@volter/teams 0.1.86 → 0.1.87
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/server/machine-link.mjs +13 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/teams",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.87",
|
|
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/server/machine-link.mjs
CHANGED
|
@@ -427,9 +427,19 @@ export async function deliverSessionRoomNotice(api, access) {
|
|
|
427
427
|
to, body: access.notice.text, id: `room-notice:${digest}`, queue: false } });
|
|
428
428
|
return await new Promise((resolve, reject) => {
|
|
429
429
|
let text = '';
|
|
430
|
-
const timeout = setTimeout(() => {
|
|
431
|
-
|
|
432
|
-
stream.on('
|
|
430
|
+
const timeout = setTimeout(() => { reject(new Error('Room notice delivery not confirmed')); stream.close('timeout'); }, 15000);
|
|
431
|
+
// Channel data is already text; the machine writes remote-deliver's JSON reply as a string.
|
|
432
|
+
stream.on('data', chunk => { text += chunk; });
|
|
433
|
+
stream.on('close', () => {
|
|
434
|
+
clearTimeout(timeout);
|
|
435
|
+
try {
|
|
436
|
+
if (!text.trim()) throw new Error('Room notice delivery returned no receipt');
|
|
437
|
+
const result = JSON.parse(text);
|
|
438
|
+
if (result?.code !== 0) throw new Error(result?.text ?? result?.detail ?? 'Room notice refused');
|
|
439
|
+
if (result.receipt?.delivered !== true) throw new Error(result.receipt?.reason ?? 'Room notice native delivery not confirmed');
|
|
440
|
+
resolve({ delivered: true, noticeId: access.notice.id });
|
|
441
|
+
} catch (error) { reject(error); }
|
|
442
|
+
});
|
|
433
443
|
stream.on('error', error => { clearTimeout(timeout); reject(error); });
|
|
434
444
|
});
|
|
435
445
|
} finally { await api.store.transaction([{ sql: 'DELETE FROM machine_grants WHERE team_id=? AND id=?', params: [access.teamId, id] }]); }
|