livekit-server-sdk 2.6.1 → 2.7.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.
Files changed (45) hide show
  1. package/dist/AccessToken.d.ts +2 -2
  2. package/dist/AccessToken.js +2 -2
  3. package/dist/EgressClient.d.ts +29 -28
  4. package/dist/EgressClient.d.ts.map +1 -1
  5. package/dist/EgressClient.js +23 -22
  6. package/dist/EgressClient.js.map +1 -1
  7. package/dist/IngressClient.d.ts +13 -12
  8. package/dist/IngressClient.d.ts.map +1 -1
  9. package/dist/IngressClient.js +11 -11
  10. package/dist/IngressClient.js.map +1 -1
  11. package/dist/RoomServiceClient.d.ts +24 -24
  12. package/dist/RoomServiceClient.js +16 -16
  13. package/dist/ServiceBase.d.ts +5 -5
  14. package/dist/ServiceBase.d.ts.map +1 -1
  15. package/dist/ServiceBase.js +3 -3
  16. package/dist/SipClient.d.ts +28 -22
  17. package/dist/SipClient.d.ts.map +1 -1
  18. package/dist/SipClient.js +36 -23
  19. package/dist/SipClient.js.map +1 -1
  20. package/dist/TwirpRPC.d.ts.map +1 -1
  21. package/dist/TwirpRPC.js +1 -0
  22. package/dist/TwirpRPC.js.map +1 -1
  23. package/dist/WebhookReceiver.d.ts +4 -5
  24. package/dist/WebhookReceiver.d.ts.map +1 -1
  25. package/dist/WebhookReceiver.js +3 -4
  26. package/dist/WebhookReceiver.js.map +1 -1
  27. package/dist/grants.d.ts.map +1 -1
  28. package/dist/grants.js +1 -0
  29. package/dist/grants.js.map +1 -1
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2 -2
  33. package/dist/index.js.map +1 -1
  34. package/package.json +4 -4
  35. package/src/AccessToken.ts +2 -2
  36. package/src/EgressClient.ts +40 -33
  37. package/src/IngressClient.ts +17 -15
  38. package/src/RoomServiceClient.ts +24 -24
  39. package/src/ServiceBase.ts +5 -5
  40. package/src/SipClient.ts +49 -23
  41. package/src/TwirpRPC.ts +2 -0
  42. package/src/WebhookReceiver.ts +4 -5
  43. package/src/grants.test.ts +2 -1
  44. package/src/grants.ts +1 -0
  45. package/src/index.ts +3 -1
@@ -1,20 +1,22 @@
1
1
  // SPDX-FileCopyrightText: 2024 LiveKit, Inc.
