@signalwire/js 4.0.0-dev-20260324190414 → 4.0.0-dev-20260326210326
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/browser.mjs +269 -23
- package/dist/browser.mjs.map +1 -1
- package/dist/browser.umd.js +269 -23
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +269 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +354 -31
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +354 -31
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +269 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -57,9 +57,9 @@ interface MediaDirections {
|
|
|
57
57
|
}
|
|
58
58
|
/** Options controlling which media tracks to send and receive. */
|
|
59
59
|
interface MediaOptions {
|
|
60
|
-
/** Enable audio input. */
|
|
60
|
+
/** Enable audio input. Defaults to `true` when not specified. */
|
|
61
61
|
audio?: boolean;
|
|
62
|
-
/** Enable video input. */
|
|
62
|
+
/** Enable video input. Defaults to `false` when not specified. */
|
|
63
63
|
video?: boolean;
|
|
64
64
|
/** Custom constraints for the audio input track. */
|
|
65
65
|
inputAudioDeviceConstraints?: MediaTrackConstraints;
|
|
@@ -76,6 +76,7 @@ interface MediaOptions {
|
|
|
76
76
|
}
|
|
77
77
|
//#endregion
|
|
78
78
|
//#region src/core/types/common.types.d.ts
|
|
79
|
+
/** JSON-compatible value type for serializable data structures. */
|
|
79
80
|
interface JSONSerializable {
|
|
80
81
|
[key: string]: JSONSerializable | string | number | boolean | null | undefined | JSONSerializable[];
|
|
81
82
|
}
|
|
@@ -124,6 +125,7 @@ interface HTTPResponse<T extends HttpBody = string> {
|
|
|
124
125
|
/** Final URL after any redirects */
|
|
125
126
|
url: string;
|
|
126
127
|
}
|
|
128
|
+
/** Browser-compatible WebSocket client interface. */
|
|
127
129
|
interface WebSocketClient {
|
|
128
130
|
addEventListener: WebSocket['addEventListener'];
|
|
129
131
|
removeEventListener: WebSocket['removeEventListener'];
|
|
@@ -131,6 +133,7 @@ interface WebSocketClient {
|
|
|
131
133
|
close: WebSocket['close'];
|
|
132
134
|
readyState: WebSocket['readyState'];
|
|
133
135
|
}
|
|
136
|
+
/** Node.js WebSocket client interface with event listener overloads. */
|
|
134
137
|
interface NodeSocketClient extends WebSocketClient {
|
|
135
138
|
addEventListener(method: 'open' | 'close' | 'error' | 'message', cb: (event: unknown) => void, options?: unknown): void;
|
|
136
139
|
removeEventListener(method: 'open' | 'close' | 'error' | 'message', cb: (event: unknown) => void): void;
|
|
@@ -147,20 +150,26 @@ interface NodeSocketAdapter {
|
|
|
147
150
|
}
|
|
148
151
|
/** Browser-compatible WebSocket constructor type. */
|
|
149
152
|
type WebSocketAdapter = new (url: string | URL, protocols?: string | string[]) => WebSocketClient;
|
|
150
|
-
/**
|
|
153
|
+
/**
|
|
154
|
+
* Authentication credentials for the SDK.
|
|
155
|
+
*
|
|
156
|
+
* At least one of `token` or `authorizationState` must be provided.
|
|
157
|
+
*/
|
|
151
158
|
interface SDKCredential {
|
|
152
|
-
/** JWT subscriber access token. */
|
|
159
|
+
/** JWT subscriber access token (SAT). */
|
|
153
160
|
token?: string;
|
|
154
161
|
/** Pre-authorized session state (alternative to token). */
|
|
155
162
|
authorizationState?: string;
|
|
156
|
-
/** Token expiry timestamp in milliseconds since epoch. */
|
|
163
|
+
/** Token expiry timestamp in milliseconds since epoch. When set, the SDK attempts credential refresh before expiry. */
|
|
157
164
|
expiry_at?: number;
|
|
158
165
|
}
|
|
159
166
|
/** Types of addressable resources in the fabric. */
|
|
160
167
|
type ResourceType = 'app' | 'call' | 'room' | 'subscriber';
|
|
161
168
|
//#endregion
|
|
162
169
|
//#region src/dependencies/interfaces.d.ts
|
|
170
|
+
/** Persistence scope: browser `localStorage` or `sessionStorage`. */
|
|
163
171
|
type StorageScope = 'local' | 'session';
|
|
172
|
+
/** Key-value storage interface for persisting SDK preferences and state. */
|
|
164
173
|
interface Storage {
|
|
165
174
|
setItem(key: string, value: string | null, scope: StorageScope): Promise<void>;
|
|
166
175
|
getItem(key: string, scope: StorageScope): Promise<string | null>;
|
|
@@ -420,40 +429,70 @@ declare abstract class Fetchable<T = unknown> extends Destroyable {
|
|
|
420
429
|
* Pure address-related types (no implementation dependencies)
|
|
421
430
|
* Types that reference model implementations are in interfaces.ts
|
|
422
431
|
*/
|
|
432
|
+
/** Raw address response from the SignalWire Fabric API. */
|
|
423
433
|
interface GetAddressResponse {
|
|
434
|
+
/** Unique address identifier. */
|
|
424
435
|
id: string;
|
|
436
|
+
/** Human-readable display name. */
|
|
425
437
|
display_name: string;
|
|
438
|
+
/** Resource name (used as a URI for dialing). */
|
|
426
439
|
name: string;
|
|
440
|
+
/** URL for an avatar or preview image. */
|
|
427
441
|
preview_url?: string;
|
|
442
|
+
/** URL for a cover image. */
|
|
428
443
|
cover_url?: string;
|
|
444
|
+
/** Underlying resource identifier. */
|
|
429
445
|
resource_id: string;
|
|
446
|
+
/** Type of the underlying resource. */
|
|
430
447
|
type: ResourceType;
|
|
448
|
+
/** Available communication channels for this address. */
|
|
431
449
|
channels: {
|
|
450
|
+
/** Audio-only channel URI. */
|
|
432
451
|
audio?: string;
|
|
452
|
+
/** Messaging channel URI. */
|
|
433
453
|
messaging?: string;
|
|
454
|
+
/** Video channel URI. */
|
|
434
455
|
video?: string;
|
|
435
456
|
};
|
|
457
|
+
/** Whether the address resource is currently locked. */
|
|
436
458
|
locked: boolean;
|
|
459
|
+
/** ISO 8601 timestamp when the address was created. */
|
|
437
460
|
created_at: string;
|
|
438
461
|
}
|
|
439
462
|
//#endregion
|
|
440
463
|
//#region src/core/types/subscriber.types.d.ts
|
|
464
|
+
/** Raw subscriber profile response from the SignalWire Fabric API. */
|
|
441
465
|
interface GetSubscriberInfoResponse {
|
|
466
|
+
/** Unique subscriber identifier. */
|
|
442
467
|
id: string;
|
|
468
|
+
/** Subscriber's email address. */
|
|
443
469
|
email: string;
|
|
470
|
+
/** Subscriber's first name. */
|
|
444
471
|
first_name?: string;
|
|
472
|
+
/** Subscriber's last name. */
|
|
445
473
|
last_name?: string;
|
|
474
|
+
/** Subscriber's display name. */
|
|
446
475
|
display_name?: string;
|
|
476
|
+
/** Subscriber's job title. */
|
|
447
477
|
job_title?: string;
|
|
478
|
+
/** Subscriber's time zone offset. */
|
|
448
479
|
time_zone?: number;
|
|
480
|
+
/** Subscriber's country. */
|
|
449
481
|
country?: string;
|
|
482
|
+
/** Subscriber's region or state. */
|
|
450
483
|
region?: string;
|
|
484
|
+
/** Subscriber's company name. */
|
|
451
485
|
company_name?: string;
|
|
486
|
+
/** Key for push notification delivery. */
|
|
452
487
|
push_notification_key: string;
|
|
488
|
+
/** Application-level settings for this subscriber. */
|
|
453
489
|
app_settings?: {
|
|
490
|
+
/** Display name configured at the application level. */
|
|
454
491
|
display_name: string;
|
|
492
|
+
/** Permission scopes granted to this subscriber. */
|
|
455
493
|
scopes: string[];
|
|
456
494
|
};
|
|
495
|
+
/** Fabric addresses associated with this subscriber. */
|
|
457
496
|
fabric_addresses: GetAddressResponse[];
|
|
458
497
|
}
|
|
459
498
|
//#endregion
|
|
@@ -499,32 +538,63 @@ declare class Subscriber extends Fetchable<GetSubscriberInfoResponse> {
|
|
|
499
538
|
}
|
|
500
539
|
//#endregion
|
|
501
540
|
//#region src/core/types/call.types.d.ts
|
|
541
|
+
/** SDP role for the peer connection negotiation. */
|
|
502
542
|
type RTCPeerConnectionType = 'offer' | 'answer';
|
|
543
|
+
/** Purpose of the peer connection (primary call, screen share, or additional device). */
|
|
503
544
|
type RTCPeerConnectionPropose = 'main' | 'screenshare' | 'additional-device';
|
|
545
|
+
/** States during call connection establishment. */
|
|
504
546
|
type CallConnectStates = 'connecting' | 'connected';
|
|
547
|
+
/** Lifecycle states of the signaling protocol for a call. */
|
|
505
548
|
type SignalingCallStates = 'created' | 'ringing' | 'answered' | 'ending' | 'ended';
|
|
549
|
+
/** Whether the call is inbound (received) or outbound (initiated). */
|
|
506
550
|
type CallDirection = 'inbound' | 'outbound';
|
|
551
|
+
/** Playback state of media being played into a call. */
|
|
507
552
|
type CallPlayState = 'playing' | 'paused' | 'finished';
|
|
553
|
+
/** Common parameters shared by all call device types. */
|
|
508
554
|
interface CallDeviceCommonParams {
|
|
555
|
+
/** Optional SIP headers to include in the call setup. */
|
|
509
556
|
headers?: unknown[];
|
|
510
557
|
}
|
|
558
|
+
/** Parameters for a WebRTC or SIP call device. */
|
|
511
559
|
interface CallDeviceWebRTCOrSIPParams extends CallDeviceCommonParams {
|
|
560
|
+
/** Source address or URI for the call. */
|
|
512
561
|
from: string;
|
|
562
|
+
/** Destination address or URI for the call. */
|
|
513
563
|
to: string;
|
|
514
564
|
}
|
|
565
|
+
/** Parameters for a phone (PSTN) call device. */
|
|
515
566
|
interface CallDevicePhoneParams extends CallDeviceCommonParams {
|
|
567
|
+
/** Caller phone number (E.164 format). */
|
|
516
568
|
from_number: string;
|
|
569
|
+
/** Destination phone number (E.164 format). */
|
|
517
570
|
to_number: string;
|
|
518
571
|
}
|
|
572
|
+
/** A WebRTC or SIP call device descriptor. */
|
|
519
573
|
interface CallDeviceWebRTCOrSIP {
|
|
574
|
+
/** Transport type for the device. */
|
|
520
575
|
type: 'webrtc' | 'sip';
|
|
576
|
+
/** Connection parameters for the device. */
|
|
521
577
|
params: CallDeviceWebRTCOrSIPParams;
|
|
522
578
|
}
|
|
579
|
+
/** A phone (PSTN) call device descriptor. */
|
|
523
580
|
interface CallDevicePhone {
|
|
581
|
+
/** Transport type for the device. */
|
|
524
582
|
type: 'phone';
|
|
583
|
+
/** Connection parameters for the device. */
|
|
525
584
|
params: CallDevicePhoneParams;
|
|
526
585
|
}
|
|
586
|
+
/** Discriminated union of call device types (WebRTC, SIP, or phone). */
|
|
527
587
|
type CallDevice = CallDeviceWebRTCOrSIP | CallDevicePhone;
|
|
588
|
+
/**
|
|
589
|
+
* Position of a participant's video within the layout canvas.
|
|
590
|
+
*
|
|
591
|
+
* - `'auto'` — Automatically positioned by the layout engine.
|
|
592
|
+
* - `` `reserved-${number}` `` — A reserved slot in the layout (e.g., `'reserved-0'`).
|
|
593
|
+
* - `` `standard-${number}` `` — A standard slot in the layout (e.g., `'standard-1'`).
|
|
594
|
+
* - `'off-canvas'` — Participant is not visible in the layout.
|
|
595
|
+
* - `'playback'` — Playback position for media streams.
|
|
596
|
+
* - `'full-screen'` — Participant occupies the entire canvas.
|
|
597
|
+
*/
|
|
528
598
|
type VideoPosition = 'auto' | `reserved-${number}` | `standard-${number}` | 'off-canvas' | 'playback' | 'full-screen';
|
|
529
599
|
//#endregion
|
|
530
600
|
//#region src/core/RPCMessages/types/common.d.ts
|
|
@@ -1001,38 +1071,84 @@ declare class SelfCapabilities extends Destroyable {
|
|
|
1001
1071
|
}
|
|
1002
1072
|
//#endregion
|
|
1003
1073
|
//#region src/core/entities/types/participant.types.d.ts
|
|
1074
|
+
/** Options for selecting a media device. */
|
|
1004
1075
|
interface SelectDeviceOptions {
|
|
1005
1076
|
savePreference?: boolean;
|
|
1006
1077
|
}
|
|
1007
1078
|
//#endregion
|
|
1008
1079
|
//#region src/interfaces/DeviceController.d.ts
|
|
1009
1080
|
/**
|
|
1010
|
-
*
|
|
1011
|
-
*
|
|
1081
|
+
* Interface for media device management.
|
|
1082
|
+
*
|
|
1083
|
+
* Provides reactive access to available media devices, device selection,
|
|
1084
|
+
* and monitoring for device changes (connect/disconnect).
|
|
1012
1085
|
*/
|
|
1013
1086
|
interface DeviceController {
|
|
1087
|
+
/** Observable list of available audio input (microphone) devices. */
|
|
1014
1088
|
readonly audioInputDevices$: Observable<MediaDeviceInfo[]>;
|
|
1089
|
+
/** Observable list of available audio output (speaker) devices. */
|
|
1015
1090
|
readonly audioOutputDevices$: Observable<MediaDeviceInfo[]>;
|
|
1091
|
+
/** Observable list of available video input (camera) devices. */
|
|
1016
1092
|
readonly videoInputDevices$: Observable<MediaDeviceInfo[]>;
|
|
1093
|
+
/** Observable of the currently selected audio input device, or `null` if none. */
|
|
1017
1094
|
readonly selectedAudioInputDevice$: Observable<MediaDeviceInfo | null>;
|
|
1095
|
+
/** Observable of the currently selected audio output device, or `null` if none. */
|
|
1018
1096
|
readonly selectedAudioOutputDevice$: Observable<MediaDeviceInfo | null>;
|
|
1097
|
+
/** Observable of the currently selected video input device, or `null` if none. */
|
|
1019
1098
|
readonly selectedVideoInputDevice$: Observable<MediaDeviceInfo | null>;
|
|
1099
|
+
/** Currently selected audio input device, or `null` if none. */
|
|
1020
1100
|
readonly selectedAudioInputDevice: MediaDeviceInfo | null;
|
|
1101
|
+
/** Currently selected audio output device, or `null` if none. */
|
|
1021
1102
|
readonly selectedAudioOutputDevice: MediaDeviceInfo | null;
|
|
1103
|
+
/** Currently selected video input device, or `null` if none. */
|
|
1022
1104
|
readonly selectedVideoInputDevice: MediaDeviceInfo | null;
|
|
1105
|
+
/** Current snapshot of available audio input devices. */
|
|
1023
1106
|
readonly audioInputDevices: MediaDeviceInfo[];
|
|
1107
|
+
/** Current snapshot of available audio output devices. */
|
|
1024
1108
|
readonly audioOutputDevices: MediaDeviceInfo[];
|
|
1109
|
+
/** Current snapshot of available video input devices. */
|
|
1025
1110
|
readonly videoInputDevices: MediaDeviceInfo[];
|
|
1111
|
+
/** Media track constraints for the selected audio input device. */
|
|
1026
1112
|
readonly selectedAudioInputDeviceConstraints: MediaTrackConstraints;
|
|
1113
|
+
/** Media track constraints for the selected video input device. */
|
|
1027
1114
|
readonly selectedVideoInputDeviceConstraints: MediaTrackConstraints;
|
|
1115
|
+
/**
|
|
1116
|
+
* Converts a {@link MediaDeviceInfo} to track constraints suitable for `getUserMedia`.
|
|
1117
|
+
* @param deviceInfo - The device to convert, or `null` for default constraints.
|
|
1118
|
+
*/
|
|
1028
1119
|
deviceInfoToConstraints(deviceInfo: MediaDeviceInfo | null): MediaTrackConstraints;
|
|
1120
|
+
/**
|
|
1121
|
+
* Sets the preferred audio input device for future calls.
|
|
1122
|
+
* @param device - The device to select, or `null` to use the system default.
|
|
1123
|
+
*/
|
|
1029
1124
|
selectAudioInputDevice(device: MediaDeviceInfo | null): void;
|
|
1125
|
+
/**
|
|
1126
|
+
* Sets the preferred video input device for future calls.
|
|
1127
|
+
* @param device - The device to select, or `null` to use the system default.
|
|
1128
|
+
*/
|
|
1030
1129
|
selectVideoInputDevice(device: MediaDeviceInfo | null): void;
|
|
1130
|
+
/**
|
|
1131
|
+
* Sets the preferred audio output device for future calls.
|
|
1132
|
+
* @param device - The device to select, or `null` to use the system default.
|
|
1133
|
+
*/
|
|
1031
1134
|
selectAudioOutputDevice(device: MediaDeviceInfo | null): void;
|
|
1135
|
+
/** Starts monitoring for media device changes (connect/disconnect). */
|
|
1032
1136
|
enableDeviceMonitoring(): void;
|
|
1137
|
+
/** Stops monitoring for media device changes. */
|
|
1033
1138
|
disableDeviceMonitoring(): void;
|
|
1139
|
+
/**
|
|
1140
|
+
* Returns the capabilities of a media device.
|
|
1141
|
+
* @param deviceInfo - The device to query.
|
|
1142
|
+
* @returns The device capabilities, or `null` if unavailable.
|
|
1143
|
+
*/
|
|
1034
1144
|
getDeviceCapabilities(deviceInfo: MediaDeviceInfo): Promise<MediaTrackCapabilities | null>;
|
|
1145
|
+
/**
|
|
1146
|
+
* Checks whether a device is still available and usable.
|
|
1147
|
+
* @param deviceInfo - The device to validate, or `null`.
|
|
1148
|
+
* @returns `true` if the device is valid and available. Returns `false` for `null`, audio output devices, or unavailable devices.
|
|
1149
|
+
*/
|
|
1035
1150
|
isValidDevice(deviceInfo: MediaDeviceInfo | null): Promise<boolean>;
|
|
1151
|
+
/** Observable stream of errors from device enumeration and monitoring. */
|
|
1036
1152
|
readonly errors$: Observable<Error>;
|
|
1037
1153
|
}
|
|
1038
1154
|
//#endregion
|
|
@@ -1136,22 +1252,39 @@ declare class Participant extends Destroyable implements CallParticipant {
|
|
|
1136
1252
|
get name(): string | undefined;
|
|
1137
1253
|
/** Participant type (e.g. `'member'`, `'screen'`). */
|
|
1138
1254
|
get type(): string | undefined;
|
|
1255
|
+
/** Whether the participant has raised their hand. */
|
|
1139
1256
|
get handraised(): boolean;
|
|
1257
|
+
/** Whether the participant is visible in the layout. */
|
|
1140
1258
|
get visible(): boolean;
|
|
1259
|
+
/** Whether the participant's audio is muted. */
|
|
1141
1260
|
get audioMuted(): boolean;
|
|
1261
|
+
/** Whether the participant's video is muted. */
|
|
1142
1262
|
get videoMuted(): boolean;
|
|
1263
|
+
/** Whether the participant is deafened (incoming audio muted). */
|
|
1143
1264
|
get deaf(): boolean;
|
|
1265
|
+
/** Current microphone input volume level, or `undefined` if not set. */
|
|
1144
1266
|
get inputVolume(): number | undefined;
|
|
1267
|
+
/** Current speaker output volume level, or `undefined` if not set. */
|
|
1145
1268
|
get outputVolume(): number | undefined;
|
|
1269
|
+
/** Current microphone input sensitivity level, or `undefined` if not set. */
|
|
1146
1270
|
get inputSensitivity(): number | undefined;
|
|
1271
|
+
/** Whether echo cancellation is enabled. */
|
|
1147
1272
|
get echoCancellation(): boolean;
|
|
1273
|
+
/** Whether automatic gain control is enabled. */
|
|
1148
1274
|
get autoGain(): boolean;
|
|
1275
|
+
/** Whether noise suppression is enabled. */
|
|
1149
1276
|
get noiseSuppression(): boolean;
|
|
1277
|
+
/** Whether low-bitrate mode is active. */
|
|
1150
1278
|
get lowbitrate(): boolean;
|
|
1279
|
+
/** Whether noise reduction (denoise) is active. */
|
|
1151
1280
|
get denoise(): boolean;
|
|
1281
|
+
/** Custom metadata for this participant, or `undefined` if not set. */
|
|
1152
1282
|
get meta(): Record<string, unknown> | undefined;
|
|
1283
|
+
/** Subscriber ID of this participant, or `undefined` if not available. */
|
|
1153
1284
|
get subscriberId(): string | undefined;
|
|
1285
|
+
/** Address ID of this participant, or `undefined` if not available. */
|
|
1154
1286
|
get addressId(): string | undefined;
|
|
1287
|
+
/** Server node ID for this participant, or `undefined` if not available. */
|
|
1155
1288
|
get nodeId(): string | undefined;
|
|
1156
1289
|
/** @internal */
|
|
1157
1290
|
get value(): Partial<Member>;
|
|
@@ -1180,18 +1313,38 @@ declare class Participant extends Destroyable implements CallParticipant {
|
|
|
1180
1313
|
toggleLowbitrate(): Promise<void>;
|
|
1181
1314
|
/** Sets the microphone input sensitivity level. */
|
|
1182
1315
|
setAudioInputSensitivity(value: number): Promise<void>;
|
|
1183
|
-
/**
|
|
1316
|
+
/**
|
|
1317
|
+
* Sets the microphone input volume level.
|
|
1318
|
+
* @param value - Volume level (0-100).
|
|
1319
|
+
*/
|
|
1184
1320
|
setAudioInputVolume(value: number): Promise<void>;
|
|
1185
|
-
/**
|
|
1321
|
+
/**
|
|
1322
|
+
* Sets the speaker output volume level.
|
|
1323
|
+
* @param value - Volume level (0-100).
|
|
1324
|
+
*/
|
|
1186
1325
|
setAudioOutputVolume(value: number): Promise<void>;
|
|
1187
|
-
/**
|
|
1326
|
+
/**
|
|
1327
|
+
* Sets the participant's position in the video layout.
|
|
1328
|
+
* @param value - The {@link VideoPosition} to assign (e.g. `'auto'`, `'reserved-0'`).
|
|
1329
|
+
*/
|
|
1188
1330
|
setPosition(value: VideoPosition): Promise<void>;
|
|
1189
1331
|
/** Removes this participant from the call. */
|
|
1190
1332
|
remove(): Promise<void>;
|
|
1191
1333
|
/** Ends the call for this participant. */
|
|
1192
1334
|
end(): Promise<void>;
|
|
1335
|
+
/**
|
|
1336
|
+
* Replaces custom metadata for this participant.
|
|
1337
|
+
* @param _meta - Metadata object to set.
|
|
1338
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
1339
|
+
*/
|
|
1193
1340
|
setMeta(_meta: Record<string, unknown>): Promise<void>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Merges values into custom metadata (unlike {@link setMeta} which replaces).
|
|
1343
|
+
* @param _meta - Metadata to merge.
|
|
1344
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
1345
|
+
*/
|
|
1194
1346
|
updateMeta(_meta: Record<string, unknown>): Promise<void>;
|
|
1347
|
+
/** Destroys the participant, releasing all subscriptions and references. */
|
|
1195
1348
|
destroy(): void;
|
|
1196
1349
|
}
|
|
1197
1350
|
/**
|
|
@@ -1207,6 +1360,7 @@ declare class SelfParticipant extends Participant implements CallSelfParticipant
|
|
|
1207
1360
|
* Contains all capability flags as both observables and values.
|
|
1208
1361
|
*/
|
|
1209
1362
|
readonly capabilities: SelfCapabilities;
|
|
1363
|
+
/** @internal */
|
|
1210
1364
|
constructor(id: string, executeMethod: ExecuteMethod, vertoManager: VertoManager, deviceController: DeviceController);
|
|
1211
1365
|
destroy(): void;
|
|
1212
1366
|
/** Starts sharing the local screen. */
|
|
@@ -1254,9 +1408,13 @@ declare class SelfParticipant extends Participant implements CallSelfParticipant
|
|
|
1254
1408
|
setVideoInputDeviceConstraints(constraints: MediaTrackConstraints): Promise<void>;
|
|
1255
1409
|
/** Selects the audio output device. Optionally saves as a preference. */
|
|
1256
1410
|
selectAudioOutputDevice(device: MediaDeviceInfo, options?: SelectDeviceOptions): void;
|
|
1411
|
+
/** Mutes local audio. Falls back to local device mute if the server RPC fails. */
|
|
1257
1412
|
mute(): Promise<void>;
|
|
1413
|
+
/** Unmutes local audio. Falls back to local device unmute if the server RPC fails. */
|
|
1258
1414
|
unmute(): Promise<void>;
|
|
1415
|
+
/** Mutes local video. Falls back to local device mute if the server RPC fails. */
|
|
1259
1416
|
muteVideo(): Promise<void>;
|
|
1417
|
+
/** Unmutes local video. Falls back to local device unmute if the server RPC fails. */
|
|
1260
1418
|
unmuteVideo(): Promise<void>;
|
|
1261
1419
|
}
|
|
1262
1420
|
/** Type guard that checks if a participant is the local {@link SelfParticipant}. */
|
|
@@ -1493,7 +1651,7 @@ interface CallManager extends Call {
|
|
|
1493
1651
|
* This interface breaks the circular dependency between Address and Directory
|
|
1494
1652
|
* by providing a minimal contract that Address needs from the Directory.
|
|
1495
1653
|
*
|
|
1496
|
-
* @
|
|
1654
|
+
* @template TAddress - The Address type, defaults to never to enforce explicit typing
|
|
1497
1655
|
*
|
|
1498
1656
|
* @remarks
|
|
1499
1657
|
* Uses a generic type parameter to maintain type safety while avoiding
|
|
@@ -1514,7 +1672,7 @@ interface AddressProvider<TAddress = never> {
|
|
|
1514
1672
|
* Address history entry from conversation messages
|
|
1515
1673
|
* Contains a reference to the sender address as an observable
|
|
1516
1674
|
*
|
|
1517
|
-
* @
|
|
1675
|
+
* @template TAddress - The Address type, provided by the implementation
|
|
1518
1676
|
*
|
|
1519
1677
|
* @remarks
|
|
1520
1678
|
* Uses a generic type parameter to maintain type safety while avoiding
|
|
@@ -1532,7 +1690,7 @@ interface AddressHistory<TAddress = never> {
|
|
|
1532
1690
|
* Text message from conversation
|
|
1533
1691
|
* Contains a reference to the sender address as an observable
|
|
1534
1692
|
*
|
|
1535
|
-
* @
|
|
1693
|
+
* @template TAddress - The Address type, provided by the implementation
|
|
1536
1694
|
*
|
|
1537
1695
|
* @remarks
|
|
1538
1696
|
* Uses a generic type parameter to maintain type safety while avoiding
|
|
@@ -1675,11 +1833,35 @@ declare class Address extends Destroyable {
|
|
|
1675
1833
|
get locked(): boolean;
|
|
1676
1834
|
/** Observable indicating whether the address (room) is locked. */
|
|
1677
1835
|
get locked$(): Observable<boolean>;
|
|
1678
|
-
/**
|
|
1836
|
+
/**
|
|
1837
|
+
* Sends a text message to this address.
|
|
1838
|
+
*
|
|
1839
|
+
* @param text - The message text to send.
|
|
1840
|
+
*
|
|
1841
|
+
* @example
|
|
1842
|
+
* ```ts
|
|
1843
|
+
* await address.sendText('Hello!');
|
|
1844
|
+
* ```
|
|
1845
|
+
*/
|
|
1679
1846
|
sendText(text: string): Promise<void>;
|
|
1680
|
-
/**
|
|
1847
|
+
/**
|
|
1848
|
+
* Collection of text messages for this address, with pagination support.
|
|
1849
|
+
*
|
|
1850
|
+
* Returns `undefined` until {@link textMessages$} has been subscribed to (lazy-loaded).
|
|
1851
|
+
* Filters to `'chat'` subtype messages from the conversation.
|
|
1852
|
+
*
|
|
1853
|
+
* @see {@link textMessages$} to trigger lazy loading.
|
|
1854
|
+
* @see {@link sendText} to send a new message.
|
|
1855
|
+
*/
|
|
1681
1856
|
get textMessage(): EntityCollectionTransformed<GetConversationMessageResponse, TextMessage<Address>> | undefined;
|
|
1682
|
-
/**
|
|
1857
|
+
/**
|
|
1858
|
+
* Collection of call history entries for this address, with pagination support.
|
|
1859
|
+
*
|
|
1860
|
+
* Returns `undefined` until {@link history$} has been subscribed to (lazy-loaded).
|
|
1861
|
+
* Filters to `'log'` subtype messages including kind, status, start/end times.
|
|
1862
|
+
*
|
|
1863
|
+
* @see {@link history$} to trigger lazy loading.
|
|
1864
|
+
*/
|
|
1683
1865
|
get history(): EntityCollectionTransformed<GetConversationMessageResponse, AddressHistory<Address>> | undefined;
|
|
1684
1866
|
/** Observable of active call states for this address. @throws {UnimplementedError} Requires presence support. */
|
|
1685
1867
|
get activity$(): Observable<CallState[]>;
|
|
@@ -2295,6 +2477,12 @@ declare class SignalWire extends Destroyable implements DeviceController {
|
|
|
2295
2477
|
private _options;
|
|
2296
2478
|
private _refreshTimerId?;
|
|
2297
2479
|
private _deps;
|
|
2480
|
+
/**
|
|
2481
|
+
* Creates a new SignalWire client and begins connecting.
|
|
2482
|
+
*
|
|
2483
|
+
* @param credentialProvider - Provider that supplies authentication credentials.
|
|
2484
|
+
* @param options - Configuration options (connection, device monitoring, preferences).
|
|
2485
|
+
*/
|
|
2298
2486
|
constructor(credentialProvider: CredentialProvider, options?: SignalWireOptions);
|
|
2299
2487
|
private validateCredentials;
|
|
2300
2488
|
private init;
|
|
@@ -2381,18 +2569,52 @@ declare class SignalWire extends Destroyable implements DeviceController {
|
|
|
2381
2569
|
get ready$(): Observable<boolean>;
|
|
2382
2570
|
/** Observable stream of errors from transport, authentication, and devices. */
|
|
2383
2571
|
get errors$(): Observable<Error>;
|
|
2384
|
-
/**
|
|
2572
|
+
/**
|
|
2573
|
+
* Disconnects the WebSocket and tears down the current session.
|
|
2574
|
+
*
|
|
2575
|
+
* The client can be reconnected by calling {@link connect} again,
|
|
2576
|
+
* which creates a fresh transport and session.
|
|
2577
|
+
*/
|
|
2385
2578
|
disconnect(): Promise<void>;
|
|
2386
2579
|
private waitAuthentication;
|
|
2387
|
-
/**
|
|
2580
|
+
/**
|
|
2581
|
+
* Registers the subscriber as online to receive inbound calls and events.
|
|
2582
|
+
*
|
|
2583
|
+
* Waits for authentication to complete before sending the registration.
|
|
2584
|
+
* If the initial attempt fails, reauthentication is attempted automatically.
|
|
2585
|
+
*
|
|
2586
|
+
* @throws {InvalidCredentialsError} If registration and reauthentication both fail.
|
|
2587
|
+
*/
|
|
2388
2588
|
register(): Promise<void>;
|
|
2389
|
-
/**
|
|
2589
|
+
/**
|
|
2590
|
+
* Unregisters the subscriber, going offline for inbound calls.
|
|
2591
|
+
*
|
|
2592
|
+
* The WebSocket connection remains open; use {@link disconnect} to fully close it.
|
|
2593
|
+
*/
|
|
2390
2594
|
unregister(): Promise<void>;
|
|
2391
2595
|
/**
|
|
2392
2596
|
* Places an outbound call to the given destination.
|
|
2393
|
-
*
|
|
2394
|
-
*
|
|
2597
|
+
*
|
|
2598
|
+
* Waits for authentication before dialing. Media options are merged from
|
|
2599
|
+
* saved preferences, destination query parameters (e.g. `?channel=video`),
|
|
2600
|
+
* and the provided `options` (highest priority).
|
|
2601
|
+
*
|
|
2602
|
+
* Returns a {@link Call} in `'ringing'` state. Subscribe to {@link Call.status$}
|
|
2603
|
+
* to track progression through `'connected'` → `'disconnected'`.
|
|
2604
|
+
*
|
|
2605
|
+
* @param destination - Address URI string (e.g. `'/public/my-room'`) or {@link Address} instance.
|
|
2606
|
+
* @param options - Media and dial options (audio/video, device constraints). Overrides defaults.
|
|
2395
2607
|
* @returns The created {@link Call} instance.
|
|
2608
|
+
* @throws {Error} If authentication is not complete or call creation fails.
|
|
2609
|
+
*
|
|
2610
|
+
* @example
|
|
2611
|
+
* ```ts
|
|
2612
|
+
* const call = await client.dial('/public/conference', {
|
|
2613
|
+
* audio: true,
|
|
2614
|
+
* video: true,
|
|
2615
|
+
* });
|
|
2616
|
+
* call.status$.subscribe(status => console.log('Call:', status));
|
|
2617
|
+
* ```
|
|
2396
2618
|
*/
|
|
2397
2619
|
dial(destination: string | Address, options?: DialOptions): Promise<Call>;
|
|
2398
2620
|
/** The underlying client session for advanced RPC operations. */
|
|
@@ -2437,8 +2659,19 @@ declare class SignalWire extends Destroyable implements DeviceController {
|
|
|
2437
2659
|
enableDeviceMonitoring(): void;
|
|
2438
2660
|
/** Stops monitoring for media device changes. */
|
|
2439
2661
|
disableDeviceMonitoring(): void;
|
|
2662
|
+
/**
|
|
2663
|
+
* Returns the capabilities of a media device.
|
|
2664
|
+
* @param deviceInfo - The device to query.
|
|
2665
|
+
* @returns The device capabilities, or `null` if unavailable.
|
|
2666
|
+
*/
|
|
2440
2667
|
getDeviceCapabilities(deviceInfo: MediaDeviceInfo): Promise<MediaTrackCapabilities | null>;
|
|
2668
|
+
/**
|
|
2669
|
+
* Checks whether a device is still available and usable.
|
|
2670
|
+
* @param deviceInfo - The device to validate, or `null`.
|
|
2671
|
+
* @returns `true` if the device is valid and available. Returns `false` for `null`, audio output devices, or unavailable devices.
|
|
2672
|
+
*/
|
|
2441
2673
|
isValidDevice(deviceInfo: MediaDeviceInfo | null): Promise<boolean>;
|
|
2674
|
+
/** Destroys the client, clearing timers and releasing all resources. */
|
|
2442
2675
|
destroy(): void;
|
|
2443
2676
|
}
|
|
2444
2677
|
//#endregion
|
|
@@ -2825,17 +3058,45 @@ declare class WebRTCCall extends Destroyable implements CallManager {
|
|
|
2825
3058
|
get participants(): CallParticipant[];
|
|
2826
3059
|
/** The local participant, or `null` if not yet joined. */
|
|
2827
3060
|
get self(): CallSelfParticipant | null;
|
|
3061
|
+
/** Toggles the call lock state, preventing or allowing new participants from joining. */
|
|
2828
3062
|
toggleLock(): Promise<void>;
|
|
3063
|
+
/**
|
|
3064
|
+
* Toggles the hold state of the call (pauses/resumes local media transmission).
|
|
3065
|
+
*
|
|
3066
|
+
* Distinct from {@link Participant.toggleMute} which mutes individual tracks.
|
|
3067
|
+
*/
|
|
2829
3068
|
toggleHold(): Promise<void>;
|
|
3069
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link recording$}. */
|
|
2830
3070
|
startRecording(): Promise<void>;
|
|
3071
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link streaming$}. */
|
|
2831
3072
|
startStreaming(): Promise<void>;
|
|
3073
|
+
/**
|
|
3074
|
+
* Replaces the call's custom metadata.
|
|
3075
|
+
* @param _meta - Metadata object to set.
|
|
3076
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
3077
|
+
*/
|
|
2832
3078
|
setMeta(_meta: Record<string, unknown>): Promise<void>;
|
|
3079
|
+
/**
|
|
3080
|
+
* Merges values into the call's custom metadata (unlike {@link setMeta} which replaces).
|
|
3081
|
+
* @param _meta - Metadata to merge.
|
|
3082
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
3083
|
+
*/
|
|
2833
3084
|
updateMeta(_meta: Record<string, unknown>): Promise<void>;
|
|
2834
3085
|
/** Observable of layout layer positions for all participants. */
|
|
2835
3086
|
get layoutLayers$(): Observable<LayoutLayer[]>;
|
|
2836
3087
|
/** Current snapshot of layout layers. */
|
|
2837
3088
|
get layoutLayers(): LayoutLayer[];
|
|
2838
|
-
/**
|
|
3089
|
+
/**
|
|
3090
|
+
* Executes a Verto RPC method targeting a specific participant.
|
|
3091
|
+
*
|
|
3092
|
+
* Constructs call context (node_id, call_id, member_id) and sends the RPC request.
|
|
3093
|
+
*
|
|
3094
|
+
* @param target - Target member ID string, or a {@link MemberTarget} object.
|
|
3095
|
+
* @param method - Verto method name (e.g. `'call.mute'`, `'call.member.remove'`).
|
|
3096
|
+
* @param args - Parameters for the RPC method.
|
|
3097
|
+
* @returns The RPC response.
|
|
3098
|
+
* @throws {JSONRPCError} If the RPC call returns an error.
|
|
3099
|
+
*/
|
|
2839
3100
|
executeMethod<T extends JSONRPCResponse = JSONRPCResponse>(target: string | MemberTarget, method: string, args: Record<string, unknown>): Promise<T>;
|
|
2840
3101
|
private buildMethodParams;
|
|
2841
3102
|
/** Observable of the current call status (e.g. `'ringing'`, `'connected'`). */
|
|
@@ -2897,7 +3158,16 @@ declare class WebRTCCall extends Destroyable implements CallManager {
|
|
|
2897
3158
|
/** Current audio/video send/receive directions. */
|
|
2898
3159
|
get mediaDirections(): MediaDirections;
|
|
2899
3160
|
protected get participantsId$(): Observable<string[]>;
|
|
2900
|
-
/**
|
|
3161
|
+
/**
|
|
3162
|
+
* Executes a raw JSON-RPC request on the client session.
|
|
3163
|
+
*
|
|
3164
|
+
* Lower-level than {@link executeMethod} — allows full control over the RPC request structure.
|
|
3165
|
+
*
|
|
3166
|
+
* @param request - Complete JSON-RPC request object.
|
|
3167
|
+
* @param options - Optional RPC execution options (timeout, etc.).
|
|
3168
|
+
* @returns The RPC response.
|
|
3169
|
+
* @throws {JSONRPCError} If the RPC call returns an error response.
|
|
3170
|
+
*/
|
|
2901
3171
|
execute<T extends JSONRPCResponse = JSONRPCResponse>(request: JSONRPCRequest, options?: PendingRPCOptions): Promise<T>;
|
|
2902
3172
|
/** Observable of the local participant's member ID. */
|
|
2903
3173
|
get selfId$(): Observable<string | null>;
|
|
@@ -2911,9 +3181,9 @@ declare class WebRTCCall extends Destroyable implements CallManager {
|
|
|
2911
3181
|
private get callSessionEvents$();
|
|
2912
3182
|
/** Observable of call-updated events. */
|
|
2913
3183
|
get callUpdated$(): Observable<CallUpdatedPayload>;
|
|
2914
|
-
/** Observable of member-joined events. */
|
|
3184
|
+
/** Observable of member-joined events, emitted when a remote participant joins the call. */
|
|
2915
3185
|
get memberJoined$(): Observable<MemberJoinedPayload>;
|
|
2916
|
-
/** Observable of member-left events. */
|
|
3186
|
+
/** Observable of member-left events, emitted when a participant leaves the call. */
|
|
2917
3187
|
get memberLeft$(): Observable<MemberLeftPayload>;
|
|
2918
3188
|
/** Observable of member-updated events (mute, volume, etc.). */
|
|
2919
3189
|
get memberUpdated$(): Observable<MemberUpdatedPayload>;
|
|
@@ -2933,25 +3203,78 @@ declare class WebRTCCall extends Destroyable implements CallManager {
|
|
|
2933
3203
|
get callEvent$(): Observable<WebrtcMessagePayload | CallJoinedPayload | CallLeftPayload | CallUpdatedPayload | CallStatePayload | CallPlayPayload | CallConnectPayload | MemberUpdatedPayload | MemberJoinedPayload | MemberLeftPayload | MemberTalkingPayload | LayoutChangedPayload | ConversationMessagePayload>;
|
|
2934
3204
|
/** Observable of layout-changed signaling events. */
|
|
2935
3205
|
get layoutEvent$(): Observable<LayoutChangedPayload>;
|
|
2936
|
-
/**
|
|
3206
|
+
/**
|
|
3207
|
+
* Hangs up the call and releases all resources.
|
|
3208
|
+
*
|
|
3209
|
+
* Sends a Verto `bye` to the server, transitions status to `'disconnecting'`,
|
|
3210
|
+
* then destroys the call. After this, the call instance is no longer usable.
|
|
3211
|
+
*
|
|
3212
|
+
* @example
|
|
3213
|
+
* ```ts
|
|
3214
|
+
* await call.hangup();
|
|
3215
|
+
* ```
|
|
3216
|
+
*/
|
|
2937
3217
|
hangup(): Promise<void>;
|
|
2938
|
-
/**
|
|
3218
|
+
/**
|
|
3219
|
+
* Sends DTMF digits on the call.
|
|
3220
|
+
*
|
|
3221
|
+
* @param dtmf - The digit string to send (e.g. `'1234#'`).
|
|
3222
|
+
*
|
|
3223
|
+
* @example
|
|
3224
|
+
* ```ts
|
|
3225
|
+
* await call.sendDigits('1234#');
|
|
3226
|
+
* ```
|
|
3227
|
+
*/
|
|
2939
3228
|
sendDigits(dtmf: string): Promise<void>;
|
|
2940
|
-
/**
|
|
3229
|
+
/**
|
|
3230
|
+
* Accepts an inbound call, optionally overriding media options for the answer.
|
|
3231
|
+
*
|
|
3232
|
+
* @param options - Optional media constraints for the answer (audio/video).
|
|
3233
|
+
*
|
|
3234
|
+
* @example
|
|
3235
|
+
* ```ts
|
|
3236
|
+
* // Accept with defaults
|
|
3237
|
+
* call.answer();
|
|
3238
|
+
*
|
|
3239
|
+
* // Accept audio-only
|
|
3240
|
+
* call.answer({ audio: true, video: false });
|
|
3241
|
+
* ```
|
|
3242
|
+
* @see {@link reject} to decline the call instead.
|
|
3243
|
+
* @see {@link answered$} to observe the acceptance state.
|
|
3244
|
+
*/
|
|
2941
3245
|
answer(options?: MediaOptions): void;
|
|
2942
3246
|
/** Media options provided when answering. Used internally by the VertoManager. */
|
|
2943
3247
|
get answerMediaOptions(): MediaOptions | undefined;
|
|
2944
|
-
/**
|
|
3248
|
+
/**
|
|
3249
|
+
* Rejects an inbound call, preventing media negotiation.
|
|
3250
|
+
*
|
|
3251
|
+
* @see {@link answer} to accept the call instead.
|
|
3252
|
+
* @see {@link answered$} to observe the rejection state.
|
|
3253
|
+
*/
|
|
2945
3254
|
reject(): void;
|
|
2946
3255
|
/** Observable that emits `true` when answered, `false` when rejected. */
|
|
2947
3256
|
get answered$(): Observable<boolean>;
|
|
2948
3257
|
/**
|
|
2949
3258
|
* Sets the call layout and participant positions.
|
|
3259
|
+
*
|
|
2950
3260
|
* @param layout - Layout name (must be one of {@link layouts}).
|
|
2951
|
-
* @param positions - Map of member IDs to
|
|
3261
|
+
* @param positions - Map of member IDs to {@link VideoPosition} values.
|
|
3262
|
+
* @throws {InvalidParams} If the layout is not in the available {@link layouts}.
|
|
3263
|
+
*
|
|
3264
|
+
* @example
|
|
3265
|
+
* ```ts
|
|
3266
|
+
* await call.setLayout('grid-responsive', {
|
|
3267
|
+
* [participantId]: 'reserved-0',
|
|
3268
|
+
* });
|
|
3269
|
+
* ```
|
|
2952
3270
|
*/
|
|
2953
3271
|
setLayout(layout: string, positions: Record<string, VideoPosition>): Promise<void>;
|
|
2954
|
-
/**
|
|
3272
|
+
/**
|
|
3273
|
+
* Transfers the call to another destination.
|
|
3274
|
+
*
|
|
3275
|
+
* @param options - Transfer configuration including the target destination.
|
|
3276
|
+
* @see {@link status$} to observe the transfer progress.
|
|
3277
|
+
*/
|
|
2955
3278
|
transfer(options: TransferOptions): Promise<void>;
|
|
2956
3279
|
/** Destroys the call, releasing all resources and subscriptions. */
|
|
2957
3280
|
destroy(): void;
|