@unicitylabs/sphere-sdk 0.6.1 → 0.6.2
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/core/index.cjs +20 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +27 -1
- package/dist/core/index.d.ts +27 -1
- package/dist/core/index.js +20 -0
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/index.cjs +28 -0
- package/dist/impl/browser/index.cjs.map +1 -1
- package/dist/impl/browser/index.js +28 -0
- package/dist/impl/browser/index.js.map +1 -1
- package/dist/impl/nodejs/index.cjs +28 -0
- package/dist/impl/nodejs/index.cjs.map +1 -1
- package/dist/impl/nodejs/index.d.cts +11 -0
- package/dist/impl/nodejs/index.d.ts +11 -0
- package/dist/impl/nodejs/index.js +28 -0
- package/dist/impl/nodejs/index.js.map +1 -1
- package/dist/index.cjs +20 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/dist/l1/index.d.cts +0 -717
- package/dist/l1/index.d.ts +0 -717
|
@@ -1217,6 +1217,7 @@ var NostrTransportProvider = class {
|
|
|
1217
1217
|
this.mainSubscriptionId = null;
|
|
1218
1218
|
this.walletSubscriptionId = null;
|
|
1219
1219
|
this.chatSubscriptionId = null;
|
|
1220
|
+
this.chatEoseFired = false;
|
|
1220
1221
|
this.status = "disconnected";
|
|
1221
1222
|
this.emitEvent({ type: "transport:disconnected", timestamp: Date.now() });
|
|
1222
1223
|
logger.debug("Nostr", "Disconnected from all relays");
|
|
@@ -1540,6 +1541,20 @@ var NostrTransportProvider = class {
|
|
|
1540
1541
|
this.typingIndicatorHandlers.add(handler);
|
|
1541
1542
|
return () => this.typingIndicatorHandlers.delete(handler);
|
|
1542
1543
|
}
|
|
1544
|
+
onChatReady(handler) {
|
|
1545
|
+
if (this.chatEoseFired) {
|
|
1546
|
+
try {
|
|
1547
|
+
handler();
|
|
1548
|
+
} catch {
|
|
1549
|
+
}
|
|
1550
|
+
return () => {
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
this.chatEoseHandlers.push(handler);
|
|
1554
|
+
return () => {
|
|
1555
|
+
this.chatEoseHandlers = this.chatEoseHandlers.filter((h) => h !== handler);
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1543
1558
|
// ===========================================================================
|
|
1544
1559
|
// Composing Indicators (NIP-59 kind 25050)
|
|
1545
1560
|
// ===========================================================================
|
|
@@ -2257,6 +2272,9 @@ var NostrTransportProvider = class {
|
|
|
2257
2272
|
// Track subscription IDs for cleanup
|
|
2258
2273
|
walletSubscriptionId = null;
|
|
2259
2274
|
chatSubscriptionId = null;
|
|
2275
|
+
// Chat EOSE handlers — fired once when relay finishes delivering stored DMs
|
|
2276
|
+
chatEoseHandlers = [];
|
|
2277
|
+
chatEoseFired = false;
|
|
2260
2278
|
async subscribeToEvents() {
|
|
2261
2279
|
logger.debug("Nostr", "subscribeToEvents called, identity:", !!this.identity, "keyManager:", !!this.keyManager, "nostrClient:", !!this.nostrClient);
|
|
2262
2280
|
if (!this.identity || !this.keyManager || !this.nostrClient) {
|
|
@@ -2346,6 +2364,16 @@ var NostrTransportProvider = class {
|
|
|
2346
2364
|
},
|
|
2347
2365
|
onEndOfStoredEvents: () => {
|
|
2348
2366
|
logger.debug("Nostr", "Chat subscription ready (EOSE)");
|
|
2367
|
+
if (!this.chatEoseFired) {
|
|
2368
|
+
this.chatEoseFired = true;
|
|
2369
|
+
for (const handler of this.chatEoseHandlers) {
|
|
2370
|
+
try {
|
|
2371
|
+
handler();
|
|
2372
|
+
} catch {
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
this.chatEoseHandlers = [];
|
|
2376
|
+
}
|
|
2349
2377
|
},
|
|
2350
2378
|
onError: (_subId, error) => {
|
|
2351
2379
|
logger.debug("Nostr", "Chat subscription error:", error);
|