livekit-server-sdk 1.1.2 → 1.1.3
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/package.json +1 -1
- package/dist/AccessToken.d.ts +0 -56
- package/dist/AccessToken.js +0 -118
- package/dist/AccessToken.js.map +0 -1
- package/dist/AccessToken.test.d.ts +0 -1
- package/dist/AccessToken.test.js +0 -72
- package/dist/AccessToken.test.js.map +0 -1
- package/dist/EgressClient.d.ts +0 -128
- package/dist/EgressClient.js +0 -263
- package/dist/EgressClient.js.map +0 -1
- package/dist/IngressClient.d.ts +0 -84
- package/dist/IngressClient.js +0 -112
- package/dist/IngressClient.js.map +0 -1
- package/dist/RoomServiceClient.d.ts +0 -132
- package/dist/RoomServiceClient.js +0 -189
- package/dist/RoomServiceClient.js.map +0 -1
- package/dist/ServiceBase.d.ts +0 -16
- package/dist/ServiceBase.js +0 -27
- package/dist/ServiceBase.js.map +0 -1
- package/dist/TwirpRPC.d.ts +0 -16
- package/dist/TwirpRPC.js +0 -37
- package/dist/TwirpRPC.js.map +0 -1
- package/dist/WebhookReceiver.d.ts +0 -14
- package/dist/WebhookReceiver.js +0 -40
- package/dist/WebhookReceiver.js.map +0 -1
- package/dist/WebhookReceiver.test.d.ts +0 -1
- package/dist/WebhookReceiver.test.js +0 -39
- package/dist/WebhookReceiver.test.js.map +0 -1
- package/dist/grants.d.ts +0 -38
- package/dist/grants.js +0 -3
- package/dist/grants.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.js +0 -45
- package/dist/index.js.map +0 -1
- package/dist/proto/google/protobuf/timestamp.d.ts +0 -132
- package/dist/proto/google/protobuf/timestamp.js +0 -92
- package/dist/proto/google/protobuf/timestamp.js.map +0 -1
- package/dist/proto/livekit_egress.d.ts +0 -11266
- package/dist/proto/livekit_egress.js +0 -2869
- package/dist/proto/livekit_egress.js.map +0 -1
- package/dist/proto/livekit_ingress.d.ts +0 -2163
- package/dist/proto/livekit_ingress.js +0 -1264
- package/dist/proto/livekit_ingress.js.map +0 -1
- package/dist/proto/livekit_models.d.ts +0 -1356
- package/dist/proto/livekit_models.js +0 -2893
- package/dist/proto/livekit_models.js.map +0 -1
- package/dist/proto/livekit_room.d.ts +0 -3273
- package/dist/proto/livekit_room.js +0 -1057
- package/dist/proto/livekit_room.js.map +0 -1
- package/dist/proto/livekit_webhook.d.ts +0 -4837
- package/dist/proto/livekit_webhook.js +0 -169
- package/dist/proto/livekit_webhook.js.map +0 -1
package/dist/IngressClient.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { IngressAudioOptions, IngressInfo, IngressInput, IngressVideoOptions } from './proto/livekit_ingress';
|
|
2
|
-
import ServiceBase from './ServiceBase';
|
|
3
|
-
export interface CreateIngressOptions {
|
|
4
|
-
/**
|
|
5
|
-
* ingress name. optional
|
|
6
|
-
*/
|
|
7
|
-
name?: string;
|
|
8
|
-
/**
|
|
9
|
-
* name of the room to send media to. optional
|
|
10
|
-
*/
|
|
11
|
-
roomName?: string;
|
|
12
|
-
/**
|
|
13
|
-
* unique identity of the participant. optional
|
|
14
|
-
*/
|
|
15
|
-
participantIdentity?: string;
|
|
16
|
-
/**
|
|
17
|
-
* participant display name
|
|
18
|
-
*/
|
|
19
|
-
participantName?: string;
|
|
20
|
-
/**
|
|
21
|
-
* custom audio encoding parameters. optional
|
|
22
|
-
*/
|
|
23
|
-
audio?: IngressAudioOptions;
|
|
24
|
-
/**
|
|
25
|
-
* custom video encoding parameters. optional
|
|
26
|
-
*/
|
|
27
|
-
video?: IngressVideoOptions;
|
|
28
|
-
}
|
|
29
|
-
export interface UpdateIngressOptions {
|
|
30
|
-
/**
|
|
31
|
-
* ingress name. optional
|
|
32
|
-
*/
|
|
33
|
-
name: string;
|
|
34
|
-
/**
|
|
35
|
-
* name of the room to send media to. optional
|
|
36
|
-
*/
|
|
37
|
-
roomName?: string;
|
|
38
|
-
/**
|
|
39
|
-
* unique identity of the participant. optional
|
|
40
|
-
*/
|
|
41
|
-
participantIdentity?: string;
|
|
42
|
-
/**
|
|
43
|
-
* participant display name
|
|
44
|
-
*/
|
|
45
|
-
participantName?: string;
|
|
46
|
-
/**
|
|
47
|
-
* custom audio encoding parameters. optional
|
|
48
|
-
*/
|
|
49
|
-
audio?: IngressAudioOptions;
|
|
50
|
-
/**
|
|
51
|
-
* custom video encoding parameters. optional
|
|
52
|
-
*/
|
|
53
|
-
video?: IngressVideoOptions;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Client to access Ingress APIs
|
|
57
|
-
*/
|
|
58
|
-
export declare class IngressClient extends ServiceBase {
|
|
59
|
-
private readonly rpc;
|
|
60
|
-
/**
|
|
61
|
-
* @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
|
|
62
|
-
* @param apiKey API Key, can be set in env var LIVEKIT_API_KEY
|
|
63
|
-
* @param secret API Secret, can be set in env var LIVEKIT_API_SECRET
|
|
64
|
-
*/
|
|
65
|
-
constructor(host: string, apiKey?: string, secret?: string);
|
|
66
|
-
/**
|
|
67
|
-
* @param inputType protocol for the ingress
|
|
68
|
-
* @param opts CreateIngressOptions
|
|
69
|
-
*/
|
|
70
|
-
createIngress(inputType: IngressInput, opts?: CreateIngressOptions): Promise<IngressInfo>;
|
|
71
|
-
/**
|
|
72
|
-
* @param ingressId ID of the ingress to update
|
|
73
|
-
* @param opts UpdateIngressOptions
|
|
74
|
-
*/
|
|
75
|
-
updateIngress(ingressId: string, opts: UpdateIngressOptions): Promise<IngressInfo>;
|
|
76
|
-
/**
|
|
77
|
-
* @param roomName list ingress for one room only
|
|
78
|
-
*/
|
|
79
|
-
listIngress(roomName?: string): Promise<Array<IngressInfo>>;
|
|
80
|
-
/**
|
|
81
|
-
* @param ingressId ingress to delete
|
|
82
|
-
*/
|
|
83
|
-
deleteIngress(ingressId: string): Promise<IngressInfo>;
|
|
84
|
-
}
|
package/dist/IngressClient.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.IngressClient = void 0;
|
|
16
|
-
const livekit_ingress_1 = require("./proto/livekit_ingress");
|
|
17
|
-
const ServiceBase_1 = __importDefault(require("./ServiceBase"));
|
|
18
|
-
const TwirpRPC_1 = require("./TwirpRPC");
|
|
19
|
-
const svc = 'Ingress';
|
|
20
|
-
/**
|
|
21
|
-
* Client to access Ingress APIs
|
|
22
|
-
*/
|
|
23
|
-
class IngressClient extends ServiceBase_1.default {
|
|
24
|
-
/**
|
|
25
|
-
* @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
|
|
26
|
-
* @param apiKey API Key, can be set in env var LIVEKIT_API_KEY
|
|
27
|
-
* @param secret API Secret, can be set in env var LIVEKIT_API_SECRET
|
|
28
|
-
*/
|
|
29
|
-
constructor(host, apiKey, secret) {
|
|
30
|
-
super(apiKey, secret);
|
|
31
|
-
this.rpc = new TwirpRPC_1.TwirpRpc(host, TwirpRPC_1.livekitPackage);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @param inputType protocol for the ingress
|
|
35
|
-
* @param opts CreateIngressOptions
|
|
36
|
-
*/
|
|
37
|
-
createIngress(inputType, opts) {
|
|
38
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
let name = '';
|
|
40
|
-
let roomName = '';
|
|
41
|
-
let participantName = '';
|
|
42
|
-
let participantIdentity = '';
|
|
43
|
-
let audio;
|
|
44
|
-
let video;
|
|
45
|
-
if (opts !== undefined) {
|
|
46
|
-
name = opts.name || '';
|
|
47
|
-
roomName = opts.roomName || '';
|
|
48
|
-
participantName = opts.participantName || '';
|
|
49
|
-
participantIdentity = opts.participantIdentity || '';
|
|
50
|
-
audio = opts.audio;
|
|
51
|
-
video = opts.video;
|
|
52
|
-
}
|
|
53
|
-
const req = livekit_ingress_1.CreateIngressRequest.toJSON({
|
|
54
|
-
inputType,
|
|
55
|
-
name,
|
|
56
|
-
roomName,
|
|
57
|
-
participantIdentity,
|
|
58
|
-
participantName,
|
|
59
|
-
audio,
|
|
60
|
-
video,
|
|
61
|
-
});
|
|
62
|
-
const data = yield this.rpc.request(svc, 'CreateIngress', req, this.authHeader({ ingressAdmin: true }));
|
|
63
|
-
return livekit_ingress_1.IngressInfo.fromJSON(data);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* @param ingressId ID of the ingress to update
|
|
68
|
-
* @param opts UpdateIngressOptions
|
|
69
|
-
*/
|
|
70
|
-
updateIngress(ingressId, opts) {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
const name = opts.name || '';
|
|
73
|
-
const roomName = opts.roomName || '';
|
|
74
|
-
const participantName = opts.participantName || '';
|
|
75
|
-
const participantIdentity = opts.participantIdentity || '';
|
|
76
|
-
const { audio, video } = opts;
|
|
77
|
-
const req = livekit_ingress_1.UpdateIngressRequest.toJSON({
|
|
78
|
-
ingressId,
|
|
79
|
-
name,
|
|
80
|
-
roomName,
|
|
81
|
-
participantIdentity,
|
|
82
|
-
participantName,
|
|
83
|
-
audio,
|
|
84
|
-
video,
|
|
85
|
-
});
|
|
86
|
-
const data = yield this.rpc.request(svc, 'UpdateIngress', req, this.authHeader({ ingressAdmin: true }));
|
|
87
|
-
return livekit_ingress_1.IngressInfo.fromJSON(data);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* @param roomName list ingress for one room only
|
|
92
|
-
*/
|
|
93
|
-
listIngress(roomName) {
|
|
94
|
-
var _a;
|
|
95
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
-
roomName !== null && roomName !== void 0 ? roomName : (roomName = '');
|
|
97
|
-
const data = yield this.rpc.request(svc, 'ListIngress', livekit_ingress_1.ListIngressRequest.toJSON({ roomName }), this.authHeader({ ingressAdmin: true }));
|
|
98
|
-
return (_a = livekit_ingress_1.ListIngressResponse.fromJSON(data).items) !== null && _a !== void 0 ? _a : [];
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* @param ingressId ingress to delete
|
|
103
|
-
*/
|
|
104
|
-
deleteIngress(ingressId) {
|
|
105
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
-
const data = yield this.rpc.request(svc, 'DeleteIngress', livekit_ingress_1.DeleteIngressRequest.toJSON({ ingressId }), this.authHeader({ ingressAdmin: true }));
|
|
107
|
-
return livekit_ingress_1.IngressInfo.fromJSON(data);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.IngressClient = IngressClient;
|
|
112
|
-
//# sourceMappingURL=IngressClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IngressClient.js","sourceRoot":"","sources":["../src/IngressClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAUiC;AACjC,gEAAwC;AACxC,yCAA2D;AAE3D,MAAM,GAAG,GAAG,SAAS,CAAC;AAwDtB;;GAEG;AACH,MAAa,aAAc,SAAQ,qBAAW;IAG5C;;;;OAIG;IACH,YAAY,IAAY,EAAE,MAAe,E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AAG,EACH,eAAe,EACf,sCAAoB,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAC1C,IAAI,CAAC,UAAU,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CACxC,CAAC;YACF,OAAO,6BAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;KAAA;CACF;AA9GD,sCA8GC"}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { DataPacket_Kind, ParticipantInfo, ParticipantPermission, Room, TrackInfo } from './proto/livekit_models';
|
|
2
|
-
import { RoomEgress } from './proto/livekit_room';
|
|
3
|
-
import ServiceBase from './ServiceBase';
|
|
4
|
-
/**
|
|
5
|
-
* Options for when creating a room
|
|
6
|
-
*/
|
|
7
|
-
export interface CreateOptions {
|
|
8
|
-
/**
|
|
9
|
-
* name of the room. required
|
|
10
|
-
*/
|
|
11
|
-
name: string;
|
|
12
|
-
/**
|
|
13
|
-
* number of seconds the room should clean up after being empty
|
|
14
|
-
*/
|
|
15
|
-
emptyTimeout?: number;
|
|
16
|
-
/**
|
|
17
|
-
* limit to the number of participants in a room at a time
|
|
18
|
-
*/
|
|
19
|
-
maxParticipants?: number;
|
|
20
|
-
/**
|
|
21
|
-
* initial room metadata
|
|
22
|
-
*/
|
|
23
|
-
metadata?: string;
|
|
24
|
-
/**
|
|
25
|
-
* add egress options
|
|
26
|
-
*/
|
|
27
|
-
egress?: RoomEgress;
|
|
28
|
-
/**
|
|
29
|
-
* override the node room is allocated to, for debugging
|
|
30
|
-
* does not work with Cloud
|
|
31
|
-
*/
|
|
32
|
-
nodeId?: string;
|
|
33
|
-
}
|
|
34
|
-
export declare type SendDataOptions = {
|
|
35
|
-
destinationSids?: string[];
|
|
36
|
-
topic?: string;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Client to access Room APIs
|
|
40
|
-
*/
|
|
41
|
-
export declare class RoomServiceClient extends ServiceBase {
|
|
42
|
-
private readonly rpc;
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
* @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
|
|
46
|
-
* @param apiKey API Key, can be set in env var LIVEKIT_API_KEY
|
|
47
|
-
* @param secret API Secret, can be set in env var LIVEKIT_API_SECRET
|
|
48
|
-
*/
|
|
49
|
-
constructor(host: string, apiKey?: string, secret?: string);
|
|
50
|
-
/**
|
|
51
|
-
* Creates a new room. Explicit room creation is not required, since rooms will
|
|
52
|
-
* be automatically created when the first participant joins. This method can be
|
|
53
|
-
* used to customize room settings.
|
|
54
|
-
* @param options
|
|
55
|
-
*/
|
|
56
|
-
createRoom(options: CreateOptions): Promise<Room>;
|
|
57
|
-
/**
|
|
58
|
-
* List active rooms
|
|
59
|
-
* @param names when undefined or empty, list all rooms.
|
|
60
|
-
* otherwise returns rooms with matching names
|
|
61
|
-
* @returns
|
|
62
|
-
*/
|
|
63
|
-
listRooms(names?: string[]): Promise<Room[]>;
|
|
64
|
-
deleteRoom(room: string): Promise<void>;
|
|
65
|
-
/**
|
|
66
|
-
* Update metadata of a room
|
|
67
|
-
* @param room name of the room
|
|
68
|
-
* @param metadata the new metadata for the room
|
|
69
|
-
*/
|
|
70
|
-
updateRoomMetadata(room: string, metadata: string): Promise<Room>;
|
|
71
|
-
/**
|
|
72
|
-
* List participants in a room
|
|
73
|
-
* @param room name of the room
|
|
74
|
-
*/
|
|
75
|
-
listParticipants(room: string): Promise<ParticipantInfo[]>;
|
|
76
|
-
/**
|
|
77
|
-
* Get information on a specific participant, including the tracks that participant
|
|
78
|
-
* has published
|
|
79
|
-
* @param room name of the room
|
|
80
|
-
* @param identity identity of the participant to return
|
|
81
|
-
*/
|
|
82
|
-
getParticipant(room: string, identity: string): Promise<ParticipantInfo>;
|
|
83
|
-
/**
|
|
84
|
-
* Removes a participant in the room. This will disconnect the participant
|
|
85
|
-
* and will emit a Disconnected event for that participant.
|
|
86
|
-
* Even after being removed, the participant can still re-join the room.
|
|
87
|
-
* @param room
|
|
88
|
-
* @param identity
|
|
89
|
-
*/
|
|
90
|
-
removeParticipant(room: string, identity: string): Promise<void>;
|
|
91
|
-
/**
|
|
92
|
-
* Mutes a track that the participant has published.
|
|
93
|
-
* @param room
|
|
94
|
-
* @param identity
|
|
95
|
-
* @param trackSid sid of the track to be muted
|
|
96
|
-
* @param muted true to mute, false to unmute
|
|
97
|
-
*/
|
|
98
|
-
mutePublishedTrack(room: string, identity: string, trackSid: string, muted: boolean): Promise<TrackInfo>;
|
|
99
|
-
/**
|
|
100
|
-
* Updates a participant's metadata or permissions
|
|
101
|
-
* @param room
|
|
102
|
-
* @param identity
|
|
103
|
-
* @param metadata optional, metadata to update
|
|
104
|
-
* @param permission optional, new permissions to assign to participant
|
|
105
|
-
* @param name optional, new name for participant
|
|
106
|
-
*/
|
|
107
|
-
updateParticipant(room: string, identity: string, metadata?: string, permission?: ParticipantPermission, name?: string): Promise<ParticipantInfo>;
|
|
108
|
-
/**
|
|
109
|
-
* Updates a participant's subscription to tracks
|
|
110
|
-
* @param room
|
|
111
|
-
* @param identity
|
|
112
|
-
* @param trackSids
|
|
113
|
-
* @param subscribe true to subscribe, false to unsubscribe
|
|
114
|
-
*/
|
|
115
|
-
updateSubscriptions(room: string, identity: string, trackSids: string[], subscribe: boolean): Promise<void>;
|
|
116
|
-
/**
|
|
117
|
-
* Sends data message to participants in the room
|
|
118
|
-
* @param room
|
|
119
|
-
* @param data opaque payload to send
|
|
120
|
-
* @param kind delivery reliability
|
|
121
|
-
* @param options optionally specify a topic and destinationSids (when destinationSids is empty, message is sent to everyone)
|
|
122
|
-
*/
|
|
123
|
-
sendData(room: string, data: Uint8Array, kind: DataPacket_Kind, options: SendDataOptions): Promise<void>;
|
|
124
|
-
/**
|
|
125
|
-
* Sends data message to participants in the room
|
|
126
|
-
* @param room
|
|
127
|
-
* @param data opaque payload to send
|
|
128
|
-
* @param kind delivery reliability
|
|
129
|
-
* @param destinationSids optional. when empty, message is sent to everyone
|
|
130
|
-
*/
|
|
131
|
-
sendData(room: string, data: Uint8Array, kind: DataPacket_Kind, destinationSids?: string[]): Promise<void>;
|
|
132
|
-
}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.RoomServiceClient = void 0;
|
|
16
|
-
const livekit_models_1 = require("./proto/livekit_models");
|
|
17
|
-
const livekit_room_1 = require("./proto/livekit_room");
|
|
18
|
-
const ServiceBase_1 = __importDefault(require("./ServiceBase"));
|
|
19
|
-
const TwirpRPC_1 = require("./TwirpRPC");
|
|
20
|
-
const svc = 'RoomService';
|
|
21
|
-
/**
|
|
22
|
-
* Client to access Room APIs
|
|
23
|
-
*/
|
|
24
|
-
class RoomServiceClient extends ServiceBase_1.default {
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
|
|
28
|
-
* @param apiKey API Key, can be set in env var LIVEKIT_API_KEY
|
|
29
|
-
* @param secret API Secret, can be set in env var LIVEKIT_API_SECRET
|
|
30
|
-
*/
|
|
31
|
-
constructor(host, apiKey, secret) {
|
|
32
|
-
super(apiKey, secret);
|
|
33
|
-
this.rpc = new TwirpRPC_1.TwirpRpc(host, TwirpRPC_1.livekitPackage);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Creates a new room. Explicit room creation is not required, since rooms will
|
|
37
|
-
* be automatically created when the first participant joins. This method can be
|
|
38
|
-
* used to customize room settings.
|
|
39
|
-
* @param options
|
|
40
|
-
*/
|
|
41
|
-
createRoom(options) {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
const data = yield this.rpc.request(svc, 'CreateRoom', livekit_room_1.CreateRoomRequest.toJSON(livekit_room_1.CreateRoomRequest.fromPartial(options)), this.authHeader({ roomCreate: true }));
|
|
44
|
-
return livekit_models_1.Room.fromJSON(data);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* List active rooms
|
|
49
|
-
* @param names when undefined or empty, list all rooms.
|
|
50
|
-
* otherwise returns rooms with matching names
|
|
51
|
-
* @returns
|
|
52
|
-
*/
|
|
53
|
-
listRooms(names) {
|
|
54
|
-
var _a;
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
const data = yield this.rpc.request(svc, 'ListRooms', livekit_room_1.ListRoomsRequest.toJSON({ names: names !== null && names !== void 0 ? names : [] }), this.authHeader({ roomList: true }));
|
|
57
|
-
const res = livekit_room_1.ListRoomsResponse.fromJSON(data);
|
|
58
|
-
return (_a = res.rooms) !== null && _a !== void 0 ? _a : [];
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
deleteRoom(room) {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
yield this.rpc.request(svc, 'DeleteRoom', livekit_room_1.DeleteRoomRequest.toJSON({ room }), this.authHeader({ roomCreate: true }));
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Update metadata of a room
|
|
68
|
-
* @param room name of the room
|
|
69
|
-
* @param metadata the new metadata for the room
|
|
70
|
-
*/
|
|
71
|
-
updateRoomMetadata(room, metadata) {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
const data = yield this.rpc.request(svc, 'UpdateRoomMetadata', livekit_room_1.UpdateRoomMetadataRequest.toJSON({ room, metadata }), this.authHeader({ roomAdmin: true, room }));
|
|
74
|
-
return livekit_models_1.Room.fromJSON(data);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* List participants in a room
|
|
79
|
-
* @param room name of the room
|
|
80
|
-
*/
|
|
81
|
-
listParticipants(room) {
|
|
82
|
-
var _a;
|
|
83
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
const data = yield this.rpc.request(svc, 'ListParticipants', livekit_room_1.ListParticipantsRequest.toJSON({ room }), this.authHeader({ roomAdmin: true, room }));
|
|
85
|
-
const res = livekit_room_1.ListParticipantsResponse.fromJSON(data);
|
|
86
|
-
return (_a = res.participants) !== null && _a !== void 0 ? _a : [];
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Get information on a specific participant, including the tracks that participant
|
|
91
|
-
* has published
|
|
92
|
-
* @param room name of the room
|
|
93
|
-
* @param identity identity of the participant to return
|
|
94
|
-
*/
|
|
95
|
-
getParticipant(room, identity) {
|
|
96
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
const data = yield this.rpc.request(svc, 'GetParticipant', livekit_room_1.RoomParticipantIdentity.toJSON({ room, identity }), this.authHeader({ roomAdmin: true, room }));
|
|
98
|
-
return livekit_models_1.ParticipantInfo.fromJSON(data);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Removes a participant in the room. This will disconnect the participant
|
|
103
|
-
* and will emit a Disconnected event for that participant.
|
|
104
|
-
* Even after being removed, the participant can still re-join the room.
|
|
105
|
-
* @param room
|
|
106
|
-
* @param identity
|
|
107
|
-
*/
|
|
108
|
-
removeParticipant(room, identity) {
|
|
109
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
yield this.rpc.request(svc, 'RemoveParticipant', livekit_room_1.RoomParticipantIdentity.toJSON({ room, identity }), this.authHeader({ roomAdmin: true, room }));
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Mutes a track that the participant has published.
|
|
115
|
-
* @param room
|
|
116
|
-
* @param identity
|
|
117
|
-
* @param trackSid sid of the track to be muted
|
|
118
|
-
* @param muted true to mute, false to unmute
|
|
119
|
-
*/
|
|
120
|
-
mutePublishedTrack(room, identity, trackSid, muted) {
|
|
121
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
const req = livekit_room_1.MuteRoomTrackRequest.toJSON({
|
|
123
|
-
room,
|
|
124
|
-
identity,
|
|
125
|
-
trackSid,
|
|
126
|
-
muted,
|
|
127
|
-
});
|
|
128
|
-
const data = yield this.rpc.request(svc, 'MutePublishedTrack', req, this.authHeader({ roomAdmin: true, room }));
|
|
129
|
-
const res = livekit_room_1.MuteRoomTrackResponse.fromJSON(data);
|
|
130
|
-
return res.track;
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Updates a participant's metadata or permissions
|
|
135
|
-
* @param room
|
|
136
|
-
* @param identity
|
|
137
|
-
* @param metadata optional, metadata to update
|
|
138
|
-
* @param permission optional, new permissions to assign to participant
|
|
139
|
-
* @param name optional, new name for participant
|
|
140
|
-
*/
|
|
141
|
-
updateParticipant(room, identity, metadata, permission, name) {
|
|
142
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
-
const req = {
|
|
144
|
-
room,
|
|
145
|
-
identity,
|
|
146
|
-
metadata: metadata || '',
|
|
147
|
-
permission,
|
|
148
|
-
name: name || '',
|
|
149
|
-
};
|
|
150
|
-
const data = yield this.rpc.request(svc, 'UpdateParticipant', livekit_room_1.UpdateParticipantRequest.toJSON(req), this.authHeader({ roomAdmin: true, room }));
|
|
151
|
-
return livekit_models_1.ParticipantInfo.fromJSON(data);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Updates a participant's subscription to tracks
|
|
156
|
-
* @param room
|
|
157
|
-
* @param identity
|
|
158
|
-
* @param trackSids
|
|
159
|
-
* @param subscribe true to subscribe, false to unsubscribe
|
|
160
|
-
*/
|
|
161
|
-
updateSubscriptions(room, identity, trackSids, subscribe) {
|
|
162
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
-
const req = livekit_room_1.UpdateSubscriptionsRequest.toJSON({
|
|
164
|
-
room,
|
|
165
|
-
identity,
|
|
166
|
-
trackSids,
|
|
167
|
-
subscribe,
|
|
168
|
-
participantTracks: [],
|
|
169
|
-
});
|
|
170
|
-
yield this.rpc.request(svc, 'UpdateSubscriptions', req, this.authHeader({ roomAdmin: true, room }));
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
sendData(room, data, kind, options = {}) {
|
|
174
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
-
const destinationSids = Array.isArray(options) ? options : options.destinationSids;
|
|
176
|
-
const topic = Array.isArray(options) ? undefined : options.topic;
|
|
177
|
-
const req = livekit_room_1.SendDataRequest.toJSON({
|
|
178
|
-
room,
|
|
179
|
-
data,
|
|
180
|
-
kind,
|
|
181
|
-
destinationSids: destinationSids !== null && destinationSids !== void 0 ? destinationSids : [],
|
|
182
|
-
topic,
|
|
183
|
-
});
|
|
184
|
-
yield this.rpc.request(svc, 'SendData', req, this.authHeader({ roomAdmin: true, room }));
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
exports.RoomServiceClient = RoomServiceClient;
|
|
189
|
-
//# sourceMappingURL=RoomServiceClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RoomServiceClient.js","sourceRoot":"","sources":["../src/RoomServiceClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAA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EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC3F,CAAC;KAAA;CACF;AA1PD,8CA0PC"}
|
package/dist/ServiceBase.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { VideoGrant } from './grants';
|
|
2
|
-
/**
|
|
3
|
-
* Utilities to handle authentication
|
|
4
|
-
*/
|
|
5
|
-
export default class ServiceBase {
|
|
6
|
-
private readonly apiKey?;
|
|
7
|
-
private readonly secret?;
|
|
8
|
-
private readonly ttl;
|
|
9
|
-
/**
|
|
10
|
-
* @param apiKey API Key.
|
|
11
|
-
* @param secret API Secret.
|
|
12
|
-
* @param ttl token TTL
|
|
13
|
-
*/
|
|
14
|
-
constructor(apiKey?: string, secret?: string, ttl?: string);
|
|
15
|
-
authHeader(grant: VideoGrant): any;
|
|
16
|
-
}
|
package/dist/ServiceBase.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const AccessToken_1 = require("./AccessToken");
|
|
4
|
-
/**
|
|
5
|
-
* Utilities to handle authentication
|
|
6
|
-
*/
|
|
7
|
-
class ServiceBase {
|
|
8
|
-
/**
|
|
9
|
-
* @param apiKey API Key.
|
|
10
|
-
* @param secret API Secret.
|
|
11
|
-
* @param ttl token TTL
|
|
12
|
-
*/
|
|
13
|
-
constructor(apiKey, secret, ttl) {
|
|
14
|
-
this.apiKey = apiKey;
|
|
15
|
-
this.secret = secret;
|
|
16
|
-
this.ttl = ttl || '10m';
|
|
17
|
-
}
|
|
18
|
-
authHeader(grant) {
|
|
19
|
-
const at = new AccessToken_1.AccessToken(this.apiKey, this.secret, { ttl: this.ttl });
|
|
20
|
-
at.addGrant(grant);
|
|
21
|
-
return {
|
|
22
|
-
Authorization: `Bearer ${at.toJwt()}`,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.default = ServiceBase;
|
|
27
|
-
//# sourceMappingURL=ServiceBase.js.map
|
package/dist/ServiceBase.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceBase.js","sourceRoot":"","sources":["../src/ServiceBase.ts"],"names":[],"mappings":";;AAAA,+CAA4C;AAG5C;;GAEG;AACH,MAAqB,WAAW;IAO9B;;;;OAIG;IACH,YAAY,MAAe,EAAE,MAAe,EAAE,GAAY;QACxD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,KAAK,CAAC;IAC1B,CAAC;IAED,UAAU,CAAC,KAAiB;QAC1B,MAAM,EAAE,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACxE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO;YACL,aAAa,EAAE,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE;SACtC,CAAC;IACJ,CAAC;CACF;AAzBD,8BAyBC"}
|
package/dist/TwirpRPC.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
export declare const livekitPackage = "livekit";
|
|
3
|
-
export interface Rpc {
|
|
4
|
-
request(service: string, method: string, data: any, headers?: any): Promise<string>;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* JSON based Twirp V7 RPC
|
|
8
|
-
*/
|
|
9
|
-
export declare class TwirpRpc {
|
|
10
|
-
host: string;
|
|
11
|
-
pkg: string;
|
|
12
|
-
prefix: string;
|
|
13
|
-
instance: AxiosInstance;
|
|
14
|
-
constructor(host: string, pkg: string, prefix?: string);
|
|
15
|
-
request(service: string, method: string, data: any, headers?: any): Promise<any>;
|
|
16
|
-
}
|
package/dist/TwirpRPC.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TwirpRpc = exports.livekitPackage = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const camelcase_keys_1 = __importDefault(require("camelcase-keys"));
|
|
9
|
-
// twirp RPC adapter for client implementation
|
|
10
|
-
const defaultPrefix = '/twirp';
|
|
11
|
-
exports.livekitPackage = 'livekit';
|
|
12
|
-
/**
|
|
13
|
-
* JSON based Twirp V7 RPC
|
|
14
|
-
*/
|
|
15
|
-
class TwirpRpc {
|
|
16
|
-
constructor(host, pkg, prefix) {
|
|
17
|
-
this.host = host;
|
|
18
|
-
this.pkg = pkg;
|
|
19
|
-
this.prefix = prefix || defaultPrefix;
|
|
20
|
-
this.instance = axios_1.default.create({
|
|
21
|
-
baseURL: host,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
request(service, method, data, headers) {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
const path = `${this.prefix}/${this.pkg}.${service}/${method}`;
|
|
27
|
-
this.instance
|
|
28
|
-
.post(path, data, { headers })
|
|
29
|
-
.then((res) => {
|
|
30
|
-
resolve(camelcase_keys_1.default(res.data, { deep: true }));
|
|
31
|
-
})
|
|
32
|
-
.catch(reject);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.TwirpRpc = TwirpRpc;
|
|
37
|
-
//# sourceMappingURL=TwirpRPC.js.map
|
package/dist/TwirpRPC.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TwirpRPC.js","sourceRoot":"","sources":["../src/TwirpRPC.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA6C;AAC7C,oEAA2C;AAE3C,8CAA8C;AAE9C,MAAM,aAAa,GAAG,QAAQ,CAAC;AAElB,QAAA,cAAc,GAAG,SAAS,CAAC;AAKxC;;GAEG;AACH,MAAa,QAAQ;IASnB,YAAY,IAAY,EAAE,GAAW,EAAE,MAAe;QACpD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,aAAa,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,eAAK,CAAC,MAAM,CAAC;YAC3B,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,OAAe,EAAE,MAAc,EAAE,IAAS,EAAE,OAAa;QAC/D,OAAO,IAAI,OAAO,CAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC1C,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,GAAG,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;YAC/D,IAAI,CAAC,QAAQ;iBACV,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC;iBAC7B,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;gBACZ,OAAO,CAAC,wBAAa,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YACnD,CAAC,CAAC;iBACD,KAAK,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA7BD,4BA6BC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { WebhookEvent } from './proto/livekit_webhook';
|
|
2
|
-
export declare const authorizeHeader = "Authorize";
|
|
3
|
-
export declare class WebhookReceiver {
|
|
4
|
-
private verifier;
|
|
5
|
-
constructor(apiKey: string, apiSecret: string);
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* @param body string of the posted body
|
|
9
|
-
* @param authHeader `Authorization` header from the request
|
|
10
|
-
* @param skipAuth true to skip auth validation
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
receive(body: string, authHeader?: string, skipAuth?: boolean): WebhookEvent;
|
|
14
|
-
}
|