@instantdb/core 0.22.88-experimental.drewh-entity-caching.20249092034.1 → 0.22.88-experimental.drewh-fix-explorer.20249092035.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/src/instaql.bench.js +2 -80
- package/dist/commonjs/store.d.ts +1 -1
- package/dist/commonjs/store.d.ts.map +1 -1
- package/dist/commonjs/store.js +0 -5
- package/dist/commonjs/store.js.map +1 -1
- package/dist/esm/store.d.ts +1 -1
- package/dist/esm/store.d.ts.map +1 -1
- package/dist/esm/store.js +0 -5
- package/dist/esm/store.js.map +1 -1
- package/dist/standalone/index.js +722 -725
- package/dist/standalone/index.umd.cjs +3 -3
- package/package.json +2 -2
- package/src/store.ts +0 -6
- package/__tests__/src/instaqlCache.test.ts +0 -78
package/dist/standalone/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var w = (t, e, n) =>
|
|
1
|
+
var Bn = Object.defineProperty;
|
|
2
|
+
var Hn = (t, e, n) => e in t ? Bn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var w = (t, e, n) => Hn(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
4
|
function P(t) {
|
|
5
5
|
if (typeof t == "number")
|
|
6
6
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
@@ -40,14 +40,14 @@ const A = {
|
|
|
40
40
|
Remove: "remove",
|
|
41
41
|
Replace: "replace",
|
|
42
42
|
Add: "add"
|
|
43
|
-
},
|
|
43
|
+
}, nn = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Jn = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Te = Symbol.iterator, L = {
|
|
44
44
|
mutable: "mutable",
|
|
45
45
|
immutable: "immutable"
|
|
46
|
-
},
|
|
46
|
+
}, it = {};
|
|
47
47
|
function ue(t, e) {
|
|
48
48
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function St(t, e) {
|
|
51
51
|
if (e in t) {
|
|
52
52
|
let n = Reflect.getPrototypeOf(t);
|
|
53
53
|
for (; n; ) {
|
|
@@ -58,10 +58,10 @@ function Ot(t, e) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function ot(t) {
|
|
62
62
|
return Object.getPrototypeOf(t) === Set.prototype;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function at(t) {
|
|
65
65
|
return Object.getPrototypeOf(t) === Map.prototype;
|
|
66
66
|
}
|
|
67
67
|
function U(t) {
|
|
@@ -72,9 +72,9 @@ function Y(t) {
|
|
|
72
72
|
return !!S(t);
|
|
73
73
|
}
|
|
74
74
|
function S(t) {
|
|
75
|
-
return typeof t != "object" ? null : t == null ? void 0 : t[
|
|
75
|
+
return typeof t != "object" ? null : t == null ? void 0 : t[nn];
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function ct(t) {
|
|
78
78
|
var e;
|
|
79
79
|
const n = S(t);
|
|
80
80
|
return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
|
|
@@ -85,7 +85,7 @@ function K(t, e) {
|
|
|
85
85
|
let n;
|
|
86
86
|
return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((n = e.mark(t, L)) === L.immutable || typeof n == "function");
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function rn(t, e = []) {
|
|
89
89
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
90
90
|
const n = t.parent.copy, r = S(Q(n, t.key));
|
|
91
91
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
@@ -96,10 +96,10 @@ function sn(t, e = []) {
|
|
|
96
96
|
e.push(i);
|
|
97
97
|
}
|
|
98
98
|
if (t.parent)
|
|
99
|
-
return
|
|
99
|
+
return rn(t.parent, e);
|
|
100
100
|
e.reverse();
|
|
101
101
|
try {
|
|
102
|
-
|
|
102
|
+
Yn(t.copy, e);
|
|
103
103
|
} catch {
|
|
104
104
|
return null;
|
|
105
105
|
}
|
|
@@ -114,14 +114,14 @@ function Q(t, e) {
|
|
|
114
114
|
function pe(t, e, n) {
|
|
115
115
|
Z(t) === 2 ? t.set(e, n) : t[e] = n;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function xe(t, e) {
|
|
118
118
|
const n = S(t);
|
|
119
119
|
return (n ? U(n) : t)[e];
|
|
120
120
|
}
|
|
121
121
|
function W(t, e) {
|
|
122
122
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function Ke(t) {
|
|
125
125
|
if (t)
|
|
126
126
|
for (; t.finalities.revoke.length > 0; )
|
|
127
127
|
t.finalities.revoke.pop()();
|
|
@@ -132,7 +132,7 @@ function H(t, e) {
|
|
|
132
132
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
133
133
|
}).join("/");
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function Yn(t, e) {
|
|
136
136
|
for (let n = 0; n < e.length - 1; n += 1) {
|
|
137
137
|
const r = e[n];
|
|
138
138
|
if (t = Q(Z(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
|
|
@@ -140,7 +140,7 @@ function Zn(t, e) {
|
|
|
140
140
|
}
|
|
141
141
|
return t;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Zn(t) {
|
|
144
144
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
145
145
|
return Reflect.ownKeys(t).forEach((n) => {
|
|
146
146
|
let r = Reflect.getOwnPropertyDescriptor(t, n);
|
|
@@ -156,26 +156,26 @@ function Xn(t) {
|
|
|
156
156
|
}), Reflect.defineProperty(e, n, r);
|
|
157
157
|
}), e;
|
|
158
158
|
}
|
|
159
|
-
const
|
|
160
|
-
function
|
|
159
|
+
const Xn = Object.prototype.propertyIsEnumerable;
|
|
160
|
+
function sn(t, e) {
|
|
161
161
|
let n;
|
|
162
162
|
if (Array.isArray(t))
|
|
163
163
|
return Array.prototype.concat.call(t);
|
|
164
164
|
if (t instanceof Set) {
|
|
165
|
-
if (!
|
|
165
|
+
if (!ot(t)) {
|
|
166
166
|
const r = Object.getPrototypeOf(t).constructor;
|
|
167
167
|
return new r(t.values());
|
|
168
168
|
}
|
|
169
169
|
return Set.prototype.difference ? Set.prototype.difference.call(t, /* @__PURE__ */ new Set()) : new Set(t.values());
|
|
170
170
|
} else if (t instanceof Map) {
|
|
171
|
-
if (!
|
|
171
|
+
if (!at(t)) {
|
|
172
172
|
const r = Object.getPrototypeOf(t).constructor;
|
|
173
173
|
return new r(t);
|
|
174
174
|
}
|
|
175
175
|
return new Map(t);
|
|
176
176
|
} else if (e != null && e.mark && (n = e.mark(t, L), n !== void 0) && n !== L.mutable) {
|
|
177
177
|
if (n === L.immutable)
|
|
178
|
-
return
|
|
178
|
+
return Zn(t);
|
|
179
179
|
if (typeof n == "function") {
|
|
180
180
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
181
181
|
throw new Error("You can't use mark and patches or auto freeze together.");
|
|
@@ -187,17 +187,17 @@ function on(t, e) {
|
|
|
187
187
|
return Object.keys(t).forEach((s) => {
|
|
188
188
|
r[s] = t[s];
|
|
189
189
|
}), Object.getOwnPropertySymbols(t).forEach((s) => {
|
|
190
|
-
|
|
190
|
+
Xn.call(t, s) && (r[s] = t[s]);
|
|
191
191
|
}), r;
|
|
192
192
|
} else
|
|
193
193
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
194
194
|
}
|
|
195
195
|
function j(t) {
|
|
196
|
-
t.copy || (t.copy =
|
|
196
|
+
t.copy || (t.copy = sn(t.original, t.options));
|
|
197
197
|
}
|
|
198
198
|
function oe(t) {
|
|
199
199
|
if (!K(t))
|
|
200
|
-
return
|
|
200
|
+
return ct(t);
|
|
201
201
|
if (Array.isArray(t))
|
|
202
202
|
return t.map(oe);
|
|
203
203
|
if (t instanceof Map) {
|
|
@@ -205,7 +205,7 @@ function oe(t) {
|
|
|
205
205
|
r,
|
|
206
206
|
oe(s)
|
|
207
207
|
]);
|
|
208
|
-
if (!
|
|
208
|
+
if (!at(t)) {
|
|
209
209
|
const r = Object.getPrototypeOf(t).constructor;
|
|
210
210
|
return new r(n);
|
|
211
211
|
}
|
|
@@ -213,7 +213,7 @@ function oe(t) {
|
|
|
213
213
|
}
|
|
214
214
|
if (t instanceof Set) {
|
|
215
215
|
const n = Array.from(t).map(oe);
|
|
216
|
-
if (!
|
|
216
|
+
if (!ot(t)) {
|
|
217
217
|
const r = Object.getPrototypeOf(t).constructor;
|
|
218
218
|
return new r(n);
|
|
219
219
|
}
|
|
@@ -231,7 +231,7 @@ function z(t) {
|
|
|
231
231
|
var e;
|
|
232
232
|
t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && z(t.parent));
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function Ot() {
|
|
235
235
|
throw new Error("Cannot modify frozen object");
|
|
236
236
|
}
|
|
237
237
|
function X(t, e, n, r, s) {
|
|
@@ -259,12 +259,12 @@ function X(t, e, n, r, s) {
|
|
|
259
259
|
case 2:
|
|
260
260
|
for (const [a, c] of t)
|
|
261
261
|
X(a, a, n, r, s), X(c, a, n, r, s);
|
|
262
|
-
t.set = t.clear = t.delete =
|
|
262
|
+
t.set = t.clear = t.delete = Ot;
|
|
263
263
|
break;
|
|
264
264
|
case 3:
|
|
265
265
|
for (const a of t)
|
|
266
266
|
X(a, a, n, r, s);
|
|
267
|
-
t.add = t.clear = t.delete =
|
|
267
|
+
t.add = t.clear = t.delete = Ot;
|
|
268
268
|
break;
|
|
269
269
|
case 1:
|
|
270
270
|
Object.freeze(t);
|
|
@@ -280,7 +280,7 @@ function X(t, e, n, r, s) {
|
|
|
280
280
|
}
|
|
281
281
|
r.pop(), s.pop();
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function ut(t, e) {
|
|
284
284
|
const n = Z(t);
|
|
285
285
|
if (n === 0)
|
|
286
286
|
Reflect.ownKeys(t).forEach((r) => {
|
|
@@ -293,11 +293,11 @@ function lt(t, e) {
|
|
|
293
293
|
} else
|
|
294
294
|
t.forEach((r, s) => e(s, r, t));
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function on(t, e, n) {
|
|
297
297
|
if (Y(t) || !K(t, n) || e.has(t) || Object.isFrozen(t))
|
|
298
298
|
return;
|
|
299
299
|
const r = t instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
|
|
300
|
-
if (e.add(t),
|
|
300
|
+
if (e.add(t), ut(t, (i, o) => {
|
|
301
301
|
var a;
|
|
302
302
|
if (Y(o)) {
|
|
303
303
|
const c = S(o);
|
|
@@ -305,7 +305,7 @@ function an(t, e, n) {
|
|
|
305
305
|
const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
|
|
306
306
|
pe(r ? s : t, i, u);
|
|
307
307
|
} else
|
|
308
|
-
|
|
308
|
+
on(o, e, n);
|
|
309
309
|
}), s) {
|
|
310
310
|
const i = t, o = Array.from(i);
|
|
311
311
|
i.clear(), o.forEach((a) => {
|
|
@@ -313,39 +313,39 @@ function an(t, e, n) {
|
|
|
313
313
|
});
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function er(t, e) {
|
|
317
317
|
const n = t.type === 3 ? t.setMap : t.copy;
|
|
318
|
-
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n &&
|
|
318
|
+
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && on(Q(n, e), t.finalities.handledSet, t.options);
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function qe(t) {
|
|
321
321
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
322
|
-
t.copy.add(
|
|
322
|
+
t.copy.add(ct(e));
|
|
323
323
|
}));
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function ze(t, e, n, r) {
|
|
326
326
|
if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
|
|
327
327
|
if (n && r) {
|
|
328
|
-
const i =
|
|
328
|
+
const i = rn(t);
|
|
329
329
|
i && e(t, i, n, r);
|
|
330
330
|
}
|
|
331
331
|
t.finalized = !0;
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function lt(t, e, n, r) {
|
|
335
335
|
const s = S(n);
|
|
336
336
|
s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
|
|
337
337
|
var a;
|
|
338
338
|
const c = t.type === 3 ? t.setMap : t.copy;
|
|
339
339
|
if (W(Q(c, e), n)) {
|
|
340
340
|
let u = s.original;
|
|
341
|
-
s.copy && (u = s.copy),
|
|
341
|
+
s.copy && (u = s.copy), qe(t), ze(t, r, i, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(u, s.original)), pe(c, e, u);
|
|
342
342
|
}
|
|
343
343
|
}), t.options.enableAutoFreeze && s.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), K(n, t.options) && t.finalities.draft.push(() => {
|
|
344
344
|
const i = t.type === 3 ? t.setMap : t.copy;
|
|
345
|
-
W(Q(i, e), n) &&
|
|
345
|
+
W(Q(i, e), n) && er(t, e);
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
|
-
function
|
|
348
|
+
function tr(t, e, n, r, s) {
|
|
349
349
|
let { original: i, assignedMap: o, options: a } = t, c = t.copy;
|
|
350
350
|
c.length < i.length && ([i, c] = [c, i], [n, r] = [r, n]);
|
|
351
351
|
for (let u = 0; u < i.length; u += 1)
|
|
@@ -391,7 +391,7 @@ function nr(t, e, n, r, s) {
|
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function nr({ original: t, copy: e, assignedMap: n }, r, s, i, o) {
|
|
395
395
|
n.forEach((a, c) => {
|
|
396
396
|
const u = Q(t, c), l = me(Q(e, c)), f = a ? ue(t, c) ? A.Replace : A.Add : A.Remove;
|
|
397
397
|
if (W(u, l) && f === A.Replace)
|
|
@@ -400,7 +400,7 @@ function rr({ original: t, copy: e, assignedMap: n }, r, s, i, o) {
|
|
|
400
400
|
s.push(f === A.Remove ? { op: f, path: h } : { op: f, path: h, value: l }), i.push(f === A.Add ? { op: A.Remove, path: h } : f === A.Remove ? { op: A.Add, path: h, value: u } : { op: A.Replace, path: h, value: u });
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function rr({ original: t, copy: e }, n, r, s, i) {
|
|
404
404
|
let o = 0;
|
|
405
405
|
t.forEach((a) => {
|
|
406
406
|
if (!e.has(a)) {
|
|
@@ -437,17 +437,17 @@ function de(t, e, n, r) {
|
|
|
437
437
|
switch (t.type) {
|
|
438
438
|
case 0:
|
|
439
439
|
case 2:
|
|
440
|
-
return rr(t, e, n, r, s);
|
|
441
|
-
case 1:
|
|
442
440
|
return nr(t, e, n, r, s);
|
|
441
|
+
case 1:
|
|
442
|
+
return tr(t, e, n, r, s);
|
|
443
443
|
case 3:
|
|
444
|
-
return
|
|
444
|
+
return rr(t, e, n, r, s);
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
const ve = (t, e, n = !1) => {
|
|
448
448
|
if (typeof t == "object" && t !== null && (!K(t, e) || n))
|
|
449
449
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
450
|
-
},
|
|
450
|
+
}, Ve = {
|
|
451
451
|
get size() {
|
|
452
452
|
return U(S(this)).size;
|
|
453
453
|
},
|
|
@@ -456,7 +456,7 @@ const ve = (t, e, n = !1) => {
|
|
|
456
456
|
},
|
|
457
457
|
set(t, e) {
|
|
458
458
|
const n = S(this), r = U(n);
|
|
459
|
-
return (!r.has(t) || !W(r.get(t), e)) && (j(n), z(n), n.assignedMap.set(t, !0), n.copy.set(t, e),
|
|
459
|
+
return (!r.has(t) || !W(r.get(t), e)) && (j(n), z(n), n.assignedMap.set(t, !0), n.copy.set(t, e), lt(n, t, e, de)), this;
|
|
460
460
|
},
|
|
461
461
|
delete(t) {
|
|
462
462
|
if (!this.has(t))
|
|
@@ -484,7 +484,7 @@ const ve = (t, e, n = !1) => {
|
|
|
484
484
|
const r = S(this), s = U(r).get(t), i = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, s, L)) === L.mutable;
|
|
485
485
|
if (r.options.strict && ve(s, r.options, i), i || r.finalized || !K(s, r.options) || s !== r.original.get(t))
|
|
486
486
|
return s;
|
|
487
|
-
const o =
|
|
487
|
+
const o = it.createDraft({
|
|
488
488
|
original: s,
|
|
489
489
|
parentDraft: r,
|
|
490
490
|
key: t,
|
|
@@ -528,7 +528,7 @@ const ve = (t, e, n = !1) => {
|
|
|
528
528
|
[Te]() {
|
|
529
529
|
return this.entries();
|
|
530
530
|
}
|
|
531
|
-
},
|
|
531
|
+
}, sr = Reflect.ownKeys(Ve), vt = (t, e, { isValuesIterator: n }) => () => {
|
|
532
532
|
var r, s;
|
|
533
533
|
const i = e.next();
|
|
534
534
|
if (i.done)
|
|
@@ -537,7 +537,7 @@ const ve = (t, e, n = !1) => {
|
|
|
537
537
|
let a = t.setMap.get(o);
|
|
538
538
|
const c = S(a), u = ((s = (r = t.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, L)) === L.mutable;
|
|
539
539
|
if (t.options.strict && ve(o, t.options, u), !u && !c && K(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
540
|
-
const l =
|
|
540
|
+
const l = it.createDraft({
|
|
541
541
|
original: o,
|
|
542
542
|
parentDraft: t,
|
|
543
543
|
key: o,
|
|
@@ -564,7 +564,7 @@ const ve = (t, e, n = !1) => {
|
|
|
564
564
|
},
|
|
565
565
|
add(t) {
|
|
566
566
|
const e = S(this);
|
|
567
|
-
return this.has(t) || (j(e), z(e), e.assignedMap.set(t, !0), e.setMap.set(t, t),
|
|
567
|
+
return this.has(t) || (j(e), z(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), lt(e, t, t, de)), this;
|
|
568
568
|
},
|
|
569
569
|
delete(t) {
|
|
570
570
|
if (!this.has(t))
|
|
@@ -589,7 +589,7 @@ const ve = (t, e, n = !1) => {
|
|
|
589
589
|
const e = t.setMap.keys();
|
|
590
590
|
return {
|
|
591
591
|
[Symbol.iterator]: () => this.values(),
|
|
592
|
-
next:
|
|
592
|
+
next: vt(t, e, { isValuesIterator: !0 })
|
|
593
593
|
};
|
|
594
594
|
},
|
|
595
595
|
entries() {
|
|
@@ -598,7 +598,7 @@ const ve = (t, e, n = !1) => {
|
|
|
598
598
|
const e = t.setMap.keys();
|
|
599
599
|
return {
|
|
600
600
|
[Symbol.iterator]: () => this.entries(),
|
|
601
|
-
next:
|
|
601
|
+
next: vt(t, e, {
|
|
602
602
|
isValuesIterator: !1
|
|
603
603
|
})
|
|
604
604
|
};
|
|
@@ -639,13 +639,13 @@ Set.prototype.difference && Object.assign(Ae, {
|
|
|
639
639
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
|
|
640
640
|
}
|
|
641
641
|
});
|
|
642
|
-
const
|
|
642
|
+
const ir = Reflect.ownKeys(Ae), an = /* @__PURE__ */ new WeakSet(), cn = {
|
|
643
643
|
get(t, e, n) {
|
|
644
644
|
var r, s;
|
|
645
645
|
const i = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
|
|
646
|
-
if (i &&
|
|
646
|
+
if (i && an.has(i))
|
|
647
647
|
return i;
|
|
648
|
-
if (e ===
|
|
648
|
+
if (e === nn)
|
|
649
649
|
return t;
|
|
650
650
|
let o;
|
|
651
651
|
if (t.options.mark) {
|
|
@@ -654,14 +654,14 @@ const or = Reflect.ownKeys(Ae), cn = /* @__PURE__ */ new WeakSet(), un = {
|
|
|
654
654
|
return t.options.strict && ve(u, t.options, !0), u;
|
|
655
655
|
}
|
|
656
656
|
const a = U(t);
|
|
657
|
-
if (a instanceof Map &&
|
|
657
|
+
if (a instanceof Map && sr.includes(e)) {
|
|
658
658
|
if (e === "size")
|
|
659
|
-
return Object.getOwnPropertyDescriptor(
|
|
660
|
-
const u =
|
|
659
|
+
return Object.getOwnPropertyDescriptor(Ve, "size").get.call(t.proxy);
|
|
660
|
+
const u = Ve[e];
|
|
661
661
|
if (u)
|
|
662
662
|
return u.bind(t.proxy);
|
|
663
663
|
}
|
|
664
|
-
if (a instanceof Set &&
|
|
664
|
+
if (a instanceof Set && ir.includes(e)) {
|
|
665
665
|
if (e === "size")
|
|
666
666
|
return Object.getOwnPropertyDescriptor(Ae, "size").get.call(t.proxy);
|
|
667
667
|
const u = Ae[e];
|
|
@@ -669,7 +669,7 @@ const or = Reflect.ownKeys(Ae), cn = /* @__PURE__ */ new WeakSet(), un = {
|
|
|
669
669
|
return u.bind(t.proxy);
|
|
670
670
|
}
|
|
671
671
|
if (!ue(a, e)) {
|
|
672
|
-
const u =
|
|
672
|
+
const u = St(a, e);
|
|
673
673
|
return u ? "value" in u ? u.value : (
|
|
674
674
|
// !case: support for getter
|
|
675
675
|
(s = u.get) === null || s === void 0 ? void 0 : s.call(t.proxy)
|
|
@@ -678,8 +678,8 @@ const or = Reflect.ownKeys(Ae), cn = /* @__PURE__ */ new WeakSet(), un = {
|
|
|
678
678
|
const c = a[e];
|
|
679
679
|
if (t.options.strict && ve(c, t.options), t.finalized || !K(c, t.options))
|
|
680
680
|
return c;
|
|
681
|
-
if (c ===
|
|
682
|
-
if (j(t), t.copy[e] =
|
|
681
|
+
if (c === xe(t.original, e)) {
|
|
682
|
+
if (j(t), t.copy[e] = ft({
|
|
683
683
|
original: t.original[e],
|
|
684
684
|
parentDraft: t,
|
|
685
685
|
key: t.type === 1 ? Number(e) : e,
|
|
@@ -700,11 +700,11 @@ const or = Reflect.ownKeys(Ae), cn = /* @__PURE__ */ new WeakSet(), un = {
|
|
|
700
700
|
let s;
|
|
701
701
|
if (t.type === 1 && e !== "length" && !(Number.isInteger(s = Number(e)) && s >= 0 && (e === 0 || s === 0 || String(s) === String(e))))
|
|
702
702
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
703
|
-
const i =
|
|
703
|
+
const i = St(U(t), e);
|
|
704
704
|
if (i != null && i.set)
|
|
705
705
|
return i.set.call(t.proxy, n), !0;
|
|
706
|
-
const o =
|
|
707
|
-
return a && W(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (W(n, o) && (n !== void 0 || ue(t.original, e)) || (j(t), z(t), ue(t.original, e) && W(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n,
|
|
706
|
+
const o = xe(U(t), e), a = S(o);
|
|
707
|
+
return a && W(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (W(n, o) && (n !== void 0 || ue(t.original, e)) || (j(t), z(t), ue(t.original, e) && W(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, lt(t, e, n, de)), !0);
|
|
708
708
|
},
|
|
709
709
|
has(t, e) {
|
|
710
710
|
return e in U(t);
|
|
@@ -732,10 +732,10 @@ const or = Reflect.ownKeys(Ae), cn = /* @__PURE__ */ new WeakSet(), un = {
|
|
|
732
732
|
},
|
|
733
733
|
deleteProperty(t, e) {
|
|
734
734
|
var n;
|
|
735
|
-
return t.type === 1 ?
|
|
735
|
+
return t.type === 1 ? cn.set.call(this, t, e, void 0, t.proxy) : (xe(t.original, e) !== void 0 || e in t.original ? (j(t), z(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
|
|
736
736
|
}
|
|
737
737
|
};
|
|
738
|
-
function
|
|
738
|
+
function ft(t) {
|
|
739
739
|
const { original: e, parentDraft: n, key: r, finalities: s, options: i } = t, o = Z(e), a = {
|
|
740
740
|
type: o,
|
|
741
741
|
finalized: !1,
|
|
@@ -749,8 +749,8 @@ function dt(t) {
|
|
|
749
749
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
750
750
|
};
|
|
751
751
|
(r || "key" in t) && (a.key = r);
|
|
752
|
-
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a,
|
|
753
|
-
if (s.revoke.push(u),
|
|
752
|
+
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, cn);
|
|
753
|
+
if (s.revoke.push(u), an.add(c), a.proxy = c, n) {
|
|
754
754
|
const l = n;
|
|
755
755
|
l.finalities.draft.push((f, d) => {
|
|
756
756
|
var h, p;
|
|
@@ -759,7 +759,7 @@ function dt(t) {
|
|
|
759
759
|
const y = Q(_, r), g = S(y);
|
|
760
760
|
if (g) {
|
|
761
761
|
let T = g.original;
|
|
762
|
-
g.operated && (T =
|
|
762
|
+
g.operated && (T = ct(y)), qe(g), ze(g, de, f, d), l.options.enableAutoFreeze && (l.options.updatedValues = (h = l.options.updatedValues) !== null && h !== void 0 ? h : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(T, g.original)), pe(_, r, T);
|
|
763
763
|
}
|
|
764
764
|
(p = b.callbacks) === null || p === void 0 || p.forEach((T) => {
|
|
765
765
|
T(f, d);
|
|
@@ -768,26 +768,26 @@ function dt(t) {
|
|
|
768
768
|
} else {
|
|
769
769
|
const l = S(c);
|
|
770
770
|
l.finalities.draft.push((f, d) => {
|
|
771
|
-
|
|
771
|
+
qe(l), ze(l, de, f, d);
|
|
772
772
|
});
|
|
773
773
|
}
|
|
774
774
|
return c;
|
|
775
775
|
}
|
|
776
|
-
|
|
777
|
-
function
|
|
776
|
+
it.createDraft = ft;
|
|
777
|
+
function or(t, e, n, r, s) {
|
|
778
778
|
var i;
|
|
779
779
|
const o = S(t), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : t, c = !!e.length;
|
|
780
780
|
if (o != null && o.operated)
|
|
781
781
|
for (; o.finalities.draft.length > 0; )
|
|
782
782
|
o.finalities.draft.pop()(n, r);
|
|
783
783
|
const u = c ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
784
|
-
return o &&
|
|
784
|
+
return o && Ke(o), s && X(u, u, o == null ? void 0 : o.options.updatedValues), [
|
|
785
785
|
u,
|
|
786
786
|
n && c ? [{ op: A.Replace, path: [], value: e[0] }] : n,
|
|
787
787
|
r && c ? [{ op: A.Replace, path: [], value: a }] : r
|
|
788
788
|
];
|
|
789
789
|
}
|
|
790
|
-
function
|
|
790
|
+
function ar(t, e) {
|
|
791
791
|
var n;
|
|
792
792
|
const r = {
|
|
793
793
|
draft: [],
|
|
@@ -796,7 +796,7 @@ function cr(t, e) {
|
|
|
796
796
|
};
|
|
797
797
|
let s, i;
|
|
798
798
|
e.enablePatches && (s = [], i = []);
|
|
799
|
-
const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, L)) === L.mutable || !K(t, e) ? t :
|
|
799
|
+
const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, L)) === L.mutable || !K(t, e) ? t : ft({
|
|
800
800
|
original: t,
|
|
801
801
|
parentDraft: null,
|
|
802
802
|
finalities: r,
|
|
@@ -805,14 +805,14 @@ function cr(t, e) {
|
|
|
805
805
|
return [
|
|
806
806
|
a,
|
|
807
807
|
(c = []) => {
|
|
808
|
-
const [u, l, f] =
|
|
808
|
+
const [u, l, f] = or(a, c, s, i, e.enableAutoFreeze);
|
|
809
809
|
return e.enablePatches ? [u, l, f] : u;
|
|
810
810
|
}
|
|
811
811
|
];
|
|
812
812
|
}
|
|
813
|
-
function
|
|
813
|
+
function We(t) {
|
|
814
814
|
const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: s = !0 } = t;
|
|
815
|
-
|
|
815
|
+
ut(n, (i, o, a) => {
|
|
816
816
|
const c = S(o);
|
|
817
817
|
if (c && e && c.finalities === e.finalities) {
|
|
818
818
|
t.isContainDraft = !0;
|
|
@@ -822,10 +822,10 @@ function Qe(t) {
|
|
|
822
822
|
a.clear(), l.forEach((f) => a.add(i === f ? u : f));
|
|
823
823
|
} else
|
|
824
824
|
pe(a, i, u);
|
|
825
|
-
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1,
|
|
825
|
+
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, We(t));
|
|
826
826
|
}), s && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function un(t) {
|
|
829
829
|
var e;
|
|
830
830
|
const n = S(t);
|
|
831
831
|
if (!K(t, n == null ? void 0 : n.options))
|
|
@@ -835,7 +835,7 @@ function ln(t) {
|
|
|
835
835
|
return n.original;
|
|
836
836
|
let s;
|
|
837
837
|
function i() {
|
|
838
|
-
s = r === 2 ?
|
|
838
|
+
s = r === 2 ? at(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : sn(t, n == null ? void 0 : n.options);
|
|
839
839
|
}
|
|
840
840
|
if (n) {
|
|
841
841
|
n.finalized = !0;
|
|
@@ -846,23 +846,23 @@ function ln(t) {
|
|
|
846
846
|
}
|
|
847
847
|
} else
|
|
848
848
|
s = t;
|
|
849
|
-
if (
|
|
849
|
+
if (ut(s, (o, a) => {
|
|
850
850
|
if (n && W(Q(n.original, o), a))
|
|
851
851
|
return;
|
|
852
|
-
const c =
|
|
852
|
+
const c = un(a);
|
|
853
853
|
c !== a && (s === t && i(), pe(s, o, c));
|
|
854
854
|
}), r === 3) {
|
|
855
855
|
const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : s;
|
|
856
|
-
return
|
|
856
|
+
return ot(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
|
|
857
857
|
}
|
|
858
858
|
return s;
|
|
859
859
|
}
|
|
860
|
-
function
|
|
860
|
+
function At(t) {
|
|
861
861
|
if (!Y(t))
|
|
862
862
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
863
|
-
return
|
|
863
|
+
return un(t);
|
|
864
864
|
}
|
|
865
|
-
const
|
|
865
|
+
const cr = (t) => function e(n, r, s) {
|
|
866
866
|
var i, o, a;
|
|
867
867
|
if (typeof n == "function" && typeof r != "function")
|
|
868
868
|
return function(m, ...M) {
|
|
@@ -873,7 +873,7 @@ const ur = (t) => function e(n, r, s) {
|
|
|
873
873
|
if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
|
|
874
874
|
throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
|
|
875
875
|
l = Object.assign(Object.assign({}, t), l);
|
|
876
|
-
const f = Y(c) ?
|
|
876
|
+
const f = Y(c) ? At(c) : c, d = Array.isArray(l.mark) ? (m, M) => {
|
|
877
877
|
for (const I of l.mark) {
|
|
878
878
|
if (typeof I != "function")
|
|
879
879
|
throw new Error(`Invalid mark: ${I}, 'mark' should be a function.`);
|
|
@@ -889,7 +889,7 @@ const ur = (t) => function e(n, r, s) {
|
|
|
889
889
|
};
|
|
890
890
|
if (!K(f, _) && typeof f == "object" && f !== null)
|
|
891
891
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
892
|
-
const [y, g] =
|
|
892
|
+
const [y, g] = ar(f, _);
|
|
893
893
|
if (typeof r != "function") {
|
|
894
894
|
if (!K(f, _))
|
|
895
895
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
@@ -899,24 +899,24 @@ const ur = (t) => function e(n, r, s) {
|
|
|
899
899
|
try {
|
|
900
900
|
T = u(y);
|
|
901
901
|
} catch (m) {
|
|
902
|
-
throw
|
|
902
|
+
throw Ke(S(y)), m;
|
|
903
903
|
}
|
|
904
904
|
const v = (m) => {
|
|
905
905
|
const M = S(y);
|
|
906
906
|
if (!Y(m)) {
|
|
907
907
|
if (m !== void 0 && !W(m, y) && (M != null && M.operated))
|
|
908
908
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
909
|
-
const B = m == null ? void 0 : m[
|
|
909
|
+
const B = m == null ? void 0 : m[Jn];
|
|
910
910
|
if (B) {
|
|
911
911
|
const De = B[0];
|
|
912
|
-
return _.strict && typeof m == "object" && m !== null &&
|
|
912
|
+
return _.strict && typeof m == "object" && m !== null && We({
|
|
913
913
|
rootDraft: M,
|
|
914
914
|
value: m,
|
|
915
915
|
useRawReturn: !0
|
|
916
916
|
}), g([De]);
|
|
917
917
|
}
|
|
918
918
|
if (m !== void 0)
|
|
919
|
-
return typeof m == "object" && m !== null &&
|
|
919
|
+
return typeof m == "object" && m !== null && We({ rootDraft: M, value: m }), g([m]);
|
|
920
920
|
}
|
|
921
921
|
if (m === y || m === void 0)
|
|
922
922
|
return g([]);
|
|
@@ -924,30 +924,30 @@ const ur = (t) => function e(n, r, s) {
|
|
|
924
924
|
if (_ === I.options) {
|
|
925
925
|
if (I.operated)
|
|
926
926
|
throw new Error("Cannot return a modified child draft.");
|
|
927
|
-
return g([
|
|
927
|
+
return g([At(m)]);
|
|
928
928
|
}
|
|
929
929
|
return g([m]);
|
|
930
930
|
};
|
|
931
931
|
return T instanceof Promise ? T.then(v, (m) => {
|
|
932
|
-
throw
|
|
932
|
+
throw Ke(S(y)), m;
|
|
933
933
|
}) : v(T);
|
|
934
|
-
}, ke =
|
|
934
|
+
}, ke = cr();
|
|
935
935
|
Object.prototype.constructor.toString();
|
|
936
|
-
function
|
|
936
|
+
function ln(t, e) {
|
|
937
937
|
const n = Object.keys(t), r = Object.keys(e);
|
|
938
938
|
return n.length === r.length && Object.keys(t).every((s) => e.hasOwnProperty(s));
|
|
939
939
|
}
|
|
940
|
-
function
|
|
940
|
+
function kt(t, e) {
|
|
941
941
|
return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every(
|
|
942
942
|
(n) => e.hasOwnProperty(n) && t[n] === e[n]
|
|
943
943
|
);
|
|
944
944
|
}
|
|
945
945
|
function Se(t, e) {
|
|
946
|
-
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e :
|
|
946
|
+
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : ln(t, e) ? Object.keys(t).every(
|
|
947
947
|
(n) => Se(t[n], e[n])
|
|
948
948
|
) : !1;
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function dt(t) {
|
|
951
951
|
if (!ae(t))
|
|
952
952
|
return t;
|
|
953
953
|
const e = {};
|
|
@@ -955,7 +955,7 @@ function ht(t) {
|
|
|
955
955
|
r !== void 0 && (e[n] = r);
|
|
956
956
|
return e;
|
|
957
957
|
}
|
|
958
|
-
function
|
|
958
|
+
function fn(t, e) {
|
|
959
959
|
if (!ae(t) || !ae(e))
|
|
960
960
|
return e;
|
|
961
961
|
const n = { ...t };
|
|
@@ -966,14 +966,14 @@ function dn(t, e) {
|
|
|
966
966
|
continue;
|
|
967
967
|
}
|
|
968
968
|
const s = ae(t[r]) && ae(e[r]);
|
|
969
|
-
n[r] = s ?
|
|
969
|
+
n[r] = s ? fn(t[r], e[r]) : e[r];
|
|
970
970
|
}
|
|
971
971
|
return n;
|
|
972
972
|
}
|
|
973
973
|
function ae(t) {
|
|
974
974
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
975
975
|
}
|
|
976
|
-
function
|
|
976
|
+
function ur(t, e, n) {
|
|
977
977
|
if (!t || e.length === 0)
|
|
978
978
|
return;
|
|
979
979
|
let r = t || {};
|
|
@@ -984,7 +984,7 @@ function lr(t, e, n) {
|
|
|
984
984
|
const s = e[e.length - 1];
|
|
985
985
|
Array.isArray(r) && typeof s == "number" ? r.splice(s, 0, n) : r[s] = n;
|
|
986
986
|
}
|
|
987
|
-
function
|
|
987
|
+
function Et(t, e, n) {
|
|
988
988
|
if (!t || e.length === 0)
|
|
989
989
|
return;
|
|
990
990
|
let r = t || {};
|
|
@@ -994,7 +994,7 @@ function Ct(t, e, n) {
|
|
|
994
994
|
}
|
|
995
995
|
r[e[e.length - 1]] = n;
|
|
996
996
|
}
|
|
997
|
-
function
|
|
997
|
+
function dn(t, e) {
|
|
998
998
|
if (!t || e.length === 0)
|
|
999
999
|
return;
|
|
1000
1000
|
const [n, ...r] = e;
|
|
@@ -1003,13 +1003,13 @@ function hn(t, e) {
|
|
|
1003
1003
|
Array.isArray(t) ? t.splice(n, 1) : delete t[n];
|
|
1004
1004
|
return;
|
|
1005
1005
|
}
|
|
1006
|
-
|
|
1006
|
+
dn(t[n], r), lr(t[n]) && delete t[n];
|
|
1007
1007
|
}
|
|
1008
1008
|
}
|
|
1009
|
-
function
|
|
1009
|
+
function lr(t) {
|
|
1010
1010
|
return t && Object.keys(t).length === 0;
|
|
1011
1011
|
}
|
|
1012
|
-
const
|
|
1012
|
+
const Ct = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|WAST|WAKT|WADT|VUT|VOLT|VLAT|VLAST|VET|UZT|UZST|UYT|UYST|UTC|UT|ULAT|ULAST|UCT|TVT|TRUT|TOT|TMT|TKT|TJT|TFT|TAHT|SGT|SCT|SAST|SADT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PKST|PHT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZT|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|MYT|MVT|MUT|MUST|MST|MSK|MSD|MPT|MMT|MHT|MEZ|METDST|MET|MESZ|MEST|MDT|MAWT|MART|MAGT|MAGST|LKT|LINT|LIGT|LHST|LHDT|KST|KRAT|KRAST|KOST|KGT|KGST|KDT|JST|JAYT|IST|IRT|IRKT|IRKST|IOT|IDT|ICT|HST|HKT|GYT|GMT|GILT|GFT|GET|GEST|GAMT|GALT|FNT|FNST|FKT|FKST|FJT|FJST|FET|EST|EGT|EGST|EETDST|EET|EEST|EDT|EAT|EAST|EASST|DDUT|DAVT|CXT|CST|COT|CLT|CLST|CKT|CHUT|CHAST|CHADT|CETDST|CET|CEST|CDT|CCT|CAST|CADT|BTT|BST|BRT|BRST|BRA|BOT|BORT|BNT|BDT|BDST|AZT|AZST|AZOT|AZOST|AWST|AWSST|AST|ART|ARST|ANAT|ANAST|AMT|AMST|ALMT|ALMST|AKST|AKDT|AFT|AEST|AESST|AEDT|ADT|ACWST|ACT|ACST|ACSST|ACDT$/, fr = {
|
|
1013
1013
|
ZULU: 0,
|
|
1014
1014
|
YEKT: 18e3,
|
|
1015
1015
|
YEKST: 21600,
|
|
@@ -1205,32 +1205,32 @@ const Mt = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
|
|
|
1205
1205
|
ACSST: 37800,
|
|
1206
1206
|
ACDT: 37800
|
|
1207
1207
|
};
|
|
1208
|
-
function
|
|
1208
|
+
function dr(t) {
|
|
1209
1209
|
return new Date(t);
|
|
1210
1210
|
}
|
|
1211
|
-
function
|
|
1211
|
+
function hr(t) {
|
|
1212
1212
|
return /* @__PURE__ */ new Date(t + "Z");
|
|
1213
1213
|
}
|
|
1214
|
-
const
|
|
1215
|
-
function
|
|
1216
|
-
const e = t.match(
|
|
1214
|
+
const pr = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
|
|
1215
|
+
function yr(t) {
|
|
1216
|
+
const e = t.match(pr);
|
|
1217
1217
|
if (!e)
|
|
1218
1218
|
return null;
|
|
1219
1219
|
const [n, r, s, i] = e;
|
|
1220
1220
|
return r <= 0 || s <= 0 || i <= 0 ? null : r > 999 ? new Date(Date.UTC(r, s - 1, i, 0, 0, 0, 0)) : new Date(Date.UTC(i, r - 1, s, 0, 0, 0, 0));
|
|
1221
1221
|
}
|
|
1222
|
-
function
|
|
1222
|
+
function br(t) {
|
|
1223
1223
|
const [e, n] = t.split(" ");
|
|
1224
1224
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1225
1225
|
}
|
|
1226
|
-
function
|
|
1226
|
+
function _r(t) {
|
|
1227
1227
|
const [e, n] = t.split(" ");
|
|
1228
1228
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1229
1229
|
}
|
|
1230
|
-
function
|
|
1230
|
+
function gr(t) {
|
|
1231
1231
|
return new Date(t);
|
|
1232
1232
|
}
|
|
1233
|
-
function
|
|
1233
|
+
function wr(t) {
|
|
1234
1234
|
const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
|
|
1235
1235
|
if (!t.match(e))
|
|
1236
1236
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
@@ -1247,7 +1247,7 @@ function Tr(t) {
|
|
|
1247
1247
|
)
|
|
1248
1248
|
);
|
|
1249
1249
|
}
|
|
1250
|
-
function
|
|
1250
|
+
function Tr(t) {
|
|
1251
1251
|
const e = /^(.+T.+)([+-])(\d{2})$/, n = t.match(e);
|
|
1252
1252
|
if (n) {
|
|
1253
1253
|
const [, r, s, i] = n, o = `${r}${s}${i}:00`;
|
|
@@ -1255,7 +1255,7 @@ function mr(t) {
|
|
|
1255
1255
|
}
|
|
1256
1256
|
return null;
|
|
1257
1257
|
}
|
|
1258
|
-
function
|
|
1258
|
+
function mr(t) {
|
|
1259
1259
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, n = t.match(e);
|
|
1260
1260
|
if (n) {
|
|
1261
1261
|
const [, r, s, i, o, a] = n, c = s.padStart(2, "0"), u = i.padStart(2, "0"), l = `${r}-${c}-${u}T${a}`;
|
|
@@ -1263,14 +1263,14 @@ function Sr(t) {
|
|
|
1263
1263
|
}
|
|
1264
1264
|
return null;
|
|
1265
1265
|
}
|
|
1266
|
-
function
|
|
1266
|
+
function Sr(t) {
|
|
1267
1267
|
const [e, n] = t.split(", "), [r, s, i] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1268
1268
|
if (!o)
|
|
1269
1269
|
throw new Error(`Unable to parse time from: ${t}`);
|
|
1270
1270
|
let [, a, c, u, l] = o;
|
|
1271
1271
|
return a = Number(a), c = Number(c), u = Number(u), l === "PM" && a !== 12 ? a += 12 : l === "AM" && a === 12 && (a = 0), new Date(Date.UTC(i, r - 1, s, a, c, u));
|
|
1272
1272
|
}
|
|
1273
|
-
function
|
|
1273
|
+
function Or(t) {
|
|
1274
1274
|
switch (t) {
|
|
1275
1275
|
case "epoch":
|
|
1276
1276
|
return /* @__PURE__ */ new Date(0);
|
|
@@ -1282,28 +1282,28 @@ function vr(t) {
|
|
|
1282
1282
|
return null;
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
1285
|
-
function
|
|
1286
|
-
const e = t.match(
|
|
1285
|
+
function vr(t) {
|
|
1286
|
+
const e = t.match(Ct);
|
|
1287
1287
|
if (!e)
|
|
1288
1288
|
return null;
|
|
1289
|
-
const [n] = e, r =
|
|
1289
|
+
const [n] = e, r = fr[n], s = new Date(t.replace(Ct, "Z"));
|
|
1290
1290
|
return new Date(s.getTime() - r * 1e3);
|
|
1291
1291
|
}
|
|
1292
|
-
const
|
|
1293
|
-
|
|
1292
|
+
const Ar = [
|
|
1293
|
+
yr,
|
|
1294
|
+
_r,
|
|
1295
|
+
wr,
|
|
1296
|
+
Sr,
|
|
1294
1297
|
gr,
|
|
1298
|
+
hr,
|
|
1295
1299
|
Tr,
|
|
1300
|
+
br,
|
|
1301
|
+
dr,
|
|
1296
1302
|
Or,
|
|
1297
|
-
wr,
|
|
1298
|
-
pr,
|
|
1299
|
-
mr,
|
|
1300
|
-
_r,
|
|
1301
|
-
hr,
|
|
1302
1303
|
vr,
|
|
1303
|
-
|
|
1304
|
-
Sr
|
|
1304
|
+
mr
|
|
1305
1305
|
];
|
|
1306
|
-
function
|
|
1306
|
+
function kr(t, e) {
|
|
1307
1307
|
try {
|
|
1308
1308
|
const n = t(e);
|
|
1309
1309
|
return n instanceof Date && !isNaN(n.getTime()) ? n : null;
|
|
@@ -1311,18 +1311,18 @@ function Er(t, e) {
|
|
|
1311
1311
|
return null;
|
|
1312
1312
|
}
|
|
1313
1313
|
}
|
|
1314
|
-
function
|
|
1315
|
-
for (const e of
|
|
1316
|
-
const n =
|
|
1314
|
+
function Qe(t) {
|
|
1315
|
+
for (const e of Ar) {
|
|
1316
|
+
const n = kr(e, t);
|
|
1317
1317
|
if (n)
|
|
1318
1318
|
return n;
|
|
1319
1319
|
}
|
|
1320
1320
|
return null;
|
|
1321
1321
|
}
|
|
1322
|
-
function
|
|
1322
|
+
function Er(t) {
|
|
1323
1323
|
try {
|
|
1324
1324
|
const e = JSON.parse(t);
|
|
1325
|
-
return typeof e == "string" ?
|
|
1325
|
+
return typeof e == "string" ? Qe(e) : null;
|
|
1326
1326
|
} catch {
|
|
1327
1327
|
return null;
|
|
1328
1328
|
}
|
|
@@ -1334,7 +1334,7 @@ function Me(t) {
|
|
|
1334
1334
|
if (t instanceof Date)
|
|
1335
1335
|
return t;
|
|
1336
1336
|
if (typeof t == "string") {
|
|
1337
|
-
const e =
|
|
1337
|
+
const e = Qe(t) || Er(t) || Qe(t.trim());
|
|
1338
1338
|
if (!e)
|
|
1339
1339
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1340
1340
|
return e;
|
|
@@ -1345,13 +1345,13 @@ function Me(t) {
|
|
|
1345
1345
|
);
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
|
-
function
|
|
1348
|
+
function Cr(t) {
|
|
1349
1349
|
return t.cardinality === "one";
|
|
1350
1350
|
}
|
|
1351
|
-
function
|
|
1351
|
+
function ht(t) {
|
|
1352
1352
|
return t["value-type"] === "ref";
|
|
1353
1353
|
}
|
|
1354
|
-
function
|
|
1354
|
+
function pt(t) {
|
|
1355
1355
|
return t["value-type"] === "blob";
|
|
1356
1356
|
}
|
|
1357
1357
|
function re(t, e) {
|
|
@@ -1379,7 +1379,7 @@ function D(t, e, n) {
|
|
|
1379
1379
|
let i = t.get(r);
|
|
1380
1380
|
i || (i = /* @__PURE__ */ new Map(), t.set(r, i)), D(i, s, n);
|
|
1381
1381
|
}
|
|
1382
|
-
function
|
|
1382
|
+
function hn(t, e, n) {
|
|
1383
1383
|
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
1384
1384
|
for (const o of e) {
|
|
1385
1385
|
let [a, c, u, l] = o;
|
|
@@ -1388,32 +1388,32 @@ function pn(t, e, n) {
|
|
|
1388
1388
|
console.warn("no such attr", a, t);
|
|
1389
1389
|
continue;
|
|
1390
1390
|
}
|
|
1391
|
-
f["checked-data-type"] === "date" && n && (u = Me(u), o[2] = u),
|
|
1391
|
+
f["checked-data-type"] === "date" && n && (u = Me(u), o[2] = u), ht(f) && D(i, [u, c, a], o), D(r, [a, c, u], o), D(s, [c, a, u], o);
|
|
1392
1392
|
}
|
|
1393
1393
|
return { eav: r, aev: s, vae: i };
|
|
1394
1394
|
}
|
|
1395
|
-
function
|
|
1395
|
+
function pn(t) {
|
|
1396
1396
|
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1397
1397
|
for (const i of Object.values(t)) {
|
|
1398
1398
|
const o = i["forward-identity"], [a, c, u] = o, l = i["reverse-identity"];
|
|
1399
|
-
if (D(r, [c, u], i),
|
|
1399
|
+
if (D(r, [c, u], i), pt(i) && D(e, [c, u], i), i["primary?"] && D(n, [c], i), l) {
|
|
1400
1400
|
const [f, d, h] = l;
|
|
1401
1401
|
D(s, [d, h], i);
|
|
1402
1402
|
}
|
|
1403
1403
|
}
|
|
1404
1404
|
return { blobAttrs: e, primaryKeys: n, forwardIdents: r, revIdents: s };
|
|
1405
1405
|
}
|
|
1406
|
-
function
|
|
1406
|
+
function yn(t) {
|
|
1407
1407
|
return {
|
|
1408
1408
|
__type: t.__type,
|
|
1409
1409
|
attrs: t.attrs,
|
|
1410
|
-
triples:
|
|
1410
|
+
triples: x(t.eav, 3),
|
|
1411
1411
|
cardinalityInference: t.cardinalityInference,
|
|
1412
1412
|
linkIndex: t.linkIndex,
|
|
1413
1413
|
useDateObjects: t.useDateObjects
|
|
1414
1414
|
};
|
|
1415
1415
|
}
|
|
1416
|
-
function
|
|
1416
|
+
function bn(t) {
|
|
1417
1417
|
return Oe(
|
|
1418
1418
|
t.attrs,
|
|
1419
1419
|
t.triples,
|
|
@@ -1422,19 +1422,19 @@ function _n(t) {
|
|
|
1422
1422
|
t.useDateObjects
|
|
1423
1423
|
);
|
|
1424
1424
|
}
|
|
1425
|
-
function
|
|
1425
|
+
function Mr(t, e) {
|
|
1426
1426
|
return se(t.eav, [e]) !== void 0;
|
|
1427
1427
|
}
|
|
1428
|
-
function
|
|
1429
|
-
t.attrIndexes =
|
|
1428
|
+
function yt(t) {
|
|
1429
|
+
t.attrIndexes = pn(t.attrs);
|
|
1430
1430
|
}
|
|
1431
1431
|
function Oe(t, e, n, r, s) {
|
|
1432
|
-
const i =
|
|
1432
|
+
const i = hn(
|
|
1433
1433
|
t,
|
|
1434
1434
|
e,
|
|
1435
1435
|
s
|
|
1436
1436
|
);
|
|
1437
|
-
return i.useDateObjects = s, i.attrs = t, i.attrIndexes =
|
|
1437
|
+
return i.useDateObjects = s, i.attrs = t, i.attrIndexes = pn(t), i.cardinalityInference = n, i.linkIndex = r, i.__type = "store", i;
|
|
1438
1438
|
}
|
|
1439
1439
|
function ye(t, e) {
|
|
1440
1440
|
var s, i;
|
|
@@ -1443,7 +1443,7 @@ function ye(t, e) {
|
|
|
1443
1443
|
const [o, a] = e[0], c = t.aev.get(o);
|
|
1444
1444
|
if (!c)
|
|
1445
1445
|
return null;
|
|
1446
|
-
n = (s =
|
|
1446
|
+
n = (s = x(c, 2).find((l) => l[2] === a)) == null ? void 0 : s[0];
|
|
1447
1447
|
} else
|
|
1448
1448
|
n = e[0];
|
|
1449
1449
|
if (!n)
|
|
@@ -1453,7 +1453,7 @@ function ye(t, e) {
|
|
|
1453
1453
|
const [o, a] = r, c = t.aev.get(o);
|
|
1454
1454
|
if (!c)
|
|
1455
1455
|
return null;
|
|
1456
|
-
const l = (i =
|
|
1456
|
+
const l = (i = x(c, 2).find((b) => b[2] === a)) == null ? void 0 : i[0];
|
|
1457
1457
|
if (!l)
|
|
1458
1458
|
return null;
|
|
1459
1459
|
const [f, d, h, ...p] = e;
|
|
@@ -1463,21 +1463,21 @@ function ye(t, e) {
|
|
|
1463
1463
|
return [n, ...a];
|
|
1464
1464
|
}
|
|
1465
1465
|
}
|
|
1466
|
-
function
|
|
1466
|
+
function _n(t, e) {
|
|
1467
1467
|
const n = ye(t, e);
|
|
1468
1468
|
if (!n)
|
|
1469
1469
|
return;
|
|
1470
1470
|
const [r, s, i] = n, o = re(t.attrs, s);
|
|
1471
|
-
o && (N(t.eav, [r, s, i]), N(t.aev, [s, r, i]),
|
|
1471
|
+
o && (N(t.eav, [r, s, i]), N(t.aev, [s, r, i]), ht(o) && N(t.vae, [i, s, r]));
|
|
1472
1472
|
}
|
|
1473
|
-
let
|
|
1474
|
-
function
|
|
1473
|
+
let Ir = 0;
|
|
1474
|
+
function gn(t, e, n) {
|
|
1475
1475
|
const [r, s, i] = n;
|
|
1476
1476
|
let o;
|
|
1477
1477
|
const a = se(t.eav, [r, s, i]);
|
|
1478
|
-
return a && (o = a[3]), o || Date.now() * 10 +
|
|
1478
|
+
return a && (o = a[3]), o || Date.now() * 10 + Ir++;
|
|
1479
1479
|
}
|
|
1480
|
-
function
|
|
1480
|
+
function wn(t, e) {
|
|
1481
1481
|
const n = ye(t, e);
|
|
1482
1482
|
if (!n)
|
|
1483
1483
|
return;
|
|
@@ -1486,31 +1486,31 @@ function Tn(t, e) {
|
|
|
1486
1486
|
if (!o)
|
|
1487
1487
|
return;
|
|
1488
1488
|
o["checked-data-type"] === "date" && t.useDateObjects && (i = Me(i));
|
|
1489
|
-
const a = se(t.eav, [r, s, i]), c = (a == null ? void 0 : a[3]) ??
|
|
1490
|
-
|
|
1489
|
+
const a = se(t.eav, [r, s, i]), c = (a == null ? void 0 : a[3]) ?? gn(t, o, n), u = [r, s, i, c];
|
|
1490
|
+
Cr(o) ? (D(t.eav, [r, s], /* @__PURE__ */ new Map([[i, u]])), D(t.aev, [s, r], /* @__PURE__ */ new Map([[i, u]]))) : (D(t.eav, [r, s, i], u), D(t.aev, [s, r, i], u)), ht(o) && D(t.vae, [i, s, r], u);
|
|
1491
1491
|
}
|
|
1492
|
-
function
|
|
1492
|
+
function Pr(t, e) {
|
|
1493
1493
|
var d;
|
|
1494
1494
|
const n = ye(t, e);
|
|
1495
1495
|
if (!n)
|
|
1496
1496
|
return;
|
|
1497
1497
|
const [r, s, i] = n, o = re(t.attrs, s);
|
|
1498
1498
|
if (!o) return;
|
|
1499
|
-
if (!
|
|
1499
|
+
if (!pt(o))
|
|
1500
1500
|
throw new Error("merge operation is not supported for links");
|
|
1501
1501
|
const a = se(t.eav, [r, s]);
|
|
1502
1502
|
if (!a) return;
|
|
1503
1503
|
const c = (d = a.values().next()) == null ? void 0 : d.value;
|
|
1504
1504
|
if (!c) return;
|
|
1505
|
-
const u = c[2], l =
|
|
1505
|
+
const u = c[2], l = fn(u, i), f = [
|
|
1506
1506
|
r,
|
|
1507
1507
|
s,
|
|
1508
1508
|
l,
|
|
1509
|
-
|
|
1509
|
+
gn(t, o, c)
|
|
1510
1510
|
];
|
|
1511
1511
|
D(t.eav, [r, s], /* @__PURE__ */ new Map([[l, f]]));
|
|
1512
1512
|
}
|
|
1513
|
-
function
|
|
1513
|
+
function Ge(t, e) {
|
|
1514
1514
|
var c, u;
|
|
1515
1515
|
const [n, r] = e, s = ye(t, [n]);
|
|
1516
1516
|
if (!s)
|
|
@@ -1519,10 +1519,10 @@ function Be(t, e) {
|
|
|
1519
1519
|
if (o) {
|
|
1520
1520
|
for (const l of o.keys()) {
|
|
1521
1521
|
const f = t.attrs[l];
|
|
1522
|
-
f && f["on-delete-reverse"] === "cascade" &&
|
|
1522
|
+
f && f["on-delete-reverse"] === "cascade" && x(o.get(l), 1).forEach(
|
|
1523
1523
|
([d, h, p]) => {
|
|
1524
1524
|
var b;
|
|
1525
|
-
return
|
|
1525
|
+
return Ge(t, [p, (b = f["reverse-identity"]) == null ? void 0 : b[1]]);
|
|
1526
1526
|
}
|
|
1527
1527
|
), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
1528
1528
|
// the store that didn't set `etype` in deleteEntity
|
|
@@ -1532,15 +1532,15 @@ function Be(t, e) {
|
|
|
1532
1532
|
}
|
|
1533
1533
|
o.size === 0 && N(t.eav, [i]);
|
|
1534
1534
|
}
|
|
1535
|
-
const a = t.vae.get(i) &&
|
|
1535
|
+
const a = t.vae.get(i) && x(t.vae.get(i), 2);
|
|
1536
1536
|
a && a.forEach((l) => {
|
|
1537
1537
|
var b, _, y;
|
|
1538
1538
|
const [f, d, h] = l, p = t.attrs[d];
|
|
1539
|
-
(!r || !p || ((b = p["reverse-identity"]) == null ? void 0 : b[1]) === r) && (N(t.eav, [f, d, h]), N(t.aev, [d, f, h]), N(t.vae, [h, d, f])), p && p["on-delete"] === "cascade" && ((_ = p["reverse-identity"]) == null ? void 0 : _[1]) === r &&
|
|
1539
|
+
(!r || !p || ((b = p["reverse-identity"]) == null ? void 0 : b[1]) === r) && (N(t.eav, [f, d, h]), N(t.aev, [d, f, h]), N(t.vae, [h, d, f])), p && p["on-delete"] === "cascade" && ((_ = p["reverse-identity"]) == null ? void 0 : _[1]) === r && Ge(t, [f, (y = p["forward-identity"]) == null ? void 0 : y[1]]);
|
|
1540
1540
|
}), ((u = t.vae.get(i)) == null ? void 0 : u.size) === 0 && N(t.vae, [i]);
|
|
1541
1541
|
}
|
|
1542
|
-
function
|
|
1543
|
-
const n =
|
|
1542
|
+
function Tn(t, e) {
|
|
1543
|
+
const n = hn(
|
|
1544
1544
|
t.attrs,
|
|
1545
1545
|
e,
|
|
1546
1546
|
t.useDateObjects
|
|
@@ -1549,44 +1549,44 @@ function mn(t, e) {
|
|
|
1549
1549
|
t[r] = n[r];
|
|
1550
1550
|
});
|
|
1551
1551
|
}
|
|
1552
|
-
function
|
|
1553
|
-
t.attrs[e.id] = e,
|
|
1552
|
+
function jr(t, [e]) {
|
|
1553
|
+
t.attrs[e.id] = e, yt(t);
|
|
1554
1554
|
}
|
|
1555
|
-
function
|
|
1556
|
-
return
|
|
1555
|
+
function mn(t) {
|
|
1556
|
+
return x(t.eav, 3);
|
|
1557
1557
|
}
|
|
1558
|
-
function
|
|
1558
|
+
function $r(t, [e]) {
|
|
1559
1559
|
if (!t.attrs[e]) return;
|
|
1560
|
-
const n =
|
|
1561
|
-
delete t.attrs[e],
|
|
1560
|
+
const n = mn(t).filter(([r, s]) => s !== e);
|
|
1561
|
+
delete t.attrs[e], yt(t), Tn(t, n);
|
|
1562
1562
|
}
|
|
1563
|
-
function
|
|
1563
|
+
function Dr(t, [e]) {
|
|
1564
1564
|
const n = t.attrs[e.id];
|
|
1565
|
-
n && (t.attrs[e.id] = { ...n, ...e },
|
|
1565
|
+
n && (t.attrs[e.id] = { ...n, ...e }, yt(t), Tn(t, mn(t)));
|
|
1566
1566
|
}
|
|
1567
1567
|
function xr(t, e) {
|
|
1568
1568
|
const [n, ...r] = e;
|
|
1569
1569
|
switch (n) {
|
|
1570
1570
|
case "add-triple":
|
|
1571
|
-
|
|
1571
|
+
wn(t, r);
|
|
1572
1572
|
break;
|
|
1573
1573
|
case "deep-merge-triple":
|
|
1574
|
-
|
|
1574
|
+
Pr(t, r);
|
|
1575
1575
|
break;
|
|
1576
1576
|
case "retract-triple":
|
|
1577
|
-
|
|
1577
|
+
_n(t, r);
|
|
1578
1578
|
break;
|
|
1579
1579
|
case "delete-entity":
|
|
1580
|
-
|
|
1580
|
+
Ge(t, r);
|
|
1581
1581
|
break;
|
|
1582
1582
|
case "add-attr":
|
|
1583
|
-
|
|
1583
|
+
jr(t, r);
|
|
1584
1584
|
break;
|
|
1585
1585
|
case "delete-attr":
|
|
1586
|
-
|
|
1586
|
+
$r(t, r);
|
|
1587
1587
|
break;
|
|
1588
1588
|
case "update-attr":
|
|
1589
|
-
|
|
1589
|
+
Dr(t, r);
|
|
1590
1590
|
break;
|
|
1591
1591
|
case "restore-attr":
|
|
1592
1592
|
break;
|
|
@@ -1596,7 +1596,7 @@ function xr(t, e) {
|
|
|
1596
1596
|
throw new Error(`unhandled transaction action: ${n}`);
|
|
1597
1597
|
}
|
|
1598
1598
|
}
|
|
1599
|
-
function
|
|
1599
|
+
function x(t, e, n = []) {
|
|
1600
1600
|
if (!t || e === 0)
|
|
1601
1601
|
return n;
|
|
1602
1602
|
if (e === 1) {
|
|
@@ -1605,7 +1605,7 @@ function R(t, e, n = []) {
|
|
|
1605
1605
|
return n;
|
|
1606
1606
|
}
|
|
1607
1607
|
for (const r of t.values())
|
|
1608
|
-
|
|
1608
|
+
x(r, e - 1, n);
|
|
1609
1609
|
return n;
|
|
1610
1610
|
}
|
|
1611
1611
|
function be(t, e, n) {
|
|
@@ -1633,7 +1633,7 @@ function be(t, e, n) {
|
|
|
1633
1633
|
return r;
|
|
1634
1634
|
}
|
|
1635
1635
|
if (n != null && n.$comparator)
|
|
1636
|
-
return
|
|
1636
|
+
return x(e, 1).filter(n.$op);
|
|
1637
1637
|
const s = n.in || n.$in || [n];
|
|
1638
1638
|
for (const o of s) {
|
|
1639
1639
|
const a = e.get(o);
|
|
@@ -1641,20 +1641,20 @@ function be(t, e, n) {
|
|
|
1641
1641
|
}
|
|
1642
1642
|
return r;
|
|
1643
1643
|
}
|
|
1644
|
-
function
|
|
1644
|
+
function Rr(t, e, n) {
|
|
1645
1645
|
let r = "";
|
|
1646
1646
|
return t !== void 0 && (r += "e"), e !== void 0 && (r += "a"), n !== void 0 && (r += "v"), r;
|
|
1647
1647
|
}
|
|
1648
|
-
function
|
|
1648
|
+
function Ur(t, [e, n, r]) {
|
|
1649
1649
|
var i, o;
|
|
1650
|
-
switch (
|
|
1650
|
+
switch (Rr(e, n, r)) {
|
|
1651
1651
|
case "e": {
|
|
1652
1652
|
const a = t.eav.get(e);
|
|
1653
|
-
return
|
|
1653
|
+
return x(a, 2);
|
|
1654
1654
|
}
|
|
1655
1655
|
case "ea": {
|
|
1656
1656
|
const a = (i = t.eav.get(e)) == null ? void 0 : i.get(n);
|
|
1657
|
-
return
|
|
1657
|
+
return x(a, 1);
|
|
1658
1658
|
}
|
|
1659
1659
|
case "eav": {
|
|
1660
1660
|
const a = (o = t.eav.get(e)) == null ? void 0 : o.get(n);
|
|
@@ -1671,7 +1671,7 @@ function Lr(t, [e, n, r]) {
|
|
|
1671
1671
|
}
|
|
1672
1672
|
case "a": {
|
|
1673
1673
|
const a = t.aev.get(n);
|
|
1674
|
-
return
|
|
1674
|
+
return x(a, 2);
|
|
1675
1675
|
}
|
|
1676
1676
|
case "av": {
|
|
1677
1677
|
const a = t.aev.get(n);
|
|
@@ -1690,41 +1690,38 @@ function Lr(t, [e, n, r]) {
|
|
|
1690
1690
|
return a;
|
|
1691
1691
|
}
|
|
1692
1692
|
default:
|
|
1693
|
-
return
|
|
1693
|
+
return x(t.eav, 3);
|
|
1694
1694
|
}
|
|
1695
1695
|
}
|
|
1696
|
-
|
|
1697
|
-
function Fr(t, e, n) {
|
|
1696
|
+
function Lr(t, e, n) {
|
|
1698
1697
|
var s;
|
|
1699
|
-
if (xe[n])
|
|
1700
|
-
return xe[n];
|
|
1701
1698
|
const r = {};
|
|
1702
1699
|
if (!e)
|
|
1703
1700
|
return r;
|
|
1704
1701
|
for (const [i, o] of e.entries()) {
|
|
1705
|
-
const a = (s = t.eav.get(n)) == null ? void 0 : s.get(o.id), c =
|
|
1702
|
+
const a = (s = t.eav.get(n)) == null ? void 0 : s.get(o.id), c = x(a, 1);
|
|
1706
1703
|
for (const u of c)
|
|
1707
1704
|
r[i] = u[2];
|
|
1708
1705
|
}
|
|
1709
|
-
return
|
|
1706
|
+
return r;
|
|
1710
1707
|
}
|
|
1711
1708
|
function G(t, e, n) {
|
|
1712
1709
|
var r;
|
|
1713
1710
|
return (r = t.attrIndexes.forwardIdents.get(e)) == null ? void 0 : r.get(n);
|
|
1714
1711
|
}
|
|
1715
|
-
function
|
|
1712
|
+
function Sn(t, e, n) {
|
|
1716
1713
|
var r;
|
|
1717
1714
|
return (r = t.attrIndexes.revIdents.get(e)) == null ? void 0 : r.get(n);
|
|
1718
1715
|
}
|
|
1719
|
-
function
|
|
1716
|
+
function Fr(t, e) {
|
|
1720
1717
|
return t.attrIndexes.blobAttrs.get(e);
|
|
1721
1718
|
}
|
|
1722
|
-
function
|
|
1719
|
+
function On(t, e) {
|
|
1723
1720
|
var r;
|
|
1724
1721
|
const n = t.attrIndexes.primaryKeys.get(e);
|
|
1725
1722
|
return n || ((r = t.attrIndexes.forwardIdents.get(e)) == null ? void 0 : r.get("id"));
|
|
1726
1723
|
}
|
|
1727
|
-
function
|
|
1724
|
+
function Nr(t, e) {
|
|
1728
1725
|
const n = ye(t, e);
|
|
1729
1726
|
if (!n)
|
|
1730
1727
|
return;
|
|
@@ -1732,7 +1729,7 @@ function Kr(t, e) {
|
|
|
1732
1729
|
if (re(t.attrs, s))
|
|
1733
1730
|
return se(t.eav, [r, s]);
|
|
1734
1731
|
}
|
|
1735
|
-
function
|
|
1732
|
+
function Kr(t, e) {
|
|
1736
1733
|
const n = e.filter(
|
|
1737
1734
|
([r, s, i, o, a]) => {
|
|
1738
1735
|
if (r !== "add-triple" && r !== "deep-merge-triple")
|
|
@@ -1743,8 +1740,8 @@ function qr(t, e) {
|
|
|
1743
1740
|
let u = !1;
|
|
1744
1741
|
const l = re(t.attrs, i);
|
|
1745
1742
|
if (l) {
|
|
1746
|
-
const f =
|
|
1747
|
-
u = !!
|
|
1743
|
+
const f = On(t, l["forward-identity"][1]);
|
|
1744
|
+
u = !!Nr(t, [
|
|
1748
1745
|
s,
|
|
1749
1746
|
f == null ? void 0 : f.id,
|
|
1750
1747
|
s
|
|
@@ -1759,28 +1756,28 @@ function qr(t, e) {
|
|
|
1759
1756
|
});
|
|
1760
1757
|
});
|
|
1761
1758
|
}
|
|
1762
|
-
function
|
|
1759
|
+
function qr(t) {
|
|
1763
1760
|
return typeof t == "string" && t.startsWith("?");
|
|
1764
1761
|
}
|
|
1765
|
-
function
|
|
1762
|
+
function zr(t, e, n) {
|
|
1766
1763
|
if (n.hasOwnProperty(t)) {
|
|
1767
1764
|
const r = n[t];
|
|
1768
|
-
return
|
|
1765
|
+
return vn(r, e, n);
|
|
1769
1766
|
}
|
|
1770
1767
|
return { ...n, [t]: e };
|
|
1771
1768
|
}
|
|
1772
|
-
function
|
|
1769
|
+
function Mt(t, e, n) {
|
|
1773
1770
|
return t === e ? n : null;
|
|
1774
1771
|
}
|
|
1775
|
-
function
|
|
1772
|
+
function Vr(t) {
|
|
1776
1773
|
switch (typeof t) {
|
|
1777
1774
|
case "string":
|
|
1778
|
-
return t.startsWith("?") ?
|
|
1775
|
+
return t.startsWith("?") ? zr : Mt;
|
|
1779
1776
|
default:
|
|
1780
|
-
return
|
|
1777
|
+
return Mt;
|
|
1781
1778
|
}
|
|
1782
1779
|
}
|
|
1783
|
-
const
|
|
1780
|
+
const Wr = [
|
|
1784
1781
|
"in",
|
|
1785
1782
|
"$in",
|
|
1786
1783
|
"$not",
|
|
@@ -1788,94 +1785,94 @@ const Qr = [
|
|
|
1788
1785
|
"$comparator"
|
|
1789
1786
|
// covers all of $gt, $lt, etc.
|
|
1790
1787
|
];
|
|
1791
|
-
function
|
|
1792
|
-
for (const e of
|
|
1788
|
+
function Qr(t) {
|
|
1789
|
+
for (const e of Wr)
|
|
1793
1790
|
if (t.hasOwnProperty(e))
|
|
1794
1791
|
return !0;
|
|
1795
1792
|
return !1;
|
|
1796
1793
|
}
|
|
1797
|
-
function
|
|
1798
|
-
return n ? typeof t == "object" ?
|
|
1794
|
+
function vn(t, e, n) {
|
|
1795
|
+
return n ? typeof t == "object" ? Qr(t) ? n : null : Vr(t)(t, e, n) : null;
|
|
1799
1796
|
}
|
|
1800
|
-
function
|
|
1797
|
+
function Gr(t, e, n) {
|
|
1801
1798
|
return t.reduce((r, s, i) => {
|
|
1802
1799
|
const o = e[i];
|
|
1803
|
-
return
|
|
1800
|
+
return vn(s, o, r);
|
|
1804
1801
|
}, n);
|
|
1805
1802
|
}
|
|
1806
|
-
function
|
|
1807
|
-
return
|
|
1803
|
+
function Br(t, e, n) {
|
|
1804
|
+
return Yr(t, e, n).map((r) => Gr(e, r, n)).filter((r) => r);
|
|
1808
1805
|
}
|
|
1809
|
-
function
|
|
1810
|
-
return e.or ? e.or.patterns.flatMap((r) =>
|
|
1806
|
+
function Hr(t, e, n) {
|
|
1807
|
+
return e.or ? e.or.patterns.flatMap((r) => Be(t, r, n)) : e.and ? e.and.patterns.reduce((r, s) => Be(t, s, r), n) : n.flatMap((r) => Br(t, e, r));
|
|
1811
1808
|
}
|
|
1812
|
-
function
|
|
1813
|
-
return e.reduce((r, s) =>
|
|
1809
|
+
function Be(t, e, n = [{}]) {
|
|
1810
|
+
return e.reduce((r, s) => Hr(t, s, r), n);
|
|
1814
1811
|
}
|
|
1815
|
-
function
|
|
1816
|
-
return Array.isArray(e) ? e.map((n) =>
|
|
1812
|
+
function bt(t, e) {
|
|
1813
|
+
return Array.isArray(e) ? e.map((n) => bt(t, n)) : qr(e) ? t[e] : e;
|
|
1817
1814
|
}
|
|
1818
|
-
function
|
|
1819
|
-
return
|
|
1815
|
+
function Jr(t, { find: e, where: n }) {
|
|
1816
|
+
return Be(t, n).map((s) => bt(s, e));
|
|
1820
1817
|
}
|
|
1821
|
-
function
|
|
1822
|
-
return
|
|
1818
|
+
function Yr(t, e, n) {
|
|
1819
|
+
return Ur(t, bt(n, e));
|
|
1823
1820
|
}
|
|
1824
|
-
const
|
|
1821
|
+
const Zr = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
|
1825
1822
|
function te(t) {
|
|
1826
|
-
return typeof t == "string" &&
|
|
1823
|
+
return typeof t == "string" && Zr.test(t);
|
|
1827
1824
|
}
|
|
1828
1825
|
const E = [];
|
|
1829
1826
|
for (let t = 0; t < 256; ++t)
|
|
1830
1827
|
E.push((t + 256).toString(16).slice(1));
|
|
1831
|
-
function
|
|
1828
|
+
function Xr(t, e = 0) {
|
|
1832
1829
|
return (E[t[e + 0]] + E[t[e + 1]] + E[t[e + 2]] + E[t[e + 3]] + "-" + E[t[e + 4]] + E[t[e + 5]] + "-" + E[t[e + 6]] + E[t[e + 7]] + "-" + E[t[e + 8]] + E[t[e + 9]] + "-" + E[t[e + 10]] + E[t[e + 11]] + E[t[e + 12]] + E[t[e + 13]] + E[t[e + 14]] + E[t[e + 15]]).toLowerCase();
|
|
1833
1830
|
}
|
|
1834
|
-
let
|
|
1835
|
-
const
|
|
1836
|
-
function
|
|
1837
|
-
if (!
|
|
1831
|
+
let Re;
|
|
1832
|
+
const es = new Uint8Array(16);
|
|
1833
|
+
function ts() {
|
|
1834
|
+
if (!Re) {
|
|
1838
1835
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1839
1836
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1840
|
-
|
|
1837
|
+
Re = crypto.getRandomValues.bind(crypto);
|
|
1841
1838
|
}
|
|
1842
|
-
return
|
|
1839
|
+
return Re(es);
|
|
1843
1840
|
}
|
|
1844
|
-
const
|
|
1845
|
-
function
|
|
1841
|
+
const ns = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), It = { randomUUID: ns };
|
|
1842
|
+
function rs(t, e, n) {
|
|
1846
1843
|
var s;
|
|
1847
|
-
if (
|
|
1848
|
-
return
|
|
1844
|
+
if (It.randomUUID && !t)
|
|
1845
|
+
return It.randomUUID();
|
|
1849
1846
|
t = t || {};
|
|
1850
|
-
const r = t.random ?? ((s = t.rng) == null ? void 0 : s.call(t)) ??
|
|
1847
|
+
const r = t.random ?? ((s = t.rng) == null ? void 0 : s.call(t)) ?? ts();
|
|
1851
1848
|
if (r.length < 16)
|
|
1852
1849
|
throw new Error("Random bytes length must be >= 16");
|
|
1853
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1850
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Xr(r);
|
|
1854
1851
|
}
|
|
1855
|
-
function
|
|
1852
|
+
function Pt(t) {
|
|
1856
1853
|
const e = t.replace(/-/g, ""), n = [];
|
|
1857
1854
|
for (let r = 0; r < e.length; r += 2)
|
|
1858
1855
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
1859
1856
|
return n;
|
|
1860
1857
|
}
|
|
1861
|
-
function
|
|
1858
|
+
function ss(t, e) {
|
|
1862
1859
|
for (let n = 0; n < t.length; n++) {
|
|
1863
1860
|
if (t[n] < e[n]) return -1;
|
|
1864
1861
|
if (t[n] > e[n]) return 1;
|
|
1865
1862
|
}
|
|
1866
1863
|
return 0;
|
|
1867
1864
|
}
|
|
1868
|
-
function
|
|
1869
|
-
return
|
|
1865
|
+
function is(t, e) {
|
|
1866
|
+
return ss(Pt(t), Pt(e));
|
|
1870
1867
|
}
|
|
1871
1868
|
function k() {
|
|
1872
|
-
return
|
|
1869
|
+
return rs();
|
|
1873
1870
|
}
|
|
1874
|
-
function
|
|
1871
|
+
function os(t, e) {
|
|
1875
1872
|
return t.localeCompare(e);
|
|
1876
1873
|
}
|
|
1877
|
-
function
|
|
1878
|
-
let t =
|
|
1874
|
+
function as() {
|
|
1875
|
+
let t = os;
|
|
1879
1876
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
1880
1877
|
try {
|
|
1881
1878
|
t = Intl.Collator("en-US").compare;
|
|
@@ -1883,10 +1880,10 @@ function cs() {
|
|
|
1883
1880
|
}
|
|
1884
1881
|
return t;
|
|
1885
1882
|
}
|
|
1886
|
-
const
|
|
1887
|
-
let
|
|
1883
|
+
const cs = as();
|
|
1884
|
+
let us = 0;
|
|
1888
1885
|
function le(t) {
|
|
1889
|
-
return Ie(`_${t}`,
|
|
1886
|
+
return Ie(`_${t}`, us++);
|
|
1890
1887
|
}
|
|
1891
1888
|
function Ie(t, e) {
|
|
1892
1889
|
return `?${t}-${e}`;
|
|
@@ -1896,28 +1893,28 @@ class ne extends Error {
|
|
|
1896
1893
|
super(e), this.name = "AttrNotFoundError";
|
|
1897
1894
|
}
|
|
1898
1895
|
}
|
|
1899
|
-
function
|
|
1900
|
-
const n =
|
|
1896
|
+
function ls(t, e) {
|
|
1897
|
+
const n = On(t, e);
|
|
1901
1898
|
if (!n)
|
|
1902
1899
|
throw new ne(`Could not find id attr for ${e}`);
|
|
1903
1900
|
return n;
|
|
1904
1901
|
}
|
|
1905
|
-
function
|
|
1906
|
-
return [
|
|
1902
|
+
function jt(t, e, n, r) {
|
|
1903
|
+
return [fs(t, e, n, r)];
|
|
1907
1904
|
}
|
|
1908
|
-
function
|
|
1905
|
+
function fs(t, e, n, r) {
|
|
1909
1906
|
return [
|
|
1910
1907
|
t(n, r),
|
|
1911
|
-
|
|
1908
|
+
ls(e, n).id,
|
|
1912
1909
|
t(n, r),
|
|
1913
1910
|
t("time", r)
|
|
1914
1911
|
];
|
|
1915
1912
|
}
|
|
1916
|
-
function
|
|
1913
|
+
function ds(t, e, n) {
|
|
1917
1914
|
return t.map((r) => r === e ? n : r);
|
|
1918
1915
|
}
|
|
1919
|
-
function
|
|
1920
|
-
const i = G(e, n, s), o =
|
|
1916
|
+
function An(t, e, n, r, s) {
|
|
1917
|
+
const i = G(e, n, s), o = Sn(e, n, s), a = i || o;
|
|
1921
1918
|
if (!a)
|
|
1922
1919
|
throw new ne(`Could not find attr for ${[n, s]}`);
|
|
1923
1920
|
if (a["value-type"] !== "ref")
|
|
@@ -1935,7 +1932,7 @@ function kn(t, e, n, r, s) {
|
|
|
1935
1932
|
];
|
|
1936
1933
|
return [i ? f : u, d, h, a, !!i];
|
|
1937
1934
|
}
|
|
1938
|
-
function
|
|
1935
|
+
function $t(t, e) {
|
|
1939
1936
|
if (typeof e != "string")
|
|
1940
1937
|
return function(o) {
|
|
1941
1938
|
return !1;
|
|
@@ -1948,7 +1945,7 @@ function Dt(t, e) {
|
|
|
1948
1945
|
return typeof o != "string" ? !1 : s.test(o);
|
|
1949
1946
|
};
|
|
1950
1947
|
}
|
|
1951
|
-
function
|
|
1948
|
+
function hs(t, e) {
|
|
1952
1949
|
if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
|
|
1953
1950
|
return e;
|
|
1954
1951
|
const n = t["checked-data-type"] === "date";
|
|
@@ -1989,7 +1986,7 @@ function ps(t, e) {
|
|
|
1989
1986
|
}
|
|
1990
1987
|
};
|
|
1991
1988
|
if (e.hasOwnProperty("$like")) {
|
|
1992
|
-
const r =
|
|
1989
|
+
const r = $t(!0, e.$like);
|
|
1993
1990
|
return {
|
|
1994
1991
|
$comparator: !0,
|
|
1995
1992
|
$op: function(i) {
|
|
@@ -1998,7 +1995,7 @@ function ps(t, e) {
|
|
|
1998
1995
|
};
|
|
1999
1996
|
}
|
|
2000
1997
|
if (e.hasOwnProperty("$ilike")) {
|
|
2001
|
-
const r =
|
|
1998
|
+
const r = $t(!1, e.$ilike);
|
|
2002
1999
|
return {
|
|
2003
2000
|
$comparator: !0,
|
|
2004
2001
|
$op: function(i) {
|
|
@@ -2008,8 +2005,8 @@ function ps(t, e) {
|
|
|
2008
2005
|
}
|
|
2009
2006
|
return e;
|
|
2010
2007
|
}
|
|
2011
|
-
function
|
|
2012
|
-
const o = G(e, n, s), a =
|
|
2008
|
+
function ps(t, e, n, r, s, i) {
|
|
2009
|
+
const o = G(e, n, s), a = Sn(e, n, s), c = o || a;
|
|
2013
2010
|
if (!c)
|
|
2014
2011
|
throw new ne(
|
|
2015
2012
|
`No attr for etype = ${n} label = ${s}`
|
|
@@ -2030,14 +2027,14 @@ function ys(t, e, n, r, s, i) {
|
|
|
2030
2027
|
return o ? [
|
|
2031
2028
|
t(n, r),
|
|
2032
2029
|
c.id,
|
|
2033
|
-
|
|
2030
|
+
hs(c, i),
|
|
2034
2031
|
le("time")
|
|
2035
2032
|
] : [i, c.id, t(n, r), le("time")];
|
|
2036
2033
|
}
|
|
2037
|
-
function
|
|
2034
|
+
function ys(t, e, n, r, s) {
|
|
2038
2035
|
const [i, o, a] = s.reduce(
|
|
2039
2036
|
(c, u) => {
|
|
2040
|
-
const [l, f, d] = c, [h, p, b] =
|
|
2037
|
+
const [l, f, d] = c, [h, p, b] = An(
|
|
2041
2038
|
t,
|
|
2042
2039
|
e,
|
|
2043
2040
|
l,
|
|
@@ -2050,14 +2047,14 @@ function bs(t, e, n, r, s) {
|
|
|
2050
2047
|
);
|
|
2051
2048
|
return [i, o, a];
|
|
2052
2049
|
}
|
|
2053
|
-
function
|
|
2054
|
-
const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] =
|
|
2050
|
+
function He(t, e, n, r, s, i) {
|
|
2051
|
+
const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = ys(
|
|
2055
2052
|
t,
|
|
2056
2053
|
e,
|
|
2057
2054
|
n,
|
|
2058
2055
|
r,
|
|
2059
2056
|
o
|
|
2060
|
-
), f =
|
|
2057
|
+
), f = ps(
|
|
2061
2058
|
t,
|
|
2062
2059
|
e,
|
|
2063
2060
|
c,
|
|
@@ -2067,50 +2064,50 @@ function Je(t, e, n, r, s, i) {
|
|
|
2067
2064
|
);
|
|
2068
2065
|
return l.concat([f]);
|
|
2069
2066
|
}
|
|
2070
|
-
function
|
|
2067
|
+
function bs(t, e) {
|
|
2071
2068
|
return e ? [e].concat(t) : t;
|
|
2072
2069
|
}
|
|
2073
|
-
function
|
|
2070
|
+
function _s([t, e]) {
|
|
2074
2071
|
return t === "or" && Array.isArray(e);
|
|
2075
2072
|
}
|
|
2076
|
-
function
|
|
2073
|
+
function gs([t, e]) {
|
|
2077
2074
|
return t === "and" && Array.isArray(e);
|
|
2078
2075
|
}
|
|
2079
|
-
function
|
|
2076
|
+
function ws(t, e, n) {
|
|
2080
2077
|
return (r, s) => {
|
|
2081
2078
|
const i = t(r, s);
|
|
2082
2079
|
return e == i ? i : `${i}-${n}`;
|
|
2083
2080
|
};
|
|
2084
2081
|
}
|
|
2085
|
-
function
|
|
2082
|
+
function Dt(t, e, n, r, s, i) {
|
|
2086
2083
|
const o = t(r, s), a = i.map((c, u) => {
|
|
2087
|
-
const l =
|
|
2088
|
-
return
|
|
2084
|
+
const l = ws(t, o, u);
|
|
2085
|
+
return kn(l, n, r, s, c);
|
|
2089
2086
|
});
|
|
2090
2087
|
return { [e]: { patterns: a, joinSym: o } };
|
|
2091
2088
|
}
|
|
2092
|
-
function
|
|
2089
|
+
function Ts(t) {
|
|
2093
2090
|
const e = [];
|
|
2094
2091
|
for (let n = 1; n <= t.length; n++)
|
|
2095
2092
|
e.push(t.slice(0, n));
|
|
2096
2093
|
return e;
|
|
2097
2094
|
}
|
|
2098
2095
|
function xt(t, e, n, r, s) {
|
|
2099
|
-
return
|
|
2100
|
-
(i) =>
|
|
2096
|
+
return Ts(s).map(
|
|
2097
|
+
(i) => He(t, e, n, r, i, { $isNull: !0 })
|
|
2101
2098
|
);
|
|
2102
2099
|
}
|
|
2103
|
-
function
|
|
2100
|
+
function kn(t, e, n, r, s) {
|
|
2104
2101
|
return Object.entries(s).flatMap(([i, o]) => {
|
|
2102
|
+
if (_s([i, o]))
|
|
2103
|
+
return Dt(t, "or", e, n, r, o);
|
|
2105
2104
|
if (gs([i, o]))
|
|
2106
|
-
return
|
|
2107
|
-
if (ws([i, o]))
|
|
2108
|
-
return Rt(t, "and", e, n, r, o);
|
|
2105
|
+
return Dt(t, "and", e, n, r, o);
|
|
2109
2106
|
if (i === "$entityIdStartsWith")
|
|
2110
2107
|
return [];
|
|
2111
2108
|
const a = i.split(".");
|
|
2112
2109
|
if (o != null && o.hasOwnProperty("$ne") && (o = { ...o, $not: o.$ne }, delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2113
|
-
const c =
|
|
2110
|
+
const c = He(t, e, n, r, a, o), u = xt(
|
|
2114
2111
|
t,
|
|
2115
2112
|
e,
|
|
2116
2113
|
n,
|
|
@@ -2139,41 +2136,41 @@ function En(t, e, n, r, s) {
|
|
|
2139
2136
|
joinSym: t(n, r)
|
|
2140
2137
|
}
|
|
2141
2138
|
}
|
|
2142
|
-
] :
|
|
2139
|
+
] : He(t, e, n, r, a, o);
|
|
2143
2140
|
});
|
|
2144
2141
|
}
|
|
2145
|
-
function
|
|
2142
|
+
function ms(t, e, n, r) {
|
|
2146
2143
|
const s = Ie;
|
|
2147
|
-
return r ?
|
|
2144
|
+
return r ? kn(s, t, e, n, r).concat(jt(s, t, e, n)) : jt(s, t, e, n);
|
|
2148
2145
|
}
|
|
2149
|
-
function
|
|
2146
|
+
function Ss(t, e, n) {
|
|
2150
2147
|
return [t(e, n), t("time", n)];
|
|
2151
2148
|
}
|
|
2152
|
-
function
|
|
2153
|
-
const [o, a, c, u, l] =
|
|
2149
|
+
function Os(t, e, n, r, s, i) {
|
|
2150
|
+
const [o, a, c, u, l] = An(
|
|
2154
2151
|
t,
|
|
2155
2152
|
e,
|
|
2156
2153
|
n,
|
|
2157
2154
|
r,
|
|
2158
2155
|
s
|
|
2159
|
-
), f =
|
|
2156
|
+
), f = ds(c, t(n, r), i);
|
|
2160
2157
|
return [o, a, f, u, l];
|
|
2161
2158
|
}
|
|
2162
|
-
function
|
|
2159
|
+
function vs(t, e, { etype: n, level: r, form: s }, i) {
|
|
2163
2160
|
const o = Object.keys(s).filter((a) => a !== "$");
|
|
2164
2161
|
return o.length ? Object.entries(i).map(function([c, u]) {
|
|
2165
2162
|
return o.map(function(d) {
|
|
2166
2163
|
var p, b, _;
|
|
2167
2164
|
const h = !!(e.cardinalityInference && ((_ = (b = (p = e.linkIndex) == null ? void 0 : p[n]) == null ? void 0 : b[d]) != null && _.isSingular));
|
|
2168
2165
|
try {
|
|
2169
|
-
const [y, g, T] =
|
|
2166
|
+
const [y, g, T] = Os(
|
|
2170
2167
|
t,
|
|
2171
2168
|
e,
|
|
2172
2169
|
n,
|
|
2173
2170
|
r,
|
|
2174
2171
|
d,
|
|
2175
2172
|
c
|
|
2176
|
-
), v =
|
|
2173
|
+
), v = Cn(e, {
|
|
2177
2174
|
etype: y,
|
|
2178
2175
|
level: g,
|
|
2179
2176
|
form: s[d],
|
|
@@ -2190,48 +2187,48 @@ function As(t, e, { etype: n, level: r, form: s }, i) {
|
|
|
2190
2187
|
}, u);
|
|
2191
2188
|
}) : Object.values(i);
|
|
2192
2189
|
}
|
|
2193
|
-
function
|
|
2194
|
-
return n === "string" ?
|
|
2190
|
+
function As(t, e, n) {
|
|
2191
|
+
return n === "string" ? cs(t, e) : t > e ? 1 : -1;
|
|
2195
2192
|
}
|
|
2196
2193
|
function ce(t, e, n, r, s) {
|
|
2197
|
-
return e === r || e == null && r == null ?
|
|
2194
|
+
return e === r || e == null && r == null ? is(t, n) : r == null ? 1 : e == null ? -1 : As(e, r, s);
|
|
2198
2195
|
}
|
|
2199
2196
|
function Ee([t, e], [n, r], s) {
|
|
2200
2197
|
return ce(t, e, n, r, s);
|
|
2201
2198
|
}
|
|
2202
|
-
function
|
|
2199
|
+
function Je(t) {
|
|
2203
2200
|
return t == null ? t : new Date(t).getTime();
|
|
2204
2201
|
}
|
|
2205
|
-
function
|
|
2202
|
+
function ks(t, e, n, r) {
|
|
2206
2203
|
var p;
|
|
2207
2204
|
const [s, i, o, a] = t, c = n === "desc" ? 1 : -1;
|
|
2208
2205
|
if (((p = e["forward-identity"]) == null ? void 0 : p[2]) === "id")
|
|
2209
2206
|
return Ee(r, [s, a], null) === c;
|
|
2210
|
-
const [u, l] = r, f = e["checked-data-type"], d = f === "date" ?
|
|
2207
|
+
const [u, l] = r, f = e["checked-data-type"], d = f === "date" ? Je(l) : l, h = f === "date" ? Je(o) : o;
|
|
2211
2208
|
return Ee([u, d], [s, h], f) === c;
|
|
2212
2209
|
}
|
|
2213
|
-
function
|
|
2210
|
+
function Es(t, e) {
|
|
2214
2211
|
const n = e[1];
|
|
2215
2212
|
return t.attrs[n];
|
|
2216
2213
|
}
|
|
2217
|
-
function
|
|
2214
|
+
function Cs(t, e, n) {
|
|
2218
2215
|
const r = Object.keys(n)[0];
|
|
2219
2216
|
return G(t, e, r);
|
|
2220
2217
|
}
|
|
2221
|
-
function
|
|
2218
|
+
function Ms(t, e, n, r) {
|
|
2222
2219
|
if (n)
|
|
2223
|
-
return
|
|
2220
|
+
return Es(t, n);
|
|
2224
2221
|
if (r)
|
|
2225
|
-
return
|
|
2222
|
+
return Cs(t, e, r);
|
|
2226
2223
|
}
|
|
2227
|
-
function
|
|
2224
|
+
function Is(t, e, n) {
|
|
2228
2225
|
var s, i;
|
|
2229
2226
|
if (!Array.isArray(n.fields))
|
|
2230
|
-
return
|
|
2227
|
+
return Fr(t, e);
|
|
2231
2228
|
const r = /* @__PURE__ */ new Map();
|
|
2232
2229
|
for (const o of n.fields) {
|
|
2233
2230
|
const a = G(t, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
|
|
2234
|
-
c &&
|
|
2231
|
+
c && pt(a) && r.set(c, a);
|
|
2235
2232
|
}
|
|
2236
2233
|
if (!r.has("id")) {
|
|
2237
2234
|
const o = G(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
|
|
@@ -2239,17 +2236,17 @@ function Ps(t, e, n) {
|
|
|
2239
2236
|
}
|
|
2240
2237
|
return r;
|
|
2241
2238
|
}
|
|
2242
|
-
function
|
|
2239
|
+
function Ps(t, { etype: e, pageInfo: n, dq: r, form: s }) {
|
|
2243
2240
|
var h, p;
|
|
2244
|
-
const i = (h = s == null ? void 0 : s.$) == null ? void 0 : h.order, o =
|
|
2245
|
-
let c =
|
|
2246
|
-
const u = n == null ? void 0 : n["start-cursor"], l =
|
|
2241
|
+
const i = (h = s == null ? void 0 : s.$) == null ? void 0 : h.order, o = En(s), a = js(s);
|
|
2242
|
+
let c = Jr(t, r);
|
|
2243
|
+
const u = n == null ? void 0 : n["start-cursor"], l = Ms(t, e, u, i);
|
|
2247
2244
|
if (l && ((p = l == null ? void 0 : l["forward-identity"]) == null ? void 0 : p[2]) !== "id") {
|
|
2248
2245
|
const b = l["checked-data-type"] === "date", _ = l.id;
|
|
2249
2246
|
c = c.map(([y]) => {
|
|
2250
2247
|
var T, v, m, M, I;
|
|
2251
2248
|
let g = (I = (M = (m = (v = (T = t.eav.get(y)) == null ? void 0 : T.get(_)) == null ? void 0 : v.values()) == null ? void 0 : m.next()) == null ? void 0 : M.value) == null ? void 0 : I[2];
|
|
2252
|
-
return b && (g =
|
|
2249
|
+
return b && (g = Je(g)), [y, g];
|
|
2253
2250
|
});
|
|
2254
2251
|
}
|
|
2255
2252
|
c.sort(
|
|
@@ -2260,31 +2257,31 @@ function js(t, { etype: e, pageInfo: n, dq: r, form: s }) {
|
|
|
2260
2257
|
}
|
|
2261
2258
|
);
|
|
2262
2259
|
let f = {};
|
|
2263
|
-
const d =
|
|
2260
|
+
const d = Is(t, e, r);
|
|
2264
2261
|
for (const b of c) {
|
|
2265
2262
|
const [_] = b;
|
|
2266
|
-
if (f[_] || !o && u && l &&
|
|
2263
|
+
if (f[_] || !o && u && l && ks(u, l, a, b))
|
|
2267
2264
|
continue;
|
|
2268
|
-
const y =
|
|
2265
|
+
const y = Lr(t, d, _);
|
|
2269
2266
|
y && (f[_] = y);
|
|
2270
2267
|
}
|
|
2271
2268
|
return f;
|
|
2272
2269
|
}
|
|
2273
|
-
function
|
|
2270
|
+
function js(t) {
|
|
2274
2271
|
var n;
|
|
2275
2272
|
const e = (n = t.$) == null ? void 0 : n.order;
|
|
2276
2273
|
return e && e[Object.keys(e)[0]] || "asc";
|
|
2277
2274
|
}
|
|
2278
|
-
function
|
|
2275
|
+
function En(t) {
|
|
2279
2276
|
var s, i, o;
|
|
2280
2277
|
const e = (s = t.$) == null ? void 0 : s.offset, n = (i = t.$) == null ? void 0 : i.before, r = (o = t.$) == null ? void 0 : o.after;
|
|
2281
2278
|
return !e && !n && !r;
|
|
2282
2279
|
}
|
|
2283
|
-
function
|
|
2280
|
+
function $s(t, { etype: e, level: n, form: r, join: s, pageInfo: i }) {
|
|
2284
2281
|
var f, d, h, p, b;
|
|
2285
|
-
if (!
|
|
2282
|
+
if (!En(r) && (!i || !i["start-cursor"]))
|
|
2286
2283
|
return [];
|
|
2287
|
-
const o =
|
|
2284
|
+
const o = bs(ms(t, e, n, (f = r.$) == null ? void 0 : f.where), s), a = Ss(Ie, e, n), c = (d = r.$) == null ? void 0 : d.fields, u = Ps(t, {
|
|
2288
2285
|
etype: e,
|
|
2289
2286
|
pageInfo: i,
|
|
2290
2287
|
form: r,
|
|
@@ -2299,18 +2296,18 @@ function Ds(t, { etype: e, level: n, form: r, join: s, pageInfo: i }) {
|
|
|
2299
2296
|
}
|
|
2300
2297
|
return u;
|
|
2301
2298
|
}
|
|
2302
|
-
function
|
|
2299
|
+
function Ds(t, e) {
|
|
2303
2300
|
try {
|
|
2304
|
-
return
|
|
2301
|
+
return $s(t, e);
|
|
2305
2302
|
} catch (n) {
|
|
2306
2303
|
if (n instanceof ne)
|
|
2307
2304
|
return {};
|
|
2308
2305
|
throw n;
|
|
2309
2306
|
}
|
|
2310
2307
|
}
|
|
2311
|
-
function
|
|
2312
|
-
const n =
|
|
2313
|
-
return
|
|
2308
|
+
function Cn(t, e) {
|
|
2309
|
+
const n = Ds(t, e);
|
|
2310
|
+
return vs(Ie, t, e, n);
|
|
2314
2311
|
}
|
|
2315
2312
|
function xs(t) {
|
|
2316
2313
|
const e = {};
|
|
@@ -2323,13 +2320,13 @@ function xs(t) {
|
|
|
2323
2320
|
};
|
|
2324
2321
|
return e;
|
|
2325
2322
|
}
|
|
2326
|
-
function
|
|
2323
|
+
function Mn({
|
|
2327
2324
|
store: t,
|
|
2328
2325
|
pageInfo: e,
|
|
2329
2326
|
aggregate: n
|
|
2330
2327
|
}, r) {
|
|
2331
2328
|
const i = { data: Object.keys(r).reduce(function(a, c) {
|
|
2332
|
-
return n != null && n[c] || c === "$$ruleParams" || (a[c] =
|
|
2329
|
+
return n != null && n[c] || c === "$$ruleParams" || (a[c] = Cn(t, {
|
|
2333
2330
|
etype: c,
|
|
2334
2331
|
form: r[c],
|
|
2335
2332
|
level: 0,
|
|
@@ -2338,7 +2335,7 @@ function In({
|
|
|
2338
2335
|
}, {}) };
|
|
2339
2336
|
return e && (i.pageInfo = xs(e)), n && (i.aggregate = n), i;
|
|
2340
2337
|
}
|
|
2341
|
-
function
|
|
2338
|
+
function Rs() {
|
|
2342
2339
|
const e = {
|
|
2343
2340
|
__etype: 1,
|
|
2344
2341
|
__ops: 1,
|
|
@@ -2352,8 +2349,8 @@ function Us() {
|
|
|
2352
2349
|
};
|
|
2353
2350
|
return new Set(Object.keys(e));
|
|
2354
2351
|
}
|
|
2355
|
-
const
|
|
2356
|
-
function
|
|
2352
|
+
const Us = Rs();
|
|
2353
|
+
function Ye(t, e, n) {
|
|
2357
2354
|
const r = {
|
|
2358
2355
|
__etype: t,
|
|
2359
2356
|
__ops: n
|
|
@@ -2362,8 +2359,8 @@ function Ze(t, e, n) {
|
|
|
2362
2359
|
get: (s, i) => {
|
|
2363
2360
|
if (i === "__ops") return n;
|
|
2364
2361
|
if (i === "__etype") return t;
|
|
2365
|
-
if (
|
|
2366
|
-
return (o, a) =>
|
|
2362
|
+
if (Us.has(i))
|
|
2363
|
+
return (o, a) => Ye(t, e, [
|
|
2367
2364
|
...n,
|
|
2368
2365
|
a ? [i, t, e, o, a] : [i, t, e, o]
|
|
2369
2366
|
]);
|
|
@@ -2376,11 +2373,11 @@ function xo(t, e) {
|
|
|
2376
2373
|
function Ce(t) {
|
|
2377
2374
|
return t.startsWith("lookup__");
|
|
2378
2375
|
}
|
|
2379
|
-
function
|
|
2376
|
+
function In(t) {
|
|
2380
2377
|
const [e, n, ...r] = t.split("__");
|
|
2381
2378
|
return [n, JSON.parse(r.join("__"))];
|
|
2382
2379
|
}
|
|
2383
|
-
function
|
|
2380
|
+
function Ls(t) {
|
|
2384
2381
|
return new Proxy(
|
|
2385
2382
|
{
|
|
2386
2383
|
__etype: t
|
|
@@ -2389,26 +2386,26 @@ function Fs(t) {
|
|
|
2389
2386
|
get(e, n) {
|
|
2390
2387
|
if (n === "__etype") return t;
|
|
2391
2388
|
const r = n;
|
|
2392
|
-
return Ce(r) ?
|
|
2389
|
+
return Ce(r) ? Ye(t, In(r), []) : Ye(t, r, []);
|
|
2393
2390
|
}
|
|
2394
2391
|
}
|
|
2395
2392
|
);
|
|
2396
2393
|
}
|
|
2397
|
-
function
|
|
2394
|
+
function Pn() {
|
|
2398
2395
|
return new Proxy(
|
|
2399
2396
|
{},
|
|
2400
2397
|
{
|
|
2401
2398
|
get(t, e) {
|
|
2402
|
-
return
|
|
2399
|
+
return Ls(e);
|
|
2403
2400
|
}
|
|
2404
2401
|
}
|
|
2405
2402
|
);
|
|
2406
2403
|
}
|
|
2407
|
-
const
|
|
2408
|
-
function
|
|
2404
|
+
const Ro = Pn();
|
|
2405
|
+
function Fs(t) {
|
|
2409
2406
|
return t.__ops;
|
|
2410
2407
|
}
|
|
2411
|
-
function
|
|
2408
|
+
function Ns(t, e) {
|
|
2412
2409
|
const { attrIdMap: n, refSwapAttrIds: r } = t, s = [];
|
|
2413
2410
|
for (const o of e) {
|
|
2414
2411
|
const a = n[o];
|
|
@@ -2441,7 +2438,7 @@ function J(t, e, n) {
|
|
|
2441
2438
|
return o === e && a === n;
|
|
2442
2439
|
});
|
|
2443
2440
|
}
|
|
2444
|
-
function
|
|
2441
|
+
function Ks(t) {
|
|
2445
2442
|
if (Array.isArray(t))
|
|
2446
2443
|
return t;
|
|
2447
2444
|
const e = Object.entries(t);
|
|
@@ -2451,39 +2448,39 @@ function qs(t) {
|
|
|
2451
2448
|
);
|
|
2452
2449
|
return e[0];
|
|
2453
2450
|
}
|
|
2454
|
-
function
|
|
2451
|
+
function Ze(t, e, n) {
|
|
2455
2452
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2456
2453
|
// before assuming it's a ref lookup.
|
|
2457
2454
|
!C(t, e, n);
|
|
2458
2455
|
}
|
|
2459
|
-
function
|
|
2456
|
+
function Xe(t) {
|
|
2460
2457
|
const [e, n, ...r] = t.split(".");
|
|
2461
2458
|
if (r.length > 0 || n !== "id")
|
|
2462
2459
|
throw new Error(`${t} is not a valid lookup attribute.`);
|
|
2463
2460
|
return e;
|
|
2464
2461
|
}
|
|
2465
|
-
function
|
|
2466
|
-
if (!
|
|
2462
|
+
function qs(t, e, n) {
|
|
2463
|
+
if (!Ze(t, e, n))
|
|
2467
2464
|
return C(t, e, n);
|
|
2468
|
-
const r =
|
|
2465
|
+
const r = Xe(n), s = C(t, e, r) || J(t, e, r);
|
|
2469
2466
|
if (s && s["value-type"] !== "ref")
|
|
2470
2467
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
2471
2468
|
return s;
|
|
2472
2469
|
}
|
|
2473
|
-
function
|
|
2474
|
-
return typeof t == "string" && !Ce(t) ? null : typeof t == "string" && Ce(t) ?
|
|
2470
|
+
function et(t) {
|
|
2471
|
+
return typeof t == "string" && !Ce(t) ? null : typeof t == "string" && Ce(t) ? In(t) : Ks(t);
|
|
2475
2472
|
}
|
|
2476
|
-
function
|
|
2477
|
-
const r =
|
|
2473
|
+
function R(t, e, n) {
|
|
2474
|
+
const r = et(n);
|
|
2478
2475
|
if (r === null)
|
|
2479
2476
|
return n;
|
|
2480
|
-
const [s, i] = r, o =
|
|
2477
|
+
const [s, i] = r, o = qs(t, e, s);
|
|
2481
2478
|
if (!o || !o["unique?"])
|
|
2482
2479
|
throw new Error(`${s} is not a unique attribute.`);
|
|
2483
2480
|
return [o.id, i];
|
|
2484
2481
|
}
|
|
2485
|
-
function
|
|
2486
|
-
const s =
|
|
2482
|
+
function jn(t, e, n, r) {
|
|
2483
|
+
const s = R(t, e, n);
|
|
2487
2484
|
return Array.isArray(s) ? [[
|
|
2488
2485
|
"add-triple",
|
|
2489
2486
|
s,
|
|
@@ -2491,47 +2488,47 @@ function $n(t, e, n, r) {
|
|
|
2491
2488
|
s
|
|
2492
2489
|
]].concat(r) : r;
|
|
2493
2490
|
}
|
|
2494
|
-
function
|
|
2491
|
+
function zs({ attrs: t }, [e, n, r]) {
|
|
2495
2492
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
2496
2493
|
const a = Array.isArray(o) ? o : [o], c = C(t, e, i), u = J(t, e, i);
|
|
2497
2494
|
return a.map((l) => c ? [
|
|
2498
2495
|
"add-triple",
|
|
2499
|
-
|
|
2496
|
+
R(t, e, n),
|
|
2500
2497
|
c.id,
|
|
2501
|
-
|
|
2498
|
+
R(t, c["reverse-identity"][1], l)
|
|
2502
2499
|
] : [
|
|
2503
2500
|
"add-triple",
|
|
2504
|
-
|
|
2501
|
+
R(t, u["forward-identity"][1], l),
|
|
2505
2502
|
u.id,
|
|
2506
|
-
|
|
2503
|
+
R(t, e, n)
|
|
2507
2504
|
]);
|
|
2508
2505
|
});
|
|
2509
|
-
return
|
|
2506
|
+
return jn(t, e, n, s);
|
|
2510
2507
|
}
|
|
2511
|
-
function
|
|
2508
|
+
function Vs({ attrs: t }, [e, n, r]) {
|
|
2512
2509
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
2513
2510
|
const a = Array.isArray(o) ? o : [o], c = C(t, e, i), u = J(t, e, i);
|
|
2514
2511
|
return a.map((l) => c ? [
|
|
2515
2512
|
"retract-triple",
|
|
2516
|
-
|
|
2513
|
+
R(t, e, n),
|
|
2517
2514
|
c.id,
|
|
2518
|
-
|
|
2515
|
+
R(t, c["reverse-identity"][1], l)
|
|
2519
2516
|
] : [
|
|
2520
2517
|
"retract-triple",
|
|
2521
|
-
|
|
2518
|
+
R(t, u["forward-identity"][1], l),
|
|
2522
2519
|
u.id,
|
|
2523
|
-
|
|
2520
|
+
R(t, e, n)
|
|
2524
2521
|
]);
|
|
2525
2522
|
});
|
|
2526
|
-
return
|
|
2523
|
+
return jn(t, e, n, s);
|
|
2527
2524
|
}
|
|
2528
|
-
function
|
|
2525
|
+
function Ws(t, e, n) {
|
|
2529
2526
|
if (Array.isArray(n)) {
|
|
2530
2527
|
const [r, s] = n;
|
|
2531
2528
|
for (const i of t || []) {
|
|
2532
2529
|
const o = i == null ? void 0 : i.aev.get(r);
|
|
2533
2530
|
if (o) {
|
|
2534
|
-
for (const [a, c, u] of
|
|
2531
|
+
for (const [a, c, u] of x(o, 2))
|
|
2535
2532
|
if (u === s)
|
|
2536
2533
|
return !0;
|
|
2537
2534
|
}
|
|
@@ -2547,18 +2544,18 @@ function Qs(t, e, n) {
|
|
|
2547
2544
|
}
|
|
2548
2545
|
return !1;
|
|
2549
2546
|
}
|
|
2550
|
-
function
|
|
2551
|
-
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null :
|
|
2547
|
+
function $n({ stores: t, attrs: e }, [n, r, s, i]) {
|
|
2548
|
+
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : Ws(t, n, r) ? { mode: "update" } : null;
|
|
2552
2549
|
}
|
|
2553
|
-
function
|
|
2554
|
-
const { attrs: n } = t, [r, s, i, o] = e, a =
|
|
2550
|
+
function Qs(t, e) {
|
|
2551
|
+
const { attrs: n } = t, [r, s, i, o] = e, a = dt(i), c = R(n, r, s);
|
|
2555
2552
|
return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
|
|
2556
2553
|
const d = C(n, r, l);
|
|
2557
2554
|
return d["checked-data-type"] === "date" && t.useDateObjects && (f = Me(f)), ["add-triple", c, d.id, f, { mode: "create" }];
|
|
2558
2555
|
});
|
|
2559
2556
|
}
|
|
2560
|
-
function
|
|
2561
|
-
const { attrs: n } = t, [r, s, i, o] = e, a =
|
|
2557
|
+
function Gs(t, e) {
|
|
2558
|
+
const { attrs: n } = t, [r, s, i, o] = e, a = dt(i), c = R(n, r, s), u = $n(t, [r, c, i, o]);
|
|
2562
2559
|
return [["id", c]].concat(Object.entries(a)).map(([f, d]) => {
|
|
2563
2560
|
const h = C(n, r, f);
|
|
2564
2561
|
return h["checked-data-type"] === "date" && t.useDateObjects && (d = Me(d)), [
|
|
@@ -2570,11 +2567,11 @@ function Bs(t, e) {
|
|
|
2570
2567
|
];
|
|
2571
2568
|
});
|
|
2572
2569
|
}
|
|
2573
|
-
function
|
|
2574
|
-
return [["delete-entity",
|
|
2570
|
+
function Bs({ attrs: t }, [e, n]) {
|
|
2571
|
+
return [["delete-entity", R(t, e, n), e]];
|
|
2575
2572
|
}
|
|
2576
|
-
function
|
|
2577
|
-
const { attrs: n } = t, [r, s, i, o] = e, a =
|
|
2573
|
+
function Hs(t, e) {
|
|
2574
|
+
const { attrs: n } = t, [r, s, i, o] = e, a = dt(i), c = R(n, r, s), u = $n(t, [r, c, i, o]), l = Object.entries(a).map(([d, h]) => {
|
|
2578
2575
|
const p = C(n, r, d);
|
|
2579
2576
|
return [
|
|
2580
2577
|
"deep-merge-triple",
|
|
@@ -2592,38 +2589,38 @@ function Js(t, e) {
|
|
|
2592
2589
|
...u ? [u] : []
|
|
2593
2590
|
]].concat(l);
|
|
2594
2591
|
}
|
|
2595
|
-
function
|
|
2596
|
-
return [["rule-params",
|
|
2592
|
+
function Js({ attrs: t }, [e, n, r]) {
|
|
2593
|
+
return [["rule-params", R(t, e, n), e, r]];
|
|
2597
2594
|
}
|
|
2598
|
-
function
|
|
2595
|
+
function Ys(t) {
|
|
2599
2596
|
const [e, n, r, s, i] = t;
|
|
2600
2597
|
if (!s)
|
|
2601
2598
|
return t;
|
|
2602
2599
|
const o = { ...s };
|
|
2603
2600
|
return delete o.id, [e, n, r, o, ...i ? [i] : []];
|
|
2604
2601
|
}
|
|
2605
|
-
function
|
|
2606
|
-
const [n, ...r] =
|
|
2602
|
+
function Zs(t, e) {
|
|
2603
|
+
const [n, ...r] = Ys(e);
|
|
2607
2604
|
switch (n) {
|
|
2608
2605
|
case "merge":
|
|
2609
|
-
return
|
|
2606
|
+
return Hs(t, r);
|
|
2610
2607
|
case "create":
|
|
2611
|
-
return
|
|
2608
|
+
return Qs(t, r);
|
|
2612
2609
|
case "update":
|
|
2613
|
-
return
|
|
2610
|
+
return Gs(t, r);
|
|
2614
2611
|
case "link":
|
|
2615
|
-
return
|
|
2612
|
+
return zs(t, r);
|
|
2616
2613
|
case "unlink":
|
|
2617
|
-
return
|
|
2614
|
+
return Vs(t, r);
|
|
2618
2615
|
case "delete":
|
|
2619
|
-
return
|
|
2616
|
+
return Bs(t, r);
|
|
2620
2617
|
case "ruleParams":
|
|
2621
|
-
return
|
|
2618
|
+
return Js(t, r);
|
|
2622
2619
|
default:
|
|
2623
2620
|
throw new Error(`unsupported action ${n}`);
|
|
2624
2621
|
}
|
|
2625
2622
|
}
|
|
2626
|
-
function
|
|
2623
|
+
function Xs(t) {
|
|
2627
2624
|
switch (t) {
|
|
2628
2625
|
case "string":
|
|
2629
2626
|
case "date":
|
|
@@ -2634,13 +2631,13 @@ function ei(t) {
|
|
|
2634
2631
|
return;
|
|
2635
2632
|
}
|
|
2636
2633
|
}
|
|
2637
|
-
function
|
|
2634
|
+
function ei(t, e, n) {
|
|
2638
2635
|
var a, c;
|
|
2639
2636
|
const r = (c = (a = t.entities[e]) == null ? void 0 : a.attrs) == null ? void 0 : c[n];
|
|
2640
2637
|
if (n === "id") return null;
|
|
2641
2638
|
if (!r)
|
|
2642
2639
|
throw new Error(`${e}.${n} does not exist in your schema`);
|
|
2643
|
-
const { unique: s, indexed: i } = r == null ? void 0 : r.config, o =
|
|
2640
|
+
const { unique: s, indexed: i } = r == null ? void 0 : r.config, o = Xs(r == null ? void 0 : r.valueType);
|
|
2644
2641
|
return {
|
|
2645
2642
|
"index?": i,
|
|
2646
2643
|
"unique?": s,
|
|
@@ -2648,7 +2645,7 @@ function ti(t, e, n) {
|
|
|
2648
2645
|
};
|
|
2649
2646
|
}
|
|
2650
2647
|
function _e(t, e, n, r) {
|
|
2651
|
-
const s = t ?
|
|
2648
|
+
const s = t ? ei(t, e, n) : null, i = k(), a = [k(), e, n];
|
|
2652
2649
|
return {
|
|
2653
2650
|
id: i,
|
|
2654
2651
|
"forward-identity": a,
|
|
@@ -2661,11 +2658,11 @@ function _e(t, e, n, r) {
|
|
|
2661
2658
|
...r || {}
|
|
2662
2659
|
};
|
|
2663
2660
|
}
|
|
2664
|
-
function
|
|
2661
|
+
function ti(t, e, n) {
|
|
2665
2662
|
return Object.values(t.links).find((s) => s.forward.on === e && s.forward.label === n || s.reverse.on === e && s.reverse.label === n);
|
|
2666
2663
|
}
|
|
2667
|
-
function
|
|
2668
|
-
const r =
|
|
2664
|
+
function ni(t, e, n) {
|
|
2665
|
+
const r = ti(t, e, n);
|
|
2669
2666
|
if (!r)
|
|
2670
2667
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
2671
2668
|
const { forward: s, reverse: i } = r;
|
|
@@ -2678,8 +2675,8 @@ function ri(t, e, n) {
|
|
|
2678
2675
|
"on-delete-reverse": i.onDelete
|
|
2679
2676
|
};
|
|
2680
2677
|
}
|
|
2681
|
-
function
|
|
2682
|
-
const s = t ?
|
|
2678
|
+
function Rt(t, e, n, r) {
|
|
2679
|
+
const s = t ? ni(t, e, n) : null, i = k(), o = [k(), e, n], a = [k(), n, e];
|
|
2683
2680
|
return {
|
|
2684
2681
|
id: i,
|
|
2685
2682
|
"forward-identity": o,
|
|
@@ -2693,7 +2690,7 @@ function Ut(t, e, n, r) {
|
|
|
2693
2690
|
...r || {}
|
|
2694
2691
|
};
|
|
2695
2692
|
}
|
|
2696
|
-
const
|
|
2693
|
+
const ri = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), si = /* @__PURE__ */ new Set(["link", "unlink"]), ii = /* @__PURE__ */ new Set(["create", "update", "merge"]), oi = /* @__PURE__ */ new Set([
|
|
2697
2694
|
"link",
|
|
2698
2695
|
"unlink",
|
|
2699
2696
|
"create",
|
|
@@ -2701,17 +2698,17 @@ const si = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
2701
2698
|
"merge",
|
|
2702
2699
|
"delete",
|
|
2703
2700
|
"ruleParams"
|
|
2704
|
-
]),
|
|
2705
|
-
function
|
|
2701
|
+
]), tt = { "unique?": !0, "index?": !0 }, ai = { ...tt, cardinality: "one" };
|
|
2702
|
+
function ci(t) {
|
|
2706
2703
|
const e = [], [n, r, s, i] = t;
|
|
2707
|
-
if (!
|
|
2704
|
+
if (!oi.has(n))
|
|
2708
2705
|
return e;
|
|
2709
|
-
const o =
|
|
2706
|
+
const o = et(s);
|
|
2710
2707
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
2711
2708
|
for (const [a, c] of Object.entries(i)) {
|
|
2712
2709
|
const u = Array.isArray(c) ? c : [c];
|
|
2713
2710
|
for (const l of u) {
|
|
2714
|
-
const f =
|
|
2711
|
+
const f = et(l);
|
|
2715
2712
|
f && e.push({
|
|
2716
2713
|
etype: r,
|
|
2717
2714
|
lookupPair: f,
|
|
@@ -2721,7 +2718,7 @@ function ui(t) {
|
|
|
2721
2718
|
}
|
|
2722
2719
|
return e;
|
|
2723
2720
|
}
|
|
2724
|
-
function
|
|
2721
|
+
function ui({ attrs: t, schema: e }, n) {
|
|
2725
2722
|
var u, l;
|
|
2726
2723
|
const [r, s, i] = [/* @__PURE__ */ new Set(), { ...t }, []];
|
|
2727
2724
|
function o(f) {
|
|
@@ -2732,67 +2729,67 @@ function li({ attrs: t, schema: e }, n) {
|
|
|
2732
2729
|
}
|
|
2733
2730
|
function c(f, d) {
|
|
2734
2731
|
const h = C(s, f, d), p = J(s, f, d);
|
|
2735
|
-
a(h), a(p), !h && !p && o(
|
|
2732
|
+
a(h), a(p), !h && !p && o(Rt(e, f, d, ai));
|
|
2736
2733
|
}
|
|
2737
2734
|
for (const f of n)
|
|
2738
|
-
for (const { etype: d, lookupPair: h, linkLabel: p } of
|
|
2735
|
+
for (const { etype: d, lookupPair: h, linkLabel: p } of ci(f)) {
|
|
2739
2736
|
const b = h[0];
|
|
2740
2737
|
if (p) {
|
|
2741
2738
|
c(d, p);
|
|
2742
2739
|
const _ = C(s, d, p), y = J(s, d, p);
|
|
2743
2740
|
a(_), a(y);
|
|
2744
2741
|
const g = ((u = _ == null ? void 0 : _["reverse-identity"]) == null ? void 0 : u[1]) || ((l = y == null ? void 0 : y["forward-identity"]) == null ? void 0 : l[1]) || p;
|
|
2745
|
-
if (
|
|
2746
|
-
c(g,
|
|
2742
|
+
if (Ze(s, g, b))
|
|
2743
|
+
c(g, Xe(b));
|
|
2747
2744
|
else {
|
|
2748
2745
|
const T = C(s, g, b);
|
|
2749
2746
|
T || o(
|
|
2750
|
-
_e(e, g, b,
|
|
2747
|
+
_e(e, g, b, tt)
|
|
2751
2748
|
), a(T);
|
|
2752
2749
|
}
|
|
2753
|
-
} else if (
|
|
2754
|
-
c(d,
|
|
2750
|
+
} else if (Ze(s, d, b))
|
|
2751
|
+
c(d, Xe(b));
|
|
2755
2752
|
else {
|
|
2756
2753
|
const _ = C(s, d, b);
|
|
2757
|
-
_ || o(_e(e, d, b,
|
|
2754
|
+
_ || o(_e(e, d, b, tt)), a(_);
|
|
2758
2755
|
}
|
|
2759
2756
|
}
|
|
2760
2757
|
for (const f of n) {
|
|
2761
2758
|
const [d, h, p, b] = f;
|
|
2762
|
-
if (
|
|
2759
|
+
if (ri.has(d)) {
|
|
2763
2760
|
const _ = C(s, h, "id");
|
|
2764
2761
|
a(_), _ || o(_e(e, h, "id", { "unique?": !0 }));
|
|
2765
2762
|
for (const y of Object.keys(b)) {
|
|
2766
2763
|
const g = C(s, h, y);
|
|
2767
|
-
if (a(g),
|
|
2764
|
+
if (a(g), ii.has(d) && (g || o(
|
|
2768
2765
|
_e(
|
|
2769
2766
|
e,
|
|
2770
2767
|
h,
|
|
2771
2768
|
y,
|
|
2772
2769
|
y === "id" ? { "unique?": !0 } : null
|
|
2773
2770
|
)
|
|
2774
|
-
)),
|
|
2771
|
+
)), si.has(d)) {
|
|
2775
2772
|
const T = J(s, h, y);
|
|
2776
|
-
!g && !T && o(
|
|
2773
|
+
!g && !T && o(Rt(e, h, y)), a(T);
|
|
2777
2774
|
}
|
|
2778
2775
|
}
|
|
2779
2776
|
}
|
|
2780
2777
|
}
|
|
2781
2778
|
return [s, i];
|
|
2782
2779
|
}
|
|
2783
|
-
function
|
|
2784
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((c) =>
|
|
2780
|
+
function li(t, e) {
|
|
2781
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((c) => Fs(c)), [s, i] = ui(t, r), o = { ...t, attrs: s }, a = r.flatMap((c) => Zs(o, c));
|
|
2785
2782
|
return [...i, ...a];
|
|
2786
2783
|
}
|
|
2787
|
-
function
|
|
2784
|
+
function Ut(t, e) {
|
|
2788
2785
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
2789
2786
|
}
|
|
2790
2787
|
const fe = "__meta";
|
|
2791
|
-
class
|
|
2788
|
+
class fi {
|
|
2792
2789
|
constructor(e, n) {
|
|
2793
2790
|
}
|
|
2794
2791
|
}
|
|
2795
|
-
class
|
|
2792
|
+
class nt {
|
|
2796
2793
|
constructor(e) {
|
|
2797
2794
|
this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
|
|
2798
2795
|
isLoading: !0,
|
|
@@ -2974,7 +2971,7 @@ class rt {
|
|
|
2974
2971
|
gc() {
|
|
2975
2972
|
this._nextGc || (this._nextGc = setTimeout(
|
|
2976
2973
|
() => {
|
|
2977
|
-
|
|
2974
|
+
Ut(() => {
|
|
2978
2975
|
this._nextGc = null, this._gc();
|
|
2979
2976
|
}, 30 * 1e3);
|
|
2980
2977
|
},
|
|
@@ -2989,7 +2986,7 @@ class rt {
|
|
|
2989
2986
|
return;
|
|
2990
2987
|
}
|
|
2991
2988
|
this._nextSave = setTimeout(() => {
|
|
2992
|
-
|
|
2989
|
+
Ut(() => {
|
|
2993
2990
|
this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
|
|
2994
2991
|
}, this._idleCallbackMaxWaitMs);
|
|
2995
2992
|
}, this._saveThrottleMs);
|
|
@@ -3021,13 +3018,13 @@ class rt {
|
|
|
3021
3018
|
};
|
|
3022
3019
|
}
|
|
3023
3020
|
}
|
|
3024
|
-
const
|
|
3025
|
-
function
|
|
3021
|
+
const di = 6, hi = ["kv", "querySubs", "syncSubs"];
|
|
3022
|
+
function pi(t) {
|
|
3026
3023
|
return function(n) {
|
|
3027
3024
|
console.error("Error in IndexedDB event", { source: t, event: n });
|
|
3028
3025
|
};
|
|
3029
3026
|
}
|
|
3030
|
-
async function
|
|
3027
|
+
async function yi(t) {
|
|
3031
3028
|
return new Promise((e) => {
|
|
3032
3029
|
const n = indexedDB.open(t);
|
|
3033
3030
|
n.onerror = (r) => {
|
|
@@ -3041,7 +3038,7 @@ async function bi(t) {
|
|
|
3041
3038
|
};
|
|
3042
3039
|
});
|
|
3043
3040
|
}
|
|
3044
|
-
async function
|
|
3041
|
+
async function bi(t, e, n) {
|
|
3045
3042
|
const r = (
|
|
3046
3043
|
// Backwards compatibility for older versions where we JSON.stringified before storing
|
|
3047
3044
|
typeof e == "string" ? JSON.parse(e) : e
|
|
@@ -3075,14 +3072,14 @@ async function _i(t, e, n) {
|
|
|
3075
3072
|
};
|
|
3076
3073
|
});
|
|
3077
3074
|
}
|
|
3078
|
-
async function
|
|
3075
|
+
async function Lt(t, e, n) {
|
|
3079
3076
|
const r = n.put(e, t);
|
|
3080
3077
|
return new Promise((s, i) => {
|
|
3081
3078
|
r.onsuccess = () => s(), r.onerror = (o) => i(o);
|
|
3082
3079
|
});
|
|
3083
3080
|
}
|
|
3084
|
-
async function
|
|
3085
|
-
const n = await
|
|
3081
|
+
async function _i(t, e) {
|
|
3082
|
+
const n = await yi(`instant_${t}_5`);
|
|
3086
3083
|
if (!n)
|
|
3087
3084
|
return;
|
|
3088
3085
|
const r = await new Promise((l, f) => {
|
|
@@ -3105,12 +3102,12 @@ async function gi(t, e) {
|
|
|
3105
3102
|
for (const [l, f] of r)
|
|
3106
3103
|
switch (l) {
|
|
3107
3104
|
case "querySubs": {
|
|
3108
|
-
const d =
|
|
3105
|
+
const d = bi(l, f, o);
|
|
3109
3106
|
a.push(d);
|
|
3110
3107
|
break;
|
|
3111
3108
|
}
|
|
3112
3109
|
default: {
|
|
3113
|
-
const d =
|
|
3110
|
+
const d = Lt(l, f, i);
|
|
3114
3111
|
a.push(d);
|
|
3115
3112
|
const h = {
|
|
3116
3113
|
createdAt: Date.now(),
|
|
@@ -3121,15 +3118,15 @@ async function gi(t, e) {
|
|
|
3121
3118
|
break;
|
|
3122
3119
|
}
|
|
3123
3120
|
}
|
|
3124
|
-
const u =
|
|
3121
|
+
const u = Lt(fe, c, i);
|
|
3125
3122
|
a.push(u), await Promise.all(a), await new Promise((l, f) => {
|
|
3126
3123
|
s.oncomplete = (d) => l(d), s.onerror = (d) => f(d), s.onabort = (d) => f(d);
|
|
3127
3124
|
});
|
|
3128
3125
|
}
|
|
3129
|
-
const
|
|
3130
|
-
class
|
|
3126
|
+
const Ft = /* @__PURE__ */ new Map();
|
|
3127
|
+
class Dn extends fi {
|
|
3131
3128
|
constructor(e, n) {
|
|
3132
|
-
super(e, n), this.dbName = `instant_${e}_${
|
|
3129
|
+
super(e, n), this.dbName = `instant_${e}_${di}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
|
|
3133
3130
|
}
|
|
3134
3131
|
_init() {
|
|
3135
3132
|
return new Promise((e, n) => {
|
|
@@ -3140,12 +3137,12 @@ class Rn extends di {
|
|
|
3140
3137
|
}, s.onsuccess = (i) => {
|
|
3141
3138
|
const a = i.target.result;
|
|
3142
3139
|
if (r) {
|
|
3143
|
-
const c =
|
|
3144
|
-
|
|
3140
|
+
const c = _i(this._appId, a).catch((u) => {
|
|
3141
|
+
pi("Error upgrading store from version 5 to 6.")(u);
|
|
3145
3142
|
});
|
|
3146
|
-
|
|
3143
|
+
Ft.set(this.dbName, c), c.then(() => e(a)).catch(() => e(a));
|
|
3147
3144
|
} else {
|
|
3148
|
-
const c =
|
|
3145
|
+
const c = Ft.get(this.dbName);
|
|
3149
3146
|
c ? c.then(() => e(a)).catch(() => e(a)) : e(a);
|
|
3150
3147
|
}
|
|
3151
3148
|
}, s.onupgradeneeded = (i) => {
|
|
@@ -3155,7 +3152,7 @@ class Rn extends di {
|
|
|
3155
3152
|
}
|
|
3156
3153
|
_upgradeStore(e) {
|
|
3157
3154
|
const r = e.target.result;
|
|
3158
|
-
for (const s of
|
|
3155
|
+
for (const s of hi)
|
|
3159
3156
|
r.objectStoreNames.contains(s) || r.createObjectStore(s);
|
|
3160
3157
|
}
|
|
3161
3158
|
async getItem(e) {
|
|
@@ -3261,7 +3258,7 @@ async function q(t, e) {
|
|
|
3261
3258
|
const n = await fetch(t, e), r = await n.json();
|
|
3262
3259
|
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new Pe({ status: n.status, body: r }));
|
|
3263
3260
|
}
|
|
3264
|
-
function
|
|
3261
|
+
function gi({
|
|
3265
3262
|
apiURI: t,
|
|
3266
3263
|
appId: e,
|
|
3267
3264
|
email: n
|
|
@@ -3272,7 +3269,7 @@ function wi({
|
|
|
3272
3269
|
body: JSON.stringify({ "app-id": e, email: n })
|
|
3273
3270
|
});
|
|
3274
3271
|
}
|
|
3275
|
-
async function
|
|
3272
|
+
async function wi({
|
|
3276
3273
|
apiURI: t,
|
|
3277
3274
|
appId: e,
|
|
3278
3275
|
email: n,
|
|
@@ -3290,7 +3287,7 @@ async function Ti({
|
|
|
3290
3287
|
})
|
|
3291
3288
|
});
|
|
3292
3289
|
}
|
|
3293
|
-
async function
|
|
3290
|
+
async function Ti({
|
|
3294
3291
|
apiURI: t,
|
|
3295
3292
|
appId: e,
|
|
3296
3293
|
refreshToken: n
|
|
@@ -3304,7 +3301,7 @@ async function mi({
|
|
|
3304
3301
|
})
|
|
3305
3302
|
});
|
|
3306
3303
|
}
|
|
3307
|
-
async function
|
|
3304
|
+
async function mi({
|
|
3308
3305
|
apiURI: t,
|
|
3309
3306
|
appId: e
|
|
3310
3307
|
}) {
|
|
@@ -3316,7 +3313,7 @@ async function Si({
|
|
|
3316
3313
|
})
|
|
3317
3314
|
});
|
|
3318
3315
|
}
|
|
3319
|
-
async function
|
|
3316
|
+
async function Nt({
|
|
3320
3317
|
apiURI: t,
|
|
3321
3318
|
appId: e,
|
|
3322
3319
|
code: n,
|
|
@@ -3334,7 +3331,7 @@ async function Kt({
|
|
|
3334
3331
|
})
|
|
3335
3332
|
});
|
|
3336
3333
|
}
|
|
3337
|
-
async function
|
|
3334
|
+
async function Si({
|
|
3338
3335
|
apiURI: t,
|
|
3339
3336
|
appId: e,
|
|
3340
3337
|
nonce: n,
|
|
@@ -3354,7 +3351,7 @@ async function Oi({
|
|
|
3354
3351
|
})
|
|
3355
3352
|
});
|
|
3356
3353
|
}
|
|
3357
|
-
async function
|
|
3354
|
+
async function Oi({
|
|
3358
3355
|
apiURI: t,
|
|
3359
3356
|
appId: e,
|
|
3360
3357
|
refreshToken: n
|
|
@@ -3370,7 +3367,7 @@ async function vi({
|
|
|
3370
3367
|
})
|
|
3371
3368
|
});
|
|
3372
3369
|
}
|
|
3373
|
-
async function
|
|
3370
|
+
async function vi({
|
|
3374
3371
|
apiURI: t,
|
|
3375
3372
|
appId: e,
|
|
3376
3373
|
path: n,
|
|
@@ -3391,7 +3388,7 @@ async function Ai({
|
|
|
3391
3388
|
body: r
|
|
3392
3389
|
});
|
|
3393
3390
|
}
|
|
3394
|
-
async function
|
|
3391
|
+
async function Ai({
|
|
3395
3392
|
apiURI: t,
|
|
3396
3393
|
appId: e,
|
|
3397
3394
|
path: n,
|
|
@@ -3409,7 +3406,7 @@ async function ki({
|
|
|
3409
3406
|
);
|
|
3410
3407
|
return s;
|
|
3411
3408
|
}
|
|
3412
|
-
async function
|
|
3409
|
+
async function ki({
|
|
3413
3410
|
apiURI: t,
|
|
3414
3411
|
appId: e,
|
|
3415
3412
|
fileName: n,
|
|
@@ -3429,7 +3426,7 @@ async function Ei({
|
|
|
3429
3426
|
});
|
|
3430
3427
|
return i;
|
|
3431
3428
|
}
|
|
3432
|
-
async function
|
|
3429
|
+
async function Ei(t, e) {
|
|
3433
3430
|
return (await fetch(t, {
|
|
3434
3431
|
method: "PUT",
|
|
3435
3432
|
body: e,
|
|
@@ -3438,7 +3435,7 @@ async function Ci(t, e) {
|
|
|
3438
3435
|
}
|
|
3439
3436
|
})).ok;
|
|
3440
3437
|
}
|
|
3441
|
-
async function
|
|
3438
|
+
async function Ci({
|
|
3442
3439
|
apiURI: t,
|
|
3443
3440
|
appId: e,
|
|
3444
3441
|
path: n,
|
|
@@ -3458,39 +3455,39 @@ async function Mi({
|
|
|
3458
3455
|
);
|
|
3459
3456
|
return s;
|
|
3460
3457
|
}
|
|
3461
|
-
let
|
|
3462
|
-
typeof window < "u" && typeof window.localStorage < "u" && (
|
|
3463
|
-
function
|
|
3458
|
+
let _t = !1, Rn = !1, Un = !1;
|
|
3459
|
+
typeof window < "u" && typeof window.localStorage < "u" && (_t = !!window.localStorage.getItem("devBackend"), Rn = !!window.localStorage.getItem("__instantLogging"), Un = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
3460
|
+
function Kt(t, e) {
|
|
3464
3461
|
if (!e) return t;
|
|
3465
3462
|
const n = {};
|
|
3466
3463
|
return e.forEach((r) => {
|
|
3467
3464
|
n[r] = t[r];
|
|
3468
3465
|
}), n;
|
|
3469
3466
|
}
|
|
3470
|
-
function
|
|
3467
|
+
function Mi(t, e, n) {
|
|
3471
3468
|
const r = {
|
|
3472
3469
|
peers: {}
|
|
3473
3470
|
};
|
|
3474
3471
|
if (e && "user" in e ? e.user : !0) {
|
|
3475
|
-
const i =
|
|
3472
|
+
const i = Kt(t.user ?? {}, e == null ? void 0 : e.keys);
|
|
3476
3473
|
r.user = { ...i, peerId: n };
|
|
3477
3474
|
}
|
|
3478
3475
|
for (const i of Object.keys(t.peers ?? {})) {
|
|
3479
3476
|
const o = (e == null ? void 0 : e.peers) === void 0, a = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(i));
|
|
3480
3477
|
if (o || a) {
|
|
3481
|
-
const c =
|
|
3478
|
+
const c = Kt(t.peers[i], e == null ? void 0 : e.keys);
|
|
3482
3479
|
r.peers[i] = { ...c, peerId: i };
|
|
3483
3480
|
}
|
|
3484
3481
|
}
|
|
3485
3482
|
return r;
|
|
3486
3483
|
}
|
|
3487
|
-
function
|
|
3488
|
-
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !
|
|
3484
|
+
function Ii(t, e) {
|
|
3485
|
+
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !kt(t.user, e.user)) || !ln(t.peers, e.peers)) return !0;
|
|
3489
3486
|
for (const r of Object.keys(t.peers))
|
|
3490
|
-
if (!
|
|
3487
|
+
if (!kt(t.peers[r], e.peers[r])) return !0;
|
|
3491
3488
|
return !1;
|
|
3492
3489
|
}
|
|
3493
|
-
class
|
|
3490
|
+
class qt {
|
|
3494
3491
|
constructor() {
|
|
3495
3492
|
w(this, "promise");
|
|
3496
3493
|
w(this, "_resolve");
|
|
@@ -3506,20 +3503,20 @@ class zt {
|
|
|
3506
3503
|
this._reject(e);
|
|
3507
3504
|
}
|
|
3508
3505
|
}
|
|
3509
|
-
function
|
|
3506
|
+
function Ln(t, e = []) {
|
|
3510
3507
|
t.forEach((n) => {
|
|
3511
3508
|
const { data: r } = n, { "datalog-result": s } = r, { "join-rows": i } = s;
|
|
3512
3509
|
for (const o of i)
|
|
3513
3510
|
for (const a of o)
|
|
3514
3511
|
e.push(a);
|
|
3515
|
-
|
|
3512
|
+
Ln(n["child-nodes"], e);
|
|
3516
3513
|
});
|
|
3517
3514
|
}
|
|
3518
|
-
function
|
|
3515
|
+
function zt(t) {
|
|
3519
3516
|
const e = [];
|
|
3520
|
-
return
|
|
3517
|
+
return Ln(t, e), e;
|
|
3521
3518
|
}
|
|
3522
|
-
function
|
|
3519
|
+
function Vt(t) {
|
|
3523
3520
|
return Object.values(t.links).reduce((e, n) => {
|
|
3524
3521
|
var r, s;
|
|
3525
3522
|
return e[r = n.forward.on] ?? (e[r] = {}), e[n.forward.on][n.forward.label] = {
|
|
@@ -3533,8 +3530,8 @@ function Wt(t) {
|
|
|
3533
3530
|
}, e;
|
|
3534
3531
|
}, {});
|
|
3535
3532
|
}
|
|
3536
|
-
const
|
|
3537
|
-
function
|
|
3533
|
+
const Fn = "v0.22.88-experimental.drewh-fix-explorer.20249092035.1";
|
|
3534
|
+
function Pi(t, e) {
|
|
3538
3535
|
return {
|
|
3539
3536
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
3540
3537
|
},
|
|
@@ -3643,7 +3640,7 @@ class O extends Error {
|
|
|
3643
3640
|
super(r), this.name = "QueryValidationError";
|
|
3644
3641
|
}
|
|
3645
3642
|
}
|
|
3646
|
-
const
|
|
3643
|
+
const Wt = [
|
|
3647
3644
|
"where",
|
|
3648
3645
|
"order",
|
|
3649
3646
|
"limit",
|
|
@@ -3654,7 +3651,7 @@ const Qt = [
|
|
|
3654
3651
|
"before",
|
|
3655
3652
|
"fields",
|
|
3656
3653
|
"aggregate"
|
|
3657
|
-
],
|
|
3654
|
+
], ji = (t) => t.valueType || "unknown", Nn = (t, e, n = !1) => {
|
|
3658
3655
|
if (n || t == null) return !0;
|
|
3659
3656
|
switch (e) {
|
|
3660
3657
|
case "string":
|
|
@@ -3668,9 +3665,9 @@ const Qt = [
|
|
|
3668
3665
|
default:
|
|
3669
3666
|
return !0;
|
|
3670
3667
|
}
|
|
3671
|
-
},
|
|
3668
|
+
}, $i = (t, e, n, r, s, i, o) => {
|
|
3672
3669
|
const a = i.valueType === "json", c = (u, l, f) => {
|
|
3673
|
-
if (!
|
|
3670
|
+
if (!Nn(f, l, a))
|
|
3674
3671
|
throw new O(
|
|
3675
3672
|
`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`,
|
|
3676
3673
|
o
|
|
@@ -3713,13 +3710,13 @@ const Qt = [
|
|
|
3713
3710
|
);
|
|
3714
3711
|
}
|
|
3715
3712
|
}, ee = (t, e, n, r, s) => {
|
|
3716
|
-
const i =
|
|
3713
|
+
const i = ji(n), o = n.valueType === "json";
|
|
3717
3714
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
3718
3715
|
if (o)
|
|
3719
3716
|
return;
|
|
3720
3717
|
const c = t;
|
|
3721
3718
|
for (const [u, l] of Object.entries(c))
|
|
3722
|
-
|
|
3719
|
+
$i(
|
|
3723
3720
|
u,
|
|
3724
3721
|
l,
|
|
3725
3722
|
i,
|
|
@@ -3728,12 +3725,12 @@ const Qt = [
|
|
|
3728
3725
|
n,
|
|
3729
3726
|
`${s}.${u}`
|
|
3730
3727
|
);
|
|
3731
|
-
} else if (!
|
|
3728
|
+
} else if (!Nn(t, i, o))
|
|
3732
3729
|
throw new O(
|
|
3733
3730
|
`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof t}`,
|
|
3734
3731
|
s
|
|
3735
3732
|
);
|
|
3736
|
-
},
|
|
3733
|
+
}, Di = (t, e, n, r, s) => {
|
|
3737
3734
|
const i = t.split(".");
|
|
3738
3735
|
if (i.length < 2)
|
|
3739
3736
|
throw new O(
|
|
@@ -3803,12 +3800,12 @@ const Qt = [
|
|
|
3803
3800
|
);
|
|
3804
3801
|
}
|
|
3805
3802
|
ee(e, t, u, n, s);
|
|
3806
|
-
},
|
|
3803
|
+
}, Kn = (t, e, n, r) => {
|
|
3807
3804
|
for (const [s, i] of Object.entries(t)) {
|
|
3808
3805
|
if (s === "or" || s === "and") {
|
|
3809
3806
|
if (Array.isArray(i))
|
|
3810
3807
|
for (const u of i)
|
|
3811
|
-
typeof u == "object" && u !== null &&
|
|
3808
|
+
typeof u == "object" && u !== null && Kn(
|
|
3812
3809
|
u,
|
|
3813
3810
|
e,
|
|
3814
3811
|
n,
|
|
@@ -3827,7 +3824,7 @@ const Qt = [
|
|
|
3827
3824
|
continue;
|
|
3828
3825
|
}
|
|
3829
3826
|
if (s.includes(".")) {
|
|
3830
|
-
|
|
3827
|
+
Di(
|
|
3831
3828
|
s,
|
|
3832
3829
|
i,
|
|
3833
3830
|
e,
|
|
@@ -3872,9 +3869,9 @@ const Qt = [
|
|
|
3872
3869
|
}
|
|
3873
3870
|
}, xi = (t, e, n, r, s = 0) => {
|
|
3874
3871
|
for (const o of Object.keys(t))
|
|
3875
|
-
if (!
|
|
3872
|
+
if (!Wt.includes(o))
|
|
3876
3873
|
throw new O(
|
|
3877
|
-
`Invalid query parameter '${o}' in $ object. Valid parameters are: ${
|
|
3874
|
+
`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Wt.join(", ")}. Found: ${o}`,
|
|
3878
3875
|
r
|
|
3879
3876
|
);
|
|
3880
3877
|
const i = [
|
|
@@ -3897,14 +3894,14 @@ const Qt = [
|
|
|
3897
3894
|
`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`,
|
|
3898
3895
|
r ? `${r}.where` : void 0
|
|
3899
3896
|
);
|
|
3900
|
-
|
|
3897
|
+
Kn(
|
|
3901
3898
|
t.where,
|
|
3902
3899
|
e,
|
|
3903
3900
|
n,
|
|
3904
3901
|
r ? `${r}.where` : "where"
|
|
3905
3902
|
);
|
|
3906
3903
|
}
|
|
3907
|
-
},
|
|
3904
|
+
}, qn = (t, e, n, r, s = 0) => {
|
|
3908
3905
|
var i;
|
|
3909
3906
|
if (!t || typeof t != "object")
|
|
3910
3907
|
throw new O(
|
|
@@ -3923,7 +3920,7 @@ const Qt = [
|
|
|
3923
3920
|
const a = t[o];
|
|
3924
3921
|
if (typeof a == "object" && a !== null) {
|
|
3925
3922
|
const c = (i = n == null ? void 0 : n.entities[e].links[o]) == null ? void 0 : i.entityName;
|
|
3926
|
-
c &&
|
|
3923
|
+
c && qn(
|
|
3927
3924
|
a,
|
|
3928
3925
|
c,
|
|
3929
3926
|
n,
|
|
@@ -3946,7 +3943,7 @@ const Qt = [
|
|
|
3946
3943
|
s
|
|
3947
3944
|
);
|
|
3948
3945
|
}
|
|
3949
|
-
},
|
|
3946
|
+
}, Qt = (t, e) => {
|
|
3950
3947
|
if (typeof t != "object" || t === null)
|
|
3951
3948
|
throw new O(
|
|
3952
3949
|
`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`
|
|
@@ -3975,7 +3972,7 @@ const Qt = [
|
|
|
3975
3972
|
r
|
|
3976
3973
|
);
|
|
3977
3974
|
}
|
|
3978
|
-
|
|
3975
|
+
qn(
|
|
3979
3976
|
n[r],
|
|
3980
3977
|
r,
|
|
3981
3978
|
e,
|
|
@@ -3985,30 +3982,30 @@ const Qt = [
|
|
|
3985
3982
|
);
|
|
3986
3983
|
}
|
|
3987
3984
|
}
|
|
3988
|
-
},
|
|
3985
|
+
}, Gt = (t) => typeof t != "string" ? !1 : Ce(t) ? !0 : te(t);
|
|
3989
3986
|
class F extends Error {
|
|
3990
3987
|
constructor(e) {
|
|
3991
3988
|
super(e), this.name = "TransactionValidationError";
|
|
3992
3989
|
}
|
|
3993
3990
|
}
|
|
3994
|
-
const
|
|
3995
|
-
`Entity '${t}' does not exist in schema. Available entities: ${
|
|
3996
|
-
),
|
|
3991
|
+
const zn = (t) => t.length > 0 ? t.join(", ") : "none", Ri = (t, e) => new F(
|
|
3992
|
+
`Entity '${t}' does not exist in schema. Available entities: ${zn(e)}`
|
|
3993
|
+
), Ue = {
|
|
3997
3994
|
string: (t) => typeof t == "string",
|
|
3998
3995
|
number: (t) => typeof t == "number" && !isNaN(t),
|
|
3999
3996
|
boolean: (t) => typeof t == "boolean",
|
|
4000
3997
|
date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
|
|
4001
3998
|
json: () => !0
|
|
4002
|
-
},
|
|
3999
|
+
}, Ui = (t, e) => {
|
|
4003
4000
|
var n;
|
|
4004
|
-
return t == null ? !0 : ((n =
|
|
4005
|
-
},
|
|
4001
|
+
return t == null ? !0 : ((n = Ue[e.valueType]) == null ? void 0 : n.call(Ue, t)) ?? !1;
|
|
4002
|
+
}, Vn = (t, e) => {
|
|
4006
4003
|
const n = e.entities[t];
|
|
4007
4004
|
if (!n)
|
|
4008
|
-
throw
|
|
4005
|
+
throw Ri(t, Object.keys(e.entities));
|
|
4009
4006
|
return n;
|
|
4010
|
-
},
|
|
4011
|
-
const r =
|
|
4007
|
+
}, Le = (t, e, n) => {
|
|
4008
|
+
const r = Vn(t, n);
|
|
4012
4009
|
if (typeof e != "object" || e === null)
|
|
4013
4010
|
throw new F(
|
|
4014
4011
|
`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`
|
|
@@ -4016,13 +4013,13 @@ const Vn = (t) => t.length > 0 ? t.join(", ") : "none", Ui = (t, e) => new F(
|
|
|
4016
4013
|
for (const [s, i] of Object.entries(e)) {
|
|
4017
4014
|
if (s === "id") continue;
|
|
4018
4015
|
const o = r.attrs[s];
|
|
4019
|
-
if (o && !
|
|
4016
|
+
if (o && !Ui(i, o))
|
|
4020
4017
|
throw new F(
|
|
4021
4018
|
`Invalid value for attribute '${s}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof i}`
|
|
4022
4019
|
);
|
|
4023
4020
|
}
|
|
4024
|
-
},
|
|
4025
|
-
const r =
|
|
4021
|
+
}, Bt = (t, e, n) => {
|
|
4022
|
+
const r = Vn(t, n);
|
|
4026
4023
|
if (typeof e != "object" || e === null)
|
|
4027
4024
|
throw new F(
|
|
4028
4025
|
`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`
|
|
@@ -4031,31 +4028,31 @@ const Vn = (t) => t.length > 0 ? t.join(", ") : "none", Ui = (t, e) => new F(
|
|
|
4031
4028
|
if (!r.links[s]) {
|
|
4032
4029
|
const a = Object.keys(r.links);
|
|
4033
4030
|
throw new F(
|
|
4034
|
-
`Link '${s}' does not exist on entity '${t}'. Available links: ${
|
|
4031
|
+
`Link '${s}' does not exist on entity '${t}'. Available links: ${zn(a)}`
|
|
4035
4032
|
);
|
|
4036
4033
|
}
|
|
4037
4034
|
if (i != null) {
|
|
4038
4035
|
if (Array.isArray(i)) {
|
|
4039
4036
|
for (const a of i)
|
|
4040
|
-
if (!
|
|
4037
|
+
if (!Gt(a))
|
|
4041
4038
|
throw new F(
|
|
4042
4039
|
`Invalid entity ID in link '${s}' for entity '${t}'. Expected a UUID or a lookup, but received: ${a}`
|
|
4043
4040
|
);
|
|
4044
|
-
} else if (!
|
|
4041
|
+
} else if (!Gt(i))
|
|
4045
4042
|
throw new F(
|
|
4046
4043
|
`Invalid UUID in link '${s}' for entity '${t}'. Expected a UUID, but received: ${i}`
|
|
4047
4044
|
);
|
|
4048
4045
|
}
|
|
4049
4046
|
}
|
|
4050
|
-
},
|
|
4051
|
-
create:
|
|
4052
|
-
update:
|
|
4053
|
-
merge:
|
|
4054
|
-
link:
|
|
4055
|
-
unlink:
|
|
4047
|
+
}, Li = {
|
|
4048
|
+
create: Le,
|
|
4049
|
+
update: Le,
|
|
4050
|
+
merge: Le,
|
|
4051
|
+
link: Bt,
|
|
4052
|
+
unlink: Bt,
|
|
4056
4053
|
delete: () => {
|
|
4057
4054
|
}
|
|
4058
|
-
},
|
|
4055
|
+
}, Fi = (t, e) => {
|
|
4059
4056
|
if (!e) return;
|
|
4060
4057
|
const [n, r, s, i] = t;
|
|
4061
4058
|
if (!Array.isArray(s) && !te(s))
|
|
@@ -4066,9 +4063,9 @@ const Vn = (t) => t.length > 0 ? t.join(", ") : "none", Ui = (t, e) => new F(
|
|
|
4066
4063
|
throw new F(
|
|
4067
4064
|
`Entity name must be a string, but received: ${typeof r}`
|
|
4068
4065
|
);
|
|
4069
|
-
const o =
|
|
4066
|
+
const o = Li[n];
|
|
4070
4067
|
o && i !== void 0 && o(r, i, e);
|
|
4071
|
-
},
|
|
4068
|
+
}, Ni = (t, e) => {
|
|
4072
4069
|
const n = Array.isArray(t) ? t : [t];
|
|
4073
4070
|
for (const r of n) {
|
|
4074
4071
|
if (!r || typeof r != "object")
|
|
@@ -4084,14 +4081,14 @@ const Vn = (t) => t.length > 0 ? t.join(", ") : "none", Ui = (t, e) => new F(
|
|
|
4084
4081
|
throw new F(
|
|
4085
4082
|
`Transaction operation must be an array, but received: ${typeof s}`
|
|
4086
4083
|
);
|
|
4087
|
-
|
|
4084
|
+
Fi(s, e);
|
|
4088
4085
|
}
|
|
4089
4086
|
}
|
|
4090
4087
|
};
|
|
4091
|
-
let
|
|
4092
|
-
class
|
|
4088
|
+
let Wn = 0;
|
|
4089
|
+
class Ht {
|
|
4093
4090
|
constructor(e) {
|
|
4094
|
-
this.type = "ws", this.id = `${this.type}_${
|
|
4091
|
+
this.type = "ws", this.id = `${this.type}_${Wn++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
|
|
4095
4092
|
this.onopen && this.onopen({ target: this });
|
|
4096
4093
|
}, this.conn.onmessage = (n) => {
|
|
4097
4094
|
this.onmessage && this.onmessage({
|
|
@@ -4117,9 +4114,9 @@ class Jt {
|
|
|
4117
4114
|
return this.conn.send(JSON.stringify(e));
|
|
4118
4115
|
}
|
|
4119
4116
|
}
|
|
4120
|
-
class
|
|
4117
|
+
class Ki {
|
|
4121
4118
|
constructor(e, n) {
|
|
4122
|
-
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${
|
|
4119
|
+
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${Wn++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
|
|
4123
4120
|
this.initParams || this.handleError();
|
|
4124
4121
|
}, 1e4), this.conn.onmessage = (r) => {
|
|
4125
4122
|
const s = JSON.parse(r.data);
|
|
@@ -4200,34 +4197,34 @@ class qi {
|
|
|
4200
4197
|
this.handleClose();
|
|
4201
4198
|
}
|
|
4202
4199
|
}
|
|
4203
|
-
function
|
|
4200
|
+
function qi(t, e) {
|
|
4204
4201
|
const n = t.values;
|
|
4205
4202
|
if (n)
|
|
4206
4203
|
for (const r of n.entities || [])
|
|
4207
|
-
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store =
|
|
4204
|
+
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store = bn(r.store);
|
|
4208
4205
|
return t;
|
|
4209
4206
|
}
|
|
4210
|
-
function
|
|
4207
|
+
function zi(t, e) {
|
|
4211
4208
|
var n, r;
|
|
4212
4209
|
if ((n = e.values) != null && n.entities) {
|
|
4213
4210
|
const s = [];
|
|
4214
4211
|
for (const i of (r = e.values) == null ? void 0 : r.entities) {
|
|
4215
|
-
const o =
|
|
4212
|
+
const o = yn(i.store);
|
|
4216
4213
|
delete o.attrs, s.push({ ...i, store: o });
|
|
4217
4214
|
}
|
|
4218
4215
|
return { ...e, values: { ...e.values, entities: s } };
|
|
4219
4216
|
} else
|
|
4220
4217
|
return e;
|
|
4221
4218
|
}
|
|
4222
|
-
function
|
|
4219
|
+
function Vi(t, e, n) {
|
|
4223
4220
|
var i, o;
|
|
4224
4221
|
const r = (i = e == null ? void 0 : e.state) == null ? void 0 : i.txId, s = (o = n == null ? void 0 : n.state) == null ? void 0 : o.txId;
|
|
4225
4222
|
return r && (!s || r > s) ? e : s && (!r || s > r) ? n : e || n;
|
|
4226
4223
|
}
|
|
4227
|
-
function
|
|
4228
|
-
return
|
|
4224
|
+
function Fe(t, e) {
|
|
4225
|
+
return Mn({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4229
4226
|
}
|
|
4230
|
-
function
|
|
4227
|
+
function Jt(t, e, n) {
|
|
4231
4228
|
var i;
|
|
4232
4229
|
const r = (i = G(e, t.table, "id")) == null ? void 0 : i.id;
|
|
4233
4230
|
if (!r)
|
|
@@ -4235,18 +4232,18 @@ function Yt(t, e, n) {
|
|
|
4235
4232
|
const s = se(e.eav, [n, r, n]);
|
|
4236
4233
|
return s ? s[3] : -1;
|
|
4237
4234
|
}
|
|
4238
|
-
function
|
|
4235
|
+
function Yt(t, e) {
|
|
4239
4236
|
for (const { action: n, triple: r } of e)
|
|
4240
4237
|
switch (n) {
|
|
4241
4238
|
case "added":
|
|
4242
|
-
|
|
4239
|
+
wn(t, r);
|
|
4243
4240
|
break;
|
|
4244
4241
|
case "removed":
|
|
4245
|
-
|
|
4242
|
+
_n(t, r);
|
|
4246
4243
|
break;
|
|
4247
4244
|
}
|
|
4248
4245
|
}
|
|
4249
|
-
function
|
|
4246
|
+
function Wi(t, e) {
|
|
4250
4247
|
var r, s;
|
|
4251
4248
|
const n = {};
|
|
4252
4249
|
for (const { action: i, triple: o } of e) {
|
|
@@ -4273,14 +4270,14 @@ function Qi(t, e) {
|
|
|
4273
4270
|
function ge(t, e) {
|
|
4274
4271
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4275
4272
|
}
|
|
4276
|
-
function
|
|
4273
|
+
function Qi(t, e) {
|
|
4277
4274
|
var r;
|
|
4278
4275
|
if (t.orderFieldType)
|
|
4279
4276
|
return t.orderFieldType;
|
|
4280
4277
|
const n = t.orderField === "serverCreatedAt" ? "number" : (r = G(e([]), t.table, t.orderField)) == null ? void 0 : r["checked-data-type"];
|
|
4281
4278
|
return t.orderFieldType = n, n;
|
|
4282
4279
|
}
|
|
4283
|
-
function
|
|
4280
|
+
function Gi(t, e, n) {
|
|
4284
4281
|
const r = e;
|
|
4285
4282
|
if (t.orderField === "serverCreatedAt") {
|
|
4286
4283
|
n.sort(
|
|
@@ -4325,14 +4322,14 @@ function Bi(t, e, n) {
|
|
|
4325
4322
|
}
|
|
4326
4323
|
);
|
|
4327
4324
|
}
|
|
4328
|
-
var
|
|
4329
|
-
class
|
|
4325
|
+
var Bi = /* @__PURE__ */ ((t) => (t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error", t))(Bi || {});
|
|
4326
|
+
class Hi {
|
|
4330
4327
|
constructor(e, n, r, s, i) {
|
|
4331
|
-
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.subs = new
|
|
4328
|
+
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.subs = new nt({
|
|
4332
4329
|
persister: n,
|
|
4333
|
-
merge:
|
|
4334
|
-
serialize:
|
|
4335
|
-
parse: (o, a) =>
|
|
4330
|
+
merge: Vi,
|
|
4331
|
+
serialize: zi,
|
|
4332
|
+
parse: (o, a) => qi(a, this.config.useDateObjects),
|
|
4336
4333
|
objectSize: (o) => {
|
|
4337
4334
|
var a;
|
|
4338
4335
|
return ((a = o.values) == null ? void 0 : a.entities.length) || 0;
|
|
@@ -4465,11 +4462,11 @@ class Ji {
|
|
|
4465
4462
|
for (const u of r) {
|
|
4466
4463
|
const l = this.createStore(u);
|
|
4467
4464
|
a.attrs = l.attrs;
|
|
4468
|
-
const f =
|
|
4465
|
+
const f = Fe(o, l);
|
|
4469
4466
|
c.push({
|
|
4470
4467
|
store: l,
|
|
4471
4468
|
entity: f,
|
|
4472
|
-
serverCreatedAt:
|
|
4469
|
+
serverCreatedAt: Jt(o, l, f.id)
|
|
4473
4470
|
}), i.push(f);
|
|
4474
4471
|
}
|
|
4475
4472
|
this.subs.updateInPlace((u) => {
|
|
@@ -4539,9 +4536,9 @@ class Ji {
|
|
|
4539
4536
|
e: for (const [_, y] of Object.entries(u))
|
|
4540
4537
|
for (let g = 0; g < f.length; g++) {
|
|
4541
4538
|
const T = f[g];
|
|
4542
|
-
if (
|
|
4543
|
-
|
|
4544
|
-
const v =
|
|
4539
|
+
if (Mr(T.store, _)) {
|
|
4540
|
+
Yt(T.store, y);
|
|
4541
|
+
const v = Fe(s, T.store), m = Wi(T.store, y)[_];
|
|
4545
4542
|
v ? (d.push({
|
|
4546
4543
|
oldEntity: T.entity,
|
|
4547
4544
|
newEntity: v,
|
|
@@ -4553,8 +4550,8 @@ class Ji {
|
|
|
4553
4550
|
const h = [];
|
|
4554
4551
|
for (const [_, y] of Object.entries(u)) {
|
|
4555
4552
|
const g = this.createStore([]);
|
|
4556
|
-
l.attrs = g.attrs,
|
|
4557
|
-
const T =
|
|
4553
|
+
l.attrs = g.attrs, Yt(g, y);
|
|
4554
|
+
const T = Fe(s, g);
|
|
4558
4555
|
if (!T) {
|
|
4559
4556
|
this.log.error("No entity found after applying change", {
|
|
4560
4557
|
sub: s,
|
|
@@ -4566,14 +4563,14 @@ class Ji {
|
|
|
4566
4563
|
f.push({
|
|
4567
4564
|
store: g,
|
|
4568
4565
|
entity: T,
|
|
4569
|
-
serverCreatedAt:
|
|
4566
|
+
serverCreatedAt: Jt(s, g, T.id)
|
|
4570
4567
|
}), h.push(T);
|
|
4571
4568
|
}
|
|
4572
4569
|
const p = [];
|
|
4573
4570
|
for (const _ of c.sort().reverse())
|
|
4574
4571
|
p.push(f[_].entity), f.splice(_, 1);
|
|
4575
|
-
const b =
|
|
4576
|
-
|
|
4572
|
+
const b = Qi(s, this.createStore);
|
|
4573
|
+
Gi(s, b, f), this.notifyCbs(r, {
|
|
4577
4574
|
type: "SyncTransaction",
|
|
4578
4575
|
data: ge(s, (o = s.values) == null ? void 0 : o.entities),
|
|
4579
4576
|
added: h,
|
|
@@ -4620,11 +4617,11 @@ const V = {
|
|
|
4620
4617
|
AUTHENTICATED: "authenticated",
|
|
4621
4618
|
CLOSED: "closed",
|
|
4622
4619
|
ERRORED: "errored"
|
|
4623
|
-
},
|
|
4620
|
+
}, Ji = 3e4, Yi = 3e4, Zi = 200, Xi = {
|
|
4624
4621
|
apiURI: "https://api.instantdb.com",
|
|
4625
4622
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
4626
|
-
},
|
|
4627
|
-
function
|
|
4623
|
+
}, Ne = "_instant_oauth_redirect", ie = "currentUser";
|
|
4624
|
+
function eo({
|
|
4628
4625
|
transportType: t,
|
|
4629
4626
|
appId: e,
|
|
4630
4627
|
apiURI: n,
|
|
@@ -4632,12 +4629,12 @@ function to({
|
|
|
4632
4629
|
EventSourceImpl: s
|
|
4633
4630
|
}) {
|
|
4634
4631
|
if (!s)
|
|
4635
|
-
return new
|
|
4632
|
+
return new Ht(`${r}?app_id=${e}`);
|
|
4636
4633
|
switch (t) {
|
|
4637
4634
|
case "ws":
|
|
4638
|
-
return new
|
|
4635
|
+
return new Ht(`${r}?app_id=${e}`);
|
|
4639
4636
|
case "sse":
|
|
4640
|
-
return new
|
|
4637
|
+
return new Ki(
|
|
4641
4638
|
s,
|
|
4642
4639
|
`${n}/runtime/sse?app_id=${e}`
|
|
4643
4640
|
);
|
|
@@ -4645,36 +4642,36 @@ function to({
|
|
|
4645
4642
|
throw new Error("Unknown transport type " + t);
|
|
4646
4643
|
}
|
|
4647
4644
|
}
|
|
4648
|
-
function
|
|
4645
|
+
function to() {
|
|
4649
4646
|
return typeof window < "u" || typeof chrome < "u";
|
|
4650
4647
|
}
|
|
4651
|
-
const
|
|
4648
|
+
const Zt = {
|
|
4652
4649
|
"set-presence": !0,
|
|
4653
4650
|
"set-presence-ok": !0,
|
|
4654
4651
|
"refresh-presence": !0,
|
|
4655
4652
|
"patch-presence": !0
|
|
4656
4653
|
};
|
|
4657
|
-
function
|
|
4654
|
+
function no(t, e) {
|
|
4658
4655
|
var r;
|
|
4659
4656
|
const n = typeof t == "string" ? JSON.parse(t) : t;
|
|
4660
4657
|
if ((r = n == null ? void 0 : n.result) != null && r.store) {
|
|
4661
4658
|
const s = n.result.store;
|
|
4662
|
-
n.result.store =
|
|
4659
|
+
n.result.store = bn({
|
|
4663
4660
|
...s,
|
|
4664
4661
|
useDateObjects: e
|
|
4665
4662
|
});
|
|
4666
4663
|
}
|
|
4667
4664
|
return n;
|
|
4668
4665
|
}
|
|
4669
|
-
function
|
|
4666
|
+
function ro(t, e) {
|
|
4670
4667
|
var r;
|
|
4671
4668
|
const n = { ...e };
|
|
4672
4669
|
return (r = e.result) != null && r.store && (n.result = {
|
|
4673
4670
|
...e.result,
|
|
4674
|
-
store:
|
|
4671
|
+
store: yn(e.result.store)
|
|
4675
4672
|
}), n;
|
|
4676
4673
|
}
|
|
4677
|
-
function
|
|
4674
|
+
function so(t, e) {
|
|
4678
4675
|
switch (t) {
|
|
4679
4676
|
case "pendingMutations":
|
|
4680
4677
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -4682,7 +4679,7 @@ function io(t, e) {
|
|
|
4682
4679
|
return e;
|
|
4683
4680
|
}
|
|
4684
4681
|
}
|
|
4685
|
-
function
|
|
4682
|
+
function io(t, e) {
|
|
4686
4683
|
switch (t) {
|
|
4687
4684
|
case "pendingMutations":
|
|
4688
4685
|
return [...e.entries()];
|
|
@@ -4690,18 +4687,18 @@ function oo(t, e) {
|
|
|
4690
4687
|
return e;
|
|
4691
4688
|
}
|
|
4692
4689
|
}
|
|
4693
|
-
function
|
|
4690
|
+
function oo(t, e, n) {
|
|
4694
4691
|
const r = e == null ? void 0 : e.result, s = n == null ? void 0 : n.result;
|
|
4695
4692
|
return r && !s && n && (n.result = r), n || e;
|
|
4696
4693
|
}
|
|
4697
|
-
function
|
|
4694
|
+
function Xt(t) {
|
|
4698
4695
|
return [...t].sort((e, n) => {
|
|
4699
4696
|
const [r, s] = e, [i, o] = n, a = s.order || 0, c = o.order || 0;
|
|
4700
4697
|
return a == c ? r < i ? -1 : r > i ? 1 : 0 : a - c;
|
|
4701
4698
|
});
|
|
4702
4699
|
}
|
|
4703
|
-
class
|
|
4704
|
-
constructor(e, n =
|
|
4700
|
+
class ao {
|
|
4701
|
+
constructor(e, n = Dn, r = xn, s, i) {
|
|
4705
4702
|
w(this, "attrs");
|
|
4706
4703
|
w(this, "_isOnline", !0);
|
|
4707
4704
|
w(this, "_isShutdown", !1);
|
|
@@ -4794,9 +4791,9 @@ class co {
|
|
|
4794
4791
|
});
|
|
4795
4792
|
/** Applies transactions locally and sends transact message to server */
|
|
4796
4793
|
w(this, "pushTx", (e) => {
|
|
4797
|
-
this.config.disableValidation ||
|
|
4794
|
+
this.config.disableValidation || Ni(e, this.config.schema);
|
|
4798
4795
|
try {
|
|
4799
|
-
const n =
|
|
4796
|
+
const n = li(
|
|
4800
4797
|
{
|
|
4801
4798
|
attrs: this.optimisticAttrs(),
|
|
4802
4799
|
schema: this.config.schema,
|
|
@@ -4831,7 +4828,7 @@ class co {
|
|
|
4831
4828
|
this._updatePendingMutations((c) => {
|
|
4832
4829
|
c.set(r, o);
|
|
4833
4830
|
});
|
|
4834
|
-
const a = new
|
|
4831
|
+
const a = new qt();
|
|
4835
4832
|
return this.mutationDeferredStore.set(r, a), this._sendMutation(r, o), this.notifyAll(), a.promise;
|
|
4836
4833
|
});
|
|
4837
4834
|
w(this, "_transportOnOpen", (e) => {
|
|
@@ -4935,10 +4932,10 @@ class co {
|
|
|
4935
4932
|
this._reconnectTimeoutMs
|
|
4936
4933
|
), this._scheduleReconnect();
|
|
4937
4934
|
});
|
|
4938
|
-
if (this._EventSource = i, this.config = { ...
|
|
4939
|
-
e.verbose ||
|
|
4935
|
+
if (this._EventSource = i, this.config = { ...Xi, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Yi, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Zi, this._log = Pi(
|
|
4936
|
+
e.verbose || _t || Rn,
|
|
4940
4937
|
() => this._reactorStats()
|
|
4941
|
-
), this.versions = { ...s || {}, "@instantdb/core":
|
|
4938
|
+
), this.versions = { ...s || {}, "@instantdb/core": Fn }, this.config.schema && (this._linkIndex = Vt(this.config.schema)), !!to()) {
|
|
4942
4939
|
if (!e.appId)
|
|
4943
4940
|
throw new Error("Instant must be initialized with an appId.");
|
|
4944
4941
|
if (!te(e.appId))
|
|
@@ -4955,7 +4952,7 @@ class co {
|
|
|
4955
4952
|
} catch (c) {
|
|
4956
4953
|
this._log.error("[error] handle broadcast channel", c);
|
|
4957
4954
|
}
|
|
4958
|
-
})), this._initStorage(n), this._syncTable = new
|
|
4955
|
+
})), this._initStorage(n), this._syncTable = new Hi(
|
|
4959
4956
|
this._trySendAuthed.bind(this),
|
|
4960
4957
|
new n(this.config.appId, "syncSubs"),
|
|
4961
4958
|
{
|
|
@@ -4986,7 +4983,7 @@ class co {
|
|
|
4986
4983
|
...this.config,
|
|
4987
4984
|
schema: e,
|
|
4988
4985
|
cardinalityInference: !!e
|
|
4989
|
-
}, this._linkIndex = e ?
|
|
4986
|
+
}, this._linkIndex = e ? Vt(this.config.schema) : null;
|
|
4990
4987
|
}
|
|
4991
4988
|
_reactorStats() {
|
|
4992
4989
|
return {
|
|
@@ -4999,11 +4996,11 @@ class co {
|
|
|
4999
4996
|
this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
|
|
5000
4997
|
}
|
|
5001
4998
|
_initStorage(e) {
|
|
5002
|
-
this.querySubs = new
|
|
4999
|
+
this.querySubs = new nt({
|
|
5003
5000
|
persister: new e(this.config.appId, "querySubs"),
|
|
5004
|
-
merge:
|
|
5005
|
-
serialize:
|
|
5006
|
-
parse: (n, r) =>
|
|
5001
|
+
merge: oo,
|
|
5002
|
+
serialize: ro,
|
|
5003
|
+
parse: (n, r) => no(r, this.config.useDateObjects),
|
|
5007
5004
|
// objectSize
|
|
5008
5005
|
objectSize: (n) => {
|
|
5009
5006
|
var r, s, i;
|
|
@@ -5019,11 +5016,11 @@ class co {
|
|
|
5019
5016
|
maxSize: 1e6
|
|
5020
5017
|
// 1 million triples
|
|
5021
5018
|
}
|
|
5022
|
-
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new
|
|
5019
|
+
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new nt({
|
|
5023
5020
|
persister: new e(this.config.appId, "kv"),
|
|
5024
5021
|
merge: this._onMergeKv,
|
|
5025
|
-
serialize:
|
|
5026
|
-
parse:
|
|
5022
|
+
serialize: io,
|
|
5023
|
+
parse: so,
|
|
5027
5024
|
objectSize: () => 0,
|
|
5028
5025
|
logger: this._log,
|
|
5029
5026
|
saveThrottleMs: 100,
|
|
@@ -5085,7 +5082,7 @@ class co {
|
|
|
5085
5082
|
_handleReceive(e, n) {
|
|
5086
5083
|
var s, i, o, a, c, u;
|
|
5087
5084
|
const r = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
5088
|
-
switch (
|
|
5085
|
+
switch (Zt[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
5089
5086
|
case "init-ok": {
|
|
5090
5087
|
this._setStatus(V.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
5091
5088
|
for (const d of Object.keys(this._rooms)) {
|
|
@@ -5102,7 +5099,7 @@ class co {
|
|
|
5102
5099
|
const { q: d, result: h } = n, p = P(d);
|
|
5103
5100
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[p])
|
|
5104
5101
|
break;
|
|
5105
|
-
const b = (a = (o = h == null ? void 0 : h[0]) == null ? void 0 : o.data) == null ? void 0 : a["page-info"], _ = (u = (c = h == null ? void 0 : h[0]) == null ? void 0 : c.data) == null ? void 0 : u.aggregate, y =
|
|
5102
|
+
const b = (a = (o = h == null ? void 0 : h[0]) == null ? void 0 : o.data) == null ? void 0 : a["page-info"], _ = (u = (c = h == null ? void 0 : h[0]) == null ? void 0 : c.data) == null ? void 0 : u.aggregate, y = zt(h), g = Oe(
|
|
5106
5103
|
this.attrs,
|
|
5107
5104
|
y,
|
|
5108
5105
|
r,
|
|
@@ -5150,9 +5147,9 @@ class co {
|
|
|
5150
5147
|
b !== this._pendingMutations() && this.kv.updateInPlace((g) => {
|
|
5151
5148
|
g.pendingMutations = b;
|
|
5152
5149
|
});
|
|
5153
|
-
const _ =
|
|
5154
|
-
var wt, Tt, mt
|
|
5155
|
-
const T = g["instaql-query"], v = g["instaql-result"], m = P(T), M =
|
|
5150
|
+
const _ = Xt(b.entries()), y = d.map((g) => {
|
|
5151
|
+
var gt, wt, Tt, mt;
|
|
5152
|
+
const T = g["instaql-query"], v = g["instaql-result"], m = P(T), M = zt(v), I = Oe(
|
|
5156
5153
|
this.attrs,
|
|
5157
5154
|
M,
|
|
5158
5155
|
r,
|
|
@@ -5162,8 +5159,8 @@ class co {
|
|
|
5162
5159
|
I,
|
|
5163
5160
|
_,
|
|
5164
5161
|
p
|
|
5165
|
-
), De = (
|
|
5166
|
-
return { q: T, hash: m, store: B, pageInfo: De, aggregate:
|
|
5162
|
+
), De = (wt = (gt = v == null ? void 0 : v[0]) == null ? void 0 : gt.data) == null ? void 0 : wt["page-info"], Gn = (mt = (Tt = v == null ? void 0 : v[0]) == null ? void 0 : Tt.data) == null ? void 0 : mt.aggregate;
|
|
5163
|
+
return { q: T, hash: m, store: B, pageInfo: De, aggregate: Gn };
|
|
5167
5164
|
});
|
|
5168
5165
|
y.forEach(({ hash: g, q: T, store: v, pageInfo: m, aggregate: M }) => {
|
|
5169
5166
|
this.querySubs.updateInPlace((I) => {
|
|
@@ -5332,15 +5329,15 @@ class co {
|
|
|
5332
5329
|
* Returns an unsubscribe function
|
|
5333
5330
|
*/
|
|
5334
5331
|
subscribeQuery(e, n, r) {
|
|
5335
|
-
this.config.disableValidation ||
|
|
5332
|
+
this.config.disableValidation || Qt(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
|
|
5336
5333
|
const s = P(e), i = this.getPreviousResult(e);
|
|
5337
5334
|
return i && n(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
|
|
5338
5335
|
this._unsubQuery(e, s, n);
|
|
5339
5336
|
};
|
|
5340
5337
|
}
|
|
5341
5338
|
queryOnce(e, n) {
|
|
5342
|
-
this.config.disableValidation ||
|
|
5343
|
-
const r = new
|
|
5339
|
+
this.config.disableValidation || Qt(e, this.config.schema), n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
5340
|
+
const r = new qt();
|
|
5344
5341
|
if (!this._isOnline)
|
|
5345
5342
|
return r.reject(
|
|
5346
5343
|
new Error("We can't run `queryOnce`, because the device is offline.")
|
|
@@ -5354,7 +5351,7 @@ class co {
|
|
|
5354
5351
|
const s = P(e), i = this._startQuerySub(e, s);
|
|
5355
5352
|
return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(
|
|
5356
5353
|
() => r.reject(new Error("Query timed out")),
|
|
5357
|
-
|
|
5354
|
+
Ji
|
|
5358
5355
|
), r.promise;
|
|
5359
5356
|
}
|
|
5360
5357
|
_completeQueryOnce(e, n, r) {
|
|
@@ -5416,7 +5413,7 @@ class co {
|
|
|
5416
5413
|
a = !0;
|
|
5417
5414
|
continue;
|
|
5418
5415
|
}
|
|
5419
|
-
const b = a ?
|
|
5416
|
+
const b = a ? Ns(o, h) : h;
|
|
5420
5417
|
d.push(b);
|
|
5421
5418
|
}
|
|
5422
5419
|
return a ? d : l;
|
|
@@ -5429,7 +5426,7 @@ class co {
|
|
|
5429
5426
|
return a ? u : n;
|
|
5430
5427
|
}
|
|
5431
5428
|
_rewriteMutationsSorted(e, n) {
|
|
5432
|
-
return
|
|
5429
|
+
return Xt(this._rewriteMutations(e, n).entries());
|
|
5433
5430
|
}
|
|
5434
5431
|
// ---------------------------
|
|
5435
5432
|
// Transact
|
|
@@ -5472,11 +5469,11 @@ class co {
|
|
|
5472
5469
|
p,
|
|
5473
5470
|
h
|
|
5474
5471
|
);
|
|
5475
|
-
return { data:
|
|
5472
|
+
return { data: Mn({ store: b, pageInfo: f, aggregate: d }, a), querySubVersion: r, pendingMutationsVersion: i };
|
|
5476
5473
|
}
|
|
5477
5474
|
_applyOptimisticUpdates(e, n, r) {
|
|
5478
5475
|
for (const [s, i] of n)
|
|
5479
|
-
(!i["tx-id"] || r && i["tx-id"] > r) && (e =
|
|
5476
|
+
(!i["tx-id"] || r && i["tx-id"] > r) && (e = Kr(e, i["tx-steps"]));
|
|
5480
5477
|
return e;
|
|
5481
5478
|
}
|
|
5482
5479
|
/** Re-compute all subscriptions */
|
|
@@ -5570,7 +5567,7 @@ class co {
|
|
|
5570
5567
|
}
|
|
5571
5568
|
_trySend(e, n, r) {
|
|
5572
5569
|
if (this._transport.isOpen()) {
|
|
5573
|
-
switch (
|
|
5570
|
+
switch (Zt[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
|
|
5574
5571
|
case "transact": {
|
|
5575
5572
|
this._inFlightMutationEventIds.add(e);
|
|
5576
5573
|
break;
|
|
@@ -5599,7 +5596,7 @@ class co {
|
|
|
5599
5596
|
return;
|
|
5600
5597
|
}
|
|
5601
5598
|
const e = this._transport;
|
|
5602
|
-
this._transport =
|
|
5599
|
+
this._transport = eo({
|
|
5603
5600
|
transportType: this._transportType,
|
|
5604
5601
|
appId: this.config.appId,
|
|
5605
5602
|
apiURI: this.config.apiURI,
|
|
@@ -5638,9 +5635,9 @@ class co {
|
|
|
5638
5635
|
if (typeof URL > "u")
|
|
5639
5636
|
return;
|
|
5640
5637
|
const e = new URL(window.location.href);
|
|
5641
|
-
if (e.searchParams.get(
|
|
5638
|
+
if (e.searchParams.get(Ne)) {
|
|
5642
5639
|
const n = e.toString();
|
|
5643
|
-
e.searchParams.delete(
|
|
5640
|
+
e.searchParams.delete(Ne), e.searchParams.delete("code"), e.searchParams.delete("error");
|
|
5644
5641
|
const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
|
|
5645
5642
|
if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
|
|
5646
5643
|
typeof navigation == "object" && // @ts-ignore (waiting for ts support)
|
|
@@ -5664,7 +5661,7 @@ class co {
|
|
|
5664
5661
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
5665
5662
|
return null;
|
|
5666
5663
|
const e = new URLSearchParams(window.location.search);
|
|
5667
|
-
if (!e.get(
|
|
5664
|
+
if (!e.get(Ne))
|
|
5668
5665
|
return null;
|
|
5669
5666
|
const n = e.get("error");
|
|
5670
5667
|
if (n)
|
|
@@ -5674,7 +5671,7 @@ class co {
|
|
|
5674
5671
|
return null;
|
|
5675
5672
|
this._replaceUrlAfterOAuth();
|
|
5676
5673
|
try {
|
|
5677
|
-
const c = await this._getCurrentUser(), u = (c == null ? void 0 : c.type) === "guest", { user: l } = await
|
|
5674
|
+
const c = await this._getCurrentUser(), u = (c == null ? void 0 : c.type) === "guest", { user: l } = await Nt({
|
|
5678
5675
|
apiURI: this.config.apiURI,
|
|
5679
5676
|
appId: this.config.appId,
|
|
5680
5677
|
code: r,
|
|
@@ -5793,7 +5790,7 @@ class co {
|
|
|
5793
5790
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
|
|
5794
5791
|
}
|
|
5795
5792
|
sendMagicCode({ email: e }) {
|
|
5796
|
-
return
|
|
5793
|
+
return gi({
|
|
5797
5794
|
apiURI: this.config.apiURI,
|
|
5798
5795
|
appId: this.config.appId,
|
|
5799
5796
|
email: e
|
|
@@ -5801,7 +5798,7 @@ class co {
|
|
|
5801
5798
|
}
|
|
5802
5799
|
async signInWithMagicCode({ email: e, code: n }) {
|
|
5803
5800
|
var o;
|
|
5804
|
-
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await
|
|
5801
|
+
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await wi({
|
|
5805
5802
|
apiURI: this.config.apiURI,
|
|
5806
5803
|
appId: this.config.appId,
|
|
5807
5804
|
email: e,
|
|
@@ -5811,7 +5808,7 @@ class co {
|
|
|
5811
5808
|
return await this.changeCurrentUser(i.user), i;
|
|
5812
5809
|
}
|
|
5813
5810
|
async signInWithCustomToken(e) {
|
|
5814
|
-
const n = await
|
|
5811
|
+
const n = await Ti({
|
|
5815
5812
|
apiURI: this.config.apiURI,
|
|
5816
5813
|
appId: this.config.appId,
|
|
5817
5814
|
refreshToken: e
|
|
@@ -5819,7 +5816,7 @@ class co {
|
|
|
5819
5816
|
return await this.changeCurrentUser(n.user), n;
|
|
5820
5817
|
}
|
|
5821
5818
|
async signInAsGuest() {
|
|
5822
|
-
const e = await
|
|
5819
|
+
const e = await mi({
|
|
5823
5820
|
apiURI: this.config.apiURI,
|
|
5824
5821
|
appId: this.config.appId
|
|
5825
5822
|
});
|
|
@@ -5834,7 +5831,7 @@ class co {
|
|
|
5834
5831
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
5835
5832
|
return;
|
|
5836
5833
|
}
|
|
5837
|
-
|
|
5834
|
+
Oi({
|
|
5838
5835
|
apiURI: this.config.apiURI,
|
|
5839
5836
|
appId: this.config.appId,
|
|
5840
5837
|
refreshToken: r
|
|
@@ -5866,7 +5863,7 @@ class co {
|
|
|
5866
5863
|
*/
|
|
5867
5864
|
async exchangeCodeForToken({ code: e, codeVerifier: n }) {
|
|
5868
5865
|
var o;
|
|
5869
|
-
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await
|
|
5866
|
+
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await Nt({
|
|
5870
5867
|
apiURI: this.config.apiURI,
|
|
5871
5868
|
appId: this.config.appId,
|
|
5872
5869
|
code: e,
|
|
@@ -5887,7 +5884,7 @@ class co {
|
|
|
5887
5884
|
*/
|
|
5888
5885
|
async signInWithIdToken({ idToken: e, clientName: n, nonce: r }) {
|
|
5889
5886
|
var a;
|
|
5890
|
-
const s = await this.getCurrentUser(), i = (a = s == null ? void 0 : s.user) == null ? void 0 : a.refresh_token, o = await
|
|
5887
|
+
const s = await this.getCurrentUser(), i = (a = s == null ? void 0 : s.user) == null ? void 0 : a.refresh_token, o = await Si({
|
|
5891
5888
|
apiURI: this.config.apiURI,
|
|
5892
5889
|
appId: this.config.appId,
|
|
5893
5890
|
idToken: e,
|
|
@@ -5928,7 +5925,7 @@ class co {
|
|
|
5928
5925
|
getPresence(e, n, r = {}) {
|
|
5929
5926
|
const s = this._rooms[n], i = this._presence[n];
|
|
5930
5927
|
return !s || !i || !i.result ? null : {
|
|
5931
|
-
...
|
|
5928
|
+
...Mi(i.result, r, this._sessionId),
|
|
5932
5929
|
isLoading: !s.isConnected,
|
|
5933
5930
|
error: s.error
|
|
5934
5931
|
};
|
|
@@ -5984,7 +5981,7 @@ class co {
|
|
|
5984
5981
|
}
|
|
5985
5982
|
_notifyPresenceSub(e, n) {
|
|
5986
5983
|
const r = this.getPresence("", e, n);
|
|
5987
|
-
r && (n.prev && !
|
|
5984
|
+
r && (n.prev && !Ii(r, n.prev) || (n.prev = r, n.cb(r)));
|
|
5988
5985
|
}
|
|
5989
5986
|
_patchPresencePeers(e, n) {
|
|
5990
5987
|
var o, a, c;
|
|
@@ -5997,13 +5994,13 @@ class co {
|
|
|
5997
5994
|
for (let [l, f, d] of n)
|
|
5998
5995
|
switch (f) {
|
|
5999
5996
|
case "+":
|
|
6000
|
-
|
|
5997
|
+
ur(u, l, d);
|
|
6001
5998
|
break;
|
|
6002
5999
|
case "r":
|
|
6003
|
-
|
|
6000
|
+
Et(u, l, d);
|
|
6004
6001
|
break;
|
|
6005
6002
|
case "-":
|
|
6006
|
-
|
|
6003
|
+
dn(u, l);
|
|
6007
6004
|
break;
|
|
6008
6005
|
}
|
|
6009
6006
|
delete u[this._sessionId];
|
|
@@ -6017,7 +6014,7 @@ class co {
|
|
|
6017
6014
|
Object.entries(r).map(([i, o]) => [i, o.data])
|
|
6018
6015
|
);
|
|
6019
6016
|
this._presence = ke(this._presence, (i) => {
|
|
6020
|
-
|
|
6017
|
+
Et(i, [e, "result", "peers"], s);
|
|
6021
6018
|
});
|
|
6022
6019
|
}
|
|
6023
6020
|
// --------
|
|
@@ -6060,7 +6057,7 @@ class co {
|
|
|
6060
6057
|
async uploadFile(e, n, r) {
|
|
6061
6058
|
var o;
|
|
6062
6059
|
const s = await this.getCurrentUser(), i = (o = s == null ? void 0 : s.user) == null ? void 0 : o.refresh_token;
|
|
6063
|
-
return
|
|
6060
|
+
return vi({
|
|
6064
6061
|
...r,
|
|
6065
6062
|
apiURI: this.config.apiURI,
|
|
6066
6063
|
appId: this.config.appId,
|
|
@@ -6072,7 +6069,7 @@ class co {
|
|
|
6072
6069
|
async deleteFile(e) {
|
|
6073
6070
|
var i;
|
|
6074
6071
|
const n = await this.getCurrentUser(), r = (i = n == null ? void 0 : n.user) == null ? void 0 : i.refresh_token;
|
|
6075
|
-
return await
|
|
6072
|
+
return await Ai({
|
|
6076
6073
|
apiURI: this.config.apiURI,
|
|
6077
6074
|
appId: this.config.appId,
|
|
6078
6075
|
path: e,
|
|
@@ -6083,18 +6080,18 @@ class co {
|
|
|
6083
6080
|
// ---------------------------------
|
|
6084
6081
|
async upload(e, n) {
|
|
6085
6082
|
var c;
|
|
6086
|
-
const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || n.name, o = await
|
|
6083
|
+
const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || n.name, o = await ki({
|
|
6087
6084
|
apiURI: this.config.apiURI,
|
|
6088
6085
|
appId: this.config.appId,
|
|
6089
6086
|
fileName: i,
|
|
6090
6087
|
refreshToken: s
|
|
6091
6088
|
});
|
|
6092
|
-
return await
|
|
6089
|
+
return await Ei(o, n);
|
|
6093
6090
|
}
|
|
6094
6091
|
async getDownloadUrl(e) {
|
|
6095
6092
|
var i;
|
|
6096
6093
|
const n = await this.getCurrentUser(), r = (i = n == null ? void 0 : n.user) == null ? void 0 : i.refresh_token;
|
|
6097
|
-
return await
|
|
6094
|
+
return await Ci({
|
|
6098
6095
|
apiURI: this.config.apiURI,
|
|
6099
6096
|
appId: this.config.appId,
|
|
6100
6097
|
path: e,
|
|
@@ -6102,9 +6099,9 @@ class co {
|
|
|
6102
6099
|
});
|
|
6103
6100
|
}
|
|
6104
6101
|
}
|
|
6105
|
-
function
|
|
6102
|
+
function co(t, e) {
|
|
6106
6103
|
return new $e(
|
|
6107
|
-
|
|
6104
|
+
Qn(t, e),
|
|
6108
6105
|
// (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
|
|
6109
6106
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
6110
6107
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -6114,28 +6111,28 @@ function uo(t, e) {
|
|
|
6114
6111
|
void 0
|
|
6115
6112
|
);
|
|
6116
6113
|
}
|
|
6117
|
-
function
|
|
6114
|
+
function uo(t) {
|
|
6118
6115
|
return new je(t, {});
|
|
6119
6116
|
}
|
|
6120
|
-
function
|
|
6117
|
+
function lo() {
|
|
6121
6118
|
return new $("string", !0, !1);
|
|
6122
6119
|
}
|
|
6123
|
-
function
|
|
6120
|
+
function fo() {
|
|
6124
6121
|
return new $("number", !0, !1);
|
|
6125
6122
|
}
|
|
6126
|
-
function
|
|
6123
|
+
function ho() {
|
|
6127
6124
|
return new $("boolean", !0, !1);
|
|
6128
6125
|
}
|
|
6129
|
-
function
|
|
6126
|
+
function po() {
|
|
6130
6127
|
return new $("date", !0, !1);
|
|
6131
6128
|
}
|
|
6132
|
-
function
|
|
6129
|
+
function yo() {
|
|
6133
6130
|
return new $("json", !0, !1);
|
|
6134
6131
|
}
|
|
6135
|
-
function
|
|
6132
|
+
function bo() {
|
|
6136
6133
|
return new $("json", !0, !1);
|
|
6137
6134
|
}
|
|
6138
|
-
function
|
|
6135
|
+
function Qn(t, e) {
|
|
6139
6136
|
var s, i, o, a;
|
|
6140
6137
|
const n = { fwd: {}, rev: {} };
|
|
6141
6138
|
for (const c of Object.values(e))
|
|
@@ -6156,14 +6153,14 @@ function Gn(t, e) {
|
|
|
6156
6153
|
])
|
|
6157
6154
|
);
|
|
6158
6155
|
}
|
|
6159
|
-
function
|
|
6156
|
+
function _o({
|
|
6160
6157
|
entities: t,
|
|
6161
6158
|
links: e,
|
|
6162
6159
|
rooms: n
|
|
6163
6160
|
}) {
|
|
6164
6161
|
const r = e ?? {}, s = n ?? {};
|
|
6165
6162
|
return new $e(
|
|
6166
|
-
|
|
6163
|
+
Qn(t, r),
|
|
6167
6164
|
// (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
|
|
6168
6165
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
6169
6166
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -6173,23 +6170,23 @@ function go({
|
|
|
6173
6170
|
s
|
|
6174
6171
|
);
|
|
6175
6172
|
}
|
|
6176
|
-
const
|
|
6173
|
+
const Uo = {
|
|
6177
6174
|
// constructs
|
|
6178
|
-
graph:
|
|
6179
|
-
schema:
|
|
6180
|
-
entity:
|
|
6175
|
+
graph: co,
|
|
6176
|
+
schema: _o,
|
|
6177
|
+
entity: uo,
|
|
6181
6178
|
// value types
|
|
6182
|
-
string:
|
|
6183
|
-
number:
|
|
6184
|
-
boolean:
|
|
6185
|
-
date:
|
|
6186
|
-
json:
|
|
6187
|
-
any:
|
|
6179
|
+
string: lo,
|
|
6180
|
+
number: fo,
|
|
6181
|
+
boolean: ho,
|
|
6182
|
+
date: po,
|
|
6183
|
+
json: yo,
|
|
6184
|
+
any: bo
|
|
6188
6185
|
};
|
|
6189
6186
|
let we;
|
|
6190
|
-
function
|
|
6187
|
+
function go(t, e) {
|
|
6191
6188
|
we == null || we.dispose();
|
|
6192
|
-
const n =
|
|
6189
|
+
const n = vo(e), r = mo(e, a), s = To(wo(t));
|
|
6193
6190
|
function i(l) {
|
|
6194
6191
|
var f;
|
|
6195
6192
|
l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && n.isVisible() && a();
|
|
@@ -6211,10 +6208,10 @@ function wo(t, e) {
|
|
|
6211
6208
|
}
|
|
6212
6209
|
return u();
|
|
6213
6210
|
}
|
|
6214
|
-
function
|
|
6215
|
-
return `${
|
|
6211
|
+
function wo(t) {
|
|
6212
|
+
return `${_t || Un ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
6216
6213
|
}
|
|
6217
|
-
function
|
|
6214
|
+
function To(t) {
|
|
6218
6215
|
const e = document.createElement("iframe");
|
|
6219
6216
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
6220
6217
|
width: "100%",
|
|
@@ -6223,7 +6220,7 @@ function mo(t) {
|
|
|
6223
6220
|
border: "none"
|
|
6224
6221
|
}), { element: e };
|
|
6225
6222
|
}
|
|
6226
|
-
function
|
|
6223
|
+
function mo(t, e) {
|
|
6227
6224
|
const n = `
|
|
6228
6225
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6229
6226
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -6233,7 +6230,7 @@ function So(t, e) {
|
|
|
6233
6230
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, {
|
|
6234
6231
|
// pos
|
|
6235
6232
|
position: "fixed",
|
|
6236
|
-
...
|
|
6233
|
+
...So(t.position),
|
|
6237
6234
|
height: "32px",
|
|
6238
6235
|
width: "32px",
|
|
6239
6236
|
// layout
|
|
@@ -6248,7 +6245,7 @@ function So(t, e) {
|
|
|
6248
6245
|
cursor: "pointer"
|
|
6249
6246
|
}), r.addEventListener("click", e), { element: r };
|
|
6250
6247
|
}
|
|
6251
|
-
function
|
|
6248
|
+
function So(t) {
|
|
6252
6249
|
switch (t) {
|
|
6253
6250
|
case "bottom-left":
|
|
6254
6251
|
return { bottom: "24px", left: "24px" };
|
|
@@ -6260,7 +6257,7 @@ function Oo(t) {
|
|
|
6260
6257
|
return { top: "24px", left: "24px" };
|
|
6261
6258
|
}
|
|
6262
6259
|
}
|
|
6263
|
-
function
|
|
6260
|
+
function Oo(t) {
|
|
6264
6261
|
switch (t) {
|
|
6265
6262
|
case "bottom-left":
|
|
6266
6263
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -6272,11 +6269,11 @@ function vo(t) {
|
|
|
6272
6269
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
6273
6270
|
}
|
|
6274
6271
|
}
|
|
6275
|
-
function
|
|
6272
|
+
function vo(t) {
|
|
6276
6273
|
const e = document.createElement("div");
|
|
6277
6274
|
Object.assign(e.style, {
|
|
6278
6275
|
position: "fixed",
|
|
6279
|
-
...
|
|
6276
|
+
...Oo(t.position),
|
|
6280
6277
|
display: "block",
|
|
6281
6278
|
borderRadius: "4px",
|
|
6282
6279
|
border: "1px #ccc solid",
|
|
@@ -6289,37 +6286,37 @@ function Ao(t) {
|
|
|
6289
6286
|
}
|
|
6290
6287
|
return { element: e, isVisible: n };
|
|
6291
6288
|
}
|
|
6292
|
-
const
|
|
6289
|
+
const Ao = {
|
|
6293
6290
|
apiURI: "https://api.instantdb.com",
|
|
6294
6291
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
6295
6292
|
};
|
|
6296
|
-
function
|
|
6293
|
+
function ko() {
|
|
6297
6294
|
return globalThis.__instantDbSchemaHashStore = globalThis.__instantDbSchemaHashStore ?? /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
6298
6295
|
}
|
|
6299
|
-
function
|
|
6296
|
+
function Eo() {
|
|
6300
6297
|
return globalThis.__instantDbStore = globalThis.__instantDbStore ?? {}, globalThis.__instantDbStore;
|
|
6301
6298
|
}
|
|
6302
|
-
function
|
|
6299
|
+
function rt(t) {
|
|
6303
6300
|
const e = t.__adminToken;
|
|
6304
6301
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
6305
6302
|
}
|
|
6306
|
-
const
|
|
6307
|
-
class
|
|
6303
|
+
const st = Eo(), en = ko();
|
|
6304
|
+
class Co {
|
|
6308
6305
|
constructor(e) {
|
|
6309
6306
|
this.db = e, this.sendMagicCode = (n) => this.db.sendMagicCode(n), this.signInWithMagicCode = (n) => this.db.signInWithMagicCode(n), this.signInWithToken = (n) => this.db.signInWithCustomToken(n), this.signInAsGuest = () => this.db.signInAsGuest(), this.createAuthorizationURL = (n) => this.db.createAuthorizationURL(n), this.signInWithIdToken = (n) => this.db.signInWithIdToken(n), this.exchangeOAuthCode = (n) => this.db.exchangeCodeForToken(n), this.issuerURI = () => this.db.issuerURI(), this.signOut = (n = { invalidateToken: !0 }) => this.db.signOut(n);
|
|
6310
6307
|
}
|
|
6311
6308
|
}
|
|
6312
|
-
class
|
|
6309
|
+
class Mo {
|
|
6313
6310
|
constructor(e) {
|
|
6314
6311
|
this.db = e, this.uploadFile = (n, r, s = {}) => this.db.uploadFile(n, r, s), this.delete = (n) => this.db.deleteFile(n), this.upload = (n, r) => this.db.upload(n, r), this.put = this.upload, this.getDownloadUrl = (n) => this.db.getDownloadUrl(n);
|
|
6315
6312
|
}
|
|
6316
6313
|
}
|
|
6317
|
-
function
|
|
6314
|
+
function Lo(t) {
|
|
6318
6315
|
return JSON.parse(JSON.stringify(t));
|
|
6319
6316
|
}
|
|
6320
|
-
class
|
|
6317
|
+
class Io {
|
|
6321
6318
|
constructor(e) {
|
|
6322
|
-
this.tx =
|
|
6319
|
+
this.tx = Pn(), this._reactor = e, this.auth = new Co(this._reactor), this.storage = new Mo(this._reactor);
|
|
6323
6320
|
}
|
|
6324
6321
|
/**
|
|
6325
6322
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6460,7 +6457,7 @@ class Po {
|
|
|
6460
6457
|
};
|
|
6461
6458
|
}
|
|
6462
6459
|
shutdown() {
|
|
6463
|
-
delete
|
|
6460
|
+
delete st[rt(this._reactor.config)], this._reactor.shutdown();
|
|
6464
6461
|
}
|
|
6465
6462
|
/**
|
|
6466
6463
|
* Use this for one-off queries.
|
|
@@ -6493,39 +6490,39 @@ class Po {
|
|
|
6493
6490
|
return this._reactor.subscribeTable(e, n);
|
|
6494
6491
|
}
|
|
6495
6492
|
}
|
|
6496
|
-
function
|
|
6493
|
+
function tn(t) {
|
|
6497
6494
|
if (!t)
|
|
6498
6495
|
return "0";
|
|
6499
|
-
const e =
|
|
6496
|
+
const e = en.get(t);
|
|
6500
6497
|
if (e)
|
|
6501
6498
|
return e;
|
|
6502
6499
|
const n = P(t);
|
|
6503
|
-
return
|
|
6500
|
+
return en.set(t, n), n;
|
|
6504
6501
|
}
|
|
6505
|
-
function
|
|
6506
|
-
return
|
|
6502
|
+
function Po(t, e) {
|
|
6503
|
+
return tn(t._reactor.config.schema) !== tn(e);
|
|
6507
6504
|
}
|
|
6508
|
-
function
|
|
6505
|
+
function jo(t, e, n, r, s) {
|
|
6509
6506
|
const i = {
|
|
6510
6507
|
...t,
|
|
6511
6508
|
useDateObjects: t.useDateObjects ?? !1
|
|
6512
|
-
}, o =
|
|
6509
|
+
}, o = st[rt(i)];
|
|
6513
6510
|
if (o)
|
|
6514
|
-
return
|
|
6515
|
-
const a = new
|
|
6511
|
+
return Po(o, i.schema) && o._reactor.updateSchema(i.schema), o;
|
|
6512
|
+
const a = new ao(
|
|
6516
6513
|
{
|
|
6517
|
-
...
|
|
6514
|
+
...Ao,
|
|
6518
6515
|
...i,
|
|
6519
6516
|
cardinalityInference: !!i.schema
|
|
6520
6517
|
},
|
|
6521
|
-
e ||
|
|
6518
|
+
e || Dn,
|
|
6522
6519
|
n || xn,
|
|
6523
|
-
{ ...r || {}, "@instantdb/core":
|
|
6520
|
+
{ ...r || {}, "@instantdb/core": Fn },
|
|
6524
6521
|
s
|
|
6525
|
-
), c = new
|
|
6526
|
-
return
|
|
6522
|
+
), c = new Io(a);
|
|
6523
|
+
return st[rt(i)] = c, $o(i.appId, i.devtool), c;
|
|
6527
6524
|
}
|
|
6528
|
-
function
|
|
6525
|
+
function $o(t, e) {
|
|
6529
6526
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6530
6527
|
return;
|
|
6531
6528
|
const n = {
|
|
@@ -6533,33 +6530,33 @@ function Do(t, e) {
|
|
|
6533
6530
|
allowedHosts: ["localhost"],
|
|
6534
6531
|
...typeof e == "object" ? e : {}
|
|
6535
6532
|
};
|
|
6536
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6533
|
+
n.allowedHosts.includes(window.location.hostname) && go(t, n);
|
|
6537
6534
|
}
|
|
6538
|
-
const
|
|
6535
|
+
const Fo = jo;
|
|
6539
6536
|
export {
|
|
6540
|
-
|
|
6541
|
-
|
|
6537
|
+
Co as Auth,
|
|
6538
|
+
Dn as IndexedDBStorage,
|
|
6542
6539
|
Pe as InstantAPIError,
|
|
6543
|
-
|
|
6540
|
+
Io as InstantCoreDatabase,
|
|
6544
6541
|
he as InstantError,
|
|
6545
6542
|
O as QueryValidationError,
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6543
|
+
Mo as Storage,
|
|
6544
|
+
fi as StorageInterface,
|
|
6545
|
+
Bi as SyncTableCallbackEventType,
|
|
6549
6546
|
F as TransactionValidationError,
|
|
6550
6547
|
xn as WindowNetworkListener,
|
|
6551
|
-
|
|
6548
|
+
Lo as coerceQuery,
|
|
6552
6549
|
Me as coerceToDate,
|
|
6553
|
-
|
|
6554
|
-
|
|
6550
|
+
Fs as getOps,
|
|
6551
|
+
Uo as i,
|
|
6555
6552
|
k as id,
|
|
6556
|
-
|
|
6557
|
-
|
|
6553
|
+
jo as init,
|
|
6554
|
+
Fo as init_experimental,
|
|
6558
6555
|
xo as lookup,
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6556
|
+
Ro as tx,
|
|
6557
|
+
Pn as txInit,
|
|
6558
|
+
Qt as validateQuery,
|
|
6559
|
+
Ni as validateTransactions,
|
|
6560
|
+
Fn as version,
|
|
6564
6561
|
P as weakHash
|
|
6565
6562
|
};
|