livekit-client 2.15.16 → 2.16.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.
Files changed (88) hide show
  1. package/README.md +105 -1
  2. package/dist/livekit-client.e2ee.worker.js +1 -1
  3. package/dist/livekit-client.e2ee.worker.js.map +1 -1
  4. package/dist/livekit-client.e2ee.worker.mjs +1 -0
  5. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  6. package/dist/livekit-client.esm.mjs +1175 -1341
  7. package/dist/livekit-client.esm.mjs.map +1 -1
  8. package/dist/livekit-client.umd.js +1 -1
  9. package/dist/livekit-client.umd.js.map +1 -1
  10. package/dist/src/api/SignalClient.d.ts.map +1 -1
  11. package/dist/src/api/utils.d.ts +1 -0
  12. package/dist/src/api/utils.d.ts.map +1 -1
  13. package/dist/src/connectionHelper/checks/turn.d.ts.map +1 -1
  14. package/dist/src/connectionHelper/checks/websocket.d.ts.map +1 -1
  15. package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
  16. package/dist/src/options.d.ts +4 -1
  17. package/dist/src/options.d.ts.map +1 -1
  18. package/dist/src/room/PCTransportManager.d.ts.map +1 -1
  19. package/dist/src/room/RTCEngine.d.ts +5 -0
  20. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  21. package/dist/src/room/RegionUrlProvider.d.ts +7 -0
  22. package/dist/src/room/RegionUrlProvider.d.ts.map +1 -1
  23. package/dist/src/room/Room.d.ts +1 -1
  24. package/dist/src/room/Room.d.ts.map +1 -1
  25. package/dist/src/room/data-stream/incoming/StreamReader.d.ts +3 -3
  26. package/dist/src/room/data-stream/incoming/StreamReader.d.ts.map +1 -1
  27. package/dist/src/room/data-stream/outgoing/OutgoingDataStreamManager.d.ts +0 -1
  28. package/dist/src/room/data-stream/outgoing/OutgoingDataStreamManager.d.ts.map +1 -1
  29. package/dist/src/room/errors.d.ts +74 -5
  30. package/dist/src/room/errors.d.ts.map +1 -1
  31. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  32. package/dist/src/room/participant/Participant.d.ts +1 -1
  33. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  34. package/dist/src/room/token-source/TokenSource.d.ts +10 -2
  35. package/dist/src/room/token-source/TokenSource.d.ts.map +1 -1
  36. package/dist/src/room/track/LocalTrack.d.ts +0 -4
  37. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  38. package/dist/src/room/track/TrackPublication.d.ts.map +1 -1
  39. package/dist/src/room/track/create.d.ts.map +1 -1
  40. package/dist/src/room/track/processor/types.d.ts +0 -6
  41. package/dist/src/room/track/processor/types.d.ts.map +1 -1
  42. package/dist/src/room/types.d.ts +1 -1
  43. package/dist/src/room/types.d.ts.map +1 -1
  44. package/dist/src/room/utils.d.ts +4 -4
  45. package/dist/src/room/utils.d.ts.map +1 -1
  46. package/dist/src/test/mocks.d.ts.map +1 -1
  47. package/dist/ts4.2/api/utils.d.ts +1 -0
  48. package/dist/ts4.2/options.d.ts +4 -1
  49. package/dist/ts4.2/room/RTCEngine.d.ts +5 -0
  50. package/dist/ts4.2/room/RegionUrlProvider.d.ts +7 -0
  51. package/dist/ts4.2/room/Room.d.ts +1 -1
  52. package/dist/ts4.2/room/data-stream/incoming/StreamReader.d.ts +3 -3
  53. package/dist/ts4.2/room/data-stream/outgoing/OutgoingDataStreamManager.d.ts +0 -1
  54. package/dist/ts4.2/room/errors.d.ts +74 -5
  55. package/dist/ts4.2/room/participant/Participant.d.ts +1 -1
  56. package/dist/ts4.2/room/token-source/TokenSource.d.ts +1 -1
  57. package/dist/ts4.2/room/track/LocalTrack.d.ts +0 -4
  58. package/dist/ts4.2/room/track/processor/types.d.ts +0 -6
  59. package/dist/ts4.2/room/types.d.ts +1 -1
  60. package/dist/ts4.2/room/utils.d.ts +3 -3
  61. package/package.json +10 -6
  62. package/src/api/SignalClient.test.ts +12 -19
  63. package/src/api/SignalClient.ts +13 -28
  64. package/src/api/utils.ts +1 -1
  65. package/src/connectionHelper/checks/turn.ts +7 -0
  66. package/src/connectionHelper/checks/websocket.ts +40 -11
  67. package/src/e2ee/E2eeManager.ts +6 -4
  68. package/src/options.ts +4 -4
  69. package/src/room/PCTransport.ts +1 -1
  70. package/src/room/PCTransportManager.ts +4 -19
  71. package/src/room/RTCEngine.ts +64 -20
  72. package/src/room/RegionUrlProvider.test.ts +183 -9
  73. package/src/room/RegionUrlProvider.ts +97 -12
  74. package/src/room/Room.ts +25 -17
  75. package/src/room/data-stream/incoming/IncomingDataStreamManager.ts +2 -2
  76. package/src/room/data-stream/incoming/StreamReader.ts +5 -5
  77. package/src/room/data-stream/outgoing/OutgoingDataStreamManager.ts +0 -3
  78. package/src/room/errors.ts +144 -16
  79. package/src/room/participant/LocalParticipant.ts +12 -12
  80. package/src/room/participant/Participant.ts +2 -2
  81. package/src/room/token-source/TokenSource.ts +5 -1
  82. package/src/room/track/LocalTrack.ts +0 -4
  83. package/src/room/track/TrackPublication.ts +1 -1
  84. package/src/room/track/create.ts +6 -4
  85. package/src/room/track/processor/types.ts +0 -6
  86. package/src/room/types.ts +1 -1
  87. package/src/room/utils.ts +5 -4
  88. package/src/test/mocks.ts +0 -1
