@molecule/api-video-rooms-livekit 1.0.4 → 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 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-10-16T23:32:16.484Z
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
- // Explicit config. For real cloud recording, also pass `recordingEgress` — a
34
- // LiveKit `RoomEgress` (built with RoomCompositeEgressRequest + EncodedFileOutput
35
- // + your S3/GCP/Azure upload), or a `(roomName) => RoomEgress` factory; see the
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
- * // Explicit config. For real cloud recording, also pass `recordingEgress` — a
47
- * // LiveKit `RoomEgress` (built with RoomCompositeEgressRequest + EncodedFileOutput
48
- * // + your S3/GCP/Azure upload), or a `(roomName) => RoomEgress` factory; see the
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';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
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
- * // Explicit config. For real cloud recording, also pass `recordingEgress` — a
47
- * // LiveKit `RoomEgress` (built with RoomCompositeEgressRequest + EncodedFileOutput
48
- * // + your S3/GCP/Azure upload), or a `(roomName) => RoomEgress` factory; see the
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';
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,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,CAyOvF"}
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).
@@ -258,12 +259,11 @@ export function createProvider(config = {}) {
258
259
  */
259
260
  async function issueToken(roomName, options = {}) {
260
261
  const ttl = toTtlSeconds(options.expiresAt) ?? defaultTokenTtl;
261
- const tokenOptions = { ttl };
262
- if (options.userName !== undefined) {
263
- tokenOptions.identity = options.userName;
264
- tokenOptions.name = options.userName;
265
- }
266
- 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
+ });
267
267
  const isOwner = options.isOwner === true;
268
268
  token.addGrant({
269
269
  room: roomName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-video-rooms-livekit",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
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",