@instantdb/react-common 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/standalone/index.js
CHANGED
|
@@ -4276,7 +4276,7 @@ function ir(t) {
|
|
|
4276
4276
|
}, e;
|
|
4277
4277
|
}, {});
|
|
4278
4278
|
}
|
|
4279
|
-
const ni = "v0.22.93-experimental.drewh-ssr.
|
|
4279
|
+
const ni = "v0.22.93-experimental.drewh-ssr.20384561223.1";
|
|
4280
4280
|
function Au(t, e) {
|
|
4281
4281
|
return {
|
|
4282
4282
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -5193,11 +5193,11 @@ const oe = {
|
|
|
5193
5193
|
AUTHENTICATED: "authenticated",
|
|
5194
5194
|
CLOSED: "closed",
|
|
5195
5195
|
ERRORED: "errored"
|
|
5196
|
-
}, zu = 3e4, Vu = 3e4, Wu = 200, Qu = {
|
|
5196
|
+
}, zu = 3e4, Vu = 3e4, Wu = 200, Qu = 1e3 * 60, Bu = {
|
|
5197
5197
|
apiURI: "https://api.instantdb.com",
|
|
5198
5198
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5199
5199
|
}, Ct = "_instant_oauth_redirect", xe = "currentUser";
|
|
5200
|
-
function
|
|
5200
|
+
function Gu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
5201
5201
|
if (!i)
|
|
5202
5202
|
return new fr(`${r}?app_id=${e}`);
|
|
5203
5203
|
switch (t) {
|
|
@@ -5209,7 +5209,7 @@ function Bu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl:
|
|
|
5209
5209
|
throw new Error("Unknown transport type " + t);
|
|
5210
5210
|
}
|
|
5211
5211
|
}
|
|
5212
|
-
function
|
|
5212
|
+
function Hu() {
|
|
5213
5213
|
return typeof window < "u" || typeof chrome < "u";
|
|
5214
5214
|
}
|
|
5215
5215
|
const yr = {
|
|
@@ -5218,7 +5218,7 @@ const yr = {
|
|
|
5218
5218
|
"refresh-presence": !0,
|
|
5219
5219
|
"patch-presence": !0
|
|
5220
5220
|
};
|
|
5221
|
-
function
|
|
5221
|
+
function Yu(t, e) {
|
|
5222
5222
|
var n;
|
|
5223
5223
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
5224
5224
|
if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
|
|
@@ -5230,7 +5230,7 @@ function Hu(t, e) {
|
|
|
5230
5230
|
}
|
|
5231
5231
|
return r;
|
|
5232
5232
|
}
|
|
5233
|
-
function
|
|
5233
|
+
function Ju(t, e) {
|
|
5234
5234
|
const { result: n } = e, i = ci(e, ["result"]);
|
|
5235
5235
|
if (n) {
|
|
5236
5236
|
const s = Object.assign(Object.assign({}, n), { store: Rr(n.store), attrsStore: n.attrsStore.toJSON() });
|
|
@@ -5238,7 +5238,7 @@ function Yu(t, e) {
|
|
|
5238
5238
|
}
|
|
5239
5239
|
return i;
|
|
5240
5240
|
}
|
|
5241
|
-
function
|
|
5241
|
+
function Zu(t, e) {
|
|
5242
5242
|
switch (t) {
|
|
5243
5243
|
case "pendingMutations":
|
|
5244
5244
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -5246,7 +5246,7 @@ function Ju(t, e) {
|
|
|
5246
5246
|
return e;
|
|
5247
5247
|
}
|
|
5248
5248
|
}
|
|
5249
|
-
function
|
|
5249
|
+
function Xu(t, e) {
|
|
5250
5250
|
switch (t) {
|
|
5251
5251
|
case "pendingMutations":
|
|
5252
5252
|
return [...e.entries()];
|
|
@@ -5254,7 +5254,7 @@ function Zu(t, e) {
|
|
|
5254
5254
|
return e;
|
|
5255
5255
|
}
|
|
5256
5256
|
}
|
|
5257
|
-
function
|
|
5257
|
+
function ea(t, e, n) {
|
|
5258
5258
|
const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
|
|
5259
5259
|
return r && !i && n && (n.result = r), n || e;
|
|
5260
5260
|
}
|
|
@@ -5264,7 +5264,7 @@ function br(t) {
|
|
|
5264
5264
|
return u == a ? r < s ? -1 : r > s ? 1 : 0 : u - a;
|
|
5265
5265
|
});
|
|
5266
5266
|
}
|
|
5267
|
-
class
|
|
5267
|
+
class ta {
|
|
5268
5268
|
constructor(e, n = Jr, r = Zr, i, s) {
|
|
5269
5269
|
var o, u, a;
|
|
5270
5270
|
if (this._isOnline = !0, this._isShutdown = !1, this.status = oe.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 = (d, c, f) => {
|
|
@@ -5388,7 +5388,7 @@ class ea {
|
|
|
5388
5388
|
return;
|
|
5389
5389
|
}
|
|
5390
5390
|
this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5391
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
5391
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Bu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Vu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Wu, this._log = Au(e.verbose || dn || Xr, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": ni }), this.config.schema && (this._linkIndex = ir(this.config.schema)), !!Hu()) {
|
|
5392
5392
|
if (!e.appId)
|
|
5393
5393
|
throw new Error("Instant must be initialized with an appId.");
|
|
5394
5394
|
if (!Ee(e.appId))
|
|
@@ -5410,7 +5410,7 @@ class ea {
|
|
|
5410
5410
|
}), setInterval(() => $(this, void 0, void 0, function* () {
|
|
5411
5411
|
const d = yield this.getCurrentUser();
|
|
5412
5412
|
this.syncUserToEndpoint(d.user);
|
|
5413
|
-
}),
|
|
5413
|
+
}), Qu), r.getIsOnline().then((d) => {
|
|
5414
5414
|
this._isOnline = d, this._startSocket(), r.listen((c) => {
|
|
5415
5415
|
c !== this._isOnline && (this._log.info("[network] online =", c), this._isOnline = c, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", oe.CLOSED), this._setStatus(oe.CLOSED)));
|
|
5416
5416
|
});
|
|
@@ -5438,9 +5438,9 @@ class ea {
|
|
|
5438
5438
|
_initStorage(e) {
|
|
5439
5439
|
this.querySubs = new Gt({
|
|
5440
5440
|
persister: new e(this.config.appId, "querySubs"),
|
|
5441
|
-
merge:
|
|
5442
|
-
serialize:
|
|
5443
|
-
parse: (n, r) =>
|
|
5441
|
+
merge: ea,
|
|
5442
|
+
serialize: Ju,
|
|
5443
|
+
parse: (n, r) => Yu(r, this.config.useDateObjects),
|
|
5444
5444
|
// objectSize
|
|
5445
5445
|
objectSize: (n) => {
|
|
5446
5446
|
var r, i, s, o;
|
|
@@ -5459,8 +5459,8 @@ class ea {
|
|
|
5459
5459
|
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Gt({
|
|
5460
5460
|
persister: new e(this.config.appId, "kv"),
|
|
5461
5461
|
merge: this._onMergeKv,
|
|
5462
|
-
serialize:
|
|
5463
|
-
parse:
|
|
5462
|
+
serialize: Xu,
|
|
5463
|
+
parse: Zu,
|
|
5464
5464
|
objectSize: () => 0,
|
|
5465
5465
|
logger: this._log,
|
|
5466
5466
|
saveThrottleMs: 100,
|
|
@@ -6035,7 +6035,7 @@ class ea {
|
|
|
6035
6035
|
return;
|
|
6036
6036
|
}
|
|
6037
6037
|
const e = this._transport;
|
|
6038
|
-
this._transport =
|
|
6038
|
+
this._transport = Gu({
|
|
6039
6039
|
transportType: this._transportType,
|
|
6040
6040
|
appId: this.config.appId,
|
|
6041
6041
|
apiURI: this.config.apiURI,
|
|
@@ -6572,9 +6572,9 @@ class ea {
|
|
|
6572
6572
|
}
|
|
6573
6573
|
}
|
|
6574
6574
|
let st;
|
|
6575
|
-
function
|
|
6575
|
+
function na(t, e) {
|
|
6576
6576
|
st == null || st.dispose();
|
|
6577
|
-
const n =
|
|
6577
|
+
const n = aa(e), r = sa(e, u), i = ia(ra(t));
|
|
6578
6578
|
function s(c) {
|
|
6579
6579
|
var f;
|
|
6580
6580
|
c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && u();
|
|
@@ -6596,10 +6596,10 @@ function ta(t, e) {
|
|
|
6596
6596
|
}
|
|
6597
6597
|
return d();
|
|
6598
6598
|
}
|
|
6599
|
-
function
|
|
6599
|
+
function ra(t) {
|
|
6600
6600
|
return `${dn || ei ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
6601
6601
|
}
|
|
6602
|
-
function
|
|
6602
|
+
function ia(t) {
|
|
6603
6603
|
const e = document.createElement("iframe");
|
|
6604
6604
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
6605
6605
|
width: "100%",
|
|
@@ -6608,7 +6608,7 @@ function ra(t) {
|
|
|
6608
6608
|
border: "none"
|
|
6609
6609
|
}), { element: e };
|
|
6610
6610
|
}
|
|
6611
|
-
function
|
|
6611
|
+
function sa(t, e) {
|
|
6612
6612
|
const n = `
|
|
6613
6613
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6614
6614
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -6618,7 +6618,7 @@ function ia(t, e) {
|
|
|
6618
6618
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
|
|
6619
6619
|
// pos
|
|
6620
6620
|
position: "fixed"
|
|
6621
|
-
},
|
|
6621
|
+
}, oa(t.position)), {
|
|
6622
6622
|
height: "32px",
|
|
6623
6623
|
width: "32px",
|
|
6624
6624
|
// layout
|
|
@@ -6633,7 +6633,7 @@ function ia(t, e) {
|
|
|
6633
6633
|
cursor: "pointer"
|
|
6634
6634
|
})), r.addEventListener("click", e), { element: r };
|
|
6635
6635
|
}
|
|
6636
|
-
function
|
|
6636
|
+
function oa(t) {
|
|
6637
6637
|
switch (t) {
|
|
6638
6638
|
case "bottom-left":
|
|
6639
6639
|
return { bottom: "24px", left: "24px" };
|
|
@@ -6645,7 +6645,7 @@ function sa(t) {
|
|
|
6645
6645
|
return { top: "24px", left: "24px" };
|
|
6646
6646
|
}
|
|
6647
6647
|
}
|
|
6648
|
-
function
|
|
6648
|
+
function ua(t) {
|
|
6649
6649
|
switch (t) {
|
|
6650
6650
|
case "bottom-left":
|
|
6651
6651
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -6657,23 +6657,23 @@ function oa(t) {
|
|
|
6657
6657
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
6658
6658
|
}
|
|
6659
6659
|
}
|
|
6660
|
-
function
|
|
6660
|
+
function aa(t) {
|
|
6661
6661
|
const e = document.createElement("div");
|
|
6662
|
-
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" },
|
|
6662
|
+
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, ua(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";
|
|
6663
6663
|
function n() {
|
|
6664
6664
|
return e.style.display !== "none";
|
|
6665
6665
|
}
|
|
6666
6666
|
return { element: e, isVisible: n };
|
|
6667
6667
|
}
|
|
6668
|
-
const
|
|
6668
|
+
const ca = {
|
|
6669
6669
|
apiURI: "https://api.instantdb.com",
|
|
6670
6670
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
6671
6671
|
};
|
|
6672
|
-
function
|
|
6672
|
+
function da() {
|
|
6673
6673
|
var t;
|
|
6674
6674
|
return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
6675
6675
|
}
|
|
6676
|
-
function
|
|
6676
|
+
function fa() {
|
|
6677
6677
|
var t;
|
|
6678
6678
|
return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
|
|
6679
6679
|
}
|
|
@@ -6681,23 +6681,23 @@ function Ht(t) {
|
|
|
6681
6681
|
const e = t.__adminToken;
|
|
6682
6682
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
6683
6683
|
}
|
|
6684
|
-
const Yt =
|
|
6685
|
-
class
|
|
6684
|
+
const Yt = fa(), _r = da();
|
|
6685
|
+
class la {
|
|
6686
6686
|
constructor(e) {
|
|
6687
6687
|
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);
|
|
6688
6688
|
}
|
|
6689
6689
|
}
|
|
6690
|
-
class
|
|
6690
|
+
class ha {
|
|
6691
6691
|
constructor(e) {
|
|
6692
6692
|
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);
|
|
6693
6693
|
}
|
|
6694
6694
|
}
|
|
6695
|
-
function
|
|
6695
|
+
function pa(t) {
|
|
6696
6696
|
return JSON.parse(JSON.stringify(t));
|
|
6697
6697
|
}
|
|
6698
|
-
class
|
|
6698
|
+
class ya {
|
|
6699
6699
|
constructor(e) {
|
|
6700
|
-
this.tx = cn(), this._reactor = e, this.auth = new
|
|
6700
|
+
this.tx = cn(), this._reactor = e, this.auth = new la(this._reactor), this.storage = new ha(this._reactor);
|
|
6701
6701
|
}
|
|
6702
6702
|
/**
|
|
6703
6703
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6880,24 +6880,24 @@ function gr(t) {
|
|
|
6880
6880
|
const n = N(t);
|
|
6881
6881
|
return _r.set(t, n), n;
|
|
6882
6882
|
}
|
|
6883
|
-
function
|
|
6883
|
+
function ba(t, e) {
|
|
6884
6884
|
return gr(t._reactor.config.schema) !== gr(e);
|
|
6885
6885
|
}
|
|
6886
|
-
function
|
|
6886
|
+
function _a(t, e, n, r, i) {
|
|
6887
6887
|
var s, o;
|
|
6888
6888
|
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 = Yt[Ht(u)];
|
|
6889
6889
|
if (a)
|
|
6890
|
-
return
|
|
6891
|
-
const d = new
|
|
6892
|
-
return Yt[Ht(u)] = c,
|
|
6890
|
+
return ba(a, u.schema) && a._reactor.updateSchema(u.schema), a;
|
|
6891
|
+
const d = new ta(Object.assign(Object.assign(Object.assign({}, ca), u), { cardinalityInference: !!u.schema }), e || Jr, n || Zr, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": ni }), i), c = new ya(d);
|
|
6892
|
+
return Yt[Ht(u)] = c, ga(u.appId, u.devtool), c;
|
|
6893
6893
|
}
|
|
6894
|
-
function
|
|
6894
|
+
function ga(t, e) {
|
|
6895
6895
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6896
6896
|
return;
|
|
6897
6897
|
const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
|
|
6898
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6898
|
+
n.allowedHosts.includes(window.location.hostname) && na(t, n);
|
|
6899
6899
|
}
|
|
6900
|
-
const
|
|
6900
|
+
const Ta = {
|
|
6901
6901
|
isLoading: !0,
|
|
6902
6902
|
data: void 0,
|
|
6903
6903
|
pageInfo: void 0,
|
|
@@ -6912,9 +6912,9 @@ function Tr(t) {
|
|
|
6912
6912
|
...t || {}
|
|
6913
6913
|
};
|
|
6914
6914
|
}
|
|
6915
|
-
function
|
|
6915
|
+
function wa(t, e, n) {
|
|
6916
6916
|
e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
6917
|
-
const r = e ?
|
|
6917
|
+
const r = e ? pa(e) : null, i = N(r), s = ze(
|
|
6918
6918
|
Tr(t._reactor.getPreviousResult(r))
|
|
6919
6919
|
), o = fe(
|
|
6920
6920
|
(a) => (s.current = Tr(
|
|
@@ -6938,10 +6938,10 @@ function Ta(t, e, n) {
|
|
|
6938
6938
|
return { state: Pt(
|
|
6939
6939
|
o,
|
|
6940
6940
|
() => s.current,
|
|
6941
|
-
() =>
|
|
6941
|
+
() => Ta
|
|
6942
6942
|
), query: r };
|
|
6943
6943
|
}
|
|
6944
|
-
function
|
|
6944
|
+
function ma() {
|
|
6945
6945
|
const t = ze(null);
|
|
6946
6946
|
ge(() => {
|
|
6947
6947
|
n();
|
|
@@ -6954,8 +6954,8 @@ function wa() {
|
|
|
6954
6954
|
}
|
|
6955
6955
|
return { set: e, clear: n };
|
|
6956
6956
|
}
|
|
6957
|
-
const
|
|
6958
|
-
function
|
|
6957
|
+
const va = 1e3;
|
|
6958
|
+
function Sa(t, e, n) {
|
|
6959
6959
|
const r = ze(n);
|
|
6960
6960
|
r.current = n, ge(() => t.core._reactor.subscribeTopic(
|
|
6961
6961
|
t.id,
|
|
@@ -6965,7 +6965,7 @@ function va(t, e, n) {
|
|
|
6965
6965
|
}
|
|
6966
6966
|
), [t.id, e]);
|
|
6967
6967
|
}
|
|
6968
|
-
function
|
|
6968
|
+
function Oa(t, e) {
|
|
6969
6969
|
return ge(() => t.core._reactor.joinRoom(t.id), [t.id]), fe(
|
|
6970
6970
|
(r) => {
|
|
6971
6971
|
t.core._reactor.publishTopic({
|
|
@@ -6978,7 +6978,7 @@ function Sa(t, e) {
|
|
|
6978
6978
|
[t.id, e]
|
|
6979
6979
|
);
|
|
6980
6980
|
}
|
|
6981
|
-
function
|
|
6981
|
+
function Aa(t, e = {}) {
|
|
6982
6982
|
var o, u;
|
|
6983
6983
|
const [n, r] = mr(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
|
|
6984
6984
|
peers: {},
|
|
@@ -7003,11 +7003,11 @@ function Oa(t, e = {}) {
|
|
|
7003
7003
|
publishPresence: i
|
|
7004
7004
|
}), [n, i]);
|
|
7005
7005
|
}
|
|
7006
|
-
function
|
|
7006
|
+
function Ea(t, e, n) {
|
|
7007
7007
|
ge(() => t.core._reactor.joinRoom(t.id, e), [t.id]), ge(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
|
|
7008
7008
|
}
|
|
7009
|
-
function
|
|
7010
|
-
const r =
|
|
7009
|
+
function ja(t, e, n = {}) {
|
|
7010
|
+
const r = ma(), i = ye.usePresence(t, {
|
|
7011
7011
|
keys: [e]
|
|
7012
7012
|
}), s = Mt(() => {
|
|
7013
7013
|
const c = t._core._reactor.getPresence(
|
|
@@ -7021,7 +7021,7 @@ function Ea(t, e, n = {}) {
|
|
|
7021
7021
|
(c) => {
|
|
7022
7022
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
7023
7023
|
[e]: c
|
|
7024
|
-
}), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ??
|
|
7024
|
+
}), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? va, () => {
|
|
7025
7025
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
7026
7026
|
[e]: null
|
|
7027
7027
|
});
|
|
@@ -7044,25 +7044,25 @@ function Ea(t, e, n = {}) {
|
|
|
7044
7044
|
};
|
|
7045
7045
|
}
|
|
7046
7046
|
const ye = {
|
|
7047
|
-
useTopicEffect:
|
|
7048
|
-
usePublishTopic:
|
|
7049
|
-
usePresence:
|
|
7050
|
-
useSyncPresence:
|
|
7051
|
-
useTypingIndicator:
|
|
7047
|
+
useTopicEffect: Sa,
|
|
7048
|
+
usePublishTopic: Oa,
|
|
7049
|
+
usePresence: Aa,
|
|
7050
|
+
useSyncPresence: Ea,
|
|
7051
|
+
useTypingIndicator: ja
|
|
7052
7052
|
};
|
|
7053
|
-
class
|
|
7053
|
+
class ka {
|
|
7054
7054
|
constructor(e, n, r) {
|
|
7055
7055
|
this.useTopicEffect = (i, s) => {
|
|
7056
7056
|
ye.useTopicEffect(this, i, s);
|
|
7057
7057
|
}, this.usePublishTopic = (i) => ye.usePublishTopic(this, i), this.usePresence = (i = {}) => ye.usePresence(this, i), this.useSyncPresence = (i, s) => ye.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => ye.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
|
|
7058
7058
|
}
|
|
7059
7059
|
}
|
|
7060
|
-
const
|
|
7060
|
+
const Ia = {
|
|
7061
7061
|
isLoading: !0,
|
|
7062
7062
|
user: void 0,
|
|
7063
7063
|
error: void 0
|
|
7064
7064
|
};
|
|
7065
|
-
class
|
|
7065
|
+
class Pa {
|
|
7066
7066
|
constructor(e, n) {
|
|
7067
7067
|
this.tx = cn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
7068
7068
|
const [i, s] = mr(null);
|
|
@@ -7072,7 +7072,7 @@ class Ca {
|
|
|
7072
7072
|
s(u);
|
|
7073
7073
|
})();
|
|
7074
7074
|
}, [r]), i;
|
|
7075
|
-
}, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) =>
|
|
7075
|
+
}, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => wa(this.core, r, i).state, this.useAuth = () => this._useAuth(), this.useUser = () => {
|
|
7076
7076
|
const { user: r } = this.useAuth();
|
|
7077
7077
|
if (!r)
|
|
7078
7078
|
throw new ke(
|
|
@@ -7097,7 +7097,7 @@ class Ca {
|
|
|
7097
7097
|
}, this.SignedOut = ({ children: r }) => {
|
|
7098
7098
|
const i = this.useAuth();
|
|
7099
7099
|
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ tt.jsx(tt.Fragment, { children: r });
|
|
7100
|
-
}, this.core =
|
|
7100
|
+
}, this.core = _a(
|
|
7101
7101
|
e,
|
|
7102
7102
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
7103
7103
|
this.constructor.Storage,
|
|
@@ -7121,7 +7121,7 @@ class Ca {
|
|
|
7121
7121
|
* const { peers } = db.rooms.usePresence(room);
|
|
7122
7122
|
*/
|
|
7123
7123
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
7124
|
-
return new
|
|
7124
|
+
return new ka(this.core, e, n);
|
|
7125
7125
|
}
|
|
7126
7126
|
_useAuth() {
|
|
7127
7127
|
const e = ze(
|
|
@@ -7132,7 +7132,7 @@ class Ca {
|
|
|
7132
7132
|
return Pt(
|
|
7133
7133
|
n,
|
|
7134
7134
|
() => e.current,
|
|
7135
|
-
() =>
|
|
7135
|
+
() => Ia
|
|
7136
7136
|
);
|
|
7137
7137
|
}
|
|
7138
7138
|
/**
|
|
@@ -7150,5 +7150,5 @@ class Ca {
|
|
|
7150
7150
|
}
|
|
7151
7151
|
}
|
|
7152
7152
|
export {
|
|
7153
|
-
|
|
7153
|
+
Pa as InstantReactAbstractDatabase
|
|
7154
7154
|
};
|