@instantdb/react 0.22.93-experimental.drewh-ssr.20383114333.1 → 0.22.93-experimental.drewh-ssr.20384561223.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/next-ssr/HydrationStreamProvider.d.ts.map +1 -1
- package/dist/commonjs/next-ssr/HydrationStreamProvider.js +2 -0
- package/dist/commonjs/next-ssr/HydrationStreamProvider.js.map +1 -1
- package/dist/commonjs/next-ssr/{getUserOnServer.d.ts → getUserFromInstantCookie.d.ts} +1 -1
- package/dist/commonjs/next-ssr/getUserFromInstantCookie.d.ts.map +1 -0
- package/dist/commonjs/next-ssr/{getUserOnServer.js → getUserFromInstantCookie.js} +1 -1
- package/dist/commonjs/next-ssr/getUserFromInstantCookie.js.map +1 -0
- package/dist/commonjs/next-ssr/index.d.ts +1 -1
- package/dist/commonjs/next-ssr/index.d.ts.map +1 -1
- package/dist/commonjs/next-ssr/index.js +2 -2
- package/dist/commonjs/next-ssr/index.js.map +1 -1
- package/dist/esm/next-ssr/HydrationStreamProvider.d.ts.map +1 -1
- package/dist/esm/next-ssr/HydrationStreamProvider.js +2 -0
- package/dist/esm/next-ssr/HydrationStreamProvider.js.map +1 -1
- package/dist/esm/next-ssr/{getUserOnServer.d.ts → getUserFromInstantCookie.d.ts} +1 -1
- package/dist/esm/next-ssr/getUserFromInstantCookie.d.ts.map +1 -0
- package/dist/esm/next-ssr/{getUserOnServer.js → getUserFromInstantCookie.js} +1 -1
- package/dist/esm/next-ssr/getUserFromInstantCookie.js.map +1 -0
- package/dist/esm/next-ssr/index.d.ts +1 -1
- package/dist/esm/next-ssr/index.d.ts.map +1 -1
- package/dist/esm/next-ssr/index.js +1 -1
- package/dist/esm/next-ssr/index.js.map +1 -1
- package/dist/standalone/index.js +121 -121
- package/dist/standalone/index.umd.cjs +12 -12
- package/package.json +4 -4
- package/src/next-ssr/HydrationStreamProvider.tsx +2 -0
- package/src/next-ssr/index.tsx +1 -1
- package/dist/commonjs/next-ssr/getUserOnServer.d.ts.map +0 -1
- package/dist/commonjs/next-ssr/getUserOnServer.js.map +0 -1
- package/dist/esm/next-ssr/getUserOnServer.d.ts.map +0 -1
- package/dist/esm/next-ssr/getUserOnServer.js.map +0 -1
- /package/src/next-ssr/{getUserOnServer.ts → getUserFromInstantCookie.ts} +0 -0
package/dist/standalone/index.js
CHANGED
|
@@ -2343,7 +2343,7 @@ function hn(t, e, n) {
|
|
|
2343
2343
|
}
|
|
2344
2344
|
});
|
|
2345
2345
|
}
|
|
2346
|
-
function
|
|
2346
|
+
function Lc(t, e) {
|
|
2347
2347
|
return `lookup__${t}__${JSON.stringify(e)}`;
|
|
2348
2348
|
}
|
|
2349
2349
|
function Mt(t) {
|
|
@@ -2372,7 +2372,7 @@ function Kn() {
|
|
|
2372
2372
|
}
|
|
2373
2373
|
});
|
|
2374
2374
|
}
|
|
2375
|
-
const
|
|
2375
|
+
const Fc = Kn();
|
|
2376
2376
|
function yu(t) {
|
|
2377
2377
|
return t.__ops;
|
|
2378
2378
|
}
|
|
@@ -3650,7 +3650,7 @@ function Ur(t) {
|
|
|
3650
3650
|
}, e;
|
|
3651
3651
|
}, {});
|
|
3652
3652
|
}
|
|
3653
|
-
const Wn = "v0.22.93-experimental.drewh-ssr.
|
|
3653
|
+
const Wn = "v0.22.93-experimental.drewh-ssr.20384561223.1";
|
|
3654
3654
|
function da(t, e) {
|
|
3655
3655
|
return {
|
|
3656
3656
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -4602,11 +4602,11 @@ const he = {
|
|
|
4602
4602
|
AUTHENTICATED: "authenticated",
|
|
4603
4603
|
CLOSED: "closed",
|
|
4604
4604
|
ERRORED: "errored"
|
|
4605
|
-
}, ja = 3e4, Ca = 3e4, Ia = 200, Pa = {
|
|
4605
|
+
}, ja = 3e4, Ca = 3e4, Ia = 200, Pa = 1e3 * 60, Ma = {
|
|
4606
4606
|
apiURI: "https://api.instantdb.com",
|
|
4607
4607
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
4608
4608
|
}, Zt = "_instant_oauth_redirect", Ge = "currentUser";
|
|
4609
|
-
function
|
|
4609
|
+
function Ra({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
4610
4610
|
if (!i)
|
|
4611
4611
|
return new zr(`${r}?app_id=${e}`);
|
|
4612
4612
|
switch (t) {
|
|
@@ -4618,7 +4618,7 @@ function Ma({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl:
|
|
|
4618
4618
|
throw new Error("Unknown transport type " + t);
|
|
4619
4619
|
}
|
|
4620
4620
|
}
|
|
4621
|
-
function
|
|
4621
|
+
function xa() {
|
|
4622
4622
|
return typeof window < "u" || typeof chrome < "u";
|
|
4623
4623
|
}
|
|
4624
4624
|
const Qr = {
|
|
@@ -4627,7 +4627,7 @@ const Qr = {
|
|
|
4627
4627
|
"refresh-presence": !0,
|
|
4628
4628
|
"patch-presence": !0
|
|
4629
4629
|
};
|
|
4630
|
-
function
|
|
4630
|
+
function $a(t, e) {
|
|
4631
4631
|
var n;
|
|
4632
4632
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
4633
4633
|
if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
|
|
@@ -4639,7 +4639,7 @@ function xa(t, e) {
|
|
|
4639
4639
|
}
|
|
4640
4640
|
return r;
|
|
4641
4641
|
}
|
|
4642
|
-
function
|
|
4642
|
+
function Da(t, e) {
|
|
4643
4643
|
const { result: n } = e, i = Qi(e, ["result"]);
|
|
4644
4644
|
if (n) {
|
|
4645
4645
|
const s = Object.assign(Object.assign({}, n), { store: wi(n.store), attrsStore: n.attrsStore.toJSON() });
|
|
@@ -4647,7 +4647,7 @@ function $a(t, e) {
|
|
|
4647
4647
|
}
|
|
4648
4648
|
return i;
|
|
4649
4649
|
}
|
|
4650
|
-
function
|
|
4650
|
+
function Ua(t, e) {
|
|
4651
4651
|
switch (t) {
|
|
4652
4652
|
case "pendingMutations":
|
|
4653
4653
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -4655,7 +4655,7 @@ function Da(t, e) {
|
|
|
4655
4655
|
return e;
|
|
4656
4656
|
}
|
|
4657
4657
|
}
|
|
4658
|
-
function
|
|
4658
|
+
function La(t, e) {
|
|
4659
4659
|
switch (t) {
|
|
4660
4660
|
case "pendingMutations":
|
|
4661
4661
|
return [...e.entries()];
|
|
@@ -4663,7 +4663,7 @@ function Ua(t, e) {
|
|
|
4663
4663
|
return e;
|
|
4664
4664
|
}
|
|
4665
4665
|
}
|
|
4666
|
-
function
|
|
4666
|
+
function Fa(t, e, n) {
|
|
4667
4667
|
const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
|
|
4668
4668
|
return r && !i && n && (n.result = r), n || e;
|
|
4669
4669
|
}
|
|
@@ -4673,7 +4673,7 @@ function Hr(t) {
|
|
|
4673
4673
|
return u == a ? r < s ? -1 : r > s ? 1 : 0 : u - a;
|
|
4674
4674
|
});
|
|
4675
4675
|
}
|
|
4676
|
-
class
|
|
4676
|
+
class Na {
|
|
4677
4677
|
constructor(e, n = Ui, r = Li, i, s) {
|
|
4678
4678
|
var o, u, a;
|
|
4679
4679
|
if (this._isOnline = !0, this._isShutdown = !1, this.status = he.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (c, d, f) => {
|
|
@@ -4797,7 +4797,7 @@ class Fa {
|
|
|
4797
4797
|
return;
|
|
4798
4798
|
}
|
|
4799
4799
|
this._log.info("[socket][close]", d.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
4800
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
4800
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Ma), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Ca, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Ia, this._log = da(e.verbose || qn || Fi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Wn }), this.config.schema && (this._linkIndex = Ur(this.config.schema)), !!xa()) {
|
|
4801
4801
|
if (!e.appId)
|
|
4802
4802
|
throw new Error("Instant must be initialized with an appId.");
|
|
4803
4803
|
if (!Ne(e.appId))
|
|
@@ -4819,7 +4819,7 @@ class Fa {
|
|
|
4819
4819
|
}), setInterval(() => U(this, void 0, void 0, function* () {
|
|
4820
4820
|
const c = yield this.getCurrentUser();
|
|
4821
4821
|
this.syncUserToEndpoint(c.user);
|
|
4822
|
-
}),
|
|
4822
|
+
}), Pa), r.getIsOnline().then((c) => {
|
|
4823
4823
|
this._isOnline = c, this._startSocket(), r.listen((d) => {
|
|
4824
4824
|
d !== this._isOnline && (this._log.info("[network] online =", d), this._isOnline = d, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", he.CLOSED), this._setStatus(he.CLOSED)));
|
|
4825
4825
|
});
|
|
@@ -4847,9 +4847,9 @@ class Fa {
|
|
|
4847
4847
|
_initStorage(e) {
|
|
4848
4848
|
this.querySubs = new _n({
|
|
4849
4849
|
persister: new e(this.config.appId, "querySubs"),
|
|
4850
|
-
merge:
|
|
4851
|
-
serialize:
|
|
4852
|
-
parse: (n, r) =>
|
|
4850
|
+
merge: Fa,
|
|
4851
|
+
serialize: Da,
|
|
4852
|
+
parse: (n, r) => $a(r, this.config.useDateObjects),
|
|
4853
4853
|
// objectSize
|
|
4854
4854
|
objectSize: (n) => {
|
|
4855
4855
|
var r, i, s, o;
|
|
@@ -4868,8 +4868,8 @@ class Fa {
|
|
|
4868
4868
|
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new _n({
|
|
4869
4869
|
persister: new e(this.config.appId, "kv"),
|
|
4870
4870
|
merge: this._onMergeKv,
|
|
4871
|
-
serialize:
|
|
4872
|
-
parse:
|
|
4871
|
+
serialize: La,
|
|
4872
|
+
parse: Ua,
|
|
4873
4873
|
objectSize: () => 0,
|
|
4874
4874
|
logger: this._log,
|
|
4875
4875
|
saveThrottleMs: 100,
|
|
@@ -5444,7 +5444,7 @@ class Fa {
|
|
|
5444
5444
|
return;
|
|
5445
5445
|
}
|
|
5446
5446
|
const e = this._transport;
|
|
5447
|
-
this._transport =
|
|
5447
|
+
this._transport = Ra({
|
|
5448
5448
|
transportType: this._transportType,
|
|
5449
5449
|
appId: this.config.appId,
|
|
5450
5450
|
apiURI: this.config.apiURI,
|
|
@@ -5980,7 +5980,7 @@ class Fa {
|
|
|
5980
5980
|
});
|
|
5981
5981
|
}
|
|
5982
5982
|
}
|
|
5983
|
-
function
|
|
5983
|
+
function Ka(t, e) {
|
|
5984
5984
|
return new Lt(
|
|
5985
5985
|
Hi(t, e),
|
|
5986
5986
|
// (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
|
|
@@ -5992,25 +5992,25 @@ function Na(t, e) {
|
|
|
5992
5992
|
void 0
|
|
5993
5993
|
);
|
|
5994
5994
|
}
|
|
5995
|
-
function
|
|
5995
|
+
function qa(t) {
|
|
5996
5996
|
return new Ut(t, {});
|
|
5997
5997
|
}
|
|
5998
|
-
function
|
|
5998
|
+
function Wa() {
|
|
5999
5999
|
return new H("string", !0, !1);
|
|
6000
6000
|
}
|
|
6001
|
-
function
|
|
6001
|
+
function za() {
|
|
6002
6002
|
return new H("number", !0, !1);
|
|
6003
6003
|
}
|
|
6004
|
-
function
|
|
6004
|
+
function Va() {
|
|
6005
6005
|
return new H("boolean", !0, !1);
|
|
6006
6006
|
}
|
|
6007
|
-
function
|
|
6007
|
+
function Ba() {
|
|
6008
6008
|
return new H("date", !0, !1);
|
|
6009
6009
|
}
|
|
6010
|
-
function
|
|
6010
|
+
function Ga() {
|
|
6011
6011
|
return new H("json", !0, !1);
|
|
6012
6012
|
}
|
|
6013
|
-
function
|
|
6013
|
+
function Qa() {
|
|
6014
6014
|
return new H("json", !0, !1);
|
|
6015
6015
|
}
|
|
6016
6016
|
function Hi(t, e) {
|
|
@@ -6029,7 +6029,7 @@ function Hi(t, e) {
|
|
|
6029
6029
|
new Ut(c.attrs, Object.assign(Object.assign({}, o.fwd[a]), o.rev[a]))
|
|
6030
6030
|
]));
|
|
6031
6031
|
}
|
|
6032
|
-
function
|
|
6032
|
+
function Ha({ entities: t, links: e, rooms: n }) {
|
|
6033
6033
|
const r = e ?? {}, i = n ?? {};
|
|
6034
6034
|
return new Lt(
|
|
6035
6035
|
Hi(t, r),
|
|
@@ -6042,23 +6042,23 @@ function Qa({ entities: t, links: e, rooms: n }) {
|
|
|
6042
6042
|
i
|
|
6043
6043
|
);
|
|
6044
6044
|
}
|
|
6045
|
-
const
|
|
6045
|
+
const Nc = {
|
|
6046
6046
|
// constructs
|
|
6047
|
-
graph:
|
|
6048
|
-
schema:
|
|
6049
|
-
entity:
|
|
6047
|
+
graph: Ka,
|
|
6048
|
+
schema: Ha,
|
|
6049
|
+
entity: qa,
|
|
6050
6050
|
// value types
|
|
6051
|
-
string:
|
|
6052
|
-
number:
|
|
6053
|
-
boolean:
|
|
6054
|
-
date:
|
|
6055
|
-
json:
|
|
6056
|
-
any:
|
|
6051
|
+
string: Wa,
|
|
6052
|
+
number: za,
|
|
6053
|
+
boolean: Va,
|
|
6054
|
+
date: Ba,
|
|
6055
|
+
json: Ga,
|
|
6056
|
+
any: Qa
|
|
6057
6057
|
};
|
|
6058
6058
|
let vt;
|
|
6059
|
-
function
|
|
6059
|
+
function Ya(t, e) {
|
|
6060
6060
|
vt == null || vt.dispose();
|
|
6061
|
-
const n =
|
|
6061
|
+
const n = nc(e), r = Xa(e, u), i = Za(Ja(t));
|
|
6062
6062
|
function s(d) {
|
|
6063
6063
|
var f;
|
|
6064
6064
|
d.source === i.element.contentWindow && ((f = d.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && u();
|
|
@@ -6080,10 +6080,10 @@ function Ha(t, e) {
|
|
|
6080
6080
|
}
|
|
6081
6081
|
return c();
|
|
6082
6082
|
}
|
|
6083
|
-
function
|
|
6083
|
+
function Ja(t) {
|
|
6084
6084
|
return `${qn || Ni ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
6085
6085
|
}
|
|
6086
|
-
function
|
|
6086
|
+
function Za(t) {
|
|
6087
6087
|
const e = document.createElement("iframe");
|
|
6088
6088
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
6089
6089
|
width: "100%",
|
|
@@ -6092,7 +6092,7 @@ function Ja(t) {
|
|
|
6092
6092
|
border: "none"
|
|
6093
6093
|
}), { element: e };
|
|
6094
6094
|
}
|
|
6095
|
-
function
|
|
6095
|
+
function Xa(t, e) {
|
|
6096
6096
|
const n = `
|
|
6097
6097
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6098
6098
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -6102,7 +6102,7 @@ function Za(t, e) {
|
|
|
6102
6102
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
|
|
6103
6103
|
// pos
|
|
6104
6104
|
position: "fixed"
|
|
6105
|
-
},
|
|
6105
|
+
}, ec(t.position)), {
|
|
6106
6106
|
height: "32px",
|
|
6107
6107
|
width: "32px",
|
|
6108
6108
|
// layout
|
|
@@ -6117,7 +6117,7 @@ function Za(t, e) {
|
|
|
6117
6117
|
cursor: "pointer"
|
|
6118
6118
|
})), r.addEventListener("click", e), { element: r };
|
|
6119
6119
|
}
|
|
6120
|
-
function
|
|
6120
|
+
function ec(t) {
|
|
6121
6121
|
switch (t) {
|
|
6122
6122
|
case "bottom-left":
|
|
6123
6123
|
return { bottom: "24px", left: "24px" };
|
|
@@ -6129,7 +6129,7 @@ function Xa(t) {
|
|
|
6129
6129
|
return { top: "24px", left: "24px" };
|
|
6130
6130
|
}
|
|
6131
6131
|
}
|
|
6132
|
-
function
|
|
6132
|
+
function tc(t) {
|
|
6133
6133
|
switch (t) {
|
|
6134
6134
|
case "bottom-left":
|
|
6135
6135
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -6141,23 +6141,23 @@ function ec(t) {
|
|
|
6141
6141
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
6142
6142
|
}
|
|
6143
6143
|
}
|
|
6144
|
-
function
|
|
6144
|
+
function nc(t) {
|
|
6145
6145
|
const e = document.createElement("div");
|
|
6146
|
-
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" },
|
|
6146
|
+
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, tc(t.position)), { display: "block", borderRadius: "4px", border: "1px #ccc solid", boxShadow: "0px 0px 8px #00000044", backgroundColor: "#eee", zIndex: "999990" })), e.style.display = "none", e.className = "instant-devtool-container";
|
|
6147
6147
|
function n() {
|
|
6148
6148
|
return e.style.display !== "none";
|
|
6149
6149
|
}
|
|
6150
6150
|
return { element: e, isVisible: n };
|
|
6151
6151
|
}
|
|
6152
|
-
const
|
|
6152
|
+
const rc = {
|
|
6153
6153
|
apiURI: "https://api.instantdb.com",
|
|
6154
6154
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
6155
6155
|
};
|
|
6156
|
-
function
|
|
6156
|
+
function ic() {
|
|
6157
6157
|
var t;
|
|
6158
6158
|
return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
6159
6159
|
}
|
|
6160
|
-
function
|
|
6160
|
+
function sc() {
|
|
6161
6161
|
var t;
|
|
6162
6162
|
return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
|
|
6163
6163
|
}
|
|
@@ -6165,23 +6165,23 @@ function gn(t) {
|
|
|
6165
6165
|
const e = t.__adminToken;
|
|
6166
6166
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
6167
6167
|
}
|
|
6168
|
-
const wn =
|
|
6169
|
-
class
|
|
6168
|
+
const wn = sc(), Yr = ic();
|
|
6169
|
+
class oc {
|
|
6170
6170
|
constructor(e) {
|
|
6171
6171
|
this.db = e, this.sendMagicCode = (n) => this.db.sendMagicCode(n), this.signInWithMagicCode = (n) => this.db.signInWithMagicCode(n), this.signInWithToken = (n) => this.db.signInWithCustomToken(n), this.signInAsGuest = () => this.db.signInAsGuest(), this.createAuthorizationURL = (n) => this.db.createAuthorizationURL(n), this.signInWithIdToken = (n) => this.db.signInWithIdToken(n), this.exchangeOAuthCode = (n) => this.db.exchangeCodeForToken(n), this.issuerURI = () => this.db.issuerURI(), this.signOut = (n = { invalidateToken: !0 }) => this.db.signOut(n);
|
|
6172
6172
|
}
|
|
6173
6173
|
}
|
|
6174
|
-
class
|
|
6174
|
+
class uc {
|
|
6175
6175
|
constructor(e) {
|
|
6176
6176
|
this.db = e, this.uploadFile = (n, r, i = {}) => this.db.uploadFile(n, r, i), this.delete = (n) => this.db.deleteFile(n), this.upload = (n, r) => this.db.upload(n, r), this.put = this.upload, this.getDownloadUrl = (n) => this.db.getDownloadUrl(n);
|
|
6177
6177
|
}
|
|
6178
6178
|
}
|
|
6179
|
-
function
|
|
6179
|
+
function ac(t) {
|
|
6180
6180
|
return JSON.parse(JSON.stringify(t));
|
|
6181
6181
|
}
|
|
6182
|
-
class
|
|
6182
|
+
class cc {
|
|
6183
6183
|
constructor(e) {
|
|
6184
|
-
this.tx = Kn(), this._reactor = e, this.auth = new
|
|
6184
|
+
this.tx = Kn(), this._reactor = e, this.auth = new oc(this._reactor), this.storage = new uc(this._reactor);
|
|
6185
6185
|
}
|
|
6186
6186
|
/**
|
|
6187
6187
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6364,22 +6364,22 @@ function Jr(t) {
|
|
|
6364
6364
|
const n = W(t);
|
|
6365
6365
|
return Yr.set(t, n), n;
|
|
6366
6366
|
}
|
|
6367
|
-
function
|
|
6367
|
+
function dc(t, e) {
|
|
6368
6368
|
return Jr(t._reactor.config.schema) !== Jr(e);
|
|
6369
6369
|
}
|
|
6370
|
-
function
|
|
6370
|
+
function fc(t, e, n, r, i) {
|
|
6371
6371
|
var s, o;
|
|
6372
6372
|
const u = Object.assign(Object.assign({}, t), { appId: (s = t.appId) === null || s === void 0 ? void 0 : s.trim(), useDateObjects: (o = t.useDateObjects) !== null && o !== void 0 ? o : !1 }), a = wn[gn(u)];
|
|
6373
6373
|
if (a)
|
|
6374
|
-
return
|
|
6375
|
-
const c = new
|
|
6376
|
-
return wn[gn(u)] = d,
|
|
6374
|
+
return dc(a, u.schema) && a._reactor.updateSchema(u.schema), a;
|
|
6375
|
+
const c = new Na(Object.assign(Object.assign(Object.assign({}, rc), u), { cardinalityInference: !!u.schema }), e || Ui, n || Li, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Wn }), i), d = new cc(c);
|
|
6376
|
+
return wn[gn(u)] = d, lc(u.appId, u.devtool), d;
|
|
6377
6377
|
}
|
|
6378
|
-
function
|
|
6378
|
+
function lc(t, e) {
|
|
6379
6379
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6380
6380
|
return;
|
|
6381
6381
|
const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
|
|
6382
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6382
|
+
n.allowedHosts.includes(window.location.hostname) && Ya(t, n);
|
|
6383
6383
|
}
|
|
6384
6384
|
var Tn = { exports: {} }, Qe = {};
|
|
6385
6385
|
/**
|
|
@@ -6392,7 +6392,7 @@ var Tn = { exports: {} }, Qe = {};
|
|
|
6392
6392
|
* LICENSE file in the root directory of this source tree.
|
|
6393
6393
|
*/
|
|
6394
6394
|
var Zr;
|
|
6395
|
-
function
|
|
6395
|
+
function hc() {
|
|
6396
6396
|
if (Zr) return Qe;
|
|
6397
6397
|
Zr = 1;
|
|
6398
6398
|
var t = oi, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
@@ -6406,7 +6406,7 @@ function lc() {
|
|
|
6406
6406
|
return Qe.Fragment = n, Qe.jsx = o, Qe.jsxs = o, Qe;
|
|
6407
6407
|
}
|
|
6408
6408
|
var He = {}, Xr;
|
|
6409
|
-
function
|
|
6409
|
+
function pc() {
|
|
6410
6410
|
if (Xr) return He;
|
|
6411
6411
|
Xr = 1;
|
|
6412
6412
|
var t = {};
|
|
@@ -7007,10 +7007,10 @@ React keys must be passed directly to JSX without using spread:
|
|
|
7007
7007
|
He.Fragment = i, He.jsx = Ts, He.jsxs = ms;
|
|
7008
7008
|
}(), He;
|
|
7009
7009
|
}
|
|
7010
|
-
var
|
|
7011
|
-
|
|
7010
|
+
var yc = {};
|
|
7011
|
+
yc.NODE_ENV === "production" ? Tn.exports = hc() : Tn.exports = pc();
|
|
7012
7012
|
var B = Tn.exports;
|
|
7013
|
-
const
|
|
7013
|
+
const bc = {
|
|
7014
7014
|
isLoading: !0,
|
|
7015
7015
|
data: void 0,
|
|
7016
7016
|
pageInfo: void 0,
|
|
@@ -7019,9 +7019,9 @@ const yc = {
|
|
|
7019
7019
|
function ei(t) {
|
|
7020
7020
|
return Object.assign({ isLoading: !t, data: void 0, pageInfo: void 0, error: void 0 }, t || {});
|
|
7021
7021
|
}
|
|
7022
|
-
function
|
|
7022
|
+
function _c(t, e, n) {
|
|
7023
7023
|
e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
7024
|
-
const r = e ?
|
|
7024
|
+
const r = e ? ac(e) : null, i = W(r), s = ut(ei(t._reactor.getPreviousResult(r))), o = we(
|
|
7025
7025
|
(a) => (s.current = ei(t._reactor.getPreviousResult(r)), a(), r ? t.subscribeQuery(r, (d) => {
|
|
7026
7026
|
s.current = Object.assign({
|
|
7027
7027
|
isLoading: !d,
|
|
@@ -7037,9 +7037,9 @@ function bc(t, e, n) {
|
|
|
7037
7037
|
// Build a new subscribe function if the query changes
|
|
7038
7038
|
[i]
|
|
7039
7039
|
);
|
|
7040
|
-
return { state: en(o, () => s.current, () =>
|
|
7040
|
+
return { state: en(o, () => s.current, () => bc), query: r };
|
|
7041
7041
|
}
|
|
7042
|
-
function
|
|
7042
|
+
function gc() {
|
|
7043
7043
|
const t = ut(null);
|
|
7044
7044
|
ke(() => {
|
|
7045
7045
|
n();
|
|
@@ -7052,14 +7052,14 @@ function _c() {
|
|
|
7052
7052
|
}
|
|
7053
7053
|
return { set: e, clear: n };
|
|
7054
7054
|
}
|
|
7055
|
-
const
|
|
7056
|
-
function
|
|
7055
|
+
const wc = 1e3;
|
|
7056
|
+
function Tc(t, e, n) {
|
|
7057
7057
|
const r = ut(n);
|
|
7058
7058
|
r.current = n, ke(() => t.core._reactor.subscribeTopic(t.id, e, (s, o) => {
|
|
7059
7059
|
r.current(s, o);
|
|
7060
7060
|
}), [t.id, e]);
|
|
7061
7061
|
}
|
|
7062
|
-
function
|
|
7062
|
+
function mc(t, e) {
|
|
7063
7063
|
return ke(() => t.core._reactor.joinRoom(t.id), [t.id]), we((r) => {
|
|
7064
7064
|
t.core._reactor.publishTopic({
|
|
7065
7065
|
roomType: t.type,
|
|
@@ -7069,7 +7069,7 @@ function Tc(t, e) {
|
|
|
7069
7069
|
});
|
|
7070
7070
|
}, [t.id, e]);
|
|
7071
7071
|
}
|
|
7072
|
-
function
|
|
7072
|
+
function vc(t, e = {}) {
|
|
7073
7073
|
var n, r;
|
|
7074
7074
|
const [i, s] = ui(() => {
|
|
7075
7075
|
var a;
|
|
@@ -7086,11 +7086,11 @@ function mc(t, e = {}) {
|
|
|
7086
7086
|
}, [t.type, t.id]);
|
|
7087
7087
|
return tn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
|
|
7088
7088
|
}
|
|
7089
|
-
function
|
|
7089
|
+
function Sc(t, e, n) {
|
|
7090
7090
|
ke(() => t.core._reactor.joinRoom(t.id, e), [t.id]), ke(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
|
|
7091
7091
|
}
|
|
7092
|
-
function
|
|
7093
|
-
const r =
|
|
7092
|
+
function Oc(t, e, n = {}) {
|
|
7093
|
+
const r = gc(), i = Se.usePresence(t, {
|
|
7094
7094
|
keys: [e]
|
|
7095
7095
|
}), s = tn(() => {
|
|
7096
7096
|
var d;
|
|
@@ -7100,7 +7100,7 @@ function Sc(t, e, n = {}) {
|
|
|
7100
7100
|
var f;
|
|
7101
7101
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
7102
7102
|
[e]: d
|
|
7103
|
-
}), d && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f :
|
|
7103
|
+
}), d && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f : wc, () => {
|
|
7104
7104
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
7105
7105
|
[e]: null
|
|
7106
7106
|
});
|
|
@@ -7118,20 +7118,20 @@ function Sc(t, e, n = {}) {
|
|
|
7118
7118
|
};
|
|
7119
7119
|
}
|
|
7120
7120
|
const Se = {
|
|
7121
|
-
useTopicEffect:
|
|
7122
|
-
usePublishTopic:
|
|
7123
|
-
usePresence:
|
|
7124
|
-
useSyncPresence:
|
|
7125
|
-
useTypingIndicator:
|
|
7121
|
+
useTopicEffect: Tc,
|
|
7122
|
+
usePublishTopic: mc,
|
|
7123
|
+
usePresence: vc,
|
|
7124
|
+
useSyncPresence: Sc,
|
|
7125
|
+
useTypingIndicator: Oc
|
|
7126
7126
|
};
|
|
7127
|
-
class
|
|
7127
|
+
class Ec {
|
|
7128
7128
|
constructor(e, n, r) {
|
|
7129
7129
|
this.useTopicEffect = (i, s) => {
|
|
7130
7130
|
Se.useTopicEffect(this, i, s);
|
|
7131
7131
|
}, this.usePublishTopic = (i) => Se.usePublishTopic(this, i), this.usePresence = (i = {}) => Se.usePresence(this, i), this.useSyncPresence = (i, s) => Se.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => Se.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
|
|
7132
7132
|
}
|
|
7133
7133
|
}
|
|
7134
|
-
var
|
|
7134
|
+
var Ac = function(t, e, n, r) {
|
|
7135
7135
|
function i(s) {
|
|
7136
7136
|
return s instanceof n ? s : new n(function(o) {
|
|
7137
7137
|
o(s);
|
|
@@ -7158,22 +7158,22 @@ var Ec = function(t, e, n, r) {
|
|
|
7158
7158
|
c((r = r.apply(t, e || [])).next());
|
|
7159
7159
|
});
|
|
7160
7160
|
};
|
|
7161
|
-
const
|
|
7161
|
+
const kc = {
|
|
7162
7162
|
isLoading: !0,
|
|
7163
7163
|
user: void 0,
|
|
7164
7164
|
error: void 0
|
|
7165
7165
|
};
|
|
7166
|
-
class
|
|
7166
|
+
class jc {
|
|
7167
7167
|
constructor(e, n) {
|
|
7168
7168
|
this.tx = Kn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
7169
7169
|
const [i, s] = ui(null);
|
|
7170
7170
|
return ke(() => {
|
|
7171
|
-
|
|
7171
|
+
Ac(this, void 0, void 0, function* () {
|
|
7172
7172
|
const u = yield this.getLocalId(r);
|
|
7173
7173
|
s(u);
|
|
7174
7174
|
});
|
|
7175
7175
|
}, [r]), i;
|
|
7176
|
-
}, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) =>
|
|
7176
|
+
}, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => _c(this.core, r, i).state, this.useAuth = () => this._useAuth(), this.useUser = () => {
|
|
7177
7177
|
const { user: r } = this.useAuth();
|
|
7178
7178
|
if (!r)
|
|
7179
7179
|
throw new qe("useUser must be used within an auth-protected route");
|
|
@@ -7194,7 +7194,7 @@ class kc {
|
|
|
7194
7194
|
}, this.SignedOut = ({ children: r }) => {
|
|
7195
7195
|
const i = this.useAuth();
|
|
7196
7196
|
return i.isLoading || i.error || i.user ? null : B.jsx(B.Fragment, { children: r });
|
|
7197
|
-
}, this.core =
|
|
7197
|
+
}, this.core = fc(
|
|
7198
7198
|
e,
|
|
7199
7199
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
7200
7200
|
this.constructor.Storage,
|
|
@@ -7218,13 +7218,13 @@ class kc {
|
|
|
7218
7218
|
* const { peers } = db.rooms.usePresence(room);
|
|
7219
7219
|
*/
|
|
7220
7220
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
7221
|
-
return new
|
|
7221
|
+
return new Ec(this.core, e, n);
|
|
7222
7222
|
}
|
|
7223
7223
|
_useAuth() {
|
|
7224
7224
|
const e = ut(this.core._reactor._currentUserCached), n = we((i) => this.core.subscribeAuth((o) => {
|
|
7225
7225
|
e.current = Object.assign({ isLoading: !1 }, o), i();
|
|
7226
7226
|
}), []);
|
|
7227
|
-
return en(n, () => e.current, () =>
|
|
7227
|
+
return en(n, () => e.current, () => kc);
|
|
7228
7228
|
}
|
|
7229
7229
|
/**
|
|
7230
7230
|
* One time query for the logged in state. This is useful
|
|
@@ -7247,7 +7247,7 @@ class ti extends Error {
|
|
|
7247
7247
|
}
|
|
7248
7248
|
function Xt(t) {
|
|
7249
7249
|
}
|
|
7250
|
-
function
|
|
7250
|
+
function Cc(t) {
|
|
7251
7251
|
if (typeof t == "function")
|
|
7252
7252
|
throw new TypeError(
|
|
7253
7253
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
@@ -7255,7 +7255,7 @@ function jc(t) {
|
|
|
7255
7255
|
const { onEvent: e = Xt, onError: n = Xt, onRetry: r = Xt, onComment: i } = t;
|
|
7256
7256
|
let s = "", o = !0, u, a = "", c = "";
|
|
7257
7257
|
function d(b) {
|
|
7258
|
-
const g = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [T, _] =
|
|
7258
|
+
const g = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [T, _] = Ic(`${s}${g}`);
|
|
7259
7259
|
for (const m of T)
|
|
7260
7260
|
f(m);
|
|
7261
7261
|
s = _, o = !1;
|
|
@@ -7323,7 +7323,7 @@ function jc(t) {
|
|
|
7323
7323
|
}
|
|
7324
7324
|
return { feed: d, reset: y };
|
|
7325
7325
|
}
|
|
7326
|
-
function
|
|
7326
|
+
function Ic(t) {
|
|
7327
7327
|
const e = [];
|
|
7328
7328
|
let n = "", r = 0;
|
|
7329
7329
|
for (; r < t.length; ) {
|
|
@@ -7383,7 +7383,7 @@ class ni extends Event {
|
|
|
7383
7383
|
return e(ri(this), n);
|
|
7384
7384
|
}
|
|
7385
7385
|
}
|
|
7386
|
-
function
|
|
7386
|
+
function Pc(t) {
|
|
7387
7387
|
const e = globalThis.DOMException;
|
|
7388
7388
|
return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
|
|
7389
7389
|
}
|
|
@@ -7455,13 +7455,13 @@ class kt extends EventTarget {
|
|
|
7455
7455
|
if (e instanceof URL)
|
|
7456
7456
|
x(this, Oe, e);
|
|
7457
7457
|
else if (typeof e == "string")
|
|
7458
|
-
x(this, Oe, new URL(e,
|
|
7458
|
+
x(this, Oe, new URL(e, Mc()));
|
|
7459
7459
|
else
|
|
7460
7460
|
throw new Error("Invalid URL");
|
|
7461
7461
|
} catch {
|
|
7462
|
-
throw
|
|
7462
|
+
throw Pc("An invalid or illegal string was specified");
|
|
7463
7463
|
}
|
|
7464
|
-
x(this, $e,
|
|
7464
|
+
x(this, $e, Cc({
|
|
7465
7465
|
onEvent: A(this, En),
|
|
7466
7466
|
onRetry: A(this, An)
|
|
7467
7467
|
})), x(this, J, this.CONNECTING), x(this, st, 3e3), x(this, Rt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), x(this, At, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), pe(this, se, vn).call(this);
|
|
@@ -7604,15 +7604,15 @@ kt.OPEN = 1, /**
|
|
|
7604
7604
|
* @public
|
|
7605
7605
|
*/
|
|
7606
7606
|
kt.CLOSED = 2;
|
|
7607
|
-
function
|
|
7607
|
+
function Mc() {
|
|
7608
7608
|
const t = "document" in globalThis ? globalThis.document : void 0;
|
|
7609
7609
|
return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
|
|
7610
7610
|
}
|
|
7611
|
-
const Vn = class Vn extends
|
|
7611
|
+
const Vn = class Vn extends jc {
|
|
7612
7612
|
};
|
|
7613
7613
|
Vn.EventSourceImpl = kt;
|
|
7614
7614
|
let Cn = Vn;
|
|
7615
|
-
function
|
|
7615
|
+
function Rc(t) {
|
|
7616
7616
|
const e = {
|
|
7617
7617
|
...t,
|
|
7618
7618
|
useDateObjects: t.useDateObjects ?? !1
|
|
@@ -7621,8 +7621,8 @@ function Mc(t) {
|
|
|
7621
7621
|
"@instantdb/react": Wn
|
|
7622
7622
|
});
|
|
7623
7623
|
}
|
|
7624
|
-
const
|
|
7625
|
-
function
|
|
7624
|
+
const Kc = Rc;
|
|
7625
|
+
function qc({
|
|
7626
7626
|
as: t = "div",
|
|
7627
7627
|
spaceId: e,
|
|
7628
7628
|
room: n,
|
|
@@ -7694,8 +7694,8 @@ function Kc({
|
|
|
7694
7694
|
{
|
|
7695
7695
|
style: {
|
|
7696
7696
|
...si,
|
|
7697
|
-
|
|
7698
|
-
zIndex: c !== void 0 ? c :
|
|
7697
|
+
...$c,
|
|
7698
|
+
zIndex: c !== void 0 ? c : Dc
|
|
7699
7699
|
},
|
|
7700
7700
|
children: Object.entries(f.peers).map(([_, m]) => {
|
|
7701
7701
|
const O = m[d];
|
|
@@ -7711,7 +7711,7 @@ function Kc({
|
|
|
7711
7711
|
children: u ? u({
|
|
7712
7712
|
color: O.color,
|
|
7713
7713
|
presence: l == null ? void 0 : l.peers[_]
|
|
7714
|
-
}) : /* @__PURE__ */ B.jsx(
|
|
7714
|
+
}) : /* @__PURE__ */ B.jsx(xc, { ...O })
|
|
7715
7715
|
},
|
|
7716
7716
|
_
|
|
7717
7717
|
) : null;
|
|
@@ -7722,7 +7722,7 @@ function Kc({
|
|
|
7722
7722
|
]
|
|
7723
7723
|
);
|
|
7724
7724
|
}
|
|
7725
|
-
function
|
|
7725
|
+
function xc({ color: t }) {
|
|
7726
7726
|
const n = t || "black";
|
|
7727
7727
|
return /* @__PURE__ */ B.jsxs(
|
|
7728
7728
|
"svg",
|
|
@@ -7775,21 +7775,21 @@ const si = {
|
|
|
7775
7775
|
left: 0,
|
|
7776
7776
|
bottom: 0,
|
|
7777
7777
|
right: 0
|
|
7778
|
-
},
|
|
7778
|
+
}, $c = {
|
|
7779
7779
|
overflow: "hidden",
|
|
7780
7780
|
pointerEvents: "none",
|
|
7781
7781
|
userSelect: "none"
|
|
7782
|
-
},
|
|
7782
|
+
}, Dc = 99999;
|
|
7783
7783
|
export {
|
|
7784
|
-
|
|
7784
|
+
qc as Cursors,
|
|
7785
7785
|
Dt as InstantAPIError,
|
|
7786
|
-
|
|
7786
|
+
jc as InstantReactAbstractDatabase,
|
|
7787
7787
|
Cn as InstantReactWebDatabase,
|
|
7788
7788
|
ve as SyncTableCallbackEventType,
|
|
7789
|
-
|
|
7789
|
+
Nc as i,
|
|
7790
7790
|
z as id,
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7791
|
+
Rc as init,
|
|
7792
|
+
Kc as init_experimental,
|
|
7793
|
+
Lc as lookup,
|
|
7794
|
+
Fc as tx
|
|
7795
7795
|
};
|