@soulcraft/sdk 2.0.1 → 2.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/client/index.d.ts +5 -38
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +5 -47
- package/dist/client/index.js.map +1 -1
- package/dist/client/namespace-proxy.d.ts +3 -4
- package/dist/client/namespace-proxy.d.ts.map +1 -1
- package/dist/client/namespace-proxy.js +3 -4
- package/dist/client/namespace-proxy.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/modules/hall/admin.d.ts +39 -0
- package/dist/modules/hall/admin.d.ts.map +1 -0
- package/dist/modules/hall/admin.js +115 -0
- package/dist/modules/hall/admin.js.map +1 -0
- package/dist/modules/hall/browser.d.ts +83 -27
- package/dist/modules/hall/browser.d.ts.map +1 -1
- package/dist/modules/hall/browser.js +238 -49
- package/dist/modules/hall/browser.js.map +1 -1
- package/dist/modules/hall/media.d.ts +164 -0
- package/dist/modules/hall/media.d.ts.map +1 -0
- package/dist/modules/hall/media.js +182 -0
- package/dist/modules/hall/media.js.map +1 -0
- package/dist/modules/hall/server.d.ts +119 -6
- package/dist/modules/hall/server.d.ts.map +1 -1
- package/dist/modules/hall/server.js +299 -9
- package/dist/modules/hall/server.js.map +1 -1
- package/dist/modules/hall/types.d.ts +705 -25
- package/dist/modules/hall/types.d.ts.map +1 -1
- package/dist/modules/hall/types.js +12 -7
- package/dist/modules/hall/types.js.map +1 -1
- package/dist/server/hall-handlers.d.ts +60 -14
- package/dist/server/hall-handlers.d.ts.map +1 -1
- package/dist/server/hall-handlers.js +61 -12
- package/dist/server/hall-handlers.js.map +1 -1
- package/dist/server/hono-router.d.ts +2 -9
- package/dist/server/hono-router.d.ts.map +1 -1
- package/dist/server/hono-router.js +2 -46
- package/dist/server/hono-router.js.map +1 -1
- package/dist/server/index.d.ts +4 -19
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +10 -29
- package/dist/server/index.js.map +1 -1
- package/dist/types.d.ts +2 -41
- package/dist/types.d.ts.map +1 -1
- package/docs/ADR-005-hall-integration.md +449 -0
- package/package.json +1 -1
- package/dist/client/create-client-sdk.d.ts +0 -113
- package/dist/client/create-client-sdk.d.ts.map +0 -1
- package/dist/client/create-client-sdk.js +0 -169
- package/dist/client/create-client-sdk.js.map +0 -1
- package/dist/modules/app-context/index.d.ts +0 -214
- package/dist/modules/app-context/index.d.ts.map +0 -1
- package/dist/modules/app-context/index.js +0 -569
- package/dist/modules/app-context/index.js.map +0 -1
- package/dist/modules/billing/firestore-provider.d.ts +0 -60
- package/dist/modules/billing/firestore-provider.d.ts.map +0 -1
- package/dist/modules/billing/firestore-provider.js +0 -315
- package/dist/modules/billing/firestore-provider.js.map +0 -1
- package/dist/modules/brainy/proxy.d.ts +0 -48
- package/dist/modules/brainy/proxy.d.ts.map +0 -1
- package/dist/modules/brainy/proxy.js +0 -95
- package/dist/modules/brainy/proxy.js.map +0 -1
- package/dist/server/create-sdk.d.ts +0 -74
- package/dist/server/create-sdk.d.ts.map +0 -1
- package/dist/server/create-sdk.js +0 -104
- package/dist/server/create-sdk.js.map +0 -1
- package/dist/server/from-license.d.ts +0 -252
- package/dist/server/from-license.d.ts.map +0 -1
- package/dist/server/from-license.js +0 -349
- package/dist/server/from-license.js.map +0 -1
- package/dist/server/handlers.d.ts +0 -312
- package/dist/server/handlers.d.ts.map +0 -1
- package/dist/server/handlers.js +0 -376
- package/dist/server/handlers.js.map +0 -1
- package/dist/server/postmessage-handler.d.ts +0 -152
- package/dist/server/postmessage-handler.d.ts.map +0 -1
- package/dist/server/postmessage-handler.js +0 -138
- package/dist/server/postmessage-handler.js.map +0 -1
- package/dist/transports/http.d.ts +0 -86
- package/dist/transports/http.d.ts.map +0 -1
- package/dist/transports/http.js +0 -137
- package/dist/transports/http.js.map +0 -1
- package/dist/transports/postmessage.d.ts +0 -159
- package/dist/transports/postmessage.d.ts.map +0 -1
- package/dist/transports/postmessage.js +0 -207
- package/dist/transports/postmessage.js.map +0 -1
- package/dist/transports/workshop.d.ts +0 -173
- package/dist/transports/workshop.d.ts.map +0 -1
- package/dist/transports/workshop.js +0 -307
- package/dist/transports/workshop.js.map +0 -1
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module modules/hall/media
|
|
3
|
+
* @description HTTP client for the Hall media pipeline — upload, transcode, retrieve, and delete media.
|
|
4
|
+
*
|
|
5
|
+
* Hall provides a media pipeline for processing audio, video, and image files. This module
|
|
6
|
+
* wraps the HTTP endpoints (not WebSocket) with a typed client. Async notifications for
|
|
7
|
+
* transcoding completion arrive via the product WebSocket (`mediaReady` / `mediaError` events
|
|
8
|
+
* on the `HallRoom` handle).
|
|
9
|
+
*
|
|
10
|
+
* **Auth model:** All media HTTP requests use `Authorization: Hall <productName>:<secret>`.
|
|
11
|
+
* This client is server-only — never expose the product secret to browsers. Browser clients
|
|
12
|
+
* access processed media via the public `GET /media/{mediaId}` endpoint (no auth required
|
|
13
|
+
* for read access).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { createHallMediaClient } from '@soulcraft/sdk/server'
|
|
18
|
+
*
|
|
19
|
+
* const media = createHallMediaClient({
|
|
20
|
+
* baseUrl: 'https://hall.soulcraft.com',
|
|
21
|
+
* productName: 'workshop',
|
|
22
|
+
* secret: process.env.HALL_WORKSHOP_SECRET!,
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* // Upload a file with transcoding
|
|
26
|
+
* const result = await media.upload(file, { transcode: 'video/mp4' })
|
|
27
|
+
* console.log(result.mediaId) // listen for 'mediaReady' event on the room
|
|
28
|
+
*
|
|
29
|
+
* // Get media info
|
|
30
|
+
* const info = await media.getInfo(result.mediaId)
|
|
31
|
+
*
|
|
32
|
+
* // Delete media
|
|
33
|
+
* await media.delete(result.mediaId)
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
// ─── HallMediaClient ─────────────────────────────────────────────────────────
|
|
37
|
+
/**
|
|
38
|
+
* Server-side HTTP client for the Hall media pipeline.
|
|
39
|
+
*
|
|
40
|
+
* Handles upload, info retrieval, thumbnail access, and deletion.
|
|
41
|
+
* All requests are authenticated with the product shared secret.
|
|
42
|
+
*
|
|
43
|
+
* Async transcoding notifications arrive via the product WebSocket, not this client.
|
|
44
|
+
* Listen for `mediaReady` / `mediaError` events on the `HallRoom` handle.
|
|
45
|
+
*/
|
|
46
|
+
export class HallMediaClient {
|
|
47
|
+
#baseUrl;
|
|
48
|
+
#productName;
|
|
49
|
+
#secret;
|
|
50
|
+
/**
|
|
51
|
+
* @param options - Hall server URL, product name, and shared secret.
|
|
52
|
+
*/
|
|
53
|
+
constructor(options) {
|
|
54
|
+
this.#baseUrl = options.baseUrl.replace(/\/$/, '');
|
|
55
|
+
this.#productName = options.productName;
|
|
56
|
+
this.#secret = options.secret;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Upload a media file to Hall for processing.
|
|
60
|
+
*
|
|
61
|
+
* @param file - The file to upload. Can be a `Blob`, `File`, or `Buffer`.
|
|
62
|
+
* @param options - Optional transcode target.
|
|
63
|
+
* @returns The assigned media ID. Listen for `mediaReady` on the room for completion.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const file = new Blob([audioBuffer], { type: 'audio/wav' })
|
|
68
|
+
* const { mediaId } = await media.upload(file, { transcode: 'audio/mp3' })
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
async upload(file, options = {}) {
|
|
72
|
+
const form = new FormData();
|
|
73
|
+
form.append('file', file);
|
|
74
|
+
if (options.transcode) {
|
|
75
|
+
form.append('transcode', options.transcode);
|
|
76
|
+
}
|
|
77
|
+
const response = await fetch(`${this.#baseUrl}/media/upload`, {
|
|
78
|
+
method: 'POST',
|
|
79
|
+
headers: { Authorization: this.#authHeader() },
|
|
80
|
+
body: form,
|
|
81
|
+
signal: AbortSignal.timeout(120_000),
|
|
82
|
+
});
|
|
83
|
+
if (!response.ok) {
|
|
84
|
+
throw new Error(`Hall media upload failed (${response.status}): ${await response.text()}`);
|
|
85
|
+
}
|
|
86
|
+
return response.json();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get metadata for a processed media file.
|
|
90
|
+
*
|
|
91
|
+
* @param mediaId - The media identifier from the upload result.
|
|
92
|
+
* @returns Media metadata including MIME type, size, duration, dimensions, and status.
|
|
93
|
+
*/
|
|
94
|
+
async getInfo(mediaId) {
|
|
95
|
+
const response = await fetch(`${this.#baseUrl}/media/${encodeURIComponent(mediaId)}/info`, {
|
|
96
|
+
headers: { Authorization: this.#authHeader() },
|
|
97
|
+
signal: AbortSignal.timeout(10_000),
|
|
98
|
+
});
|
|
99
|
+
if (!response.ok) {
|
|
100
|
+
throw new Error(`Hall media info failed (${response.status}): ${await response.text()}`);
|
|
101
|
+
}
|
|
102
|
+
return response.json();
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get the URL for streaming a media file.
|
|
106
|
+
* Supports HTTP range requests (206 Partial Content).
|
|
107
|
+
*
|
|
108
|
+
* @param mediaId - The media identifier.
|
|
109
|
+
* @returns The full URL to the media file.
|
|
110
|
+
*/
|
|
111
|
+
getStreamUrl(mediaId) {
|
|
112
|
+
return `${this.#baseUrl}/media/${encodeURIComponent(mediaId)}`;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get the URL for an auto-generated thumbnail (WebP).
|
|
116
|
+
*
|
|
117
|
+
* @param mediaId - The media identifier.
|
|
118
|
+
* @returns The full URL to the thumbnail image.
|
|
119
|
+
*/
|
|
120
|
+
getThumbnailUrl(mediaId) {
|
|
121
|
+
return `${this.#baseUrl}/media/${encodeURIComponent(mediaId)}/thumbnail`;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Delete a media file. Only the uploading product can delete its own media.
|
|
125
|
+
*
|
|
126
|
+
* @param mediaId - The media identifier to delete.
|
|
127
|
+
*/
|
|
128
|
+
async delete(mediaId) {
|
|
129
|
+
const response = await fetch(`${this.#baseUrl}/media/${encodeURIComponent(mediaId)}`, {
|
|
130
|
+
method: 'DELETE',
|
|
131
|
+
headers: { Authorization: this.#authHeader() },
|
|
132
|
+
signal: AbortSignal.timeout(10_000),
|
|
133
|
+
});
|
|
134
|
+
if (!response.ok) {
|
|
135
|
+
throw new Error(`Hall media delete failed (${response.status}): ${await response.text()}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Build the WHEP endpoint URL for receive-only WebRTC viewing.
|
|
140
|
+
* Browser viewers POST an SDP offer to this URL with a session token.
|
|
141
|
+
*
|
|
142
|
+
* @param roomId - The room to view.
|
|
143
|
+
* @returns The WHEP endpoint URL.
|
|
144
|
+
*/
|
|
145
|
+
getWhepUrl(roomId) {
|
|
146
|
+
return `${this.#baseUrl}/whep/${encodeURIComponent(roomId)}`;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Build the LL-HLS master playlist URL for scalable HLS viewing.
|
|
150
|
+
*
|
|
151
|
+
* @param roomId - The room to view.
|
|
152
|
+
* @returns The HLS playlist URL.
|
|
153
|
+
*/
|
|
154
|
+
getHlsUrl(roomId) {
|
|
155
|
+
return `${this.#baseUrl}/hls/${encodeURIComponent(roomId)}/playlist.m3u8`;
|
|
156
|
+
}
|
|
157
|
+
#authHeader() {
|
|
158
|
+
return `Hall ${this.#productName}:${this.#secret}`;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// ─── Factory ─────────────────────────────────────────────────────────────────
|
|
162
|
+
/**
|
|
163
|
+
* Create a server-side Hall media client for upload, transcode, and retrieval.
|
|
164
|
+
*
|
|
165
|
+
* @param options - Hall server URL, product name, and shared secret.
|
|
166
|
+
* @returns A `HallMediaClient` instance ready for use.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* import { createHallMediaClient } from '@soulcraft/sdk/server'
|
|
171
|
+
*
|
|
172
|
+
* const media = createHallMediaClient({
|
|
173
|
+
* baseUrl: 'https://hall.soulcraft.com',
|
|
174
|
+
* productName: 'workshop',
|
|
175
|
+
* secret: process.env.HALL_WORKSHOP_SECRET!,
|
|
176
|
+
* })
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
export function createHallMediaClient(options) {
|
|
180
|
+
return new HallMediaClient(options);
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../../src/modules/hall/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AA6CH,gFAAgF;AAEhF;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAe;IACjB,QAAQ,CAAQ;IAChB,YAAY,CAAQ;IACpB,OAAO,CAAQ;IAExB;;OAEG;IACH,YAAY,OAA+B;QACzC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QAClD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,WAAW,CAAA;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAA;IAC/B,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,MAAM,CAAC,IAAiB,EAAE,UAA8B,EAAE;QAC9D,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAA;QAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QACzB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;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com`. All room management (createRoom, closeRoom, session
|
|
7
|
-
* tokens, recording)
|
|
7
|
+
* tokens, recording), pub/sub (topics, presence), broadcast control (promote/demote),
|
|
8
|
+
* and media pipeline notifications go through this connection.
|
|
8
9
|
*
|
|
9
10
|
* This module is **server-only** — it uses WebSocket, reconnect timers, and the
|
|
10
11
|
* product shared secret, none of which should ever reach a browser bundle.
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
* const { token } = await hall.createSessionToken('cohort-123', 'user-456')
|
|
28
29
|
* ```
|
|
29
30
|
*/
|
|
30
|
-
import type { HallConnectionOptions, HallModule, HallRoom, HallRoomEvents, RoomOptions } from './types.js';
|
|
31
|
+
import type { HallConnectionOptions, HallModule, HallPubsubEvents, HallRoom, HallRoomEvents, HallPeerRole, RoomOptions, ScreenShareMode, WhipSession, TokenRevokedEvent } from './types.js';
|
|
31
32
|
type Listener<T> = (event: T) => void;
|
|
32
33
|
/**
|
|
33
34
|
* Concrete implementation of the {@link HallRoom} interface.
|
|
@@ -49,8 +50,9 @@ export declare class HallRoomImpl implements HallRoom {
|
|
|
49
50
|
* Product-backend WebSocket client for the Hall real-time communication server.
|
|
50
51
|
*
|
|
51
52
|
* Create one instance per product process. Maintains a single authenticated control-plane
|
|
52
|
-
* WebSocket to `hall.soulcraft.com`. All room management
|
|
53
|
-
* this single connection — do not create multiple instances
|
|
53
|
+
* WebSocket to `hall.soulcraft.com`. All room management, pub/sub, broadcast control,
|
|
54
|
+
* and event routing goes through this single connection — do not create multiple instances
|
|
55
|
+
* per product.
|
|
54
56
|
*
|
|
55
57
|
* Auto-reconnects on unexpected disconnect (configurable via `reconnectDelayMs`).
|
|
56
58
|
* In-flight promises are rejected on disconnect; register `onReconnect` to re-create rooms.
|
|
@@ -93,7 +95,7 @@ export declare class HallClient implements HallModule {
|
|
|
93
95
|
* Create a new room on the Hall server.
|
|
94
96
|
*
|
|
95
97
|
* @param roomId - Unique room identifier (e.g. Brainy session entity ID).
|
|
96
|
-
* @param options - Room configuration: peer limit, transcription, recording, concept list.
|
|
98
|
+
* @param options - Room configuration: peer limit, transcription, recording, broadcast, concept list.
|
|
97
99
|
* @returns The HallRoom handle — register event listeners on it immediately.
|
|
98
100
|
* @throws {Error} If a room with the same ID already exists or the server returns an error.
|
|
99
101
|
*/
|
|
@@ -124,9 +126,10 @@ export declare class HallClient implements HallModule {
|
|
|
124
126
|
* @param roomId - The room the browser peer will join.
|
|
125
127
|
* @param peerId - The peer's unique identifier (e.g. authenticated user ID).
|
|
126
128
|
* @param ttlSecs - Token lifetime in seconds (default: 300).
|
|
129
|
+
* @param role - Optional role hint: `"participant"`, `"viewer"`, or undefined (auto).
|
|
127
130
|
* @returns `{ token, expiresAt }` — send `token` and `this.url` to the browser.
|
|
128
131
|
*/
|
|
129
|
-
createSessionToken(roomId: string, peerId: string, ttlSecs?: number): Promise<{
|
|
132
|
+
createSessionToken(roomId: string, peerId: string, ttlSecs?: number, role?: HallPeerRole): Promise<{
|
|
130
133
|
token: string;
|
|
131
134
|
expiresAt: number;
|
|
132
135
|
}>;
|
|
@@ -144,6 +147,116 @@ export declare class HallClient implements HallModule {
|
|
|
144
147
|
* @param roomId - The room to stop recording.
|
|
145
148
|
*/
|
|
146
149
|
stopRecording(roomId: string): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Subscribe to a pub/sub topic. Topics are product-scoped.
|
|
152
|
+
*
|
|
153
|
+
* @param topic - Topic name to subscribe to.
|
|
154
|
+
* @param metadata - Optional presence metadata visible to other subscribers.
|
|
155
|
+
*/
|
|
156
|
+
subscribeTopic(topic: string, metadata?: Record<string, unknown>): void;
|
|
157
|
+
/**
|
|
158
|
+
* Unsubscribe from a pub/sub topic.
|
|
159
|
+
*
|
|
160
|
+
* @param topic - Topic name to unsubscribe from.
|
|
161
|
+
*/
|
|
162
|
+
unsubscribeTopic(topic: string): void;
|
|
163
|
+
/**
|
|
164
|
+
* Broadcast a message to all subscribers of a pub/sub topic.
|
|
165
|
+
*
|
|
166
|
+
* @param topic - Topic to broadcast to.
|
|
167
|
+
* @param payload - Arbitrary JSON payload delivered to all subscribers.
|
|
168
|
+
*/
|
|
169
|
+
broadcastTopic(topic: string, payload: unknown): void;
|
|
170
|
+
/**
|
|
171
|
+
* Request a snapshot of all current subscribers on a topic.
|
|
172
|
+
*
|
|
173
|
+
* @param topic - Topic to query presence for.
|
|
174
|
+
*/
|
|
175
|
+
getPresence(topic: string): void;
|
|
176
|
+
/**
|
|
177
|
+
* Register a listener for pub/sub events on the product connection.
|
|
178
|
+
*
|
|
179
|
+
* @param event - The pub/sub event name.
|
|
180
|
+
* @param listener - Callback invoked with the typed event payload.
|
|
181
|
+
*/
|
|
182
|
+
onPubsub<K extends keyof HallPubsubEvents>(event: K, listener: (data: HallPubsubEvents[K]) => void): void;
|
|
183
|
+
/**
|
|
184
|
+
* Issue a browser pub/sub token.
|
|
185
|
+
*
|
|
186
|
+
* @param peerId - Peer ID the token is issued for.
|
|
187
|
+
* @param allowedTopics - Optional topic whitelist.
|
|
188
|
+
* @param ttlSecs - Token lifetime in seconds (default: 300).
|
|
189
|
+
* @returns `{ token, expiresAt }`.
|
|
190
|
+
*/
|
|
191
|
+
createPubsubToken(peerId: string, allowedTopics?: string[], ttlSecs?: number): Promise<{
|
|
192
|
+
token: string;
|
|
193
|
+
expiresAt: number;
|
|
194
|
+
}>;
|
|
195
|
+
/**
|
|
196
|
+
* Promote a viewer to a full bidirectional participant.
|
|
197
|
+
*
|
|
198
|
+
* @param roomId - Room containing the peer.
|
|
199
|
+
* @param peerId - Peer ID to promote.
|
|
200
|
+
*/
|
|
201
|
+
promotePeer(roomId: string, peerId: string): void;
|
|
202
|
+
/**
|
|
203
|
+
* Demote a participant to a receive-only viewer.
|
|
204
|
+
*
|
|
205
|
+
* @param roomId - Room containing the peer.
|
|
206
|
+
* @param peerId - Peer ID to demote.
|
|
207
|
+
*/
|
|
208
|
+
demotePeer(roomId: string, peerId: string): void;
|
|
209
|
+
/**
|
|
210
|
+
* Set the screen share simulcast strategy for a peer.
|
|
211
|
+
*
|
|
212
|
+
* @param roomId - Room containing the screensharing peer.
|
|
213
|
+
* @param peerId - Peer sharing their screen.
|
|
214
|
+
* @param mode - `"static"` (resolution) or `"motion"` (framerate).
|
|
215
|
+
*/
|
|
216
|
+
setScreenShareMode(roomId: string, peerId: string, mode: ScreenShareMode): void;
|
|
217
|
+
/**
|
|
218
|
+
* Request historical chat messages for a room.
|
|
219
|
+
*
|
|
220
|
+
* @param roomId - Room to get chat history for.
|
|
221
|
+
* @param lastN - Maximum number of recent messages to return.
|
|
222
|
+
*/
|
|
223
|
+
getChatHistory(roomId: string, lastN?: number): void;
|
|
224
|
+
/**
|
|
225
|
+
* Revoke a session token. The token becomes invalid immediately.
|
|
226
|
+
*
|
|
227
|
+
* @param token - The session token string to revoke.
|
|
228
|
+
*/
|
|
229
|
+
revokeToken(token: string): void;
|
|
230
|
+
/**
|
|
231
|
+
* Register a listener for token revocation confirmations.
|
|
232
|
+
*
|
|
233
|
+
* @param listener - Called with the token hash on confirmation.
|
|
234
|
+
*/
|
|
235
|
+
onTokenRevoked(listener: (data: TokenRevokedEvent) => void): void;
|
|
236
|
+
/**
|
|
237
|
+
* Create a WHIP ingest session for an external publisher.
|
|
238
|
+
* Uses HTTP POST to `/whip/{roomId}` with the product secret.
|
|
239
|
+
*
|
|
240
|
+
* @param roomId - Room to publish into.
|
|
241
|
+
* @param sdpOffer - Raw SDP offer from the publisher.
|
|
242
|
+
* @returns WHIP session with resourceId and answerSdp.
|
|
243
|
+
*/
|
|
244
|
+
createWhipSession(roomId: string, sdpOffer: string): Promise<WhipSession>;
|
|
245
|
+
/**
|
|
246
|
+
* Send a trickle ICE candidate to an active WHIP session.
|
|
247
|
+
*
|
|
248
|
+
* @param roomId - Room the WHIP session belongs to.
|
|
249
|
+
* @param resourceId - Resource ID from createWhipSession.
|
|
250
|
+
* @param candidate - ICE candidate in trickle-ice-sdpfrag format.
|
|
251
|
+
*/
|
|
252
|
+
addWhipIceCandidate(roomId: string, resourceId: string, candidate: string): Promise<void>;
|
|
253
|
+
/**
|
|
254
|
+
* Tear down a WHIP session and remove the publisher peer.
|
|
255
|
+
*
|
|
256
|
+
* @param roomId - Room the WHIP session belongs to.
|
|
257
|
+
* @param resourceId - Resource ID from createWhipSession.
|
|
258
|
+
*/
|
|
259
|
+
closeWhipSession(roomId: string, resourceId: string): Promise<void>;
|
|
147
260
|
}
|
|
148
261
|
/**
|
|
149
262
|
* Create a server-mode Hall module that connects to the Hall standalone server.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/modules/hall/server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/modules/hall/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,KAAK,EACV,qBAAqB,EACrB,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,cAAc,EAEd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,WAAW,EACX,iBAAiB,EAoBlB,MAAM,YAAY,CAAA;AAInB,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;AAGrC;;;;;GAKG;AACH,qBAAa,YAAa,YAAW,QAAQ;;IAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;gBAoBd,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAK7C,EAAE,CAAC,CAAC,SAAS,MAAM,cAAc,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IAKzF,GAAG,CAAC,CAAC,SAAS,MAAM,cAAc,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC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