@poolse/sdk 2.23.0 → 2.24.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
@@ -866,6 +866,13 @@ interface RequestOptions {
866
866
  maxRetries?: number;
867
867
  /** AbortSignal for caller-driven cancellation. */
868
868
  signal?: AbortSignal;
869
+ /**
870
+ * Authorize with this token instead of the user's session — for the
871
+ * endpoints a call-scoped token authorizes (a call's control token).
872
+ * A 401 then surfaces at once: refreshing the session cannot fix a
873
+ * token the caller supplied.
874
+ */
875
+ bearer?: string;
869
876
  }
870
877
  declare class RestClient {
871
878
  private readonly config;
@@ -893,6 +900,8 @@ interface LiveCall {
893
900
  conversation_id: string;
894
901
  conversation_name: string | null;
895
902
  media: 'audio' | 'video';
903
+ /** `room` rang nobody (a drop-in meeting); `call` rang the members. Absent on older servers: call. */
904
+ kind?: 'call' | 'room';
896
905
  state: 'live' | 'finished';
897
906
  started_by: LiveCallMember;
898
907
  started_at: string | null;
@@ -1831,6 +1840,51 @@ declare class CallTokensResource {
1831
1840
  create(conversationId: string, signal?: AbortSignal): Promise<CallConnection | null>;
1832
1841
  }
1833
1842
 
1843
+ /** What starting or joining a room returns (the call contract's session bundle). */
1844
+ interface RoomSession {
1845
+ cv: number;
1846
+ /** True when this request started the room; false when it joined one already live. */
1847
+ created: boolean;
1848
+ /** The live room — or call: a ringing call already live there is joined instead. */
1849
+ call: LiveCall;
1850
+ /** SFU credentials for this participant. */
1851
+ livekit: {
1852
+ url: string;
1853
+ token: string;
1854
+ };
1855
+ /** Authorizes leaving (`leave`); scoped to this call. */
1856
+ control_token: string;
1857
+ }
1858
+ /**
1859
+ * A conversation's room — the Meet-style way to talk: anyone in the
1860
+ * conversation drops in for voice or video while the chat carries on,
1861
+ * and nobody's phone rings. One room per conversation; starting one
1862
+ * while it is live (or while a call is) joins that instead.
1863
+ *
1864
+ * Members see it the same way as a call — `liveCalls.get`, the
1865
+ * `call:started` / `call:participants` / `call:finished` events, a Join
1866
+ * banner — and phones join it like any call. It ends once it has been
1867
+ * empty for a short grace, and leaves one line in the chat history.
1868
+ */
1869
+ declare class RoomsResource {
1870
+ private readonly client;
1871
+ constructor(client: RestClient);
1872
+ /** POST /v1/conversations/:id/room — start the room, or join what is live. */
1873
+ start(conversationId: string, media?: 'audio' | 'video', signal?: AbortSignal): Promise<RoomSession>;
1874
+ /**
1875
+ * POST /v1/conversations/:id/calls — like `start`, but RINGS the other
1876
+ * members' phones (a support desk calling a customer). Off by default
1877
+ * in the room UI; an app opts in. Joins whatever is live instead, the
1878
+ * same as `start`.
1879
+ */
1880
+ ring(conversationId: string, media?: 'audio' | 'video', signal?: AbortSignal): Promise<RoomSession>;
1881
+ /**
1882
+ * POST /v1/calls/:id/hangup — leave. Never ends the room for the others;
1883
+ * it ends once empty. Authorized by the session's control token.
1884
+ */
1885
+ leave(session: Pick<RoomSession, 'call' | 'control_token'>): Promise<void>;
1886
+ }
1887
+
1834
1888
  type Unsubscribe = () => void;
1835
1889
  declare class CallRoom {
1836
1890
  private readonly livekit;
@@ -2060,6 +2114,8 @@ declare class Poolse {
2060
2114
  readonly callTokens: CallTokensResource;
2061
2115
  /** Whether a call is running on a conversation — for a Join banner. */
2062
2116
  readonly liveCalls: LiveCallsResource;
2117
+ /** A conversation's drop-in room: voice or video, nobody rung. */
2118
+ readonly rooms: RoomsResource;
2063
2119
  private readonly resolved;
2064
2120
  private readonly tokenCache;
2065
2121
  constructor(config: PoolseConfig);
@@ -2141,7 +2197,7 @@ declare class AuthError extends ApiError {
2141
2197
  declare function isWebRtcAvailable(): boolean;
2142
2198
  declare function createBrowserWebRtcAdapter(): WebRtcAdapter;
2143
2199
 
2144
- declare const version = "2.23.0";
2200
+ declare const version = "2.24.0";
2145
2201
 
2146
2202
  type CallLogMedia = 'audio' | 'video';
2147
2203
  /** What became of one person a call involved (the caller excluded). */
@@ -2158,6 +2214,8 @@ interface CallLogEntry {
2158
2214
  joinedUserIds: Uuid[];
2159
2215
  /** `2` for the one-record-per-call shape; `1` for older history. */
2160
2216
  version: 1 | 2;
2217
+ /** `room`: a drop-in meeting that rang nobody; `call`: rang the members. */
2218
+ callKind: 'call' | 'room';
2161
2219
  /** Who placed the call. `null` on v1 records. */
2162
2220
  callerUserId: Uuid | null;
2163
2221
  /** Everyone else the call involved, with their outcome. Empty on v1. */
@@ -2251,4 +2309,4 @@ declare function formatCallLogPreview(preview: string | null | undefined, curren
2251
2309
 
2252
2310
  declare function safeUuid(): string;
2253
2311
 
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 };
2312
+ 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 RoomSession, RoomsResource, 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
@@ -866,6 +866,13 @@ interface RequestOptions {
866
866
  maxRetries?: number;
867
867
  /** AbortSignal for caller-driven cancellation. */
868
868
  signal?: AbortSignal;
869
+ /**
870
+ * Authorize with this token instead of the user's session — for the
871
+ * endpoints a call-scoped token authorizes (a call's control token).
872
+ * A 401 then surfaces at once: refreshing the session cannot fix a
873
+ * token the caller supplied.
874
+ */
875
+ bearer?: string;
869
876
  }
870
877
  declare class RestClient {
871
878
  private readonly config;
@@ -893,6 +900,8 @@ interface LiveCall {
893
900
  conversation_id: string;
894
901
  conversation_name: string | null;
895
902
  media: 'audio' | 'video';
903
+ /** `room` rang nobody (a drop-in meeting); `call` rang the members. Absent on older servers: call. */
904
+ kind?: 'call' | 'room';
896
905
  state: 'live' | 'finished';
897
906
  started_by: LiveCallMember;
898
907
  started_at: string | null;
@@ -1831,6 +1840,51 @@ declare class CallTokensResource {
1831
1840
  create(conversationId: string, signal?: AbortSignal): Promise<CallConnection | null>;
1832
1841
  }
1833
1842
 
1843
+ /** What starting or joining a room returns (the call contract's session bundle). */
1844
+ interface RoomSession {
1845
+ cv: number;
1846
+ /** True when this request started the room; false when it joined one already live. */
1847
+ created: boolean;
1848
+ /** The live room — or call: a ringing call already live there is joined instead. */
1849
+ call: LiveCall;
1850
+ /** SFU credentials for this participant. */
1851
+ livekit: {
1852
+ url: string;
1853
+ token: string;
1854
+ };
1855
+ /** Authorizes leaving (`leave`); scoped to this call. */
1856
+ control_token: string;
1857
+ }
1858
+ /**
1859
+ * A conversation's room — the Meet-style way to talk: anyone in the
1860
+ * conversation drops in for voice or video while the chat carries on,
1861
+ * and nobody's phone rings. One room per conversation; starting one
1862
+ * while it is live (or while a call is) joins that instead.
1863
+ *
1864
+ * Members see it the same way as a call — `liveCalls.get`, the
1865
+ * `call:started` / `call:participants` / `call:finished` events, a Join
1866
+ * banner — and phones join it like any call. It ends once it has been
1867
+ * empty for a short grace, and leaves one line in the chat history.
1868
+ */
1869
+ declare class RoomsResource {
1870
+ private readonly client;
1871
+ constructor(client: RestClient);
1872
+ /** POST /v1/conversations/:id/room — start the room, or join what is live. */
1873
+ start(conversationId: string, media?: 'audio' | 'video', signal?: AbortSignal): Promise<RoomSession>;
1874
+ /**
1875
+ * POST /v1/conversations/:id/calls — like `start`, but RINGS the other
1876
+ * members' phones (a support desk calling a customer). Off by default
1877
+ * in the room UI; an app opts in. Joins whatever is live instead, the
1878
+ * same as `start`.
1879
+ */
1880
+ ring(conversationId: string, media?: 'audio' | 'video', signal?: AbortSignal): Promise<RoomSession>;
1881
+ /**
1882
+ * POST /v1/calls/:id/hangup — leave. Never ends the room for the others;
1883
+ * it ends once empty. Authorized by the session's control token.
1884
+ */
1885
+ leave(session: Pick<RoomSession, 'call' | 'control_token'>): Promise<void>;
1886
+ }
1887
+
1834
1888
  type Unsubscribe = () => void;
1835
1889
  declare class CallRoom {
1836
1890
  private readonly livekit;
@@ -2060,6 +2114,8 @@ declare class Poolse {
2060
2114
  readonly callTokens: CallTokensResource;
2061
2115
  /** Whether a call is running on a conversation — for a Join banner. */
2062
2116
  readonly liveCalls: LiveCallsResource;
2117
+ /** A conversation's drop-in room: voice or video, nobody rung. */
2118
+ readonly rooms: RoomsResource;
2063
2119
  private readonly resolved;
2064
2120
  private readonly tokenCache;
2065
2121
  constructor(config: PoolseConfig);
@@ -2141,7 +2197,7 @@ declare class AuthError extends ApiError {
2141
2197
  declare function isWebRtcAvailable(): boolean;
2142
2198
  declare function createBrowserWebRtcAdapter(): WebRtcAdapter;
2143
2199
 
2144
- declare const version = "2.23.0";
2200
+ declare const version = "2.24.0";
2145
2201
 
2146
2202
  type CallLogMedia = 'audio' | 'video';
2147
2203
  /** What became of one person a call involved (the caller excluded). */
@@ -2158,6 +2214,8 @@ interface CallLogEntry {
2158
2214
  joinedUserIds: Uuid[];
2159
2215
  /** `2` for the one-record-per-call shape; `1` for older history. */
2160
2216
  version: 1 | 2;
2217
+ /** `room`: a drop-in meeting that rang nobody; `call`: rang the members. */
2218
+ callKind: 'call' | 'room';
2161
2219
  /** Who placed the call. `null` on v1 records. */
2162
2220
  callerUserId: Uuid | null;
2163
2221
  /** Everyone else the call involved, with their outcome. Empty on v1. */
@@ -2251,4 +2309,4 @@ declare function formatCallLogPreview(preview: string | null | undefined, curren
2251
2309
 
2252
2310
  declare function safeUuid(): string;
2253
2311
 
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 };
2312
+ 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 RoomSession, RoomsResource, 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
@@ -1721,6 +1721,49 @@ var LiveCallsResource = class {
1721
1721
  }
1722
1722
  };
1723
1723
 
1724
+ // src/resources/rooms.ts
1725
+ var RoomsResource = class {
1726
+ constructor(client) {
1727
+ this.client = client;
1728
+ }
1729
+ client;
1730
+ /** POST /v1/conversations/:id/room — start the room, or join what is live. */
1731
+ start(conversationId, media = "audio", signal) {
1732
+ return this.client.request({
1733
+ method: "POST",
1734
+ path: `/v1/conversations/${encodeURIComponent(conversationId)}/room`,
1735
+ body: { media },
1736
+ ...signal ? { signal } : {}
1737
+ });
1738
+ }
1739
+ /**
1740
+ * POST /v1/conversations/:id/calls — like `start`, but RINGS the other
1741
+ * members' phones (a support desk calling a customer). Off by default
1742
+ * in the room UI; an app opts in. Joins whatever is live instead, the
1743
+ * same as `start`.
1744
+ */
1745
+ ring(conversationId, media = "audio", signal) {
1746
+ return this.client.request({
1747
+ method: "POST",
1748
+ path: `/v1/conversations/${encodeURIComponent(conversationId)}/calls`,
1749
+ body: { media },
1750
+ ...signal ? { signal } : {}
1751
+ });
1752
+ }
1753
+ /**
1754
+ * POST /v1/calls/:id/hangup — leave. Never ends the room for the others;
1755
+ * it ends once empty. Authorized by the session's control token.
1756
+ */
1757
+ leave(session) {
1758
+ return this.client.request({
1759
+ method: "POST",
1760
+ path: `/v1/calls/${encodeURIComponent(session.call.id)}/hangup`,
1761
+ bearer: session.control_token,
1762
+ idempotencyKey: null
1763
+ });
1764
+ }
1765
+ };
1766
+
1724
1767
  // src/voice/call-room.ts
1725
1768
  function toDevices(raw, kind) {
1726
1769
  const out = [];
@@ -2220,7 +2263,12 @@ var RestClient = class {
2220
2263
  let triedAuthRefresh = false;
2221
2264
  for (; ; ) {
2222
2265
  const body = opts.body === void 0 ? void 0 : JSON.stringify(opts.body);
2223
- const headers = await this.buildHeaders(opts.method, idempotencyKey, body !== void 0);
2266
+ const headers = await this.buildHeaders(
2267
+ opts.method,
2268
+ idempotencyKey,
2269
+ body !== void 0,
2270
+ opts.bearer
2271
+ );
2224
2272
  let response;
2225
2273
  try {
2226
2274
  const init = { method: opts.method, headers };
@@ -2242,7 +2290,7 @@ var RestClient = class {
2242
2290
  return await parseJsonOrNull(response);
2243
2291
  }
2244
2292
  if (response.status === 401) {
2245
- if (!triedAuthRefresh) {
2293
+ if (!triedAuthRefresh && opts.bearer === void 0) {
2246
2294
  this.tokenCache.invalidate();
2247
2295
  triedAuthRefresh = true;
2248
2296
  continue;
@@ -2280,10 +2328,10 @@ var RestClient = class {
2280
2328
  const qs = params.toString();
2281
2329
  return qs ? `${base}?${qs}` : base;
2282
2330
  }
2283
- async buildHeaders(method, idempotencyKey, hasBody) {
2331
+ async buildHeaders(method, idempotencyKey, hasBody, bearer) {
2284
2332
  const headers = { Accept: "application/json" };
2285
2333
  if (hasBody) headers["Content-Type"] = "application/json";
2286
- const token = await this.config.getToken();
2334
+ const token = bearer ?? await this.config.getToken();
2287
2335
  if (token) headers["Authorization"] = `Bearer ${token}`;
2288
2336
  if (!IDEMPOTENT_METHODS.has(method) && idempotencyKey) {
2289
2337
  headers["Idempotency-Key"] = idempotencyKey;
@@ -2459,6 +2507,8 @@ var Poolse = class {
2459
2507
  callTokens;
2460
2508
  /** Whether a call is running on a conversation — for a Join banner. */
2461
2509
  liveCalls;
2510
+ /** A conversation's drop-in room: voice or video, nobody rung. */
2511
+ rooms;
2462
2512
  resolved;
2463
2513
  tokenCache;
2464
2514
  constructor(config) {
@@ -2478,6 +2528,7 @@ var Poolse = class {
2478
2528
  this.iceServers = new IceServersResource(this.rest);
2479
2529
  this.callTokens = new CallTokensResource(this.rest);
2480
2530
  this.liveCalls = new LiveCallsResource(this.rest);
2531
+ this.rooms = new RoomsResource(this.rest);
2481
2532
  this.realtime = new PoolseRealtime(cachedConfig, this.tokenCache, {
2482
2533
  ...this.resolved.wsUrl !== void 0 ? { wsUrl: this.resolved.wsUrl } : {},
2483
2534
  socketPath: this.resolved.socketPath,
@@ -2520,7 +2571,7 @@ var Poolse = class {
2520
2571
  };
2521
2572
 
2522
2573
  // src/version.ts
2523
- var version = "2.23.0";
2574
+ var version = "2.24.0";
2524
2575
 
2525
2576
  // src/call-log.ts
2526
2577
  function parseCallLogBody(body) {
@@ -2556,6 +2607,7 @@ function parseCallLogBody(body) {
2556
2607
  durationMs,
2557
2608
  joinedUserIds: joined,
2558
2609
  version: obj.v === 2 ? 2 : 1,
2610
+ callKind: obj.call_kind === "room" ? "room" : "call",
2559
2611
  callerUserId: typeof obj.caller_user_id === "string" ? obj.caller_user_id : null,
2560
2612
  participants,
2561
2613
  endReason: isEndReason(obj.end_reason) ? obj.end_reason : null,
@@ -2606,6 +2658,15 @@ function describeCallLog(log, currentUserId) {
2606
2658
  const duration = log.durationMs !== null ? formatCallDuration(log.durationMs) : null;
2607
2659
  const group = log.participants.length > 1;
2608
2660
  const me = currentUserId;
2661
+ if (log.callKind === "room") {
2662
+ const n = (/* @__PURE__ */ new Set([...log.joinedUserIds, ...log.participants.map((p) => p.userId)])).size;
2663
+ const title = log.media === "video" ? "Video room" : "Voice room";
2664
+ const people = n > 0 ? `${n} joined` : null;
2665
+ return display(log.media, title, [duration, people].filter(Boolean).join(" \xB7 ") || null, {
2666
+ direction: null,
2667
+ callBack: false
2668
+ });
2669
+ }
2609
2670
  const mine = me !== null ? log.participants.find((p) => p.userId === me) : void 0;
2610
2671
  const isCaller = me !== null && log.callerUserId === me;
2611
2672
  if (log.version === 1 || !isCaller && !mine) {
@@ -2675,6 +2736,6 @@ function formatCallLogPreview(preview, currentUserId) {
2675
2736
  return "Call";
2676
2737
  }
2677
2738
 
2678
- export { ApiError, AttachmentHandle, AttachmentsResource, AuthError, CallRoom, CallTokensResource, CallsResource, ConversationChannel, ConversationHandle, ConversationMessages, ConversationsResource, DevicesResource, IceServersResource, LiveCallsResource, MeResource, MessageHandle, MessagesResource, NetworkError, POOLSE_API_URL, Poolse, PoolseError, PoolseRealtime, RateLimitedError, UserChannel, UsersResource, VoiceRoom, callLogDisplayFor, createBrowserWebRtcAdapter, describeCallLog, formatCallDuration, formatCallLogPreview, isCallLogMessage, isMessageVisibleTo, isWebRtcAvailable, parseCallLog, parseCallLogBody, safeUuid, version };
2739
+ export { ApiError, AttachmentHandle, AttachmentsResource, AuthError, CallRoom, CallTokensResource, CallsResource, ConversationChannel, ConversationHandle, ConversationMessages, ConversationsResource, DevicesResource, IceServersResource, LiveCallsResource, MeResource, MessageHandle, MessagesResource, NetworkError, POOLSE_API_URL, Poolse, PoolseError, PoolseRealtime, RateLimitedError, RoomsResource, UserChannel, UsersResource, VoiceRoom, callLogDisplayFor, createBrowserWebRtcAdapter, describeCallLog, formatCallDuration, formatCallLogPreview, isCallLogMessage, isMessageVisibleTo, isWebRtcAvailable, parseCallLog, parseCallLogBody, safeUuid, version };
2679
2740
  //# sourceMappingURL=index.js.map
2680
2741
  //# sourceMappingURL=index.js.map