@instantdb/core 0.22.90-experimental.drewh-ssr.20312174628.1 → 0.22.90-experimental.drewh-ssr.20347747146.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/commonjs/Reactor.d.ts.map +1 -1
- package/dist/commonjs/Reactor.js +4 -2
- package/dist/commonjs/Reactor.js.map +1 -1
- package/dist/commonjs/createRouteHandler.d.ts +0 -2
- package/dist/commonjs/createRouteHandler.d.ts.map +1 -1
- package/dist/commonjs/createRouteHandler.js +43 -34
- package/dist/commonjs/createRouteHandler.js.map +1 -1
- package/dist/commonjs/framework.d.ts.map +1 -1
- package/dist/commonjs/framework.js +1 -0
- package/dist/commonjs/framework.js.map +1 -1
- package/dist/commonjs/index.d.ts +1 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/Reactor.d.ts.map +1 -1
- package/dist/esm/Reactor.js +4 -2
- package/dist/esm/Reactor.js.map +1 -1
- package/dist/esm/createRouteHandler.d.ts +0 -2
- package/dist/esm/createRouteHandler.d.ts.map +1 -1
- package/dist/esm/createRouteHandler.js +43 -34
- package/dist/esm/createRouteHandler.js.map +1 -1
- package/dist/esm/framework.d.ts.map +1 -1
- package/dist/esm/framework.js +1 -0
- package/dist/esm/framework.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/standalone/index.js +93 -80
- package/dist/standalone/index.umd.cjs +3 -3
- package/package.json +2 -2
- package/src/Reactor.js +4 -2
- package/src/createRouteHandler.ts +38 -26
- package/src/framework.ts +1 -0
- package/src/index.ts +1 -1
package/dist/standalone/index.js
CHANGED
|
@@ -40,7 +40,7 @@ const I = {
|
|
|
40
40
|
Remove: "remove",
|
|
41
41
|
Replace: "replace",
|
|
42
42
|
Add: "add"
|
|
43
|
-
}, tn = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Hn = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), me = Symbol.iterator,
|
|
43
|
+
}, tn = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Hn = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), me = Symbol.iterator, F = {
|
|
44
44
|
mutable: "mutable",
|
|
45
45
|
immutable: "immutable"
|
|
46
46
|
}, it = {};
|
|
@@ -64,7 +64,7 @@ function ot(n) {
|
|
|
64
64
|
function at(n) {
|
|
65
65
|
return Object.getPrototypeOf(n) === Map.prototype;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function N(n) {
|
|
68
68
|
var e;
|
|
69
69
|
return (e = n.copy) !== null && e !== void 0 ? e : n.original;
|
|
70
70
|
}
|
|
@@ -83,7 +83,7 @@ function z(n, e) {
|
|
|
83
83
|
if (!n || typeof n != "object")
|
|
84
84
|
return !1;
|
|
85
85
|
let t;
|
|
86
|
-
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n,
|
|
86
|
+
return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, F)) === F.immutable || typeof t == "function");
|
|
87
87
|
}
|
|
88
88
|
function nn(n, e = []) {
|
|
89
89
|
if (Object.hasOwnProperty.call(n, "key")) {
|
|
@@ -116,7 +116,7 @@ function ye(n, e, t) {
|
|
|
116
116
|
}
|
|
117
117
|
function Re(n, e) {
|
|
118
118
|
const t = A(n);
|
|
119
|
-
return (t ?
|
|
119
|
+
return (t ? N(t) : n)[e];
|
|
120
120
|
}
|
|
121
121
|
function G(n, e) {
|
|
122
122
|
return n === e ? n !== 0 || 1 / n === 1 / e : n !== n && e !== e;
|
|
@@ -173,8 +173,8 @@ function rn(n, e) {
|
|
|
173
173
|
return new r(n);
|
|
174
174
|
}
|
|
175
175
|
return new Map(n);
|
|
176
|
-
} else if (e != null && e.mark && (t = e.mark(n,
|
|
177
|
-
if (t ===
|
|
176
|
+
} else if (e != null && e.mark && (t = e.mark(n, F), t !== void 0) && t !== F.mutable) {
|
|
177
|
+
if (t === F.immutable)
|
|
178
178
|
return Yn(n);
|
|
179
179
|
if (typeof t == "function") {
|
|
180
180
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
@@ -449,13 +449,13 @@ const Oe = (n, e, t = !1) => {
|
|
|
449
449
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
450
450
|
}, Ve = {
|
|
451
451
|
get size() {
|
|
452
|
-
return
|
|
452
|
+
return N(A(this)).size;
|
|
453
453
|
},
|
|
454
454
|
has(n) {
|
|
455
|
-
return
|
|
455
|
+
return N(A(this)).has(n);
|
|
456
456
|
},
|
|
457
457
|
set(n, e) {
|
|
458
|
-
const t = A(this), r =
|
|
458
|
+
const t = A(this), r = N(t);
|
|
459
459
|
return (!r.has(n) || !G(r.get(n), e)) && ($(t), Q(t), t.assignedMap.set(n, !0), t.copy.set(n, e), lt(t, n, e, he)), this;
|
|
460
460
|
},
|
|
461
461
|
delete(n) {
|
|
@@ -475,13 +475,13 @@ const Oe = (n, e, t = !1) => {
|
|
|
475
475
|
},
|
|
476
476
|
forEach(n, e) {
|
|
477
477
|
const t = A(this);
|
|
478
|
-
|
|
478
|
+
N(t).forEach((r, s) => {
|
|
479
479
|
n.call(e, this.get(s), s, this);
|
|
480
480
|
});
|
|
481
481
|
},
|
|
482
482
|
get(n) {
|
|
483
483
|
var e, t;
|
|
484
|
-
const r = A(this), s =
|
|
484
|
+
const r = A(this), s = N(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, F)) === F.mutable;
|
|
485
485
|
if (r.options.strict && Oe(s, r.options, i), i || r.finalized || !z(s, r.options) || s !== r.original.get(n))
|
|
486
486
|
return s;
|
|
487
487
|
const o = it.createDraft({
|
|
@@ -494,7 +494,7 @@ const Oe = (n, e, t = !1) => {
|
|
|
494
494
|
return $(r), r.copy.set(n, o), o;
|
|
495
495
|
},
|
|
496
496
|
keys() {
|
|
497
|
-
return
|
|
497
|
+
return N(A(this)).keys();
|
|
498
498
|
},
|
|
499
499
|
values() {
|
|
500
500
|
const n = this.keys();
|
|
@@ -535,7 +535,7 @@ const Oe = (n, e, t = !1) => {
|
|
|
535
535
|
return i;
|
|
536
536
|
const o = i.value;
|
|
537
537
|
let a = n.setMap.get(o);
|
|
538
|
-
const c = A(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a,
|
|
538
|
+
const c = A(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, F)) === F.mutable;
|
|
539
539
|
if (n.options.strict && Oe(o, n.options, u), !u && !c && z(o, n.options) && !n.finalized && n.original.has(o)) {
|
|
540
540
|
const l = it.createDraft({
|
|
541
541
|
original: o,
|
|
@@ -650,10 +650,10 @@ const sr = Reflect.ownKeys(ve), on = /* @__PURE__ */ new WeakSet(), an = {
|
|
|
650
650
|
let o;
|
|
651
651
|
if (n.options.mark) {
|
|
652
652
|
const u = e === "size" && (n.original instanceof Map || n.original instanceof Set) ? Reflect.get(n.original, e) : Reflect.get(n.original, e, t);
|
|
653
|
-
if (o = n.options.mark(u,
|
|
653
|
+
if (o = n.options.mark(u, F), o === F.mutable)
|
|
654
654
|
return n.options.strict && Oe(u, n.options, !0), u;
|
|
655
655
|
}
|
|
656
|
-
const a =
|
|
656
|
+
const a = N(n);
|
|
657
657
|
if (a instanceof Map && rr.includes(e)) {
|
|
658
658
|
if (e === "size")
|
|
659
659
|
return Object.getOwnPropertyDescriptor(Ve, "size").get.call(n.proxy);
|
|
@@ -700,20 +700,20 @@ const sr = Reflect.ownKeys(ve), on = /* @__PURE__ */ new WeakSet(), an = {
|
|
|
700
700
|
let s;
|
|
701
701
|
if (n.type === 1 && e !== "length" && !(Number.isInteger(s = Number(e)) && s >= 0 && (e === 0 || s === 0 || String(s) === String(e))))
|
|
702
702
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
703
|
-
const i = St(
|
|
703
|
+
const i = St(N(n), e);
|
|
704
704
|
if (i != null && i.set)
|
|
705
705
|
return i.set.call(n.proxy, t), !0;
|
|
706
|
-
const o = Re(
|
|
706
|
+
const o = Re(N(n), e), a = A(o);
|
|
707
707
|
return a && G(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (G(t, o) && (t !== void 0 || le(n.original, e)) || ($(n), Q(n), le(n.original, e) && G(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, lt(n, e, t, he)), !0);
|
|
708
708
|
},
|
|
709
709
|
has(n, e) {
|
|
710
|
-
return e in
|
|
710
|
+
return e in N(n);
|
|
711
711
|
},
|
|
712
712
|
ownKeys(n) {
|
|
713
|
-
return Reflect.ownKeys(
|
|
713
|
+
return Reflect.ownKeys(N(n));
|
|
714
714
|
},
|
|
715
715
|
getOwnPropertyDescriptor(n, e) {
|
|
716
|
-
const t =
|
|
716
|
+
const t = N(n), r = Reflect.getOwnPropertyDescriptor(t, e);
|
|
717
717
|
return r && {
|
|
718
718
|
writable: !0,
|
|
719
719
|
configurable: n.type !== 1 || e !== "length",
|
|
@@ -796,7 +796,7 @@ function or(n, e) {
|
|
|
796
796
|
};
|
|
797
797
|
let s, i;
|
|
798
798
|
e.enablePatches && (s = [], i = []);
|
|
799
|
-
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n,
|
|
799
|
+
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, F)) === F.mutable || !z(n, e) ? n : ft({
|
|
800
800
|
original: n,
|
|
801
801
|
parentDraft: null,
|
|
802
802
|
finalities: r,
|
|
@@ -1775,7 +1775,7 @@ function mn(n, e) {
|
|
|
1775
1775
|
const t = n.primaryKeys.get(e);
|
|
1776
1776
|
return t || ((r = n.forwardIdents.get(e)) == null ? void 0 : r.get("id"));
|
|
1777
1777
|
}
|
|
1778
|
-
function
|
|
1778
|
+
function Nr(n, e, t) {
|
|
1779
1779
|
const r = be(n, t);
|
|
1780
1780
|
if (!r)
|
|
1781
1781
|
return;
|
|
@@ -1783,7 +1783,7 @@ function Fr(n, e, t) {
|
|
|
1783
1783
|
if (e.getAttr(i))
|
|
1784
1784
|
return ie(n.eav, [s, i]);
|
|
1785
1785
|
}
|
|
1786
|
-
function
|
|
1786
|
+
function Fr(n, e, t) {
|
|
1787
1787
|
const r = t.filter(
|
|
1788
1788
|
([s, i, o, a, c]) => {
|
|
1789
1789
|
if (s !== "add-triple" && s !== "deep-merge-triple")
|
|
@@ -1798,7 +1798,7 @@ function Nr(n, e, t) {
|
|
|
1798
1798
|
e,
|
|
1799
1799
|
f["forward-identity"][1]
|
|
1800
1800
|
);
|
|
1801
|
-
l = !!
|
|
1801
|
+
l = !!Nr(n, e, [
|
|
1802
1802
|
i,
|
|
1803
1803
|
d == null ? void 0 : d.id,
|
|
1804
1804
|
i
|
|
@@ -2488,7 +2488,7 @@ const Lo = In();
|
|
|
2488
2488
|
function Ls(n) {
|
|
2489
2489
|
return n.__ops;
|
|
2490
2490
|
}
|
|
2491
|
-
function
|
|
2491
|
+
function Ns(n, e) {
|
|
2492
2492
|
const { attrIdMap: t, refSwapAttrIds: r } = n, s = [];
|
|
2493
2493
|
for (const o of e) {
|
|
2494
2494
|
const a = t[o];
|
|
@@ -2507,7 +2507,7 @@ function Fs(n, e) {
|
|
|
2507
2507
|
}
|
|
2508
2508
|
return s;
|
|
2509
2509
|
}
|
|
2510
|
-
function
|
|
2510
|
+
function Fs(n) {
|
|
2511
2511
|
if (Array.isArray(n))
|
|
2512
2512
|
return n;
|
|
2513
2513
|
const e = Object.entries(n);
|
|
@@ -2537,7 +2537,7 @@ function Ks(n, e, t) {
|
|
|
2537
2537
|
return s;
|
|
2538
2538
|
}
|
|
2539
2539
|
function Xe(n) {
|
|
2540
|
-
return typeof n == "string" && !Ie(n) ? null : typeof n == "string" && Ie(n) ? En(n) :
|
|
2540
|
+
return typeof n == "string" && !Ie(n) ? null : typeof n == "string" && Ie(n) ? En(n) : Fs(n);
|
|
2541
2541
|
}
|
|
2542
2542
|
function U(n, e, t) {
|
|
2543
2543
|
const r = Xe(t);
|
|
@@ -3232,7 +3232,7 @@ async function gi(n, e) {
|
|
|
3232
3232
|
s.oncomplete = (d) => l(d), s.onerror = (d) => f(d), s.onabort = (d) => f(d);
|
|
3233
3233
|
});
|
|
3234
3234
|
}
|
|
3235
|
-
const
|
|
3235
|
+
const Nt = /* @__PURE__ */ new Map();
|
|
3236
3236
|
class Pn extends fi {
|
|
3237
3237
|
constructor(e, t) {
|
|
3238
3238
|
super(e, t), this.dbName = `instant_${e}_${di}`, this._storeName = t, this._appId = e, this._dbPromise = this._init();
|
|
@@ -3249,9 +3249,9 @@ class Pn extends fi {
|
|
|
3249
3249
|
const c = gi(this._appId, a).catch((u) => {
|
|
3250
3250
|
pi("Error upgrading store from version 5 to 6.")(u);
|
|
3251
3251
|
});
|
|
3252
|
-
|
|
3252
|
+
Nt.set(this.dbName, c), c.then(() => e(a)).catch(() => e(a));
|
|
3253
3253
|
} else {
|
|
3254
|
-
const c =
|
|
3254
|
+
const c = Nt.get(this.dbName);
|
|
3255
3255
|
c ? c.then(() => e(a)).catch(() => e(a)) : e(a);
|
|
3256
3256
|
}
|
|
3257
3257
|
}, s.onupgradeneeded = (i) => {
|
|
@@ -3422,7 +3422,7 @@ async function mi({
|
|
|
3422
3422
|
})
|
|
3423
3423
|
});
|
|
3424
3424
|
}
|
|
3425
|
-
async function
|
|
3425
|
+
async function Ft({
|
|
3426
3426
|
apiURI: n,
|
|
3427
3427
|
appId: e,
|
|
3428
3428
|
code: t,
|
|
@@ -3639,7 +3639,7 @@ function nt(n) {
|
|
|
3639
3639
|
}, e;
|
|
3640
3640
|
}, {});
|
|
3641
3641
|
}
|
|
3642
|
-
const xn = "v0.22.90-experimental.drewh-ssr.
|
|
3642
|
+
const xn = "v0.22.90-experimental.drewh-ssr.20347747146.1";
|
|
3643
3643
|
function Pi(n, e) {
|
|
3644
3644
|
return {
|
|
3645
3645
|
info: n ? (...t) => console.info(...t, e()) : () => {
|
|
@@ -4010,7 +4010,7 @@ const Vt = [
|
|
|
4010
4010
|
r ? `${r}.where` : "where"
|
|
4011
4011
|
);
|
|
4012
4012
|
}
|
|
4013
|
-
},
|
|
4013
|
+
}, Nn = (n, e, t, r, s = 0) => {
|
|
4014
4014
|
var i;
|
|
4015
4015
|
if (!n || typeof n != "object")
|
|
4016
4016
|
throw new k(
|
|
@@ -4029,7 +4029,7 @@ const Vt = [
|
|
|
4029
4029
|
const a = n[o];
|
|
4030
4030
|
if (typeof a == "object" && a !== null) {
|
|
4031
4031
|
const c = (i = t == null ? void 0 : t.entities[e].links[o]) == null ? void 0 : i.entityName;
|
|
4032
|
-
c &&
|
|
4032
|
+
c && Nn(
|
|
4033
4033
|
a,
|
|
4034
4034
|
c,
|
|
4035
4035
|
t,
|
|
@@ -4081,7 +4081,7 @@ const Vt = [
|
|
|
4081
4081
|
r
|
|
4082
4082
|
);
|
|
4083
4083
|
}
|
|
4084
|
-
|
|
4084
|
+
Nn(
|
|
4085
4085
|
t[r],
|
|
4086
4086
|
r,
|
|
4087
4087
|
e,
|
|
@@ -4097,8 +4097,8 @@ class q extends Error {
|
|
|
4097
4097
|
super(e), this.name = "TransactionValidationError";
|
|
4098
4098
|
}
|
|
4099
4099
|
}
|
|
4100
|
-
const
|
|
4101
|
-
`Entity '${n}' does not exist in schema. Available entities: ${
|
|
4100
|
+
const Fn = (n) => n.length > 0 ? n.join(", ") : "none", xi = (n, e) => new q(
|
|
4101
|
+
`Entity '${n}' does not exist in schema. Available entities: ${Fn(e)}`
|
|
4102
4102
|
), Ue = {
|
|
4103
4103
|
string: (n) => typeof n == "string",
|
|
4104
4104
|
number: (n) => typeof n == "number" && !isNaN(n),
|
|
@@ -4137,7 +4137,7 @@ const Nn = (n) => n.length > 0 ? n.join(", ") : "none", xi = (n, e) => new q(
|
|
|
4137
4137
|
if (!r.links[s]) {
|
|
4138
4138
|
const a = Object.keys(r.links);
|
|
4139
4139
|
throw new q(
|
|
4140
|
-
`Link '${s}' does not exist on entity '${n}'. Available links: ${
|
|
4140
|
+
`Link '${s}' does not exist on entity '${n}'. Available links: ${Fn(a)}`
|
|
4141
4141
|
);
|
|
4142
4142
|
}
|
|
4143
4143
|
if (i != null) {
|
|
@@ -4161,7 +4161,7 @@ const Nn = (n) => n.length > 0 ? n.join(", ") : "none", xi = (n, e) => new q(
|
|
|
4161
4161
|
unlink: Gt,
|
|
4162
4162
|
delete: () => {
|
|
4163
4163
|
}
|
|
4164
|
-
},
|
|
4164
|
+
}, Ni = (n, e) => {
|
|
4165
4165
|
if (!e) return;
|
|
4166
4166
|
const [t, r, s, i] = n;
|
|
4167
4167
|
if (!Array.isArray(s) && !re(s))
|
|
@@ -4174,7 +4174,7 @@ const Nn = (n) => n.length > 0 ? n.join(", ") : "none", xi = (n, e) => new q(
|
|
|
4174
4174
|
);
|
|
4175
4175
|
const o = Li[t];
|
|
4176
4176
|
o && i !== void 0 && o(r, i, e);
|
|
4177
|
-
},
|
|
4177
|
+
}, Fi = (n, e) => {
|
|
4178
4178
|
const t = Array.isArray(n) ? n : [n];
|
|
4179
4179
|
for (const r of t) {
|
|
4180
4180
|
if (!r || typeof r != "object")
|
|
@@ -4190,7 +4190,7 @@ const Nn = (n) => n.length > 0 ? n.join(", ") : "none", xi = (n, e) => new q(
|
|
|
4190
4190
|
throw new q(
|
|
4191
4191
|
`Transaction operation must be an array, but received: ${typeof s}`
|
|
4192
4192
|
);
|
|
4193
|
-
|
|
4193
|
+
Ni(s, e);
|
|
4194
4194
|
}
|
|
4195
4195
|
}
|
|
4196
4196
|
};
|
|
@@ -4338,7 +4338,7 @@ function Vi(n, e, t) {
|
|
|
4338
4338
|
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;
|
|
4339
4339
|
return r && (!s || r > s) ? e : s && (!r || s > r) ? t : e || t;
|
|
4340
4340
|
}
|
|
4341
|
-
function
|
|
4341
|
+
function Ne(n, e, t) {
|
|
4342
4342
|
return bt(
|
|
4343
4343
|
{ store: e, attrsStore: t, pageInfo: null, aggregate: null },
|
|
4344
4344
|
n.query
|
|
@@ -4580,7 +4580,7 @@ class Hi {
|
|
|
4580
4580
|
o.values = a;
|
|
4581
4581
|
const c = a.entities;
|
|
4582
4582
|
for (const u of r) {
|
|
4583
|
-
const l = this.createStore(u), f =
|
|
4583
|
+
const l = this.createStore(u), f = Ne(o, l, a.attrsStore);
|
|
4584
4584
|
c.push({
|
|
4585
4585
|
store: l,
|
|
4586
4586
|
entity: f,
|
|
@@ -4661,7 +4661,7 @@ class Hi {
|
|
|
4661
4661
|
const w = f[y];
|
|
4662
4662
|
if (Ir(w.store, _)) {
|
|
4663
4663
|
Jt(w.store, l.attrsStore, g);
|
|
4664
|
-
const S =
|
|
4664
|
+
const S = Ne(s, w.store, l.attrsStore), m = Qi(
|
|
4665
4665
|
w.store,
|
|
4666
4666
|
l.attrsStore,
|
|
4667
4667
|
g
|
|
@@ -4678,7 +4678,7 @@ class Hi {
|
|
|
4678
4678
|
for (const [_, g] of Object.entries(u)) {
|
|
4679
4679
|
const y = this.createStore([]);
|
|
4680
4680
|
Jt(y, l.attrsStore, g);
|
|
4681
|
-
const w =
|
|
4681
|
+
const w = Ne(s, y, l.attrsStore);
|
|
4682
4682
|
if (!w) {
|
|
4683
4683
|
this.log.error("No entity found after applying change", {
|
|
4684
4684
|
sub: s,
|
|
@@ -4752,7 +4752,7 @@ const W = {
|
|
|
4752
4752
|
}, Ji = 3e4, Yi = 3e4, Zi = 200, Xi = {
|
|
4753
4753
|
apiURI: "https://api.instantdb.com",
|
|
4754
4754
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
4755
|
-
},
|
|
4755
|
+
}, Fe = "_instant_oauth_redirect", oe = "currentUser";
|
|
4756
4756
|
function eo({
|
|
4757
4757
|
transportType: n,
|
|
4758
4758
|
appId: e,
|
|
@@ -4937,7 +4937,7 @@ class ao {
|
|
|
4937
4937
|
});
|
|
4938
4938
|
/** Applies transactions locally and sends transact message to server */
|
|
4939
4939
|
T(this, "pushTx", (e) => {
|
|
4940
|
-
this.config.disableValidation ||
|
|
4940
|
+
this.config.disableValidation || Fi(e, this.config.schema);
|
|
4941
4941
|
try {
|
|
4942
4942
|
const t = li(
|
|
4943
4943
|
{
|
|
@@ -5634,7 +5634,7 @@ class ao {
|
|
|
5634
5634
|
a = !0;
|
|
5635
5635
|
continue;
|
|
5636
5636
|
}
|
|
5637
|
-
const b = a ?
|
|
5637
|
+
const b = a ? Ns(o, h) : h;
|
|
5638
5638
|
d.push(b);
|
|
5639
5639
|
}
|
|
5640
5640
|
return a ? d : l;
|
|
@@ -5708,7 +5708,7 @@ class ao {
|
|
|
5708
5708
|
_applyOptimisticUpdates(e, t, r, s) {
|
|
5709
5709
|
for (const [i, o] of r)
|
|
5710
5710
|
if (!o["tx-id"] || s && o["tx-id"] > s) {
|
|
5711
|
-
const a =
|
|
5711
|
+
const a = Fr(e, t, o["tx-steps"]);
|
|
5712
5712
|
e = a.store, t = a.attrsStore;
|
|
5713
5713
|
}
|
|
5714
5714
|
return { store: e, attrsStore: t };
|
|
@@ -5872,9 +5872,9 @@ class ao {
|
|
|
5872
5872
|
if (typeof URL > "u")
|
|
5873
5873
|
return;
|
|
5874
5874
|
const e = new URL(window.location.href);
|
|
5875
|
-
if (e.searchParams.get(
|
|
5875
|
+
if (e.searchParams.get(Fe)) {
|
|
5876
5876
|
const t = e.toString();
|
|
5877
|
-
e.searchParams.delete(
|
|
5877
|
+
e.searchParams.delete(Fe), e.searchParams.delete("code"), e.searchParams.delete("error");
|
|
5878
5878
|
const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
|
|
5879
5879
|
if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
|
|
5880
5880
|
typeof navigation == "object" && // @ts-ignore (waiting for ts support)
|
|
@@ -5898,7 +5898,7 @@ class ao {
|
|
|
5898
5898
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
5899
5899
|
return null;
|
|
5900
5900
|
const e = new URLSearchParams(window.location.search);
|
|
5901
|
-
if (!e.get(
|
|
5901
|
+
if (!e.get(Fe))
|
|
5902
5902
|
return null;
|
|
5903
5903
|
const t = e.get("error");
|
|
5904
5904
|
if (t)
|
|
@@ -5908,7 +5908,7 @@ class ao {
|
|
|
5908
5908
|
return null;
|
|
5909
5909
|
this._replaceUrlAfterOAuth();
|
|
5910
5910
|
try {
|
|
5911
|
-
const c = await this._getCurrentUser(), u = (c == null ? void 0 : c.type) === "guest", { user: l } = await
|
|
5911
|
+
const c = await this._getCurrentUser(), u = (c == null ? void 0 : c.type) === "guest", { user: l } = await Ft({
|
|
5912
5912
|
apiURI: this.config.apiURI,
|
|
5913
5913
|
appId: this.config.appId,
|
|
5914
5914
|
code: r,
|
|
@@ -6019,11 +6019,13 @@ class ao {
|
|
|
6019
6019
|
}
|
|
6020
6020
|
}
|
|
6021
6021
|
async syncUserToEndpoint(e) {
|
|
6022
|
-
if (this.config.
|
|
6022
|
+
if (this.config.firstPartyPath)
|
|
6023
6023
|
try {
|
|
6024
|
-
fetch(this.config.
|
|
6024
|
+
fetch(this.config.firstPartyPath + "/", {
|
|
6025
6025
|
method: "POST",
|
|
6026
6026
|
body: JSON.stringify({
|
|
6027
|
+
type: "sync-user",
|
|
6028
|
+
appId: this.config.appId,
|
|
6027
6029
|
user: e
|
|
6028
6030
|
}),
|
|
6029
6031
|
headers: {
|
|
@@ -6117,7 +6119,7 @@ class ao {
|
|
|
6117
6119
|
*/
|
|
6118
6120
|
async exchangeCodeForToken({ code: e, codeVerifier: t }) {
|
|
6119
6121
|
var o;
|
|
6120
|
-
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await
|
|
6122
|
+
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await Ft({
|
|
6121
6123
|
apiURI: this.config.apiURI,
|
|
6122
6124
|
appId: this.config.appId,
|
|
6123
6125
|
code: e,
|
|
@@ -6540,38 +6542,49 @@ function Oo(n) {
|
|
|
6540
6542
|
}
|
|
6541
6543
|
return { element: e, isVisible: t };
|
|
6542
6544
|
}
|
|
6543
|
-
const
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
return r.user && r.user.refresh_token ? new Response("sync", {
|
|
6545
|
+
const No = (n) => {
|
|
6546
|
+
function e(r) {
|
|
6547
|
+
return r && r.refresh_token ? new Response(JSON.stringify({ ok: !0 }), {
|
|
6547
6548
|
headers: {
|
|
6549
|
+
"Content-Type": "application/json",
|
|
6548
6550
|
// 7 day expiry
|
|
6549
|
-
"Set-Cookie": `
|
|
6551
|
+
"Set-Cookie": `instant_user_${n.appId}=${JSON.stringify(r)}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=604800`
|
|
6550
6552
|
}
|
|
6551
|
-
}) : new Response(
|
|
6553
|
+
}) : new Response(JSON.stringify({ ok: !0 }), {
|
|
6552
6554
|
headers: {
|
|
6555
|
+
"Content-Type": "application/json",
|
|
6553
6556
|
// remove the cookie (some browsers)
|
|
6554
|
-
"Set-Cookie":
|
|
6557
|
+
"Set-Cookie": `instant_user_${n.appId}=; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=-1`
|
|
6555
6558
|
}
|
|
6556
6559
|
});
|
|
6557
6560
|
}
|
|
6561
|
+
function t(r, s) {
|
|
6562
|
+
return new Response(JSON.stringify({ ok: !1, error: s }), {
|
|
6563
|
+
status: r,
|
|
6564
|
+
headers: { "Content-Type": "application/json" }
|
|
6565
|
+
});
|
|
6566
|
+
}
|
|
6558
6567
|
return {
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
+
POST: async (r) => {
|
|
6569
|
+
let s;
|
|
6570
|
+
try {
|
|
6571
|
+
s = await r.json();
|
|
6572
|
+
} catch {
|
|
6573
|
+
return t(400, "Invalid JSON body");
|
|
6574
|
+
}
|
|
6575
|
+
if (!s.type)
|
|
6576
|
+
return t(400, 'Missing "type" field');
|
|
6577
|
+
if (s.appId !== n.appId)
|
|
6578
|
+
return t(403, "App ID mismatch");
|
|
6579
|
+
switch (s.type) {
|
|
6580
|
+
case "sync-user":
|
|
6581
|
+
return e(s.user ?? null);
|
|
6582
|
+
default:
|
|
6583
|
+
return t(400, `Unknown type: ${s.type}`);
|
|
6568
6584
|
}
|
|
6569
|
-
return new Response("Route not found", {
|
|
6570
|
-
status: 404
|
|
6571
|
-
});
|
|
6572
6585
|
}
|
|
6573
6586
|
};
|
|
6574
|
-
},
|
|
6587
|
+
}, Fo = (n) => {
|
|
6575
6588
|
var i, o, a, c, u, l;
|
|
6576
6589
|
const e = {};
|
|
6577
6590
|
for (const [f, d] of Object.entries(n.entities)) {
|
|
@@ -6704,7 +6717,7 @@ class qo {
|
|
|
6704
6717
|
u.status = "success", u.data = l, u.promise = null;
|
|
6705
6718
|
}), c.catch((l) => {
|
|
6706
6719
|
u.status = "error", u.error = l, u.promise = null;
|
|
6707
|
-
}), u;
|
|
6720
|
+
}), this.resultMap.set(s, u), u;
|
|
6708
6721
|
}
|
|
6709
6722
|
const o = this.getTriplesAndAttrsForQuery(i);
|
|
6710
6723
|
let a = {
|
|
@@ -7055,18 +7068,18 @@ export {
|
|
|
7055
7068
|
jn as WindowNetworkListener,
|
|
7056
7069
|
Po as coerceQuery,
|
|
7057
7070
|
Ce as coerceToDate,
|
|
7058
|
-
|
|
7071
|
+
No as createInstantRouteHandler,
|
|
7059
7072
|
Ls as getOps,
|
|
7060
7073
|
E as i,
|
|
7061
7074
|
P as id,
|
|
7062
7075
|
Do as init,
|
|
7063
7076
|
Ko as init_experimental,
|
|
7064
7077
|
Uo as lookup,
|
|
7065
|
-
|
|
7078
|
+
Fo as parseSchemaFromJSON,
|
|
7066
7079
|
Lo as tx,
|
|
7067
7080
|
In as txInit,
|
|
7068
7081
|
Qt as validateQuery,
|
|
7069
|
-
|
|
7082
|
+
Fi as validateTransactions,
|
|
7070
7083
|
xn as version,
|
|
7071
7084
|
M as weakHash
|
|
7072
7085
|
};
|