@volter/teams 0.2.50 → 0.2.51
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/package.json +1 -1
- package/session-follow.mjs +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/teams",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.51",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Volter Teams, the neutral team plane: machine identity and daemon core, the local door and server link, admission from machine grants, product doors, and the Teams server's neutral routes (company RFC 0008).",
|
|
6
6
|
"license": "MIT",
|
package/session-follow.mjs
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
// the hosted viewer uses, exported so a workplace that draws the session itself (RH2's Conversation, supercode-ui in
|
|
3
3
|
// its own tree) reads and labels it the same way. No imports: it runs as the viewer's own module and in a host's bundle.
|
|
4
4
|
|
|
5
|
+
// A signal that aborts `ms` from now, for use inside AbortSignal.any(). Its timer holds its controller, so it fires
|
|
6
|
+
// whatever the garbage collector does. AbortSignal.timeout() inside AbortSignal.any() does not on Node 23.9: the timeout
|
|
7
|
+
// signal is collected, the combined signal never aborts, and a request to a server that went quiet never ends.
|
|
8
|
+
const timeoutSignal=ms=>{const controller=new AbortController(),timer=setTimeout(()=>controller.abort(new DOMException('The operation was aborted due to timeout','TimeoutError')),ms);timer.unref?.();return controller.signal;};
|
|
9
|
+
|
|
5
10
|
/**
|
|
6
11
|
* Follow one session: its snapshot read whole (`/messages?tail=`, a busy session's is over the follow stream's 1 MB
|
|
7
12
|
* buffer), then its follow stream from that snapshot's cursor, each change meaning "read again". The stream ends when
|
|
@@ -25,7 +30,7 @@ export function followTeamSession({ origin, teamId, sessionId, token, tail = 300
|
|
|
25
30
|
let snapshot;
|
|
26
31
|
do {
|
|
27
32
|
requested = false;
|
|
28
|
-
const response = await fetchImpl(`${base}/messages?tail=${tail}`, { headers: await headers(), signal: AbortSignal.any([controller.signal,
|
|
33
|
+
const response = await fetchImpl(`${base}/messages?tail=${tail}`, { headers: await headers(), signal: AbortSignal.any([controller.signal, timeoutSignal(15000)]) });
|
|
29
34
|
if (!response.ok) throw failure('read', response.status, `reading the session failed (${response.status})`);
|
|
30
35
|
const body = await response.json();
|
|
31
36
|
if (controller.signal.aborted) throw new DOMException('Session follow stopped', 'AbortError');
|