@poolse/sdk 2.3.0 → 2.4.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/index.cjs +44 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +64 -2
- package/dist/index.d.ts +64 -2
- package/dist/index.js +44 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1257,6 +1257,63 @@ declare class ConversationsResource {
|
|
|
1257
1257
|
one(id: Uuid): ConversationHandle;
|
|
1258
1258
|
}
|
|
1259
1259
|
|
|
1260
|
+
/** Which push service a token belongs to. */
|
|
1261
|
+
type DevicePlatform = 'ios' | 'android';
|
|
1262
|
+
/**
|
|
1263
|
+
* Which APNs environment issued the token. The two have disjoint token
|
|
1264
|
+
* spaces — a sandbox token is rejected by production APNs and vice
|
|
1265
|
+
* versa — so a debug build must say `sandbox` or its pushes vanish.
|
|
1266
|
+
*/
|
|
1267
|
+
type DeviceEnvironment = 'production' | 'sandbox';
|
|
1268
|
+
interface RegisterDeviceRequest {
|
|
1269
|
+
/**
|
|
1270
|
+
* On iOS this MUST be the **PushKit VoIP token**, not the regular
|
|
1271
|
+
* APNs token. Apple issues them separately and a VoIP push aimed at a
|
|
1272
|
+
* normal token is discarded without an error.
|
|
1273
|
+
*/
|
|
1274
|
+
token: string;
|
|
1275
|
+
platform: DevicePlatform;
|
|
1276
|
+
/** Defaults to `production` server-side. */
|
|
1277
|
+
environment?: DeviceEnvironment;
|
|
1278
|
+
}
|
|
1279
|
+
/** A registered device, minus the token itself. */
|
|
1280
|
+
interface Device {
|
|
1281
|
+
id: string;
|
|
1282
|
+
tenant_id: string;
|
|
1283
|
+
user_id: string;
|
|
1284
|
+
platform: DevicePlatform;
|
|
1285
|
+
environment: DeviceEnvironment;
|
|
1286
|
+
last_registered_at: string | null;
|
|
1287
|
+
inserted_at: string;
|
|
1288
|
+
updated_at: string;
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* `/v1/devices` — where a call should ring when the app isn't running.
|
|
1292
|
+
*
|
|
1293
|
+
* The realtime `call:incoming` event only reaches a live WebSocket, and
|
|
1294
|
+
* iOS suspends sockets on background and drops them on close. Registering
|
|
1295
|
+
* here is what lets the server wake the app with a VoIP push instead.
|
|
1296
|
+
*/
|
|
1297
|
+
declare class DevicesResource {
|
|
1298
|
+
private readonly client;
|
|
1299
|
+
constructor(client: RestClient);
|
|
1300
|
+
/**
|
|
1301
|
+
* POST /v1/devices
|
|
1302
|
+
*
|
|
1303
|
+
* Idempotent — PushKit hands the app a token on every launch, so call
|
|
1304
|
+
* this each time rather than trying to remember whether you already
|
|
1305
|
+
* did. Re-registering also refreshes the server's staleness clock.
|
|
1306
|
+
*/
|
|
1307
|
+
register(body: RegisterDeviceRequest, signal?: AbortSignal): Promise<Device>;
|
|
1308
|
+
/**
|
|
1309
|
+
* DELETE /v1/devices/:token
|
|
1310
|
+
*
|
|
1311
|
+
* Call on sign-out, or the handset keeps ringing for a user who is no
|
|
1312
|
+
* longer on it.
|
|
1313
|
+
*/
|
|
1314
|
+
unregister(token: string, signal?: AbortSignal): Promise<void>;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1260
1317
|
/** `/v1/me` — the End-User identity behind the presented JWT. */
|
|
1261
1318
|
declare class MeResource {
|
|
1262
1319
|
private readonly client;
|
|
@@ -1305,6 +1362,11 @@ declare class UsersResource {
|
|
|
1305
1362
|
declare class Poolse {
|
|
1306
1363
|
/** `/v1/me` — current End User. */
|
|
1307
1364
|
readonly me: MeResource;
|
|
1365
|
+
/**
|
|
1366
|
+
* `/v1/devices` — push destinations, so an incoming call can ring a
|
|
1367
|
+
* phone whose app isn't running. Only meaningful on mobile.
|
|
1368
|
+
*/
|
|
1369
|
+
readonly devices: DevicesResource;
|
|
1308
1370
|
/** `/v1/conversations` collection + per-conversation handle factory. */
|
|
1309
1371
|
readonly conversations: ConversationsResource;
|
|
1310
1372
|
/** `/v1/messages/:id/*` — accessed via `chat.messages.one(id)`. */
|
|
@@ -1400,8 +1462,8 @@ declare class AuthError extends ApiError {
|
|
|
1400
1462
|
declare function isWebRtcAvailable(): boolean;
|
|
1401
1463
|
declare function createBrowserWebRtcAdapter(): WebRtcAdapter;
|
|
1402
1464
|
|
|
1403
|
-
declare const version = "2.
|
|
1465
|
+
declare const version = "2.4.1";
|
|
1404
1466
|
|
|
1405
1467
|
declare function safeUuid(): string;
|
|
1406
1468
|
|
|
1407
|
-
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 CallDeclined, CallsResource, type Conversation, ConversationChannel, type ConversationCreateRequest, type ConversationCreatedEvent, ConversationHandle, type ConversationList, ConversationMessages, type ConversationType, type ConversationUpdateRequest, type ConversationUpdatedEvent, ConversationsResource, type ErrorEnvelope, type IncomingCall, type IsoDateTime, 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 TypingEvent, type 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, createBrowserWebRtcAdapter, isWebRtcAvailable, safeUuid, version };
|
|
1469
|
+
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 CallDeclined, CallsResource, type Conversation, ConversationChannel, type ConversationCreateRequest, type ConversationCreatedEvent, ConversationHandle, type ConversationList, ConversationMessages, type ConversationType, type ConversationUpdateRequest, type ConversationUpdatedEvent, ConversationsResource, type Device, type DeviceEnvironment, type DevicePlatform, DevicesResource, type ErrorEnvelope, type IncomingCall, type IsoDateTime, 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, 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, createBrowserWebRtcAdapter, isWebRtcAvailable, safeUuid, version };
|
package/dist/index.d.ts
CHANGED
|
@@ -1257,6 +1257,63 @@ declare class ConversationsResource {
|
|
|
1257
1257
|
one(id: Uuid): ConversationHandle;
|
|
1258
1258
|
}
|
|
1259
1259
|
|
|
1260
|
+
/** Which push service a token belongs to. */
|
|
1261
|
+
type DevicePlatform = 'ios' | 'android';
|
|
1262
|
+
/**
|
|
1263
|
+
* Which APNs environment issued the token. The two have disjoint token
|
|
1264
|
+
* spaces — a sandbox token is rejected by production APNs and vice
|
|
1265
|
+
* versa — so a debug build must say `sandbox` or its pushes vanish.
|
|
1266
|
+
*/
|
|
1267
|
+
type DeviceEnvironment = 'production' | 'sandbox';
|
|
1268
|
+
interface RegisterDeviceRequest {
|
|
1269
|
+
/**
|
|
1270
|
+
* On iOS this MUST be the **PushKit VoIP token**, not the regular
|
|
1271
|
+
* APNs token. Apple issues them separately and a VoIP push aimed at a
|
|
1272
|
+
* normal token is discarded without an error.
|
|
1273
|
+
*/
|
|
1274
|
+
token: string;
|
|
1275
|
+
platform: DevicePlatform;
|
|
1276
|
+
/** Defaults to `production` server-side. */
|
|
1277
|
+
environment?: DeviceEnvironment;
|
|
1278
|
+
}
|
|
1279
|
+
/** A registered device, minus the token itself. */
|
|
1280
|
+
interface Device {
|
|
1281
|
+
id: string;
|
|
1282
|
+
tenant_id: string;
|
|
1283
|
+
user_id: string;
|
|
1284
|
+
platform: DevicePlatform;
|
|
1285
|
+
environment: DeviceEnvironment;
|
|
1286
|
+
last_registered_at: string | null;
|
|
1287
|
+
inserted_at: string;
|
|
1288
|
+
updated_at: string;
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* `/v1/devices` — where a call should ring when the app isn't running.
|
|
1292
|
+
*
|
|
1293
|
+
* The realtime `call:incoming` event only reaches a live WebSocket, and
|
|
1294
|
+
* iOS suspends sockets on background and drops them on close. Registering
|
|
1295
|
+
* here is what lets the server wake the app with a VoIP push instead.
|
|
1296
|
+
*/
|
|
1297
|
+
declare class DevicesResource {
|
|
1298
|
+
private readonly client;
|
|
1299
|
+
constructor(client: RestClient);
|
|
1300
|
+
/**
|
|
1301
|
+
* POST /v1/devices
|
|
1302
|
+
*
|
|
1303
|
+
* Idempotent — PushKit hands the app a token on every launch, so call
|
|
1304
|
+
* this each time rather than trying to remember whether you already
|
|
1305
|
+
* did. Re-registering also refreshes the server's staleness clock.
|
|
1306
|
+
*/
|
|
1307
|
+
register(body: RegisterDeviceRequest, signal?: AbortSignal): Promise<Device>;
|
|
1308
|
+
/**
|
|
1309
|
+
* DELETE /v1/devices/:token
|
|
1310
|
+
*
|
|
1311
|
+
* Call on sign-out, or the handset keeps ringing for a user who is no
|
|
1312
|
+
* longer on it.
|
|
1313
|
+
*/
|
|
1314
|
+
unregister(token: string, signal?: AbortSignal): Promise<void>;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1260
1317
|
/** `/v1/me` — the End-User identity behind the presented JWT. */
|
|
1261
1318
|
declare class MeResource {
|
|
1262
1319
|
private readonly client;
|
|
@@ -1305,6 +1362,11 @@ declare class UsersResource {
|
|
|
1305
1362
|
declare class Poolse {
|
|
1306
1363
|
/** `/v1/me` — current End User. */
|
|
1307
1364
|
readonly me: MeResource;
|
|
1365
|
+
/**
|
|
1366
|
+
* `/v1/devices` — push destinations, so an incoming call can ring a
|
|
1367
|
+
* phone whose app isn't running. Only meaningful on mobile.
|
|
1368
|
+
*/
|
|
1369
|
+
readonly devices: DevicesResource;
|
|
1308
1370
|
/** `/v1/conversations` collection + per-conversation handle factory. */
|
|
1309
1371
|
readonly conversations: ConversationsResource;
|
|
1310
1372
|
/** `/v1/messages/:id/*` — accessed via `chat.messages.one(id)`. */
|
|
@@ -1400,8 +1462,8 @@ declare class AuthError extends ApiError {
|
|
|
1400
1462
|
declare function isWebRtcAvailable(): boolean;
|
|
1401
1463
|
declare function createBrowserWebRtcAdapter(): WebRtcAdapter;
|
|
1402
1464
|
|
|
1403
|
-
declare const version = "2.
|
|
1465
|
+
declare const version = "2.4.1";
|
|
1404
1466
|
|
|
1405
1467
|
declare function safeUuid(): string;
|
|
1406
1468
|
|
|
1407
|
-
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 CallDeclined, CallsResource, type Conversation, ConversationChannel, type ConversationCreateRequest, type ConversationCreatedEvent, ConversationHandle, type ConversationList, ConversationMessages, type ConversationType, type ConversationUpdateRequest, type ConversationUpdatedEvent, ConversationsResource, type ErrorEnvelope, type IncomingCall, type IsoDateTime, 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 TypingEvent, type 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, createBrowserWebRtcAdapter, isWebRtcAvailable, safeUuid, version };
|
|
1469
|
+
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 CallDeclined, CallsResource, type Conversation, ConversationChannel, type ConversationCreateRequest, type ConversationCreatedEvent, ConversationHandle, type ConversationList, ConversationMessages, type ConversationType, type ConversationUpdateRequest, type ConversationUpdatedEvent, ConversationsResource, type Device, type DeviceEnvironment, type DevicePlatform, DevicesResource, type ErrorEnvelope, type IncomingCall, type IsoDateTime, 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, 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, createBrowserWebRtcAdapter, isWebRtcAvailable, safeUuid, version };
|
package/dist/index.js
CHANGED
|
@@ -1402,6 +1402,42 @@ var ConversationsResource = class {
|
|
|
1402
1402
|
}
|
|
1403
1403
|
};
|
|
1404
1404
|
|
|
1405
|
+
// src/resources/devices.ts
|
|
1406
|
+
var DevicesResource = class {
|
|
1407
|
+
constructor(client) {
|
|
1408
|
+
this.client = client;
|
|
1409
|
+
}
|
|
1410
|
+
client;
|
|
1411
|
+
/**
|
|
1412
|
+
* POST /v1/devices
|
|
1413
|
+
*
|
|
1414
|
+
* Idempotent — PushKit hands the app a token on every launch, so call
|
|
1415
|
+
* this each time rather than trying to remember whether you already
|
|
1416
|
+
* did. Re-registering also refreshes the server's staleness clock.
|
|
1417
|
+
*/
|
|
1418
|
+
register(body, signal) {
|
|
1419
|
+
return this.client.request({
|
|
1420
|
+
method: "POST",
|
|
1421
|
+
path: "/v1/devices",
|
|
1422
|
+
body,
|
|
1423
|
+
...signal ? { signal } : {}
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* DELETE /v1/devices/:token
|
|
1428
|
+
*
|
|
1429
|
+
* Call on sign-out, or the handset keeps ringing for a user who is no
|
|
1430
|
+
* longer on it.
|
|
1431
|
+
*/
|
|
1432
|
+
unregister(token, signal) {
|
|
1433
|
+
return this.client.request({
|
|
1434
|
+
method: "DELETE",
|
|
1435
|
+
path: `/v1/devices/${encodeURIComponent(token)}`,
|
|
1436
|
+
...signal ? { signal } : {}
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
|
|
1405
1441
|
// src/resources/me.ts
|
|
1406
1442
|
var MeResource = class {
|
|
1407
1443
|
constructor(client) {
|
|
@@ -1727,6 +1763,11 @@ function decodeBase64Url(s) {
|
|
|
1727
1763
|
var Poolse = class {
|
|
1728
1764
|
/** `/v1/me` — current End User. */
|
|
1729
1765
|
me;
|
|
1766
|
+
/**
|
|
1767
|
+
* `/v1/devices` — push destinations, so an incoming call can ring a
|
|
1768
|
+
* phone whose app isn't running. Only meaningful on mobile.
|
|
1769
|
+
*/
|
|
1770
|
+
devices;
|
|
1730
1771
|
/** `/v1/conversations` collection + per-conversation handle factory. */
|
|
1731
1772
|
conversations;
|
|
1732
1773
|
/** `/v1/messages/:id/*` — accessed via `chat.messages.one(id)`. */
|
|
@@ -1768,6 +1809,7 @@ var Poolse = class {
|
|
|
1768
1809
|
};
|
|
1769
1810
|
this.rest = new RestClient(cachedConfig, this.tokenCache);
|
|
1770
1811
|
this.me = new MeResource(this.rest);
|
|
1812
|
+
this.devices = new DevicesResource(this.rest);
|
|
1771
1813
|
this.conversations = new ConversationsResource(this.rest);
|
|
1772
1814
|
this.messages = new MessagesResource(this.rest);
|
|
1773
1815
|
this.attachments = new AttachmentsResource(this.rest, cachedConfig.fetch);
|
|
@@ -1789,8 +1831,8 @@ var Poolse = class {
|
|
|
1789
1831
|
};
|
|
1790
1832
|
|
|
1791
1833
|
// src/version.ts
|
|
1792
|
-
var version = "2.
|
|
1834
|
+
var version = "2.4.1";
|
|
1793
1835
|
|
|
1794
|
-
export { ApiError, AttachmentHandle, AttachmentsResource, AuthError, CallsResource, ConversationChannel, ConversationHandle, ConversationMessages, ConversationsResource, MeResource, MessageHandle, MessagesResource, NetworkError, POOLSE_API_URL, Poolse, PoolseError, PoolseRealtime, RateLimitedError, UserChannel, UsersResource, VoiceRoom, createBrowserWebRtcAdapter, isWebRtcAvailable, safeUuid, version };
|
|
1836
|
+
export { ApiError, AttachmentHandle, AttachmentsResource, AuthError, CallsResource, ConversationChannel, ConversationHandle, ConversationMessages, ConversationsResource, DevicesResource, MeResource, MessageHandle, MessagesResource, NetworkError, POOLSE_API_URL, Poolse, PoolseError, PoolseRealtime, RateLimitedError, UserChannel, UsersResource, VoiceRoom, createBrowserWebRtcAdapter, isWebRtcAvailable, safeUuid, version };
|
|
1795
1837
|
//# sourceMappingURL=index.js.map
|
|
1796
1838
|
//# sourceMappingURL=index.js.map
|