2
2
  //
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- import {
4
+ import type {
5
5
  DirectFileOutput,
6
- EgressInfo,
7
6
  EncodedFileOutput,
8
7
  EncodingOptions,
9
8
  EncodingOptionsPreset,
10
9
  ImageOutput,
10
+ SegmentedFileOutput,
11
+ StreamOutput,
12
+ } from '@livekit/protocol';
13
+ import {
14
+ EgressInfo,
11
15
  ListEgressRequest,
12
16
  ListEgressResponse,
13
17
  ParticipantEgressRequest,
14
18
  RoomCompositeEgressRequest,
15
- SegmentedFileOutput,
16
19
  StopEgressRequest,
17
- StreamOutput,
18
20
  TrackCompositeEgressRequest,
19
21
  TrackEgressRequest,
20
22
  UpdateLayoutRequest,
@@ -22,7 +24,8 @@ import {
22
24
  WebEgressRequest,
23
25
  } from '@livekit/protocol';
24
26
  import ServiceBase from './ServiceBase.js';
25
- import { Rpc, TwirpRpc, livekitPackage } from './TwirpRPC.js';
27
+ import type { Rpc } from './TwirpRPC.js';
28
+ import { TwirpRpc, livekitPackage } from './TwirpRPC.js';
26
29
 
27
30
  const svc = 'Egress';
28
31
 
@@ -118,9 +121,9 @@ export class EgressClient extends ServiceBase {
118
121
  private readonly rpc: Rpc;
119
122
 
120
123
  /**
121
- * @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
122
- * @param apiKey API Key, can be set in env var LIVEKIT_API_KEY
123
- * @param secret API Secret, can be set in env var LIVEKIT_API_SECRET
124
+ * @param host - hostname including protocol. i.e. 'https://cluster.livekit.io'
125
+ * @param apiKey - API Key, can be set in env var LIVEKIT_API_KEY
126
+ * @param secret - API Secret, can be set in env var LIVEKIT_API_SECRET
124
127
  */
125
128
  constructor(host: string, apiKey?: string, secret?: string) {
126
129
  super(apiKey, secret);
@@ -128,9 +131,9 @@ export class EgressClient extends ServiceBase {
128
131
  }
129
132
 
130
133
  /**
131
- * @param roomName room name
132
- * @param output file or stream output
133
- * @param opts RoomCompositeOptions
134
+ * @param roomName - room name
135
+ * @param output - file or stream output
136
+ * @param opts - RoomCompositeOptions
134
137
  */
135
138
  async startRoomCompositeEgress(
136
139
  roomName: string,
@@ -210,9 +213,9 @@ export class EgressClient extends ServiceBase {
210
213
  }
211
214
 
212
215
  /**
213
- * @param url url
214
- * @param output file or stream output
215
- * @param opts WebOptions
216
+ * @param url - url
217
+ * @param output - file or stream output
218
+ * @param opts - WebOptions
216
219
  */
217
220
  async startWebEgress(
218
221
  url: string,
@@ -256,9 +259,9 @@ export class EgressClient extends ServiceBase {
256
259
  /**
257
260
  * Export a participant's audio and video tracks,
258
261
  *
259
- * @param roomName room name
260
- * @param output one or more outputs
261
- * @param opts ParticipantEgressOptions
262
+ * @param roomName - room name
263
+ * @param output - one or more outputs
264
+ * @param opts - ParticipantEgressOptions
262
265
  */
263
266
  async startParticipantEgress(
264
267
  roomName: string,
@@ -288,9 +291,9 @@ export class EgressClient extends ServiceBase {
288
291
  }
289
292
 
290
293
  /**
291
- * @param roomName room name
292
- * @param output file or stream output
293
- * @param opts TrackCompositeOptions
294
+ * @param roomName - room name
295
+ * @param output - file or stream output
296
+ * @param opts - TrackCompositeOptions
294
297
  */
295
298
  async startTrackCompositeEgress(
296
299
  roomName: string,
@@ -358,6 +361,7 @@ export class EgressClient extends ServiceBase {
358
361
  return EgressInfo.fromJson(data, { ignoreUnknownFields: true });
359
362
  }
360
363
 
364
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
361
365
  private isEncodedOutputs(output: any): output is EncodedOutputs {
362
366
  return (
363
367
  (<EncodedOutputs>output).file !== undefined ||
@@ -366,6 +370,7 @@ export class EgressClient extends ServiceBase {
366
370
  );
367
371
  }
368
372
 
373
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
369
374
  private isEncodedFileOutput(output: any): output is EncodedFileOutput {
370
375
  return (
371
376
  (<EncodedFileOutput>output).filepath !== undefined ||
@@ -373,6 +378,7 @@ export class EgressClient extends ServiceBase {
373
378
  );
374
379
  }
375
380
 
381
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
376
382
  private isSegmentedFileOutput(output: any): output is SegmentedFileOutput {
377
383
  return (
378
384
  (<SegmentedFileOutput>output).filenamePrefix !== undefined ||
@@ -381,6 +387,7 @@ export class EgressClient extends ServiceBase {
381
387
  );
382
388
  }
383
389
 
390
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
384
391
  private isStreamOutput(output: any): output is StreamOutput {
385
392
  return (
386
393
  (<StreamOutput>output).protocol !== undefined || (<StreamOutput>output).urls !== undefined
@@ -489,9 +496,9 @@ export class EgressClient extends ServiceBase {
489
496
  }
490
497
 
491
498
  /**
492
- * @param roomName room name
493
- * @param output file or websocket output
494
- * @param trackId track Id
499
+ * @param roomName - room name
500
+ * @param output - file or websocket output
501
+ * @param trackId - track Id
495
502
  */
496
503
  async startTrackEgress(
497
504
  roomName: string,
@@ -537,8 +544,8 @@ export class EgressClient extends ServiceBase {
537
544
  }
538
545
 
539
546
  /**
540
- * @param egressId
541
- * @param layout
547
+ * @param egressId -
548
+ * @param layout -
542
549
  */
543
550
  async updateLayout(egressId: string, layout: string): Promise<EgressInfo> {
544
551
  const data = await this.rpc.request(
@@ -551,9 +558,9 @@ export class EgressClient extends ServiceBase {
551
558
  }
552
559
 
553
560
  /**
554
- * @param egressId
555
- * @param addOutputUrls
556
- * @param removeOutputUrls
561
+ * @param egressId -
562
+ * @param addOutputUrls -
563
+ * @param removeOutputUrls -
557
564
  */
558
565
  async updateStream(
559
566
  egressId: string,
@@ -573,17 +580,17 @@ export class EgressClient extends ServiceBase {
573
580
  }
574
581
 
575
582
  /**
576
- * @param options options to filter listed Egresses, by default returns all
583
+ * @param options - options to filter listed Egresses, by default returns all
577
584
  * Egress instances
578
585
  */
579
586
  async listEgress(options?: ListEgressOptions): Promise<Array<EgressInfo>>;
580
587
  /**
581
- * @deprecated
582
- * @param roomName list egress for one room only
588
+ * @deprecated use `listEgress(options?: ListEgressOptions)` instead
589
+ * @param roomName - list egress for one room only
583
590
  */
584
591
  async listEgress(roomName?: string): Promise<Array<EgressInfo>>;
585
592
  /**
586
- * @param roomName list egress for one room only
593
+ * @param roomName - list egress for one room only
587
594
  */
588
595
  async listEgress(options?: string | ListEgressOptions): Promise<Array<EgressInfo>> {
589
596
  let req: Partial<ListEgressRequest> = {};
@@ -603,7 +610,7 @@ export class EgressClient extends ServiceBase {
603
610
  }
604
611
 
605
612
  /**
606
- * @param egressId
613
+ * @param egressId -
607
614
  */
608
615
  async stopEgress(egressId: string): Promise<EgressInfo> {
609
616
  const data = await this.rpc.request(
@@ -1,19 +1,18 @@
1
1
  // SPDX-FileCopyrightText: 2024 LiveKit, Inc.
2
2
  //
3
3
  // SPDX-License-Identifier: Apache-2.0
4
+ import type { IngressAudioOptions, IngressInput, IngressVideoOptions } from '@livekit/protocol';
4
5
  import {
5
6
  CreateIngressRequest,
6
7
  DeleteIngressRequest,
7
- IngressAudioOptions,
8
8
  IngressInfo,
9
- IngressInput,
10
- IngressVideoOptions,
11
9
  ListIngressRequest,
12
10
  ListIngressResponse,
13
11
  UpdateIngressRequest,
14
12
  } from '@livekit/protocol';
15
13
  import ServiceBase from './ServiceBase.js';
16
- import { Rpc, TwirpRpc, livekitPackage } from './TwirpRPC.js';
14
+ import type { Rpc } from './TwirpRPC.js';
15
+ import { TwirpRpc, livekitPackage } from './TwirpRPC.js';
17
16
 
18
17
  const svc = 'Ingress';
19
18
 
@@ -122,9 +121,9 @@ export class IngressClient extends ServiceBase {
122
121
  private readonly rpc: Rpc;
123
122
 
124
123
  /**
125
- * @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
126
- * @param apiKey API Key, can be set in env var LIVEKIT_API_KEY
127
- * @param secret API Secret, can be set in env var LIVEKIT_API_SECRET
124
+ * @param host - hostname including protocol. i.e. 'https://cluster.livekit.io'
125
+ * @param apiKey - API Key, can be set in env var LIVEKIT_API_KEY
126
+ * @param secret - API Secret, can be set in env var LIVEKIT_API_SECRET
128
127
  */
129
128
  constructor(host: string, apiKey?: string, secret?: string) {
130
129
  super(apiKey, secret);
@@ -132,8 +131,8 @@ export class IngressClient extends ServiceBase {
132
131
  }
133
132
 
134
133
  /**
135
- * @param inputType protocol for the ingress
136
- * @param opts CreateIngressOptions
134
+ * @param inputType - protocol for the ingress
135
+ * @param opts - CreateIngressOptions
137
136
  */
138
137
  async createIngress(inputType: IngressInput, opts?: CreateIngressOptions): Promise<IngressInfo> {
139
138
  let name: string = '';
@@ -184,8 +183,8 @@ export class IngressClient extends ServiceBase {
184
183
  }
185
184
 
186
185
  /**
187
- * @param ingressId ID of the ingress to update
188
- * @param opts UpdateIngressOptions
186
+ * @param ingressId - ID of the ingress to update
187
+ * @param opts - UpdateIngressOptions
189
188
  */
190
189
  async updateIngress(ingressId: string, opts: UpdateIngressOptions): Promise<IngressInfo> {
191
190
  const name: string = opts.name || '';
@@ -218,14 +217,17 @@ export class IngressClient extends ServiceBase {
218
217
  }
219
218
 
220
219
  /**
221
- * @deprecated use listIngress(opts) instead
222
- * @param roomName list ingress for one room only
220
+ * @deprecated use `listIngress(opts)` or `listIngress(arg)` instead
221
+ * @param roomName - list ingress for one room only
223
222
  */
224
223
  async listIngress(roomName?: string): Promise<Array<IngressInfo>>;
225
224
  /**
226
- * @param opts list options
225
+ * @param opts - list options
227
226
  */
228
227
  async listIngress(opts?: ListIngressOptions): Promise<Array<IngressInfo>>;
228
+ /**
229
+ * @param arg - list room name or options
230
+ */
229
231
  async listIngress(arg?: string | ListIngressOptions): Promise<Array<IngressInfo>> {
230
232
  let req: Partial<ListIngressRequest> = {};
231
233
  if (typeof arg === 'string') {
@@ -243,7 +245,7 @@ export class IngressClient extends ServiceBase {
243
245
  }
244
246
 
245
247
  /**
246
- * @param ingressId ingress to delete
248
+ * @param ingressId - ingress to delete
247
249
  */
248
250
  async deleteIngress(ingressId: string): Promise<IngressInfo> {
249
251
  const data = await this.rpc.request(
@@ -122,7 +122,7 @@ export class RoomServiceClient extends ServiceBase {
122
122
  * Creates a new room. Explicit room creation is not required, since rooms will
123
123
  * be automatically created when the first participant joins. This method can be
124
124
  * used to customize room settings.
125
- * @param options
125
+ * @param options -
126
126
  */
127
127
  async createRoom(options: CreateOptions): Promise<Room> {
128
128
  const data = await this.rpc.request(
@@ -162,8 +162,8 @@ export class RoomServiceClient extends ServiceBase {
162
162
 
163
163
  /**
164
164
  * Update metadata of a room
165
- * @param room name of the room
166
- * @param metadata the new metadata for the room
165
+ * @param room - name of the room
166
+ * @param metadata - the new metadata for the room
167
167
  */
168
168
  async updateRoomMetadata(room: string, metadata: string) {
169
169
  const data = await this.rpc.request(
@@ -177,7 +177,7 @@ export class RoomServiceClient extends ServiceBase {
177
177
 
178
178
  /**
179
179
  * List participants in a room
180
- * @param room name of the room
180
+ * @param room - name of the room
181
181
  */
182
182
  async listParticipants(room: string): Promise<ParticipantInfo[]> {
183
183
  const data = await this.rpc.request(
@@ -193,8 +193,8 @@ export class RoomServiceClient extends ServiceBase {
193
193
  /**
194
194
  * Get information on a specific participant, including the tracks that participant
195
195
  * has published
196
- * @param room name of the room
197
- * @param identity identity of the participant to return
196
+ * @param room - name of the room
197
+ * @param identity - identity of the participant to return
198
198
  */
199
199
  async getParticipant(room: string, identity: string): Promise<ParticipantInfo> {
200
200
  const data = await this.rpc.request(
@@ -211,8 +211,8 @@ export class RoomServiceClient extends ServiceBase {
211
211
  * Removes a participant in the room. This will disconnect the participant
212
212
  * and will emit a Disconnected event for that participant.
213
213
  * Even after being removed, the participant can still re-join the room.
214
- * @param room
215
- * @param identity
214
+ * @param room -
215
+ * @param identity -
216
216
  */
217
217
  async removeParticipant(room: string, identity: string): Promise<void> {
218
218
  await this.rpc.request(
@@ -225,10 +225,10 @@ export class RoomServiceClient extends ServiceBase {
225
225
 
226
226
  /**
227
227
  * Mutes a track that the participant has published.
228
- * @param room
229
- * @param identity
230
- * @param trackSid sid of the track to be muted
231
- * @param muted true to mute, false to unmute
228
+ * @param room -
229
+ * @param identity -
230
+ * @param trackSid - sid of the track to be muted
231
+ * @param muted - true to mute, false to unmute
232
232
  */
233
233
  async mutePublishedTrack(
234
234
  room: string,
@@ -312,10 +312,10 @@ export class RoomServiceClient extends ServiceBase {
312
312
 
313
313
  /**
314
314
  * Updates a participant's subscription to tracks
315
- * @param room
316
- * @param identity
317
- * @param trackSids
318
- * @param subscribe true to subscribe, false to unsubscribe
315
+ * @param room -
316
+ * @param identity -
317
+ * @param trackSids -
318
+ * @param subscribe - true to subscribe, false to unsubscribe
319
319
  */
320
320
  async updateSubscriptions(
321
321
  room: string,
@@ -340,10 +340,10 @@ export class RoomServiceClient extends ServiceBase {
340
340
 
341
341
  /**
342
342
  * Sends data message to participants in the room
343
- * @param room
344
- * @param data opaque payload to send
345
- * @param kind delivery reliability
346
- * @param options optionally specify a topic and destinationSids (when destinationSids is empty, message is sent to everyone)
343
+ * @param room -
344
+ * @param data - opaque payload to send
345
+ * @param kind - delivery reliability
346
+ * @param options - optionally specify a topic and destinationSids (when destinationSids is empty, message is sent to everyone)
347
347
  */
348
348
  async sendData(
349
349
  room: string,
@@ -354,10 +354,10 @@ export class RoomServiceClient extends ServiceBase {
354
354
  /**
355
355
  * Sends data message to participants in the room
356
356
  * @deprecated use sendData(room, data, kind, options) instead
357
- * @param room
358
- * @param data opaque payload to send
359
- * @param kind delivery reliability
360
- * @param destinationSids optional. when empty, message is sent to everyone
357
+ * @param room -
358
+ * @param data - opaque payload to send
359
+ * @param kind - delivery reliability
360
+ * @param destinationSids - optional. when empty, message is sent to everyone
361
361
  */
362
362
  async sendData(
363
363
  room: string,
@@ -2,7 +2,7 @@
2
2
  //
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import { AccessToken } from './AccessToken.js';
5
- import { SIPGrant, VideoGrant } from './grants.js';
5
+ import type { SIPGrant, VideoGrant } from './grants.js';
6
6
 
7
7
  /**
8
8
  * Utilities to handle authentication
@@ -15,9 +15,9 @@ export default class ServiceBase {
15
15
  private readonly ttl: string;
16
16
 
17
17
  /**
18
- * @param apiKey API Key.
19
- * @param secret API Secret.
20
- * @param ttl token TTL
18
+ * @param apiKey - API Key.
19
+ * @param secret - API Secret.
20
+ * @param ttl - token TTL
21
21
  */
22
22
  constructor(apiKey?: string, secret?: string, ttl?: string) {
23
23
  this.apiKey = apiKey;
@@ -25,7 +25,7 @@ export default class ServiceBase {
25
25
  this.ttl = ttl || '10m';
26
26
  }
27
27
 
28
- async authHeader(grant: VideoGrant, sip?: SIPGrant): Promise<any> {
28
+ async authHeader(grant: VideoGrant, sip?: SIPGrant): Promise<Record<string, string>> {
29
29
  const at = new AccessToken(this.apiKey, this.secret, { ttl: this.ttl });
30
30
  at.addGrant(grant);
31
31
  if (sip) {
package/src/SipClient.ts CHANGED
@@ -26,9 +26,11 @@ import {
26
26
  SIPParticipantInfo,
27
27
  SIPTransport,
28
28
  SIPTrunkInfo,
29
+ TransferSIPParticipantRequest,
29
30
  } from '@livekit/protocol';
30
31
  import ServiceBase from './ServiceBase.js';
31
- import { Rpc, TwirpRpc, livekitPackage } from './TwirpRPC.js';
32
+ import type { Rpc } from './TwirpRPC.js';
33
+ import { TwirpRpc, livekitPackage } from './TwirpRPC.js';
32
34
 
33
35
  const svc = 'SIP';
34
36
 
@@ -95,9 +97,9 @@ export class SipClient extends ServiceBase {
95
97
  private readonly rpc: Rpc;
96
98
 
97
99
  /**
98
- * @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
99
- * @param apiKey API Key, can be set in env var LIVEKIT_API_KEY
100
- * @param secret API Secret, can be set in env var LIVEKIT_API_SECRET
100
+ * @param host - hostname including protocol. i.e. 'https://cluster.livekit.io'
101
+ * @param apiKey - API Key, can be set in env var LIVEKIT_API_KEY
102
+ * @param secret - API Secret, can be set in env var LIVEKIT_API_SECRET
101
103
  */
102
104
  constructor(host: string, apiKey?: string, secret?: string) {
103
105
  super(apiKey, secret);
@@ -105,9 +107,9 @@ export class SipClient extends ServiceBase {
105
107
  }
106
108
 
107
109
  /**
108
- * @param number phone number of the trunk
109
- * @param opts CreateSipTrunkOptions
110
- * @deprecated use createSipInboundTrunk or createSipOutboundTrunk
110
+ * @param number - phone number of the trunk
111
+ * @param opts - CreateSipTrunkOptions
112
+ * @deprecated use `createSipInboundTrunk` or `createSipOutboundTrunk`
111
113
  */
112
114
  async createSipTrunk(number: string, opts?: CreateSipTrunkOptions): Promise<SIPTrunkInfo> {
113
115
  let inboundAddresses: string[] | undefined;
@@ -155,9 +157,9 @@ export class SipClient extends ServiceBase {
155
157
  }
156
158
 
157
159
  /**
158
- @param name human-readable name of the trunk
159
- * @param numbers phone numbers of the trunk
160
- * @param opts CreateSipTrunkOptions
160
+ * @param name - human-readable name of the trunk
161
+ * @param numbers - phone numbers of the trunk
162
+ * @param opts - CreateSipTrunkOptions
161
163
  */
162
164
  async createSipInboundTrunk(
163
165
  name: string,
@@ -200,10 +202,10 @@ export class SipClient extends ServiceBase {
200
202
  }
201
203
 
202
204
  /**
203
- * @param name human-readable name of the trunk
204
- * @param address hostname and port of the SIP server to dial
205
- * @param numbers phone numbers of the trunk
206
- * @param opts CreateSipTrunkOptions
205
+ * @param name - human-readable name of the trunk
206
+ * @param address - hostname and port of the SIP server to dial
207
+ * @param numbers - phone numbers of the trunk
208
+ * @param opts - CreateSipTrunkOptions
207
209
  */
208
210
  async createSipOutboundTrunk(
209
211
  name: string,
@@ -245,7 +247,7 @@ export class SipClient extends ServiceBase {
245
247
  }
246
248
 
247
249
  /**
248
- * @deprecated use listSipInboundTrunk or listSipOutboundTrunk
250
+ * @deprecated use `listSipInboundTrunk` or `listSipOutboundTrunk`
249
251
  */
250
252
  async listSipTrunk(): Promise<Array<SIPTrunkInfo>> {
251
253
  const req: Partial<ListSIPTrunkRequest> = {};
@@ -281,7 +283,7 @@ export class SipClient extends ServiceBase {
281
283
  }
282
284
 
283
285
  /**
284
- * @param sipTrunkId sip trunk to delete
286
+ * @param sipTrunkId - sip trunk to delete
285
287
  */
286
288
  async deleteSipTrunk(sipTrunkId: string): Promise<SIPTrunkInfo> {
287
289
  const data = await this.rpc.request(
@@ -294,8 +296,8 @@ export class SipClient extends ServiceBase {
294
296
  }
295
297
 
296
298
  /**
297
- * @param rule sip dispatch rule
298
- * @param opts CreateSipDispatchRuleOptions
299
+ * @param rule - sip dispatch rule
300
+ * @param opts - CreateSipDispatchRuleOptions
299
301
  */
300
302
  async createSipDispatchRule(
301
303
  rule: SipDispatchRuleDirect | SipDispatchRuleIndividual,
@@ -364,7 +366,7 @@ export class SipClient extends ServiceBase {
364
366
  }
365
367
 
366
368
  /**
367
- * @param sipDispatchRuleId sip trunk to delete
369
+ * @param sipDispatchRuleId - sip trunk to delete
368
370
  */
369
371
  async deleteSipDispatchRule(sipDispatchRuleId: string): Promise<SIPDispatchRuleInfo> {
370
372
  const data = await this.rpc.request(
@@ -377,10 +379,10 @@ export class SipClient extends ServiceBase {
377
379
  }
378
380
 
379
381
  /**
380
- * @param sipTrunkId sip trunk to use for the call
381
- * @param number number to dial
382
- * @param roomName room to attach the call to
383
- * @param opts CreateSipParticipantOptions
382
+ * @param sipTrunkId - sip trunk to use for the call
383
+ * @param number - number to dial
384
+ * @param roomName - room to attach the call to
385
+ * @param opts - CreateSipParticipantOptions
384
386
  */
385
387
  async createSipParticipant(
386
388
  sipTrunkId: string,
@@ -424,4 +426,28 @@ export class SipClient extends ServiceBase {
424
426
  );
425
427
  return SIPParticipantInfo.fromJson(data, { ignoreUnknownFields: true });
426
428
  }
429
+
430
+ /**
431
+ * @param roomName - room the SIP participant to transfer is connectd to
432
+ * @param participantIdentity - identity of the SIP participant to transfer
433
+ * @param transferTo - SIP URL to transfer the participant to
434
+ */
435
+ async transferSipParticipant(
436
+ roomName: string,
437
+ participantIdentity: string,
438
+ transferTo: string,
439
+ ): Promise<void> {
440
+ const req = new TransferSIPParticipantRequest({
441
+ participantIdentity: participantIdentity,
442
+ roomName: roomName,
443
+ transferTo: transferTo,
444
+ }).toJson();
445
+
446
+ await this.rpc.request(
447
+ svc,
448
+ 'TransferSIPParticipant',
449
+ req,
450
+ await this.authHeader({ roomAdmin: true, room: roomName }, { call: true }),
451
+ );
452
+ }
427
453
  }
package/src/TwirpRPC.ts CHANGED
@@ -10,6 +10,7 @@ const defaultPrefix = '/twirp';
10
10
 
11
11
  export const livekitPackage = 'livekit';
12
12
  export interface Rpc {
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
14
  request(service: string, method: string, data: JsonValue, headers?: any): Promise<string>;
14
15
  }
15
16
 
@@ -32,6 +33,7 @@ export class TwirpRpc {
32
33
  this.prefix = prefix || defaultPrefix;
33
34
  }
34
35
 
36
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
37
  async request(service: string, method: string, data: any, headers?: any): Promise<any> {
36
38
  const path = `${this.prefix}/${this.pkg}.${service}/${method}`;
37
39
  const url = new URL(path, this.host);
@@ -37,7 +37,7 @@ export type WebhookEventNames =
37
37
  | 'ingress_ended'
38
38
  /**
39
39
  * @internal
40
- * @note only used as a default value, not a valid webhook event
40
+ * @remarks only used as a default value, not a valid webhook event
41
41
  */
42
42
  | '';
43
43
 
@@ -49,10 +49,9 @@ export class WebhookReceiver {
49
49
  }
50
50
 
51
51
  /**
52
- *
53
- * @param body string of the posted body
54
- * @param authHeader `Authorization` header from the request
55
- * @param skipAuth true to skip auth validation
52
+ * @param body - string of the posted body
53
+ * @param authHeader - `Authorization` header from the request
54
+ * @param skipAuth - true to skip auth validation
56
55
  * @returns
57
56
  */
58
57
  async receive(
@@ -3,7 +3,8 @@
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import { TrackSource } from '@livekit/protocol';
5
5
  import { describe, expect, it } from 'vitest';
6
- import { ClaimGrants, VideoGrant, claimsToJwtPayload } from './grants';
6
+ import type { ClaimGrants, VideoGrant } from './grants';
7
+ import { claimsToJwtPayload } from './grants';
7
8
 
8
9
  describe('ClaimGrants are parsed correctly', () => {
9
10
  it('parses TrackSource correctly to strings', () => {
package/src/grants.ts CHANGED
@@ -22,6 +22,7 @@ export function trackSourceToString(source: TrackSource) {
22
22
  export function claimsToJwtPayload(
23
23
  grant: ClaimGrants,
24
24
  ): JWTPayload & { video?: Record<string, unknown> } {
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
26
  const claim: Record<string, any> = { ...grant };
26
27
  // eslint-disable-next-line no-restricted-syntax
27
28
  if (Array.isArray(claim.video?.canPublishSources)) {
package/src/index.ts CHANGED
@@ -16,6 +16,8 @@ export {
16
16
  EncodingOptions,
17
17
  EncodingOptionsPreset,
18
18
  GCPUpload,
19
+ ImageCodec,
20
+ ImageFileSuffix,
19
21
  ImageOutput,
20
22
  IngressAudioEncodingOptions,
21
23
  IngressAudioEncodingPreset,
@@ -50,8 +52,8 @@ export {
50
52
  } from '@livekit/protocol';
51
53
  export * from './AccessToken.js';
52
54
  export * from './EgressClient.js';
55
+ export * from './grants.js';
53
56
  export * from './IngressClient.js';
54
57
  export * from './RoomServiceClient.js';
55
58
  export * from './SipClient.js';
56
59
  export * from './WebhookReceiver.js';
57
- export * from './grants.js';