livekit-server-sdk 1.0.3 → 1.1.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.
- package/dist/EgressClient.d.ts +22 -4
- package/dist/EgressClient.js +32 -12
- package/dist/EgressClient.js.map +1 -1
- package/dist/IngressClient.d.ts +84 -0
- package/dist/IngressClient.js +113 -0
- package/dist/IngressClient.js.map +1 -0
- package/dist/RoomServiceClient.d.ts +2 -4
- package/dist/RoomServiceClient.js +10 -13
- package/dist/RoomServiceClient.js.map +1 -1
- package/dist/ServiceBase.d.ts +16 -0
- package/dist/ServiceBase.js +27 -0
- package/dist/ServiceBase.js.map +1 -0
- package/dist/grants.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/proto/google/protobuf/timestamp.d.ts +5 -5
- package/dist/proto/google/protobuf/timestamp.js +17 -32
- package/dist/proto/google/protobuf/timestamp.js.map +1 -1
- package/dist/proto/livekit_egress.d.ts +3317 -653
- package/dist/proto/livekit_egress.js +842 -507
- package/dist/proto/livekit_egress.js.map +1 -1
- package/dist/proto/livekit_ingress.d.ts +152 -110
- package/dist/proto/livekit_ingress.js +218 -272
- package/dist/proto/livekit_ingress.js.map +1 -1
- package/dist/proto/livekit_models.d.ts +77 -58
- package/dist/proto/livekit_models.js +396 -447
- package/dist/proto/livekit_models.js.map +1 -1
- package/dist/proto/livekit_room.d.ts +456 -115
- package/dist/proto/livekit_room.js +188 -223
- package/dist/proto/livekit_room.js.map +1 -1
- package/dist/proto/livekit_webhook.d.ts +986 -85
- package/dist/proto/livekit_webhook.js +43 -68
- package/dist/proto/livekit_webhook.js.map +1 -1
- package/generate-proto.sh +25 -0
- package/package.json +3 -3
- package/dist/proto/google/protobuf/empty.d.ts +0 -31
- package/dist/proto/google/protobuf/empty.js +0 -67
- package/dist/proto/google/protobuf/empty.js.map +0 -1
package/dist/EgressClient.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DirectFileOutput, EgressInfo, EncodedFileOutput, EncodingOptions, EncodingOptionsPreset, SegmentedFileOutput, StreamOutput } from './proto/livekit_egress';
|
|
2
|
+
import ServiceBase from './ServiceBase';
|
|
2
3
|
export interface RoomCompositeOptions {
|
|
3
4
|
/**
|
|
4
5
|
* egress layout. optional
|
|
@@ -21,6 +22,20 @@ export interface RoomCompositeOptions {
|
|
|
21
22
|
*/
|
|
22
23
|
customBaseUrl?: string;
|
|
23
24
|
}
|
|
25
|
+
export interface WebOptions {
|
|
26
|
+
/**
|
|
27
|
+
* encoding options or preset. optional
|
|
28
|
+
*/
|
|
29
|
+
encodingOptions?: EncodingOptionsPreset | EncodingOptions;
|
|
30
|
+
/**
|
|
31
|
+
* record audio only. optional
|
|
32
|
+
*/
|
|
33
|
+
audioOnly?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* record video only. optional
|
|
36
|
+
*/
|
|
37
|
+
videoOnly?: boolean;
|
|
38
|
+
}
|
|
24
39
|
export interface TrackCompositeOptions {
|
|
25
40
|
/**
|
|
26
41
|
* audio track ID
|
|
@@ -38,10 +53,8 @@ export interface TrackCompositeOptions {
|
|
|
38
53
|
/**
|
|
39
54
|
* Client to access Egress APIs
|
|
40
55
|
*/
|
|
41
|
-
export declare class EgressClient {
|
|
56
|
+
export declare class EgressClient extends ServiceBase {
|
|
42
57
|
private readonly rpc;
|
|
43
|
-
private readonly apiKey?;
|
|
44
|
-
private readonly secret?;
|
|
45
58
|
/**
|
|
46
59
|
* @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
|
|
47
60
|
* @param apiKey API Key, can be set in env var LIVEKIT_API_KEY
|
|
@@ -58,6 +71,12 @@ export declare class EgressClient {
|
|
|
58
71
|
* @deprecated use RoomCompositeOptions instead
|
|
59
72
|
*/
|
|
60
73
|
startRoomCompositeEgress(roomName: string, output: EncodedFileOutput | SegmentedFileOutput | StreamOutput, layout?: string, options?: EncodingOptionsPreset | EncodingOptions, audioOnly?: boolean, videoOnly?: boolean, customBaseUrl?: string): Promise<EgressInfo>;
|
|
74
|
+
/**
|
|
75
|
+
* @param url url
|
|
76
|
+
* @param output file or stream output
|
|
77
|
+
* @param opts WebOptions
|
|
78
|
+
*/
|
|
79
|
+
startWebEgress(url: string, output: EncodedFileOutput | SegmentedFileOutput | StreamOutput, opts?: WebOptions): Promise<EgressInfo>;
|
|
61
80
|
/**
|
|
62
81
|
* @param roomName room name
|
|
63
82
|
* @param output file or stream output
|
|
@@ -94,5 +113,4 @@ export declare class EgressClient {
|
|
|
94
113
|
* @param egressId
|
|
95
114
|
*/
|
|
96
115
|
stopEgress(egressId: string): Promise<EgressInfo>;
|
|
97
|
-
private authHeader;
|
|
98
116
|
}
|
package/dist/EgressClient.js
CHANGED
|
@@ -8,25 +8,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.EgressClient = void 0;
|
|
13
|
-
const AccessToken_1 = require("./AccessToken");
|
|
14
16
|
const livekit_egress_1 = require("./proto/livekit_egress");
|
|
17
|
+
const ServiceBase_1 = __importDefault(require("./ServiceBase"));
|
|
15
18
|
const TwirpRPC_1 = require("./TwirpRPC");
|
|
16
19
|
const svc = 'Egress';
|
|
17
20
|
/**
|
|
18
21
|
* Client to access Egress APIs
|
|
19
22
|
*/
|
|
20
|
-
class EgressClient {
|
|
23
|
+
class EgressClient extends ServiceBase_1.default {
|
|
21
24
|
/**
|
|
22
25
|
* @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
|
|
23
26
|
* @param apiKey API Key, can be set in env var LIVEKIT_API_KEY
|
|
24
27
|
* @param secret API Secret, can be set in env var LIVEKIT_API_SECRET
|
|
25
28
|
*/
|
|
26
29
|
constructor(host, apiKey, secret) {
|
|
30
|
+
super(apiKey, secret);
|
|
27
31
|
this.rpc = new TwirpRPC_1.TwirpRpc(host, TwirpRPC_1.livekitPackage);
|
|
28
|
-
this.apiKey = apiKey;
|
|
29
|
-
this.secret = secret;
|
|
30
32
|
}
|
|
31
33
|
startRoomCompositeEgress(roomName, output, optsOrLayout, options, audioOnly, videoOnly, customBaseUrl) {
|
|
32
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -65,6 +67,30 @@ class EgressClient {
|
|
|
65
67
|
return livekit_egress_1.EgressInfo.fromJSON(data);
|
|
66
68
|
});
|
|
67
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* @param url url
|
|
72
|
+
* @param output file or stream output
|
|
73
|
+
* @param opts WebOptions
|
|
74
|
+
*/
|
|
75
|
+
startWebEgress(url, output, opts) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const audioOnly = (opts === null || opts === void 0 ? void 0 : opts.audioOnly) || false;
|
|
78
|
+
const videoOnly = (opts === null || opts === void 0 ? void 0 : opts.videoOnly) || false;
|
|
79
|
+
const { file, segments, stream, preset, advanced } = this.getOutputParams(output, opts === null || opts === void 0 ? void 0 : opts.encodingOptions);
|
|
80
|
+
const req = livekit_egress_1.WebEgressRequest.toJSON({
|
|
81
|
+
url,
|
|
82
|
+
audioOnly,
|
|
83
|
+
videoOnly,
|
|
84
|
+
file,
|
|
85
|
+
stream,
|
|
86
|
+
segments,
|
|
87
|
+
preset,
|
|
88
|
+
advanced,
|
|
89
|
+
});
|
|
90
|
+
const data = yield this.rpc.request(svc, 'StartWebEgress', req, this.authHeader({ roomRecord: true }));
|
|
91
|
+
return livekit_egress_1.EgressInfo.fromJSON(data);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
68
94
|
startTrackCompositeEgress(roomName, output, optsOrAudioTrackId, videoTrackId, options) {
|
|
69
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
96
|
let audioTrackId;
|
|
@@ -173,10 +199,11 @@ class EgressClient {
|
|
|
173
199
|
* @param roomName list egress for one room only
|
|
174
200
|
*/
|
|
175
201
|
listEgress(roomName) {
|
|
202
|
+
var _a;
|
|
176
203
|
return __awaiter(this, void 0, void 0, function* () {
|
|
177
204
|
roomName !== null && roomName !== void 0 ? roomName : (roomName = '');
|
|
178
205
|
const data = yield this.rpc.request(svc, 'ListEgress', livekit_egress_1.ListEgressRequest.toJSON({ roomName }), this.authHeader({ roomRecord: true }));
|
|
179
|
-
return livekit_egress_1.ListEgressResponse.fromJSON(data).items;
|
|
206
|
+
return (_a = livekit_egress_1.ListEgressResponse.fromJSON(data).items) !== null && _a !== void 0 ? _a : [];
|
|
180
207
|
});
|
|
181
208
|
}
|
|
182
209
|
/**
|
|
@@ -188,13 +215,6 @@ class EgressClient {
|
|
|
188
215
|
return livekit_egress_1.EgressInfo.fromJSON(data);
|
|
189
216
|
});
|
|
190
217
|
}
|
|
191
|
-
authHeader(grant) {
|
|
192
|
-
const at = new AccessToken_1.AccessToken(this.apiKey, this.secret, { ttl: '10m' });
|
|
193
|
-
at.addGrant(grant);
|
|
194
|
-
return {
|
|
195
|
-
Authorization: `Bearer ${at.toJwt()}`,
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
218
|
}
|
|
199
219
|
exports.EgressClient = EgressClient;
|
|
200
220
|
//# sourceMappingURL=EgressClient.js.map
|
package/dist/EgressClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EgressClient.js","sourceRoot":"","sources":["../src/EgressClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EgressClient.js","sourceRoot":"","sources":["../src/EgressClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2DAiBgC;AAChC,gEAAwC;AACxC,yCAA2D;AAE3D,MAAM,GAAG,GAAG,QAAQ,CAAC;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mCAAI,EAAE,CAAC;;KACtD;IAED;;OAEG;IACG,UAAU,CAAC,QAAgB;;YAC/B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CACjC,GAAG,EACH,YAAY,EACZ,kCAAiB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,EACtC,IAAI,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CACtC,CAAC;YACF,OAAO,2BAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;KAAA;CACF;AAxTD,oCAwTC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
audioParams?: IngressAudioOptions;
|
|
24
|
+
/**
|
|
25
|
+
* custom video encoding parameters. optional
|
|
26
|
+
*/
|
|
27
|
+
videoParams?: 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
|
+
audioParams?: IngressAudioOptions;
|
|
50
|
+
/**
|
|
51
|
+
* custom video encoding parameters. optional
|
|
52
|
+
*/
|
|
53
|
+
videoParams?: 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
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
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.audioParams;
|
|
51
|
+
video = opts.videoParams;
|
|
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 = opts.audioParams;
|
|
77
|
+
const video = opts.videoParams;
|
|
78
|
+
const req = livekit_ingress_1.UpdateIngressRequest.toJSON({
|
|
79
|
+
ingressId,
|
|
80
|
+
name,
|
|
81
|
+
roomName,
|
|
82
|
+
participantIdentity,
|
|
83
|
+
participantName,
|
|
84
|
+
audio,
|
|
85
|
+
video,
|
|
86
|
+
});
|
|
87
|
+
const data = yield this.rpc.request(svc, 'UpdateIngress', req, this.authHeader({ ingressAdmin: true }));
|
|
88
|
+
return livekit_ingress_1.IngressInfo.fromJSON(data);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @param roomName list ingress for one room only
|
|
93
|
+
*/
|
|
94
|
+
listIngress(roomName) {
|
|
95
|
+
var _a;
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
roomName !== null && roomName !== void 0 ? roomName : (roomName = '');
|
|
98
|
+
const data = yield this.rpc.request(svc, 'ListIngress', livekit_ingress_1.ListIngressRequest.toJSON({ roomName }), this.authHeader({ ingressAdmin: true }));
|
|
99
|
+
return (_a = livekit_ingress_1.ListIngressResponse.fromJSON(data).items) !== null && _a !== void 0 ? _a : [];
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @param ingressId ingress to delete
|
|
104
|
+
*/
|
|
105
|
+
deleteIngress(ingressId) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
const data = yield this.rpc.request(svc, 'DeleteIngress', livekit_ingress_1.DeleteIngressRequest.toJSON({ ingressId }), this.authHeader({ ingressAdmin: true }));
|
|
108
|
+
return livekit_ingress_1.IngressInfo.fromJSON(data);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.IngressClient = IngressClient;
|
|
113
|
+
//# sourceMappingURL=IngressClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,MA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KACvD;IAED;;OAEG;IACG,aAAa,CAAC,SAAiB;;YACnC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CACjC,GAAG,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;AA/GD,sCA+GC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DataPacket_Kind, ParticipantInfo, ParticipantPermission, Room, TrackInfo } from './proto/livekit_models';
|
|
2
2
|
import { RoomEgress } from './proto/livekit_room';
|
|
3
|
+
import ServiceBase from './ServiceBase';
|
|
3
4
|
/**
|
|
4
5
|
* Options for when creating a room
|
|
5
6
|
*/
|
|
@@ -28,10 +29,8 @@ export interface CreateOptions {
|
|
|
28
29
|
/**
|
|
29
30
|
* Client to access Room APIs
|
|
30
31
|
*/
|
|
31
|
-
export declare class RoomServiceClient {
|
|
32
|
+
export declare class RoomServiceClient extends ServiceBase {
|
|
32
33
|
private readonly rpc;
|
|
33
|
-
private readonly apiKey?;
|
|
34
|
-
private readonly secret?;
|
|
35
34
|
/**
|
|
36
35
|
*
|
|
37
36
|
* @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
|
|
@@ -113,5 +112,4 @@ export declare class RoomServiceClient {
|
|
|
113
112
|
* @param destinationSids optional. when empty, message is sent to everyone
|
|
114
113
|
*/
|
|
115
114
|
sendData(room: string, data: Uint8Array, kind: DataPacket_Kind, destinationSids?: string[]): Promise<void>;
|
|
116
|
-
private authHeader;
|
|
117
115
|
}
|
|
@@ -8,17 +8,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.RoomServiceClient = void 0;
|
|
13
|
-
const AccessToken_1 = require("./AccessToken");
|
|
14
16
|
const livekit_models_1 = require("./proto/livekit_models");
|
|
15
17
|
const livekit_room_1 = require("./proto/livekit_room");
|
|
18
|
+
const ServiceBase_1 = __importDefault(require("./ServiceBase"));
|
|
16
19
|
const TwirpRPC_1 = require("./TwirpRPC");
|
|
17
20
|
const svc = 'RoomService';
|
|
18
21
|
/**
|
|
19
22
|
* Client to access Room APIs
|
|
20
23
|
*/
|
|
21
|
-
class RoomServiceClient {
|
|
24
|
+
class RoomServiceClient extends ServiceBase_1.default {
|
|
22
25
|
/**
|
|
23
26
|
*
|
|
24
27
|
* @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
|
|
@@ -26,9 +29,8 @@ class RoomServiceClient {
|
|
|
26
29
|
* @param secret API Secret, can be set in env var LIVEKIT_API_SECRET
|
|
27
30
|
*/
|
|
28
31
|
constructor(host, apiKey, secret) {
|
|
32
|
+
super(apiKey, secret);
|
|
29
33
|
this.rpc = new TwirpRPC_1.TwirpRpc(host, TwirpRPC_1.livekitPackage);
|
|
30
|
-
this.apiKey = apiKey;
|
|
31
|
-
this.secret = secret;
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
34
36
|
* Creates a new room. Explicit room creation is not required, since rooms will
|
|
@@ -49,10 +51,11 @@ class RoomServiceClient {
|
|
|
49
51
|
* @returns
|
|
50
52
|
*/
|
|
51
53
|
listRooms(names) {
|
|
54
|
+
var _a;
|
|
52
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
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 }));
|
|
54
57
|
const res = livekit_room_1.ListRoomsResponse.fromJSON(data);
|
|
55
|
-
return res.rooms;
|
|
58
|
+
return (_a = res.rooms) !== null && _a !== void 0 ? _a : [];
|
|
56
59
|
});
|
|
57
60
|
}
|
|
58
61
|
deleteRoom(room) {
|
|
@@ -76,10 +79,11 @@ class RoomServiceClient {
|
|
|
76
79
|
* @param room name of the room
|
|
77
80
|
*/
|
|
78
81
|
listParticipants(room) {
|
|
82
|
+
var _a;
|
|
79
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
84
|
const data = yield this.rpc.request(svc, 'ListParticipants', livekit_room_1.ListParticipantsRequest.toJSON({ room }), this.authHeader({ roomAdmin: true, room }));
|
|
81
85
|
const res = livekit_room_1.ListParticipantsResponse.fromJSON(data);
|
|
82
|
-
return res.participants;
|
|
86
|
+
return (_a = res.participants) !== null && _a !== void 0 ? _a : [];
|
|
83
87
|
});
|
|
84
88
|
}
|
|
85
89
|
/**
|
|
@@ -184,13 +188,6 @@ class RoomServiceClient {
|
|
|
184
188
|
yield this.rpc.request(svc, 'SendData', req, this.authHeader({ roomAdmin: true, room }));
|
|
185
189
|
});
|
|
186
190
|
}
|
|
187
|
-
authHeader(grant) {
|
|
188
|
-
const at = new AccessToken_1.AccessToken(this.apiKey, this.secret, { ttl: '10m' });
|
|
189
|
-
at.addGrant(grant);
|
|
190
|
-
return {
|
|
191
|
-
Authorization: `Bearer ${at.toJwt()}`,
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
191
|
}
|
|
195
192
|
exports.RoomServiceClient = RoomServiceClient;
|
|
196
193
|
//# sourceMappingURL=RoomServiceClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RoomServiceClient.js","sourceRoot":"","sources":["../src/RoomServiceClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RoomServiceClient.js","sourceRoot":"","sources":["../src/RoomServiceClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;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,uCAAwB,CAAC,MAAM,CAAC,GAAG,CAAC,EACpC,IAAI,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAC3C,CAAC;YACF,OAAO,gCAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACxC,CAAC;KAAA;IAED;;;;;;OAMG;IACG,mBAAmB,CACvB,IAAY,EACZ,QAAgB,EAChB,SAAmB,EACnB,SAAkB;;YAElB,MAAM,GAAG,GAAG,yCAA0B,CAAC,MAAM,CAAC;gBAC5C,IAAI;gBACJ,QAAQ;gBACR,SAAS;gBACT,SAAS;gBACT,iBAAiB,EAAE,EAAE;aACtB,CAAC,CAAC;YACH,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CACpB,GAAG,EACH,qBAAqB,EACrB,GAAG,EACH,IAAI,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAC3C,CAAC;QACJ,CAAC;KAAA;IAED;;;;;;OAMG;IACG,QAAQ,CACZ,IAAY,EACZ,IAAgB,EAChB,IAAqB,EACrB,kBAA4B,EAAE;;YAE9B,MAAM,GAAG,GAAG,8BAAe,CAAC,MAAM,CAAC;gBACjC,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,eAAe;aAChB,CAAC,CAAC;YACH,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC3F,CAAC;KAAA;CACF;AApOD,8CAoOC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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/grants.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface VideoGrant {
|
|
|
11
11
|
roomAdmin?: boolean;
|
|
12
12
|
/** name of the room, must be set for admin or join permissions */
|
|
13
13
|
room?: string;
|
|
14
|
+
/** permissions to control ingress, not specific to any room or ingress */
|
|
15
|
+
ingressAdmin?: boolean;
|
|
14
16
|
/**
|
|
15
17
|
* allow participant to publish. If neither canPublish or canSubscribe is set,
|
|
16
18
|
* both publish and subscribe are enabled
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './AccessToken';
|
|
2
2
|
export * from './EgressClient';
|
|
3
3
|
export * from './grants';
|
|
4
|
+
export * from './IngressClient';
|
|
4
5
|
export { DirectFileOutput, EgressInfo, EncodedFileOutput, EncodedFileType, EncodingOptions, EncodingOptionsPreset, SegmentedFileOutput, SegmentedFileProtocol, StreamOutput, StreamProtocol, } from './proto/livekit_egress';
|
|
6
|
+
export { IngressAudioOptions, IngressInfo, IngressInput, IngressState, IngressVideoOptions, } from './proto/livekit_ingress';
|
|
5
7
|
export { DataPacket_Kind, ParticipantInfo, ParticipantInfo_State, ParticipantPermission, Room, TrackInfo, TrackType, } from './proto/livekit_models';
|
|
6
8
|
export * from './RoomServiceClient';
|
|
7
9
|
export * from './WebhookReceiver';
|
package/dist/index.js
CHANGED
|
@@ -10,10 +10,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.TrackType = exports.TrackInfo = exports.Room = exports.ParticipantPermission = exports.ParticipantInfo_State = exports.ParticipantInfo = exports.DataPacket_Kind = exports.StreamProtocol = exports.StreamOutput = exports.SegmentedFileProtocol = exports.SegmentedFileOutput = exports.EncodingOptionsPreset = exports.EncodingOptions = exports.EncodedFileType = exports.EncodedFileOutput = exports.EgressInfo = exports.DirectFileOutput = void 0;
|
|
13
|
+
exports.TrackType = exports.TrackInfo = exports.Room = exports.ParticipantPermission = exports.ParticipantInfo_State = exports.ParticipantInfo = exports.DataPacket_Kind = exports.IngressVideoOptions = exports.IngressState = exports.IngressInput = exports.IngressInfo = exports.IngressAudioOptions = exports.StreamProtocol = exports.StreamOutput = exports.SegmentedFileProtocol = exports.SegmentedFileOutput = exports.EncodingOptionsPreset = exports.EncodingOptions = exports.EncodedFileType = exports.EncodedFileOutput = exports.EgressInfo = exports.DirectFileOutput = void 0;
|
|
14
14
|
__exportStar(require("./AccessToken"), exports);
|
|
15
15
|
__exportStar(require("./EgressClient"), exports);
|
|
16
16
|
__exportStar(require("./grants"), exports);
|
|
17
|
+
__exportStar(require("./IngressClient"), exports);
|
|
17
18
|
var livekit_egress_1 = require("./proto/livekit_egress");
|
|
18
19
|
Object.defineProperty(exports, "DirectFileOutput", { enumerable: true, get: function () { return livekit_egress_1.DirectFileOutput; } });
|
|
19
20
|
Object.defineProperty(exports, "EgressInfo", { enumerable: true, get: function () { return livekit_egress_1.EgressInfo; } });
|
|
@@ -25,6 +26,12 @@ Object.defineProperty(exports, "SegmentedFileOutput", { enumerable: true, get: f
|
|
|
25
26
|
Object.defineProperty(exports, "SegmentedFileProtocol", { enumerable: true, get: function () { return livekit_egress_1.SegmentedFileProtocol; } });
|
|
26
27
|
Object.defineProperty(exports, "StreamOutput", { enumerable: true, get: function () { return livekit_egress_1.StreamOutput; } });
|
|
27
28
|
Object.defineProperty(exports, "StreamProtocol", { enumerable: true, get: function () { return livekit_egress_1.StreamProtocol; } });
|
|
29
|
+
var livekit_ingress_1 = require("./proto/livekit_ingress");
|
|
30
|
+
Object.defineProperty(exports, "IngressAudioOptions", { enumerable: true, get: function () { return livekit_ingress_1.IngressAudioOptions; } });
|
|
31
|
+
Object.defineProperty(exports, "IngressInfo", { enumerable: true, get: function () { return livekit_ingress_1.IngressInfo; } });
|
|
32
|
+
Object.defineProperty(exports, "IngressInput", { enumerable: true, get: function () { return livekit_ingress_1.IngressInput; } });
|
|
33
|
+
Object.defineProperty(exports, "IngressState", { enumerable: true, get: function () { return livekit_ingress_1.IngressState; } });
|
|
34
|
+
Object.defineProperty(exports, "IngressVideoOptions", { enumerable: true, get: function () { return livekit_ingress_1.IngressVideoOptions; } });
|
|
28
35
|
var livekit_models_1 = require("./proto/livekit_models");
|
|
29
36
|
Object.defineProperty(exports, "DataPacket_Kind", { enumerable: true, get: function () { return livekit_models_1.DataPacket_Kind; } });
|
|
30
37
|
Object.defineProperty(exports, "ParticipantInfo", { enumerable: true, get: function () { return livekit_models_1.ParticipantInfo; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,iDAA+B;AAC/B,2CAAyB;AACzB,yDAWgC;AAV9B,kHAAA,gBAAgB,OAAA;AAChB,4GAAA,UAAU,OAAA;AACV,mHAAA,iBAAiB,OAAA;AACjB,iHAAA,eAAe,OAAA;AACf,iHAAA,eAAe,OAAA;AACf,uHAAA,qBAAqB,OAAA;AACrB,qHAAA,mBAAmB,OAAA;AACnB,uHAAA,qBAAqB,OAAA;AACrB,8GAAA,YAAY,OAAA;AACZ,gHAAA,cAAc,OAAA;AAEhB,yDAQgC;AAP9B,iHAAA,eAAe,OAAA;AACf,iHAAA,eAAe,OAAA;AACf,uHAAA,qBAAqB,OAAA;AACrB,uHAAA,qBAAqB,OAAA;AACrB,sGAAA,IAAI,OAAA;AACJ,2GAAA,SAAS,OAAA;AACT,2GAAA,SAAS,OAAA;AAEX,sDAAoC;AACpC,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,iDAA+B;AAC/B,2CAAyB;AACzB,kDAAgC;AAChC,yDAWgC;AAV9B,kHAAA,gBAAgB,OAAA;AAChB,4GAAA,UAAU,OAAA;AACV,mHAAA,iBAAiB,OAAA;AACjB,iHAAA,eAAe,OAAA;AACf,iHAAA,eAAe,OAAA;AACf,uHAAA,qBAAqB,OAAA;AACrB,qHAAA,mBAAmB,OAAA;AACnB,uHAAA,qBAAqB,OAAA;AACrB,8GAAA,YAAY,OAAA;AACZ,gHAAA,cAAc,OAAA;AAEhB,2DAMiC;AAL/B,sHAAA,mBAAmB,OAAA;AACnB,8GAAA,WAAW,OAAA;AACX,+GAAA,YAAY,OAAA;AACZ,+GAAA,YAAY,OAAA;AACZ,sHAAA,mBAAmB,OAAA;AAErB,yDAQgC;AAP9B,iHAAA,eAAe,OAAA;AACf,iHAAA,eAAe,OAAA;AACf,uHAAA,qBAAqB,OAAA;AACrB,uHAAA,qBAAqB,OAAA;AACrB,sGAAA,IAAI,OAAA;AACJ,2GAAA,SAAS,OAAA;AACT,2GAAA,SAAS,OAAA;AAEX,sDAAoC;AACpC,oDAAkC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _m0 from "protobufjs/minimal";
|
|
2
2
|
export declare const protobufPackage = "google.protobuf";
|
|
3
3
|
/**
|
|
4
4
|
* A Timestamp represents a point in time independent of any time zone or local
|
|
@@ -51,7 +51,6 @@ export declare const protobufPackage = "google.protobuf";
|
|
|
51
51
|
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
|
52
52
|
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
|
53
53
|
*
|
|
54
|
-
*
|
|
55
54
|
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
|
56
55
|
*
|
|
57
56
|
* Instant now = Instant.now();
|
|
@@ -60,7 +59,6 @@ export declare const protobufPackage = "google.protobuf";
|
|
|
60
59
|
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
|
61
60
|
* .setNanos(now.getNano()).build();
|
|
62
61
|
*
|
|
63
|
-
*
|
|
64
62
|
* Example 6: Compute Timestamp from current time in Python.
|
|
65
63
|
*
|
|
66
64
|
* timestamp = Timestamp()
|
|
@@ -119,7 +117,7 @@ export declare const Timestamp: {
|
|
|
119
117
|
} & {
|
|
120
118
|
seconds?: number | undefined;
|
|
121
119
|
nanos?: number | undefined;
|
|
122
|
-
} &
|
|
120
|
+
} & { [K in Exclude<keyof I, keyof Timestamp>]: never; }>(object: I): Timestamp;
|
|
123
121
|
};
|
|
124
122
|
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
125
123
|
export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
@@ -128,5 +126,7 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
|
|
|
128
126
|
declare type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
129
127
|
export declare type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
130
128
|
[K in keyof P]: Exact<P[K], I[K]>;
|
|
131
|
-
} &
|
|
129
|
+
} & {
|
|
130
|
+
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
|
131
|
+
};
|
|
132
132
|
export {};
|