@remavideo/sdk 0.9.0 → 0.11.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/index.d.ts +883 -6
- package/dist/index.js +38 -24
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,870 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as _trpc_server from '@trpc/server';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
import { createTRPCClient } from '@trpc/client';
|
|
4
|
+
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
5
|
+
|
|
6
|
+
declare const CreateNodeInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7
|
+
workflowId: z.ZodString;
|
|
8
|
+
kind: z.ZodLiteral<"FILE_INPUT">;
|
|
9
|
+
nodeId: z.ZodString;
|
|
10
|
+
fileInput: z.ZodObject<{
|
|
11
|
+
fileName: z.ZodString;
|
|
12
|
+
loop: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
+
sourceName: z.ZodOptional<z.ZodString>;
|
|
14
|
+
disabled: z.ZodDefault<z.ZodBoolean>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
17
|
+
workflowId: z.ZodString;
|
|
18
|
+
kind: z.ZodLiteral<"RTMP_READER">;
|
|
19
|
+
nodeId: z.ZodString;
|
|
20
|
+
rtmpReader: z.ZodObject<{
|
|
21
|
+
app: z.ZodString;
|
|
22
|
+
sourceName: z.ZodString;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
25
|
+
workflowId: z.ZodString;
|
|
26
|
+
kind: z.ZodLiteral<"RTMP_OUTPUT">;
|
|
27
|
+
nodeId: z.ZodString;
|
|
28
|
+
rtmpOutput: z.ZodObject<{
|
|
29
|
+
url: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
32
|
+
workflowId: z.ZodString;
|
|
33
|
+
kind: z.ZodLiteral<"SRT_OUTPUT">;
|
|
34
|
+
nodeId: z.ZodString;
|
|
35
|
+
srtOutput: z.ZodObject<{
|
|
36
|
+
url: z.ZodString;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
39
|
+
workflowId: z.ZodString;
|
|
40
|
+
kind: z.ZodLiteral<"FILE_OUTPUT">;
|
|
41
|
+
nodeId: z.ZodString;
|
|
42
|
+
fileOutput: z.ZodObject<{
|
|
43
|
+
fileName: z.ZodString;
|
|
44
|
+
format: z.ZodDefault<z.ZodString>;
|
|
45
|
+
overwrite: z.ZodDefault<z.ZodBoolean>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
48
|
+
workflowId: z.ZodString;
|
|
49
|
+
kind: z.ZodLiteral<"HLS_OUTPUT">;
|
|
50
|
+
nodeId: z.ZodString;
|
|
51
|
+
hlsOutput: z.ZodObject<{
|
|
52
|
+
destinations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53
|
+
type: z.ZodLiteral<"file">;
|
|
54
|
+
path: z.ZodString;
|
|
55
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
56
|
+
type: z.ZodLiteral<"s3">;
|
|
57
|
+
bucket: z.ZodString;
|
|
58
|
+
region: z.ZodString;
|
|
59
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
60
|
+
keyPrefix: z.ZodOptional<z.ZodString>;
|
|
61
|
+
makePrefixUnique: z.ZodDefault<z.ZodBoolean>;
|
|
62
|
+
accessKeyId: z.ZodString;
|
|
63
|
+
secretAccessKey: z.ZodString;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
type: z.ZodLiteral<"http">;
|
|
66
|
+
baseUrl: z.ZodString;
|
|
67
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
68
|
+
}, z.core.$strip>], "type">>;
|
|
69
|
+
segmentTime: z.ZodDefault<z.ZodNumber>;
|
|
70
|
+
listSize: z.ZodDefault<z.ZodNumber>;
|
|
71
|
+
audioCodec: z.ZodOptional<z.ZodString>;
|
|
72
|
+
videoCodec: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
workflowId: z.ZodString;
|
|
76
|
+
kind: z.ZodLiteral<"CAPTION_SOURCE">;
|
|
77
|
+
nodeId: z.ZodString;
|
|
78
|
+
captionSource: z.ZodObject<{
|
|
79
|
+
replayCount: z.ZodDefault<z.ZodNumber>;
|
|
80
|
+
language: z.ZodDefault<z.ZodString>;
|
|
81
|
+
label: z.ZodDefault<z.ZodString>;
|
|
82
|
+
defaultTrack: z.ZodDefault<z.ZodBoolean>;
|
|
83
|
+
maxLineLength: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
86
|
+
workflowId: z.ZodString;
|
|
87
|
+
kind: z.ZodLiteral<"CEA608_ENCODER">;
|
|
88
|
+
nodeId: z.ZodString;
|
|
89
|
+
cea608Encoder: z.ZodObject<{
|
|
90
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
91
|
+
rollUp: "rollUp";
|
|
92
|
+
popOn: "popOn";
|
|
93
|
+
paintOn: "paintOn";
|
|
94
|
+
}>>;
|
|
95
|
+
rows: z.ZodDefault<z.ZodNumber>;
|
|
96
|
+
autoWrap: z.ZodDefault<z.ZodBoolean>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
99
|
+
workflowId: z.ZodString;
|
|
100
|
+
kind: z.ZodLiteral<"RTMP_ANNOUNCER">;
|
|
101
|
+
nodeId: z.ZodString;
|
|
102
|
+
rtmpAnnouncer: z.ZodObject<{
|
|
103
|
+
app: z.ZodDefault<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
106
|
+
workflowId: z.ZodString;
|
|
107
|
+
kind: z.ZodLiteral<"SRT_ANNOUNCER">;
|
|
108
|
+
nodeId: z.ZodString;
|
|
109
|
+
srtAnnouncer: z.ZodObject<{
|
|
110
|
+
app: z.ZodDefault<z.ZodString>;
|
|
111
|
+
passphrase: z.ZodOptional<z.ZodString>;
|
|
112
|
+
latencyMs: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
115
|
+
workflowId: z.ZodString;
|
|
116
|
+
kind: z.ZodLiteral<"SRT_READER">;
|
|
117
|
+
nodeId: z.ZodString;
|
|
118
|
+
srtReader: z.ZodObject<{
|
|
119
|
+
app: z.ZodString;
|
|
120
|
+
sourceName: z.ZodString;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
123
|
+
workflowId: z.ZodString;
|
|
124
|
+
kind: z.ZodLiteral<"RTMP_MULTIPLEXER">;
|
|
125
|
+
nodeId: z.ZodString;
|
|
126
|
+
rtmpMultiplexer: z.ZodObject<{
|
|
127
|
+
app: z.ZodDefault<z.ZodString>;
|
|
128
|
+
port: z.ZodDefault<z.ZodNumber>;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
131
|
+
workflowId: z.ZodString;
|
|
132
|
+
kind: z.ZodLiteral<"FFPROBE_MONITOR">;
|
|
133
|
+
nodeId: z.ZodString;
|
|
134
|
+
ffprobeMonitor: z.ZodObject<{
|
|
135
|
+
intervalMs: z.ZodDefault<z.ZodNumber>;
|
|
136
|
+
probeSizeBytes: z.ZodDefault<z.ZodNumber>;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
139
|
+
workflowId: z.ZodString;
|
|
140
|
+
kind: z.ZodLiteral<"NODE_STREAM_INPUT">;
|
|
141
|
+
nodeId: z.ZodString;
|
|
142
|
+
nodeStreamInput: z.ZodObject<{
|
|
143
|
+
format: z.ZodString;
|
|
144
|
+
sampleRate: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
channels: z.ZodOptional<z.ZodNumber>;
|
|
146
|
+
audioCodec: z.ZodDefault<z.ZodString>;
|
|
147
|
+
label: z.ZodOptional<z.ZodString>;
|
|
148
|
+
}, z.core.$strip>;
|
|
149
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
150
|
+
workflowId: z.ZodString;
|
|
151
|
+
kind: z.ZodLiteral<"GEMINI_TRANSLATE">;
|
|
152
|
+
nodeId: z.ZodString;
|
|
153
|
+
geminiTranslate: z.ZodObject<{
|
|
154
|
+
apiKey: z.ZodString;
|
|
155
|
+
targetLanguageCode: z.ZodString;
|
|
156
|
+
label: z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
159
|
+
workflowId: z.ZodString;
|
|
160
|
+
kind: z.ZodLiteral<"CAMB_AI_TRANSLATE">;
|
|
161
|
+
nodeId: z.ZodString;
|
|
162
|
+
cambAiTranslate: z.ZodObject<{
|
|
163
|
+
apiKey: z.ZodString;
|
|
164
|
+
sourceLanguageCode: z.ZodString;
|
|
165
|
+
targetLanguageCode: z.ZodString;
|
|
166
|
+
model: z.ZodOptional<z.ZodEnum<{
|
|
167
|
+
lilac: "lilac";
|
|
168
|
+
violet: "violet";
|
|
169
|
+
iris: "iris";
|
|
170
|
+
orchid: "orchid";
|
|
171
|
+
}>>;
|
|
172
|
+
voiceId: z.ZodOptional<z.ZodNumber>;
|
|
173
|
+
label: z.ZodOptional<z.ZodString>;
|
|
174
|
+
}, z.core.$strip>;
|
|
175
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
176
|
+
workflowId: z.ZodString;
|
|
177
|
+
kind: z.ZodLiteral<"BUFFER">;
|
|
178
|
+
nodeId: z.ZodString;
|
|
179
|
+
buffer: z.ZodObject<{
|
|
180
|
+
bufferMs: z.ZodNumber;
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
183
|
+
workflowId: z.ZodString;
|
|
184
|
+
kind: z.ZodLiteral<"GATE">;
|
|
185
|
+
nodeId: z.ZodString;
|
|
186
|
+
gate: z.ZodObject<{
|
|
187
|
+
minReady: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
189
|
+
}, z.core.$strip>;
|
|
190
|
+
}, z.core.$strip>], "kind">;
|
|
191
|
+
/**
|
|
192
|
+
* Shared source-spec schema used by subscribeNode — discriminated on
|
|
193
|
+
* `selector` so per-stream options (codec, rendition metadata) are only
|
|
194
|
+
* accepted where they apply.
|
|
195
|
+
*/
|
|
196
|
+
declare const SourceSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
197
|
+
selector: z.ZodLiteral<"VIDEO">;
|
|
198
|
+
track: z.ZodOptional<z.ZodNumber>;
|
|
199
|
+
codec: z.ZodOptional<z.ZodObject<{
|
|
200
|
+
name: z.ZodString;
|
|
201
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
202
|
+
}, z.core.$strip>>;
|
|
203
|
+
video: z.ZodOptional<z.ZodObject<{
|
|
204
|
+
label: z.ZodString;
|
|
205
|
+
}, z.core.$strip>>;
|
|
206
|
+
sourceNodeId: z.ZodString;
|
|
207
|
+
delayMs: z.ZodOptional<z.ZodNumber>;
|
|
208
|
+
port: z.ZodOptional<z.ZodString>;
|
|
209
|
+
name: z.ZodOptional<z.ZodString>;
|
|
210
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
211
|
+
selector: z.ZodLiteral<"AUDIO">;
|
|
212
|
+
track: z.ZodOptional<z.ZodNumber>;
|
|
213
|
+
codec: z.ZodOptional<z.ZodObject<{
|
|
214
|
+
name: z.ZodString;
|
|
215
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
216
|
+
}, z.core.$strip>>;
|
|
217
|
+
audio: z.ZodOptional<z.ZodObject<{
|
|
218
|
+
language: z.ZodDefault<z.ZodString>;
|
|
219
|
+
label: z.ZodString;
|
|
220
|
+
defaultTrack: z.ZodDefault<z.ZodBoolean>;
|
|
221
|
+
}, z.core.$strip>>;
|
|
222
|
+
sourceNodeId: z.ZodString;
|
|
223
|
+
delayMs: z.ZodOptional<z.ZodNumber>;
|
|
224
|
+
port: z.ZodOptional<z.ZodString>;
|
|
225
|
+
name: z.ZodOptional<z.ZodString>;
|
|
226
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
227
|
+
selector: z.ZodLiteral<"ALL">;
|
|
228
|
+
videoCodec: z.ZodOptional<z.ZodObject<{
|
|
229
|
+
name: z.ZodString;
|
|
230
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
231
|
+
}, z.core.$strip>>;
|
|
232
|
+
audioCodec: z.ZodOptional<z.ZodObject<{
|
|
233
|
+
name: z.ZodString;
|
|
234
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
235
|
+
}, z.core.$strip>>;
|
|
236
|
+
video: z.ZodOptional<z.ZodObject<{
|
|
237
|
+
label: z.ZodString;
|
|
238
|
+
}, z.core.$strip>>;
|
|
239
|
+
audio: z.ZodOptional<z.ZodObject<{
|
|
240
|
+
language: z.ZodDefault<z.ZodString>;
|
|
241
|
+
label: z.ZodString;
|
|
242
|
+
defaultTrack: z.ZodDefault<z.ZodBoolean>;
|
|
243
|
+
}, z.core.$strip>>;
|
|
244
|
+
sourceNodeId: z.ZodString;
|
|
245
|
+
delayMs: z.ZodOptional<z.ZodNumber>;
|
|
246
|
+
port: z.ZodOptional<z.ZodString>;
|
|
247
|
+
name: z.ZodOptional<z.ZodString>;
|
|
248
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
249
|
+
selector: z.ZodLiteral<"CAPTIONS">;
|
|
250
|
+
sourceNodeId: z.ZodString;
|
|
251
|
+
delayMs: z.ZodOptional<z.ZodNumber>;
|
|
252
|
+
port: z.ZodOptional<z.ZodString>;
|
|
253
|
+
name: z.ZodOptional<z.ZodString>;
|
|
254
|
+
}, z.core.$strict>], "selector">;
|
|
255
|
+
declare const ActivationGateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
256
|
+
type: z.ZodLiteral<"all_stream_active">;
|
|
257
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
258
|
+
type: z.ZodLiteral<"min_active_by_selector">;
|
|
259
|
+
selector: z.ZodEnum<{
|
|
260
|
+
VIDEO: "VIDEO";
|
|
261
|
+
AUDIO: "AUDIO";
|
|
262
|
+
CAPTIONS: "CAPTIONS";
|
|
263
|
+
ALL: "ALL";
|
|
264
|
+
}>;
|
|
265
|
+
count: z.ZodNumber;
|
|
266
|
+
}, z.core.$strip>], "type">;
|
|
267
|
+
type ActivationGate = z.infer<typeof ActivationGateSchema>;
|
|
268
|
+
type CreateNodeInput = z.infer<typeof CreateNodeInputSchema>;
|
|
269
|
+
interface NodeEventMsg {
|
|
270
|
+
nodeId: string;
|
|
271
|
+
kind: NodeEventKind;
|
|
272
|
+
message?: string;
|
|
273
|
+
}
|
|
274
|
+
/** Derived from `SourceSpecSchema` so types are always in sync. */
|
|
275
|
+
type SubscriptionSourceInput = z.output<typeof SourceSpecSchema>;
|
|
276
|
+
/**
|
|
277
|
+
* Metadata for one elementary stream discovered by probing a node's media
|
|
278
|
+
* stream (ffprobe). `track` is the **per-type** index (`-map 0:v:N` /
|
|
279
|
+
* `0:a:N`) — the value to pass back as `track` in a VIDEO/AUDIO
|
|
280
|
+
* subscription. `streamIndex` is ffprobe's global index within the
|
|
281
|
+
* container; the two differ whenever a container mixes stream types.
|
|
282
|
+
*/
|
|
283
|
+
interface TrackInfo {
|
|
284
|
+
/** Per-type index — pass this as `track` in a VIDEO/AUDIO subscription. */
|
|
285
|
+
track: number;
|
|
286
|
+
/** Global stream index inside the probed container (ffprobe `index`). */
|
|
287
|
+
streamIndex: number;
|
|
288
|
+
type: "video" | "audio" | "other";
|
|
289
|
+
codec?: string;
|
|
290
|
+
width?: number;
|
|
291
|
+
height?: number;
|
|
292
|
+
/** Average frame rate as an ffprobe rational string (e.g. `"25/1"`). */
|
|
293
|
+
frameRate?: string;
|
|
294
|
+
channels?: number;
|
|
295
|
+
sampleRate?: number;
|
|
296
|
+
channelLayout?: string;
|
|
297
|
+
/** ISO-639 language tag from the container, when present. */
|
|
298
|
+
language?: string;
|
|
299
|
+
title?: string;
|
|
300
|
+
}
|
|
301
|
+
interface MonitorDescriptorMsg {
|
|
302
|
+
name: string;
|
|
303
|
+
label: string;
|
|
304
|
+
kind: "log" | "status" | "metrics";
|
|
305
|
+
}
|
|
306
|
+
type MonitorEventMsg = {
|
|
307
|
+
kind: "log";
|
|
308
|
+
text: string;
|
|
309
|
+
ts: number;
|
|
310
|
+
} | {
|
|
311
|
+
kind: "status";
|
|
312
|
+
kv: Record<string, string>;
|
|
313
|
+
ts: number;
|
|
314
|
+
} | {
|
|
315
|
+
kind: "metrics";
|
|
316
|
+
name: string;
|
|
317
|
+
value: number;
|
|
318
|
+
ts: number;
|
|
319
|
+
};
|
|
320
|
+
/** CPU/memory usage for a workflow's worker process and everything it spawned. */
|
|
321
|
+
interface WorkflowResourceUsageMsg {
|
|
322
|
+
cpuPercent: number;
|
|
323
|
+
memoryBytes: number;
|
|
324
|
+
pidCount: number;
|
|
325
|
+
rootPid: number;
|
|
326
|
+
ts: number;
|
|
327
|
+
}
|
|
328
|
+
interface WorkflowInfo {
|
|
329
|
+
id: string;
|
|
330
|
+
name?: string;
|
|
331
|
+
createdAt: number;
|
|
332
|
+
status: "active" | "closed" | "crashed";
|
|
333
|
+
/** ID of the parent workflow, if this is a sub-workflow. */
|
|
334
|
+
parentId?: string;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Sticky lifecycle state — exactly one of these describes a node's current
|
|
338
|
+
* health at any time. `READY → ACTIVE → ENDED` is the normal cycle (`ENDED`
|
|
339
|
+
* can return to `ACTIVE` on reconnect/re-enable); `ERROR` and `CLOSED` are
|
|
340
|
+
* reachable from any state, with `CLOSED` always terminal.
|
|
341
|
+
*/
|
|
342
|
+
type NodeState = "READY" | "ACTIVE" | "ENDED" | "ERROR" | "CLOSED";
|
|
343
|
+
/**
|
|
344
|
+
* Point-in-time notification kinds. These carry a payload (e.g. which child
|
|
345
|
+
* node or publisher) but are not a node's "state" — they never overwrite
|
|
346
|
+
* `VisNode.state` / `BaseNode.currentEventKind`.
|
|
347
|
+
*/
|
|
348
|
+
type NodeNotificationKind = "STREAM_CONNECTED" | "STREAM_DISCONNECTED" | "CHILD_CREATED" | "CHILD_CLOSED";
|
|
349
|
+
/** Anything that can appear on a node's `events$` / the `createNode` subscription. */
|
|
350
|
+
type NodeEventKind = NodeState | NodeNotificationKind | "CREATED";
|
|
351
|
+
interface VisNode {
|
|
352
|
+
id: string;
|
|
353
|
+
label: string;
|
|
354
|
+
group: "input" | "output" | "processor";
|
|
355
|
+
kind: string;
|
|
356
|
+
summary: string;
|
|
357
|
+
config: Record<string, string>;
|
|
358
|
+
/** Current lifecycle state of the node. */
|
|
359
|
+
state?: NodeState;
|
|
360
|
+
/** Detail message attached to the current state (e.g. the error text for `state: "ERROR"`). */
|
|
361
|
+
stateMessage?: string;
|
|
362
|
+
/** Set on nodes that were dynamically spawned by another node (e.g. RtmpReaderNode child → RtmpMultiplexerNode). */
|
|
363
|
+
parentId?: string;
|
|
364
|
+
/** The workflow this node belongs to. */
|
|
365
|
+
workflowId: string;
|
|
366
|
+
}
|
|
367
|
+
interface VisEdge {
|
|
368
|
+
from: string;
|
|
369
|
+
to: string;
|
|
370
|
+
selector: string;
|
|
371
|
+
}
|
|
372
|
+
interface PipelineSnapshot {
|
|
373
|
+
nodes: VisNode[];
|
|
374
|
+
edges: VisEdge[];
|
|
375
|
+
}
|
|
376
|
+
interface ServiceContext {
|
|
377
|
+
createNode(input: CreateNodeInput): Promise<void>;
|
|
378
|
+
subscribeNode(workflowId: string, nodeId: string, sources: SubscriptionSourceInput[], gate?: ActivationGate): Promise<void>;
|
|
379
|
+
/**
|
|
380
|
+
* Return the effective base path or URL for each destination in the current
|
|
381
|
+
* session. Must be called after `subscribeNode` so destinations are wired.
|
|
382
|
+
*/
|
|
383
|
+
hlsOutputInfo(workflowId: string, nodeId: string): Promise<{
|
|
384
|
+
effectivePaths: string[];
|
|
385
|
+
}>;
|
|
386
|
+
/**
|
|
387
|
+
* Probe a node's media stream with ffprobe and return its track list.
|
|
388
|
+
* Available track indices can then be passed as `track` on VIDEO/AUDIO
|
|
389
|
+
* subscriptions.
|
|
390
|
+
*/
|
|
391
|
+
probeTracks(workflowId: string, nodeId: string, probeSizeBytes: number): Promise<TrackInfo[]>;
|
|
392
|
+
sendCaption(workflowId: string, nodeId: string, text: string, durationMs: number, startAtMs: number): Promise<boolean>;
|
|
393
|
+
/** Parse raw SRT/VTT content and schedule all entries on the caption source. */
|
|
394
|
+
loadCaptionFile(workflowId: string, nodeId: string, content: string): Promise<{
|
|
395
|
+
count: number;
|
|
396
|
+
ok: boolean;
|
|
397
|
+
}>;
|
|
398
|
+
enableNode(workflowId: string, nodeId: string): Promise<void>;
|
|
399
|
+
rejectPublisher(workflowId: string, nodeId: string, sourceName: string): Promise<void>;
|
|
400
|
+
/** Kick a previously-observed announcer connection by its MediaMTX id — the node resolves its own protocol. */
|
|
401
|
+
disconnectSource(workflowId: string, nodeId: string, connectionId: string): Promise<void>;
|
|
402
|
+
closeNode(workflowId: string, nodeId: string): Promise<void>;
|
|
403
|
+
pipelineState(workflowId: string, signal: AbortSignal): AsyncGenerator<PipelineSnapshot>;
|
|
404
|
+
workflowEvents(workflowId: string, signal: AbortSignal): AsyncGenerator<NodeEventMsg>;
|
|
405
|
+
workflowState(signal: AbortSignal): AsyncGenerator<WorkflowInfo[]>;
|
|
406
|
+
listMonitors(workflowId: string, nodeId: string): Promise<MonitorDescriptorMsg[]>;
|
|
407
|
+
observeNode(workflowId: string, nodeId: string, monitorName: string, signal: AbortSignal): AsyncGenerator<MonitorEventMsg>;
|
|
408
|
+
/** Per-workflow CPU/memory usage, aggregated across the worker process and everything it spawned. */
|
|
409
|
+
workflowResourceUsage(workflowId: string, signal: AbortSignal): AsyncGenerator<WorkflowResourceUsageMsg>;
|
|
410
|
+
createWorkflow(opts: {
|
|
411
|
+
workflowId?: string | undefined;
|
|
412
|
+
name?: string | undefined;
|
|
413
|
+
parentId?: string | undefined;
|
|
414
|
+
closeWithParent?: boolean | undefined;
|
|
415
|
+
closeOnDisconnect?: boolean | undefined;
|
|
416
|
+
}): Promise<WorkflowInfo>;
|
|
417
|
+
listWorkflows(): WorkflowInfo[];
|
|
418
|
+
closeWorkflow(workflowId: string): Promise<void>;
|
|
419
|
+
}
|
|
420
|
+
declare const appRouter: _trpc_server.TRPCBuiltRouter<{
|
|
421
|
+
ctx: ServiceContext;
|
|
422
|
+
meta: object;
|
|
423
|
+
errorShape: _trpc_server.TRPCDefaultErrorShape;
|
|
424
|
+
transformer: true;
|
|
425
|
+
}, _trpc_server.TRPCDecorateCreateRouterOptions<{
|
|
426
|
+
ping: _trpc_server.TRPCQueryProcedure<{
|
|
427
|
+
input: void;
|
|
428
|
+
output: {
|
|
429
|
+
serverVersion: string;
|
|
430
|
+
};
|
|
431
|
+
meta: object;
|
|
432
|
+
}>;
|
|
433
|
+
createNode: _trpc_server.TRPCMutationProcedure<{
|
|
434
|
+
input: {
|
|
435
|
+
workflowId: string;
|
|
436
|
+
kind: "FILE_INPUT";
|
|
437
|
+
nodeId: string;
|
|
438
|
+
fileInput: {
|
|
439
|
+
fileName: string;
|
|
440
|
+
loop?: boolean | undefined;
|
|
441
|
+
sourceName?: string | undefined;
|
|
442
|
+
disabled?: boolean | undefined;
|
|
443
|
+
};
|
|
444
|
+
} | {
|
|
445
|
+
workflowId: string;
|
|
446
|
+
kind: "RTMP_READER";
|
|
447
|
+
nodeId: string;
|
|
448
|
+
rtmpReader: {
|
|
449
|
+
app: string;
|
|
450
|
+
sourceName: string;
|
|
451
|
+
};
|
|
452
|
+
} | {
|
|
453
|
+
workflowId: string;
|
|
454
|
+
kind: "RTMP_OUTPUT";
|
|
455
|
+
nodeId: string;
|
|
456
|
+
rtmpOutput: {
|
|
457
|
+
url: string;
|
|
458
|
+
};
|
|
459
|
+
} | {
|
|
460
|
+
workflowId: string;
|
|
461
|
+
kind: "SRT_OUTPUT";
|
|
462
|
+
nodeId: string;
|
|
463
|
+
srtOutput: {
|
|
464
|
+
url: string;
|
|
465
|
+
};
|
|
466
|
+
} | {
|
|
467
|
+
workflowId: string;
|
|
468
|
+
kind: "FILE_OUTPUT";
|
|
469
|
+
nodeId: string;
|
|
470
|
+
fileOutput: {
|
|
471
|
+
fileName: string;
|
|
472
|
+
format?: string | undefined;
|
|
473
|
+
overwrite?: boolean | undefined;
|
|
474
|
+
};
|
|
475
|
+
} | {
|
|
476
|
+
workflowId: string;
|
|
477
|
+
kind: "HLS_OUTPUT";
|
|
478
|
+
nodeId: string;
|
|
479
|
+
hlsOutput: {
|
|
480
|
+
destinations: ({
|
|
481
|
+
type: "file";
|
|
482
|
+
path: string;
|
|
483
|
+
} | {
|
|
484
|
+
type: "s3";
|
|
485
|
+
bucket: string;
|
|
486
|
+
region: string;
|
|
487
|
+
accessKeyId: string;
|
|
488
|
+
secretAccessKey: string;
|
|
489
|
+
endpoint?: string | undefined;
|
|
490
|
+
keyPrefix?: string | undefined;
|
|
491
|
+
makePrefixUnique?: boolean | undefined;
|
|
492
|
+
} | {
|
|
493
|
+
type: "http";
|
|
494
|
+
baseUrl: string;
|
|
495
|
+
headers?: Record<string, string> | undefined;
|
|
496
|
+
})[];
|
|
497
|
+
segmentTime?: number | undefined;
|
|
498
|
+
listSize?: number | undefined;
|
|
499
|
+
audioCodec?: string | undefined;
|
|
500
|
+
videoCodec?: string | undefined;
|
|
501
|
+
};
|
|
502
|
+
} | {
|
|
503
|
+
workflowId: string;
|
|
504
|
+
kind: "CAPTION_SOURCE";
|
|
505
|
+
nodeId: string;
|
|
506
|
+
captionSource: {
|
|
507
|
+
replayCount?: number | undefined;
|
|
508
|
+
language?: string | undefined;
|
|
509
|
+
label?: string | undefined;
|
|
510
|
+
defaultTrack?: boolean | undefined;
|
|
511
|
+
maxLineLength?: number | undefined;
|
|
512
|
+
};
|
|
513
|
+
} | {
|
|
514
|
+
workflowId: string;
|
|
515
|
+
kind: "CEA608_ENCODER";
|
|
516
|
+
nodeId: string;
|
|
517
|
+
cea608Encoder: {
|
|
518
|
+
mode?: "rollUp" | "popOn" | "paintOn" | undefined;
|
|
519
|
+
rows?: number | undefined;
|
|
520
|
+
autoWrap?: boolean | undefined;
|
|
521
|
+
};
|
|
522
|
+
} | {
|
|
523
|
+
workflowId: string;
|
|
524
|
+
kind: "RTMP_ANNOUNCER";
|
|
525
|
+
nodeId: string;
|
|
526
|
+
rtmpAnnouncer: {
|
|
527
|
+
app?: string | undefined;
|
|
528
|
+
};
|
|
529
|
+
} | {
|
|
530
|
+
workflowId: string;
|
|
531
|
+
kind: "SRT_ANNOUNCER";
|
|
532
|
+
nodeId: string;
|
|
533
|
+
srtAnnouncer: {
|
|
534
|
+
app?: string | undefined;
|
|
535
|
+
passphrase?: string | undefined;
|
|
536
|
+
latencyMs?: number | undefined;
|
|
537
|
+
};
|
|
538
|
+
} | {
|
|
539
|
+
workflowId: string;
|
|
540
|
+
kind: "SRT_READER";
|
|
541
|
+
nodeId: string;
|
|
542
|
+
srtReader: {
|
|
543
|
+
app: string;
|
|
544
|
+
sourceName: string;
|
|
545
|
+
};
|
|
546
|
+
} | {
|
|
547
|
+
workflowId: string;
|
|
548
|
+
kind: "RTMP_MULTIPLEXER";
|
|
549
|
+
nodeId: string;
|
|
550
|
+
rtmpMultiplexer: {
|
|
551
|
+
app?: string | undefined;
|
|
552
|
+
port?: number | undefined;
|
|
553
|
+
};
|
|
554
|
+
} | {
|
|
555
|
+
workflowId: string;
|
|
556
|
+
kind: "FFPROBE_MONITOR";
|
|
557
|
+
nodeId: string;
|
|
558
|
+
ffprobeMonitor: {
|
|
559
|
+
intervalMs?: number | undefined;
|
|
560
|
+
probeSizeBytes?: number | undefined;
|
|
561
|
+
};
|
|
562
|
+
} | {
|
|
563
|
+
workflowId: string;
|
|
564
|
+
kind: "NODE_STREAM_INPUT";
|
|
565
|
+
nodeId: string;
|
|
566
|
+
nodeStreamInput: {
|
|
567
|
+
format: string;
|
|
568
|
+
sampleRate?: number | undefined;
|
|
569
|
+
channels?: number | undefined;
|
|
570
|
+
audioCodec?: string | undefined;
|
|
571
|
+
label?: string | undefined;
|
|
572
|
+
};
|
|
573
|
+
} | {
|
|
574
|
+
workflowId: string;
|
|
575
|
+
kind: "GEMINI_TRANSLATE";
|
|
576
|
+
nodeId: string;
|
|
577
|
+
geminiTranslate: {
|
|
578
|
+
apiKey: string;
|
|
579
|
+
targetLanguageCode: string;
|
|
580
|
+
label?: string | undefined;
|
|
581
|
+
};
|
|
582
|
+
} | {
|
|
583
|
+
workflowId: string;
|
|
584
|
+
kind: "CAMB_AI_TRANSLATE";
|
|
585
|
+
nodeId: string;
|
|
586
|
+
cambAiTranslate: {
|
|
587
|
+
apiKey: string;
|
|
588
|
+
sourceLanguageCode: string;
|
|
589
|
+
targetLanguageCode: string;
|
|
590
|
+
model?: "lilac" | "violet" | "iris" | "orchid" | undefined;
|
|
591
|
+
voiceId?: number | undefined;
|
|
592
|
+
label?: string | undefined;
|
|
593
|
+
};
|
|
594
|
+
} | {
|
|
595
|
+
workflowId: string;
|
|
596
|
+
kind: "BUFFER";
|
|
597
|
+
nodeId: string;
|
|
598
|
+
buffer: {
|
|
599
|
+
bufferMs: number;
|
|
600
|
+
};
|
|
601
|
+
} | {
|
|
602
|
+
workflowId: string;
|
|
603
|
+
kind: "GATE";
|
|
604
|
+
nodeId: string;
|
|
605
|
+
gate: {
|
|
606
|
+
minReady?: number | undefined;
|
|
607
|
+
timeoutMs?: number | undefined;
|
|
608
|
+
};
|
|
609
|
+
};
|
|
610
|
+
output: {
|
|
611
|
+
nodeId: string;
|
|
612
|
+
};
|
|
613
|
+
meta: object;
|
|
614
|
+
}>;
|
|
615
|
+
subscribeNode: _trpc_server.TRPCMutationProcedure<{
|
|
616
|
+
input: {
|
|
617
|
+
workflowId: string;
|
|
618
|
+
nodeId: string;
|
|
619
|
+
sources: ({
|
|
620
|
+
selector: "VIDEO";
|
|
621
|
+
sourceNodeId: string;
|
|
622
|
+
track?: number | undefined;
|
|
623
|
+
codec?: {
|
|
624
|
+
name: string;
|
|
625
|
+
options?: Record<string, string | number> | undefined;
|
|
626
|
+
} | undefined;
|
|
627
|
+
video?: {
|
|
628
|
+
label: string;
|
|
629
|
+
} | undefined;
|
|
630
|
+
delayMs?: number | undefined;
|
|
631
|
+
port?: string | undefined;
|
|
632
|
+
name?: string | undefined;
|
|
633
|
+
} | {
|
|
634
|
+
selector: "AUDIO";
|
|
635
|
+
sourceNodeId: string;
|
|
636
|
+
track?: number | undefined;
|
|
637
|
+
codec?: {
|
|
638
|
+
name: string;
|
|
639
|
+
options?: Record<string, string | number> | undefined;
|
|
640
|
+
} | undefined;
|
|
641
|
+
audio?: {
|
|
642
|
+
label: string;
|
|
643
|
+
language?: string | undefined;
|
|
644
|
+
defaultTrack?: boolean | undefined;
|
|
645
|
+
} | undefined;
|
|
646
|
+
delayMs?: number | undefined;
|
|
647
|
+
port?: string | undefined;
|
|
648
|
+
name?: string | undefined;
|
|
649
|
+
} | {
|
|
650
|
+
selector: "ALL";
|
|
651
|
+
sourceNodeId: string;
|
|
652
|
+
videoCodec?: {
|
|
653
|
+
name: string;
|
|
654
|
+
options?: Record<string, string | number> | undefined;
|
|
655
|
+
} | undefined;
|
|
656
|
+
audioCodec?: {
|
|
657
|
+
name: string;
|
|
658
|
+
options?: Record<string, string | number> | undefined;
|
|
659
|
+
} | undefined;
|
|
660
|
+
video?: {
|
|
661
|
+
label: string;
|
|
662
|
+
} | undefined;
|
|
663
|
+
audio?: {
|
|
664
|
+
label: string;
|
|
665
|
+
language?: string | undefined;
|
|
666
|
+
defaultTrack?: boolean | undefined;
|
|
667
|
+
} | undefined;
|
|
668
|
+
delayMs?: number | undefined;
|
|
669
|
+
port?: string | undefined;
|
|
670
|
+
name?: string | undefined;
|
|
671
|
+
} | {
|
|
672
|
+
selector: "CAPTIONS";
|
|
673
|
+
sourceNodeId: string;
|
|
674
|
+
delayMs?: number | undefined;
|
|
675
|
+
port?: string | undefined;
|
|
676
|
+
name?: string | undefined;
|
|
677
|
+
})[];
|
|
678
|
+
gate?: {
|
|
679
|
+
type: "all_stream_active";
|
|
680
|
+
} | {
|
|
681
|
+
type: "min_active_by_selector";
|
|
682
|
+
selector: "VIDEO" | "AUDIO" | "CAPTIONS" | "ALL";
|
|
683
|
+
count: number;
|
|
684
|
+
} | undefined;
|
|
685
|
+
};
|
|
686
|
+
output: {
|
|
687
|
+
ok: boolean;
|
|
688
|
+
};
|
|
689
|
+
meta: object;
|
|
690
|
+
}>;
|
|
691
|
+
sendCaption: _trpc_server.TRPCMutationProcedure<{
|
|
692
|
+
input: {
|
|
693
|
+
workflowId: string;
|
|
694
|
+
nodeId: string;
|
|
695
|
+
text: string;
|
|
696
|
+
durationMs: number;
|
|
697
|
+
startAtMs?: number | undefined;
|
|
698
|
+
};
|
|
699
|
+
output: {
|
|
700
|
+
ok: boolean;
|
|
701
|
+
};
|
|
702
|
+
meta: object;
|
|
703
|
+
}>;
|
|
704
|
+
loadCaptionFile: _trpc_server.TRPCMutationProcedure<{
|
|
705
|
+
input: {
|
|
706
|
+
workflowId: string;
|
|
707
|
+
nodeId: string;
|
|
708
|
+
content: string;
|
|
709
|
+
};
|
|
710
|
+
output: {
|
|
711
|
+
count: number;
|
|
712
|
+
ok: boolean;
|
|
713
|
+
};
|
|
714
|
+
meta: object;
|
|
715
|
+
}>;
|
|
716
|
+
hlsOutputInfo: _trpc_server.TRPCQueryProcedure<{
|
|
717
|
+
input: {
|
|
718
|
+
workflowId: string;
|
|
719
|
+
nodeId: string;
|
|
720
|
+
};
|
|
721
|
+
output: {
|
|
722
|
+
effectivePaths: string[];
|
|
723
|
+
};
|
|
724
|
+
meta: object;
|
|
725
|
+
}>;
|
|
726
|
+
probeTracks: _trpc_server.TRPCQueryProcedure<{
|
|
727
|
+
input: {
|
|
728
|
+
workflowId: string;
|
|
729
|
+
nodeId: string;
|
|
730
|
+
probeSizeBytes?: number | undefined;
|
|
731
|
+
};
|
|
732
|
+
output: TrackInfo[];
|
|
733
|
+
meta: object;
|
|
734
|
+
}>;
|
|
735
|
+
enableNode: _trpc_server.TRPCMutationProcedure<{
|
|
736
|
+
input: {
|
|
737
|
+
workflowId: string;
|
|
738
|
+
nodeId: string;
|
|
739
|
+
};
|
|
740
|
+
output: {
|
|
741
|
+
ok: boolean;
|
|
742
|
+
};
|
|
743
|
+
meta: object;
|
|
744
|
+
}>;
|
|
745
|
+
rejectPublisher: _trpc_server.TRPCMutationProcedure<{
|
|
746
|
+
input: {
|
|
747
|
+
workflowId: string;
|
|
748
|
+
nodeId: string;
|
|
749
|
+
sourceName: string;
|
|
750
|
+
};
|
|
751
|
+
output: {
|
|
752
|
+
ok: boolean;
|
|
753
|
+
};
|
|
754
|
+
meta: object;
|
|
755
|
+
}>;
|
|
756
|
+
disconnectSource: _trpc_server.TRPCMutationProcedure<{
|
|
757
|
+
input: {
|
|
758
|
+
workflowId: string;
|
|
759
|
+
nodeId: string;
|
|
760
|
+
connectionId: string;
|
|
761
|
+
};
|
|
762
|
+
output: {
|
|
763
|
+
ok: boolean;
|
|
764
|
+
};
|
|
765
|
+
meta: object;
|
|
766
|
+
}>;
|
|
767
|
+
closeNode: _trpc_server.TRPCMutationProcedure<{
|
|
768
|
+
input: {
|
|
769
|
+
workflowId: string;
|
|
770
|
+
nodeId: string;
|
|
771
|
+
};
|
|
772
|
+
output: {
|
|
773
|
+
ok: boolean;
|
|
774
|
+
};
|
|
775
|
+
meta: object;
|
|
776
|
+
}>;
|
|
777
|
+
pipelineState: _trpc_server.TRPCSubscriptionProcedure<{
|
|
778
|
+
input: {
|
|
779
|
+
workflowId: string;
|
|
780
|
+
};
|
|
781
|
+
output: AsyncIterable<PipelineSnapshot, void, any>;
|
|
782
|
+
meta: object;
|
|
783
|
+
}>;
|
|
784
|
+
listMonitors: _trpc_server.TRPCQueryProcedure<{
|
|
785
|
+
input: {
|
|
786
|
+
workflowId: string;
|
|
787
|
+
nodeId: string;
|
|
788
|
+
};
|
|
789
|
+
output: MonitorDescriptorMsg[];
|
|
790
|
+
meta: object;
|
|
791
|
+
}>;
|
|
792
|
+
observeNode: _trpc_server.TRPCSubscriptionProcedure<{
|
|
793
|
+
input: {
|
|
794
|
+
workflowId: string;
|
|
795
|
+
nodeId: string;
|
|
796
|
+
monitorName: string;
|
|
797
|
+
};
|
|
798
|
+
output: AsyncIterable<MonitorEventMsg, void, any>;
|
|
799
|
+
meta: object;
|
|
800
|
+
}>;
|
|
801
|
+
workflowResourceUsage: _trpc_server.TRPCSubscriptionProcedure<{
|
|
802
|
+
input: {
|
|
803
|
+
workflowId: string;
|
|
804
|
+
};
|
|
805
|
+
output: AsyncIterable<WorkflowResourceUsageMsg, void, any>;
|
|
806
|
+
meta: object;
|
|
807
|
+
}>;
|
|
808
|
+
workflow: _trpc_server.TRPCBuiltRouter<{
|
|
809
|
+
ctx: ServiceContext;
|
|
810
|
+
meta: object;
|
|
811
|
+
errorShape: _trpc_server.TRPCDefaultErrorShape;
|
|
812
|
+
transformer: true;
|
|
813
|
+
}, _trpc_server.TRPCDecorateCreateRouterOptions<{
|
|
814
|
+
create: _trpc_server.TRPCMutationProcedure<{
|
|
815
|
+
input: {
|
|
816
|
+
workflowId?: string | undefined;
|
|
817
|
+
name?: string | undefined;
|
|
818
|
+
parentId?: string | undefined;
|
|
819
|
+
closeWithParent?: boolean | undefined;
|
|
820
|
+
closeOnDisconnect?: boolean | undefined;
|
|
821
|
+
};
|
|
822
|
+
output: WorkflowInfo;
|
|
823
|
+
meta: object;
|
|
824
|
+
}>;
|
|
825
|
+
list: _trpc_server.TRPCQueryProcedure<{
|
|
826
|
+
input: void;
|
|
827
|
+
output: WorkflowInfo[];
|
|
828
|
+
meta: object;
|
|
829
|
+
}>;
|
|
830
|
+
state: _trpc_server.TRPCSubscriptionProcedure<{
|
|
831
|
+
input: void;
|
|
832
|
+
output: AsyncIterable<WorkflowInfo[], void, any>;
|
|
833
|
+
meta: object;
|
|
834
|
+
}>;
|
|
835
|
+
events: _trpc_server.TRPCSubscriptionProcedure<{
|
|
836
|
+
input: {
|
|
837
|
+
workflowId: string;
|
|
838
|
+
};
|
|
839
|
+
output: AsyncIterable<NodeEventMsg, void, any>;
|
|
840
|
+
meta: object;
|
|
841
|
+
}>;
|
|
842
|
+
close: _trpc_server.TRPCMutationProcedure<{
|
|
843
|
+
input: {
|
|
844
|
+
workflowId: string;
|
|
845
|
+
};
|
|
846
|
+
output: {
|
|
847
|
+
ok: boolean;
|
|
848
|
+
};
|
|
849
|
+
meta: object;
|
|
850
|
+
}>;
|
|
851
|
+
}>>;
|
|
852
|
+
}>>;
|
|
853
|
+
type AppRouter = typeof appRouter;
|
|
854
|
+
|
|
855
|
+
/** Response shape of `GET /api/health`. */
|
|
856
|
+
interface HealthStatus {
|
|
857
|
+
status: "ok";
|
|
858
|
+
uptimeSeconds: number;
|
|
859
|
+
workflows: {
|
|
860
|
+
total: number;
|
|
861
|
+
active: number;
|
|
862
|
+
crashed: number;
|
|
863
|
+
};
|
|
864
|
+
mediamtx: {
|
|
865
|
+
reachable: boolean;
|
|
866
|
+
};
|
|
867
|
+
}
|
|
4
868
|
|
|
5
869
|
interface RemaClientOptions {
|
|
6
870
|
host?: string;
|
|
@@ -32,6 +896,12 @@ interface NodeCallbacks {
|
|
|
32
896
|
/** Called when the node closes — locally via `.close()`, or remotely (workflow close, crash). */
|
|
33
897
|
onClose?: () => void;
|
|
34
898
|
}
|
|
899
|
+
/** Events emitted by every node, mirroring {@link NodeCallbacks} for `.on()`-style consumers. */
|
|
900
|
+
interface NodeEvents {
|
|
901
|
+
error: (err: Error) => void;
|
|
902
|
+
statusChange: (state: NodeState, message?: string) => void;
|
|
903
|
+
close: () => void;
|
|
904
|
+
}
|
|
35
905
|
/**
|
|
36
906
|
* FFmpeg codec specification for one stream of a subscription.
|
|
37
907
|
*
|
|
@@ -154,9 +1024,11 @@ interface WorkflowHandle {
|
|
|
154
1024
|
}
|
|
155
1025
|
/**
|
|
156
1026
|
* Base class for all rema nodes.
|
|
157
|
-
* Provides the .subscribe() method that wires nodes together on the server
|
|
1027
|
+
* Provides the .subscribe() method that wires nodes together on the server,
|
|
1028
|
+
* and a `NodeEvents` emitter (`.on("error"/"statusChange"/"close", ...)`) as
|
|
1029
|
+
* an alternative to the `onError`/`onStatusChange`/`onClose` settings callbacks.
|
|
158
1030
|
*/
|
|
159
|
-
declare abstract class BaseNode {
|
|
1031
|
+
declare abstract class BaseNode extends TypedEmitter<NodeEvents> {
|
|
160
1032
|
readonly nodeId: string;
|
|
161
1033
|
readonly workflowId: string;
|
|
162
1034
|
protected readonly client: RemaClient;
|
|
@@ -854,6 +1726,11 @@ interface WorkflowCallbacks {
|
|
|
854
1726
|
/** Called when the workflow closes, whether via `.close()` or a crash. */
|
|
855
1727
|
onClose?: () => void;
|
|
856
1728
|
}
|
|
1729
|
+
/** Events emitted by a workflow, mirroring {@link WorkflowCallbacks} for `.on()`-style consumers. */
|
|
1730
|
+
interface WorkflowEvents {
|
|
1731
|
+
error: (err: Error) => void;
|
|
1732
|
+
close: () => void;
|
|
1733
|
+
}
|
|
857
1734
|
/**
|
|
858
1735
|
* A workflow is an isolated sub-registry on the server.
|
|
859
1736
|
* All nodes created through a workflow handle are scoped to that workflow;
|
|
@@ -861,7 +1738,7 @@ interface WorkflowCallbacks {
|
|
|
861
1738
|
*
|
|
862
1739
|
* Obtain a workflow via `rema.workflow.create()`.
|
|
863
1740
|
*/
|
|
864
|
-
declare class Workflow {
|
|
1741
|
+
declare class Workflow extends TypedEmitter<WorkflowEvents> {
|
|
865
1742
|
readonly workflowId: string;
|
|
866
1743
|
/** Non-private: accessible to factory functions via WorkflowHandle. */
|
|
867
1744
|
readonly client: RemaClient;
|
|
@@ -1017,4 +1894,4 @@ declare const selectAudio: "AUDIO";
|
|
|
1017
1894
|
declare const selectCaptions: "CAPTIONS";
|
|
1018
1895
|
declare const selectAll: "ALL";
|
|
1019
1896
|
|
|
1020
|
-
export { type AllSubscriptionSpec, type AudioRenditionOptions, type AudioSubscriptionSpec, BaseNode, BufferNode, type BufferSettings, CambAiTranslateNode, type CambAiTranslateSettings, type CaptionMode, CaptionSourceNode, type CaptionSourceSettings, type CaptionsSubscriptionSpec, Cea608EncoderNode, type Cea608EncoderSettings, type CodecSpec, FfprobeMonitorNode, type FfprobeMonitorSettings, FileInputNode, type FileInputSettings, FileOutputNode, type FileOutputSettings, GateNode, type GateSettings, GeminiTranslateNode, type GeminiTranslateSettings, type HlsDestination, HlsOutputNode, type HlsOutputSettings, type NodeCallbacks, NodeStreamInputNode, type NodeStreamInputSettings, Rema, type RemaClientOptions, RtmpAnnouncerNode, type RtmpAnnouncerSettings, type RtmpConnectionInfo, RtmpMultiplexerNode, type RtmpMultiplexerSettings, RtmpOutputNode, type RtmpOutputSettings, RtmpReaderNode, type RtmpReaderSettings, RtmpStreamNode, SrtAnnouncerNode, type SrtAnnouncerSettings, type SrtConnectionInfo, SrtOutputNode, type SrtOutputSettings, SrtReaderNode, type SrtReaderSettings, type StreamSelector, type SubscriptionSpec, type VideoRenditionOptions, type VideoSubscriptionSpec, Workflow, type WorkflowCallbacks, createNodeStreamInputNode, selectAll, selectAudio, selectCaptions, selectVideo };
|
|
1897
|
+
export { type AllSubscriptionSpec, type AppRouter, type AudioRenditionOptions, type AudioSubscriptionSpec, BaseNode, BufferNode, type BufferSettings, CambAiTranslateNode, type CambAiTranslateSettings, type CaptionMode, CaptionSourceNode, type CaptionSourceSettings, type CaptionsSubscriptionSpec, Cea608EncoderNode, type Cea608EncoderSettings, type CodecSpec, FfprobeMonitorNode, type FfprobeMonitorSettings, FileInputNode, type FileInputSettings, FileOutputNode, type FileOutputSettings, GateNode, type GateSettings, GeminiTranslateNode, type GeminiTranslateSettings, type HealthStatus, type HlsDestination, HlsOutputNode, type HlsOutputSettings, type MonitorDescriptorMsg, type MonitorEventMsg, type NodeCallbacks, type NodeEventKind, type NodeEvents, type NodeNotificationKind, type NodeState, NodeStreamInputNode, type NodeStreamInputSettings, type PipelineSnapshot, Rema, type RemaClientOptions, RtmpAnnouncerNode, type RtmpAnnouncerSettings, type RtmpConnectionInfo, RtmpMultiplexerNode, type RtmpMultiplexerSettings, RtmpOutputNode, type RtmpOutputSettings, RtmpReaderNode, type RtmpReaderSettings, RtmpStreamNode, SrtAnnouncerNode, type SrtAnnouncerSettings, type SrtConnectionInfo, SrtOutputNode, type SrtOutputSettings, SrtReaderNode, type SrtReaderSettings, type StreamSelector, type SubscriptionSpec, type TrackInfo, type VideoRenditionOptions, type VideoSubscriptionSpec, type VisEdge, type VisNode, Workflow, type WorkflowCallbacks, type WorkflowEvents, type WorkflowInfo, type WorkflowResourceUsageMsg, createNodeStreamInputNode, selectAll, selectAudio, selectCaptions, selectVideo };
|