@nemphi/sdk 0.2.4941 → 0.2.4995
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/index.d.ts +11 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -135
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -575,9 +575,8 @@ export interface Notification {
|
|
|
575
575
|
seq?: number;
|
|
576
576
|
}
|
|
577
577
|
/**
|
|
578
|
-
* One
|
|
579
|
-
* `
|
|
580
|
-
* `GET /v1/events/socket`).
|
|
578
|
+
* One event on the workspace's realtime hub (`GET /v1/events/socket`, and
|
|
579
|
+
* the `typing` / `presence` / `marketing` frames of `GET /v1/events/stream`).
|
|
581
580
|
* `action` and `notification` are wakeups — re-read the surface, the row
|
|
582
581
|
* itself comes by cursor; the rest is state that only matters while
|
|
583
582
|
* someone is watching.
|
|
@@ -655,22 +654,19 @@ export type RealtimeEvent = {
|
|
|
655
654
|
export type TypingScope = Extract<RealtimeEvent, {
|
|
656
655
|
type: "typing";
|
|
657
656
|
}>["scope"];
|
|
658
|
-
/** An open realtime
|
|
657
|
+
/** An open realtime socket; `close()` stops it and its reconnects. */
|
|
659
658
|
export interface RealtimeSocket {
|
|
660
659
|
close(): void;
|
|
661
660
|
}
|
|
662
661
|
export interface RealtimeSocketOptions {
|
|
663
662
|
onEvent: (event: RealtimeEvent) => void;
|
|
664
|
-
/**
|
|
665
|
-
* Called when the first poll answers, and again when one answers after
|
|
666
|
-
* polls failed; a screen re-reads what it shows here.
|
|
667
|
-
*/
|
|
663
|
+
/** Called when the socket connects (and reconnects); a screen re-reads what it shows here. */
|
|
668
664
|
onOpen?: () => void;
|
|
669
|
-
/** Called when a poll fails after one answered. */
|
|
670
665
|
onClose?: () => void;
|
|
671
666
|
/**
|
|
672
|
-
*
|
|
673
|
-
*
|
|
667
|
+
* How to open a WebSocket with headers. React Native's `WebSocket`
|
|
668
|
+
* takes them as a third argument, which the default uses; a browser
|
|
669
|
+
* cannot set them and should use the app's own stream route instead.
|
|
674
670
|
*/
|
|
675
671
|
webSocket?: (url: string, headers: Record<string, string>) => WebSocket;
|
|
676
672
|
}
|
|
@@ -8468,12 +8464,10 @@ export interface NemphiClient {
|
|
|
8468
8464
|
signal?: AbortSignal;
|
|
8469
8465
|
}): AsyncGenerator<Action, void, void>;
|
|
8470
8466
|
/**
|
|
8471
|
-
* The
|
|
8472
|
-
*
|
|
8473
|
-
* until `close()
|
|
8474
|
-
*
|
|
8475
|
-
* that changed. Each poll keeps the caller online. The web app polls the
|
|
8476
|
-
* same route through its own server route.
|
|
8467
|
+
* The realtime hub over a WebSocket (`GET /v1/events/socket`) for a
|
|
8468
|
+
* runtime without `EventSource`: every hub event as it happens, with
|
|
8469
|
+
* reconnects until `close()`. The web app reads the same events through
|
|
8470
|
+
* its own stream route instead.
|
|
8477
8471
|
*/
|
|
8478
8472
|
openRealtimeSocket(options: RealtimeSocketOptions): RealtimeSocket;
|
|
8479
8473
|
/** Say the caller is writing in a thread or an inbox conversation (`POST /v1/events/typing`); nothing is stored. */
|