@molecule/api-video-rooms-livekit 1.0.3 → 1.0.5
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/README.md +8 -15
- package/dist/index.d.ts +7 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -12
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +8 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-
|
|
6
|
+
Generated: 2026-12-01T16:53:45.403Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-video-rooms-livekit
|
|
@@ -23,26 +23,16 @@ infrastructure.
|
|
|
23
23
|
## Quick Start
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
|
-
import { setProvider } from '@molecule/api-video-rooms'
|
|
26
|
+
import { createMeetingToken, createRoom, setProvider } from '@molecule/api-video-rooms'
|
|
27
27
|
import { createProvider } from '@molecule/api-video-rooms-livekit'
|
|
28
28
|
|
|
29
29
|
// Bond at startup (reads LIVEKIT_URL / LIVEKIT_API_KEY /
|
|
30
30
|
// LIVEKIT_API_SECRET by default)
|
|
31
31
|
setProvider(createProvider())
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
// `recordingEgress` docs in @remarks. With it, `createRoom({ recording: true })`
|
|
37
|
-
// starts a real room-composite egress; WITHOUT it, that call throws rather than
|
|
38
|
-
// silently not recording.
|
|
39
|
-
setProvider(
|
|
40
|
-
createProvider({
|
|
41
|
-
host: 'https://livekit.example.com',
|
|
42
|
-
apiKey: 'APIxxx',
|
|
43
|
-
apiSecret: 'secretxxx',
|
|
44
|
-
}),
|
|
45
|
-
)
|
|
33
|
+
const room = await createRoom({ name: 'standup', maxParticipants: 10 })
|
|
34
|
+
const guestToken = await createMeetingToken(room.name)
|
|
35
|
+
// Send the invited guest { url: room.url, token: guestToken }.
|
|
46
36
|
```
|
|
47
37
|
|
|
48
38
|
## Type
|
|
@@ -341,6 +331,9 @@ Peer dependencies:
|
|
|
341
331
|
`roomAdmin` — there is no subscribe-only token option in this revision.
|
|
342
332
|
- `createProvider()` throws at bond time when LIVEKIT_URL /
|
|
343
333
|
LIVEKIT_API_KEY / LIVEKIT_API_SECRET are unset.
|
|
334
|
+
- Give the owner token from `createRoom()` only to the room creator.
|
|
335
|
+
Issue other participants their own token. A supplied `userName` serves
|
|
336
|
+
as the participant identity. Omitting it generates a unique identity.
|
|
344
337
|
|
|
345
338
|
## E2E Tests
|
|
346
339
|
|
package/dist/index.d.ts
CHANGED
|
@@ -32,28 +32,23 @@
|
|
|
32
32
|
* `roomAdmin` — there is no subscribe-only token option in this revision.
|
|
33
33
|
* - `createProvider()` throws at bond time when LIVEKIT_URL /
|
|
34
34
|
* LIVEKIT_API_KEY / LIVEKIT_API_SECRET are unset.
|
|
35
|
+
* - Give the owner token from `createRoom()` only to the room creator.
|
|
36
|
+
* Issue other participants their own token. A supplied `userName` serves
|
|
37
|
+
* as the participant identity. Omitting it generates a unique identity.
|
|
35
38
|
*
|
|
36
39
|
* @module
|
|
37
40
|
* @example
|
|
38
41
|
* ```typescript
|
|
39
|
-
* import { setProvider } from '@molecule/api-video-rooms'
|
|
42
|
+
* import { createMeetingToken, createRoom, setProvider } from '@molecule/api-video-rooms'
|
|
40
43
|
* import { createProvider } from '@molecule/api-video-rooms-livekit'
|
|
41
44
|
*
|
|
42
45
|
* // Bond at startup (reads LIVEKIT_URL / LIVEKIT_API_KEY /
|
|
43
46
|
* // LIVEKIT_API_SECRET by default)
|
|
44
47
|
* setProvider(createProvider())
|
|
45
48
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* //
|
|
49
|
-
* // `recordingEgress` docs in @remarks. With it, `createRoom({ recording: true })`
|
|
50
|
-
* // starts a real room-composite egress; WITHOUT it, that call throws rather than
|
|
51
|
-
* // silently not recording.
|
|
52
|
-
* setProvider(createProvider({
|
|
53
|
-
* host: 'https://livekit.example.com',
|
|
54
|
-
* apiKey: 'APIxxx',
|
|
55
|
-
* apiSecret: 'secretxxx',
|
|
56
|
-
* }))
|
|
49
|
+
* const room = await createRoom({ name: 'standup', maxParticipants: 10 })
|
|
50
|
+
* const guestToken = await createMeetingToken(room.name)
|
|
51
|
+
* // Send the invited guest { url: room.url, token: guestToken }.
|
|
57
52
|
* ```
|
|
58
53
|
*/
|
|
59
54
|
export * from './browser-guard.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -32,28 +32,23 @@
|
|
|
32
32
|
* `roomAdmin` — there is no subscribe-only token option in this revision.
|
|
33
33
|
* - `createProvider()` throws at bond time when LIVEKIT_URL /
|
|
34
34
|
* LIVEKIT_API_KEY / LIVEKIT_API_SECRET are unset.
|
|
35
|
+
* - Give the owner token from `createRoom()` only to the room creator.
|
|
36
|
+
* Issue other participants their own token. A supplied `userName` serves
|
|
37
|
+
* as the participant identity. Omitting it generates a unique identity.
|
|
35
38
|
*
|
|
36
39
|
* @module
|
|
37
40
|
* @example
|
|
38
41
|
* ```typescript
|
|
39
|
-
* import { setProvider } from '@molecule/api-video-rooms'
|
|
42
|
+
* import { createMeetingToken, createRoom, setProvider } from '@molecule/api-video-rooms'
|
|
40
43
|
* import { createProvider } from '@molecule/api-video-rooms-livekit'
|
|
41
44
|
*
|
|
42
45
|
* // Bond at startup (reads LIVEKIT_URL / LIVEKIT_API_KEY /
|
|
43
46
|
* // LIVEKIT_API_SECRET by default)
|
|
44
47
|
* setProvider(createProvider())
|
|
45
48
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* //
|
|
49
|
-
* // `recordingEgress` docs in @remarks. With it, `createRoom({ recording: true })`
|
|
50
|
-
* // starts a real room-composite egress; WITHOUT it, that call throws rather than
|
|
51
|
-
* // silently not recording.
|
|
52
|
-
* setProvider(createProvider({
|
|
53
|
-
* host: 'https://livekit.example.com',
|
|
54
|
-
* apiKey: 'APIxxx',
|
|
55
|
-
* apiSecret: 'secretxxx',
|
|
56
|
-
* }))
|
|
49
|
+
* const room = await createRoom({ name: 'standup', maxParticipants: 10 })
|
|
50
|
+
* const guestToken = await createMeetingToken(room.name)
|
|
51
|
+
* // Send the invited guest { url: room.url, token: guestToken }.
|
|
57
52
|
* ```
|
|
58
53
|
*/
|
|
59
54
|
export * from './browser-guard.js';
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,cAAc,CAAA;AASrB,OAAO,KAAK,EAMV,kBAAkB,EACnB,MAAM,2BAA2B,CAAA;AAElC,OAAO,KAAK,EAMV,uBAAuB,EACxB,MAAM,YAAY,CAAA;AAyKnB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,MAAM,GAAE,uBAA4B,GAAG,kBAAkB,CAuOvF"}
|
package/dist/provider.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @module
|
|
15
15
|
*/
|
|
16
|
+
import { randomUUID } from 'node:crypto';
|
|
16
17
|
// Side-effect import: registers this bond's secret definitions so the
|
|
17
18
|
// runtime registry is populated even when provider.js is imported directly
|
|
18
19
|
// (not through the package barrel).
|
|
@@ -214,10 +215,8 @@ export function createProvider(config = {}) {
|
|
|
214
215
|
const resolvedApiSecret = apiSecret;
|
|
215
216
|
const { http: httpUrl, ws: wsUrl } = normaliseHost(rawHost);
|
|
216
217
|
const accessTokenCtor = config.accessTokenCtor ?? AccessToken;
|
|
217
|
-
const roomService = config.roomServiceClient ??
|
|
218
|
-
|
|
219
|
-
const egress = config.egressClient ??
|
|
220
|
-
new EgressClient(httpUrl, resolvedApiKey, resolvedApiSecret);
|
|
218
|
+
const roomService = config.roomServiceClient ?? new RoomServiceClient(httpUrl, resolvedApiKey, resolvedApiSecret);
|
|
219
|
+
const egress = config.egressClient ?? new EgressClient(httpUrl, resolvedApiKey, resolvedApiSecret);
|
|
221
220
|
const recordingEgress = config.recordingEgress;
|
|
222
221
|
/**
|
|
223
222
|
* Resolves the configured auto-egress specification for a room, if any.
|
|
@@ -260,12 +259,11 @@ export function createProvider(config = {}) {
|
|
|
260
259
|
*/
|
|
261
260
|
async function issueToken(roomName, options = {}) {
|
|
262
261
|
const ttl = toTtlSeconds(options.expiresAt) ?? defaultTokenTtl;
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
const token = new accessTokenCtor(resolvedApiKey, resolvedApiSecret, tokenOptions);
|
|
262
|
+
const token = new accessTokenCtor(resolvedApiKey, resolvedApiSecret, {
|
|
263
|
+
ttl,
|
|
264
|
+
identity: options.userName || randomUUID(),
|
|
265
|
+
name: options.userName,
|
|
266
|
+
});
|
|
269
267
|
const isOwner = options.isOwner === true;
|
|
270
268
|
token.addGrant({
|
|
271
269
|
room: roomName,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-video-rooms-livekit",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "LiveKit video rooms provider for molecule.dev",
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"description": "LiveKit video rooms provider for molecule.dev. Implements @molecule/api-video-rooms via the LiveKit Server API (Twirp transport) and HS256 JWT meeting tokens via livekit-server-sdk. Self-hostable + LiveKit Cloud.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|