@openmarket/rooms-client 0.7.0 → 0.7.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/social-client.d.ts +18 -4
- package/dist/social-client.js +10 -5
- package/package.json +1 -1
- package/src/social-client.ts +26 -6
package/dist/social-client.d.ts
CHANGED
|
@@ -450,13 +450,27 @@ export declare function markRoomUnread(config: RoomSocialConfig, room: string, s
|
|
|
450
450
|
* one. The pinned ROOM_SET_ATTENTION frame (setRoomAttentionOnClient)
|
|
451
451
|
* predates `untilMs` and stays the live-session path for permanent
|
|
452
452
|
* postures; servers older than mute-with-duration strip the field and land
|
|
453
|
-
* the mute permanent, so a requested `untilMs` the echo omits
|
|
454
|
-
*
|
|
455
|
-
* unbounded mute the caller believes
|
|
456
|
-
*
|
|
453
|
+
* the mute permanent, so a requested `untilMs` the echo omits is a DROPPED
|
|
454
|
+
* DEADLINE. By default that fail-closes here: the attention is reset and
|
|
455
|
+
* the call throws rather than leave an unbounded mute the caller believes
|
|
456
|
+
* timed. Callers with a richer fail-closed seam of their own opt out via
|
|
457
|
+
* `onDroppedDeadline: "resolve"` and own the handling (see the option).
|
|
458
|
+
* Echoes the persisted attention; `muteUntil` is the ISO expiry, null when
|
|
459
|
+
* none stands (which, under "resolve", is how a dropped deadline reads).
|
|
457
460
|
*/
|
|
458
461
|
export declare function setRoomAttentionRest(config: RoomSocialConfig, room: string, attention: RoomTopicAttention, options?: {
|
|
459
462
|
untilMs?: number | undefined;
|
|
463
|
+
/** What to do when a requested `untilMs` comes back without an echoed
|
|
464
|
+
* `muteUntil` (the server predates timed mutes and landed the mute
|
|
465
|
+
* PERMANENT). Default "undo-and-throw": reset attention to 'default'
|
|
466
|
+
* and throw RoomSocialError 502, so no unbounded mute stands. Pass
|
|
467
|
+
* "resolve" ONLY when the caller implements its own dropped-deadline
|
|
468
|
+
* handling: the call then performs no undo write and no throw, and
|
|
469
|
+
* resolves with `muteUntil: null` for the caller to act on. Canonical
|
|
470
|
+
* example: the GUI session seam, which undoes to the last
|
|
471
|
+
* WS-confirmed attention, richer than this library's
|
|
472
|
+
* undo-to-default. */
|
|
473
|
+
onDroppedDeadline?: "undo-and-throw" | "resolve" | undefined;
|
|
460
474
|
}): Promise<{
|
|
461
475
|
attention: RoomTopicAttention;
|
|
462
476
|
muteUntil: string | null;
|
package/dist/social-client.js
CHANGED
|
@@ -724,10 +724,13 @@ export async function markRoomUnread(config, room, seq) {
|
|
|
724
724
|
* one. The pinned ROOM_SET_ATTENTION frame (setRoomAttentionOnClient)
|
|
725
725
|
* predates `untilMs` and stays the live-session path for permanent
|
|
726
726
|
* postures; servers older than mute-with-duration strip the field and land
|
|
727
|
-
* the mute permanent, so a requested `untilMs` the echo omits
|
|
728
|
-
*
|
|
729
|
-
* unbounded mute the caller believes
|
|
730
|
-
*
|
|
727
|
+
* the mute permanent, so a requested `untilMs` the echo omits is a DROPPED
|
|
728
|
+
* DEADLINE. By default that fail-closes here: the attention is reset and
|
|
729
|
+
* the call throws rather than leave an unbounded mute the caller believes
|
|
730
|
+
* timed. Callers with a richer fail-closed seam of their own opt out via
|
|
731
|
+
* `onDroppedDeadline: "resolve"` and own the handling (see the option).
|
|
732
|
+
* Echoes the persisted attention; `muteUntil` is the ISO expiry, null when
|
|
733
|
+
* none stands (which, under "resolve", is how a dropped deadline reads).
|
|
731
734
|
*/
|
|
732
735
|
export async function setRoomAttentionRest(config, room, attention, options = {}) {
|
|
733
736
|
const body = { attention };
|
|
@@ -738,7 +741,9 @@ export async function setRoomAttentionRest(config, room, attention, options = {}
|
|
|
738
741
|
body,
|
|
739
742
|
});
|
|
740
743
|
const muteUntil = typeof result.muteUntil === "string" ? result.muteUntil : null;
|
|
741
|
-
if (options.untilMs !== undefined &&
|
|
744
|
+
if (options.untilMs !== undefined &&
|
|
745
|
+
muteUntil === null &&
|
|
746
|
+
options.onDroppedDeadline !== "resolve") {
|
|
742
747
|
// The undo cannot know the caller's prior attention, so it deliberately
|
|
743
748
|
// lands 'default' (the same neutral a lapsed timed mute reads as, see
|
|
744
749
|
// resolveTopicAttention) rather than leave the unbounded mute standing.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmarket/rooms-client",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "OM Rooms protocol client: wire types, WebSocket + REST clients, and chat view-models. Browser-safe (no node:/bun: imports).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
package/src/social-client.ts
CHANGED
|
@@ -1456,16 +1456,32 @@ export async function markRoomUnread(
|
|
|
1456
1456
|
* one. The pinned ROOM_SET_ATTENTION frame (setRoomAttentionOnClient)
|
|
1457
1457
|
* predates `untilMs` and stays the live-session path for permanent
|
|
1458
1458
|
* postures; servers older than mute-with-duration strip the field and land
|
|
1459
|
-
* the mute permanent, so a requested `untilMs` the echo omits
|
|
1460
|
-
*
|
|
1461
|
-
* unbounded mute the caller believes
|
|
1462
|
-
*
|
|
1459
|
+
* the mute permanent, so a requested `untilMs` the echo omits is a DROPPED
|
|
1460
|
+
* DEADLINE. By default that fail-closes here: the attention is reset and
|
|
1461
|
+
* the call throws rather than leave an unbounded mute the caller believes
|
|
1462
|
+
* timed. Callers with a richer fail-closed seam of their own opt out via
|
|
1463
|
+
* `onDroppedDeadline: "resolve"` and own the handling (see the option).
|
|
1464
|
+
* Echoes the persisted attention; `muteUntil` is the ISO expiry, null when
|
|
1465
|
+
* none stands (which, under "resolve", is how a dropped deadline reads).
|
|
1463
1466
|
*/
|
|
1464
1467
|
export async function setRoomAttentionRest(
|
|
1465
1468
|
config: RoomSocialConfig,
|
|
1466
1469
|
room: string,
|
|
1467
1470
|
attention: RoomTopicAttention,
|
|
1468
|
-
options: {
|
|
1471
|
+
options: {
|
|
1472
|
+
untilMs?: number | undefined;
|
|
1473
|
+
/** What to do when a requested `untilMs` comes back without an echoed
|
|
1474
|
+
* `muteUntil` (the server predates timed mutes and landed the mute
|
|
1475
|
+
* PERMANENT). Default "undo-and-throw": reset attention to 'default'
|
|
1476
|
+
* and throw RoomSocialError 502, so no unbounded mute stands. Pass
|
|
1477
|
+
* "resolve" ONLY when the caller implements its own dropped-deadline
|
|
1478
|
+
* handling: the call then performs no undo write and no throw, and
|
|
1479
|
+
* resolves with `muteUntil: null` for the caller to act on. Canonical
|
|
1480
|
+
* example: the GUI session seam, which undoes to the last
|
|
1481
|
+
* WS-confirmed attention, richer than this library's
|
|
1482
|
+
* undo-to-default. */
|
|
1483
|
+
onDroppedDeadline?: "undo-and-throw" | "resolve" | undefined;
|
|
1484
|
+
} = {},
|
|
1469
1485
|
): Promise<{ attention: RoomTopicAttention; muteUntil: string | null }> {
|
|
1470
1486
|
const body: { attention: RoomTopicAttention; untilMs?: number } = { attention };
|
|
1471
1487
|
if (options.untilMs !== undefined) body.untilMs = options.untilMs;
|
|
@@ -1479,7 +1495,11 @@ export async function setRoomAttentionRest(
|
|
|
1479
1495
|
body,
|
|
1480
1496
|
});
|
|
1481
1497
|
const muteUntil = typeof result.muteUntil === "string" ? result.muteUntil : null;
|
|
1482
|
-
if (
|
|
1498
|
+
if (
|
|
1499
|
+
options.untilMs !== undefined &&
|
|
1500
|
+
muteUntil === null &&
|
|
1501
|
+
options.onDroppedDeadline !== "resolve"
|
|
1502
|
+
) {
|
|
1483
1503
|
// The undo cannot know the caller's prior attention, so it deliberately
|
|
1484
1504
|
// lands 'default' (the same neutral a lapsed timed mute reads as, see
|
|
1485
1505
|
// resolveTopicAttention) rather than leave the unbounded mute standing.
|