@instantdb/react 1.0.42 → 1.0.43-branch-drewh-cli-email.26904178974.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/index.js +684 -671
- package/dist/standalone/index.umd.cjs +13 -13
- package/package.json +4 -4
package/dist/standalone/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var p = (n, e, t) =>
|
|
4
|
-
import
|
|
1
|
+
var $i = Object.defineProperty;
|
|
2
|
+
var Di = (n, e, t) => e in n ? $i(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var p = (n, e, t) => Di(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import ys, { useRef as $e, useCallback as Me, useSyncExternalStore as Vt, useEffect as We, useMemo as Sn, useState as bs, createElement as Ui } from "react";
|
|
5
5
|
function ce(n) {
|
|
6
6
|
const e = Ut(n);
|
|
7
7
|
let t = 3735928559 ^ e.length, r = 1103547991 ^ e.length;
|
|
@@ -77,7 +77,7 @@ const te = {
|
|
|
77
77
|
Remove: "remove",
|
|
78
78
|
Replace: "replace",
|
|
79
79
|
Add: "add"
|
|
80
|
-
},
|
|
80
|
+
}, gs = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Li = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Lt = Symbol.iterator, we = {
|
|
81
81
|
mutable: "mutable",
|
|
82
82
|
immutable: "immutable"
|
|
83
83
|
}, Gn = {};
|
|
@@ -109,7 +109,7 @@ function qe(n) {
|
|
|
109
109
|
return !!D(n);
|
|
110
110
|
}
|
|
111
111
|
function D(n) {
|
|
112
|
-
return typeof n != "object" ? null : n == null ? void 0 : n[
|
|
112
|
+
return typeof n != "object" ? null : n == null ? void 0 : n[gs];
|
|
113
113
|
}
|
|
114
114
|
function Yn(n) {
|
|
115
115
|
var e;
|
|
@@ -122,7 +122,7 @@ function ke(n, e) {
|
|
|
122
122
|
let t;
|
|
123
123
|
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, we)) === we.immutable || typeof t == "function");
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function _s(n, e = []) {
|
|
126
126
|
if (Object.hasOwnProperty.call(n, "key")) {
|
|
127
127
|
const t = n.parent.copy, r = D(je(t, n.key));
|
|
128
128
|
if (r !== null && (r == null ? void 0 : r.original) !== n.original)
|
|
@@ -133,10 +133,10 @@ function gs(n, e = []) {
|
|
|
133
133
|
e.push(i);
|
|
134
134
|
}
|
|
135
135
|
if (n.parent)
|
|
136
|
-
return
|
|
136
|
+
return _s(n.parent, e);
|
|
137
137
|
e.reverse();
|
|
138
138
|
try {
|
|
139
|
-
|
|
139
|
+
Fi(n.copy, e);
|
|
140
140
|
} catch {
|
|
141
141
|
return null;
|
|
142
142
|
}
|
|
@@ -169,7 +169,7 @@ function Ne(n, e) {
|
|
|
169
169
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
170
170
|
}).join("/");
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function Fi(n, e) {
|
|
173
173
|
for (let t = 0; t < e.length - 1; t += 1) {
|
|
174
174
|
const r = e[t];
|
|
175
175
|
if (n = je(ze(n) === 3 ? Array.from(n) : n, r), typeof n != "object")
|
|
@@ -177,7 +177,7 @@ function Li(n, e) {
|
|
|
177
177
|
}
|
|
178
178
|
return n;
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function Ni(n) {
|
|
181
181
|
const e = Object.create(Object.getPrototypeOf(n));
|
|
182
182
|
return Reflect.ownKeys(n).forEach((t) => {
|
|
183
183
|
let r = Reflect.getOwnPropertyDescriptor(n, t);
|
|
@@ -193,8 +193,8 @@ function Fi(n) {
|
|
|
193
193
|
}), Reflect.defineProperty(e, t, r);
|
|
194
194
|
}), e;
|
|
195
195
|
}
|
|
196
|
-
const
|
|
197
|
-
function
|
|
196
|
+
const Ki = Object.prototype.propertyIsEnumerable;
|
|
197
|
+
function ms(n, e) {
|
|
198
198
|
let t;
|
|
199
199
|
if (Array.isArray(n))
|
|
200
200
|
return Array.prototype.concat.call(n);
|
|
@@ -212,7 +212,7 @@ function _s(n, e) {
|
|
|
212
212
|
return new Map(n);
|
|
213
213
|
} else if (e != null && e.mark && (t = e.mark(n, we), t !== void 0) && t !== we.mutable) {
|
|
214
214
|
if (t === we.immutable)
|
|
215
|
-
return
|
|
215
|
+
return Ni(n);
|
|
216
216
|
if (typeof t == "function") {
|
|
217
217
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
218
218
|
throw new Error("You can't use mark and patches or auto freeze together.");
|
|
@@ -224,13 +224,13 @@ function _s(n, e) {
|
|
|
224
224
|
return Object.keys(n).forEach((s) => {
|
|
225
225
|
r[s] = n[s];
|
|
226
226
|
}), Object.getOwnPropertySymbols(n).forEach((s) => {
|
|
227
|
-
|
|
227
|
+
Ki.call(n, s) && (r[s] = n[s]);
|
|
228
228
|
}), r;
|
|
229
229
|
} else
|
|
230
230
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
231
231
|
}
|
|
232
232
|
function de(n) {
|
|
233
|
-
n.copy || (n.copy =
|
|
233
|
+
n.copy || (n.copy = ms(n.original, n.options));
|
|
234
234
|
}
|
|
235
235
|
function ht(n) {
|
|
236
236
|
if (!ke(n))
|
|
@@ -330,7 +330,7 @@ function Zn(n, e) {
|
|
|
330
330
|
} else
|
|
331
331
|
n.forEach((r, s) => e(s, r, n));
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function ws(n, e, t) {
|
|
334
334
|
if (qe(n) || !ke(n, t) || e.has(n) || Object.isFrozen(n))
|
|
335
335
|
return;
|
|
336
336
|
const r = n instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
|
|
@@ -342,7 +342,7 @@ function ms(n, e, t) {
|
|
|
342
342
|
const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
|
|
343
343
|
Ot(r ? s : n, i, u);
|
|
344
344
|
} else
|
|
345
|
-
|
|
345
|
+
ws(o, e, t);
|
|
346
346
|
}), s) {
|
|
347
347
|
const i = n, o = Array.from(i);
|
|
348
348
|
i.clear(), o.forEach((a) => {
|
|
@@ -350,9 +350,9 @@ function ms(n, e, t) {
|
|
|
350
350
|
});
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function Wi(n, e) {
|
|
354
354
|
const t = n.type === 3 ? n.setMap : n.copy;
|
|
355
|
-
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t &&
|
|
355
|
+
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && ws(je(t, e), n.finalities.handledSet, n.options);
|
|
356
356
|
}
|
|
357
357
|
function vn(n) {
|
|
358
358
|
n.type === 3 && n.copy && (n.copy.clear(), n.setMap.forEach((e) => {
|
|
@@ -362,7 +362,7 @@ function vn(n) {
|
|
|
362
362
|
function En(n, e, t, r) {
|
|
363
363
|
if (n.operated && n.assignedMap && n.assignedMap.size > 0 && !n.finalized) {
|
|
364
364
|
if (t && r) {
|
|
365
|
-
const i =
|
|
365
|
+
const i = _s(n);
|
|
366
366
|
i && e(n, i, t, r);
|
|
367
367
|
}
|
|
368
368
|
n.finalized = !0;
|
|
@@ -379,10 +379,10 @@ function Xn(n, e, t, r) {
|
|
|
379
379
|
}
|
|
380
380
|
}), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), ke(t, n.options) && n.finalities.draft.push(() => {
|
|
381
381
|
const i = n.type === 3 ? n.setMap : n.copy;
|
|
382
|
-
Re(je(i, e), t) &&
|
|
382
|
+
Re(je(i, e), t) && Wi(n, e);
|
|
383
383
|
});
|
|
384
384
|
}
|
|
385
|
-
function
|
|
385
|
+
function qi(n, e, t, r, s) {
|
|
386
386
|
let { original: i, assignedMap: o, options: a } = n, c = n.copy;
|
|
387
387
|
c.length < i.length && ([i, c] = [c, i], [t, r] = [r, t]);
|
|
388
388
|
for (let u = 0; u < i.length; u += 1)
|
|
@@ -428,7 +428,7 @@ function Wi(n, e, t, r, s) {
|
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function zi({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
|
|
432
432
|
t.forEach((a, c) => {
|
|
433
433
|
const u = je(n, c), l = Ft(je(e, c)), f = a ? wt(n, c) ? te.Replace : te.Add : te.Remove;
|
|
434
434
|
if (Re(u, l) && f === te.Replace)
|
|
@@ -437,7 +437,7 @@ function qi({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
|
|
|
437
437
|
s.push(f === te.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === te.Add ? { op: te.Remove, path: y } : f === te.Remove ? { op: te.Add, path: y, value: u } : { op: te.Replace, path: y, value: u });
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function Vi({ original: n, copy: e }, t, r, s, i) {
|
|
441
441
|
let o = 0;
|
|
442
442
|
n.forEach((a) => {
|
|
443
443
|
if (!e.has(a)) {
|
|
@@ -474,11 +474,11 @@ function Et(n, e, t, r) {
|
|
|
474
474
|
switch (n.type) {
|
|
475
475
|
case 0:
|
|
476
476
|
case 2:
|
|
477
|
-
return
|
|
477
|
+
return zi(n, e, t, r, s);
|
|
478
478
|
case 1:
|
|
479
|
-
return
|
|
479
|
+
return qi(n, e, t, r, s);
|
|
480
480
|
case 3:
|
|
481
|
-
return
|
|
481
|
+
return Vi(n, e, t, r, s);
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
484
|
const Qt = (n, e, t = !1) => {
|
|
@@ -565,7 +565,7 @@ const Qt = (n, e, t = !1) => {
|
|
|
565
565
|
[Lt]() {
|
|
566
566
|
return this.entries();
|
|
567
567
|
}
|
|
568
|
-
},
|
|
568
|
+
}, Qi = Reflect.ownKeys(On), kr = (n, e, { isValuesIterator: t }) => () => {
|
|
569
569
|
var r, s;
|
|
570
570
|
const i = e.next();
|
|
571
571
|
if (i.done)
|
|
@@ -676,13 +676,13 @@ Set.prototype.difference && Object.assign(Bt, {
|
|
|
676
676
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), n);
|
|
677
677
|
}
|
|
678
678
|
});
|
|
679
|
-
const
|
|
679
|
+
const Bi = Reflect.ownKeys(Bt), Ss = /* @__PURE__ */ new WeakSet(), Ts = {
|
|
680
680
|
get(n, e, t) {
|
|
681
681
|
var r, s;
|
|
682
682
|
const i = (r = n.copy) === null || r === void 0 ? void 0 : r[e];
|
|
683
|
-
if (i &&
|
|
683
|
+
if (i && Ss.has(i))
|
|
684
684
|
return i;
|
|
685
|
-
if (e ===
|
|
685
|
+
if (e === gs)
|
|
686
686
|
return n;
|
|
687
687
|
let o;
|
|
688
688
|
if (n.options.mark) {
|
|
@@ -691,14 +691,14 @@ const Qi = Reflect.ownKeys(Bt), ws = /* @__PURE__ */ new WeakSet(), Ss = {
|
|
|
691
691
|
return n.options.strict && Qt(u, n.options, !0), u;
|
|
692
692
|
}
|
|
693
693
|
const a = me(n);
|
|
694
|
-
if (a instanceof Map &&
|
|
694
|
+
if (a instanceof Map && Qi.includes(e)) {
|
|
695
695
|
if (e === "size")
|
|
696
696
|
return Object.getOwnPropertyDescriptor(On, "size").get.call(n.proxy);
|
|
697
697
|
const u = On[e];
|
|
698
698
|
if (u)
|
|
699
699
|
return u.bind(n.proxy);
|
|
700
700
|
}
|
|
701
|
-
if (a instanceof Set &&
|
|
701
|
+
if (a instanceof Set && Bi.includes(e)) {
|
|
702
702
|
if (e === "size")
|
|
703
703
|
return Object.getOwnPropertyDescriptor(Bt, "size").get.call(n.proxy);
|
|
704
704
|
const u = Bt[e];
|
|
@@ -769,7 +769,7 @@ const Qi = Reflect.ownKeys(Bt), ws = /* @__PURE__ */ new WeakSet(), Ss = {
|
|
|
769
769
|
},
|
|
770
770
|
deleteProperty(n, e) {
|
|
771
771
|
var t;
|
|
772
|
-
return n.type === 1 ?
|
|
772
|
+
return n.type === 1 ? Ts.set.call(this, n, e, void 0, n.proxy) : (fn(n.original, e) !== void 0 || e in n.original ? (de(n), Ie(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
|
|
773
773
|
}
|
|
774
774
|
};
|
|
775
775
|
function er(n) {
|
|
@@ -786,8 +786,8 @@ function er(n) {
|
|
|
786
786
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
787
787
|
};
|
|
788
788
|
(r || "key" in n) && (a.key = r);
|
|
789
|
-
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a,
|
|
790
|
-
if (s.revoke.push(u),
|
|
789
|
+
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, Ts);
|
|
790
|
+
if (s.revoke.push(u), Ss.add(c), a.proxy = c, t) {
|
|
791
791
|
const l = t;
|
|
792
792
|
l.finalities.draft.push((f, d) => {
|
|
793
793
|
var y, b;
|
|
@@ -811,7 +811,7 @@ function er(n) {
|
|
|
811
811
|
return c;
|
|
812
812
|
}
|
|
813
813
|
Gn.createDraft = er;
|
|
814
|
-
function
|
|
814
|
+
function Gi(n, e, t, r, s) {
|
|
815
815
|
var i;
|
|
816
816
|
const o = D(n), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : n, c = !!e.length;
|
|
817
817
|
if (o != null && o.operated)
|
|
@@ -824,7 +824,7 @@ function Bi(n, e, t, r, s) {
|
|
|
824
824
|
r && c ? [{ op: te.Replace, path: [], value: a }] : r
|
|
825
825
|
];
|
|
826
826
|
}
|
|
827
|
-
function
|
|
827
|
+
function Hi(n, e) {
|
|
828
828
|
var t;
|
|
829
829
|
const r = {
|
|
830
830
|
draft: [],
|
|
@@ -842,7 +842,7 @@ function Gi(n, e) {
|
|
|
842
842
|
return [
|
|
843
843
|
a,
|
|
844
844
|
(c = []) => {
|
|
845
|
-
const [u, l, f] =
|
|
845
|
+
const [u, l, f] = Gi(a, c, s, i, e.enableAutoFreeze);
|
|
846
846
|
return e.enablePatches ? [u, l, f] : u;
|
|
847
847
|
}
|
|
848
848
|
];
|
|
@@ -862,7 +862,7 @@ function kn(n) {
|
|
|
862
862
|
} else typeof o == "object" && o !== null && (n.value = o, n.isRoot = !1, kn(n));
|
|
863
863
|
}), s && (n.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
864
864
|
}
|
|
865
|
-
function
|
|
865
|
+
function vs(n) {
|
|
866
866
|
var e;
|
|
867
867
|
const t = D(n);
|
|
868
868
|
if (!ke(n, t == null ? void 0 : t.options))
|
|
@@ -872,7 +872,7 @@ function Ts(n) {
|
|
|
872
872
|
return t.original;
|
|
873
873
|
let s;
|
|
874
874
|
function i() {
|
|
875
|
-
s = r === 2 ? Jn(n) ? new Map(n) : new (Object.getPrototypeOf(n)).constructor(n) : r === 3 ? Array.from(t.setMap.values()) :
|
|
875
|
+
s = r === 2 ? Jn(n) ? new Map(n) : new (Object.getPrototypeOf(n)).constructor(n) : r === 3 ? Array.from(t.setMap.values()) : ms(n, t == null ? void 0 : t.options);
|
|
876
876
|
}
|
|
877
877
|
if (t) {
|
|
878
878
|
t.finalized = !0;
|
|
@@ -886,7 +886,7 @@ function Ts(n) {
|
|
|
886
886
|
if (Zn(s, (o, a) => {
|
|
887
887
|
if (t && Re(je(t.original, o), a))
|
|
888
888
|
return;
|
|
889
|
-
const c =
|
|
889
|
+
const c = vs(a);
|
|
890
890
|
c !== a && (s === n && i(), Ot(s, o, c));
|
|
891
891
|
}), r === 3) {
|
|
892
892
|
const o = (e = t == null ? void 0 : t.original) !== null && e !== void 0 ? e : s;
|
|
@@ -897,9 +897,9 @@ function Ts(n) {
|
|
|
897
897
|
function Ar(n) {
|
|
898
898
|
if (!qe(n))
|
|
899
899
|
throw new Error(`current() is only used for Draft, parameter: ${n}`);
|
|
900
|
-
return
|
|
900
|
+
return vs(n);
|
|
901
901
|
}
|
|
902
|
-
const
|
|
902
|
+
const Ji = (n) => function e(t, r, s) {
|
|
903
903
|
var i, o, a;
|
|
904
904
|
if (typeof t == "function" && typeof r != "function")
|
|
905
905
|
return function(v, ...U) {
|
|
@@ -926,7 +926,7 @@ const Hi = (n) => function e(t, r, s) {
|
|
|
926
926
|
};
|
|
927
927
|
if (!ke(f, m) && typeof f == "object" && f !== null)
|
|
928
928
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
929
|
-
const [T, _] =
|
|
929
|
+
const [T, _] = Hi(f, m);
|
|
930
930
|
if (typeof r != "function") {
|
|
931
931
|
if (!ke(f, m))
|
|
932
932
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
@@ -943,7 +943,7 @@ const Hi = (n) => function e(t, r, s) {
|
|
|
943
943
|
if (!qe(v)) {
|
|
944
944
|
if (v !== void 0 && !Re(v, T) && (U != null && U.operated))
|
|
945
945
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
946
|
-
const P = v == null ? void 0 : v[
|
|
946
|
+
const P = v == null ? void 0 : v[Li];
|
|
947
947
|
if (P) {
|
|
948
948
|
const H = P[0];
|
|
949
949
|
return m.strict && typeof v == "object" && v !== null && kn({
|
|
@@ -968,9 +968,9 @@ const Hi = (n) => function e(t, r, s) {
|
|
|
968
968
|
return w instanceof Promise ? w.then(C, (v) => {
|
|
969
969
|
throw Tn(D(T)), v;
|
|
970
970
|
}) : C(w);
|
|
971
|
-
}, Gt =
|
|
971
|
+
}, Gt = Ji();
|
|
972
972
|
Object.prototype.constructor.toString();
|
|
973
|
-
function
|
|
973
|
+
function Es(n, e) {
|
|
974
974
|
const t = Object.keys(n), r = Object.keys(e);
|
|
975
975
|
return t.length === r.length && Object.keys(n).every((s) => e.hasOwnProperty(s));
|
|
976
976
|
}
|
|
@@ -978,7 +978,7 @@ function Cr(n, e) {
|
|
|
978
978
|
return Object.keys(n).length === Object.keys(e).length && Object.keys(n).every((t) => e.hasOwnProperty(t) && n[t] === e[t]);
|
|
979
979
|
}
|
|
980
980
|
function Nt(n, e) {
|
|
981
|
-
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e :
|
|
981
|
+
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : Es(n, e) ? Object.keys(n).every((t) => Nt(n[t], e[t])) : !1;
|
|
982
982
|
}
|
|
983
983
|
function tr(n) {
|
|
984
984
|
if (!pt(n))
|
|
@@ -988,7 +988,7 @@ function tr(n) {
|
|
|
988
988
|
r !== void 0 && (e[t] = r);
|
|
989
989
|
return e;
|
|
990
990
|
}
|
|
991
|
-
function
|
|
991
|
+
function Os(n, e) {
|
|
992
992
|
if (!pt(n) || !pt(e))
|
|
993
993
|
return e;
|
|
994
994
|
const t = { ...n };
|
|
@@ -1000,14 +1000,14 @@ function Es(n, e) {
|
|
|
1000
1000
|
continue;
|
|
1001
1001
|
}
|
|
1002
1002
|
const s = pt(n[r]) && pt(e[r]);
|
|
1003
|
-
t[r] = s ?
|
|
1003
|
+
t[r] = s ? Os(n[r], e[r]) : e[r];
|
|
1004
1004
|
}
|
|
1005
1005
|
return t;
|
|
1006
1006
|
}
|
|
1007
1007
|
function pt(n) {
|
|
1008
1008
|
return typeof n == "object" && n !== null && !Array.isArray(n);
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1010
|
+
function Yi(n, e, t) {
|
|
1011
1011
|
if (!n || e.length === 0)
|
|
1012
1012
|
return;
|
|
1013
1013
|
let r = n || {};
|
|
@@ -1028,7 +1028,7 @@ function Ir(n, e, t) {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
r[e[e.length - 1]] = t;
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1031
|
+
function ks(n, e) {
|
|
1032
1032
|
if (!n || e.length === 0)
|
|
1033
1033
|
return;
|
|
1034
1034
|
const [t, ...r] = e;
|
|
@@ -1037,13 +1037,13 @@ function Os(n, e) {
|
|
|
1037
1037
|
Array.isArray(n) ? n.splice(t, 1) : delete n[t];
|
|
1038
1038
|
return;
|
|
1039
1039
|
}
|
|
1040
|
-
|
|
1040
|
+
ks(n[t], r), Zi(n[t]) && delete n[t];
|
|
1041
1041
|
}
|
|
1042
1042
|
}
|
|
1043
|
-
function
|
|
1043
|
+
function Zi(n) {
|
|
1044
1044
|
return n && Object.keys(n).length === 0;
|
|
1045
1045
|
}
|
|
1046
|
-
const Pr = /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$/,
|
|
1046
|
+
const Pr = /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$/, Xi = {
|
|
1047
1047
|
ZULU: 0,
|
|
1048
1048
|
YEKT: 18e3,
|
|
1049
1049
|
YEKST: 21600,
|
|
@@ -1239,39 +1239,39 @@ const Pr = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
|
|
|
1239
1239
|
ACSST: 37800,
|
|
1240
1240
|
ACDT: 37800
|
|
1241
1241
|
};
|
|
1242
|
-
function
|
|
1242
|
+
function eo(n) {
|
|
1243
1243
|
return new Date(n);
|
|
1244
1244
|
}
|
|
1245
|
-
function
|
|
1245
|
+
function to(n) {
|
|
1246
1246
|
return /* @__PURE__ */ new Date(n + "Z");
|
|
1247
1247
|
}
|
|
1248
|
-
const
|
|
1249
|
-
function
|
|
1250
|
-
const e = n.match(
|
|
1248
|
+
const no = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
|
|
1249
|
+
function ro(n) {
|
|
1250
|
+
const e = n.match(no);
|
|
1251
1251
|
if (!e)
|
|
1252
1252
|
return null;
|
|
1253
1253
|
const [t, r, s, i] = e;
|
|
1254
1254
|
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));
|
|
1255
1255
|
}
|
|
1256
|
-
function
|
|
1256
|
+
function so(n) {
|
|
1257
1257
|
const [e, t] = n.split(" ");
|
|
1258
1258
|
return /* @__PURE__ */ new Date(e + "T" + t + "Z");
|
|
1259
1259
|
}
|
|
1260
|
-
function
|
|
1260
|
+
function io(n) {
|
|
1261
1261
|
const [e, t] = n.split(" ");
|
|
1262
1262
|
return /* @__PURE__ */ new Date(e + "T" + t + "Z");
|
|
1263
1263
|
}
|
|
1264
|
-
function
|
|
1264
|
+
function oo(n) {
|
|
1265
1265
|
return new Date(n);
|
|
1266
1266
|
}
|
|
1267
|
-
function
|
|
1267
|
+
function ao(n) {
|
|
1268
1268
|
const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
|
|
1269
1269
|
if (!n.match(e))
|
|
1270
1270
|
throw new Error(`Unable to parse \`${n}\` as a date.`);
|
|
1271
1271
|
const r = /* @__PURE__ */ new Date(n + " UTC");
|
|
1272
1272
|
return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), 0, 0, 0, 0));
|
|
1273
1273
|
}
|
|
1274
|
-
function
|
|
1274
|
+
function co(n) {
|
|
1275
1275
|
const e = /^(.+T.+)([+-])(\d{2})$/, t = n.match(e);
|
|
1276
1276
|
if (t) {
|
|
1277
1277
|
const [, r, s, i] = t, o = `${r}${s}${i}:00`;
|
|
@@ -1279,7 +1279,7 @@ function ao(n) {
|
|
|
1279
1279
|
}
|
|
1280
1280
|
return null;
|
|
1281
1281
|
}
|
|
1282
|
-
function
|
|
1282
|
+
function uo(n) {
|
|
1283
1283
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(\d{1,2})(?::(\d{1,2}))?(?::(\d{1,2}))?(.*)$/, t = n.match(e);
|
|
1284
1284
|
if (t) {
|
|
1285
1285
|
const [, r, s, i, o, a, c, u, l] = t, f = s.padStart(2, "0"), d = i.padStart(2, "0");
|
|
@@ -1290,14 +1290,14 @@ function co(n) {
|
|
|
1290
1290
|
}
|
|
1291
1291
|
return null;
|
|
1292
1292
|
}
|
|
1293
|
-
function
|
|
1293
|
+
function lo(n) {
|
|
1294
1294
|
const [e, t] = n.split(", "), [r, s, i] = e.split("/").map(Number), o = t.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1295
1295
|
if (!o)
|
|
1296
1296
|
throw new Error(`Unable to parse time from: ${n}`);
|
|
1297
1297
|
let [, a, c, u, l] = o;
|
|
1298
1298
|
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));
|
|
1299
1299
|
}
|
|
1300
|
-
function
|
|
1300
|
+
function fo(n) {
|
|
1301
1301
|
switch (n) {
|
|
1302
1302
|
case "epoch":
|
|
1303
1303
|
return /* @__PURE__ */ new Date(0);
|
|
@@ -1309,28 +1309,28 @@ function lo(n) {
|
|
|
1309
1309
|
return null;
|
|
1310
1310
|
}
|
|
1311
1311
|
}
|
|
1312
|
-
function
|
|
1312
|
+
function ho(n) {
|
|
1313
1313
|
const e = n.match(Pr);
|
|
1314
1314
|
if (!e)
|
|
1315
1315
|
return null;
|
|
1316
|
-
const [t] = e, r =
|
|
1316
|
+
const [t] = e, r = Xi[t], s = new Date(n.replace(Pr, "Z"));
|
|
1317
1317
|
return new Date(s.getTime() - r * 1e3);
|
|
1318
1318
|
}
|
|
1319
|
-
const
|
|
1320
|
-
no,
|
|
1321
|
-
so,
|
|
1322
|
-
oo,
|
|
1323
|
-
uo,
|
|
1324
|
-
eo,
|
|
1325
|
-
ao,
|
|
1319
|
+
const po = [
|
|
1326
1320
|
ro,
|
|
1327
|
-
|
|
1321
|
+
io,
|
|
1322
|
+
ao,
|
|
1328
1323
|
lo,
|
|
1329
|
-
|
|
1324
|
+
to,
|
|
1330
1325
|
co,
|
|
1331
|
-
|
|
1326
|
+
so,
|
|
1327
|
+
eo,
|
|
1328
|
+
fo,
|
|
1329
|
+
ho,
|
|
1330
|
+
uo,
|
|
1331
|
+
oo
|
|
1332
1332
|
];
|
|
1333
|
-
function
|
|
1333
|
+
function yo(n, e) {
|
|
1334
1334
|
try {
|
|
1335
1335
|
const t = n(e);
|
|
1336
1336
|
return t instanceof Date && !isNaN(t.getTime()) ? t : null;
|
|
@@ -1339,14 +1339,14 @@ function po(n, e) {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
}
|
|
1341
1341
|
function An(n) {
|
|
1342
|
-
for (const e of
|
|
1343
|
-
const t =
|
|
1342
|
+
for (const e of po) {
|
|
1343
|
+
const t = yo(e, n);
|
|
1344
1344
|
if (t)
|
|
1345
1345
|
return t;
|
|
1346
1346
|
}
|
|
1347
1347
|
return null;
|
|
1348
1348
|
}
|
|
1349
|
-
function
|
|
1349
|
+
function bo(n) {
|
|
1350
1350
|
try {
|
|
1351
1351
|
const e = JSON.parse(n);
|
|
1352
1352
|
return typeof e == "string" ? An(e) : null;
|
|
@@ -1361,7 +1361,7 @@ function Zt(n) {
|
|
|
1361
1361
|
if (n instanceof Date)
|
|
1362
1362
|
return n;
|
|
1363
1363
|
if (typeof n == "string") {
|
|
1364
|
-
const e = An(n) ||
|
|
1364
|
+
const e = An(n) || bo(n) || An(n.trim());
|
|
1365
1365
|
if (!e)
|
|
1366
1366
|
throw new Error(`Unable to parse \`${n}\` as a date.`);
|
|
1367
1367
|
return e;
|
|
@@ -1445,7 +1445,7 @@ class Ke {
|
|
|
1445
1445
|
return { attrs: this.attrs, linkIndex: this.linkIndex };
|
|
1446
1446
|
}
|
|
1447
1447
|
}
|
|
1448
|
-
function
|
|
1448
|
+
function go(n) {
|
|
1449
1449
|
return n.cardinality === "one";
|
|
1450
1450
|
}
|
|
1451
1451
|
function nr(n) {
|
|
@@ -1477,7 +1477,7 @@ function be(n, e, t) {
|
|
|
1477
1477
|
}
|
|
1478
1478
|
s > -1 && r.set(e[s], t);
|
|
1479
1479
|
}
|
|
1480
|
-
function
|
|
1480
|
+
function As(n, e, t) {
|
|
1481
1481
|
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
1482
1482
|
for (const o of e) {
|
|
1483
1483
|
let [a, c, u] = o;
|
|
@@ -1490,7 +1490,7 @@ function ks(n, e, t) {
|
|
|
1490
1490
|
}
|
|
1491
1491
|
return { eav: r, aev: s, vae: i };
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function Cs(n) {
|
|
1494
1494
|
return {
|
|
1495
1495
|
triples: ge(n.eav, 3),
|
|
1496
1496
|
cardinalityInference: n.cardinalityInference,
|
|
@@ -1498,20 +1498,20 @@ function As(n) {
|
|
|
1498
1498
|
version: 1
|
|
1499
1499
|
};
|
|
1500
1500
|
}
|
|
1501
|
-
function
|
|
1501
|
+
function Is(n, e) {
|
|
1502
1502
|
return yt(n, e.triples, e.cardinalityInference, e.useDateObjects);
|
|
1503
1503
|
}
|
|
1504
|
-
function
|
|
1504
|
+
function Ps(n, e) {
|
|
1505
1505
|
if (n)
|
|
1506
1506
|
return new Ke(n.attrs, n.linkIndex);
|
|
1507
1507
|
if (e && "__type" in e)
|
|
1508
1508
|
return new Ke(e.attrs, e.linkIndex);
|
|
1509
1509
|
}
|
|
1510
|
-
function
|
|
1510
|
+
function _o(n, e) {
|
|
1511
1511
|
return at(n.eav, [e]) !== void 0;
|
|
1512
1512
|
}
|
|
1513
1513
|
function yt(n, e, t, r) {
|
|
1514
|
-
const s =
|
|
1514
|
+
const s = As(n, e, r);
|
|
1515
1515
|
return s.cardinalityInference = t, s.useDateObjects = r, s;
|
|
1516
1516
|
}
|
|
1517
1517
|
function kt(n, e) {
|
|
@@ -1541,21 +1541,21 @@ function kt(n, e) {
|
|
|
1541
1541
|
return [t, ...a];
|
|
1542
1542
|
}
|
|
1543
1543
|
}
|
|
1544
|
-
function
|
|
1544
|
+
function Ms(n, e, t) {
|
|
1545
1545
|
const r = kt(n, t);
|
|
1546
1546
|
if (!r)
|
|
1547
1547
|
return;
|
|
1548
1548
|
const [s, i, o] = r, a = e.getAttr(i);
|
|
1549
1549
|
a && (Oe(n.eav, [s, i, o]), Oe(n.aev, [i, s, o]), nr(a) && Oe(n.vae, [o, i, s]));
|
|
1550
1550
|
}
|
|
1551
|
-
let
|
|
1552
|
-
function
|
|
1551
|
+
let mo = 0;
|
|
1552
|
+
function Rs(n, e, t) {
|
|
1553
1553
|
const [r, s, i] = t;
|
|
1554
1554
|
let o;
|
|
1555
1555
|
const a = at(n.eav, [r, s, i]);
|
|
1556
|
-
return a && (o = a[3]), o || Date.now() * 10 +
|
|
1556
|
+
return a && (o = a[3]), o || Date.now() * 10 + mo++;
|
|
1557
1557
|
}
|
|
1558
|
-
function
|
|
1558
|
+
function js(n, e, t) {
|
|
1559
1559
|
const r = kt(n, t);
|
|
1560
1560
|
if (!r)
|
|
1561
1561
|
return;
|
|
@@ -1564,10 +1564,10 @@ function Rs(n, e, t) {
|
|
|
1564
1564
|
if (!a)
|
|
1565
1565
|
return;
|
|
1566
1566
|
a["checked-data-type"] === "date" && n.useDateObjects && (o = Zt(o));
|
|
1567
|
-
const c = at(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ??
|
|
1568
|
-
|
|
1567
|
+
const c = at(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? Rs(n, a, r), l = [s, i, o, u];
|
|
1568
|
+
go(a) ? (be(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), be(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (be(n.eav, [s, i, o], l), be(n.aev, [i, s, o], l)), nr(a) && be(n.vae, [o, i, s], l);
|
|
1569
1569
|
}
|
|
1570
|
-
function
|
|
1570
|
+
function wo(n, e, t) {
|
|
1571
1571
|
var y;
|
|
1572
1572
|
const r = kt(n, t);
|
|
1573
1573
|
if (!r)
|
|
@@ -1583,11 +1583,11 @@ function mo(n, e, t) {
|
|
|
1583
1583
|
const u = (y = c.values().next()) == null ? void 0 : y.value;
|
|
1584
1584
|
if (!u)
|
|
1585
1585
|
return;
|
|
1586
|
-
const l = u[2], f =
|
|
1586
|
+
const l = u[2], f = Os(l, o), d = [
|
|
1587
1587
|
s,
|
|
1588
1588
|
i,
|
|
1589
1589
|
f,
|
|
1590
|
-
|
|
1590
|
+
Rs(n, a, u)
|
|
1591
1591
|
];
|
|
1592
1592
|
be(n.eav, [s, i], /* @__PURE__ */ new Map([[f, d]])), be(n.aev, [i, s], /* @__PURE__ */ new Map([[f, d]]));
|
|
1593
1593
|
}
|
|
@@ -1618,50 +1618,50 @@ function Cn(n, e, t) {
|
|
|
1618
1618
|
(!s || !g || ((m = g["reverse-identity"]) == null ? void 0 : m[1]) === s) && (Oe(n.eav, [d, y, b]), Oe(n.aev, [y, d, b]), Oe(n.vae, [b, y, d])), g && g["on-delete"] === "cascade" && ((T = g["reverse-identity"]) == null ? void 0 : T[1]) === s && Cn(n, e, [d, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
|
|
1619
1619
|
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && Oe(n.vae, [o]);
|
|
1620
1620
|
}
|
|
1621
|
-
function
|
|
1622
|
-
const r =
|
|
1621
|
+
function xs(n, e, t) {
|
|
1622
|
+
const r = As(e, t, n.useDateObjects);
|
|
1623
1623
|
Object.keys(r).forEach((s) => {
|
|
1624
1624
|
n[s] = r[s];
|
|
1625
1625
|
});
|
|
1626
1626
|
}
|
|
1627
|
-
function
|
|
1627
|
+
function So(n, [e]) {
|
|
1628
1628
|
n.addAttr(e);
|
|
1629
1629
|
}
|
|
1630
|
-
function
|
|
1630
|
+
function $s(n) {
|
|
1631
1631
|
return ge(n.eav, 3);
|
|
1632
1632
|
}
|
|
1633
|
-
function
|
|
1633
|
+
function To(n, e, [t]) {
|
|
1634
1634
|
if (!e.getAttr(t))
|
|
1635
1635
|
return;
|
|
1636
|
-
const r =
|
|
1637
|
-
e.deleteAttr(t),
|
|
1636
|
+
const r = $s(n).filter(([s, i]) => i !== t);
|
|
1637
|
+
e.deleteAttr(t), xs(n, e, r);
|
|
1638
1638
|
}
|
|
1639
|
-
function
|
|
1640
|
-
e.getAttr(t.id) && (e.updateAttr(t),
|
|
1639
|
+
function vo(n, e, [t]) {
|
|
1640
|
+
e.getAttr(t.id) && (e.updateAttr(t), xs(n, e, $s(n)));
|
|
1641
1641
|
}
|
|
1642
|
-
function
|
|
1642
|
+
function Eo(n, e, t) {
|
|
1643
1643
|
const [r, ...s] = t;
|
|
1644
1644
|
switch (r) {
|
|
1645
1645
|
case "add-triple":
|
|
1646
|
-
|
|
1646
|
+
js(n, e, s);
|
|
1647
1647
|
break;
|
|
1648
1648
|
case "deep-merge-triple":
|
|
1649
|
-
|
|
1649
|
+
wo(n, e, s);
|
|
1650
1650
|
break;
|
|
1651
1651
|
case "retract-triple":
|
|
1652
|
-
|
|
1652
|
+
Ms(n, e, s);
|
|
1653
1653
|
break;
|
|
1654
1654
|
case "delete-entity":
|
|
1655
1655
|
Cn(n, e, s);
|
|
1656
1656
|
break;
|
|
1657
1657
|
case "add-attr":
|
|
1658
|
-
|
|
1658
|
+
So(e, s);
|
|
1659
1659
|
break;
|
|
1660
1660
|
case "delete-attr":
|
|
1661
|
-
|
|
1661
|
+
To(n, e, s);
|
|
1662
1662
|
break;
|
|
1663
1663
|
case "update-attr":
|
|
1664
|
-
|
|
1664
|
+
vo(n, e, s);
|
|
1665
1665
|
break;
|
|
1666
1666
|
case "restore-attr":
|
|
1667
1667
|
break;
|
|
@@ -1716,13 +1716,13 @@ function Mt(n, e, t) {
|
|
|
1716
1716
|
}
|
|
1717
1717
|
return r;
|
|
1718
1718
|
}
|
|
1719
|
-
function
|
|
1719
|
+
function Oo(n, e, t) {
|
|
1720
1720
|
let r = "";
|
|
1721
1721
|
return n !== void 0 && (r += "e"), e !== void 0 && (r += "a"), t !== void 0 && (r += "v"), r;
|
|
1722
1722
|
}
|
|
1723
|
-
function
|
|
1723
|
+
function ko(n, [e, t, r]) {
|
|
1724
1724
|
var i, o;
|
|
1725
|
-
switch (
|
|
1725
|
+
switch (Oo(e, t, r)) {
|
|
1726
1726
|
case "e": {
|
|
1727
1727
|
const a = n.eav.get(e);
|
|
1728
1728
|
return ge(a, 2);
|
|
@@ -1768,7 +1768,7 @@ function Oo(n, [e, t, r]) {
|
|
|
1768
1768
|
return ge(n.eav, 3);
|
|
1769
1769
|
}
|
|
1770
1770
|
}
|
|
1771
|
-
function
|
|
1771
|
+
function Ao(n, e, t) {
|
|
1772
1772
|
var s;
|
|
1773
1773
|
const r = {};
|
|
1774
1774
|
if (!e)
|
|
@@ -1788,15 +1788,15 @@ function Ve(n, e, t) {
|
|
|
1788
1788
|
var r;
|
|
1789
1789
|
return (r = n.revIdents.get(e)) == null ? void 0 : r.get(t);
|
|
1790
1790
|
}
|
|
1791
|
-
function
|
|
1791
|
+
function Co(n, e) {
|
|
1792
1792
|
return n.blobAttrs.get(e);
|
|
1793
1793
|
}
|
|
1794
|
-
function
|
|
1794
|
+
function Ds(n, e) {
|
|
1795
1795
|
var r;
|
|
1796
1796
|
const t = n.primaryKeys.get(e);
|
|
1797
1797
|
return t || ((r = n.forwardIdents.get(e)) == null ? void 0 : r.get("id"));
|
|
1798
1798
|
}
|
|
1799
|
-
function
|
|
1799
|
+
function Io(n, e, t) {
|
|
1800
1800
|
const r = kt(n, t);
|
|
1801
1801
|
if (!r)
|
|
1802
1802
|
return;
|
|
@@ -1804,7 +1804,7 @@ function Co(n, e, t) {
|
|
|
1804
1804
|
if (e.getAttr(i))
|
|
1805
1805
|
return at(n.eav, [s, i]);
|
|
1806
1806
|
}
|
|
1807
|
-
function
|
|
1807
|
+
function Po(n, e, t) {
|
|
1808
1808
|
const r = t.filter(([s, i, o, a, c]) => {
|
|
1809
1809
|
if (s !== "add-triple" && s !== "deep-merge-triple")
|
|
1810
1810
|
return !0;
|
|
@@ -1814,8 +1814,8 @@ function Io(n, e, t) {
|
|
|
1814
1814
|
let l = !1;
|
|
1815
1815
|
const f = e.getAttr(o);
|
|
1816
1816
|
if (f) {
|
|
1817
|
-
const d =
|
|
1818
|
-
l = !!
|
|
1817
|
+
const d = Ds(e, f["forward-identity"][1]);
|
|
1818
|
+
l = !!Io(n, e, [
|
|
1819
1819
|
i,
|
|
1820
1820
|
d == null ? void 0 : d.id,
|
|
1821
1821
|
i
|
|
@@ -1825,7 +1825,7 @@ function Io(n, e, t) {
|
|
|
1825
1825
|
});
|
|
1826
1826
|
return Gt({ store: n, attrsStore: e }, (s) => {
|
|
1827
1827
|
r.forEach((i) => {
|
|
1828
|
-
|
|
1828
|
+
Eo(s.store, s.attrsStore, i);
|
|
1829
1829
|
});
|
|
1830
1830
|
}, {
|
|
1831
1831
|
mark: (s) => {
|
|
@@ -1834,28 +1834,28 @@ function Io(n, e, t) {
|
|
|
1834
1834
|
}
|
|
1835
1835
|
});
|
|
1836
1836
|
}
|
|
1837
|
-
function
|
|
1837
|
+
function Mo(n) {
|
|
1838
1838
|
return typeof n == "string" && n.startsWith("?");
|
|
1839
1839
|
}
|
|
1840
|
-
function
|
|
1840
|
+
function Ro(n, e, t) {
|
|
1841
1841
|
if (t.hasOwnProperty(n)) {
|
|
1842
1842
|
const r = t[n];
|
|
1843
|
-
return
|
|
1843
|
+
return Us(r, e, t);
|
|
1844
1844
|
}
|
|
1845
1845
|
return { ...t, [n]: e };
|
|
1846
1846
|
}
|
|
1847
1847
|
function Mr(n, e, t) {
|
|
1848
1848
|
return n === e ? t : null;
|
|
1849
1849
|
}
|
|
1850
|
-
function
|
|
1850
|
+
function jo(n) {
|
|
1851
1851
|
switch (typeof n) {
|
|
1852
1852
|
case "string":
|
|
1853
|
-
return n.startsWith("?") ?
|
|
1853
|
+
return n.startsWith("?") ? Ro : Mr;
|
|
1854
1854
|
default:
|
|
1855
1855
|
return Mr;
|
|
1856
1856
|
}
|
|
1857
1857
|
}
|
|
1858
|
-
const
|
|
1858
|
+
const xo = [
|
|
1859
1859
|
"in",
|
|
1860
1860
|
"$in",
|
|
1861
1861
|
"$not",
|
|
@@ -1863,69 +1863,69 @@ const jo = [
|
|
|
1863
1863
|
"$comparator"
|
|
1864
1864
|
// covers all of $gt, $lt, etc.
|
|
1865
1865
|
];
|
|
1866
|
-
function
|
|
1867
|
-
for (const e of
|
|
1866
|
+
function $o(n) {
|
|
1867
|
+
for (const e of xo)
|
|
1868
1868
|
if (n.hasOwnProperty(e))
|
|
1869
1869
|
return !0;
|
|
1870
1870
|
return !1;
|
|
1871
1871
|
}
|
|
1872
|
-
function
|
|
1873
|
-
return t ? typeof n == "object" ?
|
|
1872
|
+
function Us(n, e, t) {
|
|
1873
|
+
return t ? typeof n == "object" ? $o(n) ? t : null : jo(n)(n, e, t) : null;
|
|
1874
1874
|
}
|
|
1875
|
-
function
|
|
1875
|
+
function Do(n, e, t) {
|
|
1876
1876
|
return n.reduce((r, s, i) => {
|
|
1877
1877
|
const o = e[i];
|
|
1878
|
-
return
|
|
1878
|
+
return Us(s, o, r);
|
|
1879
1879
|
}, t);
|
|
1880
1880
|
}
|
|
1881
|
-
function Do(n, e, t) {
|
|
1882
|
-
return Fo(n, e, t).map((r) => $o(e, r, t)).filter((r) => r);
|
|
1883
|
-
}
|
|
1884
1881
|
function Uo(n, e, t) {
|
|
1885
|
-
return
|
|
1882
|
+
return No(n, e, t).map((r) => Do(e, r, t)).filter((r) => r);
|
|
1883
|
+
}
|
|
1884
|
+
function Lo(n, e, t) {
|
|
1885
|
+
return e.or ? e.or.patterns.flatMap((r) => In(n, r, t)) : e.and ? e.and.patterns.reduce((r, s) => In(n, s, r), t) : t.flatMap((r) => Uo(n, e, r));
|
|
1886
1886
|
}
|
|
1887
1887
|
function In(n, e, t = [{}]) {
|
|
1888
|
-
return e.reduce((r, s) =>
|
|
1888
|
+
return e.reduce((r, s) => Lo(n, s, r), t);
|
|
1889
1889
|
}
|
|
1890
1890
|
function sr(n, e) {
|
|
1891
|
-
return Array.isArray(e) ? e.map((t) => sr(n, t)) :
|
|
1891
|
+
return Array.isArray(e) ? e.map((t) => sr(n, t)) : Mo(e) ? n[e] : e;
|
|
1892
1892
|
}
|
|
1893
|
-
function
|
|
1893
|
+
function Fo(n, { find: e, where: t }) {
|
|
1894
1894
|
return In(n, t).map((s) => sr(s, e));
|
|
1895
1895
|
}
|
|
1896
|
-
function
|
|
1897
|
-
return
|
|
1896
|
+
function No(n, e, t) {
|
|
1897
|
+
return ko(n, sr(t, e));
|
|
1898
1898
|
}
|
|
1899
|
-
const
|
|
1899
|
+
const Ko = /^(?:[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;
|
|
1900
1900
|
function it(n) {
|
|
1901
|
-
return typeof n == "string" &&
|
|
1901
|
+
return typeof n == "string" && Ko.test(n);
|
|
1902
1902
|
}
|
|
1903
1903
|
const oe = [];
|
|
1904
1904
|
for (let n = 0; n < 256; ++n)
|
|
1905
1905
|
oe.push((n + 256).toString(16).slice(1));
|
|
1906
|
-
function
|
|
1906
|
+
function Wo(n, e = 0) {
|
|
1907
1907
|
return (oe[n[e + 0]] + oe[n[e + 1]] + oe[n[e + 2]] + oe[n[e + 3]] + "-" + oe[n[e + 4]] + oe[n[e + 5]] + "-" + oe[n[e + 6]] + oe[n[e + 7]] + "-" + oe[n[e + 8]] + oe[n[e + 9]] + "-" + oe[n[e + 10]] + oe[n[e + 11]] + oe[n[e + 12]] + oe[n[e + 13]] + oe[n[e + 14]] + oe[n[e + 15]]).toLowerCase();
|
|
1908
1908
|
}
|
|
1909
1909
|
let dn;
|
|
1910
|
-
const
|
|
1911
|
-
function
|
|
1910
|
+
const qo = new Uint8Array(16);
|
|
1911
|
+
function zo() {
|
|
1912
1912
|
if (!dn) {
|
|
1913
1913
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1914
1914
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1915
1915
|
dn = crypto.getRandomValues.bind(crypto);
|
|
1916
1916
|
}
|
|
1917
|
-
return dn(
|
|
1917
|
+
return dn(qo);
|
|
1918
1918
|
}
|
|
1919
|
-
const
|
|
1920
|
-
function
|
|
1919
|
+
const Vo = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Rr = { randomUUID: Vo };
|
|
1920
|
+
function Qo(n, e, t) {
|
|
1921
1921
|
var s;
|
|
1922
1922
|
if (Rr.randomUUID && !n)
|
|
1923
1923
|
return Rr.randomUUID();
|
|
1924
1924
|
n = n || {};
|
|
1925
|
-
const r = n.random ?? ((s = n.rng) == null ? void 0 : s.call(n)) ??
|
|
1925
|
+
const r = n.random ?? ((s = n.rng) == null ? void 0 : s.call(n)) ?? zo();
|
|
1926
1926
|
if (r.length < 16)
|
|
1927
1927
|
throw new Error("Random bytes length must be >= 16");
|
|
1928
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1928
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Wo(r);
|
|
1929
1929
|
}
|
|
1930
1930
|
function jr(n) {
|
|
1931
1931
|
const e = n.replace(/-/g, ""), t = [];
|
|
@@ -1933,7 +1933,7 @@ function jr(n) {
|
|
|
1933
1933
|
t.push(parseInt(e.substring(r, r + 2), 16));
|
|
1934
1934
|
return t;
|
|
1935
1935
|
}
|
|
1936
|
-
function
|
|
1936
|
+
function Bo(n, e) {
|
|
1937
1937
|
for (let t = 0; t < n.length; t++) {
|
|
1938
1938
|
if (n[t] < e[t])
|
|
1939
1939
|
return -1;
|
|
@@ -1942,17 +1942,17 @@ function Qo(n, e) {
|
|
|
1942
1942
|
}
|
|
1943
1943
|
return 0;
|
|
1944
1944
|
}
|
|
1945
|
-
function
|
|
1946
|
-
return
|
|
1945
|
+
function Go(n, e) {
|
|
1946
|
+
return Bo(jr(n), jr(e));
|
|
1947
1947
|
}
|
|
1948
1948
|
function Z() {
|
|
1949
|
-
return
|
|
1949
|
+
return Qo();
|
|
1950
1950
|
}
|
|
1951
|
-
function
|
|
1951
|
+
function Ho(n, e) {
|
|
1952
1952
|
return n.localeCompare(e);
|
|
1953
1953
|
}
|
|
1954
|
-
function
|
|
1955
|
-
let n =
|
|
1954
|
+
function Jo() {
|
|
1955
|
+
let n = Ho;
|
|
1956
1956
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
1957
1957
|
try {
|
|
1958
1958
|
n = Intl.Collator("en-US").compare;
|
|
@@ -1960,14 +1960,14 @@ function Ho() {
|
|
|
1960
1960
|
}
|
|
1961
1961
|
return n;
|
|
1962
1962
|
}
|
|
1963
|
-
const
|
|
1964
|
-
let
|
|
1965
|
-
const
|
|
1966
|
-
|
|
1963
|
+
const Yo = Jo();
|
|
1964
|
+
let Ls = !0;
|
|
1965
|
+
const ul = (n) => {
|
|
1966
|
+
Ls = n;
|
|
1967
1967
|
};
|
|
1968
|
-
let
|
|
1968
|
+
let Zo = 0;
|
|
1969
1969
|
function St(n) {
|
|
1970
|
-
return Xt(`_${n}`,
|
|
1970
|
+
return Xt(`_${n}`, Zo++);
|
|
1971
1971
|
}
|
|
1972
1972
|
function Xt(n, e) {
|
|
1973
1973
|
return `?${n}-${e}`;
|
|
@@ -1977,27 +1977,27 @@ class ot extends Error {
|
|
|
1977
1977
|
super(e), this.name = "AttrNotFoundError";
|
|
1978
1978
|
}
|
|
1979
1979
|
}
|
|
1980
|
-
function
|
|
1981
|
-
const t =
|
|
1980
|
+
function Xo(n, e) {
|
|
1981
|
+
const t = Ds(n, e);
|
|
1982
1982
|
if (!t)
|
|
1983
1983
|
throw new ot(`Could not find id attr for ${e}`);
|
|
1984
1984
|
return t;
|
|
1985
1985
|
}
|
|
1986
1986
|
function xr(n, e, t, r) {
|
|
1987
|
-
return [
|
|
1987
|
+
return [ea(n, e, t, r)];
|
|
1988
1988
|
}
|
|
1989
|
-
function
|
|
1989
|
+
function ea(n, e, t, r) {
|
|
1990
1990
|
return [
|
|
1991
1991
|
n(t, r),
|
|
1992
|
-
|
|
1992
|
+
Xo(e, t).id,
|
|
1993
1993
|
n(t, r),
|
|
1994
1994
|
n("time", r)
|
|
1995
1995
|
];
|
|
1996
1996
|
}
|
|
1997
|
-
function
|
|
1997
|
+
function ta(n, e, t) {
|
|
1998
1998
|
return n.map((r) => r === e ? t : r);
|
|
1999
1999
|
}
|
|
2000
|
-
function
|
|
2000
|
+
function Fs(n, e, t, r, s) {
|
|
2001
2001
|
const i = se(e, t, s), o = Ve(e, t, s), a = i || o;
|
|
2002
2002
|
if (!a)
|
|
2003
2003
|
throw new ot(`Could not find attr for ${[t, s]}`);
|
|
@@ -2026,7 +2026,7 @@ function $r(n, e) {
|
|
|
2026
2026
|
return typeof o != "string" ? !1 : s.test(o);
|
|
2027
2027
|
};
|
|
2028
2028
|
}
|
|
2029
|
-
function
|
|
2029
|
+
function na(n, e) {
|
|
2030
2030
|
if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
|
|
2031
2031
|
return e;
|
|
2032
2032
|
const t = n["checked-data-type"] === "date";
|
|
@@ -2086,7 +2086,7 @@ function ta(n, e) {
|
|
|
2086
2086
|
}
|
|
2087
2087
|
return e;
|
|
2088
2088
|
}
|
|
2089
|
-
function
|
|
2089
|
+
function ra(n, e, t, r, s, i) {
|
|
2090
2090
|
const o = se(e, t, s), a = Ve(e, t, s), c = o || a;
|
|
2091
2091
|
if (!c)
|
|
2092
2092
|
throw new ot(`No attr for etype = ${t} label = ${s}`);
|
|
@@ -2104,31 +2104,31 @@ function na(n, e, t, r, s, i) {
|
|
|
2104
2104
|
return o ? [
|
|
2105
2105
|
n(t, r),
|
|
2106
2106
|
c.id,
|
|
2107
|
-
|
|
2107
|
+
na(c, i),
|
|
2108
2108
|
St("time")
|
|
2109
2109
|
] : [i, c.id, n(t, r), St("time")];
|
|
2110
2110
|
}
|
|
2111
|
-
function
|
|
2111
|
+
function sa(n, e, t, r, s) {
|
|
2112
2112
|
const [i, o, a] = s.reduce((c, u) => {
|
|
2113
|
-
const [l, f, d] = c, [y, b, g] =
|
|
2113
|
+
const [l, f, d] = c, [y, b, g] = Fs(n, e, l, f, u);
|
|
2114
2114
|
return [y, b, [...d, g]];
|
|
2115
2115
|
}, [t, r, []]);
|
|
2116
2116
|
return [i, o, a];
|
|
2117
2117
|
}
|
|
2118
2118
|
function Pn(n, e, t, r, s, i) {
|
|
2119
|
-
const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] =
|
|
2119
|
+
const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = sa(n, e, t, r, o), f = ra(n, e, c, u, a, i);
|
|
2120
2120
|
return l.concat([f]);
|
|
2121
2121
|
}
|
|
2122
|
-
function
|
|
2122
|
+
function ia(n, e) {
|
|
2123
2123
|
return e ? [e].concat(n) : n;
|
|
2124
2124
|
}
|
|
2125
|
-
function
|
|
2125
|
+
function oa([n, e]) {
|
|
2126
2126
|
return n === "or" && Array.isArray(e);
|
|
2127
2127
|
}
|
|
2128
|
-
function
|
|
2128
|
+
function aa([n, e]) {
|
|
2129
2129
|
return n === "and" && Array.isArray(e);
|
|
2130
2130
|
}
|
|
2131
|
-
function
|
|
2131
|
+
function ca(n, e, t) {
|
|
2132
2132
|
return (r, s) => {
|
|
2133
2133
|
const i = n(r, s);
|
|
2134
2134
|
return e == i ? i : `${i}-${t}`;
|
|
@@ -2136,27 +2136,27 @@ function aa(n, e, t) {
|
|
|
2136
2136
|
}
|
|
2137
2137
|
function Dr(n, e, t, r, s, i) {
|
|
2138
2138
|
const o = n(r, s), a = i.map((c, u) => {
|
|
2139
|
-
const l =
|
|
2140
|
-
return
|
|
2139
|
+
const l = ca(n, o, u);
|
|
2140
|
+
return Ns(l, t, r, s, c);
|
|
2141
2141
|
});
|
|
2142
2142
|
return { [e]: { patterns: a, joinSym: o } };
|
|
2143
2143
|
}
|
|
2144
|
-
function
|
|
2144
|
+
function ua(n) {
|
|
2145
2145
|
const e = [];
|
|
2146
2146
|
for (let t = 1; t <= n.length; t++)
|
|
2147
2147
|
e.push(n.slice(0, t));
|
|
2148
2148
|
return e;
|
|
2149
2149
|
}
|
|
2150
2150
|
function Ur(n, e, t, r, s) {
|
|
2151
|
-
return
|
|
2151
|
+
return ua(s).map((i) => Pn(n, e, t, r, i, {
|
|
2152
2152
|
$isNull: !0
|
|
2153
2153
|
}));
|
|
2154
2154
|
}
|
|
2155
|
-
function
|
|
2155
|
+
function Ns(n, e, t, r, s) {
|
|
2156
2156
|
return Object.entries(s).flatMap(([i, o]) => {
|
|
2157
|
-
if (ia([i, o]))
|
|
2158
|
-
return Dr(n, "or", e, t, r, o);
|
|
2159
2157
|
if (oa([i, o]))
|
|
2158
|
+
return Dr(n, "or", e, t, r, o);
|
|
2159
|
+
if (aa([i, o]))
|
|
2160
2160
|
return Dr(n, "and", e, t, r, o);
|
|
2161
2161
|
if (i === "$entityIdStartsWith")
|
|
2162
2162
|
return [];
|
|
@@ -2182,25 +2182,25 @@ function Fs(n, e, t, r, s) {
|
|
|
2182
2182
|
] : Pn(n, e, t, r, a, o);
|
|
2183
2183
|
});
|
|
2184
2184
|
}
|
|
2185
|
-
function
|
|
2185
|
+
function la(n, e, t, r) {
|
|
2186
2186
|
const s = Xt;
|
|
2187
|
-
return r ?
|
|
2187
|
+
return r ? Ns(s, n, e, t, r).concat(xr(s, n, e, t)) : xr(s, n, e, t);
|
|
2188
2188
|
}
|
|
2189
|
-
function
|
|
2189
|
+
function fa(n, e, t) {
|
|
2190
2190
|
return [n(e, t), n("time", t)];
|
|
2191
2191
|
}
|
|
2192
|
-
function
|
|
2193
|
-
const [o, a, c, u, l] =
|
|
2192
|
+
function da(n, e, t, r, s, i) {
|
|
2193
|
+
const [o, a, c, u, l] = Fs(n, e, t, r, s), f = ta(c, n(t, r), i);
|
|
2194
2194
|
return [o, a, f, u, l];
|
|
2195
2195
|
}
|
|
2196
|
-
function
|
|
2196
|
+
function ha(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
2197
2197
|
const a = Object.keys(i).filter((c) => c !== "$");
|
|
2198
2198
|
return a.length ? Object.entries(o).map(function([u, l]) {
|
|
2199
2199
|
return a.map(function(y) {
|
|
2200
2200
|
var g, m, T;
|
|
2201
2201
|
const b = !!(e.cardinalityInference && ((T = (m = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : m[y]) != null && T.isSingular));
|
|
2202
2202
|
try {
|
|
2203
|
-
const [_, w, C] =
|
|
2203
|
+
const [_, w, C] = da(n, t, r, s, y, u), v = qs(e, t, {
|
|
2204
2204
|
etype: _,
|
|
2205
2205
|
level: w,
|
|
2206
2206
|
form: i[y],
|
|
@@ -2217,11 +2217,11 @@ function da(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
|
2217
2217
|
}, l);
|
|
2218
2218
|
}) : Object.values(o);
|
|
2219
2219
|
}
|
|
2220
|
-
function
|
|
2221
|
-
return t === "string" ?
|
|
2220
|
+
function pa(n, e, t) {
|
|
2221
|
+
return t === "string" ? Yo(n, e) : n > e ? 1 : -1;
|
|
2222
2222
|
}
|
|
2223
2223
|
function bt(n, e, t, r, s) {
|
|
2224
|
-
return e === r || e == null && r == null ?
|
|
2224
|
+
return e === r || e == null && r == null ? Go(n, t) : r == null ? 1 : e == null ? -1 : pa(e, r, s);
|
|
2225
2225
|
}
|
|
2226
2226
|
function Ht([n, e], [t, r], s) {
|
|
2227
2227
|
return bt(n, e, t, r, s);
|
|
@@ -2229,7 +2229,7 @@ function Ht([n, e], [t, r], s) {
|
|
|
2229
2229
|
function Mn(n) {
|
|
2230
2230
|
return n == null ? n : new Date(n).getTime();
|
|
2231
2231
|
}
|
|
2232
|
-
function
|
|
2232
|
+
function Ks(n, e, t) {
|
|
2233
2233
|
var d;
|
|
2234
2234
|
const [r, s, i, o] = n;
|
|
2235
2235
|
if (((d = e["forward-identity"]) == null ? void 0 : d[2]) === "id")
|
|
@@ -2237,32 +2237,32 @@ function Ns(n, e, t) {
|
|
|
2237
2237
|
const [a, c] = t, u = e["checked-data-type"], l = u === "date" ? Mn(c) : c, f = u === "date" ? Mn(i) : i;
|
|
2238
2238
|
return Ht([a, l], [r, f], u);
|
|
2239
2239
|
}
|
|
2240
|
-
function
|
|
2241
|
-
const s =
|
|
2240
|
+
function ya(n, e, t, r) {
|
|
2241
|
+
const s = Ks(n, e, r);
|
|
2242
2242
|
return t === "desc" ? s > 0 : s < 0;
|
|
2243
2243
|
}
|
|
2244
|
-
function
|
|
2245
|
-
const s =
|
|
2244
|
+
function ba(n, e, t, r) {
|
|
2245
|
+
const s = Ks(n, e, r);
|
|
2246
2246
|
return t === "desc" ? s < 0 : s > 0;
|
|
2247
2247
|
}
|
|
2248
|
-
function
|
|
2248
|
+
function ga(n, e) {
|
|
2249
2249
|
const t = e[1];
|
|
2250
2250
|
return n.getAttr(t);
|
|
2251
2251
|
}
|
|
2252
|
-
function
|
|
2252
|
+
function _a(n, e, t) {
|
|
2253
2253
|
const r = Object.keys(t)[0];
|
|
2254
2254
|
return se(n, e, r);
|
|
2255
2255
|
}
|
|
2256
|
-
function
|
|
2256
|
+
function ma(n, e, t, r) {
|
|
2257
2257
|
if (t)
|
|
2258
|
-
return
|
|
2258
|
+
return ga(n, t);
|
|
2259
2259
|
if (r)
|
|
2260
|
-
return
|
|
2260
|
+
return _a(n, e, r);
|
|
2261
2261
|
}
|
|
2262
|
-
function
|
|
2262
|
+
function wa(n, e, t) {
|
|
2263
2263
|
var s, i;
|
|
2264
2264
|
if (!Array.isArray(t.fields))
|
|
2265
|
-
return
|
|
2265
|
+
return Co(n, e);
|
|
2266
2266
|
const r = /* @__PURE__ */ new Map();
|
|
2267
2267
|
for (const o of t.fields) {
|
|
2268
2268
|
const a = se(n, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
|
|
@@ -2274,11 +2274,11 @@ function ma(n, e, t) {
|
|
|
2274
2274
|
}
|
|
2275
2275
|
return r;
|
|
2276
2276
|
}
|
|
2277
|
-
function
|
|
2277
|
+
function Sa(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
2278
2278
|
var g, m;
|
|
2279
|
-
const o = (g = i == null ? void 0 : i.$) == null ? void 0 : g.order, a =
|
|
2280
|
-
let u =
|
|
2281
|
-
const l = r == null ? void 0 : r["start-cursor"], f = r == null ? void 0 : r["end-cursor"], d =
|
|
2279
|
+
const o = (g = i == null ? void 0 : i.$) == null ? void 0 : g.order, a = Ws(i), c = Ta(i);
|
|
2280
|
+
let u = Fo(n, s);
|
|
2281
|
+
const l = r == null ? void 0 : r["start-cursor"], f = r == null ? void 0 : r["end-cursor"], d = ma(e, t, l, o);
|
|
2282
2282
|
if (d && ((m = d == null ? void 0 : d["forward-identity"]) == null ? void 0 : m[2]) !== "id") {
|
|
2283
2283
|
const T = d["checked-data-type"] === "date", _ = d.id;
|
|
2284
2284
|
u = u.map(([w]) => {
|
|
@@ -2293,57 +2293,57 @@ function wa(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
|
2293
2293
|
return Ht(w, _, d == null ? void 0 : d["checked-data-type"]);
|
|
2294
2294
|
});
|
|
2295
2295
|
let y = {};
|
|
2296
|
-
const b =
|
|
2296
|
+
const b = wa(e, t, s);
|
|
2297
2297
|
for (const T of u) {
|
|
2298
2298
|
const [_] = T;
|
|
2299
|
-
if (y[_] || !a && l && d &&
|
|
2299
|
+
if (y[_] || !a && l && d && ya(l, d, c, T) || !a && f && d && ba(f, d, c, T))
|
|
2300
2300
|
continue;
|
|
2301
|
-
const w =
|
|
2301
|
+
const w = Ao(n, b, _);
|
|
2302
2302
|
w && (y[_] = w);
|
|
2303
2303
|
}
|
|
2304
2304
|
return y;
|
|
2305
2305
|
}
|
|
2306
|
-
function
|
|
2306
|
+
function Ta(n) {
|
|
2307
2307
|
var t;
|
|
2308
2308
|
const e = (t = n.$) == null ? void 0 : t.order;
|
|
2309
2309
|
return e && e[Object.keys(e)[0]] || "asc";
|
|
2310
2310
|
}
|
|
2311
|
-
function
|
|
2311
|
+
function Ws(n) {
|
|
2312
2312
|
var s, i, o;
|
|
2313
2313
|
const e = (s = n.$) == null ? void 0 : s.offset, t = (i = n.$) == null ? void 0 : i.before, r = (o = n.$) == null ? void 0 : o.after;
|
|
2314
2314
|
return !e && !t && !r;
|
|
2315
2315
|
}
|
|
2316
|
-
function
|
|
2316
|
+
function va(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
|
|
2317
2317
|
var d, y, b, g, m;
|
|
2318
|
-
if (!
|
|
2318
|
+
if (!Ws(s) && (!o || !o["start-cursor"]))
|
|
2319
2319
|
return [];
|
|
2320
|
-
const a =
|
|
2320
|
+
const a = ia(la(e, t, r, (d = s.$) == null ? void 0 : d.where), i), c = fa(Xt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = Sa(n, e, {
|
|
2321
2321
|
etype: t,
|
|
2322
2322
|
pageInfo: o,
|
|
2323
2323
|
form: s,
|
|
2324
2324
|
dq: { where: a, find: c, fields: u }
|
|
2325
2325
|
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((m = s.$) == null ? void 0 : m.last);
|
|
2326
2326
|
if (f != null) {
|
|
2327
|
-
r > 0 &&
|
|
2327
|
+
r > 0 && Ls && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
|
|
2328
2328
|
const T = Object.entries(l);
|
|
2329
2329
|
return T.length <= f ? l : Object.fromEntries(T.slice(0, f));
|
|
2330
2330
|
}
|
|
2331
2331
|
return l;
|
|
2332
2332
|
}
|
|
2333
|
-
function
|
|
2333
|
+
function Ea(n, e, t) {
|
|
2334
2334
|
try {
|
|
2335
|
-
return
|
|
2335
|
+
return va(n, e, t);
|
|
2336
2336
|
} catch (r) {
|
|
2337
2337
|
if (r instanceof ot)
|
|
2338
2338
|
return {};
|
|
2339
2339
|
throw r;
|
|
2340
2340
|
}
|
|
2341
2341
|
}
|
|
2342
|
-
function
|
|
2343
|
-
const r =
|
|
2344
|
-
return
|
|
2342
|
+
function qs(n, e, t) {
|
|
2343
|
+
const r = Ea(n, e, t);
|
|
2344
|
+
return ha(Xt, n, e, t, r);
|
|
2345
2345
|
}
|
|
2346
|
-
function
|
|
2346
|
+
function Oa(n) {
|
|
2347
2347
|
const e = {};
|
|
2348
2348
|
for (const [t, r] of Object.entries(n))
|
|
2349
2349
|
e[t] = {
|
|
@@ -2354,18 +2354,18 @@ function Ea(n) {
|
|
|
2354
2354
|
};
|
|
2355
2355
|
return e;
|
|
2356
2356
|
}
|
|
2357
|
-
function
|
|
2357
|
+
function zs({ store: n, attrsStore: e, pageInfo: t, aggregate: r }, s) {
|
|
2358
2358
|
const o = { data: Object.keys(s).reduce(function(c, u) {
|
|
2359
|
-
return r != null && r[u] || u === "$$ruleParams" || (c[u] =
|
|
2359
|
+
return r != null && r[u] || u === "$$ruleParams" || (c[u] = qs(n, e, {
|
|
2360
2360
|
etype: u,
|
|
2361
2361
|
form: s[u],
|
|
2362
2362
|
level: 0,
|
|
2363
2363
|
pageInfo: t == null ? void 0 : t[u]
|
|
2364
2364
|
})), c;
|
|
2365
2365
|
}, {}) };
|
|
2366
|
-
return t && (o.pageInfo =
|
|
2366
|
+
return t && (o.pageInfo = Oa(t)), r && (o.aggregate = r), o;
|
|
2367
2367
|
}
|
|
2368
|
-
function
|
|
2368
|
+
function ka() {
|
|
2369
2369
|
const e = {
|
|
2370
2370
|
__etype: 1,
|
|
2371
2371
|
__ops: 1,
|
|
@@ -2379,7 +2379,7 @@ function Oa() {
|
|
|
2379
2379
|
};
|
|
2380
2380
|
return new Set(Object.keys(e));
|
|
2381
2381
|
}
|
|
2382
|
-
const
|
|
2382
|
+
const Aa = ka();
|
|
2383
2383
|
function Kt(n, e, t) {
|
|
2384
2384
|
const r = {
|
|
2385
2385
|
__etype: n,
|
|
@@ -2391,7 +2391,7 @@ function Kt(n, e, t) {
|
|
|
2391
2391
|
return t;
|
|
2392
2392
|
if (i === "__etype")
|
|
2393
2393
|
return n;
|
|
2394
|
-
if (
|
|
2394
|
+
if (Aa.has(i))
|
|
2395
2395
|
return (o, a) => Kt(n, e, [
|
|
2396
2396
|
...t,
|
|
2397
2397
|
a ? [i, n, e, o, a] : [i, n, e, o]
|
|
@@ -2399,7 +2399,7 @@ function Kt(n, e, t) {
|
|
|
2399
2399
|
}
|
|
2400
2400
|
});
|
|
2401
2401
|
}
|
|
2402
|
-
function
|
|
2402
|
+
function Ca(n, e) {
|
|
2403
2403
|
return `lookup__${n}__${JSON.stringify(e)}`;
|
|
2404
2404
|
}
|
|
2405
2405
|
function Jt(n) {
|
|
@@ -2409,13 +2409,13 @@ function Rn(n) {
|
|
|
2409
2409
|
const [e, t, ...r] = n.split("__");
|
|
2410
2410
|
return [t, JSON.parse(r.join("__"))];
|
|
2411
2411
|
}
|
|
2412
|
-
function
|
|
2412
|
+
function Ia(n) {
|
|
2413
2413
|
return new Proxy({
|
|
2414
2414
|
__etype: n
|
|
2415
2415
|
}, {
|
|
2416
2416
|
get(e, t) {
|
|
2417
2417
|
if (t === "lookup")
|
|
2418
|
-
return (s, i) => Kt(n, Rn(
|
|
2418
|
+
return (s, i) => Kt(n, Rn(Ca(s, i)), []);
|
|
2419
2419
|
if (t === "__etype")
|
|
2420
2420
|
return n;
|
|
2421
2421
|
const r = t;
|
|
@@ -2426,15 +2426,15 @@ function Ca(n) {
|
|
|
2426
2426
|
function ir() {
|
|
2427
2427
|
return new Proxy({}, {
|
|
2428
2428
|
get(n, e) {
|
|
2429
|
-
return
|
|
2429
|
+
return Ia(e);
|
|
2430
2430
|
}
|
|
2431
2431
|
});
|
|
2432
2432
|
}
|
|
2433
|
-
const
|
|
2434
|
-
function
|
|
2433
|
+
const ll = ir();
|
|
2434
|
+
function Pa(n) {
|
|
2435
2435
|
return n.__ops;
|
|
2436
2436
|
}
|
|
2437
|
-
function
|
|
2437
|
+
function Ma(n, e) {
|
|
2438
2438
|
const { attrIdMap: t, refSwapAttrIds: r } = n, s = [];
|
|
2439
2439
|
for (const o of e) {
|
|
2440
2440
|
const a = t[o];
|
|
@@ -2453,7 +2453,7 @@ function Pa(n, e) {
|
|
|
2453
2453
|
}
|
|
2454
2454
|
return s;
|
|
2455
2455
|
}
|
|
2456
|
-
function
|
|
2456
|
+
function Ra(n) {
|
|
2457
2457
|
if (Array.isArray(n))
|
|
2458
2458
|
return n;
|
|
2459
2459
|
const e = Object.entries(n);
|
|
@@ -2461,7 +2461,7 @@ function Ma(n) {
|
|
|
2461
2461
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
2462
2462
|
return e[0];
|
|
2463
2463
|
}
|
|
2464
|
-
function
|
|
2464
|
+
function ja(n, e, t) {
|
|
2465
2465
|
return t.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2466
2466
|
// before assuming it's a ref lookup.
|
|
2467
2467
|
!se(n, e, t);
|
|
@@ -2472,8 +2472,8 @@ function jn(n) {
|
|
|
2472
2472
|
throw new Error(`${n} is not a valid lookup attribute.`);
|
|
2473
2473
|
return e;
|
|
2474
2474
|
}
|
|
2475
|
-
function
|
|
2476
|
-
if (!
|
|
2475
|
+
function xa(n, e, t) {
|
|
2476
|
+
if (!ja(n, e, t))
|
|
2477
2477
|
return se(n, e, t);
|
|
2478
2478
|
const r = jn(t), s = se(n, e, r) || Ve(n, e, r);
|
|
2479
2479
|
if (s && s["value-type"] !== "ref")
|
|
@@ -2481,18 +2481,18 @@ function ja(n, e, t) {
|
|
|
2481
2481
|
return s;
|
|
2482
2482
|
}
|
|
2483
2483
|
function xn(n) {
|
|
2484
|
-
return typeof n == "string" && !Jt(n) ? null : typeof n == "string" && Jt(n) ? Rn(n) :
|
|
2484
|
+
return typeof n == "string" && !Jt(n) ? null : typeof n == "string" && Jt(n) ? Rn(n) : Ra(n);
|
|
2485
2485
|
}
|
|
2486
2486
|
function _e(n, e, t) {
|
|
2487
2487
|
const r = xn(t);
|
|
2488
2488
|
if (r === null)
|
|
2489
2489
|
return t;
|
|
2490
|
-
const [s, i] = r, o =
|
|
2490
|
+
const [s, i] = r, o = xa(n, e, s);
|
|
2491
2491
|
if (!o || !o["unique?"])
|
|
2492
2492
|
throw new Error(`${s} is not a unique attribute.`);
|
|
2493
2493
|
return [o.id, i];
|
|
2494
2494
|
}
|
|
2495
|
-
function
|
|
2495
|
+
function Vs(n, e, t, r) {
|
|
2496
2496
|
var o;
|
|
2497
2497
|
const s = _e(n, e, t);
|
|
2498
2498
|
return Array.isArray(s) ? [[
|
|
@@ -2502,7 +2502,7 @@ function zs(n, e, t, r) {
|
|
|
2502
2502
|
s
|
|
2503
2503
|
]].concat(r) : r;
|
|
2504
2504
|
}
|
|
2505
|
-
function
|
|
2505
|
+
function $a({ attrsStore: n }, [e, t, r]) {
|
|
2506
2506
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
2507
2507
|
const a = Array.isArray(o) ? o : [o], c = se(n, e, i), u = Ve(n, e, i);
|
|
2508
2508
|
return a.map((l) => c ? [
|
|
@@ -2521,9 +2521,9 @@ function xa({ attrsStore: n }, [e, t, r]) {
|
|
|
2521
2521
|
_e(n, e, t)
|
|
2522
2522
|
]);
|
|
2523
2523
|
});
|
|
2524
|
-
return
|
|
2524
|
+
return Vs(n, e, t, s);
|
|
2525
2525
|
}
|
|
2526
|
-
function
|
|
2526
|
+
function Da({ attrsStore: n }, [e, t, r]) {
|
|
2527
2527
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
2528
2528
|
const a = Array.isArray(o) ? o : [o], c = se(n, e, i), u = Ve(n, e, i);
|
|
2529
2529
|
return a.map((l) => c ? [
|
|
@@ -2542,9 +2542,9 @@ function $a({ attrsStore: n }, [e, t, r]) {
|
|
|
2542
2542
|
_e(n, e, t)
|
|
2543
2543
|
]);
|
|
2544
2544
|
});
|
|
2545
|
-
return
|
|
2545
|
+
return Vs(n, e, t, s);
|
|
2546
2546
|
}
|
|
2547
|
-
function
|
|
2547
|
+
function Ua(n, e, t, r) {
|
|
2548
2548
|
var s;
|
|
2549
2549
|
if (Array.isArray(r)) {
|
|
2550
2550
|
const [i, o] = r;
|
|
@@ -2567,18 +2567,18 @@ function Da(n, e, t, r) {
|
|
|
2567
2567
|
}
|
|
2568
2568
|
return !1;
|
|
2569
2569
|
}
|
|
2570
|
-
function
|
|
2571
|
-
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null :
|
|
2570
|
+
function Qs({ stores: n, attrsStore: e }, [t, r, s, i]) {
|
|
2571
|
+
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : Ua(n, e, t, r) ? { mode: "update" } : null;
|
|
2572
2572
|
}
|
|
2573
|
-
function
|
|
2573
|
+
function La(n, e) {
|
|
2574
2574
|
const { attrsStore: t } = n, [r, s, i, o] = e, a = tr(i), c = _e(t, r, s);
|
|
2575
2575
|
return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
|
|
2576
2576
|
const d = se(t, r, l);
|
|
2577
2577
|
return d["checked-data-type"] === "date" && n.useDateObjects && (f = Zt(f)), ["add-triple", c, d.id, f, { mode: "create" }];
|
|
2578
2578
|
});
|
|
2579
2579
|
}
|
|
2580
|
-
function
|
|
2581
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = tr(i), c = _e(t, r, s), u =
|
|
2580
|
+
function Fa(n, e) {
|
|
2581
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = tr(i), c = _e(t, r, s), u = Qs(n, [r, c, i, o]);
|
|
2582
2582
|
return [["id", c]].concat(Object.entries(a)).map(([f, d]) => {
|
|
2583
2583
|
const y = se(t, r, f);
|
|
2584
2584
|
return y["checked-data-type"] === "date" && n.useDateObjects && (d = Zt(d)), [
|
|
@@ -2590,11 +2590,11 @@ function La(n, e) {
|
|
|
2590
2590
|
];
|
|
2591
2591
|
});
|
|
2592
2592
|
}
|
|
2593
|
-
function
|
|
2593
|
+
function Na({ attrsStore: n }, [e, t]) {
|
|
2594
2594
|
return [["delete-entity", _e(n, e, t), e]];
|
|
2595
2595
|
}
|
|
2596
|
-
function
|
|
2597
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = tr(i), c = _e(t, r, s), u =
|
|
2596
|
+
function Ka(n, e) {
|
|
2597
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = tr(i), c = _e(t, r, s), u = Qs(n, [r, c, i, o]), l = Object.entries(a).map(([d, y]) => {
|
|
2598
2598
|
const b = se(t, r, d);
|
|
2599
2599
|
return [
|
|
2600
2600
|
"deep-merge-triple",
|
|
@@ -2612,38 +2612,38 @@ function Na(n, e) {
|
|
|
2612
2612
|
...u ? [u] : []
|
|
2613
2613
|
]].concat(l);
|
|
2614
2614
|
}
|
|
2615
|
-
function
|
|
2615
|
+
function Wa({ attrsStore: n }, [e, t, r]) {
|
|
2616
2616
|
return [["rule-params", _e(n, e, t), e, r]];
|
|
2617
2617
|
}
|
|
2618
|
-
function
|
|
2618
|
+
function qa(n) {
|
|
2619
2619
|
const [e, t, r, s, i] = n;
|
|
2620
2620
|
if (!s)
|
|
2621
2621
|
return n;
|
|
2622
2622
|
const o = { ...s };
|
|
2623
2623
|
return delete o.id, [e, t, r, o, ...i ? [i] : []];
|
|
2624
2624
|
}
|
|
2625
|
-
function
|
|
2626
|
-
const [t, ...r] =
|
|
2625
|
+
function za(n, e) {
|
|
2626
|
+
const [t, ...r] = qa(e);
|
|
2627
2627
|
switch (t) {
|
|
2628
2628
|
case "merge":
|
|
2629
|
-
return
|
|
2629
|
+
return Ka(n, r);
|
|
2630
2630
|
case "create":
|
|
2631
|
-
return Ua(n, r);
|
|
2632
|
-
case "update":
|
|
2633
2631
|
return La(n, r);
|
|
2632
|
+
case "update":
|
|
2633
|
+
return Fa(n, r);
|
|
2634
2634
|
case "link":
|
|
2635
|
-
return xa(n, r);
|
|
2636
|
-
case "unlink":
|
|
2637
2635
|
return $a(n, r);
|
|
2636
|
+
case "unlink":
|
|
2637
|
+
return Da(n, r);
|
|
2638
2638
|
case "delete":
|
|
2639
|
-
return
|
|
2639
|
+
return Na(n, r);
|
|
2640
2640
|
case "ruleParams":
|
|
2641
|
-
return
|
|
2641
|
+
return Wa(n, r);
|
|
2642
2642
|
default:
|
|
2643
2643
|
throw new Error(`unsupported action ${t}`);
|
|
2644
2644
|
}
|
|
2645
2645
|
}
|
|
2646
|
-
function
|
|
2646
|
+
function Va(n) {
|
|
2647
2647
|
switch (n) {
|
|
2648
2648
|
case "string":
|
|
2649
2649
|
case "date":
|
|
@@ -2654,14 +2654,14 @@ function za(n) {
|
|
|
2654
2654
|
return;
|
|
2655
2655
|
}
|
|
2656
2656
|
}
|
|
2657
|
-
function
|
|
2657
|
+
function Qa(n, e, t) {
|
|
2658
2658
|
var a, c;
|
|
2659
2659
|
const r = (c = (a = n.entities[e]) == null ? void 0 : a.attrs) == null ? void 0 : c[t];
|
|
2660
2660
|
if (t === "id")
|
|
2661
2661
|
return null;
|
|
2662
2662
|
if (!r)
|
|
2663
2663
|
throw new Error(`${e}.${t} does not exist in your schema`);
|
|
2664
|
-
const { unique: s, indexed: i } = r == null ? void 0 : r.config, o =
|
|
2664
|
+
const { unique: s, indexed: i } = r == null ? void 0 : r.config, o = Va(r == null ? void 0 : r.valueType);
|
|
2665
2665
|
return {
|
|
2666
2666
|
"index?": i,
|
|
2667
2667
|
"unique?": s,
|
|
@@ -2669,7 +2669,7 @@ function Va(n, e, t) {
|
|
|
2669
2669
|
};
|
|
2670
2670
|
}
|
|
2671
2671
|
function Rt(n, e, t, r) {
|
|
2672
|
-
const s = n ?
|
|
2672
|
+
const s = n ? Qa(n, e, t) : null, i = Z(), a = [Z(), e, t];
|
|
2673
2673
|
return {
|
|
2674
2674
|
id: i,
|
|
2675
2675
|
"forward-identity": a,
|
|
@@ -2682,11 +2682,11 @@ function Rt(n, e, t, r) {
|
|
|
2682
2682
|
...r || {}
|
|
2683
2683
|
};
|
|
2684
2684
|
}
|
|
2685
|
-
function
|
|
2685
|
+
function Ba(n, e, t) {
|
|
2686
2686
|
return Object.values(n.links).find((i) => i.forward.on === e && i.forward.label === t || i.reverse.on === e && i.reverse.label === t);
|
|
2687
2687
|
}
|
|
2688
|
-
function
|
|
2689
|
-
const r =
|
|
2688
|
+
function Ga(n, e, t) {
|
|
2689
|
+
const r = Ba(n, e, t);
|
|
2690
2690
|
if (!r)
|
|
2691
2691
|
throw new Error(`Couldn't find the link ${e}.${t} in your schema`);
|
|
2692
2692
|
const { forward: s, reverse: i } = r;
|
|
@@ -2700,7 +2700,7 @@ function Ba(n, e, t) {
|
|
|
2700
2700
|
};
|
|
2701
2701
|
}
|
|
2702
2702
|
function Lr(n, e, t, r) {
|
|
2703
|
-
const s = n ?
|
|
2703
|
+
const s = n ? Ga(n, e, t) : null, i = Z(), o = [Z(), e, t], a = [Z(), t, e];
|
|
2704
2704
|
return {
|
|
2705
2705
|
id: i,
|
|
2706
2706
|
// @ts-ignore: ts thinks it's any[]
|
|
@@ -2717,7 +2717,7 @@ function Lr(n, e, t, r) {
|
|
|
2717
2717
|
...r || {}
|
|
2718
2718
|
};
|
|
2719
2719
|
}
|
|
2720
|
-
const
|
|
2720
|
+
const Ha = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Ja = /* @__PURE__ */ new Set(["link", "unlink"]), Ya = /* @__PURE__ */ new Set(["create", "update", "merge"]), Za = /* @__PURE__ */ new Set([
|
|
2721
2721
|
"link",
|
|
2722
2722
|
"unlink",
|
|
2723
2723
|
"create",
|
|
@@ -2725,13 +2725,13 @@ const Ga = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
2725
2725
|
"merge",
|
|
2726
2726
|
"delete",
|
|
2727
2727
|
"ruleParams"
|
|
2728
|
-
]), $n = { "unique?": !0, "index?": !0 },
|
|
2728
|
+
]), $n = { "unique?": !0, "index?": !0 }, Xa = {
|
|
2729
2729
|
...$n,
|
|
2730
2730
|
cardinality: "one"
|
|
2731
2731
|
};
|
|
2732
|
-
function
|
|
2732
|
+
function ec(n) {
|
|
2733
2733
|
const e = [], [t, r, s, i] = n;
|
|
2734
|
-
if (!
|
|
2734
|
+
if (!Za.has(t))
|
|
2735
2735
|
return e;
|
|
2736
2736
|
const o = xn(s);
|
|
2737
2737
|
if (o && e.push({ etype: r, lookupPair: o }), t === "link")
|
|
@@ -2748,7 +2748,7 @@ function Xa(n) {
|
|
|
2748
2748
|
}
|
|
2749
2749
|
return e;
|
|
2750
2750
|
}
|
|
2751
|
-
function
|
|
2751
|
+
function tc({ attrsStore: n, schema: e }, t) {
|
|
2752
2752
|
var d, y;
|
|
2753
2753
|
const r = /* @__PURE__ */ new Set(), s = [], i = [];
|
|
2754
2754
|
function o(b, g) {
|
|
@@ -2773,10 +2773,10 @@ function ec({ attrsStore: n, schema: e }, t) {
|
|
|
2773
2773
|
}
|
|
2774
2774
|
function f(b, g) {
|
|
2775
2775
|
const m = o(b, g), T = a(b, g);
|
|
2776
|
-
u(m), u(T), !m && !T && c(Lr(e, b, g,
|
|
2776
|
+
u(m), u(T), !m && !T && c(Lr(e, b, g, Xa));
|
|
2777
2777
|
}
|
|
2778
2778
|
for (const b of t)
|
|
2779
|
-
for (const { etype: g, lookupPair: m, linkLabel: T } of
|
|
2779
|
+
for (const { etype: g, lookupPair: m, linkLabel: T } of ec(b)) {
|
|
2780
2780
|
const _ = m[0];
|
|
2781
2781
|
if (T) {
|
|
2782
2782
|
f(g, T);
|
|
@@ -2798,12 +2798,12 @@ function ec({ attrsStore: n, schema: e }, t) {
|
|
|
2798
2798
|
}
|
|
2799
2799
|
for (const b of t) {
|
|
2800
2800
|
const [g, m, T, _] = b;
|
|
2801
|
-
if (
|
|
2801
|
+
if (Ha.has(g)) {
|
|
2802
2802
|
const w = o(m, "id");
|
|
2803
2803
|
u(w), w || c(Rt(e, m, "id", { "unique?": !0 }));
|
|
2804
2804
|
for (const C of Object.keys(_)) {
|
|
2805
2805
|
const v = o(m, C);
|
|
2806
|
-
if (u(v),
|
|
2806
|
+
if (u(v), Ya.has(g) && (v || c(Rt(e, m, C, C === "id" ? { "unique?": !0 } : null))), Ja.has(g)) {
|
|
2807
2807
|
const U = a(m, C);
|
|
2808
2808
|
!v && !U && c(Lr(e, m, C)), u(U);
|
|
2809
2809
|
}
|
|
@@ -2818,15 +2818,15 @@ function ec({ attrsStore: n, schema: e }, t) {
|
|
|
2818
2818
|
}
|
|
2819
2819
|
return [n, i];
|
|
2820
2820
|
}
|
|
2821
|
-
function
|
|
2822
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((c) =>
|
|
2821
|
+
function nc(n, e) {
|
|
2822
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((c) => Pa(c)), [s, i] = tc(n, r), o = { ...n, attrsStore: s }, a = r.flatMap((c) => za(o, c));
|
|
2823
2823
|
return [...i, ...a];
|
|
2824
2824
|
}
|
|
2825
2825
|
function Fr(n, e) {
|
|
2826
2826
|
typeof requestIdleCallback > "u" ? n() : requestIdleCallback(n, { timeout: e });
|
|
2827
2827
|
}
|
|
2828
2828
|
const tt = "__meta";
|
|
2829
|
-
class
|
|
2829
|
+
class rc {
|
|
2830
2830
|
constructor(e, t) {
|
|
2831
2831
|
}
|
|
2832
2832
|
}
|
|
@@ -3078,13 +3078,13 @@ class Dn {
|
|
|
3078
3078
|
e && await this._enqueuePersist();
|
|
3079
3079
|
}
|
|
3080
3080
|
}
|
|
3081
|
-
const
|
|
3082
|
-
function
|
|
3081
|
+
const sc = 6, ic = ["kv", "querySubs", "syncSubs"];
|
|
3082
|
+
function oc(n) {
|
|
3083
3083
|
return function(t) {
|
|
3084
3084
|
console.error("Error in IndexedDB event", { source: n, event: t });
|
|
3085
3085
|
};
|
|
3086
3086
|
}
|
|
3087
|
-
async function
|
|
3087
|
+
async function ac(n) {
|
|
3088
3088
|
return new Promise((e) => {
|
|
3089
3089
|
const t = indexedDB.open(n);
|
|
3090
3090
|
t.onerror = (r) => {
|
|
@@ -3098,7 +3098,7 @@ async function oc(n) {
|
|
|
3098
3098
|
};
|
|
3099
3099
|
});
|
|
3100
3100
|
}
|
|
3101
|
-
async function
|
|
3101
|
+
async function cc(n, e, t) {
|
|
3102
3102
|
const r = (
|
|
3103
3103
|
// Backwards compatibility for older versions where we JSON.stringified before storing
|
|
3104
3104
|
typeof e == "string" ? JSON.parse(e) : e
|
|
@@ -3138,8 +3138,8 @@ async function Nr(n, e, t) {
|
|
|
3138
3138
|
r.onsuccess = () => s(), r.onerror = (o) => i(o);
|
|
3139
3139
|
});
|
|
3140
3140
|
}
|
|
3141
|
-
async function
|
|
3142
|
-
const t = await
|
|
3141
|
+
async function uc(n, e) {
|
|
3142
|
+
const t = await ac(`instant_${n}_5`);
|
|
3143
3143
|
if (!t)
|
|
3144
3144
|
return;
|
|
3145
3145
|
const r = await new Promise((l, f) => {
|
|
@@ -3162,7 +3162,7 @@ async function cc(n, e) {
|
|
|
3162
3162
|
for (const [l, f] of r)
|
|
3163
3163
|
switch (l) {
|
|
3164
3164
|
case "querySubs": {
|
|
3165
|
-
const d =
|
|
3165
|
+
const d = cc(l, f, o);
|
|
3166
3166
|
a.push(d);
|
|
3167
3167
|
break;
|
|
3168
3168
|
}
|
|
@@ -3184,7 +3184,7 @@ async function cc(n, e) {
|
|
|
3184
3184
|
});
|
|
3185
3185
|
}
|
|
3186
3186
|
const Kr = /* @__PURE__ */ new Map();
|
|
3187
|
-
class
|
|
3187
|
+
class Bs extends rc {
|
|
3188
3188
|
constructor(t, r) {
|
|
3189
3189
|
super(t, r);
|
|
3190
3190
|
p(this, "dbName");
|
|
@@ -3192,7 +3192,7 @@ class Qs extends nc {
|
|
|
3192
3192
|
p(this, "_appId");
|
|
3193
3193
|
p(this, "_prefix");
|
|
3194
3194
|
p(this, "_dbPromise");
|
|
3195
|
-
this.dbName = `instant_${t}_${
|
|
3195
|
+
this.dbName = `instant_${t}_${sc}`, this._storeName = r, this._appId = t, this._dbPromise = this._init();
|
|
3196
3196
|
}
|
|
3197
3197
|
_init() {
|
|
3198
3198
|
return new Promise((t, r) => {
|
|
@@ -3207,8 +3207,8 @@ class Qs extends nc {
|
|
|
3207
3207
|
}, c.onversionchange = () => {
|
|
3208
3208
|
c.close();
|
|
3209
3209
|
}, s) {
|
|
3210
|
-
const u =
|
|
3211
|
-
|
|
3210
|
+
const u = uc(this._appId, c).catch((l) => {
|
|
3211
|
+
oc("Error upgrading store from version 5 to 6.")(l);
|
|
3212
3212
|
});
|
|
3213
3213
|
Kr.set(this.dbName, u), u.then(() => t(c)).catch(() => t(c));
|
|
3214
3214
|
} else {
|
|
@@ -3222,7 +3222,7 @@ class Qs extends nc {
|
|
|
3222
3222
|
}
|
|
3223
3223
|
_upgradeStore(t) {
|
|
3224
3224
|
const s = t.target.result;
|
|
3225
|
-
for (const i of
|
|
3225
|
+
for (const i of ic)
|
|
3226
3226
|
s.objectStoreNames.contains(i) || s.createObjectStore(i);
|
|
3227
3227
|
}
|
|
3228
3228
|
// Browsers can close IndexedDB connections unexpectedly (backgrounded tabs,
|
|
@@ -3283,7 +3283,7 @@ class Qs extends nc {
|
|
|
3283
3283
|
}));
|
|
3284
3284
|
}
|
|
3285
3285
|
}
|
|
3286
|
-
class
|
|
3286
|
+
class Gs {
|
|
3287
3287
|
static async getIsOnline() {
|
|
3288
3288
|
return navigator.onLine;
|
|
3289
3289
|
}
|
|
@@ -3329,14 +3329,14 @@ async function Ae(n, e) {
|
|
|
3329
3329
|
const t = await fetch(n, e), r = await t.json();
|
|
3330
3330
|
return t.status === 200 ? Promise.resolve(r) : Promise.reject(new en({ status: t.status, body: r }));
|
|
3331
3331
|
}
|
|
3332
|
-
function
|
|
3332
|
+
function lc({ apiURI: n, appId: e, email: t }) {
|
|
3333
3333
|
return Ae(`${n}/runtime/auth/send_magic_code`, {
|
|
3334
3334
|
method: "POST",
|
|
3335
3335
|
headers: { "content-type": "application/json" },
|
|
3336
3336
|
body: JSON.stringify({ "app-id": e, email: t })
|
|
3337
3337
|
});
|
|
3338
3338
|
}
|
|
3339
|
-
async function
|
|
3339
|
+
async function fc({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, extraFields: i }) {
|
|
3340
3340
|
return await Ae(`${n}/runtime/auth/verify_magic_code`, {
|
|
3341
3341
|
method: "POST",
|
|
3342
3342
|
headers: { "content-type": "application/json" },
|
|
@@ -3349,7 +3349,7 @@ async function lc({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, ext
|
|
|
3349
3349
|
})
|
|
3350
3350
|
});
|
|
3351
3351
|
}
|
|
3352
|
-
async function
|
|
3352
|
+
async function dc({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3353
3353
|
return await Ae(`${n}/runtime/auth/verify_refresh_token`, {
|
|
3354
3354
|
method: "POST",
|
|
3355
3355
|
headers: { "content-type": "application/json" },
|
|
@@ -3359,7 +3359,7 @@ async function fc({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
3359
3359
|
})
|
|
3360
3360
|
});
|
|
3361
3361
|
}
|
|
3362
|
-
async function
|
|
3362
|
+
async function hc({ apiURI: n, appId: e }) {
|
|
3363
3363
|
return await Ae(`${n}/runtime/auth/sign_in_guest`, {
|
|
3364
3364
|
method: "POST",
|
|
3365
3365
|
headers: { "content-type": "application/json" },
|
|
@@ -3381,7 +3381,7 @@ async function Wr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken:
|
|
|
3381
3381
|
})
|
|
3382
3382
|
});
|
|
3383
3383
|
}
|
|
3384
|
-
async function
|
|
3384
|
+
async function pc({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i, extraFields: o }) {
|
|
3385
3385
|
return await Ae(`${n}/runtime/oauth/id_token`, {
|
|
3386
3386
|
method: "POST",
|
|
3387
3387
|
headers: { "content-type": "application/json" },
|
|
@@ -3395,7 +3395,7 @@ async function hc({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
|
|
|
3395
3395
|
})
|
|
3396
3396
|
});
|
|
3397
3397
|
}
|
|
3398
|
-
async function
|
|
3398
|
+
async function yc({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3399
3399
|
return await Ae(`${n}/runtime/signout`, {
|
|
3400
3400
|
method: "POST",
|
|
3401
3401
|
headers: {
|
|
@@ -3407,7 +3407,7 @@ async function pc({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
3407
3407
|
})
|
|
3408
3408
|
});
|
|
3409
3409
|
}
|
|
3410
|
-
async function
|
|
3410
|
+
async function bc({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
|
|
3411
3411
|
const a = {
|
|
3412
3412
|
app_id: e,
|
|
3413
3413
|
path: t,
|
|
@@ -3420,7 +3420,7 @@ async function yc({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
|
|
|
3420
3420
|
body: r
|
|
3421
3421
|
});
|
|
3422
3422
|
}
|
|
3423
|
-
async function
|
|
3423
|
+
async function gc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
3424
3424
|
const { data: s } = await Ae(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
3425
3425
|
method: "DELETE",
|
|
3426
3426
|
headers: {
|
|
@@ -3430,7 +3430,7 @@ async function bc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
|
3430
3430
|
});
|
|
3431
3431
|
return s;
|
|
3432
3432
|
}
|
|
3433
|
-
async function
|
|
3433
|
+
async function _c({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
|
|
3434
3434
|
const { data: i } = await Ae(`${n}/storage/signed-upload-url`, {
|
|
3435
3435
|
method: "POST",
|
|
3436
3436
|
headers: {
|
|
@@ -3444,7 +3444,7 @@ async function gc({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata:
|
|
|
3444
3444
|
});
|
|
3445
3445
|
return i;
|
|
3446
3446
|
}
|
|
3447
|
-
async function
|
|
3447
|
+
async function mc(n, e) {
|
|
3448
3448
|
return (await fetch(n, {
|
|
3449
3449
|
method: "PUT",
|
|
3450
3450
|
body: e,
|
|
@@ -3453,7 +3453,7 @@ async function _c(n, e) {
|
|
|
3453
3453
|
}
|
|
3454
3454
|
})).ok;
|
|
3455
3455
|
}
|
|
3456
|
-
async function
|
|
3456
|
+
async function wc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
3457
3457
|
const { data: s } = await Ae(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
3458
3458
|
method: "GET",
|
|
3459
3459
|
headers: {
|
|
@@ -3463,8 +3463,8 @@ async function mc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
|
3463
3463
|
});
|
|
3464
3464
|
return s;
|
|
3465
3465
|
}
|
|
3466
|
-
let or = !1,
|
|
3467
|
-
typeof window < "u" && typeof window.localStorage < "u" && (or = !!window.localStorage.getItem("devBackend"),
|
|
3466
|
+
let or = !1, Hs = !1, Js = !1;
|
|
3467
|
+
typeof window < "u" && typeof window.localStorage < "u" && (or = !!window.localStorage.getItem("devBackend"), Hs = !!window.localStorage.getItem("__instantLogging"), Js = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
3468
3468
|
function qr(n, e) {
|
|
3469
3469
|
if (!e)
|
|
3470
3470
|
return n;
|
|
@@ -3473,7 +3473,7 @@ function qr(n, e) {
|
|
|
3473
3473
|
t[r] = n[r];
|
|
3474
3474
|
}), t;
|
|
3475
3475
|
}
|
|
3476
|
-
function
|
|
3476
|
+
function Sc(n, e, t) {
|
|
3477
3477
|
const r = {
|
|
3478
3478
|
peers: {}
|
|
3479
3479
|
};
|
|
@@ -3490,8 +3490,8 @@ function wc(n, e, t) {
|
|
|
3490
3490
|
}
|
|
3491
3491
|
return r;
|
|
3492
3492
|
}
|
|
3493
|
-
function
|
|
3494
|
-
if (n.isLoading !== e.isLoading || n.error !== e.error || (n.user || e.user) && (!n.user || !e.user || !Cr(n.user, e.user)) || !
|
|
3493
|
+
function Tc(n, e) {
|
|
3494
|
+
if (n.isLoading !== e.isLoading || n.error !== e.error || (n.user || e.user) && (!n.user || !e.user || !Cr(n.user, e.user)) || !Es(n.peers, e.peers))
|
|
3495
3495
|
return !0;
|
|
3496
3496
|
for (const r of Object.keys(n.peers))
|
|
3497
3497
|
if (!Cr(n.peers[r], e.peers[r]))
|
|
@@ -3514,18 +3514,18 @@ class zr {
|
|
|
3514
3514
|
this._reject(e);
|
|
3515
3515
|
}
|
|
3516
3516
|
}
|
|
3517
|
-
function
|
|
3517
|
+
function Ys(n, e = []) {
|
|
3518
3518
|
n.forEach((t) => {
|
|
3519
3519
|
const { data: r } = t, { "datalog-result": s } = r, { "join-rows": i } = s;
|
|
3520
3520
|
for (const o of i)
|
|
3521
3521
|
for (const a of o)
|
|
3522
3522
|
e.push(a);
|
|
3523
|
-
|
|
3523
|
+
Ys(t["child-nodes"], e);
|
|
3524
3524
|
});
|
|
3525
3525
|
}
|
|
3526
3526
|
function Vr(n) {
|
|
3527
3527
|
const e = [];
|
|
3528
|
-
return
|
|
3528
|
+
return Ys(n, e), e;
|
|
3529
3529
|
}
|
|
3530
3530
|
function Qr(n) {
|
|
3531
3531
|
return Object.values(n.links).reduce((e, t) => {
|
|
@@ -3541,8 +3541,8 @@ function Qr(n) {
|
|
|
3541
3541
|
}, e;
|
|
3542
3542
|
}, {});
|
|
3543
3543
|
}
|
|
3544
|
-
const ar = "v1.0.
|
|
3545
|
-
function
|
|
3544
|
+
const ar = "v1.0.43-branch-drewh-cli-email.26904178974.1";
|
|
3545
|
+
function vc(n, e) {
|
|
3546
3546
|
return {
|
|
3547
3547
|
info: n ? (...t) => console.info(...t, e()) : () => {
|
|
3548
3548
|
},
|
|
@@ -3644,7 +3644,7 @@ const Br = [
|
|
|
3644
3644
|
"beforeInclusive",
|
|
3645
3645
|
"fields",
|
|
3646
3646
|
"aggregate"
|
|
3647
|
-
],
|
|
3647
|
+
], Ec = (n) => n.valueType || "unknown", Zs = (n, e, t = !1) => {
|
|
3648
3648
|
if (t || n == null)
|
|
3649
3649
|
return !0;
|
|
3650
3650
|
switch (e) {
|
|
@@ -3659,9 +3659,9 @@ const Br = [
|
|
|
3659
3659
|
default:
|
|
3660
3660
|
return !0;
|
|
3661
3661
|
}
|
|
3662
|
-
},
|
|
3662
|
+
}, Oc = (n, e, t, r, s, i, o) => {
|
|
3663
3663
|
const a = i.valueType === "json", c = (u, l, f) => {
|
|
3664
|
-
if (!
|
|
3664
|
+
if (!Zs(f, l, a))
|
|
3665
3665
|
throw new B(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
|
|
3666
3666
|
};
|
|
3667
3667
|
switch (n) {
|
|
@@ -3692,16 +3692,16 @@ const Br = [
|
|
|
3692
3692
|
throw new B(`Unknown operator '${n}' for attribute '${r}' in entity '${s}'`, o);
|
|
3693
3693
|
}
|
|
3694
3694
|
}, rt = (n, e, t, r, s) => {
|
|
3695
|
-
const i =
|
|
3695
|
+
const i = Ec(t), o = t.valueType === "json";
|
|
3696
3696
|
if (typeof n == "object" && n !== null && !Array.isArray(n)) {
|
|
3697
3697
|
if (o)
|
|
3698
3698
|
return;
|
|
3699
3699
|
const c = n;
|
|
3700
3700
|
for (const [u, l] of Object.entries(c))
|
|
3701
|
-
|
|
3702
|
-
} else if (!
|
|
3701
|
+
Oc(u, l, i, e, r, t, `${s}.${u}`);
|
|
3702
|
+
} else if (!Zs(n, i, o))
|
|
3703
3703
|
throw new B(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof n}`, s);
|
|
3704
|
-
},
|
|
3704
|
+
}, kc = (n, e, t, r, s) => {
|
|
3705
3705
|
const i = n.split(".");
|
|
3706
3706
|
if (i.length < 2)
|
|
3707
3707
|
throw new B(`Invalid dot notation path '${n}'. Must contain at least one dot.`, s);
|
|
@@ -3738,12 +3738,12 @@ const Br = [
|
|
|
3738
3738
|
throw new B(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${n}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
|
|
3739
3739
|
}
|
|
3740
3740
|
rt(e, n, u, t, s);
|
|
3741
|
-
},
|
|
3741
|
+
}, Xs = (n, e, t, r) => {
|
|
3742
3742
|
for (const [s, i] of Object.entries(n)) {
|
|
3743
3743
|
if (s === "or" || s === "and") {
|
|
3744
3744
|
if (Array.isArray(i))
|
|
3745
3745
|
for (const u of i)
|
|
3746
|
-
typeof u == "object" && u !== null &&
|
|
3746
|
+
typeof u == "object" && u !== null && Xs(u, e, t, `${r}.${s}[${u}]`);
|
|
3747
3747
|
continue;
|
|
3748
3748
|
}
|
|
3749
3749
|
if (s === "id") {
|
|
@@ -3751,7 +3751,7 @@ const Br = [
|
|
|
3751
3751
|
continue;
|
|
3752
3752
|
}
|
|
3753
3753
|
if (s.includes(".")) {
|
|
3754
|
-
|
|
3754
|
+
kc(s, i, e, t, `${r}.${s}`);
|
|
3755
3755
|
continue;
|
|
3756
3756
|
}
|
|
3757
3757
|
const o = t.entities[e];
|
|
@@ -3771,7 +3771,7 @@ const Br = [
|
|
|
3771
3771
|
rt(i, s, u, e, `${r}.${s}`);
|
|
3772
3772
|
}
|
|
3773
3773
|
}
|
|
3774
|
-
},
|
|
3774
|
+
}, Ac = (n, e, t, r, s = 0) => {
|
|
3775
3775
|
for (const o of Object.keys(n))
|
|
3776
3776
|
if (!Br.includes(o))
|
|
3777
3777
|
throw new B(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Br.join(", ")}. Found: ${o}`, r);
|
|
@@ -3791,9 +3791,9 @@ const Br = [
|
|
|
3791
3791
|
if (n.where && t) {
|
|
3792
3792
|
if (typeof n.where != "object" || n.where === null)
|
|
3793
3793
|
throw new B(`'where' clause must be an object in entity '${e}', but received: ${typeof n.where}`, r ? `${r}.where` : void 0);
|
|
3794
|
-
|
|
3794
|
+
Xs(n.where, e, t, r ? `${r}.where` : "where");
|
|
3795
3795
|
}
|
|
3796
|
-
},
|
|
3796
|
+
}, ei = (n, e, t, r, s = 0) => {
|
|
3797
3797
|
var i;
|
|
3798
3798
|
if (!n || typeof n != "object")
|
|
3799
3799
|
throw new B(`Query part for entity '${e}' must be an object, but received: ${typeof n}`, r);
|
|
@@ -3806,13 +3806,13 @@ const Br = [
|
|
|
3806
3806
|
const a = n[o];
|
|
3807
3807
|
if (typeof a == "object" && a !== null) {
|
|
3808
3808
|
const c = (i = t == null ? void 0 : t.entities[e].links[o]) == null ? void 0 : i.entityName;
|
|
3809
|
-
c &&
|
|
3809
|
+
c && ei(a, c, t, `${r}.${o}`, s + 1);
|
|
3810
3810
|
}
|
|
3811
3811
|
} else {
|
|
3812
3812
|
const a = n[o];
|
|
3813
3813
|
if (typeof a != "object" || a === null)
|
|
3814
3814
|
throw new B(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
3815
|
-
|
|
3815
|
+
Ac(a, e, t, `${r}.$`, s);
|
|
3816
3816
|
}
|
|
3817
3817
|
}, Gr = (n, e) => {
|
|
3818
3818
|
if (typeof n != "object" || n === null)
|
|
@@ -3830,7 +3830,7 @@ const Br = [
|
|
|
3830
3830
|
const s = Object.keys(e.entities);
|
|
3831
3831
|
throw new B(`Entity '${r}' does not exist in schema. Available entities: ${s.length > 0 ? s.join(", ") : "none"}`, r);
|
|
3832
3832
|
}
|
|
3833
|
-
|
|
3833
|
+
ei(t[r], r, e, r, 0);
|
|
3834
3834
|
}
|
|
3835
3835
|
}
|
|
3836
3836
|
}, Hr = (n) => typeof n != "string" ? !1 : Jt(n) ? !0 : it(n);
|
|
@@ -3839,39 +3839,39 @@ class Te extends Error {
|
|
|
3839
3839
|
super(e), this.name = "TransactionValidationError";
|
|
3840
3840
|
}
|
|
3841
3841
|
}
|
|
3842
|
-
const
|
|
3842
|
+
const ti = (n) => n.length > 0 ? n.join(", ") : "none", Cc = (n, e) => new Te(`Entity '${n}' does not exist in schema. Available entities: ${ti(e)}`), hn = {
|
|
3843
3843
|
string: (n) => typeof n == "string",
|
|
3844
3844
|
number: (n) => typeof n == "number" && !isNaN(n),
|
|
3845
3845
|
boolean: (n) => typeof n == "boolean",
|
|
3846
3846
|
date: (n) => n instanceof Date || typeof n == "string" || typeof n == "number",
|
|
3847
3847
|
json: () => !0
|
|
3848
|
-
},
|
|
3848
|
+
}, Ic = (n, e) => {
|
|
3849
3849
|
var t;
|
|
3850
3850
|
return n == null ? !0 : ((t = hn[e.valueType]) == null ? void 0 : t.call(hn, n)) ?? !1;
|
|
3851
|
-
},
|
|
3851
|
+
}, ni = (n, e) => {
|
|
3852
3852
|
const t = e.entities[n];
|
|
3853
3853
|
if (!t)
|
|
3854
|
-
throw
|
|
3854
|
+
throw Cc(n, Object.keys(e.entities));
|
|
3855
3855
|
return t;
|
|
3856
3856
|
}, pn = (n, e, t) => {
|
|
3857
|
-
const r =
|
|
3857
|
+
const r = ni(n, t);
|
|
3858
3858
|
if (typeof e != "object" || e === null)
|
|
3859
3859
|
throw new Te(`Arguments for data operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
3860
3860
|
for (const [s, i] of Object.entries(e)) {
|
|
3861
3861
|
if (s === "id")
|
|
3862
3862
|
continue;
|
|
3863
3863
|
const o = r.attrs[s];
|
|
3864
|
-
if (o && !
|
|
3864
|
+
if (o && !Ic(i, o))
|
|
3865
3865
|
throw new Te(`Invalid value for attribute '${s}' in entity '${n}'. Expected ${o.valueType}, but received: ${typeof i}`);
|
|
3866
3866
|
}
|
|
3867
3867
|
}, Jr = (n, e, t) => {
|
|
3868
|
-
const r =
|
|
3868
|
+
const r = ni(n, t);
|
|
3869
3869
|
if (typeof e != "object" || e === null)
|
|
3870
3870
|
throw new Te(`Arguments for link operation on entity '${n}' must be an object, but received: ${typeof e}`);
|
|
3871
3871
|
for (const [s, i] of Object.entries(e)) {
|
|
3872
3872
|
if (!r.links[s]) {
|
|
3873
3873
|
const a = Object.keys(r.links);
|
|
3874
|
-
throw new Te(`Link '${s}' does not exist on entity '${n}'. Available links: ${
|
|
3874
|
+
throw new Te(`Link '${s}' does not exist on entity '${n}'. Available links: ${ti(a)}`);
|
|
3875
3875
|
}
|
|
3876
3876
|
if (i != null) {
|
|
3877
3877
|
if (Array.isArray(i)) {
|
|
@@ -3882,7 +3882,7 @@ const ei = (n) => n.length > 0 ? n.join(", ") : "none", Ac = (n, e) => new Te(`E
|
|
|
3882
3882
|
throw new Te(`Invalid UUID in link '${s}' for entity '${n}'. Expected a UUID, but received: ${i}`);
|
|
3883
3883
|
}
|
|
3884
3884
|
}
|
|
3885
|
-
},
|
|
3885
|
+
}, Pc = {
|
|
3886
3886
|
create: pn,
|
|
3887
3887
|
update: pn,
|
|
3888
3888
|
merge: pn,
|
|
@@ -3890,7 +3890,7 @@ const ei = (n) => n.length > 0 ? n.join(", ") : "none", Ac = (n, e) => new Te(`E
|
|
|
3890
3890
|
unlink: Jr,
|
|
3891
3891
|
delete: () => {
|
|
3892
3892
|
}
|
|
3893
|
-
},
|
|
3893
|
+
}, Mc = (n, e) => {
|
|
3894
3894
|
if (!e)
|
|
3895
3895
|
return;
|
|
3896
3896
|
const [t, r, s, i] = n;
|
|
@@ -3898,9 +3898,9 @@ const ei = (n) => n.length > 0 ? n.join(", ") : "none", Ac = (n, e) => new Te(`E
|
|
|
3898
3898
|
throw new Te(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
|
|
3899
3899
|
if (typeof r != "string")
|
|
3900
3900
|
throw new Te(`Entity name must be a string, but received: ${typeof r}`);
|
|
3901
|
-
const o =
|
|
3901
|
+
const o = Pc[t];
|
|
3902
3902
|
o && i !== void 0 && o(r, i, e);
|
|
3903
|
-
},
|
|
3903
|
+
}, Rc = (n, e) => {
|
|
3904
3904
|
const t = Array.isArray(n) ? n : [n];
|
|
3905
3905
|
for (const r of t) {
|
|
3906
3906
|
if (!r || typeof r != "object")
|
|
@@ -3910,11 +3910,11 @@ const ei = (n) => n.length > 0 ? n.join(", ") : "none", Ac = (n, e) => new Te(`E
|
|
|
3910
3910
|
for (const s of r.__ops) {
|
|
3911
3911
|
if (!Array.isArray(s))
|
|
3912
3912
|
throw new Te(`Transaction operation must be an array, but received: ${typeof s}`);
|
|
3913
|
-
|
|
3913
|
+
Mc(s, e);
|
|
3914
3914
|
}
|
|
3915
3915
|
}
|
|
3916
3916
|
};
|
|
3917
|
-
let
|
|
3917
|
+
let ri = 0;
|
|
3918
3918
|
class Yr {
|
|
3919
3919
|
constructor(e) {
|
|
3920
3920
|
p(this, "type", "ws");
|
|
@@ -3924,7 +3924,7 @@ class Yr {
|
|
|
3924
3924
|
p(this, "onmessage");
|
|
3925
3925
|
p(this, "onclose");
|
|
3926
3926
|
p(this, "onerror");
|
|
3927
|
-
this.id = `${this.type}_${
|
|
3927
|
+
this.id = `${this.type}_${ri++}`, this.conn = new WebSocket(e), this.conn.onopen = (t) => {
|
|
3928
3928
|
this.onopen && this.onopen({ target: this });
|
|
3929
3929
|
}, this.conn.onmessage = (t) => {
|
|
3930
3930
|
this.onmessage && this.onmessage({
|
|
@@ -3950,7 +3950,7 @@ class Yr {
|
|
|
3950
3950
|
return this.conn.send(JSON.stringify(e));
|
|
3951
3951
|
}
|
|
3952
3952
|
}
|
|
3953
|
-
class
|
|
3953
|
+
class jc {
|
|
3954
3954
|
constructor(e, t, r) {
|
|
3955
3955
|
p(this, "type", "sse");
|
|
3956
3956
|
p(this, "initParams", null);
|
|
@@ -3967,7 +3967,7 @@ class Rc {
|
|
|
3967
3967
|
p(this, "onmessage");
|
|
3968
3968
|
p(this, "onclose");
|
|
3969
3969
|
p(this, "onerror");
|
|
3970
|
-
this.id = `${this.type}_${
|
|
3970
|
+
this.id = `${this.type}_${ri++}`, this.url = t, this.messageUrl = r || this.url, this.ES = e, this.conn = new e(t), this.sseInitTimeout = setTimeout(() => {
|
|
3971
3971
|
this.initParams || this.handleError();
|
|
3972
3972
|
}, 1e4), this.conn.onmessage = (s) => {
|
|
3973
3973
|
const i = JSON.parse(s.data);
|
|
@@ -4047,24 +4047,24 @@ class Rc {
|
|
|
4047
4047
|
this.handleClose();
|
|
4048
4048
|
}
|
|
4049
4049
|
}
|
|
4050
|
-
function
|
|
4050
|
+
function xc(n, e) {
|
|
4051
4051
|
const t = n.values;
|
|
4052
4052
|
if (t) {
|
|
4053
|
-
const r =
|
|
4053
|
+
const r = Ps(t.attrsStore, null);
|
|
4054
4054
|
if (r) {
|
|
4055
4055
|
for (const s of t.entities || [])
|
|
4056
|
-
s.store.useDateObjects = e, s.store =
|
|
4056
|
+
s.store.useDateObjects = e, s.store = Is(r, s.store);
|
|
4057
4057
|
t.attrsStore = r;
|
|
4058
4058
|
}
|
|
4059
4059
|
}
|
|
4060
4060
|
return n;
|
|
4061
4061
|
}
|
|
4062
|
-
function
|
|
4062
|
+
function $c(n, e) {
|
|
4063
4063
|
var t;
|
|
4064
4064
|
if (e.values) {
|
|
4065
4065
|
const r = [];
|
|
4066
4066
|
for (const s of (t = e.values) == null ? void 0 : t.entities) {
|
|
4067
|
-
const i =
|
|
4067
|
+
const i = Cs(s.store);
|
|
4068
4068
|
r.push({ ...s, store: i });
|
|
4069
4069
|
}
|
|
4070
4070
|
return {
|
|
@@ -4074,13 +4074,13 @@ function xc(n, e) {
|
|
|
4074
4074
|
} else
|
|
4075
4075
|
return e;
|
|
4076
4076
|
}
|
|
4077
|
-
function
|
|
4077
|
+
function Dc(n, e, t) {
|
|
4078
4078
|
var i, o;
|
|
4079
4079
|
const r = (i = e == null ? void 0 : e.state) == null ? void 0 : i.txId, s = (o = t == null ? void 0 : t.state) == null ? void 0 : o.txId;
|
|
4080
4080
|
return r && (!s || r > s) ? e : s && (!r || s > r) ? t : e || t;
|
|
4081
4081
|
}
|
|
4082
4082
|
function yn(n, e, t) {
|
|
4083
|
-
return
|
|
4083
|
+
return zs({ store: e, attrsStore: t, pageInfo: null, aggregate: null }, n.query).data[n.table][0];
|
|
4084
4084
|
}
|
|
4085
4085
|
function Zr(n, e, t, r) {
|
|
4086
4086
|
var o;
|
|
@@ -4094,14 +4094,14 @@ function Xr(n, e, t) {
|
|
|
4094
4094
|
for (const { action: r, triple: s } of t)
|
|
4095
4095
|
switch (r) {
|
|
4096
4096
|
case "added":
|
|
4097
|
-
|
|
4097
|
+
js(n, e, s);
|
|
4098
4098
|
break;
|
|
4099
4099
|
case "removed":
|
|
4100
|
-
|
|
4100
|
+
Ms(n, e, s);
|
|
4101
4101
|
break;
|
|
4102
4102
|
}
|
|
4103
4103
|
}
|
|
4104
|
-
function
|
|
4104
|
+
function Uc(n, e, t) {
|
|
4105
4105
|
var s, i;
|
|
4106
4106
|
const r = {};
|
|
4107
4107
|
for (const { action: o, triple: a } of t) {
|
|
@@ -4129,14 +4129,14 @@ function Dc(n, e, t) {
|
|
|
4129
4129
|
function jt(n, e) {
|
|
4130
4130
|
return { [n.table]: e.map((t) => t.entity) };
|
|
4131
4131
|
}
|
|
4132
|
-
function
|
|
4132
|
+
function Lc(n, e) {
|
|
4133
4133
|
var r;
|
|
4134
4134
|
if (n.orderFieldType)
|
|
4135
4135
|
return n.orderFieldType;
|
|
4136
4136
|
const t = n.orderField === "serverCreatedAt" ? "number" : (r = se(e(), n.table, n.orderField)) == null ? void 0 : r["checked-data-type"];
|
|
4137
4137
|
return n.orderFieldType = t, t;
|
|
4138
4138
|
}
|
|
4139
|
-
function
|
|
4139
|
+
function Fc(n, e, t) {
|
|
4140
4140
|
const r = e;
|
|
4141
4141
|
if (n.orderField === "serverCreatedAt") {
|
|
4142
4142
|
t.sort(n.orderDirection === "asc" ? function(o, a) {
|
|
@@ -4157,7 +4157,7 @@ var Ue;
|
|
|
4157
4157
|
(function(n) {
|
|
4158
4158
|
n.InitialSyncBatch = "InitialSyncBatch", n.InitialSyncComplete = "InitialSyncComplete", n.LoadFromStorage = "LoadFromStorage", n.SyncTransaction = "SyncTransaction", n.Error = "Error";
|
|
4159
4159
|
})(Ue || (Ue = {}));
|
|
4160
|
-
class
|
|
4160
|
+
class Nc {
|
|
4161
4161
|
constructor(e, t, r, s, i, o) {
|
|
4162
4162
|
p(this, "trySend");
|
|
4163
4163
|
p(this, "subs");
|
|
@@ -4170,9 +4170,9 @@ class Fc {
|
|
|
4170
4170
|
p(this, "getAttrs");
|
|
4171
4171
|
this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new Dn({
|
|
4172
4172
|
persister: t,
|
|
4173
|
-
merge:
|
|
4174
|
-
serialize:
|
|
4175
|
-
parse: (a, c) =>
|
|
4173
|
+
merge: Dc,
|
|
4174
|
+
serialize: $c,
|
|
4175
|
+
parse: (a, c) => xc(c, this.config.useDateObjects),
|
|
4176
4176
|
objectSize: (a) => {
|
|
4177
4177
|
var c;
|
|
4178
4178
|
return ((c = a.values) == null ? void 0 : c.entities.length) || 0;
|
|
@@ -4367,9 +4367,9 @@ class Fc {
|
|
|
4367
4367
|
e: for (const [m, T] of Object.entries(u))
|
|
4368
4368
|
for (let _ = 0; _ < f.length; _++) {
|
|
4369
4369
|
const w = f[_];
|
|
4370
|
-
if (
|
|
4370
|
+
if (_o(w.store, m)) {
|
|
4371
4371
|
Xr(w.store, l.attrsStore, T);
|
|
4372
|
-
const C = yn(s, w.store, l.attrsStore), v =
|
|
4372
|
+
const C = yn(s, w.store, l.attrsStore), v = Uc(w.store, l.attrsStore, T)[m];
|
|
4373
4373
|
C ? (d.push({
|
|
4374
4374
|
oldEntity: w.entity,
|
|
4375
4375
|
newEntity: C,
|
|
@@ -4400,8 +4400,8 @@ class Fc {
|
|
|
4400
4400
|
const b = [];
|
|
4401
4401
|
for (const m of c.sort().reverse())
|
|
4402
4402
|
b.push(f[m].entity), f.splice(m, 1);
|
|
4403
|
-
const g =
|
|
4404
|
-
|
|
4403
|
+
const g = Lc(s, this.getAttrs);
|
|
4404
|
+
Fc(s, g, f), this.notifyCbs(r, {
|
|
4405
4405
|
type: Ue.SyncTransaction,
|
|
4406
4406
|
data: jt(s, (o = s.values) == null ? void 0 : o.entities),
|
|
4407
4407
|
added: y,
|
|
@@ -4442,7 +4442,7 @@ class Fc {
|
|
|
4442
4442
|
r && this.initSubscription(r.query, r.hash);
|
|
4443
4443
|
}
|
|
4444
4444
|
}
|
|
4445
|
-
function
|
|
4445
|
+
function Kc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStream: s }) {
|
|
4446
4446
|
const i = e.clientId;
|
|
4447
4447
|
let o = null, a = null, c = null;
|
|
4448
4448
|
const u = Z();
|
|
@@ -4641,7 +4641,7 @@ function Nc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
4641
4641
|
}
|
|
4642
4642
|
};
|
|
4643
4643
|
}
|
|
4644
|
-
class
|
|
4644
|
+
class Wc {
|
|
4645
4645
|
constructor() {
|
|
4646
4646
|
p(this, "items", []);
|
|
4647
4647
|
p(this, "resolvers", []);
|
|
@@ -4675,7 +4675,7 @@ class Kc {
|
|
|
4675
4675
|
}
|
|
4676
4676
|
}
|
|
4677
4677
|
}
|
|
4678
|
-
function
|
|
4678
|
+
function qc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
4679
4679
|
let s = e.byteOffset || 0, i = !1;
|
|
4680
4680
|
const o = new TextDecoder("utf-8"), a = new TextEncoder();
|
|
4681
4681
|
let c, u = !1;
|
|
@@ -4833,7 +4833,7 @@ function Wc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
4833
4833
|
}
|
|
4834
4834
|
};
|
|
4835
4835
|
}
|
|
4836
|
-
class
|
|
4836
|
+
class zc {
|
|
4837
4837
|
constructor({ WStream: e, RStream: t, trySend: r, log: s }) {
|
|
4838
4838
|
p(this, "trySend");
|
|
4839
4839
|
p(this, "WStream");
|
|
@@ -4846,7 +4846,7 @@ class qc {
|
|
|
4846
4846
|
this.WStream = e, this.RStream = t, this.trySend = r, this.log = s;
|
|
4847
4847
|
}
|
|
4848
4848
|
createWriteStream(e) {
|
|
4849
|
-
const { stream: t, addCompleteCb: r } =
|
|
4849
|
+
const { stream: t, addCompleteCb: r } = Kc({
|
|
4850
4850
|
WStream: this.WStream,
|
|
4851
4851
|
startStream: this.startWriteStream.bind(this),
|
|
4852
4852
|
appendStream: this.appendStream.bind(this),
|
|
@@ -4858,7 +4858,7 @@ class qc {
|
|
|
4858
4858
|
}), t;
|
|
4859
4859
|
}
|
|
4860
4860
|
createReadStream(e) {
|
|
4861
|
-
const { stream: t, addCloseCb: r } =
|
|
4861
|
+
const { stream: t, addCloseCb: r } = qc({
|
|
4862
4862
|
RStream: this.RStream,
|
|
4863
4863
|
opts: e,
|
|
4864
4864
|
startStream: this.startReadStream.bind(this),
|
|
@@ -4920,7 +4920,7 @@ class qc {
|
|
|
4920
4920
|
if (!r && !t)
|
|
4921
4921
|
throw new Error("Must provide one of streamId or clientId to subscribe to the stream.");
|
|
4922
4922
|
r && (o["stream-id"] = r), t && (o["client-id"] = t), s && (o.offset = s), i && (o["rule-params"] = i);
|
|
4923
|
-
const a = new
|
|
4923
|
+
const a = new Wc();
|
|
4924
4924
|
return this.readStreamIterators[e] = a, this.trySend(e, o), a;
|
|
4925
4925
|
}
|
|
4926
4926
|
cancelReadStream({ eventId: e }) {
|
|
@@ -5001,39 +5001,39 @@ const Ce = {
|
|
|
5001
5001
|
AUTHENTICATED: "authenticated",
|
|
5002
5002
|
CLOSED: "closed",
|
|
5003
5003
|
ERRORED: "errored"
|
|
5004
|
-
},
|
|
5004
|
+
}, Vc = 3e4, Qc = 3e4, Bc = 200, Gc = 1e3 * 60, Hc = Gc * 60 * 24, es = "lastSyncedUserCookie", Jc = {
|
|
5005
5005
|
apiURI: "https://api.instantdb.com",
|
|
5006
5006
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5007
5007
|
}, bn = "_instant_oauth_redirect", gn = "_instant_extra_fields_id", xt = "oauthExtraFields", Ge = "currentUser";
|
|
5008
|
-
function
|
|
5008
|
+
function Yc({ transportType: n, appId: e, apiURI: t, wsURI: r, EventSourceImpl: s }) {
|
|
5009
5009
|
if (!s)
|
|
5010
5010
|
return new Yr(`${r}?app_id=${e}`);
|
|
5011
5011
|
switch (n) {
|
|
5012
5012
|
case "ws":
|
|
5013
5013
|
return new Yr(`${r}?app_id=${e}`);
|
|
5014
5014
|
case "sse":
|
|
5015
|
-
return new
|
|
5015
|
+
return new jc(s, `${t}/runtime/sse?app_id=${e}`);
|
|
5016
5016
|
default:
|
|
5017
5017
|
throw new Error("Unknown transport type " + n);
|
|
5018
5018
|
}
|
|
5019
5019
|
}
|
|
5020
|
-
function
|
|
5020
|
+
function Zc() {
|
|
5021
5021
|
return typeof window < "u" || typeof chrome < "u";
|
|
5022
5022
|
}
|
|
5023
|
-
const
|
|
5023
|
+
const ts = {
|
|
5024
5024
|
"set-presence": !0,
|
|
5025
5025
|
"set-presence-ok": !0,
|
|
5026
5026
|
"refresh-presence": !0,
|
|
5027
5027
|
"patch-presence": !0
|
|
5028
5028
|
};
|
|
5029
|
-
function
|
|
5029
|
+
function Xc(n, e) {
|
|
5030
5030
|
var r;
|
|
5031
5031
|
const t = typeof n == "string" ? JSON.parse(n) : n;
|
|
5032
5032
|
if ((r = t == null ? void 0 : t.result) != null && r.store) {
|
|
5033
|
-
const s =
|
|
5033
|
+
const s = Ps(t.result.attrsStore, t.result.store);
|
|
5034
5034
|
if (s) {
|
|
5035
5035
|
const i = t.result.store;
|
|
5036
|
-
t.result.store =
|
|
5036
|
+
t.result.store = Is(s, {
|
|
5037
5037
|
...i,
|
|
5038
5038
|
useDateObjects: e
|
|
5039
5039
|
}), t.result.attrsStore = s;
|
|
@@ -5041,7 +5041,7 @@ function Yc(n, e) {
|
|
|
5041
5041
|
}
|
|
5042
5042
|
return t;
|
|
5043
5043
|
}
|
|
5044
|
-
function
|
|
5044
|
+
function eu(n, e) {
|
|
5045
5045
|
const { result: t, ...r } = e, s = (
|
|
5046
5046
|
/** @type {import('./reactorTypes.ts').QuerySubInStorage} */
|
|
5047
5047
|
r
|
|
@@ -5049,14 +5049,14 @@ function Zc(n, e) {
|
|
|
5049
5049
|
if (t) {
|
|
5050
5050
|
const i = {
|
|
5051
5051
|
...t,
|
|
5052
|
-
store:
|
|
5052
|
+
store: Cs(t.store),
|
|
5053
5053
|
attrsStore: t.attrsStore.toJSON()
|
|
5054
5054
|
};
|
|
5055
5055
|
s.result = i;
|
|
5056
5056
|
}
|
|
5057
5057
|
return s;
|
|
5058
5058
|
}
|
|
5059
|
-
function
|
|
5059
|
+
function tu(n, e) {
|
|
5060
5060
|
switch (n) {
|
|
5061
5061
|
case "pendingMutations":
|
|
5062
5062
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -5064,7 +5064,7 @@ function Xc(n, e) {
|
|
|
5064
5064
|
return e;
|
|
5065
5065
|
}
|
|
5066
5066
|
}
|
|
5067
|
-
function
|
|
5067
|
+
function nu(n, e) {
|
|
5068
5068
|
switch (n) {
|
|
5069
5069
|
case "pendingMutations":
|
|
5070
5070
|
return [...e.entries()];
|
|
@@ -5072,7 +5072,7 @@ function eu(n, e) {
|
|
|
5072
5072
|
return e;
|
|
5073
5073
|
}
|
|
5074
5074
|
}
|
|
5075
|
-
function
|
|
5075
|
+
function ru(n, e, t) {
|
|
5076
5076
|
const r = e == null ? void 0 : e.result, s = t == null ? void 0 : t.result;
|
|
5077
5077
|
return r && !s && t && (t.result = r), t || e;
|
|
5078
5078
|
}
|
|
@@ -5082,8 +5082,8 @@ function _n(n) {
|
|
|
5082
5082
|
return a == c ? r < i ? -1 : r > i ? 1 : 0 : a - c;
|
|
5083
5083
|
});
|
|
5084
5084
|
}
|
|
5085
|
-
class
|
|
5086
|
-
constructor(e, t =
|
|
5085
|
+
class su {
|
|
5086
|
+
constructor(e, t = Bs, r = Gs, s, i) {
|
|
5087
5087
|
/** @type {s.AttrsStore | undefined} */
|
|
5088
5088
|
p(this, "attrs");
|
|
5089
5089
|
p(this, "_isOnline", !0);
|
|
@@ -5181,9 +5181,9 @@ class nu {
|
|
|
5181
5181
|
});
|
|
5182
5182
|
/** Applies transactions locally and sends transact message to server */
|
|
5183
5183
|
p(this, "pushTx", (e) => {
|
|
5184
|
-
this.config.disableValidation ||
|
|
5184
|
+
this.config.disableValidation || Rc(e, this.config.schema);
|
|
5185
5185
|
try {
|
|
5186
|
-
const t =
|
|
5186
|
+
const t = nc({
|
|
5187
5187
|
attrsStore: this.optimisticAttrs(),
|
|
5188
5188
|
schema: this.config.schema,
|
|
5189
5189
|
stores: Object.values(this.querySubs.currentValue).map((r) => {
|
|
@@ -5284,7 +5284,7 @@ class nu {
|
|
|
5284
5284
|
}
|
|
5285
5285
|
this._log.info("[socket][close]", t.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5286
5286
|
});
|
|
5287
|
-
if (this._EventSource = i, this.config = { ...
|
|
5287
|
+
if (this._EventSource = i, this.config = { ...Jc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Qc, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Bc, this._log = vc(e.verbose || or || Hs, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": ar }, this.config.schema && (this._linkIndex = Qr(this.config.schema)), !!Zc()) {
|
|
5288
5288
|
if (!e.appId)
|
|
5289
5289
|
throw new Error("Instant must be initialized with an appId.");
|
|
5290
5290
|
if (!it(e.appId))
|
|
@@ -5303,19 +5303,14 @@ class nu {
|
|
|
5303
5303
|
} catch (c) {
|
|
5304
5304
|
this._log.error("[error] handle broadcast channel", c);
|
|
5305
5305
|
}
|
|
5306
|
-
})), this._initStorage(t), this._syncTable = new
|
|
5306
|
+
})), this._initStorage(t), this._syncTable = new Nc(this._trySendAuthed.bind(this), new t(this.config.appId, "syncSubs"), {
|
|
5307
5307
|
useDateObjects: this.config.useDateObjects
|
|
5308
|
-
}, this._log, (o) => yt(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new
|
|
5308
|
+
}, this._log, (o) => yt(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new zc({
|
|
5309
5309
|
WStream: this.config.WritableStream || WritableStream,
|
|
5310
5310
|
RStream: this.config.ReadableStream || ReadableStream,
|
|
5311
5311
|
trySend: this._trySendAuthed.bind(this),
|
|
5312
5312
|
log: this._log
|
|
5313
|
-
}), this._oauthCallbackResponse = this._oauthLoginInit(), this.
|
|
5314
|
-
this.syncUserToEndpoint(o.user);
|
|
5315
|
-
}), setInterval(async () => {
|
|
5316
|
-
const o = await this.getCurrentUser();
|
|
5317
|
-
this.syncUserToEndpoint(o.user);
|
|
5318
|
-
}, Bc), r.getIsOnline().then((o) => {
|
|
5313
|
+
}), this._oauthCallbackResponse = this._oauthLoginInit(), this.setupUserSyncTimer(), r.getIsOnline().then((o) => {
|
|
5319
5314
|
this._isOnline = o, this._startSocket(), r.listen((a) => {
|
|
5320
5315
|
a !== this._isOnline && (this._log.info("[network] online =", a), this._isOnline = a, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", Ce.CLOSED), this._setStatus(Ce.CLOSED)));
|
|
5321
5316
|
});
|
|
@@ -5354,9 +5349,9 @@ class nu {
|
|
|
5354
5349
|
_initStorage(e) {
|
|
5355
5350
|
this.querySubs = new Dn({
|
|
5356
5351
|
persister: new e(this.config.appId, "querySubs"),
|
|
5357
|
-
merge:
|
|
5358
|
-
serialize:
|
|
5359
|
-
parse: (t, r) =>
|
|
5352
|
+
merge: ru,
|
|
5353
|
+
serialize: eu,
|
|
5354
|
+
parse: (t, r) => Xc(r, this.config.useDateObjects),
|
|
5360
5355
|
// objectSize
|
|
5361
5356
|
objectSize: (t) => {
|
|
5362
5357
|
var r, s, i;
|
|
@@ -5375,8 +5370,8 @@ class nu {
|
|
|
5375
5370
|
}), this.querySubs.onKeyLoaded = (t) => this._onQuerySubLoaded(t), this.kv = new Dn({
|
|
5376
5371
|
persister: new e(this.config.appId, "kv"),
|
|
5377
5372
|
merge: this._onMergeKv,
|
|
5378
|
-
serialize:
|
|
5379
|
-
parse:
|
|
5373
|
+
serialize: nu,
|
|
5374
|
+
parse: tu,
|
|
5380
5375
|
objectSize: () => 0,
|
|
5381
5376
|
logger: this._log,
|
|
5382
5377
|
saveThrottleMs: 100,
|
|
@@ -5455,7 +5450,7 @@ class nu {
|
|
|
5455
5450
|
_handleReceive(e, t) {
|
|
5456
5451
|
var s, i, o, a, c, u, l;
|
|
5457
5452
|
const r = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
5458
|
-
switch (
|
|
5453
|
+
switch (ts[t.op] || this._log.info("[receive]", e, t.op, t), t.op) {
|
|
5459
5454
|
case "init-ok": {
|
|
5460
5455
|
this._setStatus(Ce.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(t.attrs), this._flushPendingMessages(), this._sessionId = t["session-id"];
|
|
5461
5456
|
for (const y of Object.keys(this._rooms)) {
|
|
@@ -5771,7 +5766,7 @@ class nu {
|
|
|
5771
5766
|
if (!this.querySubs)
|
|
5772
5767
|
return r.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), r.promise;
|
|
5773
5768
|
const s = ce(e), i = this._startQuerySub(e, s);
|
|
5774
|
-
return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")),
|
|
5769
|
+
return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), Vc), r.promise;
|
|
5775
5770
|
}
|
|
5776
5771
|
_completeQueryOnce(e, t, r) {
|
|
5777
5772
|
this.queryOnceDfds[t] && (this.queryOnceDfds[t] = this.queryOnceDfds[t].filter((s) => s.dfd !== r), this._cleanupQuery(e, t));
|
|
@@ -5838,7 +5833,7 @@ class nu {
|
|
|
5838
5833
|
a = !0;
|
|
5839
5834
|
continue;
|
|
5840
5835
|
}
|
|
5841
|
-
const g = a ?
|
|
5836
|
+
const g = a ? Ma(o, y) : y;
|
|
5842
5837
|
d.push(g);
|
|
5843
5838
|
}
|
|
5844
5839
|
return a ? d : l;
|
|
@@ -5896,12 +5891,12 @@ class nu {
|
|
|
5896
5891
|
const _ = this._applyOptimisticUpdates(f, d, m, g);
|
|
5897
5892
|
f = _.store, d = _.attrsStore;
|
|
5898
5893
|
}
|
|
5899
|
-
return { data:
|
|
5894
|
+
return { data: zs({ store: f, attrsStore: d, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
|
|
5900
5895
|
}
|
|
5901
5896
|
_applyOptimisticUpdates(e, t, r, s) {
|
|
5902
5897
|
for (const [i, o] of r)
|
|
5903
5898
|
if (!o["tx-id"] || s && o["tx-id"] > s) {
|
|
5904
|
-
const a =
|
|
5899
|
+
const a = Po(e, t, o["tx-steps"]);
|
|
5905
5900
|
e = a.store, t = a.attrsStore;
|
|
5906
5901
|
}
|
|
5907
5902
|
return { store: e, attrsStore: t };
|
|
@@ -5995,7 +5990,7 @@ class nu {
|
|
|
5995
5990
|
}
|
|
5996
5991
|
_trySend(e, t, r) {
|
|
5997
5992
|
if (this._transport.isOpen()) {
|
|
5998
|
-
switch (
|
|
5993
|
+
switch (ts[t.op] || this._log.info("[send]", this._transport.id, t.op, {
|
|
5999
5994
|
"client-event-id": e,
|
|
6000
5995
|
...t
|
|
6001
5996
|
}), t.op) {
|
|
@@ -6019,7 +6014,7 @@ class nu {
|
|
|
6019
6014
|
return;
|
|
6020
6015
|
}
|
|
6021
6016
|
const e = this._transport;
|
|
6022
|
-
this._transport =
|
|
6017
|
+
this._transport = Yc({
|
|
6023
6018
|
transportType: this._transportType,
|
|
6024
6019
|
appId: this.config.appId,
|
|
6025
6020
|
apiURI: this.config.apiURI,
|
|
@@ -6214,10 +6209,22 @@ class nu {
|
|
|
6214
6209
|
}
|
|
6215
6210
|
}
|
|
6216
6211
|
}
|
|
6217
|
-
async
|
|
6212
|
+
async setupUserSyncTimer() {
|
|
6218
6213
|
if (this.config.firstPartyPath)
|
|
6219
6214
|
try {
|
|
6220
|
-
await
|
|
6215
|
+
const e = await this.kv.waitForKeyToLoad(es), t = e ? new Date(e).getTime() : 0;
|
|
6216
|
+
if (!(!Number.isFinite(t) || Date.now() - t >= Hc))
|
|
6217
|
+
return;
|
|
6218
|
+
const { user: s } = await this.getCurrentUser();
|
|
6219
|
+
await this.syncUserToEndpoint(s ?? null);
|
|
6220
|
+
} catch (e) {
|
|
6221
|
+
this._log.error("Error syncing user cookie on startup", e);
|
|
6222
|
+
}
|
|
6223
|
+
}
|
|
6224
|
+
async syncUserToEndpoint(e) {
|
|
6225
|
+
if (this.config.firstPartyPath) {
|
|
6226
|
+
try {
|
|
6227
|
+
const t = await fetch(this.config.firstPartyPath + "/", {
|
|
6221
6228
|
method: "POST",
|
|
6222
6229
|
body: JSON.stringify({
|
|
6223
6230
|
type: "sync-user",
|
|
@@ -6228,16 +6235,17 @@ class nu {
|
|
|
6228
6235
|
"Content-Type": "application/json"
|
|
6229
6236
|
}
|
|
6230
6237
|
});
|
|
6238
|
+
if (!t.ok)
|
|
6239
|
+
throw new Error(`HTTP error! status: ${t.status}`);
|
|
6231
6240
|
} catch (t) {
|
|
6232
6241
|
this._log.error("Error syncing user with external endpoint", t);
|
|
6233
6242
|
}
|
|
6243
|
+
this.kv.updateInPlace((t) => {
|
|
6244
|
+
t[es] = (/* @__PURE__ */ new Date()).toISOString();
|
|
6245
|
+
});
|
|
6246
|
+
}
|
|
6234
6247
|
}
|
|
6235
6248
|
async updateUser(e) {
|
|
6236
|
-
try {
|
|
6237
|
-
await this.syncUserToEndpoint(e);
|
|
6238
|
-
} catch (r) {
|
|
6239
|
-
this._log.error("Error syncing user with external endpoint", r);
|
|
6240
|
-
}
|
|
6241
6249
|
const t = { error: void 0, user: e };
|
|
6242
6250
|
this._currentUserCached = { isLoading: !1, ...t }, this._dataForQueryCache = {}, this.querySubs.updateInPlace((r) => {
|
|
6243
6251
|
Object.keys(r).forEach((s) => {
|
|
@@ -6251,9 +6259,14 @@ class nu {
|
|
|
6251
6259
|
});
|
|
6252
6260
|
r.clear();
|
|
6253
6261
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(t);
|
|
6262
|
+
try {
|
|
6263
|
+
await this.syncUserToEndpoint(e);
|
|
6264
|
+
} catch (r) {
|
|
6265
|
+
this._log.error("Error syncing user with external endpoint", r);
|
|
6266
|
+
}
|
|
6254
6267
|
}
|
|
6255
6268
|
sendMagicCode({ email: e }) {
|
|
6256
|
-
return
|
|
6269
|
+
return lc({
|
|
6257
6270
|
apiURI: this.config.apiURI,
|
|
6258
6271
|
appId: this.config.appId,
|
|
6259
6272
|
email: e
|
|
@@ -6261,7 +6274,7 @@ class nu {
|
|
|
6261
6274
|
}
|
|
6262
6275
|
async signInWithMagicCode(e) {
|
|
6263
6276
|
var i, o;
|
|
6264
|
-
const t = await this.getCurrentUser(), r = ((i = t == null ? void 0 : t.user) == null ? void 0 : i.type) === "guest", s = await
|
|
6277
|
+
const t = await this.getCurrentUser(), r = ((i = t == null ? void 0 : t.user) == null ? void 0 : i.type) === "guest", s = await fc({
|
|
6265
6278
|
apiURI: this.config.apiURI,
|
|
6266
6279
|
appId: this.config.appId,
|
|
6267
6280
|
email: e.email,
|
|
@@ -6272,7 +6285,7 @@ class nu {
|
|
|
6272
6285
|
return await this.changeCurrentUser(s.user), s;
|
|
6273
6286
|
}
|
|
6274
6287
|
async signInWithCustomToken(e) {
|
|
6275
|
-
const t = await
|
|
6288
|
+
const t = await dc({
|
|
6276
6289
|
apiURI: this.config.apiURI,
|
|
6277
6290
|
appId: this.config.appId,
|
|
6278
6291
|
refreshToken: e
|
|
@@ -6280,7 +6293,7 @@ class nu {
|
|
|
6280
6293
|
return await this.changeCurrentUser(t.user), t;
|
|
6281
6294
|
}
|
|
6282
6295
|
async signInAsGuest() {
|
|
6283
|
-
const e = await
|
|
6296
|
+
const e = await hc({
|
|
6284
6297
|
apiURI: this.config.apiURI,
|
|
6285
6298
|
appId: this.config.appId
|
|
6286
6299
|
});
|
|
@@ -6295,7 +6308,7 @@ class nu {
|
|
|
6295
6308
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
6296
6309
|
return;
|
|
6297
6310
|
}
|
|
6298
|
-
|
|
6311
|
+
yc({
|
|
6299
6312
|
apiURI: this.config.apiURI,
|
|
6300
6313
|
appId: this.config.appId,
|
|
6301
6314
|
refreshToken: r
|
|
@@ -6360,7 +6373,7 @@ class nu {
|
|
|
6360
6373
|
*/
|
|
6361
6374
|
async signInWithIdToken(e) {
|
|
6362
6375
|
var i;
|
|
6363
|
-
const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token, s = await
|
|
6376
|
+
const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token, s = await pc({
|
|
6364
6377
|
apiURI: this.config.apiURI,
|
|
6365
6378
|
appId: this.config.appId,
|
|
6366
6379
|
idToken: e.idToken,
|
|
@@ -6404,7 +6417,7 @@ class nu {
|
|
|
6404
6417
|
getPresence(e, t, r = {}) {
|
|
6405
6418
|
const s = this._rooms[t], i = this._presence[t];
|
|
6406
6419
|
return !s || !i || !i.result ? null : {
|
|
6407
|
-
...
|
|
6420
|
+
...Sc(i.result, r, this._sessionId),
|
|
6408
6421
|
isLoading: !s.isConnected,
|
|
6409
6422
|
error: s.error
|
|
6410
6423
|
};
|
|
@@ -6466,7 +6479,7 @@ class nu {
|
|
|
6466
6479
|
}
|
|
6467
6480
|
_notifyPresenceSub(e, t) {
|
|
6468
6481
|
const r = this.getPresence("", e, t);
|
|
6469
|
-
r && (t.prev && !
|
|
6482
|
+
r && (t.prev && !Tc(r, t.prev) || (t.prev = r, t.cb(r)));
|
|
6470
6483
|
}
|
|
6471
6484
|
_patchPresencePeers(e, t) {
|
|
6472
6485
|
var o, a, c;
|
|
@@ -6477,13 +6490,13 @@ class nu {
|
|
|
6477
6490
|
for (let [l, f, d] of t)
|
|
6478
6491
|
switch (f) {
|
|
6479
6492
|
case "+":
|
|
6480
|
-
|
|
6493
|
+
Yi(u, l, d);
|
|
6481
6494
|
break;
|
|
6482
6495
|
case "r":
|
|
6483
6496
|
Ir(u, l, d);
|
|
6484
6497
|
break;
|
|
6485
6498
|
case "-":
|
|
6486
|
-
|
|
6499
|
+
ks(u, l);
|
|
6487
6500
|
break;
|
|
6488
6501
|
}
|
|
6489
6502
|
delete u[this._sessionId];
|
|
@@ -6538,7 +6551,7 @@ class nu {
|
|
|
6538
6551
|
async uploadFile(e, t, r) {
|
|
6539
6552
|
var o;
|
|
6540
6553
|
const s = await this.getCurrentUser(), i = (o = s == null ? void 0 : s.user) == null ? void 0 : o.refresh_token;
|
|
6541
|
-
return
|
|
6554
|
+
return bc({
|
|
6542
6555
|
...r,
|
|
6543
6556
|
apiURI: this.config.apiURI,
|
|
6544
6557
|
appId: this.config.appId,
|
|
@@ -6550,7 +6563,7 @@ class nu {
|
|
|
6550
6563
|
async deleteFile(e) {
|
|
6551
6564
|
var i;
|
|
6552
6565
|
const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token;
|
|
6553
|
-
return await
|
|
6566
|
+
return await gc({
|
|
6554
6567
|
apiURI: this.config.apiURI,
|
|
6555
6568
|
appId: this.config.appId,
|
|
6556
6569
|
path: e,
|
|
@@ -6561,18 +6574,18 @@ class nu {
|
|
|
6561
6574
|
// ---------------------------------
|
|
6562
6575
|
async upload(e, t) {
|
|
6563
6576
|
var c;
|
|
6564
|
-
const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || t.name, o = await
|
|
6577
|
+
const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || t.name, o = await _c({
|
|
6565
6578
|
apiURI: this.config.apiURI,
|
|
6566
6579
|
appId: this.config.appId,
|
|
6567
6580
|
fileName: i,
|
|
6568
6581
|
refreshToken: s
|
|
6569
6582
|
});
|
|
6570
|
-
return await
|
|
6583
|
+
return await mc(o, t);
|
|
6571
6584
|
}
|
|
6572
6585
|
async getDownloadUrl(e) {
|
|
6573
6586
|
var i;
|
|
6574
6587
|
const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token;
|
|
6575
|
-
return await
|
|
6588
|
+
return await wc({
|
|
6576
6589
|
apiURI: this.config.apiURI,
|
|
6577
6590
|
appId: this.config.appId,
|
|
6578
6591
|
path: e,
|
|
@@ -6580,9 +6593,9 @@ class nu {
|
|
|
6580
6593
|
});
|
|
6581
6594
|
}
|
|
6582
6595
|
}
|
|
6583
|
-
function
|
|
6596
|
+
function iu(n, e) {
|
|
6584
6597
|
return new nn(
|
|
6585
|
-
|
|
6598
|
+
si(n, e),
|
|
6586
6599
|
// (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
|
|
6587
6600
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
6588
6601
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -6592,28 +6605,28 @@ function ru(n, e) {
|
|
|
6592
6605
|
void 0
|
|
6593
6606
|
);
|
|
6594
6607
|
}
|
|
6595
|
-
function
|
|
6608
|
+
function ou(n) {
|
|
6596
6609
|
return new tn(n, {});
|
|
6597
6610
|
}
|
|
6598
|
-
function
|
|
6611
|
+
function au() {
|
|
6599
6612
|
return new he("string", !0, !1);
|
|
6600
6613
|
}
|
|
6601
|
-
function
|
|
6614
|
+
function cu() {
|
|
6602
6615
|
return new he("number", !0, !1);
|
|
6603
6616
|
}
|
|
6604
|
-
function
|
|
6617
|
+
function uu() {
|
|
6605
6618
|
return new he("boolean", !0, !1);
|
|
6606
6619
|
}
|
|
6607
|
-
function
|
|
6620
|
+
function lu() {
|
|
6608
6621
|
return new he("date", !0, !1);
|
|
6609
6622
|
}
|
|
6610
|
-
function
|
|
6623
|
+
function fu() {
|
|
6611
6624
|
return new he("json", !0, !1);
|
|
6612
6625
|
}
|
|
6613
|
-
function
|
|
6626
|
+
function du() {
|
|
6614
6627
|
return new he("json", !0, !1);
|
|
6615
6628
|
}
|
|
6616
|
-
function
|
|
6629
|
+
function si(n, e) {
|
|
6617
6630
|
var s, i, o, a;
|
|
6618
6631
|
const t = { fwd: {}, rev: {} };
|
|
6619
6632
|
for (const c of Object.values(e))
|
|
@@ -6632,10 +6645,10 @@ function ri(n, e) {
|
|
|
6632
6645
|
})
|
|
6633
6646
|
]));
|
|
6634
6647
|
}
|
|
6635
|
-
function
|
|
6648
|
+
function hu({ entities: n, links: e, rooms: t }) {
|
|
6636
6649
|
const r = e ?? {}, s = t ?? {};
|
|
6637
6650
|
return new nn(
|
|
6638
|
-
|
|
6651
|
+
si(n, r),
|
|
6639
6652
|
// (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
|
|
6640
6653
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
6641
6654
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -6645,23 +6658,23 @@ function fu({ entities: n, links: e, rooms: t }) {
|
|
|
6645
6658
|
s
|
|
6646
6659
|
);
|
|
6647
6660
|
}
|
|
6648
|
-
const
|
|
6661
|
+
const fl = {
|
|
6649
6662
|
// constructs
|
|
6650
|
-
graph:
|
|
6651
|
-
schema:
|
|
6652
|
-
entity:
|
|
6663
|
+
graph: iu,
|
|
6664
|
+
schema: hu,
|
|
6665
|
+
entity: ou,
|
|
6653
6666
|
// value types
|
|
6654
|
-
string:
|
|
6655
|
-
number:
|
|
6656
|
-
boolean:
|
|
6657
|
-
date:
|
|
6658
|
-
json:
|
|
6659
|
-
any:
|
|
6667
|
+
string: au,
|
|
6668
|
+
number: cu,
|
|
6669
|
+
boolean: uu,
|
|
6670
|
+
date: lu,
|
|
6671
|
+
json: fu,
|
|
6672
|
+
any: du
|
|
6660
6673
|
};
|
|
6661
6674
|
let $t;
|
|
6662
|
-
function
|
|
6675
|
+
function pu(n, e) {
|
|
6663
6676
|
$t == null || $t.dispose();
|
|
6664
|
-
const t =
|
|
6677
|
+
const t = wu(e), r = gu(e, a), s = bu(yu(n));
|
|
6665
6678
|
function i(l) {
|
|
6666
6679
|
var f;
|
|
6667
6680
|
l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && t.isVisible() && a();
|
|
@@ -6683,10 +6696,10 @@ function du(n, e) {
|
|
|
6683
6696
|
}
|
|
6684
6697
|
return u();
|
|
6685
6698
|
}
|
|
6686
|
-
function
|
|
6687
|
-
return `${or ||
|
|
6699
|
+
function yu(n) {
|
|
6700
|
+
return `${or || Js ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${n}`;
|
|
6688
6701
|
}
|
|
6689
|
-
function
|
|
6702
|
+
function bu(n) {
|
|
6690
6703
|
const e = document.createElement("iframe");
|
|
6691
6704
|
return e.src = n, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
6692
6705
|
width: "100%",
|
|
@@ -6695,7 +6708,7 @@ function pu(n) {
|
|
|
6695
6708
|
border: "none"
|
|
6696
6709
|
}), { element: e };
|
|
6697
6710
|
}
|
|
6698
|
-
function
|
|
6711
|
+
function gu(n, e) {
|
|
6699
6712
|
const t = `
|
|
6700
6713
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6701
6714
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -6705,7 +6718,7 @@ function yu(n, e) {
|
|
|
6705
6718
|
return r.innerHTML = t, r.className = "instant-devtool-toggler", Object.assign(r.style, {
|
|
6706
6719
|
// pos
|
|
6707
6720
|
position: "fixed",
|
|
6708
|
-
...
|
|
6721
|
+
..._u(n.position),
|
|
6709
6722
|
height: "32px",
|
|
6710
6723
|
width: "32px",
|
|
6711
6724
|
// layout
|
|
@@ -6720,7 +6733,7 @@ function yu(n, e) {
|
|
|
6720
6733
|
cursor: "pointer"
|
|
6721
6734
|
}), r.addEventListener("click", e), { element: r };
|
|
6722
6735
|
}
|
|
6723
|
-
function
|
|
6736
|
+
function _u(n) {
|
|
6724
6737
|
switch (n) {
|
|
6725
6738
|
case "bottom-left":
|
|
6726
6739
|
return { bottom: "24px", left: "24px" };
|
|
@@ -6732,7 +6745,7 @@ function bu(n) {
|
|
|
6732
6745
|
return { top: "24px", left: "24px" };
|
|
6733
6746
|
}
|
|
6734
6747
|
}
|
|
6735
|
-
function
|
|
6748
|
+
function mu(n) {
|
|
6736
6749
|
switch (n) {
|
|
6737
6750
|
case "bottom-left":
|
|
6738
6751
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -6744,11 +6757,11 @@ function gu(n) {
|
|
|
6744
6757
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
6745
6758
|
}
|
|
6746
6759
|
}
|
|
6747
|
-
function
|
|
6760
|
+
function wu(n) {
|
|
6748
6761
|
const e = document.createElement("div");
|
|
6749
6762
|
Object.assign(e.style, {
|
|
6750
6763
|
position: "fixed",
|
|
6751
|
-
...
|
|
6764
|
+
...mu(n.position),
|
|
6752
6765
|
display: "block",
|
|
6753
6766
|
borderRadius: "4px",
|
|
6754
6767
|
border: "1px #ccc solid",
|
|
@@ -6761,7 +6774,7 @@ function _u(n) {
|
|
|
6761
6774
|
}
|
|
6762
6775
|
return { element: e, isVisible: t };
|
|
6763
6776
|
}
|
|
6764
|
-
function
|
|
6777
|
+
function Su(n, e) {
|
|
6765
6778
|
return e && e.refresh_token ? new Response(JSON.stringify({ ok: !0 }), {
|
|
6766
6779
|
headers: {
|
|
6767
6780
|
"Content-Type": "application/json",
|
|
@@ -6782,7 +6795,7 @@ function Dt(n, e) {
|
|
|
6782
6795
|
headers: { "Content-Type": "application/json" }
|
|
6783
6796
|
});
|
|
6784
6797
|
}
|
|
6785
|
-
const
|
|
6798
|
+
const dl = (n) => ({
|
|
6786
6799
|
POST: async (e) => {
|
|
6787
6800
|
let t;
|
|
6788
6801
|
try {
|
|
@@ -6796,7 +6809,7 @@ const ll = (n) => ({
|
|
|
6796
6809
|
return Dt(403, "App ID mismatch");
|
|
6797
6810
|
switch (t.type) {
|
|
6798
6811
|
case "sync-user":
|
|
6799
|
-
return
|
|
6812
|
+
return Su(n, t.user ?? null);
|
|
6800
6813
|
default:
|
|
6801
6814
|
return Dt(400, `Unknown type: ${t.type}`);
|
|
6802
6815
|
}
|
|
@@ -6806,14 +6819,14 @@ function lt(n, e) {
|
|
|
6806
6819
|
if (!n)
|
|
6807
6820
|
throw new Error("[assertion error] " + e);
|
|
6808
6821
|
}
|
|
6809
|
-
const
|
|
6822
|
+
const Tu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]), ns = (n) => {
|
|
6810
6823
|
const [e, t] = JSON.parse(n);
|
|
6811
6824
|
return { cursor: e, afterInclusive: t };
|
|
6812
|
-
}, He = (n, e, t = !1) => `${n}:${gt(e, t)}`,
|
|
6825
|
+
}, He = (n, e, t = !1) => `${n}:${gt(e, t)}`, vu = (n) => !!n.endCursor, Eu = (n) => {
|
|
6813
6826
|
var t;
|
|
6814
6827
|
const e = Array.from(n.values());
|
|
6815
6828
|
return e.length === 0 ? !1 : ((t = e[e.length - 1]) == null ? void 0 : t.hasMore) || !1;
|
|
6816
|
-
},
|
|
6829
|
+
}, rs = (n) => {
|
|
6817
6830
|
if (!n)
|
|
6818
6831
|
return {
|
|
6819
6832
|
serverCreatedAt: "asc"
|
|
@@ -6824,9 +6837,9 @@ const wu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
6824
6837
|
} : {
|
|
6825
6838
|
serverCreatedAt: "asc"
|
|
6826
6839
|
};
|
|
6827
|
-
},
|
|
6840
|
+
}, ii = (n) => n && Object.keys(n).length > 0 ? n : {
|
|
6828
6841
|
serverCreatedAt: "asc"
|
|
6829
|
-
},
|
|
6842
|
+
}, Ou = (n, e) => {
|
|
6830
6843
|
const t = [
|
|
6831
6844
|
...Array.from(e.values()).slice().reverse(),
|
|
6832
6845
|
...Array.from(n.values())
|
|
@@ -6835,21 +6848,21 @@ const wu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
6835
6848
|
...Array.from(n.values()).flatMap((s) => s.data)
|
|
6836
6849
|
];
|
|
6837
6850
|
return { chunks: t, data: r };
|
|
6838
|
-
}, mn = ["bootstrap", "bootstrap", "bootstrap", 1],
|
|
6851
|
+
}, mn = ["bootstrap", "bootstrap", "bootstrap", 1], ku = (n, e, t, r) => {
|
|
6839
6852
|
var G, V, ne, q;
|
|
6840
|
-
const { entityName: s, entityQuery: i } =
|
|
6853
|
+
const { entityName: s, entityQuery: i } = oi(e), o = ((G = i.$) == null ? void 0 : G.limit) || 10, a = s, c = ii((V = i.$) == null ? void 0 : V.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
6841
6854
|
let d = !1, y = !0, b = null, g = null;
|
|
6842
6855
|
const m = (k) => {
|
|
6843
6856
|
t({ error: k, data: void 0, canLoadNextPage: !1 });
|
|
6844
6857
|
}, T = () => {
|
|
6845
6858
|
if (!y)
|
|
6846
6859
|
return;
|
|
6847
|
-
const { chunks: k, data: j } =
|
|
6860
|
+
const { chunks: k, data: j } = Ou(u, l);
|
|
6848
6861
|
t({
|
|
6849
6862
|
data: { [a]: j },
|
|
6850
6863
|
// @ts-expect-error hidden debug variable
|
|
6851
6864
|
chunks: k,
|
|
6852
|
-
canLoadNextPage:
|
|
6865
|
+
canLoadNextPage: Eu(u)
|
|
6853
6866
|
});
|
|
6854
6867
|
}, _ = (k, j) => {
|
|
6855
6868
|
u.set(gt(k, j.afterInclusive), j), T();
|
|
@@ -6857,7 +6870,7 @@ const wu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
6857
6870
|
l.set(gt(k), j), P(), T();
|
|
6858
6871
|
}, C = (k, j) => {
|
|
6859
6872
|
var O, A;
|
|
6860
|
-
const { cursor: R } =
|
|
6873
|
+
const { cursor: R } = ns(k), F = f.get(He("reverse", R));
|
|
6861
6874
|
F == null || F();
|
|
6862
6875
|
const N = n.subscribeQuery({
|
|
6863
6876
|
[a]: {
|
|
@@ -6868,7 +6881,7 @@ const wu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
6868
6881
|
beforeInclusive: !0,
|
|
6869
6882
|
where: (O = i.$) == null ? void 0 : O.where,
|
|
6870
6883
|
fields: (A = i.$) == null ? void 0 : A.fields,
|
|
6871
|
-
order:
|
|
6884
|
+
order: rs(c)
|
|
6872
6885
|
}
|
|
6873
6886
|
}
|
|
6874
6887
|
}, (W) => {
|
|
@@ -6893,7 +6906,7 @@ const wu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
6893
6906
|
after: k,
|
|
6894
6907
|
where: (R = i.$) == null ? void 0 : R.where,
|
|
6895
6908
|
fields: (F = i.$) == null ? void 0 : F.fields,
|
|
6896
|
-
order:
|
|
6909
|
+
order: rs(c)
|
|
6897
6910
|
}
|
|
6898
6911
|
}
|
|
6899
6912
|
}, (N) => {
|
|
@@ -6973,9 +6986,9 @@ const wu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
6973
6986
|
if (!k)
|
|
6974
6987
|
return;
|
|
6975
6988
|
const [j, R] = k;
|
|
6976
|
-
if (!(R != null && R.hasMore) || !
|
|
6989
|
+
if (!(R != null && R.hasMore) || !vu(R))
|
|
6977
6990
|
return;
|
|
6978
|
-
const F = `${j}:${
|
|
6991
|
+
const F = `${j}:${Tu(R.endCursor)}`;
|
|
6979
6992
|
F != b && (b = F, C(j, R), v(R.endCursor));
|
|
6980
6993
|
}, H = () => {
|
|
6981
6994
|
const k = Array.from(u.entries()).at(-1);
|
|
@@ -6984,7 +6997,7 @@ const wu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
6984
6997
|
const [j, R] = k;
|
|
6985
6998
|
if (!R.endCursor)
|
|
6986
6999
|
return;
|
|
6987
|
-
const { cursor: F, afterInclusive: N } =
|
|
7000
|
+
const { cursor: F, afterInclusive: N } = ns(j);
|
|
6988
7001
|
I(F, N), U(R.endCursor);
|
|
6989
7002
|
};
|
|
6990
7003
|
return g = n.subscribeQuery({
|
|
@@ -7031,7 +7044,7 @@ const wu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7031
7044
|
},
|
|
7032
7045
|
loadNextPage: H
|
|
7033
7046
|
};
|
|
7034
|
-
},
|
|
7047
|
+
}, ss = (n, e, t) => {
|
|
7035
7048
|
var u, l, f, d;
|
|
7036
7049
|
if (!e)
|
|
7037
7050
|
return {
|
|
@@ -7039,8 +7052,8 @@ const wu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7039
7052
|
data: void 0,
|
|
7040
7053
|
error: void 0
|
|
7041
7054
|
};
|
|
7042
|
-
const { entityName: r, entityQuery: s } =
|
|
7043
|
-
let a = e ?
|
|
7055
|
+
const { entityName: r, entityQuery: s } = oi(e), i = ((u = s.$) == null ? void 0 : u.limit) || 10, o = ii((l = s.$) == null ? void 0 : l.order);
|
|
7056
|
+
let a = e ? ai({
|
|
7044
7057
|
[r]: {
|
|
7045
7058
|
...s,
|
|
7046
7059
|
$: {
|
|
@@ -7061,29 +7074,29 @@ const wu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7061
7074
|
data: (c == null ? void 0 : c.data) || void 0,
|
|
7062
7075
|
error: void 0
|
|
7063
7076
|
};
|
|
7064
|
-
},
|
|
7077
|
+
}, oi = (n) => {
|
|
7065
7078
|
if (Object.keys(n).length !== 1)
|
|
7066
7079
|
throw new B("subscribeInfiniteQuery expects exactly one entity");
|
|
7067
7080
|
const [t, r] = Object.entries(n)[0];
|
|
7068
7081
|
if (!t || !r)
|
|
7069
7082
|
throw new B("No query provided for infinite query");
|
|
7070
7083
|
return { entityName: t, entityQuery: r };
|
|
7071
|
-
},
|
|
7084
|
+
}, Au = {
|
|
7072
7085
|
apiURI: "https://api.instantdb.com",
|
|
7073
7086
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
7074
7087
|
};
|
|
7075
|
-
function
|
|
7088
|
+
function Cu() {
|
|
7076
7089
|
return globalThis.__instantDbSchemaHashStore = globalThis.__instantDbSchemaHashStore ?? /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
7077
7090
|
}
|
|
7078
|
-
function
|
|
7091
|
+
function Iu() {
|
|
7079
7092
|
return globalThis.__instantDbStore = globalThis.__instantDbStore ?? {}, globalThis.__instantDbStore;
|
|
7080
7093
|
}
|
|
7081
7094
|
function Un(n) {
|
|
7082
7095
|
const e = n.__adminToken, t = n.__extraDedupeKey;
|
|
7083
7096
|
return n.appId + "_" + (n.websocketURI || "default_ws_uri") + "_" + (n.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + n.useDateObjects + "_" + (t || "");
|
|
7084
7097
|
}
|
|
7085
|
-
const Ln =
|
|
7086
|
-
class
|
|
7098
|
+
const Ln = Iu(), is = Cu();
|
|
7099
|
+
class Pu {
|
|
7087
7100
|
constructor(e) {
|
|
7088
7101
|
p(this, "db");
|
|
7089
7102
|
/**
|
|
@@ -7200,7 +7213,7 @@ class Cu {
|
|
|
7200
7213
|
this.db = e;
|
|
7201
7214
|
}
|
|
7202
7215
|
}
|
|
7203
|
-
class
|
|
7216
|
+
class Mu {
|
|
7204
7217
|
constructor(e) {
|
|
7205
7218
|
p(this, "db");
|
|
7206
7219
|
/**
|
|
@@ -7258,7 +7271,7 @@ class Iu {
|
|
|
7258
7271
|
this.db = e;
|
|
7259
7272
|
}
|
|
7260
7273
|
}
|
|
7261
|
-
class
|
|
7274
|
+
class Ru {
|
|
7262
7275
|
constructor(e) {
|
|
7263
7276
|
p(this, "db");
|
|
7264
7277
|
/**
|
|
@@ -7284,17 +7297,17 @@ class Pu {
|
|
|
7284
7297
|
this.db = e;
|
|
7285
7298
|
}
|
|
7286
7299
|
}
|
|
7287
|
-
function
|
|
7300
|
+
function ai(n) {
|
|
7288
7301
|
return JSON.parse(JSON.stringify(n));
|
|
7289
7302
|
}
|
|
7290
|
-
class
|
|
7303
|
+
class ju {
|
|
7291
7304
|
constructor(e) {
|
|
7292
7305
|
p(this, "_reactor");
|
|
7293
7306
|
p(this, "auth");
|
|
7294
7307
|
p(this, "storage");
|
|
7295
7308
|
p(this, "streams");
|
|
7296
7309
|
p(this, "tx", ir());
|
|
7297
|
-
this._reactor = e, this.auth = new
|
|
7310
|
+
this._reactor = e, this.auth = new Pu(this._reactor), this.storage = new Mu(this._reactor), this.streams = new Ru(this._reactor);
|
|
7298
7311
|
}
|
|
7299
7312
|
/**
|
|
7300
7313
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -7372,7 +7385,7 @@ class Mu {
|
|
|
7372
7385
|
* });
|
|
7373
7386
|
*/
|
|
7374
7387
|
subscribeInfiniteQuery(e, t, r) {
|
|
7375
|
-
return
|
|
7388
|
+
return ku(this, e, t, r);
|
|
7376
7389
|
}
|
|
7377
7390
|
/**
|
|
7378
7391
|
* Listen for the logged in state. This is useful
|
|
@@ -7490,19 +7503,19 @@ class Mu {
|
|
|
7490
7503
|
return this._reactor.subscribeTable(e, t);
|
|
7491
7504
|
}
|
|
7492
7505
|
}
|
|
7493
|
-
function
|
|
7506
|
+
function os(n) {
|
|
7494
7507
|
if (!n)
|
|
7495
7508
|
return "0";
|
|
7496
|
-
const e =
|
|
7509
|
+
const e = is.get(n);
|
|
7497
7510
|
if (e)
|
|
7498
7511
|
return e;
|
|
7499
7512
|
const t = ce(n);
|
|
7500
|
-
return
|
|
7513
|
+
return is.set(n, t), t;
|
|
7501
7514
|
}
|
|
7502
|
-
function
|
|
7503
|
-
return
|
|
7515
|
+
function xu(n, e) {
|
|
7516
|
+
return os(n._reactor.config.schema) !== os(e);
|
|
7504
7517
|
}
|
|
7505
|
-
function
|
|
7518
|
+
function $u(n, e, t, r, s) {
|
|
7506
7519
|
var u;
|
|
7507
7520
|
const i = {
|
|
7508
7521
|
...n,
|
|
@@ -7510,15 +7523,15 @@ function ju(n, e, t, r, s) {
|
|
|
7510
7523
|
useDateObjects: n.useDateObjects ?? !1
|
|
7511
7524
|
}, o = Ln[Un(i)];
|
|
7512
7525
|
if (o)
|
|
7513
|
-
return
|
|
7514
|
-
const a = new
|
|
7515
|
-
...
|
|
7526
|
+
return xu(o, i.schema) && o._reactor.updateSchema(i.schema), o;
|
|
7527
|
+
const a = new su({
|
|
7528
|
+
...Au,
|
|
7516
7529
|
...i,
|
|
7517
7530
|
cardinalityInference: !!i.schema
|
|
7518
|
-
}, e ||
|
|
7519
|
-
return Ln[Un(i)] = c,
|
|
7531
|
+
}, e || Bs, t || Gs, { ...r || {}, "@instantdb/core": ar }, s), c = new ju(a);
|
|
7532
|
+
return Ln[Un(i)] = c, Du(i.appId, i.devtool), c;
|
|
7520
7533
|
}
|
|
7521
|
-
function
|
|
7534
|
+
function Du(n, e) {
|
|
7522
7535
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
7523
7536
|
return;
|
|
7524
7537
|
const t = {
|
|
@@ -7526,7 +7539,7 @@ function xu(n, e) {
|
|
|
7526
7539
|
allowedHosts: ["localhost"],
|
|
7527
7540
|
...typeof e == "object" ? e : {}
|
|
7528
7541
|
};
|
|
7529
|
-
t.allowedHosts.includes(window.location.hostname) &&
|
|
7542
|
+
t.allowedHosts.includes(window.location.hostname) && pu(n, t);
|
|
7530
7543
|
}
|
|
7531
7544
|
var Fn = { exports: {} }, ft = {};
|
|
7532
7545
|
/**
|
|
@@ -7538,11 +7551,11 @@ var Fn = { exports: {} }, ft = {};
|
|
|
7538
7551
|
* This source code is licensed under the MIT license found in the
|
|
7539
7552
|
* LICENSE file in the root directory of this source tree.
|
|
7540
7553
|
*/
|
|
7541
|
-
var
|
|
7542
|
-
function
|
|
7543
|
-
if (
|
|
7544
|
-
|
|
7545
|
-
var n =
|
|
7554
|
+
var as;
|
|
7555
|
+
function Uu() {
|
|
7556
|
+
if (as) return ft;
|
|
7557
|
+
as = 1;
|
|
7558
|
+
var n = ys, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
7546
7559
|
function o(a, c, u) {
|
|
7547
7560
|
var l, f = {}, d = null, y = null;
|
|
7548
7561
|
u !== void 0 && (d = "" + u), c.key !== void 0 && (d = "" + c.key), c.ref !== void 0 && (y = c.ref);
|
|
@@ -7552,10 +7565,10 @@ function $u() {
|
|
|
7552
7565
|
}
|
|
7553
7566
|
return ft.Fragment = t, ft.jsx = o, ft.jsxs = o, ft;
|
|
7554
7567
|
}
|
|
7555
|
-
var dt = {},
|
|
7556
|
-
function
|
|
7557
|
-
if (
|
|
7558
|
-
|
|
7568
|
+
var dt = {}, cs;
|
|
7569
|
+
function Lu() {
|
|
7570
|
+
if (cs) return dt;
|
|
7571
|
+
cs = 1;
|
|
7559
7572
|
var n = {};
|
|
7560
7573
|
/**
|
|
7561
7574
|
* @license React
|
|
@@ -7567,7 +7580,7 @@ function Du() {
|
|
|
7567
7580
|
* LICENSE file in the root directory of this source tree.
|
|
7568
7581
|
*/
|
|
7569
7582
|
return n.NODE_ENV !== "production" && function() {
|
|
7570
|
-
var e =
|
|
7583
|
+
var e = ys, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, m = "@@iterator";
|
|
7571
7584
|
function T(h) {
|
|
7572
7585
|
if (h === null || typeof h != "object")
|
|
7573
7586
|
return null;
|
|
@@ -7734,8 +7747,8 @@ function Du() {
|
|
|
7734
7747
|
}
|
|
7735
7748
|
var sn = !1, Ct;
|
|
7736
7749
|
{
|
|
7737
|
-
var
|
|
7738
|
-
Ct = new
|
|
7750
|
+
var li = typeof WeakMap == "function" ? WeakMap : Map;
|
|
7751
|
+
Ct = new li();
|
|
7739
7752
|
}
|
|
7740
7753
|
function ur(h, S) {
|
|
7741
7754
|
if (!h || sn)
|
|
@@ -7808,10 +7821,10 @@ function Du() {
|
|
|
7808
7821
|
var Be = h ? h.displayName || h.name : "", De = Be ? At(Be) : "";
|
|
7809
7822
|
return typeof h == "function" && Ct.set(h, De), De;
|
|
7810
7823
|
}
|
|
7811
|
-
function
|
|
7824
|
+
function fi(h, S, E) {
|
|
7812
7825
|
return ur(h, !1);
|
|
7813
7826
|
}
|
|
7814
|
-
function
|
|
7827
|
+
function di(h) {
|
|
7815
7828
|
var S = h.prototype;
|
|
7816
7829
|
return !!(S && S.isReactComponent);
|
|
7817
7830
|
}
|
|
@@ -7819,7 +7832,7 @@ function Du() {
|
|
|
7819
7832
|
if (h == null)
|
|
7820
7833
|
return "";
|
|
7821
7834
|
if (typeof h == "function")
|
|
7822
|
-
return ur(h,
|
|
7835
|
+
return ur(h, di(h));
|
|
7823
7836
|
if (typeof h == "string")
|
|
7824
7837
|
return At(h);
|
|
7825
7838
|
switch (h) {
|
|
@@ -7831,7 +7844,7 @@ function Du() {
|
|
|
7831
7844
|
if (typeof h == "object")
|
|
7832
7845
|
switch (h.$$typeof) {
|
|
7833
7846
|
case u:
|
|
7834
|
-
return
|
|
7847
|
+
return fi(h.render);
|
|
7835
7848
|
case d:
|
|
7836
7849
|
return It(h.type, S, E);
|
|
7837
7850
|
case y: {
|
|
@@ -7852,7 +7865,7 @@ function Du() {
|
|
|
7852
7865
|
} else
|
|
7853
7866
|
fr.setExtraStackFrame(null);
|
|
7854
7867
|
}
|
|
7855
|
-
function
|
|
7868
|
+
function hi(h, S, E, M, z) {
|
|
7856
7869
|
{
|
|
7857
7870
|
var Q = Function.call.bind(ut);
|
|
7858
7871
|
for (var L in h)
|
|
@@ -7871,17 +7884,17 @@ function Du() {
|
|
|
7871
7884
|
}
|
|
7872
7885
|
}
|
|
7873
7886
|
}
|
|
7874
|
-
var
|
|
7887
|
+
var pi = Array.isArray;
|
|
7875
7888
|
function on(h) {
|
|
7876
|
-
return
|
|
7889
|
+
return pi(h);
|
|
7877
7890
|
}
|
|
7878
|
-
function
|
|
7891
|
+
function yi(h) {
|
|
7879
7892
|
{
|
|
7880
7893
|
var S = typeof Symbol == "function" && Symbol.toStringTag, E = S && h[Symbol.toStringTag] || h.constructor.name || "Object";
|
|
7881
7894
|
return E;
|
|
7882
7895
|
}
|
|
7883
7896
|
}
|
|
7884
|
-
function
|
|
7897
|
+
function bi(h) {
|
|
7885
7898
|
try {
|
|
7886
7899
|
return dr(h), !1;
|
|
7887
7900
|
} catch {
|
|
@@ -7892,16 +7905,16 @@ function Du() {
|
|
|
7892
7905
|
return "" + h;
|
|
7893
7906
|
}
|
|
7894
7907
|
function hr(h) {
|
|
7895
|
-
if (
|
|
7896
|
-
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
7908
|
+
if (bi(h))
|
|
7909
|
+
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", yi(h)), dr(h);
|
|
7897
7910
|
}
|
|
7898
|
-
var pr = _.ReactCurrentOwner,
|
|
7911
|
+
var pr = _.ReactCurrentOwner, gi = {
|
|
7899
7912
|
key: !0,
|
|
7900
7913
|
ref: !0,
|
|
7901
7914
|
__self: !0,
|
|
7902
7915
|
__source: !0
|
|
7903
7916
|
}, yr, br;
|
|
7904
|
-
function
|
|
7917
|
+
function _i(h) {
|
|
7905
7918
|
if (ut.call(h, "ref")) {
|
|
7906
7919
|
var S = Object.getOwnPropertyDescriptor(h, "ref").get;
|
|
7907
7920
|
if (S && S.isReactWarning)
|
|
@@ -7909,7 +7922,7 @@ function Du() {
|
|
|
7909
7922
|
}
|
|
7910
7923
|
return h.ref !== void 0;
|
|
7911
7924
|
}
|
|
7912
|
-
function
|
|
7925
|
+
function mi(h) {
|
|
7913
7926
|
if (ut.call(h, "key")) {
|
|
7914
7927
|
var S = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
7915
7928
|
if (S && S.isReactWarning)
|
|
@@ -7917,10 +7930,10 @@ function Du() {
|
|
|
7917
7930
|
}
|
|
7918
7931
|
return h.key !== void 0;
|
|
7919
7932
|
}
|
|
7920
|
-
function
|
|
7933
|
+
function wi(h, S) {
|
|
7921
7934
|
typeof h.ref == "string" && pr.current;
|
|
7922
7935
|
}
|
|
7923
|
-
function
|
|
7936
|
+
function Si(h, S) {
|
|
7924
7937
|
{
|
|
7925
7938
|
var E = function() {
|
|
7926
7939
|
yr || (yr = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", S));
|
|
@@ -7931,7 +7944,7 @@ function Du() {
|
|
|
7931
7944
|
});
|
|
7932
7945
|
}
|
|
7933
7946
|
}
|
|
7934
|
-
function
|
|
7947
|
+
function Ti(h, S) {
|
|
7935
7948
|
{
|
|
7936
7949
|
var E = function() {
|
|
7937
7950
|
br || (br = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", S));
|
|
@@ -7942,7 +7955,7 @@ function Du() {
|
|
|
7942
7955
|
});
|
|
7943
7956
|
}
|
|
7944
7957
|
}
|
|
7945
|
-
var
|
|
7958
|
+
var vi = function(h, S, E, M, z, Q, L) {
|
|
7946
7959
|
var $ = {
|
|
7947
7960
|
// This tag allows us to uniquely identify this as a React Element
|
|
7948
7961
|
$$typeof: t,
|
|
@@ -7971,12 +7984,12 @@ function Du() {
|
|
|
7971
7984
|
value: z
|
|
7972
7985
|
}), Object.freeze && (Object.freeze($.props), Object.freeze($)), $;
|
|
7973
7986
|
};
|
|
7974
|
-
function
|
|
7987
|
+
function Ei(h, S, E, M, z) {
|
|
7975
7988
|
{
|
|
7976
7989
|
var Q, L = {}, $ = null, fe = null;
|
|
7977
|
-
E !== void 0 && (hr(E), $ = "" + E),
|
|
7990
|
+
E !== void 0 && (hr(E), $ = "" + E), mi(S) && (hr(S.key), $ = "" + S.key), _i(S) && (fe = S.ref, wi(S, z));
|
|
7978
7991
|
for (Q in S)
|
|
7979
|
-
ut.call(S, Q) && !
|
|
7992
|
+
ut.call(S, Q) && !gi.hasOwnProperty(Q) && (L[Q] = S[Q]);
|
|
7980
7993
|
if (h && h.defaultProps) {
|
|
7981
7994
|
var ee = h.defaultProps;
|
|
7982
7995
|
for (Q in ee)
|
|
@@ -7984,9 +7997,9 @@ function Du() {
|
|
|
7984
7997
|
}
|
|
7985
7998
|
if ($ || fe) {
|
|
7986
7999
|
var re = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
7987
|
-
$ &&
|
|
8000
|
+
$ && Si(L, re), fe && Ti(L, re);
|
|
7988
8001
|
}
|
|
7989
|
-
return
|
|
8002
|
+
return vi(h, $, fe, z, M, pr.current, L);
|
|
7990
8003
|
}
|
|
7991
8004
|
}
|
|
7992
8005
|
var an = _.ReactCurrentOwner, gr = _.ReactDebugCurrentFrame;
|
|
@@ -8014,11 +8027,11 @@ Check the render method of \`` + h + "`.";
|
|
|
8014
8027
|
return "";
|
|
8015
8028
|
}
|
|
8016
8029
|
}
|
|
8017
|
-
function
|
|
8030
|
+
function Oi(h) {
|
|
8018
8031
|
return "";
|
|
8019
8032
|
}
|
|
8020
8033
|
var mr = {};
|
|
8021
|
-
function
|
|
8034
|
+
function ki(h) {
|
|
8022
8035
|
{
|
|
8023
8036
|
var S = _r();
|
|
8024
8037
|
if (!S) {
|
|
@@ -8035,7 +8048,7 @@ Check the top-level render call using <` + E + ">.");
|
|
|
8035
8048
|
if (!h._store || h._store.validated || h.key != null)
|
|
8036
8049
|
return;
|
|
8037
8050
|
h._store.validated = !0;
|
|
8038
|
-
var E =
|
|
8051
|
+
var E = ki(S);
|
|
8039
8052
|
if (mr[E])
|
|
8040
8053
|
return;
|
|
8041
8054
|
mr[E] = !0;
|
|
@@ -8062,7 +8075,7 @@ Check the top-level render call using <` + E + ">.");
|
|
|
8062
8075
|
}
|
|
8063
8076
|
}
|
|
8064
8077
|
}
|
|
8065
|
-
function
|
|
8078
|
+
function Ai(h) {
|
|
8066
8079
|
{
|
|
8067
8080
|
var S = h.type;
|
|
8068
8081
|
if (S == null || typeof S == "string")
|
|
@@ -8078,7 +8091,7 @@ Check the top-level render call using <` + E + ">.");
|
|
|
8078
8091
|
return;
|
|
8079
8092
|
if (E) {
|
|
8080
8093
|
var M = q(S);
|
|
8081
|
-
|
|
8094
|
+
hi(E, h.props, "prop", M, h);
|
|
8082
8095
|
} else if (S.PropTypes !== void 0 && !cn) {
|
|
8083
8096
|
cn = !0;
|
|
8084
8097
|
var z = q(S);
|
|
@@ -8087,7 +8100,7 @@ Check the top-level render call using <` + E + ">.");
|
|
|
8087
8100
|
typeof S.getDefaultProps == "function" && !S.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
8088
8101
|
}
|
|
8089
8102
|
}
|
|
8090
|
-
function
|
|
8103
|
+
function Ci(h) {
|
|
8091
8104
|
{
|
|
8092
8105
|
for (var S = Object.keys(h.props), E = 0; E < S.length; E++) {
|
|
8093
8106
|
var M = S[E];
|
|
@@ -8106,12 +8119,12 @@ Check the top-level render call using <` + E + ">.");
|
|
|
8106
8119
|
if (!L) {
|
|
8107
8120
|
var $ = "";
|
|
8108
8121
|
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && ($ += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
8109
|
-
var fe =
|
|
8122
|
+
var fe = Oi();
|
|
8110
8123
|
fe ? $ += fe : $ += _r();
|
|
8111
8124
|
var ee;
|
|
8112
8125
|
h === null ? ee = "null" : on(h) ? ee = "array" : h !== void 0 && h.$$typeof === t ? (ee = "<" + (q(h.type) || "Unknown") + " />", $ = " Did you accidentally export a JSX literal instead of a component?") : ee = typeof h, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ee, $);
|
|
8113
8126
|
}
|
|
8114
|
-
var re =
|
|
8127
|
+
var re = Ei(h, S, E, z, Q);
|
|
8115
8128
|
if (re == null)
|
|
8116
8129
|
return re;
|
|
8117
8130
|
if (L) {
|
|
@@ -8128,42 +8141,42 @@ Check the top-level render call using <` + E + ">.");
|
|
|
8128
8141
|
Sr(Se, h);
|
|
8129
8142
|
}
|
|
8130
8143
|
if (ut.call(S, "key")) {
|
|
8131
|
-
var De = q(h), pe = Object.keys(S).filter(function(
|
|
8132
|
-
return
|
|
8144
|
+
var De = q(h), pe = Object.keys(S).filter(function(xi) {
|
|
8145
|
+
return xi !== "key";
|
|
8133
8146
|
}), ln = pe.length > 0 ? "{key: someKey, " + pe.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
8134
8147
|
if (!Tr[De + ln]) {
|
|
8135
|
-
var
|
|
8148
|
+
var ji = pe.length > 0 ? "{" + pe.join(": ..., ") + ": ...}" : "{}";
|
|
8136
8149
|
w(`A props object containing a "key" prop is being spread into JSX:
|
|
8137
8150
|
let props = %s;
|
|
8138
8151
|
<%s {...props} />
|
|
8139
8152
|
React keys must be passed directly to JSX without using spread:
|
|
8140
8153
|
let props = %s;
|
|
8141
|
-
<%s key={someKey} {...props} />`, ln, De,
|
|
8154
|
+
<%s key={someKey} {...props} />`, ln, De, ji, De), Tr[De + ln] = !0;
|
|
8142
8155
|
}
|
|
8143
8156
|
}
|
|
8144
|
-
return h === s ?
|
|
8157
|
+
return h === s ? Ci(re) : Ai(re), re;
|
|
8145
8158
|
}
|
|
8146
8159
|
}
|
|
8147
|
-
function
|
|
8160
|
+
function Ii(h, S, E) {
|
|
8148
8161
|
return vr(h, S, E, !0);
|
|
8149
8162
|
}
|
|
8150
|
-
function
|
|
8163
|
+
function Pi(h, S, E) {
|
|
8151
8164
|
return vr(h, S, E, !1);
|
|
8152
8165
|
}
|
|
8153
|
-
var
|
|
8154
|
-
dt.Fragment = s, dt.jsx =
|
|
8166
|
+
var Mi = Pi, Ri = Ii;
|
|
8167
|
+
dt.Fragment = s, dt.jsx = Mi, dt.jsxs = Ri;
|
|
8155
8168
|
}(), dt;
|
|
8156
8169
|
}
|
|
8157
|
-
var
|
|
8158
|
-
|
|
8170
|
+
var Fu = {};
|
|
8171
|
+
Fu.NODE_ENV === "production" ? Fn.exports = Uu() : Fn.exports = Lu();
|
|
8159
8172
|
var ae = Fn.exports;
|
|
8160
|
-
const
|
|
8173
|
+
const Nu = {
|
|
8161
8174
|
isLoading: !0,
|
|
8162
8175
|
data: void 0,
|
|
8163
8176
|
pageInfo: void 0,
|
|
8164
8177
|
error: void 0
|
|
8165
8178
|
};
|
|
8166
|
-
function
|
|
8179
|
+
function us(n) {
|
|
8167
8180
|
return {
|
|
8168
8181
|
isLoading: !n,
|
|
8169
8182
|
data: void 0,
|
|
@@ -8172,10 +8185,10 @@ function cs(n) {
|
|
|
8172
8185
|
...n || {}
|
|
8173
8186
|
};
|
|
8174
8187
|
}
|
|
8175
|
-
function
|
|
8188
|
+
function Ku(n, e, t, r) {
|
|
8176
8189
|
e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
|
|
8177
|
-
const s = e ?
|
|
8178
|
-
(l) => (o.current =
|
|
8190
|
+
const s = e ? ai(e) : null, i = ce(s), o = $e(us(n._reactor.getPreviousResult(s))), a = $e(Nu), c = Me(
|
|
8191
|
+
(l) => (o.current = us(n._reactor.getPreviousResult(s)), l(), s ? n.subscribeQuery(s, (d) => {
|
|
8179
8192
|
o.current = {
|
|
8180
8193
|
isLoading: !d,
|
|
8181
8194
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
@@ -8193,19 +8206,19 @@ function Fu(n, e, t, r) {
|
|
|
8193
8206
|
);
|
|
8194
8207
|
return { state: Vt(c, () => o.current, () => a.current), query: s, queryHash: i };
|
|
8195
8208
|
}
|
|
8196
|
-
const
|
|
8209
|
+
const Wu = {
|
|
8197
8210
|
error: void 0,
|
|
8198
8211
|
data: void 0,
|
|
8199
8212
|
isLoading: !0,
|
|
8200
8213
|
canLoadNextPage: !1
|
|
8201
8214
|
};
|
|
8202
|
-
function
|
|
8203
|
-
const r = $e(null), s = ce(e), i = ce(t), o =
|
|
8215
|
+
function qu({ core: n, query: e, opts: t }) {
|
|
8216
|
+
const r = $e(null), s = ce(e), i = ce(t), o = ss(n, e, t), a = $e({
|
|
8204
8217
|
...o,
|
|
8205
8218
|
isLoading: !o.data && !o.error
|
|
8206
8219
|
}), c = Me((f) => {
|
|
8207
8220
|
r.current = null;
|
|
8208
|
-
const d =
|
|
8221
|
+
const d = ss(n, e, t);
|
|
8209
8222
|
if (a.current = {
|
|
8210
8223
|
...d,
|
|
8211
8224
|
isLoading: !d.data && !d.error
|
|
@@ -8223,14 +8236,14 @@ function Ku({ core: n, query: e, opts: t }) {
|
|
|
8223
8236
|
};
|
|
8224
8237
|
}, [s, i]);
|
|
8225
8238
|
return {
|
|
8226
|
-
...Vt(c, () => a.current, () =>
|
|
8239
|
+
...Vt(c, () => a.current, () => Wu),
|
|
8227
8240
|
loadNextPage: () => {
|
|
8228
8241
|
var f;
|
|
8229
8242
|
(f = r.current) == null || f.loadNextPage();
|
|
8230
8243
|
}
|
|
8231
8244
|
};
|
|
8232
8245
|
}
|
|
8233
|
-
function
|
|
8246
|
+
function zu() {
|
|
8234
8247
|
const n = $e(null);
|
|
8235
8248
|
We(() => {
|
|
8236
8249
|
t();
|
|
@@ -8243,14 +8256,14 @@ function Wu() {
|
|
|
8243
8256
|
}
|
|
8244
8257
|
return { set: e, clear: t };
|
|
8245
8258
|
}
|
|
8246
|
-
const
|
|
8247
|
-
function
|
|
8259
|
+
const Vu = 1e3;
|
|
8260
|
+
function Qu(n, e, t) {
|
|
8248
8261
|
const r = $e(t);
|
|
8249
8262
|
r.current = t, We(() => n.core._reactor.subscribeTopic(n.type, n.id, e, (i, o) => {
|
|
8250
8263
|
r.current(i, o);
|
|
8251
8264
|
}), [n.id, e]);
|
|
8252
8265
|
}
|
|
8253
|
-
function
|
|
8266
|
+
function Bu(n, e) {
|
|
8254
8267
|
return We(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]), Me((r) => {
|
|
8255
8268
|
n.core._reactor.publishTopic({
|
|
8256
8269
|
roomType: n.type,
|
|
@@ -8260,9 +8273,9 @@ function Vu(n, e) {
|
|
|
8260
8273
|
});
|
|
8261
8274
|
}, [n.id, e]);
|
|
8262
8275
|
}
|
|
8263
|
-
function
|
|
8276
|
+
function Gu(n, e = {}) {
|
|
8264
8277
|
var o, a;
|
|
8265
|
-
const [t, r] =
|
|
8278
|
+
const [t, r] = bs(() => n.core._reactor.getPresence(n.type, n.id, e) ?? {
|
|
8266
8279
|
peers: {},
|
|
8267
8280
|
isLoading: !0
|
|
8268
8281
|
});
|
|
@@ -8277,11 +8290,11 @@ function Qu(n, e = {}) {
|
|
|
8277
8290
|
publishPresence: s
|
|
8278
8291
|
}), [t, s]);
|
|
8279
8292
|
}
|
|
8280
|
-
function
|
|
8293
|
+
function Hu(n, e, t) {
|
|
8281
8294
|
We(() => n.core._reactor.joinRoom(n.type, n.id, e), [n.id]), We(() => n.core._reactor.publishPresence(n.type, n.id, e), [n.type, n.id, t ?? JSON.stringify(e)]);
|
|
8282
8295
|
}
|
|
8283
|
-
function
|
|
8284
|
-
const r =
|
|
8296
|
+
function Ju(n, e, t = {}) {
|
|
8297
|
+
const r = zu(), s = Le.usePresence(n, {
|
|
8285
8298
|
keys: [e]
|
|
8286
8299
|
}), i = Sn(() => {
|
|
8287
8300
|
const l = n._core._reactor.getPresence(n.type, n.id);
|
|
@@ -8289,7 +8302,7 @@ function Gu(n, e, t = {}) {
|
|
|
8289
8302
|
}, [t == null ? void 0 : t.writeOnly, s]), o = Me((l) => {
|
|
8290
8303
|
n.core._reactor.publishPresence(n.type, n.id, {
|
|
8291
8304
|
[e]: l
|
|
8292
|
-
}), l && ((t == null ? void 0 : t.timeout) === null || (t == null ? void 0 : t.timeout) === 0 || r.set((t == null ? void 0 : t.timeout) ??
|
|
8305
|
+
}), l && ((t == null ? void 0 : t.timeout) === null || (t == null ? void 0 : t.timeout) === 0 || r.set((t == null ? void 0 : t.timeout) ?? Vu, () => {
|
|
8293
8306
|
n.core._reactor.publishPresence(n.type, n.id, {
|
|
8294
8307
|
[e]: null
|
|
8295
8308
|
});
|
|
@@ -8307,13 +8320,13 @@ function Gu(n, e, t = {}) {
|
|
|
8307
8320
|
};
|
|
8308
8321
|
}
|
|
8309
8322
|
const Le = {
|
|
8310
|
-
useTopicEffect:
|
|
8311
|
-
usePublishTopic:
|
|
8312
|
-
usePresence:
|
|
8313
|
-
useSyncPresence:
|
|
8314
|
-
useTypingIndicator:
|
|
8323
|
+
useTopicEffect: Qu,
|
|
8324
|
+
usePublishTopic: Bu,
|
|
8325
|
+
usePresence: Gu,
|
|
8326
|
+
useSyncPresence: Hu,
|
|
8327
|
+
useTypingIndicator: Ju
|
|
8315
8328
|
};
|
|
8316
|
-
class
|
|
8329
|
+
class Yu {
|
|
8317
8330
|
constructor(e, t, r) {
|
|
8318
8331
|
p(this, "core");
|
|
8319
8332
|
/** @deprecated use `core` instead */
|
|
@@ -8400,7 +8413,7 @@ class Hu {
|
|
|
8400
8413
|
this.core = e, this._core = this.core, this.type = t, this.id = r;
|
|
8401
8414
|
}
|
|
8402
8415
|
}
|
|
8403
|
-
const
|
|
8416
|
+
const Zu = {
|
|
8404
8417
|
isLoading: !0,
|
|
8405
8418
|
user: void 0,
|
|
8406
8419
|
error: void 0
|
|
@@ -8436,7 +8449,7 @@ class Wt {
|
|
|
8436
8449
|
* console.log('Device ID:', deviceId)
|
|
8437
8450
|
*/
|
|
8438
8451
|
p(this, "useLocalId", (e) => {
|
|
8439
|
-
const [t, r] =
|
|
8452
|
+
const [t, r] = bs(null);
|
|
8440
8453
|
return We(() => {
|
|
8441
8454
|
(async () => {
|
|
8442
8455
|
const i = await this.getLocalId(e);
|
|
@@ -8504,7 +8517,7 @@ class Wt {
|
|
|
8504
8517
|
* auth.user ? { goals: {} } : null,
|
|
8505
8518
|
* );
|
|
8506
8519
|
*/
|
|
8507
|
-
p(this, "useQuery", (e, t) =>
|
|
8520
|
+
p(this, "useQuery", (e, t) => Ku(this.core, e, t).state);
|
|
8508
8521
|
/**
|
|
8509
8522
|
* Listen for the logged in state. This is useful
|
|
8510
8523
|
* for deciding when to show a login screen.
|
|
@@ -8624,7 +8637,7 @@ class Wt {
|
|
|
8624
8637
|
* },
|
|
8625
8638
|
* });
|
|
8626
8639
|
*/
|
|
8627
|
-
p(this, "useInfiniteQuery", (e, t) =>
|
|
8640
|
+
p(this, "useInfiniteQuery", (e, t) => qu({
|
|
8628
8641
|
core: this.core,
|
|
8629
8642
|
query: e,
|
|
8630
8643
|
opts: t
|
|
@@ -8657,7 +8670,7 @@ class Wt {
|
|
|
8657
8670
|
const t = this.useAuth();
|
|
8658
8671
|
return t.isLoading || t.error || t.user ? null : ae.jsx(ae.Fragment, { children: e });
|
|
8659
8672
|
});
|
|
8660
|
-
this.core =
|
|
8673
|
+
this.core = $u(
|
|
8661
8674
|
e,
|
|
8662
8675
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
8663
8676
|
e.Store || this.constructor.Store,
|
|
@@ -8681,13 +8694,13 @@ class Wt {
|
|
|
8681
8694
|
* const { peers } = db.rooms.usePresence(room);
|
|
8682
8695
|
*/
|
|
8683
8696
|
room(e = "_defaultRoomType", t = "_defaultRoomId") {
|
|
8684
|
-
return new
|
|
8697
|
+
return new Yu(this.core, e, t);
|
|
8685
8698
|
}
|
|
8686
8699
|
_useAuth() {
|
|
8687
8700
|
const e = $e(this.core._reactor._currentUserCached), t = Me((s) => this.core.subscribeAuth((o) => {
|
|
8688
8701
|
e.current = { isLoading: !1, ...o }, s();
|
|
8689
8702
|
}), []);
|
|
8690
|
-
return Vt(t, () => e.current, () =>
|
|
8703
|
+
return Vt(t, () => e.current, () => Zu);
|
|
8691
8704
|
}
|
|
8692
8705
|
/**
|
|
8693
8706
|
* One time query for the logged in state. This is useful
|
|
@@ -8704,14 +8717,14 @@ class Wt {
|
|
|
8704
8717
|
}
|
|
8705
8718
|
}
|
|
8706
8719
|
p(Wt, "Store"), p(Wt, "NetworkListener"), p(Wt, "EventSourceImpl");
|
|
8707
|
-
class
|
|
8720
|
+
class ls extends Error {
|
|
8708
8721
|
constructor(e, t) {
|
|
8709
8722
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
8710
8723
|
}
|
|
8711
8724
|
}
|
|
8712
8725
|
function wn(n) {
|
|
8713
8726
|
}
|
|
8714
|
-
function
|
|
8727
|
+
function Xu(n) {
|
|
8715
8728
|
if (typeof n == "function")
|
|
8716
8729
|
throw new TypeError(
|
|
8717
8730
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
@@ -8719,7 +8732,7 @@ function Yu(n) {
|
|
|
8719
8732
|
const { onEvent: e = wn, onError: t = wn, onRetry: r = wn, onComment: s } = n;
|
|
8720
8733
|
let i = "", o = !0, a, c = "", u = "";
|
|
8721
8734
|
function l(g) {
|
|
8722
|
-
const m = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [T, _] =
|
|
8735
|
+
const m = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [T, _] = el(`${i}${m}`);
|
|
8723
8736
|
for (const w of T)
|
|
8724
8737
|
f(w);
|
|
8725
8738
|
i = _, o = !1;
|
|
@@ -8755,7 +8768,7 @@ function Yu(n) {
|
|
|
8755
8768
|
break;
|
|
8756
8769
|
case "retry":
|
|
8757
8770
|
/^\d+$/.test(m) ? r(parseInt(m, 10)) : t(
|
|
8758
|
-
new
|
|
8771
|
+
new ls(`Invalid \`retry\` value: "${m}"`, {
|
|
8759
8772
|
type: "invalid-retry",
|
|
8760
8773
|
value: m,
|
|
8761
8774
|
line: T
|
|
@@ -8764,7 +8777,7 @@ function Yu(n) {
|
|
|
8764
8777
|
break;
|
|
8765
8778
|
default:
|
|
8766
8779
|
t(
|
|
8767
|
-
new
|
|
8780
|
+
new ls(
|
|
8768
8781
|
`Unknown field "${g.length > 20 ? `${g.slice(0, 20)}…` : g}"`,
|
|
8769
8782
|
{ type: "unknown-field", field: g, value: m, line: T }
|
|
8770
8783
|
)
|
|
@@ -8787,7 +8800,7 @@ function Yu(n) {
|
|
|
8787
8800
|
}
|
|
8788
8801
|
return { feed: l, reset: b };
|
|
8789
8802
|
}
|
|
8790
|
-
function
|
|
8803
|
+
function el(n) {
|
|
8791
8804
|
const e = [];
|
|
8792
8805
|
let t = "", r = 0;
|
|
8793
8806
|
for (; r < n.length; ) {
|
|
@@ -8805,7 +8818,7 @@ function Zu(n) {
|
|
|
8805
8818
|
}
|
|
8806
8819
|
return [e, t];
|
|
8807
8820
|
}
|
|
8808
|
-
class
|
|
8821
|
+
class fs extends Event {
|
|
8809
8822
|
/**
|
|
8810
8823
|
* Constructs a new `ErrorEvent` instance. This is typically not called directly,
|
|
8811
8824
|
* but rather emitted by the `EventSource` object when an error occurs.
|
|
@@ -8830,7 +8843,7 @@ class ls extends Event {
|
|
|
8830
8843
|
* @returns A string representation of the error
|
|
8831
8844
|
*/
|
|
8832
8845
|
[Symbol.for("nodejs.util.inspect.custom")](e, t, r) {
|
|
8833
|
-
return r(
|
|
8846
|
+
return r(ds(this), t);
|
|
8834
8847
|
}
|
|
8835
8848
|
/**
|
|
8836
8849
|
* Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -8844,17 +8857,17 @@ class ls extends Event {
|
|
|
8844
8857
|
* @returns A string representation of the error
|
|
8845
8858
|
*/
|
|
8846
8859
|
[Symbol.for("Deno.customInspect")](e, t) {
|
|
8847
|
-
return e(
|
|
8860
|
+
return e(ds(this), t);
|
|
8848
8861
|
}
|
|
8849
8862
|
}
|
|
8850
|
-
function
|
|
8863
|
+
function tl(n) {
|
|
8851
8864
|
const e = globalThis.DOMException;
|
|
8852
8865
|
return typeof e == "function" ? new e(n, "SyntaxError") : new SyntaxError(n);
|
|
8853
8866
|
}
|
|
8854
8867
|
function Nn(n) {
|
|
8855
8868
|
return n instanceof Error ? "errors" in n && Array.isArray(n.errors) ? n.errors.map(Nn).join(", ") : "cause" in n && n.cause instanceof Error ? `${n}: ${Nn(n.cause)}` : n.message : `${n}`;
|
|
8856
8869
|
}
|
|
8857
|
-
function
|
|
8870
|
+
function ds(n) {
|
|
8858
8871
|
return {
|
|
8859
8872
|
type: n.type,
|
|
8860
8873
|
message: n.message,
|
|
@@ -8864,9 +8877,9 @@ function fs(n) {
|
|
|
8864
8877
|
timeStamp: n.timeStamp
|
|
8865
8878
|
};
|
|
8866
8879
|
}
|
|
8867
|
-
var
|
|
8880
|
+
var ci = (n) => {
|
|
8868
8881
|
throw TypeError(n);
|
|
8869
|
-
}, cr = (n, e, t) => e.has(n) ||
|
|
8882
|
+
}, cr = (n, e, t) => e.has(n) || ci("Cannot " + t), x = (n, e, t) => (cr(n, e, "read from private field"), t ? t.call(n) : e.get(n)), ie = (n, e, t) => e.has(n) ? ci("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), Y = (n, e, t, r) => (cr(n, e, "write to private field"), e.set(n, t), t), Pe = (n, e, t) => (cr(n, e, "access private method"), t), ye, Fe, Ye, qt, Yt, Tt, nt, vt, xe, Ze, st, Xe, _t, Ee, Kn, Wn, qn, hs, zn, Vn, mt, Qn, Bn;
|
|
8870
8883
|
class zt extends EventTarget {
|
|
8871
8884
|
constructor(e, t) {
|
|
8872
8885
|
var r, s;
|
|
@@ -8919,13 +8932,13 @@ class zt extends EventTarget {
|
|
|
8919
8932
|
if (e instanceof URL)
|
|
8920
8933
|
Y(this, Fe, e);
|
|
8921
8934
|
else if (typeof e == "string")
|
|
8922
|
-
Y(this, Fe, new URL(e,
|
|
8935
|
+
Y(this, Fe, new URL(e, nl()));
|
|
8923
8936
|
else
|
|
8924
8937
|
throw new Error("Invalid URL");
|
|
8925
8938
|
} catch {
|
|
8926
|
-
throw
|
|
8939
|
+
throw tl("An invalid or illegal string was specified");
|
|
8927
8940
|
}
|
|
8928
|
-
Y(this, Ze,
|
|
8941
|
+
Y(this, Ze, Xu({
|
|
8929
8942
|
onEvent: x(this, zn),
|
|
8930
8943
|
onRetry: x(this, Vn)
|
|
8931
8944
|
})), Y(this, ye, this.CONNECTING), Y(this, Tt, 3e3), Y(this, Yt, (r = t == null ? void 0 : t.fetch) != null ? r : globalThis.fetch), Y(this, qt, (s = t == null ? void 0 : t.withCredentials) != null ? s : !1), Pe(this, Ee, Kn).call(this);
|
|
@@ -9007,14 +9020,14 @@ ye = /* @__PURE__ */ new WeakMap(), Fe = /* @__PURE__ */ new WeakMap(), Ye = /*
|
|
|
9007
9020
|
* @internal
|
|
9008
9021
|
*/
|
|
9009
9022
|
Kn = function() {
|
|
9010
|
-
Y(this, ye, this.CONNECTING), Y(this, xe, new AbortController()), x(this, Yt)(x(this, Fe), Pe(this, Ee,
|
|
9023
|
+
Y(this, ye, this.CONNECTING), Y(this, xe, new AbortController()), x(this, Yt)(x(this, Fe), Pe(this, Ee, hs).call(this)).then(x(this, Wn)).catch(x(this, qn));
|
|
9011
9024
|
}, Wn = /* @__PURE__ */ new WeakMap(), qn = /* @__PURE__ */ new WeakMap(), /**
|
|
9012
9025
|
* Get request options for the `fetch()` request
|
|
9013
9026
|
*
|
|
9014
9027
|
* @returns The request options
|
|
9015
9028
|
* @internal
|
|
9016
9029
|
*/
|
|
9017
|
-
|
|
9030
|
+
hs = function() {
|
|
9018
9031
|
var n;
|
|
9019
9032
|
const e = {
|
|
9020
9033
|
// [spec] Let `corsAttributeState` be `Anonymous`…
|
|
@@ -9036,7 +9049,7 @@ ds = function() {
|
|
|
9036
9049
|
mt = function(n, e) {
|
|
9037
9050
|
var t;
|
|
9038
9051
|
x(this, ye) !== this.CLOSED && Y(this, ye, this.CLOSED);
|
|
9039
|
-
const r = new
|
|
9052
|
+
const r = new fs("error", { code: e, message: n });
|
|
9040
9053
|
(t = x(this, st)) == null || t.call(this, r), this.dispatchEvent(r);
|
|
9041
9054
|
}, /**
|
|
9042
9055
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
@@ -9050,7 +9063,7 @@ Qn = function(n, e) {
|
|
|
9050
9063
|
if (x(this, ye) === this.CLOSED)
|
|
9051
9064
|
return;
|
|
9052
9065
|
Y(this, ye, this.CONNECTING);
|
|
9053
|
-
const r = new
|
|
9066
|
+
const r = new fs("error", { code: e, message: n });
|
|
9054
9067
|
(t = x(this, st)) == null || t.call(this, r), this.dispatchEvent(r), Y(this, nt, setTimeout(x(this, Bn), x(this, Tt)));
|
|
9055
9068
|
}, Bn = /* @__PURE__ */ new WeakMap(), /**
|
|
9056
9069
|
* ReadyState representing an EventSource currently trying to connect
|
|
@@ -9068,24 +9081,24 @@ zt.OPEN = 1, /**
|
|
|
9068
9081
|
* @public
|
|
9069
9082
|
*/
|
|
9070
9083
|
zt.CLOSED = 2;
|
|
9071
|
-
function
|
|
9084
|
+
function nl() {
|
|
9072
9085
|
const n = "document" in globalThis ? globalThis.document : void 0;
|
|
9073
9086
|
return n && typeof n == "object" && "baseURI" in n && typeof n.baseURI == "string" ? n.baseURI : void 0;
|
|
9074
9087
|
}
|
|
9075
|
-
class
|
|
9088
|
+
class ui extends Wt {
|
|
9076
9089
|
}
|
|
9077
|
-
p(
|
|
9078
|
-
function
|
|
9090
|
+
p(ui, "EventSourceImpl", zt);
|
|
9091
|
+
function rl(n) {
|
|
9079
9092
|
const e = {
|
|
9080
9093
|
...n,
|
|
9081
9094
|
useDateObjects: n.useDateObjects ?? !1
|
|
9082
9095
|
};
|
|
9083
|
-
return new
|
|
9096
|
+
return new ui(e, {
|
|
9084
9097
|
"@instantdb/react": ar
|
|
9085
9098
|
});
|
|
9086
9099
|
}
|
|
9087
|
-
const
|
|
9088
|
-
function
|
|
9100
|
+
const hl = rl;
|
|
9101
|
+
function pl({
|
|
9089
9102
|
as: n = "div",
|
|
9090
9103
|
spaceId: e,
|
|
9091
9104
|
room: t,
|
|
@@ -9137,7 +9150,7 @@ function dl({
|
|
|
9137
9150
|
[l]: void 0
|
|
9138
9151
|
});
|
|
9139
9152
|
}
|
|
9140
|
-
return
|
|
9153
|
+
return Ui(
|
|
9141
9154
|
n,
|
|
9142
9155
|
{
|
|
9143
9156
|
onMouseMove: b,
|
|
@@ -9156,9 +9169,9 @@ function dl({
|
|
|
9156
9169
|
"div",
|
|
9157
9170
|
{
|
|
9158
9171
|
style: {
|
|
9159
|
-
...
|
|
9160
|
-
...
|
|
9161
|
-
zIndex: u !== void 0 ? u :
|
|
9172
|
+
...ps,
|
|
9173
|
+
...il,
|
|
9174
|
+
zIndex: u !== void 0 ? u : ol
|
|
9162
9175
|
},
|
|
9163
9176
|
children: Object.entries(f.peers).map(([_, w]) => {
|
|
9164
9177
|
const C = w[l];
|
|
@@ -9166,7 +9179,7 @@ function dl({
|
|
|
9166
9179
|
"div",
|
|
9167
9180
|
{
|
|
9168
9181
|
style: {
|
|
9169
|
-
...
|
|
9182
|
+
...ps,
|
|
9170
9183
|
transform: `translate(${C.xPercent}%, ${C.yPercent}%)`,
|
|
9171
9184
|
transformOrigin: "0 0",
|
|
9172
9185
|
transition: "transform 100ms"
|
|
@@ -9174,7 +9187,7 @@ function dl({
|
|
|
9174
9187
|
children: a ? a({
|
|
9175
9188
|
color: C.color,
|
|
9176
9189
|
presence: d == null ? void 0 : d.peers[_]
|
|
9177
|
-
}) : /* @__PURE__ */ ae.jsx(
|
|
9190
|
+
}) : /* @__PURE__ */ ae.jsx(sl, { ...C })
|
|
9178
9191
|
},
|
|
9179
9192
|
_
|
|
9180
9193
|
) : null;
|
|
@@ -9185,7 +9198,7 @@ function dl({
|
|
|
9185
9198
|
]
|
|
9186
9199
|
);
|
|
9187
9200
|
}
|
|
9188
|
-
function
|
|
9201
|
+
function sl({ color: n }) {
|
|
9189
9202
|
const t = n || "black";
|
|
9190
9203
|
return /* @__PURE__ */ ae.jsxs(
|
|
9191
9204
|
"svg",
|
|
@@ -9232,30 +9245,30 @@ function nl({ color: n }) {
|
|
|
9232
9245
|
}
|
|
9233
9246
|
);
|
|
9234
9247
|
}
|
|
9235
|
-
const
|
|
9248
|
+
const ps = {
|
|
9236
9249
|
position: "absolute",
|
|
9237
9250
|
top: 0,
|
|
9238
9251
|
left: 0,
|
|
9239
9252
|
bottom: 0,
|
|
9240
9253
|
right: 0
|
|
9241
|
-
},
|
|
9254
|
+
}, il = {
|
|
9242
9255
|
overflow: "hidden",
|
|
9243
9256
|
pointerEvents: "none",
|
|
9244
9257
|
userSelect: "none"
|
|
9245
|
-
},
|
|
9258
|
+
}, ol = 99999;
|
|
9246
9259
|
export {
|
|
9247
|
-
|
|
9260
|
+
pl as Cursors,
|
|
9248
9261
|
en as InstantAPIError,
|
|
9249
9262
|
Wt as InstantReactAbstractDatabase,
|
|
9250
|
-
|
|
9251
|
-
|
|
9263
|
+
ui as InstantReactWebDatabase,
|
|
9264
|
+
rc as StoreInterface,
|
|
9252
9265
|
Ue as SyncTableCallbackEventType,
|
|
9253
|
-
|
|
9254
|
-
|
|
9266
|
+
dl as createInstantRouteHandler,
|
|
9267
|
+
fl as i,
|
|
9255
9268
|
Z as id,
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9269
|
+
rl as init,
|
|
9270
|
+
hl as init_experimental,
|
|
9271
|
+
Ca as lookup,
|
|
9272
|
+
ul as setInstantWarningsEnabled,
|
|
9273
|
+
ll as tx
|
|
9261
9274
|
};
|