@poolse/sdk 2.22.0 → 2.23.0

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.cts CHANGED
@@ -11,6 +11,23 @@ interface Me {
11
11
  is_blocked: boolean;
12
12
  inserted_at: IsoDateTime;
13
13
  updated_at: IsoDateTime;
14
+ /** Where read receipts stand for this user. Absent on older servers (treat as on). */
15
+ read_receipts?: ReadReceiptsState;
16
+ }
17
+ /**
18
+ * The workspace's read-receipt setting, as it applies to one user.
19
+ * `visible: false` means the app shows no check marks at all — the
20
+ * server withholds other members' read state anyway.
21
+ */
22
+ interface ReadReceiptsState {
23
+ /** `on`: everyone sees them; `off`: nobody; `user`: each user decides (reciprocal). */
24
+ mode: 'on' | 'off' | 'user';
25
+ /** Whether others see when this user reads. */
26
+ shared: boolean;
27
+ /** True only in `user` mode — the app may offer a switch (`me.update`). */
28
+ can_change: boolean;
29
+ /** Whether this user sees other people's read state. */
30
+ visible: boolean;
14
31
  }
15
32
  type ConversationType = 'direct' | 'group';
16
33
  interface Conversation {
@@ -1463,12 +1480,36 @@ declare class DevicesResource {
1463
1480
  unregister(token: string, signal?: AbortSignal): Promise<void>;
1464
1481
  }
1465
1482
 
1466
- /** `/v1/me` — the End-User identity behind the presented JWT. */
1483
+ interface UpdateMeRequest {
1484
+ /**
1485
+ * Whether others see when this user reads their messages. Accepted
1486
+ * only while the workspace lets users decide (`read_receipts.can_change`);
1487
+ * otherwise the server answers 409 `read_receipts_fixed`. Reciprocal:
1488
+ * turning it off also hides other people's.
1489
+ */
1490
+ read_receipts?: boolean;
1491
+ }
1492
+ /**
1493
+ * `/v1/me` — the End-User identity behind the presented JWT.
1494
+ *
1495
+ * Keeps the last-known user so every screen agrees: a change made
1496
+ * through `update` (say, turning read receipts off) reaches every
1497
+ * `onChange` subscriber at once instead of waiting for a remount.
1498
+ */
1467
1499
  declare class MeResource {
1468
1500
  private readonly client;
1501
+ private current;
1502
+ private readonly listeners;
1469
1503
  constructor(client: RestClient);
1470
1504
  /** GET /v1/me */
1471
1505
  show(signal?: AbortSignal): Promise<Me>;
1506
+ /** PATCH /v1/me — the user's own preferences. */
1507
+ update(body: UpdateMeRequest, signal?: AbortSignal): Promise<Me>;
1508
+ /** The last user `show` / `update` returned, or null before the first. */
1509
+ peek(): Me | null;
1510
+ /** Called with the user whenever `show` or `update` returns a new one. */
1511
+ onChange(fn: (me: Me) => void): () => void;
1512
+ private set;
1472
1513
  }
1473
1514
 
1474
1515
  type Listener = () => void;
@@ -2100,7 +2141,7 @@ declare class AuthError extends ApiError {
2100
2141
  declare function isWebRtcAvailable(): boolean;
2101
2142
  declare function createBrowserWebRtcAdapter(): WebRtcAdapter;
2102
2143
 
2103
- declare const version = "2.22.0";
2144
+ declare const version = "2.23.0";
2104
2145
 
2105
2146
  type CallLogMedia = 'audio' | 'video';
2106
2147
  /** What became of one person a call involved (the caller excluded). */
@@ -2210,4 +2251,4 @@ declare function formatCallLogPreview(preview: string | null | undefined, curren
2210
2251
 
2211
2252
  declare function safeUuid(): string;
2212
2253
 
2213
- export { type AddMemberOptions, ApiError, type Attachment, type AttachmentDownloadResponse, AttachmentHandle, type AttachmentOptions, type AttachmentProgressEvent, type AttachmentStatus, type AttachmentUploadInput, type AttachmentUploadRequest, type AttachmentUploadResponse, AttachmentsResource, AuthError, type CallAccepted, type CallBusy, type CallCancelled, type CallConnection, type CallDeclined, type CallDevice, type CallDeviceKind, type CallEndReason, type CallEnded, type CallFinishedEvent, type CallLog, type CallLogDisplay, type CallLogEntry, type CallLogMedia, type CallMedia, type CallMissedEntry, type CallParticipant, type CallParticipantStatus, type CallParticipantsEvent, CallRoom, type CallRoomOptions, type CallRoomStatus, type CallStartedEvent, CallTokensResource, CallsResource, type CameraFacing, type CheckedLiveKitModule, type Conversation, ConversationChannel, type ConversationCreateRequest, type ConversationCreatedEvent, ConversationHandle, type ConversationList, ConversationMessages, type ConversationType, type ConversationUpdateRequest, type ConversationUpdatedEvent, ConversationsResource, type Device, type DeviceEnvironment, type DeviceKind, type DevicePlatform, DevicesResource, type ErrorEnvelope, type IceServerResponse, IceServersResource, type IncomingCall, type IsoDateTime, type LiveCall, type LiveCallMember, LiveCallsResource, type LiveKitLocalVideoTrack, type LiveKitModule, type LiveKitParticipant, type LiveKitPublication, type LiveKitRoomHandle, type LiveKitTrack, type LiveKitTrackReference, type Me, MeResource, type MemberReadEvent, type MemberRole, type Membership, type MembershipCreateRequest, type MembershipList, type MentionEvent, type Message, type MessageCreateRequest, type MessageDeletedEvent, MessageHandle, type MessageList, type MessageNewEvent, type MessageType, type MessageUpdateRequest, type MessageUpdatedEvent, MessagesResource, NetworkError, type OutgoingCall, POOLSE_API_URL, Poolse, type PoolseConfig, PoolseError, PoolseRealtime, type PoolseUserProfile, type PresenceSnapshot, type QuotedMessagePreview, RateLimitedError, type ReactionEvent, type ReactionRequest, type ReadRequest, type RealtimeStatus, type RegisterDeviceRequest, type TypingEvent, type Unsubscribe$1 as Unsubscribe, UserChannel, UsersResource, type Uuid, type VoiceCandidate, type VoiceDescription, type VoiceIceServer, type VoiceParticipant, type VoicePeerConnection, VoiceRoom, type VoiceRoomOptions, type VoiceStatus, type VoiceStream, type VoiceTrack, type WebRtcAdapter, callLogDisplayFor, createBrowserWebRtcAdapter, describeCallLog, formatCallDuration, formatCallLogPreview, isCallLogMessage, isMessageVisibleTo, isWebRtcAvailable, parseCallLog, parseCallLogBody, safeUuid, version };
2254
+ export { type AddMemberOptions, ApiError, type Attachment, type AttachmentDownloadResponse, AttachmentHandle, type AttachmentOptions, type AttachmentProgressEvent, type AttachmentStatus, type AttachmentUploadInput, type AttachmentUploadRequest, type AttachmentUploadResponse, AttachmentsResource, AuthError, type CallAccepted, type CallBusy, type CallCancelled, type CallConnection, type CallDeclined, type CallDevice, type CallDeviceKind, type CallEndReason, type CallEnded, type CallFinishedEvent, type CallLog, type CallLogDisplay, type CallLogEntry, type CallLogMedia, type CallMedia, type CallMissedEntry, type CallParticipant, type CallParticipantStatus, type CallParticipantsEvent, CallRoom, type CallRoomOptions, type CallRoomStatus, type CallStartedEvent, CallTokensResource, CallsResource, type CameraFacing, type CheckedLiveKitModule, type Conversation, ConversationChannel, type ConversationCreateRequest, type ConversationCreatedEvent, ConversationHandle, type ConversationList, ConversationMessages, type ConversationType, type ConversationUpdateRequest, type ConversationUpdatedEvent, ConversationsResource, type Device, type DeviceEnvironment, type DeviceKind, type DevicePlatform, DevicesResource, type ErrorEnvelope, type IceServerResponse, IceServersResource, type IncomingCall, type IsoDateTime, type LiveCall, type LiveCallMember, LiveCallsResource, type LiveKitLocalVideoTrack, type LiveKitModule, type LiveKitParticipant, type LiveKitPublication, type LiveKitRoomHandle, type LiveKitTrack, type LiveKitTrackReference, type Me, MeResource, type MemberReadEvent, type MemberRole, type Membership, type MembershipCreateRequest, type MembershipList, type MentionEvent, type Message, type MessageCreateRequest, type MessageDeletedEvent, MessageHandle, type MessageList, type MessageNewEvent, type MessageType, type MessageUpdateRequest, type MessageUpdatedEvent, MessagesResource, NetworkError, type OutgoingCall, POOLSE_API_URL, Poolse, type PoolseConfig, PoolseError, PoolseRealtime, type PoolseUserProfile, type PresenceSnapshot, type QuotedMessagePreview, RateLimitedError, type ReactionEvent, type ReactionRequest, type ReadReceiptsState, type ReadRequest, type RealtimeStatus, type RegisterDeviceRequest, type TypingEvent, type Unsubscribe$1 as Unsubscribe, type UpdateMeRequest, UserChannel, UsersResource, type Uuid, type VoiceCandidate, type VoiceDescription, type VoiceIceServer, type VoiceParticipant, type VoicePeerConnection, VoiceRoom, type VoiceRoomOptions, type VoiceStatus, type VoiceStream, type VoiceTrack, type WebRtcAdapter, callLogDisplayFor, createBrowserWebRtcAdapter, describeCallLog, formatCallDuration, formatCallLogPreview, isCallLogMessage, isMessageVisibleTo, isWebRtcAvailable, parseCallLog, parseCallLogBody, safeUuid, version };
package/dist/index.d.ts CHANGED
@@ -11,6 +11,23 @@ interface Me {
11
11
  is_blocked: boolean;
12
12
  inserted_at: IsoDateTime;
13
13
  updated_at: IsoDateTime;
14
+ /** Where read receipts stand for this user. Absent on older servers (treat as on). */
15
+ read_receipts?: ReadReceiptsState;
16
+ }
17
+ /**
18
+ * The workspace's read-receipt setting, as it applies to one user.
19
+ * `visible: false` means the app shows no check marks at all — the
20
+ * server withholds other members' read state anyway.
21
+ */
22
+ interface ReadReceiptsState {
23
+ /** `on`: everyone sees them; `off`: nobody; `user`: each user decides (reciprocal). */
24
+ mode: 'on' | 'off' | 'user';
25
+ /** Whether others see when this user reads. */
26
+ shared: boolean;
27
+ /** True only in `user` mode — the app may offer a switch (`me.update`). */
28
+ can_change: boolean;
29
+ /** Whether this user sees other people's read state. */
30
+ visible: boolean;
14
31
  }
15
32
  type ConversationType = 'direct' | 'group';
16
33
  interface Conversation {
@@ -1463,12 +1480,36 @@ declare class DevicesResource {
1463
1480
  unregister(token: string, signal?: AbortSignal): Promise<void>;
1464
1481
  }
1465
1482
 
1466
- /** `/v1/me` — the End-User identity behind the presented JWT. */
1483
+ interface UpdateMeRequest {
1484
+ /**
1485
+ * Whether others see when this user reads their messages. Accepted
1486
+ * only while the workspace lets users decide (`read_receipts.can_change`);
1487
+ * otherwise the server answers 409 `read_receipts_fixed`. Reciprocal:
1488
+ * turning it off also hides other people's.
1489
+ */
1490
+ read_receipts?: boolean;
1491
+ }
1492
+ /**
1493
+ * `/v1/me` — the End-User identity behind the presented JWT.
1494
+ *
1495
+ * Keeps the last-known user so every screen agrees: a change made
1496
+ * through `update` (say, turning read receipts off) reaches every
1497
+ * `onChange` subscriber at once instead of waiting for a remount.
1498
+ */
1467
1499
  declare class MeResource {
1468
1500
  private readonly client;
1501
+ private current;
1502
+ private readonly listeners;
1469
1503
  constructor(client: RestClient);
1470
1504
  /** GET /v1/me */
1471
1505
  show(signal?: AbortSignal): Promise<Me>;
1506
+ /** PATCH /v1/me — the user's own preferences. */
1507
+ update(body: UpdateMeRequest, signal?: AbortSignal): Promise<Me>;
1508
+ /** The last user `show` / `update` returned, or null before the first. */
1509
+ peek(): Me | null;
1510
+ /** Called with the user whenever `show` or `update` returns a new one. */
1511
+ onChange(fn: (me: Me) => void): () => void;
1512
+ private set;
1472
1513
  }
1473
1514
 
1474
1515
  type Listener = () => void;
@@ -2100,7 +2141,7 @@ declare class AuthError extends ApiError {
2100
2141
  declare function isWebRtcAvailable(): boolean;
2101
2142
  declare function createBrowserWebRtcAdapter(): WebRtcAdapter;
2102
2143
 
2103
- declare const version = "2.22.0";
2144
+ declare const version = "2.23.0";
2104
2145
 
2105
2146
  type CallLogMedia = 'audio' | 'video';
2106
2147
  /** What became of one person a call involved (the caller excluded). */
@@ -2210,4 +2251,4 @@ declare function formatCallLogPreview(preview: string | null | undefined, curren
2210
2251
 
2211
2252
  declare function safeUuid(): string;
2212
2253
 
2213
- export { type AddMemberOptions, ApiError, type Attachment, type AttachmentDownloadResponse, AttachmentHandle, type AttachmentOptions, type AttachmentProgressEvent, type AttachmentStatus, type AttachmentUploadInput, type AttachmentUploadRequest, type AttachmentUploadResponse, AttachmentsResource, AuthError, type CallAccepted, type CallBusy, type CallCancelled, type CallConnection, type CallDeclined, type CallDevice, type CallDeviceKind, type CallEndReason, type CallEnded, type CallFinishedEvent, type CallLog, type CallLogDisplay, type CallLogEntry, type CallLogMedia, type CallMedia, type CallMissedEntry, type CallParticipant, type CallParticipantStatus, type CallParticipantsEvent, CallRoom, type CallRoomOptions, type CallRoomStatus, type CallStartedEvent, CallTokensResource, CallsResource, type CameraFacing, type CheckedLiveKitModule, type Conversation, ConversationChannel, type ConversationCreateRequest, type ConversationCreatedEvent, ConversationHandle, type ConversationList, ConversationMessages, type ConversationType, type ConversationUpdateRequest, type ConversationUpdatedEvent, ConversationsResource, type Device, type DeviceEnvironment, type DeviceKind, type DevicePlatform, DevicesResource, type ErrorEnvelope, type IceServerResponse, IceServersResource, type IncomingCall, type IsoDateTime, type LiveCall, type LiveCallMember, LiveCallsResource, type LiveKitLocalVideoTrack, type LiveKitModule, type LiveKitParticipant, type LiveKitPublication, type LiveKitRoomHandle, type LiveKitTrack, type LiveKitTrackReference, type Me, MeResource, type MemberReadEvent, type MemberRole, type Membership, type MembershipCreateRequest, type MembershipList, type MentionEvent, type Message, type MessageCreateRequest, type MessageDeletedEvent, MessageHandle, type MessageList, type MessageNewEvent, type MessageType, type MessageUpdateRequest, type MessageUpdatedEvent, MessagesResource, NetworkError, type OutgoingCall, POOLSE_API_URL, Poolse, type PoolseConfig, PoolseError, PoolseRealtime, type PoolseUserProfile, type PresenceSnapshot, type QuotedMessagePreview, RateLimitedError, type ReactionEvent, type ReactionRequest, type ReadRequest, type RealtimeStatus, type RegisterDeviceRequest, type TypingEvent, type Unsubscribe$1 as Unsubscribe, UserChannel, UsersResource, type Uuid, type VoiceCandidate, type VoiceDescription, type VoiceIceServer, type VoiceParticipant, type VoicePeerConnection, VoiceRoom, type VoiceRoomOptions, type VoiceStatus, type VoiceStream, type VoiceTrack, type WebRtcAdapter, callLogDisplayFor, createBrowserWebRtcAdapter, describeCallLog, formatCallDuration, formatCallLogPreview, isCallLogMessage, isMessageVisibleTo, isWebRtcAvailable, parseCallLog, parseCallLogBody, safeUuid, version };
2254
+ export { type AddMemberOptions, ApiError, type Attachment, type AttachmentDownloadResponse, AttachmentHandle, type AttachmentOptions, type AttachmentProgressEvent, type AttachmentStatus, type AttachmentUploadInput, type AttachmentUploadRequest, type AttachmentUploadResponse, AttachmentsResource, AuthError, type CallAccepted, type CallBusy, type CallCancelled, type CallConnection, type CallDeclined, type CallDevice, type CallDeviceKind, type CallEndReason, type CallEnded, type CallFinishedEvent, type CallLog, type CallLogDisplay, type CallLogEntry, type CallLogMedia, type CallMedia, type CallMissedEntry, type CallParticipant, type CallParticipantStatus, type CallParticipantsEvent, CallRoom, type CallRoomOptions, type CallRoomStatus, type CallStartedEvent, CallTokensResource, CallsResource, type CameraFacing, type CheckedLiveKitModule, type Conversation, ConversationChannel, type ConversationCreateRequest, type ConversationCreatedEvent, ConversationHandle, type ConversationList, ConversationMessages, type ConversationType, type ConversationUpdateRequest, type ConversationUpdatedEvent, ConversationsResource, type Device, type DeviceEnvironment, type DeviceKind, type DevicePlatform, DevicesResource, type ErrorEnvelope, type IceServerResponse, IceServersResource, type IncomingCall, type IsoDateTime, type LiveCall, type LiveCallMember, LiveCallsResource, type LiveKitLocalVideoTrack, type LiveKitModule, type LiveKitParticipant, type LiveKitPublication, type LiveKitRoomHandle, type LiveKitTrack, type LiveKitTrackReference, type Me, MeResource, type MemberReadEvent, type MemberRole, type Membership, type MembershipCreateRequest, type MembershipList, type MentionEvent, type Message, type MessageCreateRequest, type MessageDeletedEvent, MessageHandle, type MessageList, type MessageNewEvent, type MessageType, type MessageUpdateRequest, type MessageUpdatedEvent, MessagesResource, NetworkError, type OutgoingCall, POOLSE_API_URL, Poolse, type PoolseConfig, PoolseError, PoolseRealtime, type PoolseUserProfile, type PresenceSnapshot, type QuotedMessagePreview, RateLimitedError, type ReactionEvent, type ReactionRequest, type ReadReceiptsState, type ReadRequest, type RealtimeStatus, type RegisterDeviceRequest, type TypingEvent, type Unsubscribe$1 as Unsubscribe, type UpdateMeRequest, UserChannel, UsersResource, type Uuid, type VoiceCandidate, type VoiceDescription, type VoiceIceServer, type VoiceParticipant, type VoicePeerConnection, VoiceRoom, type VoiceRoomOptions, type VoiceStatus, type VoiceStream, type VoiceTrack, type WebRtcAdapter, callLogDisplayFor, createBrowserWebRtcAdapter, describeCallLog, formatCallDuration, formatCallLogPreview, isCallLogMessage, isMessageVisibleTo, isWebRtcAvailable, parseCallLog, parseCallLogBody, safeUuid, version };
package/dist/index.js CHANGED
@@ -1537,13 +1537,43 @@ var MeResource = class {
1537
1537
  this.client = client;
1538
1538
  }
1539
1539
  client;
1540
+ current = null;
1541
+ listeners = /* @__PURE__ */ new Set();
1540
1542
  /** GET /v1/me */
1541
- show(signal) {
1542
- return this.client.request({
1543
+ async show(signal) {
1544
+ const me = await this.client.request({
1543
1545
  method: "GET",
1544
1546
  path: "/v1/me",
1545
1547
  ...signal ? { signal } : {}
1546
1548
  });
1549
+ this.set(me);
1550
+ return me;
1551
+ }
1552
+ /** PATCH /v1/me — the user's own preferences. */
1553
+ async update(body, signal) {
1554
+ const me = await this.client.request({
1555
+ method: "PATCH",
1556
+ path: "/v1/me",
1557
+ body,
1558
+ ...signal ? { signal } : {}
1559
+ });
1560
+ this.set(me);
1561
+ return me;
1562
+ }
1563
+ /** The last user `show` / `update` returned, or null before the first. */
1564
+ peek() {
1565
+ return this.current;
1566
+ }
1567
+ /** Called with the user whenever `show` or `update` returns a new one. */
1568
+ onChange(fn) {
1569
+ this.listeners.add(fn);
1570
+ return () => {
1571
+ this.listeners.delete(fn);
1572
+ };
1573
+ }
1574
+ set(me) {
1575
+ this.current = me;
1576
+ for (const fn of this.listeners) fn(me);
1547
1577
  }
1548
1578
  };
1549
1579
 
@@ -2490,7 +2520,7 @@ var Poolse = class {
2490
2520
  };
2491
2521
 
2492
2522
  // src/version.ts
2493
- var version = "2.22.0";
2523
+ var version = "2.23.0";
2494
2524
 
2495
2525
  // src/call-log.ts
2496
2526
  function parseCallLogBody(body) {