@instantdb/core 0.22.83 → 0.22.84
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/utils/PersistedObject.test.ts +1 -1
- package/dist/commonjs/Reactor.d.ts.map +1 -1
- package/dist/commonjs/Reactor.js.map +1 -1
- package/dist/commonjs/SyncTable.d.ts.map +1 -1
- package/dist/commonjs/SyncTable.js +1 -0
- package/dist/commonjs/SyncTable.js.map +1 -1
- package/dist/commonjs/attrTypes.d.ts +1 -1
- package/dist/commonjs/attrTypes.d.ts.map +1 -1
- package/dist/commonjs/attrTypes.js.map +1 -1
- package/dist/commonjs/datalog.js +2 -2
- package/dist/commonjs/datalog.js.map +1 -1
- package/dist/commonjs/instaml.js +2 -2
- package/dist/commonjs/instaml.js.map +1 -1
- package/dist/commonjs/instaql.js.map +1 -1
- package/dist/commonjs/store.d.ts +44 -29
- package/dist/commonjs/store.d.ts.map +1 -1
- package/dist/commonjs/store.js +9 -5
- package/dist/commonjs/store.js.map +1 -1
- package/dist/esm/Reactor.d.ts.map +1 -1
- package/dist/esm/Reactor.js +1 -1
- package/dist/esm/Reactor.js.map +1 -1
- package/dist/esm/SyncTable.d.ts.map +1 -1
- package/dist/esm/SyncTable.js +2 -1
- package/dist/esm/SyncTable.js.map +1 -1
- package/dist/esm/attrTypes.d.ts +1 -1
- package/dist/esm/attrTypes.d.ts.map +1 -1
- package/dist/esm/attrTypes.js.map +1 -1
- package/dist/esm/datalog.js +1 -1
- package/dist/esm/datalog.js.map +1 -1
- package/dist/esm/instaml.js +1 -1
- package/dist/esm/instaml.js.map +1 -1
- package/dist/esm/instaql.js +1 -1
- package/dist/esm/instaql.js.map +1 -1
- package/dist/esm/store.d.ts +44 -29
- package/dist/esm/store.d.ts.map +1 -1
- package/dist/esm/store.js +9 -5
- package/dist/esm/store.js.map +1 -1
- package/dist/standalone/index.js +95 -87
- package/dist/standalone/index.umd.cjs +3 -3
- package/package.json +2 -2
- package/src/Reactor.js +1 -1
- package/src/SyncTable.ts +4 -3
- package/src/attrTypes.ts +1 -6
- package/src/datalog.js +1 -1
- package/src/instaml.js +1 -1
- package/src/instaql.js +1 -1
- package/src/{store.js → store.ts} +127 -59
package/dist/standalone/index.js
CHANGED
|
@@ -36,7 +36,7 @@ function P(t) {
|
|
|
36
36
|
}
|
|
37
37
|
return P(String(t));
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const A = {
|
|
40
40
|
Remove: "remove",
|
|
41
41
|
Replace: "replace",
|
|
42
42
|
Add: "add"
|
|
@@ -352,12 +352,12 @@ function tr(t, e, n, r, s) {
|
|
|
352
352
|
if (o.get(u.toString()) && c[u] !== i[u]) {
|
|
353
353
|
const l = e.concat([u]), f = H(l, s);
|
|
354
354
|
n.push({
|
|
355
|
-
op:
|
|
355
|
+
op: A.Replace,
|
|
356
356
|
path: f,
|
|
357
357
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
358
358
|
value: me(c[u])
|
|
359
359
|
}), r.push({
|
|
360
|
-
op:
|
|
360
|
+
op: A.Replace,
|
|
361
361
|
path: f,
|
|
362
362
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
363
363
|
value: me(i[u])
|
|
@@ -366,7 +366,7 @@ function tr(t, e, n, r, s) {
|
|
|
366
366
|
for (let u = i.length; u < c.length; u += 1) {
|
|
367
367
|
const l = e.concat([u]), f = H(l, s);
|
|
368
368
|
n.push({
|
|
369
|
-
op:
|
|
369
|
+
op: A.Add,
|
|
370
370
|
path: f,
|
|
371
371
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
372
372
|
value: me(c[u])
|
|
@@ -377,7 +377,7 @@ function tr(t, e, n, r, s) {
|
|
|
377
377
|
if (u) {
|
|
378
378
|
const l = e.concat(["length"]), f = H(l, s);
|
|
379
379
|
r.push({
|
|
380
|
-
op:
|
|
380
|
+
op: A.Replace,
|
|
381
381
|
path: f,
|
|
382
382
|
value: i.length
|
|
383
383
|
});
|
|
@@ -385,7 +385,7 @@ function tr(t, e, n, r, s) {
|
|
|
385
385
|
for (let l = c.length; i.length < l; l -= 1) {
|
|
386
386
|
const f = e.concat([l - 1]), d = H(f, s);
|
|
387
387
|
r.push({
|
|
388
|
-
op:
|
|
388
|
+
op: A.Remove,
|
|
389
389
|
path: d
|
|
390
390
|
});
|
|
391
391
|
}
|
|
@@ -393,11 +393,11 @@ function tr(t, e, n, r, s) {
|
|
|
393
393
|
}
|
|
394
394
|
function nr({ original: t, copy: e, assignedMap: n }, r, s, i, o) {
|
|
395
395
|
n.forEach((a, c) => {
|
|
396
|
-
const u = Q(t, c), l = me(Q(e, c)), f = a ? ue(t, c) ?
|
|
397
|
-
if (W(u, l) && f ===
|
|
396
|
+
const u = Q(t, c), l = me(Q(e, c)), f = a ? ue(t, c) ? A.Replace : A.Add : A.Remove;
|
|
397
|
+
if (W(u, l) && f === A.Replace)
|
|
398
398
|
return;
|
|
399
399
|
const d = r.concat(c), h = H(d, o);
|
|
400
|
-
s.push(f ===
|
|
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
403
|
function rr({ original: t, copy: e }, n, r, s, i) {
|
|
@@ -406,11 +406,11 @@ function rr({ original: t, copy: e }, n, r, s, i) {
|
|
|
406
406
|
if (!e.has(a)) {
|
|
407
407
|
const c = n.concat([o]), u = H(c, i);
|
|
408
408
|
r.push({
|
|
409
|
-
op:
|
|
409
|
+
op: A.Remove,
|
|
410
410
|
path: u,
|
|
411
411
|
value: a
|
|
412
412
|
}), s.unshift({
|
|
413
|
-
op:
|
|
413
|
+
op: A.Add,
|
|
414
414
|
path: u,
|
|
415
415
|
value: a
|
|
416
416
|
});
|
|
@@ -420,11 +420,11 @@ function rr({ original: t, copy: e }, n, r, s, i) {
|
|
|
420
420
|
if (!t.has(a)) {
|
|
421
421
|
const c = n.concat([o]), u = H(c, i);
|
|
422
422
|
r.push({
|
|
423
|
-
op:
|
|
423
|
+
op: A.Add,
|
|
424
424
|
path: u,
|
|
425
425
|
value: a
|
|
426
426
|
}), s.unshift({
|
|
427
|
-
op:
|
|
427
|
+
op: A.Remove,
|
|
428
428
|
path: u,
|
|
429
429
|
value: a
|
|
430
430
|
});
|
|
@@ -444,7 +444,7 @@ function de(t, e, n, r) {
|
|
|
444
444
|
return rr(t, e, n, r, s);
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
|
-
const
|
|
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 = {
|
|
@@ -482,7 +482,7 @@ const Ae = (t, e, n = !1) => {
|
|
|
482
482
|
get(t) {
|
|
483
483
|
var e, n;
|
|
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
|
-
if (r.options.strict &&
|
|
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
487
|
const o = it.createDraft({
|
|
488
488
|
original: s,
|
|
@@ -528,7 +528,7 @@ const Ae = (t, e, n = !1) => {
|
|
|
528
528
|
[Te]() {
|
|
529
529
|
return this.entries();
|
|
530
530
|
}
|
|
531
|
-
}, sr = Reflect.ownKeys(Ve),
|
|
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)
|
|
@@ -536,7 +536,7 @@ const Ae = (t, e, n = !1) => {
|
|
|
536
536
|
const o = i.value;
|
|
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
|
-
if (t.options.strict &&
|
|
539
|
+
if (t.options.strict && ve(o, t.options, u), !u && !c && K(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
540
540
|
const l = it.createDraft({
|
|
541
541
|
original: o,
|
|
542
542
|
parentDraft: t,
|
|
@@ -550,7 +550,7 @@ const Ae = (t, e, n = !1) => {
|
|
|
550
550
|
done: !1,
|
|
551
551
|
value: n ? a : [a, a]
|
|
552
552
|
};
|
|
553
|
-
},
|
|
553
|
+
}, Ae = {
|
|
554
554
|
get size() {
|
|
555
555
|
return S(this).setMap.size;
|
|
556
556
|
},
|
|
@@ -589,7 +589,7 @@ const Ae = (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 Ae = (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
|
};
|
|
@@ -616,7 +616,7 @@ const Ae = (t, e, n = !1) => {
|
|
|
616
616
|
t.call(e, r.value, r.value, this), r = n.next();
|
|
617
617
|
}
|
|
618
618
|
};
|
|
619
|
-
Set.prototype.difference && Object.assign(
|
|
619
|
+
Set.prototype.difference && Object.assign(Ae, {
|
|
620
620
|
intersection(t) {
|
|
621
621
|
return Set.prototype.intersection.call(new Set(this.values()), t);
|
|
622
622
|
},
|
|
@@ -639,7 +639,7 @@ Set.prototype.difference && Object.assign(ve, {
|
|
|
639
639
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
|
|
640
640
|
}
|
|
641
641
|
});
|
|
642
|
-
const ir = Reflect.ownKeys(
|
|
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];
|
|
@@ -651,7 +651,7 @@ const ir = Reflect.ownKeys(ve), an = /* @__PURE__ */ new WeakSet(), cn = {
|
|
|
651
651
|
if (t.options.mark) {
|
|
652
652
|
const u = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
|
|
653
653
|
if (o = t.options.mark(u, L), o === L.mutable)
|
|
654
|
-
return t.options.strict &&
|
|
654
|
+
return t.options.strict && ve(u, t.options, !0), u;
|
|
655
655
|
}
|
|
656
656
|
const a = U(t);
|
|
657
657
|
if (a instanceof Map && sr.includes(e)) {
|
|
@@ -663,8 +663,8 @@ const ir = Reflect.ownKeys(ve), an = /* @__PURE__ */ new WeakSet(), cn = {
|
|
|
663
663
|
}
|
|
664
664
|
if (a instanceof Set && ir.includes(e)) {
|
|
665
665
|
if (e === "size")
|
|
666
|
-
return Object.getOwnPropertyDescriptor(
|
|
667
|
-
const u =
|
|
666
|
+
return Object.getOwnPropertyDescriptor(Ae, "size").get.call(t.proxy);
|
|
667
|
+
const u = Ae[e];
|
|
668
668
|
if (u)
|
|
669
669
|
return u.bind(t.proxy);
|
|
670
670
|
}
|
|
@@ -676,7 +676,7 @@ const ir = Reflect.ownKeys(ve), an = /* @__PURE__ */ new WeakSet(), cn = {
|
|
|
676
676
|
) : void 0;
|
|
677
677
|
}
|
|
678
678
|
const c = a[e];
|
|
679
|
-
if (t.options.strict &&
|
|
679
|
+
if (t.options.strict && ve(c, t.options), t.finalized || !K(c, t.options))
|
|
680
680
|
return c;
|
|
681
681
|
if (c === Re(t.original, e)) {
|
|
682
682
|
if (j(t), t.copy[e] = ft({
|
|
@@ -783,8 +783,8 @@ function or(t, e, n, r, s) {
|
|
|
783
783
|
const u = c ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
784
784
|
return o && Ke(o), s && X(u, u, o == null ? void 0 : o.options.updatedValues), [
|
|
785
785
|
u,
|
|
786
|
-
n && c ? [{ op:
|
|
787
|
-
r && c ? [{ op:
|
|
786
|
+
n && c ? [{ op: A.Replace, path: [], value: e[0] }] : n,
|
|
787
|
+
r && c ? [{ op: A.Replace, path: [], value: a }] : r
|
|
788
788
|
];
|
|
789
789
|
}
|
|
790
790
|
function ar(t, e) {
|
|
@@ -857,7 +857,7 @@ function un(t) {
|
|
|
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
863
|
return un(t);
|
|
@@ -873,7 +873,7 @@ const cr = (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.`);
|
|
@@ -901,7 +901,7 @@ const cr = (t) => function e(n, r, s) {
|
|
|
901
901
|
} catch (m) {
|
|
902
902
|
throw Ke(S(y)), m;
|
|
903
903
|
}
|
|
904
|
-
const
|
|
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))
|
|
@@ -924,13 +924,13 @@ const cr = (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
|
-
return T instanceof Promise ? T.then(
|
|
931
|
+
return T instanceof Promise ? T.then(v, (m) => {
|
|
932
932
|
throw Ke(S(y)), m;
|
|
933
|
-
}) :
|
|
933
|
+
}) : v(T);
|
|
934
934
|
}, ke = cr();
|
|
935
935
|
Object.prototype.constructor.toString();
|
|
936
936
|
function ln(t, e) {
|
|
@@ -1282,14 +1282,14 @@ function Or(t) {
|
|
|
1282
1282
|
return null;
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
1285
|
-
function
|
|
1285
|
+
function vr(t) {
|
|
1286
1286
|
const e = t.match(Ct);
|
|
1287
1287
|
if (!e)
|
|
1288
1288
|
return null;
|
|
1289
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
|
|
1292
|
+
const Ar = [
|
|
1293
1293
|
yr,
|
|
1294
1294
|
_r,
|
|
1295
1295
|
wr,
|
|
@@ -1300,7 +1300,7 @@ const vr = [
|
|
|
1300
1300
|
br,
|
|
1301
1301
|
dr,
|
|
1302
1302
|
Or,
|
|
1303
|
-
|
|
1303
|
+
vr,
|
|
1304
1304
|
mr
|
|
1305
1305
|
];
|
|
1306
1306
|
function kr(t, e) {
|
|
@@ -1312,7 +1312,7 @@ function kr(t, e) {
|
|
|
1312
1312
|
}
|
|
1313
1313
|
}
|
|
1314
1314
|
function Qe(t) {
|
|
1315
|
-
for (const e of
|
|
1315
|
+
for (const e of Ar) {
|
|
1316
1316
|
const n = kr(e, t);
|
|
1317
1317
|
if (n)
|
|
1318
1318
|
return n;
|
|
@@ -1429,7 +1429,11 @@ function yt(t) {
|
|
|
1429
1429
|
t.attrIndexes = pn(t.attrs);
|
|
1430
1430
|
}
|
|
1431
1431
|
function Oe(t, e, n, r, s) {
|
|
1432
|
-
const i = hn(
|
|
1432
|
+
const i = hn(
|
|
1433
|
+
t,
|
|
1434
|
+
e,
|
|
1435
|
+
s
|
|
1436
|
+
);
|
|
1433
1437
|
return i.useDateObjects = s, i.attrs = t, i.attrIndexes = pn(t), i.cardinalityInference = n, i.linkIndex = r, i.__type = "store", i;
|
|
1434
1438
|
}
|
|
1435
1439
|
function ye(t, e) {
|
|
@@ -1470,7 +1474,7 @@ let Ir = 0;
|
|
|
1470
1474
|
function gn(t, e, n) {
|
|
1471
1475
|
const [r, s, i] = n;
|
|
1472
1476
|
let o;
|
|
1473
|
-
const a = se(t.
|
|
1477
|
+
const a = se(t.eav, [r, s, i]);
|
|
1474
1478
|
return a && (o = a[3]), o || Date.now() * 10 + Ir++;
|
|
1475
1479
|
}
|
|
1476
1480
|
function wn(t, e) {
|
|
@@ -1605,25 +1609,25 @@ function R(t, e, n = []) {
|
|
|
1605
1609
|
return n;
|
|
1606
1610
|
}
|
|
1607
1611
|
function be(t, e, n) {
|
|
1608
|
-
var i
|
|
1612
|
+
var i;
|
|
1609
1613
|
const r = [];
|
|
1610
1614
|
if (n != null && n.hasOwnProperty("$not")) {
|
|
1611
|
-
for (const
|
|
1612
|
-
n.$not !==
|
|
1615
|
+
for (const o of e.keys())
|
|
1616
|
+
n.$not !== o && r.push(e.get(o));
|
|
1613
1617
|
return r;
|
|
1614
1618
|
}
|
|
1615
1619
|
if (n != null && n.hasOwnProperty("$isNull")) {
|
|
1616
|
-
const { attrId:
|
|
1617
|
-
if (
|
|
1618
|
-
for (const
|
|
1619
|
-
const
|
|
1620
|
-
(
|
|
1620
|
+
const { attrId: o, isNull: a, reverse: c } = n.$isNull;
|
|
1621
|
+
if (c)
|
|
1622
|
+
for (const u of e.keys()) {
|
|
1623
|
+
const l = t.vae.get(u), f = !l || !l.get(o);
|
|
1624
|
+
(a ? f : !f) && r.push(e.get(u));
|
|
1621
1625
|
}
|
|
1622
1626
|
else {
|
|
1623
|
-
const
|
|
1624
|
-
for (const
|
|
1625
|
-
const
|
|
1626
|
-
(
|
|
1627
|
+
const u = t.aev.get(o);
|
|
1628
|
+
for (const l of e.keys()) {
|
|
1629
|
+
const f = !u || ((i = u.get(l)) == null ? void 0 : i.get(null)) || !u.get(l);
|
|
1630
|
+
(a ? f : !f) && r.push(e.get(l));
|
|
1627
1631
|
}
|
|
1628
1632
|
}
|
|
1629
1633
|
return r;
|
|
@@ -1631,9 +1635,9 @@ function be(t, e, n) {
|
|
|
1631
1635
|
if (n != null && n.$comparator)
|
|
1632
1636
|
return R(e, 1).filter(n.$op);
|
|
1633
1637
|
const s = n.in || n.$in || [n];
|
|
1634
|
-
for (const
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1638
|
+
for (const o of s) {
|
|
1639
|
+
const a = e.get(o);
|
|
1640
|
+
a && r.push(a);
|
|
1637
1641
|
}
|
|
1638
1642
|
return r;
|
|
1639
1643
|
}
|
|
@@ -1735,7 +1739,11 @@ function Kr(t, e) {
|
|
|
1735
1739
|
const l = re(t.attrs, i);
|
|
1736
1740
|
if (l) {
|
|
1737
1741
|
const f = On(t, l["forward-identity"][1]);
|
|
1738
|
-
u = !!Nr(t, [
|
|
1742
|
+
u = !!Nr(t, [
|
|
1743
|
+
s,
|
|
1744
|
+
f == null ? void 0 : f.id,
|
|
1745
|
+
s
|
|
1746
|
+
]);
|
|
1739
1747
|
}
|
|
1740
1748
|
return !(c === "create" && u || c === "update" && !u);
|
|
1741
1749
|
}
|
|
@@ -1752,7 +1760,7 @@ function qr(t) {
|
|
|
1752
1760
|
function zr(t, e, n) {
|
|
1753
1761
|
if (n.hasOwnProperty(t)) {
|
|
1754
1762
|
const r = n[t];
|
|
1755
|
-
return
|
|
1763
|
+
return vn(r, e, n);
|
|
1756
1764
|
}
|
|
1757
1765
|
return { ...n, [t]: e };
|
|
1758
1766
|
}
|
|
@@ -1781,13 +1789,13 @@ function Qr(t) {
|
|
|
1781
1789
|
return !0;
|
|
1782
1790
|
return !1;
|
|
1783
1791
|
}
|
|
1784
|
-
function
|
|
1792
|
+
function vn(t, e, n) {
|
|
1785
1793
|
return n ? typeof t == "object" ? Qr(t) ? n : null : Vr(t)(t, e, n) : null;
|
|
1786
1794
|
}
|
|
1787
1795
|
function Gr(t, e, n) {
|
|
1788
1796
|
return t.reduce((r, s, i) => {
|
|
1789
1797
|
const o = e[i];
|
|
1790
|
-
return
|
|
1798
|
+
return vn(s, o, r);
|
|
1791
1799
|
}, n);
|
|
1792
1800
|
}
|
|
1793
1801
|
function Br(t, e, n) {
|
|
@@ -1903,7 +1911,7 @@ function fs(t, e, n, r) {
|
|
|
1903
1911
|
function ds(t, e, n) {
|
|
1904
1912
|
return t.map((r) => r === e ? n : r);
|
|
1905
1913
|
}
|
|
1906
|
-
function
|
|
1914
|
+
function An(t, e, n, r, s) {
|
|
1907
1915
|
const i = G(e, n, s), o = Sn(e, n, s), a = i || o;
|
|
1908
1916
|
if (!a)
|
|
1909
1917
|
throw new ne(`Could not find attr for ${[n, s]}`);
|
|
@@ -2024,7 +2032,7 @@ function ps(t, e, n, r, s, i) {
|
|
|
2024
2032
|
function ys(t, e, n, r, s) {
|
|
2025
2033
|
const [i, o, a] = s.reduce(
|
|
2026
2034
|
(c, u) => {
|
|
2027
|
-
const [l, f, d] = c, [h, p, b] =
|
|
2035
|
+
const [l, f, d] = c, [h, p, b] = An(
|
|
2028
2036
|
t,
|
|
2029
2037
|
e,
|
|
2030
2038
|
l,
|
|
@@ -2137,7 +2145,7 @@ function Ss(t, e, n) {
|
|
|
2137
2145
|
return [t(e, n), t("time", n)];
|
|
2138
2146
|
}
|
|
2139
2147
|
function Os(t, e, n, r, s, i) {
|
|
2140
|
-
const [o, a, c, u, l] =
|
|
2148
|
+
const [o, a, c, u, l] = An(
|
|
2141
2149
|
t,
|
|
2142
2150
|
e,
|
|
2143
2151
|
n,
|
|
@@ -2146,7 +2154,7 @@ function Os(t, e, n, r, s, i) {
|
|
|
2146
2154
|
), f = ds(c, t(n, r), i);
|
|
2147
2155
|
return [o, a, f, u, l];
|
|
2148
2156
|
}
|
|
2149
|
-
function
|
|
2157
|
+
function vs(t, e, { etype: n, level: r, form: s }, i) {
|
|
2150
2158
|
const o = Object.keys(s).filter((a) => a !== "$");
|
|
2151
2159
|
return o.length ? Object.entries(i).map(function([c, u]) {
|
|
2152
2160
|
return o.map(function(d) {
|
|
@@ -2160,12 +2168,12 @@ function As(t, e, { etype: n, level: r, form: s }, i) {
|
|
|
2160
2168
|
r,
|
|
2161
2169
|
d,
|
|
2162
2170
|
c
|
|
2163
|
-
),
|
|
2171
|
+
), v = Cn(e, {
|
|
2164
2172
|
etype: y,
|
|
2165
2173
|
level: g,
|
|
2166
2174
|
form: s[d],
|
|
2167
2175
|
join: T
|
|
2168
|
-
}), m = h ?
|
|
2176
|
+
}), m = h ? v[0] : v;
|
|
2169
2177
|
return { [d]: m };
|
|
2170
2178
|
} catch (y) {
|
|
2171
2179
|
if (y instanceof ne)
|
|
@@ -2177,11 +2185,11 @@ function As(t, e, { etype: n, level: r, form: s }, i) {
|
|
|
2177
2185
|
}, u);
|
|
2178
2186
|
}) : Object.values(i);
|
|
2179
2187
|
}
|
|
2180
|
-
function
|
|
2188
|
+
function As(t, e, n) {
|
|
2181
2189
|
return n === "string" ? cs(t, e) : t > e ? 1 : -1;
|
|
2182
2190
|
}
|
|
2183
2191
|
function ce(t, e, n, r, s) {
|
|
2184
|
-
return e === r || e == null && r == null ? is(t, n) : r == null ? 1 : e == null ? -1 :
|
|
2192
|
+
return e === r || e == null && r == null ? is(t, n) : r == null ? 1 : e == null ? -1 : As(e, r, s);
|
|
2185
2193
|
}
|
|
2186
2194
|
function Ee([t, e], [n, r], s) {
|
|
2187
2195
|
return ce(t, e, n, r, s);
|
|
@@ -2234,8 +2242,8 @@ function Ps(t, { etype: e, pageInfo: n, dq: r, form: s }) {
|
|
|
2234
2242
|
if (l && ((p = l == null ? void 0 : l["forward-identity"]) == null ? void 0 : p[2]) !== "id") {
|
|
2235
2243
|
const b = l["checked-data-type"] === "date", _ = l.id;
|
|
2236
2244
|
c = c.map(([y]) => {
|
|
2237
|
-
var T,
|
|
2238
|
-
let g = (I = (M = (m = (
|
|
2245
|
+
var T, v, m, M, I;
|
|
2246
|
+
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];
|
|
2239
2247
|
return b && (g = Je(g)), [y, g];
|
|
2240
2248
|
});
|
|
2241
2249
|
}
|
|
@@ -2297,7 +2305,7 @@ function Ds(t, e) {
|
|
|
2297
2305
|
}
|
|
2298
2306
|
function Cn(t, e) {
|
|
2299
2307
|
const n = Ds(t, e);
|
|
2300
|
-
return
|
|
2308
|
+
return vs(Ie, t, e, n);
|
|
2301
2309
|
}
|
|
2302
2310
|
function Rs(t) {
|
|
2303
2311
|
const e = {};
|
|
@@ -3353,7 +3361,7 @@ async function Oi({
|
|
|
3353
3361
|
})
|
|
3354
3362
|
});
|
|
3355
3363
|
}
|
|
3356
|
-
async function
|
|
3364
|
+
async function vi({
|
|
3357
3365
|
apiURI: t,
|
|
3358
3366
|
appId: e,
|
|
3359
3367
|
path: n,
|
|
@@ -3374,7 +3382,7 @@ async function Ai({
|
|
|
3374
3382
|
body: r
|
|
3375
3383
|
});
|
|
3376
3384
|
}
|
|
3377
|
-
async function
|
|
3385
|
+
async function Ai({
|
|
3378
3386
|
apiURI: t,
|
|
3379
3387
|
appId: e,
|
|
3380
3388
|
path: n,
|
|
@@ -3516,7 +3524,7 @@ function Vt(t) {
|
|
|
3516
3524
|
}, e;
|
|
3517
3525
|
}, {});
|
|
3518
3526
|
}
|
|
3519
|
-
const Fn = "v0.22.
|
|
3527
|
+
const Fn = "v0.22.84";
|
|
3520
3528
|
function Pi(t, e) {
|
|
3521
3529
|
return {
|
|
3522
3530
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -4524,12 +4532,12 @@ class Hi {
|
|
|
4524
4532
|
const T = f[g];
|
|
4525
4533
|
if (Mr(T.store, _)) {
|
|
4526
4534
|
Yt(T.store, y);
|
|
4527
|
-
const
|
|
4528
|
-
|
|
4535
|
+
const v = Fe(s, T.store), m = Wi(T.store, y)[_];
|
|
4536
|
+
v ? (d.push({
|
|
4529
4537
|
oldEntity: T.entity,
|
|
4530
|
-
newEntity:
|
|
4538
|
+
newEntity: v,
|
|
4531
4539
|
changedFields: m || {}
|
|
4532
|
-
}), T.entity =
|
|
4540
|
+
}), T.entity = v) : c.push(g), delete u[_];
|
|
4533
4541
|
continue e;
|
|
4534
4542
|
}
|
|
4535
4543
|
}
|
|
@@ -5135,7 +5143,7 @@ class ao {
|
|
|
5135
5143
|
});
|
|
5136
5144
|
const _ = Xt(b.entries()), y = d.map((g) => {
|
|
5137
5145
|
var gt, wt, Tt, mt;
|
|
5138
|
-
const T = g["instaql-query"],
|
|
5146
|
+
const T = g["instaql-query"], v = g["instaql-result"], m = P(T), M = zt(v), I = Oe(
|
|
5139
5147
|
this.attrs,
|
|
5140
5148
|
M,
|
|
5141
5149
|
r,
|
|
@@ -5145,16 +5153,16 @@ class ao {
|
|
|
5145
5153
|
I,
|
|
5146
5154
|
_,
|
|
5147
5155
|
p
|
|
5148
|
-
), De = (wt = (gt =
|
|
5156
|
+
), 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;
|
|
5149
5157
|
return { q: T, hash: m, store: B, pageInfo: De, aggregate: Gn };
|
|
5150
5158
|
});
|
|
5151
|
-
y.forEach(({ hash: g, q: T, store:
|
|
5159
|
+
y.forEach(({ hash: g, q: T, store: v, pageInfo: m, aggregate: M }) => {
|
|
5152
5160
|
this.querySubs.updateInPlace((I) => {
|
|
5153
5161
|
if (!I[g]) {
|
|
5154
5162
|
this._log.error("Missing value in querySubs", { hash: g, q: T });
|
|
5155
5163
|
return;
|
|
5156
5164
|
}
|
|
5157
|
-
I[g].result = { store:
|
|
5165
|
+
I[g].result = { store: v, pageInfo: m, aggregate: M, processedTxId: p };
|
|
5158
5166
|
});
|
|
5159
5167
|
}), this._cleanupPendingMutationsQueries(), y.forEach(({ hash: g }) => {
|
|
5160
5168
|
this.notifyOne(g);
|
|
@@ -6043,7 +6051,7 @@ class ao {
|
|
|
6043
6051
|
async uploadFile(e, n, r) {
|
|
6044
6052
|
var o;
|
|
6045
6053
|
const s = await this.getCurrentUser(), i = (o = s == null ? void 0 : s.user) == null ? void 0 : o.refresh_token;
|
|
6046
|
-
return
|
|
6054
|
+
return vi({
|
|
6047
6055
|
...r,
|
|
6048
6056
|
apiURI: this.config.apiURI,
|
|
6049
6057
|
appId: this.config.appId,
|
|
@@ -6055,7 +6063,7 @@ class ao {
|
|
|
6055
6063
|
async deleteFile(e) {
|
|
6056
6064
|
var i;
|
|
6057
6065
|
const n = await this.getCurrentUser(), r = (i = n == null ? void 0 : n.user) == null ? void 0 : i.refresh_token;
|
|
6058
|
-
return await
|
|
6066
|
+
return await Ai({
|
|
6059
6067
|
apiURI: this.config.apiURI,
|
|
6060
6068
|
appId: this.config.appId,
|
|
6061
6069
|
path: e,
|
|
@@ -6172,7 +6180,7 @@ const Uo = {
|
|
|
6172
6180
|
let we;
|
|
6173
6181
|
function go(t, e) {
|
|
6174
6182
|
we == null || we.dispose();
|
|
6175
|
-
const n =
|
|
6183
|
+
const n = vo(e), r = mo(e, a), s = To(wo(t));
|
|
6176
6184
|
function i(l) {
|
|
6177
6185
|
var f;
|
|
6178
6186
|
l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && n.isVisible() && a();
|
|
@@ -6255,7 +6263,7 @@ function Oo(t) {
|
|
|
6255
6263
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
6256
6264
|
}
|
|
6257
6265
|
}
|
|
6258
|
-
function
|
|
6266
|
+
function vo(t) {
|
|
6259
6267
|
const e = document.createElement("div");
|
|
6260
6268
|
Object.assign(e.style, {
|
|
6261
6269
|
position: "fixed",
|
|
@@ -6272,7 +6280,7 @@ function Ao(t) {
|
|
|
6272
6280
|
}
|
|
6273
6281
|
return { element: e, isVisible: n };
|
|
6274
6282
|
}
|
|
6275
|
-
const
|
|
6283
|
+
const Ao = {
|
|
6276
6284
|
apiURI: "https://api.instantdb.com",
|
|
6277
6285
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
6278
6286
|
};
|
|
@@ -6497,7 +6505,7 @@ function jo(t, e, n, r, s) {
|
|
|
6497
6505
|
return Po(o, i.schema) && o._reactor.updateSchema(i.schema), o;
|
|
6498
6506
|
const a = new ao(
|
|
6499
6507
|
{
|
|
6500
|
-
...
|
|
6508
|
+
...Ao,
|
|
6501
6509
|
...i,
|
|
6502
6510
|
cardinalityInference: !!i.schema
|
|
6503
6511
|
},
|