@appsocom/node 0.0.0-stage → 0.6.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/LICENSE +21 -0
- package/README.md +42 -2
- package/dist/index.d.ts +407 -0
- package/dist/index.js +445 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Appsotech Limited
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @appsocom/node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node.js server SDK for [Appsocom Live](https://live.appsocom.com): mint join tokens, manage rooms and participants, moderate, record and verify webhooks. Node 18+, no runtime dependencies.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @appsocom/node
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { SfuKit, verifyWebhook } from "@appsocom/node";
|
|
11
|
+
|
|
12
|
+
const kit = new SfuKit({
|
|
13
|
+
url: "https://api.appsocom.dev",
|
|
14
|
+
adminKey: process.env.APPSOCOM_API_KEY!, // your project's API key, from the console
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const { token } = await kit.createToken({ roomId: "class-1", userId: "u_7", name: "Ada", role: "student", metadata: { seat: 3 } });
|
|
18
|
+
|
|
19
|
+
await kit.setRole("class-1", "u_9", "student"); // promote an observer
|
|
20
|
+
await kit.mute("class-1", "*", ["mic"], { lock: true }); // mute everyone, keep them muted
|
|
21
|
+
await kit.setRoomMetadata("class-1", { topic: "Fractions" });
|
|
22
|
+
await kit.setTrackPermissions("class-1", "u_7", { allowAll: false, allow: [{ userId: "u_1" }] });
|
|
23
|
+
await kit.removeParticipant("class-1", "u_8", { ban: true });
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Errors are `SfuKitError` with `status` (401 wrong key, 400 bad input, 404 …) and the parsed `body`.
|
|
27
|
+
|
|
28
|
+
Webhooks (Express):
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
app.post("/appsocom-webhooks", express.text({ type: "*/*" }), (req, res) => {
|
|
32
|
+
const event = verifyWebhook(process.env.APPSOCOM_WEBHOOK_SECRET!, req.body, req.get("x-sfukit-signature"));
|
|
33
|
+
if (!event) return res.sendStatus(401);
|
|
34
|
+
// event.event: room_started | room_finished | participant_joined | participant_left | track_published | track_unpublished
|
|
35
|
+
res.sendStatus(204);
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
All methods: `createToken`, `getRoom`, `listParticipants`, `updateRoom`, `setRoomMetadata`, `lockRoom`, `closeRoom`, `updateParticipant`, `setPermissions`, `setRole`, `setParticipantMetadata`, `setTrackPermissions`, `removeParticipant`, `unban`, `mute`, `admit`, `postChat`, `lowerHands`, `getAttendance`, `getAttendanceCsv`, `clearAttendance`, `startBreakouts`, `endBreakouts`, `moveToGroup`, `health`, and `request()` for anything else. Standalone: `signToken`, `verifyWebhook`, `signWebhook`.
|
|
40
|
+
|
|
41
|
+
Self-hosting your own deployment instead? Point `url` at it and pass its admin key; the optional `jwtSecret` signs tokens locally without an HTTP call.
|
|
42
|
+
|
|
43
|
+
Docs: [docs.appsocom.dev](https://docs.appsocom.dev) · License: MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import type { Device, Participant, Permissions, RoomState, TrackKind, TrackPermissions } from "@appsocom/protocol";
|
|
2
|
+
export type { Device, Participant, Permissions, RoomState, TrackKind, TrackPermissions };
|
|
3
|
+
export interface SfuKitOptions {
|
|
4
|
+
/** Where the kit's Worker routes live, e.g. "https://video.client.com". */
|
|
5
|
+
url: string;
|
|
6
|
+
/** The deployment's ADMIN_API_KEY (keep it on the server). */
|
|
7
|
+
adminKey: string;
|
|
8
|
+
/**
|
|
9
|
+
* The deployment's JWT_SECRET. When set, createToken() signs tokens locally
|
|
10
|
+
* (no HTTP call). Otherwise it calls POST /tokens.
|
|
11
|
+
*/
|
|
12
|
+
jwtSecret?: string;
|
|
13
|
+
/** Per-request timeout in ms. Default 10000. */
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
/** Custom fetch (tests, proxies). Default globalThis.fetch. */
|
|
16
|
+
fetch?: typeof fetch;
|
|
17
|
+
}
|
|
18
|
+
export interface TokenRequest {
|
|
19
|
+
roomId: string;
|
|
20
|
+
userId: string;
|
|
21
|
+
/** Display name (max 80 chars). Default: userId. */
|
|
22
|
+
name?: string;
|
|
23
|
+
/** "teacher" | "student" | "observer", or any label (1-32 of letters, numbers, . _ -). */
|
|
24
|
+
role?: string;
|
|
25
|
+
/** Override individual permissions. */
|
|
26
|
+
permissions?: Partial<Permissions>;
|
|
27
|
+
/** Older switch: may publish at all? Default true. Ignored for the built-in roles. */
|
|
28
|
+
canPublish?: boolean;
|
|
29
|
+
/** Shared with everyone as participant.metadata (max 4 KB as JSON). */
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
31
|
+
/** Room size limit carried by this token (2-10000; 2 = one-on-one). */
|
|
32
|
+
maxParticipants?: number;
|
|
33
|
+
/** Lifetime in seconds. Default 7200, allowed 60-86400. */
|
|
34
|
+
ttlSeconds?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Data-saver preset the user's client starts with: "low" (360p, speaker
|
|
37
|
+
* video only), "minimal" (180p), "audio" (no camera video) or "off".
|
|
38
|
+
* The user can still change it in the call.
|
|
39
|
+
*/
|
|
40
|
+
dataSaver?: "off" | "low" | "minimal" | "audio";
|
|
41
|
+
/**
|
|
42
|
+
* Must be admitted by a host (moderator): this user waits in the waiting
|
|
43
|
+
* room even when the room's waiting room is off. Use it for people joining
|
|
44
|
+
* with a shared guest link.
|
|
45
|
+
*/
|
|
46
|
+
lobby?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface Token {
|
|
49
|
+
token: string;
|
|
50
|
+
/** Unix seconds. */
|
|
51
|
+
expiresAt: number;
|
|
52
|
+
}
|
|
53
|
+
export interface RoomInfo {
|
|
54
|
+
roomId: string;
|
|
55
|
+
room: RoomState;
|
|
56
|
+
participants: Participant[];
|
|
57
|
+
}
|
|
58
|
+
export interface RoomUpdate {
|
|
59
|
+
locked?: boolean;
|
|
60
|
+
chat?: boolean;
|
|
61
|
+
waitingRoom?: boolean;
|
|
62
|
+
/** userIds to show large, in order (max 6). */
|
|
63
|
+
spotlight?: string[];
|
|
64
|
+
/** Replaces the room's metadata; null clears it. */
|
|
65
|
+
metadata?: Record<string, unknown> | null;
|
|
66
|
+
}
|
|
67
|
+
export interface ParticipantUpdate {
|
|
68
|
+
/** New role; built-in roles reset permissions to that role's defaults (plus `permissions`). */
|
|
69
|
+
role?: string;
|
|
70
|
+
/** Change permissions; null drops earlier changes (back to the token's). */
|
|
71
|
+
permissions?: Partial<Permissions> | null;
|
|
72
|
+
/** New display name (1-80 chars). */
|
|
73
|
+
name?: string;
|
|
74
|
+
/** Replaces their metadata; null clears it. */
|
|
75
|
+
metadata?: Record<string, unknown> | null;
|
|
76
|
+
/** Who may receive their tracks; null = everyone. */
|
|
77
|
+
trackPermissions?: TrackPermissions | null;
|
|
78
|
+
}
|
|
79
|
+
export interface RecordingOptions {
|
|
80
|
+
/** Record audio + video with the recorder bot (kit deployed with wrangler.video.jsonc). */
|
|
81
|
+
video?: boolean;
|
|
82
|
+
/** Video: also render composite.mp4 after stopping (default true). */
|
|
83
|
+
composite?: boolean;
|
|
84
|
+
/** Video: stop after this many minutes (default 360). */
|
|
85
|
+
maxMinutes?: number;
|
|
86
|
+
}
|
|
87
|
+
export interface Recording {
|
|
88
|
+
id: string;
|
|
89
|
+
startedAt: number;
|
|
90
|
+
startedBy: string;
|
|
91
|
+
[key: string]: unknown;
|
|
92
|
+
}
|
|
93
|
+
export interface RecordingManifest {
|
|
94
|
+
roomId: string;
|
|
95
|
+
recordingId: string;
|
|
96
|
+
stopReason: string;
|
|
97
|
+
files: {
|
|
98
|
+
key: string;
|
|
99
|
+
userId?: string;
|
|
100
|
+
kind?: string;
|
|
101
|
+
durationMs?: number;
|
|
102
|
+
bytes?: number;
|
|
103
|
+
}[];
|
|
104
|
+
errors: unknown[];
|
|
105
|
+
manifestKey: string;
|
|
106
|
+
[key: string]: unknown;
|
|
107
|
+
}
|
|
108
|
+
export interface BreakoutGroupInput {
|
|
109
|
+
name?: string;
|
|
110
|
+
userIds: string[];
|
|
111
|
+
}
|
|
112
|
+
export type WebhookEventName = "room_started" | "room_finished" | "participant_joined" | "participant_left" | "track_published" | "track_unpublished";
|
|
113
|
+
export interface WebhookEvent {
|
|
114
|
+
id: string;
|
|
115
|
+
event: WebhookEventName;
|
|
116
|
+
roomId: string;
|
|
117
|
+
createdAt: number;
|
|
118
|
+
seq: number;
|
|
119
|
+
participant?: {
|
|
120
|
+
id: string;
|
|
121
|
+
userId: string;
|
|
122
|
+
name: string;
|
|
123
|
+
role: string;
|
|
124
|
+
metadata?: Record<string, unknown>;
|
|
125
|
+
};
|
|
126
|
+
track?: {
|
|
127
|
+
kind: TrackKind;
|
|
128
|
+
trackName: string;
|
|
129
|
+
sessionId: string;
|
|
130
|
+
};
|
|
131
|
+
reason?: string;
|
|
132
|
+
}
|
|
133
|
+
/** A non-2xx answer from the kit. */
|
|
134
|
+
/** What startLesson takes (see the lessons guide for every field). */
|
|
135
|
+
export interface LessonStartOptions {
|
|
136
|
+
mode?: "tutor" | "class";
|
|
137
|
+
/** An approved plan from the lesson library (its newest approved version, or planVersion). */
|
|
138
|
+
planId?: string;
|
|
139
|
+
planVersion?: number;
|
|
140
|
+
/** Teach in: "en", "pcm" or "fr". */
|
|
141
|
+
language?: string;
|
|
142
|
+
/** "lesson" (default), "practice" (exam practice, with `exam`) or "presentation" (AI Presenter). */
|
|
143
|
+
style?: "lesson" | "practice" | "presentation";
|
|
144
|
+
exam?: {
|
|
145
|
+
board: "WAEC" | "NECO" | "JAMB" | "BECE" | "NABTEB";
|
|
146
|
+
subject: string;
|
|
147
|
+
year?: string;
|
|
148
|
+
};
|
|
149
|
+
/** Email the full report to teachers, and each learner's part to their parents (userId → emails). */
|
|
150
|
+
reportEmails?: string[];
|
|
151
|
+
guardianEmails?: Record<string, string[]>;
|
|
152
|
+
/** A written plan. With "Require review before teaching" on (the default), use planId instead. */
|
|
153
|
+
lesson?: {
|
|
154
|
+
title: string;
|
|
155
|
+
subject?: string;
|
|
156
|
+
level?: string;
|
|
157
|
+
curriculum?: string;
|
|
158
|
+
audience?: string;
|
|
159
|
+
objectives?: (string | {
|
|
160
|
+
id: string;
|
|
161
|
+
text: string;
|
|
162
|
+
})[];
|
|
163
|
+
sections?: {
|
|
164
|
+
title: string;
|
|
165
|
+
content?: string;
|
|
166
|
+
minutes?: number;
|
|
167
|
+
slides?: {
|
|
168
|
+
title: string;
|
|
169
|
+
bullets?: string[];
|
|
170
|
+
imageUrl?: string;
|
|
171
|
+
notes?: string;
|
|
172
|
+
}[];
|
|
173
|
+
questions?: {
|
|
174
|
+
id?: string;
|
|
175
|
+
question: string;
|
|
176
|
+
options: string[];
|
|
177
|
+
answer: number;
|
|
178
|
+
explanation?: string;
|
|
179
|
+
objective?: string;
|
|
180
|
+
}[];
|
|
181
|
+
}[];
|
|
182
|
+
text?: string;
|
|
183
|
+
};
|
|
184
|
+
learnerId?: string;
|
|
185
|
+
learnerUserId?: string;
|
|
186
|
+
floor?: "hands" | "teacher" | "off";
|
|
187
|
+
scope?: "strict" | "guided" | "open";
|
|
188
|
+
maxMinutes?: number;
|
|
189
|
+
strokes?: boolean;
|
|
190
|
+
name?: string;
|
|
191
|
+
instructions?: string;
|
|
192
|
+
llmModel?: string;
|
|
193
|
+
voice?: string;
|
|
194
|
+
tts?: string;
|
|
195
|
+
avatar?: {
|
|
196
|
+
provider: string;
|
|
197
|
+
id: string;
|
|
198
|
+
} | null;
|
|
199
|
+
[key: string]: unknown;
|
|
200
|
+
}
|
|
201
|
+
export declare class SfuKitError extends Error {
|
|
202
|
+
readonly status: number;
|
|
203
|
+
readonly body: unknown;
|
|
204
|
+
constructor(status: number, message: string, body: unknown);
|
|
205
|
+
}
|
|
206
|
+
export declare class SfuKit {
|
|
207
|
+
#private;
|
|
208
|
+
readonly url: string;
|
|
209
|
+
constructor(options: SfuKitOptions);
|
|
210
|
+
/** Mint a join token: signed locally if jwtSecret was given, else via POST /tokens. */
|
|
211
|
+
createToken(req: TokenRequest): Promise<Token>;
|
|
212
|
+
/** Participants and room settings (locked, chat, spotlight, metadata…). */
|
|
213
|
+
getRoom(roomId: string): Promise<RoomInfo>;
|
|
214
|
+
listParticipants(roomId: string): Promise<Participant[]>;
|
|
215
|
+
/** Change room settings and/or metadata. Returns the new settings. */
|
|
216
|
+
updateRoom(roomId: string, update: RoomUpdate): Promise<RoomState>;
|
|
217
|
+
setRoomMetadata(roomId: string, metadata: Record<string, unknown> | null): Promise<RoomState>;
|
|
218
|
+
lockRoom(roomId: string, locked?: boolean): Promise<RoomState>;
|
|
219
|
+
/** Disconnect everyone and end the room. Returns how many connections were closed. */
|
|
220
|
+
closeRoom(roomId: string): Promise<number>;
|
|
221
|
+
/** Role, permissions, name, metadata and/or track permissions in one call. Returns connections updated. */
|
|
222
|
+
updateParticipant(roomId: string, userId: string, update: ParticipantUpdate): Promise<number>;
|
|
223
|
+
setPermissions(roomId: string, userId: string, permissions: Partial<Permissions> | null): Promise<number>;
|
|
224
|
+
/** e.g. promote an observer: setRole(room, user, "student"). */
|
|
225
|
+
setRole(roomId: string, userId: string, role: string, permissions?: Partial<Permissions>): Promise<number>;
|
|
226
|
+
setParticipantMetadata(roomId: string, userId: string, metadata: Record<string, unknown> | null): Promise<number>;
|
|
227
|
+
setTrackPermissions(roomId: string, userId: string, trackPermissions: TrackPermissions | null): Promise<number>;
|
|
228
|
+
/** Disconnect a user (all their tabs). `ban` keeps them out until the room empties. */
|
|
229
|
+
removeParticipant(roomId: string, userId: string, options?: {
|
|
230
|
+
ban?: boolean;
|
|
231
|
+
}): Promise<number>;
|
|
232
|
+
unban(roomId: string, userId: string): Promise<boolean>;
|
|
233
|
+
/** Turn off devices of one user, or of everyone without `moderate` ("*"). `lock` also takes the permission away. */
|
|
234
|
+
mute(roomId: string, userId: string | "*", devices?: Device[], options?: {
|
|
235
|
+
lock?: boolean;
|
|
236
|
+
}): Promise<number>;
|
|
237
|
+
/** Let someone (or "*" = everyone) in from the waiting room. */
|
|
238
|
+
admit(roomId: string, userId: string | "*"): Promise<number>;
|
|
239
|
+
/** Post a chat message as the host; `to` makes it private. */
|
|
240
|
+
postChat(roomId: string, text: string, options?: {
|
|
241
|
+
to?: string;
|
|
242
|
+
}): Promise<unknown>;
|
|
243
|
+
/** Lower one user's hand, or everyone's. */
|
|
244
|
+
lowerHands(roomId: string, userId?: string): Promise<number>;
|
|
245
|
+
getAttendance(roomId: string): Promise<unknown>;
|
|
246
|
+
/** Attendance as CSV text (one row per user). */
|
|
247
|
+
getAttendanceCsv(roomId: string): Promise<string>;
|
|
248
|
+
clearAttendance(roomId: string): Promise<void>;
|
|
249
|
+
startBreakouts(roomId: string, groups: BreakoutGroupInput[]): Promise<{
|
|
250
|
+
id: string;
|
|
251
|
+
name: string;
|
|
252
|
+
userIds: string[];
|
|
253
|
+
}[]>;
|
|
254
|
+
endBreakouts(roomId: string): Promise<void>;
|
|
255
|
+
/** Move a user to a breakout group (null = main room). */
|
|
256
|
+
moveToGroup(roomId: string, userId: string, group: string | null): Promise<number>;
|
|
257
|
+
/** Start recording to R2. `video: true` records audio + video with the recorder bot. */
|
|
258
|
+
startRecording(roomId: string, options?: RecordingOptions): Promise<Recording>;
|
|
259
|
+
/** The recording in progress, or null. */
|
|
260
|
+
recordingStatus(roomId: string): Promise<Recording | null>;
|
|
261
|
+
/** Stop recording; returns the manifest (files in R2). 404 if nothing is recording. */
|
|
262
|
+
stopRecording(roomId: string): Promise<RecordingManifest>;
|
|
263
|
+
/** Finished recordings of a room, newest first. */
|
|
264
|
+
listRecordings(roomId: string): Promise<{
|
|
265
|
+
recordingId: string;
|
|
266
|
+
files: {
|
|
267
|
+
file: string;
|
|
268
|
+
size: number;
|
|
269
|
+
uploaded: string;
|
|
270
|
+
}[];
|
|
271
|
+
}[]>;
|
|
272
|
+
/** Download one recording file (WAV or WebM). */
|
|
273
|
+
downloadRecording(roomId: string, recordingId: string, file: string): Promise<ArrayBuffer>;
|
|
274
|
+
/**
|
|
275
|
+
* Start an AI lesson in a room. `options.mode`: "tutor" (one learner) or "class";
|
|
276
|
+
* `options.lesson`: { title, subject?, level?, curriculum?, objectives?, sections? | text? };
|
|
277
|
+
* plus learnerId, floor ("hands" | "teacher" | "off"), scope ("strict" | "guided" | "open"),
|
|
278
|
+
* maxMinutes, llmModel, voice, avatar, instructions. Returns the lesson id.
|
|
279
|
+
*/
|
|
280
|
+
startLesson(roomId: string, options: LessonStartOptions): Promise<{
|
|
281
|
+
lessonId: string;
|
|
282
|
+
agentId: string;
|
|
283
|
+
participant: Participant;
|
|
284
|
+
}>;
|
|
285
|
+
/** The live state of a running lesson (slide, board, floor, quiz, timer). */
|
|
286
|
+
getLesson(roomId: string, lessonId: string): Promise<Record<string, unknown>>;
|
|
287
|
+
/** Steer a lesson: { action: "pause" | "resume" | "end" }, { action: "goto", section }, { action: "call-on", userId }, { action: "scope", scope }, { action: "note", text }… */
|
|
288
|
+
controlLesson(roomId: string, lessonId: string, control: Record<string, unknown> & {
|
|
289
|
+
action: string;
|
|
290
|
+
}): Promise<void>;
|
|
291
|
+
/** Stop a lesson; its report is written. */
|
|
292
|
+
stopLesson(roomId: string, lessonId: string): Promise<void>;
|
|
293
|
+
/** A finished lesson's report: summary, per-learner results and feedback, alerts, transcript. */
|
|
294
|
+
lessonReport(lessonId: string): Promise<Record<string, unknown>>;
|
|
295
|
+
/** A tutor learner's saved progress (objectives met or weak, notes, past lessons). */
|
|
296
|
+
learnerProgress(learnerId: string): Promise<Record<string, unknown>>;
|
|
297
|
+
/** Forget a learner's saved progress. */
|
|
298
|
+
deleteLearnerProgress(learnerId: string): Promise<void>;
|
|
299
|
+
/** Project lesson settings: { requireReview, defaults }. */
|
|
300
|
+
lessonSettings(): Promise<{
|
|
301
|
+
requireReview: boolean;
|
|
302
|
+
defaults?: Record<string, unknown>;
|
|
303
|
+
}>;
|
|
304
|
+
/** Change lesson settings. requireReview (on by default): only approved plans can be taught. */
|
|
305
|
+
setLessonSettings(settings: {
|
|
306
|
+
requireReview?: boolean;
|
|
307
|
+
defaults?: Record<string, unknown> | null;
|
|
308
|
+
}): Promise<{
|
|
309
|
+
requireReview: boolean;
|
|
310
|
+
defaults?: Record<string, unknown>;
|
|
311
|
+
}>;
|
|
312
|
+
/** Lesson plans in the library; status: "draft" | "approved" | "archived". */
|
|
313
|
+
listLessonPlans(status?: "draft" | "approved" | "archived"): Promise<{
|
|
314
|
+
plans: Record<string, unknown>[];
|
|
315
|
+
}>;
|
|
316
|
+
/**
|
|
317
|
+
* Add a lesson plan. Either a written `plan` (saved as a draft), or material for the AI to
|
|
318
|
+
* draft from: `text`, `link` (Google Docs/Slides), `topic`, `curriculum`, `exam`. AI drafts
|
|
319
|
+
* come back with draftState "processing"; the lesson_plan_ready webhook says when they're done.
|
|
320
|
+
*/
|
|
321
|
+
createLessonPlan(input: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
322
|
+
/**
|
|
323
|
+
* Upload files (PDF, .docx, .pptx, text, Markdown, HTML, RTF, photos) for the AI to draft one
|
|
324
|
+
* lesson from. `fields` are the same options as createLessonPlan (topic, level, language…).
|
|
325
|
+
*/
|
|
326
|
+
uploadLessonMaterial(files: {
|
|
327
|
+
name: string;
|
|
328
|
+
data: Blob | ArrayBuffer | Uint8Array;
|
|
329
|
+
type?: string;
|
|
330
|
+
}[], fields?: Record<string, string | number>): Promise<Record<string, unknown>>;
|
|
331
|
+
getLessonPlan(planId: string): Promise<Record<string, unknown>>;
|
|
332
|
+
/** Edit a plan. An approved plan keeps teaching its approved version until you approve again. */
|
|
333
|
+
updateLessonPlan(planId: string, changes: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
334
|
+
/** Ask the AI to change a plan, e.g. "make section 2 simpler". */
|
|
335
|
+
reviseLessonPlan(planId: string, instruction: string): Promise<Record<string, unknown>>;
|
|
336
|
+
/** Approve the plan as it is now (a new version). Only approved plans are taught. */
|
|
337
|
+
approveLessonPlan(planId: string): Promise<Record<string, unknown>>;
|
|
338
|
+
lessonPlanVersions(planId: string): Promise<{
|
|
339
|
+
versions: Record<string, unknown>[];
|
|
340
|
+
}>;
|
|
341
|
+
/** A 5-minute tutor run of the plan as it is now (even unapproved), with no reports or emails. */
|
|
342
|
+
trialLessonPlan(planId: string, options?: {
|
|
343
|
+
roomId?: string;
|
|
344
|
+
model?: string;
|
|
345
|
+
}): Promise<{
|
|
346
|
+
roomId: string;
|
|
347
|
+
lessonId: string;
|
|
348
|
+
}>;
|
|
349
|
+
archiveLessonPlan(planId: string): Promise<void>;
|
|
350
|
+
listCourses(): Promise<{
|
|
351
|
+
courses: Record<string, unknown>[];
|
|
352
|
+
}>;
|
|
353
|
+
/** Create a course ({ title, subject?, level?, plans: planIds in order }), or update one with its id. */
|
|
354
|
+
saveCourse(course: Record<string, unknown> & {
|
|
355
|
+
id?: string;
|
|
356
|
+
}): Promise<Record<string, unknown>>;
|
|
357
|
+
deleteCourse(courseId: string): Promise<void>;
|
|
358
|
+
listTimetables(): Promise<{
|
|
359
|
+
timetables: Record<string, unknown>[];
|
|
360
|
+
}>;
|
|
361
|
+
/**
|
|
362
|
+
* Create a timetable, or update one with its id: { name, timeZone, termStart, termEnd, holidays,
|
|
363
|
+
* slots: [{ days, start: "HH:MM", minutes, roomId, planId | courseId }], sessions, defaults, active }.
|
|
364
|
+
* Refused (409, with the clashes) when two lessons would share a room; allowClashes saves anyway.
|
|
365
|
+
*/
|
|
366
|
+
saveTimetable(timetable: Record<string, unknown> & {
|
|
367
|
+
id?: string;
|
|
368
|
+
}, options?: {
|
|
369
|
+
allowClashes?: boolean;
|
|
370
|
+
}): Promise<Record<string, unknown>>;
|
|
371
|
+
deleteTimetable(timetableId: string): Promise<void>;
|
|
372
|
+
/** Scheduled lessons in the next `days` days (default 7), with their status. */
|
|
373
|
+
timetableRuns(options?: {
|
|
374
|
+
days?: number;
|
|
375
|
+
timetableId?: string;
|
|
376
|
+
}): Promise<{
|
|
377
|
+
runs: Record<string, unknown>[];
|
|
378
|
+
}>;
|
|
379
|
+
/** Start a scheduled lesson now, or skip it. */
|
|
380
|
+
startTimetableRun(key: string): Promise<Record<string, unknown>>;
|
|
381
|
+
skipTimetableRun(key: string): Promise<Record<string, unknown>>;
|
|
382
|
+
health(): Promise<Record<string, unknown>>;
|
|
383
|
+
/** Call any admin endpoint (for routes this SDK doesn't wrap yet). */
|
|
384
|
+
request<T = unknown>(method: string, path: string, body?: unknown, as?: "json" | "text" | "bytes"): Promise<T>;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Sign a join token with the deployment's JWT_SECRET, without calling the kit.
|
|
388
|
+
* Produces exactly what POST /tokens would (HS256, audience "sfukit").
|
|
389
|
+
*/
|
|
390
|
+
export declare function signToken(jwtSecret: string, req: TokenRequest): Token;
|
|
391
|
+
export declare const SIGNATURE_HEADER = "x-sfukit-signature";
|
|
392
|
+
/**
|
|
393
|
+
* Check a webhook delivery. Pass the RAW request body (not re-serialized JSON)
|
|
394
|
+
* and the X-SfuKit-Signature header. `secret` is the deployment's
|
|
395
|
+
* WEBHOOK_SECRET (or ADMIN_API_KEY if none was set). Returns the event, or
|
|
396
|
+
* null if the signature is wrong or older than `toleranceSeconds`.
|
|
397
|
+
*
|
|
398
|
+
* app.post("/sfukit-webhooks", express.text({ type: "*\/*" }), (req, res) => {
|
|
399
|
+
* const event = verifyWebhook(process.env.SFUKIT_WEBHOOK_SECRET!, req.body, req.get("x-sfukit-signature"));
|
|
400
|
+
* if (!event) return res.sendStatus(401);
|
|
401
|
+
* …
|
|
402
|
+
* res.sendStatus(204);
|
|
403
|
+
* });
|
|
404
|
+
*/
|
|
405
|
+
export declare function verifyWebhook(secret: string, rawBody: string | Buffer, signatureHeader: string | null | undefined, toleranceSeconds?: number): WebhookEvent | null;
|
|
406
|
+
/** Build a signature header (for tests of your webhook endpoint). */
|
|
407
|
+
export declare function signWebhook(secret: string, rawBody: string, t?: number): string;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @appsocom/node: server SDK for apps that use an sfukit deployment.
|
|
3
|
+
*
|
|
4
|
+
* import { SfuKit, verifyWebhook } from "@appsocom/node";
|
|
5
|
+
* const kit = new SfuKit({ url: process.env.SFUKIT_URL!, adminKey: process.env.SFUKIT_ADMIN_API_KEY! });
|
|
6
|
+
* const { token } = await kit.createToken({ roomId: "class-1", userId: "u_7", name: "Ada", role: "student" });
|
|
7
|
+
*
|
|
8
|
+
* Zero dependencies at runtime: uses Node's fetch (18+) and node:crypto.
|
|
9
|
+
*/
|
|
10
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
11
|
+
export class SfuKitError extends Error {
|
|
12
|
+
status;
|
|
13
|
+
body;
|
|
14
|
+
constructor(status, message, body) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.status = status;
|
|
17
|
+
this.body = body;
|
|
18
|
+
this.name = "SfuKitError";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const ID = /^[A-Za-z0-9._:@-]{1,128}$/;
|
|
22
|
+
const ROLE = /^[A-Za-z0-9._-]{1,32}$/;
|
|
23
|
+
const ROLE_DEFAULTS = {
|
|
24
|
+
teacher: { mic: true, camera: true, screen: true, moderate: true },
|
|
25
|
+
student: { mic: true, camera: true, screen: false, moderate: false },
|
|
26
|
+
observer: { mic: false, camera: false, screen: false, moderate: false },
|
|
27
|
+
};
|
|
28
|
+
export class SfuKit {
|
|
29
|
+
url;
|
|
30
|
+
#adminKey;
|
|
31
|
+
#jwtSecret;
|
|
32
|
+
#timeoutMs;
|
|
33
|
+
#fetch;
|
|
34
|
+
constructor(options) {
|
|
35
|
+
if (!options.url)
|
|
36
|
+
throw new Error("url is required");
|
|
37
|
+
if (!options.adminKey)
|
|
38
|
+
throw new Error("adminKey is required");
|
|
39
|
+
this.url = options.url.replace(/\/+$/, "");
|
|
40
|
+
this.#adminKey = options.adminKey;
|
|
41
|
+
this.#jwtSecret = options.jwtSecret;
|
|
42
|
+
this.#timeoutMs = options.timeoutMs ?? 10_000;
|
|
43
|
+
this.#fetch = options.fetch ?? globalThis.fetch;
|
|
44
|
+
}
|
|
45
|
+
// ---------- tokens ----------
|
|
46
|
+
/** Mint a join token: signed locally if jwtSecret was given, else via POST /tokens. */
|
|
47
|
+
async createToken(req) {
|
|
48
|
+
if (this.#jwtSecret)
|
|
49
|
+
return signToken(this.#jwtSecret, req);
|
|
50
|
+
return this.request("POST", "/tokens", req);
|
|
51
|
+
}
|
|
52
|
+
// ---------- rooms ----------
|
|
53
|
+
/** Participants and room settings (locked, chat, spotlight, metadata…). */
|
|
54
|
+
async getRoom(roomId) {
|
|
55
|
+
return this.request("GET", `/rooms/${id(roomId)}`);
|
|
56
|
+
}
|
|
57
|
+
async listParticipants(roomId) {
|
|
58
|
+
return (await this.getRoom(roomId)).participants;
|
|
59
|
+
}
|
|
60
|
+
/** Change room settings and/or metadata. Returns the new settings. */
|
|
61
|
+
async updateRoom(roomId, update) {
|
|
62
|
+
return (await this.request("PATCH", `/rooms/${id(roomId)}`, update)).room;
|
|
63
|
+
}
|
|
64
|
+
async setRoomMetadata(roomId, metadata) {
|
|
65
|
+
return this.updateRoom(roomId, { metadata });
|
|
66
|
+
}
|
|
67
|
+
async lockRoom(roomId, locked = true) {
|
|
68
|
+
return this.updateRoom(roomId, { locked });
|
|
69
|
+
}
|
|
70
|
+
/** Disconnect everyone and end the room. Returns how many connections were closed. */
|
|
71
|
+
async closeRoom(roomId) {
|
|
72
|
+
return (await this.request("DELETE", `/rooms/${id(roomId)}`)).disconnected;
|
|
73
|
+
}
|
|
74
|
+
// ---------- participants ----------
|
|
75
|
+
/** Role, permissions, name, metadata and/or track permissions in one call. Returns connections updated. */
|
|
76
|
+
async updateParticipant(roomId, userId, update) {
|
|
77
|
+
return (await this.request("PATCH", `/rooms/${id(roomId)}/participants/${id(userId)}`, update)).updated;
|
|
78
|
+
}
|
|
79
|
+
async setPermissions(roomId, userId, permissions) {
|
|
80
|
+
return this.updateParticipant(roomId, userId, { permissions });
|
|
81
|
+
}
|
|
82
|
+
/** e.g. promote an observer: setRole(room, user, "student"). */
|
|
83
|
+
async setRole(roomId, userId, role, permissions) {
|
|
84
|
+
return this.updateParticipant(roomId, userId, { role, ...(permissions ? { permissions } : {}) });
|
|
85
|
+
}
|
|
86
|
+
async setParticipantMetadata(roomId, userId, metadata) {
|
|
87
|
+
return this.updateParticipant(roomId, userId, { metadata });
|
|
88
|
+
}
|
|
89
|
+
async setTrackPermissions(roomId, userId, trackPermissions) {
|
|
90
|
+
return this.updateParticipant(roomId, userId, { trackPermissions });
|
|
91
|
+
}
|
|
92
|
+
/** Disconnect a user (all their tabs). `ban` keeps them out until the room empties. */
|
|
93
|
+
async removeParticipant(roomId, userId, options = {}) {
|
|
94
|
+
const q = options.ban ? "?ban=true" : "";
|
|
95
|
+
return (await this.request("DELETE", `/rooms/${id(roomId)}/participants/${id(userId)}${q}`)).disconnected;
|
|
96
|
+
}
|
|
97
|
+
async unban(roomId, userId) {
|
|
98
|
+
return (await this.request("DELETE", `/rooms/${id(roomId)}/bans/${id(userId)}`)).removed;
|
|
99
|
+
}
|
|
100
|
+
/** Turn off devices of one user, or of everyone without `moderate` ("*"). `lock` also takes the permission away. */
|
|
101
|
+
async mute(roomId, userId, devices = ["mic"], options = {}) {
|
|
102
|
+
return (await this.request("POST", `/rooms/${id(roomId)}/mute`, { userId, devices, lock: options.lock === true })).muted;
|
|
103
|
+
}
|
|
104
|
+
// ---------- classroom features ----------
|
|
105
|
+
/** Let someone (or "*" = everyone) in from the waiting room. */
|
|
106
|
+
async admit(roomId, userId) {
|
|
107
|
+
return (await this.request("POST", `/rooms/${id(roomId)}/admit`, { userId })).admitted;
|
|
108
|
+
}
|
|
109
|
+
/** Post a chat message as the host; `to` makes it private. */
|
|
110
|
+
async postChat(roomId, text, options = {}) {
|
|
111
|
+
return (await this.request("POST", `/rooms/${id(roomId)}/chat`, { text, ...options })).message;
|
|
112
|
+
}
|
|
113
|
+
/** Lower one user's hand, or everyone's. */
|
|
114
|
+
async lowerHands(roomId, userId) {
|
|
115
|
+
if (userId)
|
|
116
|
+
return (await this.request("DELETE", `/rooms/${id(roomId)}/hands/${id(userId)}`)).updated;
|
|
117
|
+
return (await this.request("DELETE", `/rooms/${id(roomId)}/hands`)).lowered;
|
|
118
|
+
}
|
|
119
|
+
async getAttendance(roomId) {
|
|
120
|
+
return this.request("GET", `/rooms/${id(roomId)}/attendance`);
|
|
121
|
+
}
|
|
122
|
+
/** Attendance as CSV text (one row per user). */
|
|
123
|
+
async getAttendanceCsv(roomId) {
|
|
124
|
+
return this.request("GET", `/rooms/${id(roomId)}/attendance?format=csv`, undefined, "text");
|
|
125
|
+
}
|
|
126
|
+
async clearAttendance(roomId) {
|
|
127
|
+
await this.request("DELETE", `/rooms/${id(roomId)}/attendance`);
|
|
128
|
+
}
|
|
129
|
+
async startBreakouts(roomId, groups) {
|
|
130
|
+
return (await this.request("PUT", `/rooms/${id(roomId)}/breakouts`, { groups })).groups;
|
|
131
|
+
}
|
|
132
|
+
async endBreakouts(roomId) {
|
|
133
|
+
await this.request("DELETE", `/rooms/${id(roomId)}/breakouts`);
|
|
134
|
+
}
|
|
135
|
+
/** Move a user to a breakout group (null = main room). */
|
|
136
|
+
async moveToGroup(roomId, userId, group) {
|
|
137
|
+
return (await this.request("POST", `/rooms/${id(roomId)}/move`, { userId, group })).moved;
|
|
138
|
+
}
|
|
139
|
+
// ---------- recording (needs the kit's STORAGE bucket; video needs the recorder bot) ----------
|
|
140
|
+
/** Start recording to R2. `video: true` records audio + video with the recorder bot. */
|
|
141
|
+
async startRecording(roomId, options = {}) {
|
|
142
|
+
return (await this.request("POST", `/rooms/${id(roomId)}/recording`, options)).recording;
|
|
143
|
+
}
|
|
144
|
+
/** The recording in progress, or null. */
|
|
145
|
+
async recordingStatus(roomId) {
|
|
146
|
+
return (await this.request("GET", `/rooms/${id(roomId)}/recording`)).recording;
|
|
147
|
+
}
|
|
148
|
+
/** Stop recording; returns the manifest (files in R2). 404 if nothing is recording. */
|
|
149
|
+
async stopRecording(roomId) {
|
|
150
|
+
return this.request("DELETE", `/rooms/${id(roomId)}/recording`);
|
|
151
|
+
}
|
|
152
|
+
/** Finished recordings of a room, newest first. */
|
|
153
|
+
async listRecordings(roomId) {
|
|
154
|
+
return (await this.request("GET", `/rooms/${id(roomId)}/recordings`)).recordings;
|
|
155
|
+
}
|
|
156
|
+
/** Download one recording file (WAV or WebM). */
|
|
157
|
+
async downloadRecording(roomId, recordingId, file) {
|
|
158
|
+
return this.request("GET", `/rooms/${id(roomId)}/recordings/${encodeURIComponent(recordingId)}/${encodeURIComponent(file)}`, undefined, "bytes");
|
|
159
|
+
}
|
|
160
|
+
// ---------- AI lessons (an AI tutor, or an AI-taught class) ----------
|
|
161
|
+
/**
|
|
162
|
+
* Start an AI lesson in a room. `options.mode`: "tutor" (one learner) or "class";
|
|
163
|
+
* `options.lesson`: { title, subject?, level?, curriculum?, objectives?, sections? | text? };
|
|
164
|
+
* plus learnerId, floor ("hands" | "teacher" | "off"), scope ("strict" | "guided" | "open"),
|
|
165
|
+
* maxMinutes, llmModel, voice, avatar, instructions. Returns the lesson id.
|
|
166
|
+
*/
|
|
167
|
+
async startLesson(roomId, options) {
|
|
168
|
+
return this.request("POST", `/rooms/${id(roomId)}/lessons`, options);
|
|
169
|
+
}
|
|
170
|
+
/** The live state of a running lesson (slide, board, floor, quiz, timer). */
|
|
171
|
+
async getLesson(roomId, lessonId) {
|
|
172
|
+
return this.request("GET", `/rooms/${id(roomId)}/lessons/${id(lessonId)}`);
|
|
173
|
+
}
|
|
174
|
+
/** Steer a lesson: { action: "pause" | "resume" | "end" }, { action: "goto", section }, { action: "call-on", userId }, { action: "scope", scope }, { action: "note", text }… */
|
|
175
|
+
async controlLesson(roomId, lessonId, control) {
|
|
176
|
+
await this.request("POST", `/rooms/${id(roomId)}/lessons/${id(lessonId)}/control`, control);
|
|
177
|
+
}
|
|
178
|
+
/** Stop a lesson; its report is written. */
|
|
179
|
+
async stopLesson(roomId, lessonId) {
|
|
180
|
+
await this.request("DELETE", `/rooms/${id(roomId)}/lessons/${id(lessonId)}`);
|
|
181
|
+
}
|
|
182
|
+
/** A finished lesson's report: summary, per-learner results and feedback, alerts, transcript. */
|
|
183
|
+
async lessonReport(lessonId) {
|
|
184
|
+
return this.request("GET", `/lessons/${id(lessonId)}/report`);
|
|
185
|
+
}
|
|
186
|
+
/** A tutor learner's saved progress (objectives met or weak, notes, past lessons). */
|
|
187
|
+
async learnerProgress(learnerId) {
|
|
188
|
+
return this.request("GET", `/learners/${encodeURIComponent(learnerId)}/progress`);
|
|
189
|
+
}
|
|
190
|
+
/** Forget a learner's saved progress. */
|
|
191
|
+
async deleteLearnerProgress(learnerId) {
|
|
192
|
+
await this.request("DELETE", `/learners/${encodeURIComponent(learnerId)}/progress`);
|
|
193
|
+
}
|
|
194
|
+
// ---------- lesson library: drafts, review, courses, timetables ----------
|
|
195
|
+
/** Project lesson settings: { requireReview, defaults }. */
|
|
196
|
+
async lessonSettings() {
|
|
197
|
+
return this.request("GET", "/lesson-settings");
|
|
198
|
+
}
|
|
199
|
+
/** Change lesson settings. requireReview (on by default): only approved plans can be taught. */
|
|
200
|
+
async setLessonSettings(settings) {
|
|
201
|
+
return this.request("PUT", "/lesson-settings", settings);
|
|
202
|
+
}
|
|
203
|
+
/** Lesson plans in the library; status: "draft" | "approved" | "archived". */
|
|
204
|
+
async listLessonPlans(status) {
|
|
205
|
+
return this.request("GET", `/lesson-plans${status ? `?status=${status}` : ""}`);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Add a lesson plan. Either a written `plan` (saved as a draft), or material for the AI to
|
|
209
|
+
* draft from: `text`, `link` (Google Docs/Slides), `topic`, `curriculum`, `exam`. AI drafts
|
|
210
|
+
* come back with draftState "processing"; the lesson_plan_ready webhook says when they're done.
|
|
211
|
+
*/
|
|
212
|
+
async createLessonPlan(input) {
|
|
213
|
+
return this.request("POST", "/lesson-plans", input);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Upload files (PDF, .docx, .pptx, text, Markdown, HTML, RTF, photos) for the AI to draft one
|
|
217
|
+
* lesson from. `fields` are the same options as createLessonPlan (topic, level, language…).
|
|
218
|
+
*/
|
|
219
|
+
async uploadLessonMaterial(files, fields = {}) {
|
|
220
|
+
const form = new FormData();
|
|
221
|
+
for (const f of files)
|
|
222
|
+
form.append("file", f.data instanceof Blob ? f.data : new Blob([f.data], { type: f.type ?? "application/octet-stream" }), f.name);
|
|
223
|
+
for (const [k, v] of Object.entries(fields))
|
|
224
|
+
form.append(k, String(v));
|
|
225
|
+
const res = await this.#fetch(`${this.url}/lesson-plans/upload`, { method: "POST", headers: { Authorization: `Bearer ${this.#adminKey}` }, body: form, signal: AbortSignal.timeout(this.#timeoutMs) });
|
|
226
|
+
const text = await res.text();
|
|
227
|
+
let parsed = text;
|
|
228
|
+
try {
|
|
229
|
+
parsed = JSON.parse(text);
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
// keep text
|
|
233
|
+
}
|
|
234
|
+
if (!res.ok)
|
|
235
|
+
throw new SfuKitError(res.status, `sfukit POST /lesson-plans/upload: ${res.status} ${parsed?.error ?? text}`, parsed);
|
|
236
|
+
return parsed;
|
|
237
|
+
}
|
|
238
|
+
async getLessonPlan(planId) {
|
|
239
|
+
return this.request("GET", `/lesson-plans/${id(planId)}`);
|
|
240
|
+
}
|
|
241
|
+
/** Edit a plan. An approved plan keeps teaching its approved version until you approve again. */
|
|
242
|
+
async updateLessonPlan(planId, changes) {
|
|
243
|
+
return this.request("PUT", `/lesson-plans/${id(planId)}`, changes);
|
|
244
|
+
}
|
|
245
|
+
/** Ask the AI to change a plan, e.g. "make section 2 simpler". */
|
|
246
|
+
async reviseLessonPlan(planId, instruction) {
|
|
247
|
+
return this.request("POST", `/lesson-plans/${id(planId)}/revise`, { instruction });
|
|
248
|
+
}
|
|
249
|
+
/** Approve the plan as it is now (a new version). Only approved plans are taught. */
|
|
250
|
+
async approveLessonPlan(planId) {
|
|
251
|
+
return this.request("POST", `/lesson-plans/${id(planId)}/approve`);
|
|
252
|
+
}
|
|
253
|
+
async lessonPlanVersions(planId) {
|
|
254
|
+
return this.request("GET", `/lesson-plans/${id(planId)}/versions`);
|
|
255
|
+
}
|
|
256
|
+
/** A 5-minute tutor run of the plan as it is now (even unapproved), with no reports or emails. */
|
|
257
|
+
async trialLessonPlan(planId, options = {}) {
|
|
258
|
+
return this.request("POST", `/lesson-plans/${id(planId)}/trial`, options);
|
|
259
|
+
}
|
|
260
|
+
async archiveLessonPlan(planId) {
|
|
261
|
+
await this.request("DELETE", `/lesson-plans/${id(planId)}`);
|
|
262
|
+
}
|
|
263
|
+
async listCourses() {
|
|
264
|
+
return this.request("GET", "/courses");
|
|
265
|
+
}
|
|
266
|
+
/** Create a course ({ title, subject?, level?, plans: planIds in order }), or update one with its id. */
|
|
267
|
+
async saveCourse(course) {
|
|
268
|
+
const { id: courseId, ...body } = course;
|
|
269
|
+
return courseId ? this.request("PUT", `/courses/${id(courseId)}`, body) : this.request("POST", "/courses", body);
|
|
270
|
+
}
|
|
271
|
+
async deleteCourse(courseId) {
|
|
272
|
+
await this.request("DELETE", `/courses/${id(courseId)}`);
|
|
273
|
+
}
|
|
274
|
+
async listTimetables() {
|
|
275
|
+
return this.request("GET", "/timetables");
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Create a timetable, or update one with its id: { name, timeZone, termStart, termEnd, holidays,
|
|
279
|
+
* slots: [{ days, start: "HH:MM", minutes, roomId, planId | courseId }], sessions, defaults, active }.
|
|
280
|
+
* Refused (409, with the clashes) when two lessons would share a room; allowClashes saves anyway.
|
|
281
|
+
*/
|
|
282
|
+
async saveTimetable(timetable, options = {}) {
|
|
283
|
+
const { id: ttId, ...body } = timetable;
|
|
284
|
+
const q = options.allowClashes ? "?allowClashes=true" : "";
|
|
285
|
+
return ttId ? this.request("PUT", `/timetables/${id(ttId)}${q}`, body) : this.request("POST", `/timetables${q}`, body);
|
|
286
|
+
}
|
|
287
|
+
async deleteTimetable(timetableId) {
|
|
288
|
+
await this.request("DELETE", `/timetables/${id(timetableId)}`);
|
|
289
|
+
}
|
|
290
|
+
/** Scheduled lessons in the next `days` days (default 7), with their status. */
|
|
291
|
+
async timetableRuns(options = {}) {
|
|
292
|
+
const q = new URLSearchParams();
|
|
293
|
+
if (options.days)
|
|
294
|
+
q.set("days", String(options.days));
|
|
295
|
+
if (options.timetableId)
|
|
296
|
+
q.set("timetableId", options.timetableId);
|
|
297
|
+
return this.request("GET", `/timetable-runs${q.size ? `?${q}` : ""}`);
|
|
298
|
+
}
|
|
299
|
+
/** Start a scheduled lesson now, or skip it. */
|
|
300
|
+
async startTimetableRun(key) {
|
|
301
|
+
return this.request("POST", `/timetable-runs/${encodeURIComponent(key)}/start`);
|
|
302
|
+
}
|
|
303
|
+
async skipTimetableRun(key) {
|
|
304
|
+
return this.request("POST", `/timetable-runs/${encodeURIComponent(key)}/skip`);
|
|
305
|
+
}
|
|
306
|
+
async health() {
|
|
307
|
+
return this.request("GET", "/health");
|
|
308
|
+
}
|
|
309
|
+
// ---------- plumbing ----------
|
|
310
|
+
/** Call any admin endpoint (for routes this SDK doesn't wrap yet). */
|
|
311
|
+
async request(method, path, body, as = "json") {
|
|
312
|
+
const res = await this.#fetch(`${this.url}${path}`, {
|
|
313
|
+
method,
|
|
314
|
+
headers: {
|
|
315
|
+
Authorization: `Bearer ${this.#adminKey}`,
|
|
316
|
+
...(body !== undefined ? { "Content-Type": "application/json" } : {}),
|
|
317
|
+
},
|
|
318
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
319
|
+
signal: AbortSignal.timeout(this.#timeoutMs),
|
|
320
|
+
});
|
|
321
|
+
if (as === "bytes" && res.ok)
|
|
322
|
+
return (await res.arrayBuffer());
|
|
323
|
+
const text = await res.text();
|
|
324
|
+
if (!res.ok) {
|
|
325
|
+
let parsed = text;
|
|
326
|
+
try {
|
|
327
|
+
parsed = JSON.parse(text);
|
|
328
|
+
}
|
|
329
|
+
catch {
|
|
330
|
+
// keep text
|
|
331
|
+
}
|
|
332
|
+
const msg = parsed?.error ?? text;
|
|
333
|
+
throw new SfuKitError(res.status, `sfukit ${method} ${path}: ${res.status} ${msg}`, parsed);
|
|
334
|
+
}
|
|
335
|
+
return (as === "text" ? text : text ? JSON.parse(text) : undefined);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
function id(value) {
|
|
339
|
+
if (!ID.test(value))
|
|
340
|
+
throw new SfuKitError(400, `invalid id "${value}" (letters, numbers, . _ : @ -, max 128)`, null);
|
|
341
|
+
return encodeURIComponent(value);
|
|
342
|
+
}
|
|
343
|
+
// ---------- offline token signing ----------
|
|
344
|
+
function b64url(data) {
|
|
345
|
+
return Buffer.from(data).toString("base64url");
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Sign a join token with the deployment's JWT_SECRET, without calling the kit.
|
|
349
|
+
* Produces exactly what POST /tokens would (HS256, audience "sfukit").
|
|
350
|
+
*/
|
|
351
|
+
export function signToken(jwtSecret, req) {
|
|
352
|
+
if (!jwtSecret || jwtSecret.length < 32)
|
|
353
|
+
throw new Error("jwtSecret must be at least 32 characters");
|
|
354
|
+
if (!ID.test(req.roomId) || !ID.test(req.userId))
|
|
355
|
+
throw new Error("roomId and userId must be 1-128 chars of letters, numbers, . _ : @ -");
|
|
356
|
+
if (req.role !== undefined && !ROLE.test(req.role))
|
|
357
|
+
throw new Error("role must be 1-32 chars of letters, numbers, . _ -");
|
|
358
|
+
const pub = req.canPublish ?? true;
|
|
359
|
+
const base = req.role && ROLE_DEFAULTS[req.role] ? { ...ROLE_DEFAULTS[req.role] } : { mic: pub, camera: pub, screen: pub, moderate: false };
|
|
360
|
+
const perm = { ...base };
|
|
361
|
+
for (const k of ["mic", "camera", "screen", "moderate"]) {
|
|
362
|
+
const v = req.permissions?.[k];
|
|
363
|
+
if (typeof v === "boolean")
|
|
364
|
+
perm[k] = v;
|
|
365
|
+
}
|
|
366
|
+
let md;
|
|
367
|
+
if (req.metadata !== undefined) {
|
|
368
|
+
const json = JSON.stringify(req.metadata);
|
|
369
|
+
if (!req.metadata || typeof req.metadata !== "object" || Array.isArray(req.metadata) || json.length > 4096) {
|
|
370
|
+
throw new Error("metadata must be a JSON object of at most 4 KB");
|
|
371
|
+
}
|
|
372
|
+
md = JSON.parse(json);
|
|
373
|
+
}
|
|
374
|
+
if (req.maxParticipants !== undefined && (!Number.isInteger(req.maxParticipants) || req.maxParticipants < 2 || req.maxParticipants > 10000)) {
|
|
375
|
+
throw new Error("maxParticipants must be an integer 2-10000");
|
|
376
|
+
}
|
|
377
|
+
if (req.dataSaver !== undefined && !["off", "low", "minimal", "audio"].includes(req.dataSaver)) {
|
|
378
|
+
throw new Error('dataSaver must be "off", "low", "minimal" or "audio"');
|
|
379
|
+
}
|
|
380
|
+
const ttl = Math.min(Math.max(req.ttlSeconds ?? 7200, 60), 86400);
|
|
381
|
+
const now = Math.floor(Date.now() / 1000);
|
|
382
|
+
const exp = now + ttl;
|
|
383
|
+
const payload = {
|
|
384
|
+
room: req.roomId,
|
|
385
|
+
name: (req.name ?? req.userId).slice(0, 80),
|
|
386
|
+
pub: perm.mic || perm.camera || perm.screen,
|
|
387
|
+
perm,
|
|
388
|
+
...(req.role ? { role: req.role } : {}),
|
|
389
|
+
...(req.maxParticipants !== undefined ? { max: req.maxParticipants } : {}),
|
|
390
|
+
...(md ? { md } : {}),
|
|
391
|
+
...(req.dataSaver && req.dataSaver !== "off" ? { ds: req.dataSaver } : {}),
|
|
392
|
+
...(req.lobby === true ? { lobby: true } : {}),
|
|
393
|
+
sub: req.userId,
|
|
394
|
+
aud: "sfukit",
|
|
395
|
+
iat: now,
|
|
396
|
+
exp,
|
|
397
|
+
};
|
|
398
|
+
const input = `${b64url(JSON.stringify({ alg: "HS256", typ: "JWT" }))}.${b64url(JSON.stringify(payload))}`;
|
|
399
|
+
const sig = createHmac("sha256", jwtSecret).update(input).digest("base64url");
|
|
400
|
+
return { token: `${input}.${sig}`, expiresAt: exp };
|
|
401
|
+
}
|
|
402
|
+
// ---------- webhooks ----------
|
|
403
|
+
export const SIGNATURE_HEADER = "x-sfukit-signature";
|
|
404
|
+
/**
|
|
405
|
+
* Check a webhook delivery. Pass the RAW request body (not re-serialized JSON)
|
|
406
|
+
* and the X-SfuKit-Signature header. `secret` is the deployment's
|
|
407
|
+
* WEBHOOK_SECRET (or ADMIN_API_KEY if none was set). Returns the event, or
|
|
408
|
+
* null if the signature is wrong or older than `toleranceSeconds`.
|
|
409
|
+
*
|
|
410
|
+
* app.post("/sfukit-webhooks", express.text({ type: "*\/*" }), (req, res) => {
|
|
411
|
+
* const event = verifyWebhook(process.env.SFUKIT_WEBHOOK_SECRET!, req.body, req.get("x-sfukit-signature"));
|
|
412
|
+
* if (!event) return res.sendStatus(401);
|
|
413
|
+
* …
|
|
414
|
+
* res.sendStatus(204);
|
|
415
|
+
* });
|
|
416
|
+
*/
|
|
417
|
+
export function verifyWebhook(secret, rawBody, signatureHeader, toleranceSeconds = 300) {
|
|
418
|
+
if (!secret || !signatureHeader)
|
|
419
|
+
return null;
|
|
420
|
+
const parts = new Map(signatureHeader.split(",").map((p) => {
|
|
421
|
+
const i = p.indexOf("=");
|
|
422
|
+
return [p.slice(0, i).trim(), p.slice(i + 1).trim()];
|
|
423
|
+
}));
|
|
424
|
+
const t = Number(parts.get("t"));
|
|
425
|
+
const v1 = parts.get("v1") ?? "";
|
|
426
|
+
if (!Number.isFinite(t) || !/^[0-9a-f]{64}$/.test(v1))
|
|
427
|
+
return null;
|
|
428
|
+
if (Math.abs(Date.now() / 1000 - t) > toleranceSeconds)
|
|
429
|
+
return null;
|
|
430
|
+
const body = typeof rawBody === "string" ? rawBody : rawBody.toString("utf8");
|
|
431
|
+
const expected = createHmac("sha256", secret).update(`${t}.${body}`).digest();
|
|
432
|
+
if (!timingSafeEqual(expected, Buffer.from(v1, "hex")))
|
|
433
|
+
return null;
|
|
434
|
+
try {
|
|
435
|
+
return JSON.parse(body);
|
|
436
|
+
}
|
|
437
|
+
catch {
|
|
438
|
+
return null;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
/** Build a signature header (for tests of your webhook endpoint). */
|
|
442
|
+
export function signWebhook(secret, rawBody, t = Math.floor(Date.now() / 1000)) {
|
|
443
|
+
return `t=${t},v1=${createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex")}`;
|
|
444
|
+
}
|
|
445
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAwL1D,MAAM,OAAO,WAAY,SAAQ,KAAK;IAEzB;IAEA;IAHX,YACW,MAAc,EACvB,OAAe,EACN,IAAa;QAEtB,KAAK,CAAC,OAAO,CAAC,CAAC;QAJN,WAAM,GAAN,MAAM,CAAQ;QAEd,SAAI,GAAJ,IAAI,CAAS;QAGtB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED,MAAM,EAAE,GAAG,2BAA2B,CAAC;AACvC,MAAM,IAAI,GAAG,wBAAwB,CAAC;AACtC,MAAM,aAAa,GAAgC;IACjD,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IAClE,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE;IACpE,QAAQ,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE;CACxE,CAAC;AAEF,MAAM,OAAO,MAAM;IACR,GAAG,CAAS;IACrB,SAAS,CAAS;IAClB,UAAU,CAAqB;IAC/B,UAAU,CAAS;IACnB,MAAM,CAAe;IAErB,YAAY,OAAsB;QAChC,IAAI,CAAC,OAAO,CAAC,GAAG;YAAE,MA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GAAG,EAAE,GAAG,IAAI,CAAC;IAC5F,OAAO,KAAK,CAAC,OAAO,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAC7F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsocom/node",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Node.js server SDK for Appsocom Live: join tokens, rooms, moderation, recording and webhook verification",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"appsocom",
|
|
7
|
+
"video",
|
|
8
|
+
"calls",
|
|
9
|
+
"webrtc",
|
|
10
|
+
"sfu",
|
|
11
|
+
"cloudflare",
|
|
12
|
+
"server",
|
|
13
|
+
"sdk",
|
|
14
|
+
"webhooks"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://docs.appsocom.dev",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/appsocom/appsocom-live/issues"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/appsocom/appsocom-live.git",
|
|
23
|
+
"directory": "packages/node"
|
|
24
|
+
},
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"author": "Appsotech Limited",
|
|
27
|
+
"type": "module",
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist",
|
|
38
|
+
"README.md",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=18"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc -p tsconfig.json",
|
|
46
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
47
|
+
"test": "node --test test/*.test.mjs"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@appsocom/protocol": "0.6.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/node": "^22.0.0"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
}
|
|
58
|
+
}
|