@@ -10,6 +10,14 @@ export class LivekitError extends Error {
10
10
  }
11
11
  }
12
12
 
13
+ export class SimulatedError extends LivekitError {
14
+ readonly name = 'simulated';
15
+
16
+ constructor(message = 'Simulated failure') {
17
+ super(-1, message);
18
+ }
19
+ }
20
+
13
21
  export enum ConnectionErrorReason {
14
22
  NotAllowed,
15
23
  ServerUnreachable,
@@ -17,80 +25,189 @@ export enum ConnectionErrorReason {
17
25
  Cancelled,
18
26
  LeaveRequest,
19
27
  Timeout,
28
+ WebSocket,
20
29
  }
21
30
 
22
- export class ConnectionError extends LivekitError {
31
+ type NotAllowed = {
32
+ reason: ConnectionErrorReason.NotAllowed;
33
+ status: number;
34
+ context?: unknown;
35
+ };
36
+
37
+ type InternalError = {
38
+ reason: ConnectionErrorReason.InternalError;
39
+ status: never;
40
+ context?: { status?: number; statusText?: string };
41
+ };
42
+
43
+ type ConnectionTimeout = {
44
+ reason: ConnectionErrorReason.Timeout;
45
+ status: never;
46
+ context: never;
47
+ };
48
+
49
+ type LeaveRequest = {
50
+ reason: ConnectionErrorReason.LeaveRequest;
51
+ status: never;
52
+ context: DisconnectReason;
53
+ };
54
+
55
+ type Cancelled = {
56
+ reason: ConnectionErrorReason.Cancelled;
57
+ status: never;
58
+ context: never;
59
+ };
60
+
61
+ type ServerUnreachable = {
62
+ reason: ConnectionErrorReason.ServerUnreachable;
63
+ status?: number;
64
+ context?: never;
65
+ };
66
+
67
+ type WebSocket = {
68
+ reason: ConnectionErrorReason.WebSocket;
23
69
  status?: number;
70
+ context?: string;
71
+ };
72
+
73
+ type ConnectionErrorVariants =
74
+ | NotAllowed
75
+ | ConnectionTimeout
76
+ | LeaveRequest
77
+ | InternalError
78
+ | Cancelled
79
+ | ServerUnreachable
80
+ | WebSocket;
24
81
 
25
- context?: unknown | DisconnectReason;
82
+ export class ConnectionError<
83
+ Variant extends ConnectionErrorVariants = ConnectionErrorVariants,
84
+ > extends LivekitError {
85
+ status?: Variant['status'];
26
86
 
27
- reason: ConnectionErrorReason;
87
+ context: Variant['context'];
88
+
89
+ reason: Variant['reason'];
28
90
 
29
91
  reasonName: string;
30
92
 
31
- constructor(
93
+ readonly name = 'ConnectionError';
94
+
95
+ protected constructor(
32
96
  message: string,
33
- reason: ConnectionErrorReason,
34
- status?: number,
35
- context?: unknown | DisconnectReason,
97
+ reason: Variant['reason'],
98
+ status?: Variant['status'],
99
+ context?: Variant['context'],
36
100
  ) {
37
101
  super(1, message);
38
- this.name = 'ConnectionError';
39
102
  this.status = status;
40
103
  this.reason = reason;
41
104
  this.context = context;
42
105
  this.reasonName = ConnectionErrorReason[reason];
43
106
  }
107
+
108
+ static notAllowed(message: string, status: number, context?: unknown) {
109
+ return new ConnectionError<NotAllowed>(
110
+ message,
111
+ ConnectionErrorReason.NotAllowed,
112
+ status,
113
+ context,
114
+ );
115
+ }
116
+
117
+ static timeout(message: string) {
118
+ return new ConnectionError<ConnectionTimeout>(message, ConnectionErrorReason.Timeout);
119
+ }
120
+
121
+ static leaveRequest(message: string, context: DisconnectReason) {
122
+ return new ConnectionError<LeaveRequest>(
123
+ message,
124
+ ConnectionErrorReason.LeaveRequest,
125
+ undefined,
126
+ context,
127
+ );
128
+ }
129
+
130
+ static internal(message: string, context?: { status?: number; statusText?: string }) {
131
+ return new ConnectionError<InternalError>(
132
+ message,
133
+ ConnectionErrorReason.InternalError,
134
+ undefined,
135
+ context,
136
+ );
137
+ }
138
+
139
+ static cancelled(message: string) {
140
+ return new ConnectionError<Cancelled>(message, ConnectionErrorReason.Cancelled);
141
+ }
142
+
143
+ static serverUnreachable(message: string, status?: number) {
144
+ return new ConnectionError<ServerUnreachable>(
145
+ message,
146
+ ConnectionErrorReason.ServerUnreachable,
147
+ status,
148
+ );
149
+ }
150
+
151
+ static websocket(message: string, status?: number, reason?: string) {
152
+ return new ConnectionError<WebSocket>(message, ConnectionErrorReason.WebSocket, status, reason);
153
+ }
44
154
  }
45
155
 
46
156
  export class DeviceUnsupportedError extends LivekitError {
157
+ readonly name = 'DeviceUnsupportedError';
158
+
47
159
  constructor(message?: string) {
48
160
  super(21, message ?? 'device is unsupported');
49
- this.name = 'DeviceUnsupportedError';
50
161
  }
51
162
  }
52
163
 
53
164
  export class TrackInvalidError extends LivekitError {
165
+ readonly name = 'TrackInvalidError';
166
+
54
167
  constructor(message?: string) {
55
168
  super(20, message ?? 'track is invalid');
56
- this.name = 'TrackInvalidError';
57
169
  }
58
170
  }
59
171
 
60
172
  export class UnsupportedServer extends LivekitError {
173
+ readonly name = 'UnsupportedServer';
174
+
61
175
  constructor(message?: string) {
62
176
  super(10, message ?? 'unsupported server');
63
- this.name = 'UnsupportedServer';
64
177
  }
65
178
  }
66
179
 
67
180
  export class UnexpectedConnectionState extends LivekitError {
181
+ readonly name = 'UnexpectedConnectionState';
182
+
68
183
  constructor(message?: string) {
69
184
  super(12, message ?? 'unexpected connection state');
70
- this.name = 'UnexpectedConnectionState';
71
185
  }
72
186
  }
73
187
 
74
188
  export class NegotiationError extends LivekitError {
189
+ readonly name = 'NegotiationError';
190
+
75
191
  constructor(message?: string) {
76
192
  super(13, message ?? 'unable to negotiate');
77
- this.name = 'NegotiationError';
78
193
  }
79
194
  }
80
195
 
81
196
  export class PublishDataError extends LivekitError {
197
+ readonly name = 'PublishDataError';
198
+
82
199
  constructor(message?: string) {
83
200
  super(14, message ?? 'unable to publish data');
84
- this.name = 'PublishDataError';
85
201
  }
86
202
  }
87
203
 
88
204
  export class PublishTrackError extends LivekitError {
205
+ readonly name = 'PublishTrackError';
206
+
89
207
  status: number;
90
208
 
91
209
  constructor(message: string, status: number) {
92
210
  super(15, message);
93
- this.name = 'PublishTrackError';
94
211
  this.status = status;
95
212
  }
96
213
  }
@@ -100,6 +217,8 @@ export type RequestErrorReason =
100
217
  | 'TimeoutError';
101
218
 
102
219
  export class SignalRequestError extends LivekitError {
220
+ readonly name = 'SignalRequestError';
221
+
103
222
  reason: RequestErrorReason;
104
223
 
105
224
  reasonName: string;
@@ -136,18 +255,27 @@ export enum DataStreamErrorReason {
136
255
  }
137
256
 
138
257
  export class DataStreamError extends LivekitError {
258
+ readonly name = 'DataStreamError';
259
+
139
260
  reason: DataStreamErrorReason;
140
261
 
141
262
  reasonName: string;
142
263
 
143
264
  constructor(message: string, reason: DataStreamErrorReason) {
144
265
  super(16, message);
145
- this.name = 'DataStreamError';
146
266
  this.reason = reason;
147
267
  this.reasonName = DataStreamErrorReason[reason];
148
268
  }
149
269
  }
150
270
 
271
+ export class SignalReconnectError extends LivekitError {
272
+ readonly name = 'SignalReconnectError';
273
+
274
+ constructor(message?: string) {
275
+ super(18, message);
276
+ }
277
+ }
278
+
151
279
  export enum MediaDeviceFailure {
152
280
  // user rejected permissions
153
281
  PermissionDenied = 'PermissionDenied',
@@ -137,11 +137,11 @@ export default class LocalParticipant extends Participant {
137
137
 
138
138
  private encryptionType: Encryption_Type = Encryption_Type.NONE;
139
139
 
140
- private reconnectFuture?: Future<void>;
140
+ private reconnectFuture?: Future<void, Error>;
141
141
 
142
- private signalConnectedFuture?: Future<void>;
142
+ private signalConnectedFuture?: Future<void, Error>;
143
143
 
144
- private activeAgentFuture?: Future<RemoteParticipant>;
144
+ private activeAgentFuture?: Future<RemoteParticipant, Error>;
145
145
 
146
146
  private firstActiveAgent?: RemoteParticipant;
147
147
 
@@ -262,7 +262,7 @@ export default class LocalParticipant extends Participant {
262
262
 
263
263
  private handleReconnecting = () => {
264
264
  if (!this.reconnectFuture) {
265
- this.reconnectFuture = new Future<void>();
265
+ this.reconnectFuture = new Future<void, Error>();
266
266
  }
267
267
  };
268
268
 
@@ -275,15 +275,15 @@ export default class LocalParticipant extends Participant {
275
275
  private handleClosing = () => {
276
276
  if (this.reconnectFuture) {
277
277
  this.reconnectFuture.promise.catch((e) => this.log.warn(e.message, this.logContext));
278
- this.reconnectFuture?.reject?.('Got disconnected during reconnection attempt');
278
+ this.reconnectFuture?.reject?.(new Error('Got disconnected during reconnection attempt'));
279
279
  this.reconnectFuture = undefined;
280
280
  }
281
281
  if (this.signalConnectedFuture) {
282
- this.signalConnectedFuture.reject?.('Got disconnected without signal connected');
282
+ this.signalConnectedFuture.reject?.(new Error('Got disconnected without signal connected'));
283
283
  this.signalConnectedFuture = undefined;
284
284
  }
285
285
 
286
- this.activeAgentFuture?.reject?.('Got disconnected without active agent present');
286
+ this.activeAgentFuture?.reject?.(new Error('Got disconnected without active agent present'));
287
287
  this.activeAgentFuture = undefined;
288
288
  this.firstActiveAgent = undefined;
289
289
  };
@@ -293,7 +293,7 @@ export default class LocalParticipant extends Participant {
293
293
  this.updateInfo(joinResponse.participant);
294
294
  }
295
295
  if (!this.signalConnectedFuture) {
296
- this.signalConnectedFuture = new Future<void>();
296
+ this.signalConnectedFuture = new Future<void, Error>();
297
297
  }
298
298
 
299
299
  this.signalConnectedFuture.resolve?.();
@@ -926,7 +926,7 @@ export default class LocalParticipant extends Participant {
926
926
 
927
927
  private waitUntilEngineConnected() {
928
928
  if (!this.signalConnectedFuture) {
929
- this.signalConnectedFuture = new Future<void>();
929
+ this.signalConnectedFuture = new Future<void, Error>();
930
930
  }
931
931
  return this.signalConnectedFuture.promise;
932
932
  }
@@ -1824,7 +1824,7 @@ export default class LocalParticipant extends Participant {
1824
1824
  resolve: (responsePayload: string | null, responseError: RpcError | null) => {
1825
1825
  clearTimeout(responseTimeoutId);
1826
1826
  if (this.pendingAcks.has(id)) {
1827
- console.warn('RPC response received before ack', id);
1827
+ this.log.warn('RPC response received before ack', id);
1828
1828
  this.pendingAcks.delete(id);
1829
1829
  clearTimeout(ackTimeoutId);
1830
1830
  }
@@ -2009,7 +2009,7 @@ export default class LocalParticipant extends Participant {
2009
2009
  if (agent) {
2010
2010
  this.activeAgentFuture?.resolve?.(agent);
2011
2011
  } else {
2012
- this.activeAgentFuture?.reject?.('Agent disconnected');
2012
+ this.activeAgentFuture?.reject?.(new Error('Agent disconnected'));
2013
2013
  }
2014
2014
  this.activeAgentFuture = undefined;
2015
2015
  }
@@ -2019,7 +2019,7 @@ export default class LocalParticipant extends Participant {
2019
2019
  return Promise.resolve(this.firstActiveAgent);
2020
2020
  }
2021
2021
  if (!this.activeAgentFuture) {
2022
- this.activeAgentFuture = new Future<RemoteParticipant>();
2022
+ this.activeAgentFuture = new Future<RemoteParticipant, Error>();
2023
2023
  }
2024
2024
  return this.activeAgentFuture.promise;
2025
2025
  }
@@ -96,7 +96,7 @@ export default class Participant extends (EventEmitter as new () => TypedEmitter
96
96
 
97
97
  protected loggerOptions?: LoggerOptions;
98
98
 
99
- protected activeFuture?: Future<void>;
99
+ protected activeFuture?: Future<void, Error>;
100
100
 
101
101
  protected get logContext() {
102
102
  return {
@@ -195,7 +195,7 @@ export default class Participant extends (EventEmitter as new () => TypedEmitter
195
195
  return this.activeFuture.promise;
196
196
  }
197
197
 
198
- this.activeFuture = new Future<void>();
198
+ this.activeFuture = new Future<void, Error>();
199
199
 
200
200
  this.once(ParticipantEvent.Active, () => {
201
201
  this.activeFuture?.resolve?.();
@@ -245,9 +245,13 @@ class TokenSourceSandboxTokenServer extends TokenSourceEndpoint {
245
245
  }
246
246
 
247
247
  export {
248
+ /** The return type of {@link TokenSource.literal} */
248
249
  type TokenSourceLiteral,
250
+ /** The return type of {@link TokenSource.custom} */
249
251
  type TokenSourceCustom,
252
+ /** The return type of {@link TokenSource.endpoint} */
250
253
  type TokenSourceEndpoint,
254
+ /** The return type of {@link TokenSource.sandboxTokenServer} */
251
255
  type TokenSourceSandboxTokenServer,
252
256
  decodeTokenPayload,
253
257
  areTokenSourceFetchOptionsEqual,
@@ -273,7 +277,7 @@ export const TokenSource = {
273
277
  /**
274
278
  * TokenSource.endpoint creates a token source that fetches credentials from a given URL using
275
279
  * the standard endpoint format:
276
- * FIXME: add docs link here in the future!
280
+ * @see https://cloud.livekit.io/projects/p_/sandbox/templates/token-server
277
281
  */
278
282
  endpoint(url: string, options: EndpointOptions = {}) {
279
283
  return new TokenSourceEndpoint(url, options);
@@ -518,8 +518,6 @@ export default abstract class LocalTrack<
518
518
  * Sets a processor on this track.
519
519
  * See https://github.com/livekit/track-processors-js for example usage
520
520
  *
521
- * @experimental
522
- *
523
521
  * @param processor
524
522
  * @param showProcessedStreamLocally
525
523
  * @returns
@@ -592,8 +590,6 @@ export default abstract class LocalTrack<
592
590
  * Stops the track processor
593
591
  * See https://github.com/livekit/track-processors-js for example usage
594
592
  *
595
- * @experimental
596
- * @returns
597
593
  */
598
594
  async stopProcessor(keepElement = true) {
599
595
  const unlock = await this.trackChangeLock.lock();
@@ -1,11 +1,11 @@
1
1
  import { Encryption_Type } from '@livekit/protocol';
2
+ import { EventEmitter } from 'events';
2
3
  import type {
3
4
  SubscriptionError,
4
5
  TrackInfo,
5
6
  UpdateSubscription,
6
7
  UpdateTrackSettings,
7
8
  } from '@livekit/protocol';
8
- import { EventEmitter } from 'events';
9
9
  import type TypedEventEmitter from 'typed-emitter';
10
10
  import log, { LoggerNames, getLogger } from '../../logger';
11
11
  import { TrackEvent } from '../events';
@@ -78,11 +78,13 @@ export async function createLocalTracks(
78
78
  deviceId: { ideal: deviceId },
79
79
  };
80
80
  }
81
- if (
82
- internalOptions.audio === true ||
83
- (typeof internalOptions.audio === 'object' && !internalOptions.audio.deviceId)
84
- ) {
81
+ if (internalOptions.audio === true) {
85
82
  internalOptions.audio = { deviceId: 'default' };
83
+ } else if (typeof internalOptions.audio === 'object' && internalOptions.audio !== null) {
84
+ internalOptions.audio = {
85
+ ...internalOptions.audio,
86
+ deviceId: internalOptions.audio.deviceId || 'default',
87
+ };
86
88
  }
87
89
  if (internalOptions.video === true) {
88
90
  internalOptions.video = { deviceId: 'default' };
@@ -11,9 +11,6 @@ export type ProcessorOptions<T extends Track.Kind> = {
11
11
  audioContext?: AudioContext;
12
12
  };
13
13
 
14
- /**
15
- * @experimental
16
- */
17
14
  export interface AudioProcessorOptions extends ProcessorOptions<Track.Kind.Audio> {
18
15
  audioContext: AudioContext;
19
16
  }
@@ -23,9 +20,6 @@ export interface AudioProcessorOptions extends ProcessorOptions<Track.Kind.Audio
23
20
  */
24
21
  export interface VideoProcessorOptions extends ProcessorOptions<Track.Kind.Video> {}
25
22
 
26
- /**
27
- * @experimental
28
- */
29
23
  export interface TrackProcessor<
30
24
  T extends Track.Kind,
31
25
  U extends ProcessorOptions<T> = ProcessorOptions<T>,
package/src/room/types.ts CHANGED
@@ -125,7 +125,7 @@ export interface StreamController<T extends DataStream_Chunk> {
125
125
  startTime: number;
126
126
  endTime?: number;
127
127
  sendingParticipantIdentity: string;
128
- outOfBandFailureRejectingFuture: Future<never>;
128
+ outOfBandFailureRejectingFuture: Future<never, Error>;
129
129
  }
130
130
 
131
131
  export interface BaseStreamInfo {
package/src/room/utils.ts CHANGED
@@ -5,7 +5,8 @@ import {
5
5
  DisconnectReason,
6
6
  Transcription as TranscriptionModel,
7
7
  } from '@livekit/protocol';
8
- import { type BrowserDetails, getBrowser } from '../utils/browserParser';
8
+ import { getBrowser } from '../utils/browserParser';
9
+ import type { BrowserDetails } from '../utils/browserParser';
9
10
  import { protocolVersion, version } from '../version';
10
11
  import { type ConnectionError, ConnectionErrorReason } from './errors';
11
12
  import type LocalParticipant from './participant/LocalParticipant';
@@ -455,12 +456,12 @@ export function getStereoAudioStreamTrack() {
455
456
  return stereoTrack;
456
457
  }
457
458
 
458
- export class Future<T> {
459
+ export class Future<T, E extends Error> {
459
460
  promise: Promise<T>;
460
461
 
461
462
  resolve?: (arg: T) => void;
462
463
 
463
- reject?: (e: any) => void;
464
+ reject?: (e: E) => void;
464
465
 
465
466
  onFinally?: () => void;
466
467
 
@@ -471,7 +472,7 @@ export class Future<T> {
471
472
  private _isResolved: boolean = false;
472
473
 
473
474
  constructor(
474
- futureBase?: (resolve: (arg: T) => void, reject: (e: any) => void) => void,
475
+ futureBase?: (resolve: (arg: T) => void, reject: (e: E) => void) => void,
475
476
  onFinally?: () => void,
476
477
  ) {
477
478
  this.onFinally = onFinally;
package/src/test/mocks.ts CHANGED
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line import/no-extraneous-dependencies
2
1
  import { type MockedClass, vi } from 'vitest';
3
2
  import { SignalClient } from '../api/SignalClient';
4
3
  import RTCEngine from '../room/RTCEngine';