@tribe-nest/media-protocol 1.0.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.
Files changed (84) hide show
  1. package/build/_fixtures/joinTokenVectors.json +103 -0
  2. package/build/claims.d.ts +327 -0
  3. package/build/claims.d.ts.map +1 -0
  4. package/build/claims.js +91 -0
  5. package/build/claims.js.map +1 -0
  6. package/build/codecs.d.ts +102 -0
  7. package/build/codecs.d.ts.map +1 -0
  8. package/build/codecs.js +138 -0
  9. package/build/codecs.js.map +1 -0
  10. package/build/errorSchema.d.ts +8 -0
  11. package/build/errorSchema.d.ts.map +1 -0
  12. package/build/errorSchema.js +12 -0
  13. package/build/errorSchema.js.map +1 -0
  14. package/build/errors.d.ts +18 -0
  15. package/build/errors.d.ts.map +1 -0
  16. package/build/errors.js +47 -0
  17. package/build/errors.js.map +1 -0
  18. package/build/frames.d.ts +1291 -0
  19. package/build/frames.d.ts.map +1 -0
  20. package/build/frames.js +222 -0
  21. package/build/frames.js.map +1 -0
  22. package/build/grants.d.ts +307 -0
  23. package/build/grants.d.ts.map +1 -0
  24. package/build/grants.js +228 -0
  25. package/build/grants.js.map +1 -0
  26. package/build/index.d.ts +24 -0
  27. package/build/index.d.ts.map +1 -0
  28. package/build/index.js +40 -0
  29. package/build/index.js.map +1 -0
  30. package/build/mp-build/_fixtures/joinTokenVectors.json +103 -0
  31. package/build/mp-build/claims.d.ts +299 -0
  32. package/build/mp-build/claims.d.ts.map +1 -0
  33. package/build/mp-build/claims.js +60 -0
  34. package/build/mp-build/claims.js.map +1 -0
  35. package/build/mp-build/errorSchema.d.ts +8 -0
  36. package/build/mp-build/errorSchema.d.ts.map +1 -0
  37. package/build/mp-build/errorSchema.js +12 -0
  38. package/build/mp-build/errorSchema.js.map +1 -0
  39. package/build/mp-build/errors.d.ts +18 -0
  40. package/build/mp-build/errors.d.ts.map +1 -0
  41. package/build/mp-build/errors.js +47 -0
  42. package/build/mp-build/errors.js.map +1 -0
  43. package/build/mp-build/frames.d.ts +786 -0
  44. package/build/mp-build/frames.d.ts.map +1 -0
  45. package/build/mp-build/frames.js +153 -0
  46. package/build/mp-build/frames.js.map +1 -0
  47. package/build/mp-build/grants.d.ts +245 -0
  48. package/build/mp-build/grants.d.ts.map +1 -0
  49. package/build/mp-build/grants.js +135 -0
  50. package/build/mp-build/grants.js.map +1 -0
  51. package/build/mp-build/index.d.ts +23 -0
  52. package/build/mp-build/index.d.ts.map +1 -0
  53. package/build/mp-build/index.js +39 -0
  54. package/build/mp-build/index.js.map +1 -0
  55. package/build/mp-build/token.d.ts +66 -0
  56. package/build/mp-build/token.d.ts.map +1 -0
  57. package/build/mp-build/token.js +208 -0
  58. package/build/mp-build/token.js.map +1 -0
  59. package/build/mp-build/version.d.ts +9 -0
  60. package/build/mp-build/version.d.ts.map +1 -0
  61. package/build/mp-build/version.js +12 -0
  62. package/build/mp-build/version.js.map +1 -0
  63. package/build/token.d.ts +66 -0
  64. package/build/token.d.ts.map +1 -0
  65. package/build/token.js +208 -0
  66. package/build/token.js.map +1 -0
  67. package/build/version.d.ts +9 -0
  68. package/build/version.d.ts.map +1 -0
  69. package/build/version.js +12 -0
  70. package/build/version.js.map +1 -0
  71. package/package.json +53 -0
  72. package/src/_fixtures/joinTokenVectors.json +103 -0
  73. package/src/_tests/codecs.spec.ts +66 -0
  74. package/src/_tests/publishGrants.spec.ts +109 -0
  75. package/src/_tests/token.spec.ts +272 -0
  76. package/src/claims.ts +116 -0
  77. package/src/codecs.ts +165 -0
  78. package/src/errorSchema.ts +9 -0
  79. package/src/errors.ts +44 -0
  80. package/src/frames.ts +234 -0
  81. package/src/grants.ts +248 -0
  82. package/src/index.ts +23 -0
  83. package/src/token.ts +237 -0
  84. package/src/version.ts +8 -0
@@ -0,0 +1,1291 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * The client <-> node signalling wire.
4
+ *
5
+ * One envelope, stated once. Six phase plans independently invented four
6
+ * different ones (`m` / `type` / `method` / `action`, numeric versus string
7
+ * ids, `result` versus `data`), and every mismatch is a hard parse failure
8
+ * discovered at integration by a different pair of people.
9
+ *
10
+ * ## Shape
11
+ *
12
+ * Requests carry an `id` and get exactly one reply with the same `id`. Events
13
+ * carry no `id` and are never replied to. That is the whole protocol; anything
14
+ * needing more structure is a request that returns a handle.
15
+ *
16
+ * ## What is deliberately NOT here
17
+ *
18
+ * No pipe verb, no node id, no mesh address. A client cannot express "pipe this
19
+ * producer to that node", because piping is a side effect of `consume` and the
20
+ * only way to keep it lazy is for eager piping to be unsayable.
21
+ */
22
+ export declare const requestFrameSchema: z.ZodDiscriminatedUnion<"method", [z.ZodObject<{
23
+ method: z.ZodLiteral<"join">;
24
+ id: z.ZodNumber;
25
+ protocolVersion: z.ZodNumber;
26
+ /** The token travels in the first frame, NEVER in the URL: a query string
27
+ * lands in load-balancer access logs, and a join ticket in a log is a join
28
+ * ticket for anyone who can read logs. */
29
+ token: z.ZodString;
30
+ }, "strip", z.ZodTypeAny, {
31
+ method: "join";
32
+ id: number;
33
+ protocolVersion: number;
34
+ token: string;
35
+ }, {
36
+ method: "join";
37
+ id: number;
38
+ protocolVersion: number;
39
+ token: string;
40
+ }>, z.ZodObject<{
41
+ method: z.ZodLiteral<"createTransport">;
42
+ id: z.ZodNumber;
43
+ direction: z.ZodEnum<["send", "recv"]>;
44
+ /**
45
+ * Deliberately absent: which KIND of transport this is.
46
+ *
47
+ * The kind comes from the token's `transport` claim and from nowhere else.
48
+ * Letting a client ask would mean a browser holding a valid join token
49
+ * could request a PlainTransport pointed at an address of its choosing -
50
+ * an RTP reflector, plus an unauthenticated publish path into whatever room
51
+ * the token names. Three phases independently needed to refuse that and
52
+ * none could, because nothing carried the fact.
53
+ *
54
+ * So there is no field here to refuse. The claim decides.
55
+ */
56
+ sctp: z.ZodOptional<z.ZodBoolean>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ method: "createTransport";
59
+ id: number;
60
+ direction: "send" | "recv";
61
+ sctp?: boolean | undefined;
62
+ }, {
63
+ method: "createTransport";
64
+ id: number;
65
+ direction: "send" | "recv";
66
+ sctp?: boolean | undefined;
67
+ }>, z.ZodObject<{
68
+ method: z.ZodLiteral<"connectTransport">;
69
+ id: z.ZodNumber;
70
+ transportId: z.ZodString;
71
+ /** WebRTC. */
72
+ dtlsParameters: z.ZodOptional<z.ZodUnknown>;
73
+ /**
74
+ * Plain and pipe transports have no DTLS handshake to carry the address, so
75
+ * a server-side participant names where its RTP comes from. This is the
76
+ * half the token claim cannot cover: the claim says WHO may create a plain
77
+ * transport, and `MEDIA_SERVER_PEER_CIDRS` says WHERE its media may be
78
+ * pointed. Both are required; either alone leaves a reflector.
79
+ */
80
+ ip: z.ZodOptional<z.ZodString>;
81
+ port: z.ZodOptional<z.ZodNumber>;
82
+ rtcpPort: z.ZodOptional<z.ZodNumber>;
83
+ srtpParameters: z.ZodOptional<z.ZodUnknown>;
84
+ }, "strip", z.ZodTypeAny, {
85
+ method: "connectTransport";
86
+ id: number;
87
+ transportId: string;
88
+ dtlsParameters?: unknown;
89
+ ip?: string | undefined;
90
+ port?: number | undefined;
91
+ rtcpPort?: number | undefined;
92
+ srtpParameters?: unknown;
93
+ }, {
94
+ method: "connectTransport";
95
+ id: number;
96
+ transportId: string;
97
+ dtlsParameters?: unknown;
98
+ ip?: string | undefined;
99
+ port?: number | undefined;
100
+ rtcpPort?: number | undefined;
101
+ srtpParameters?: unknown;
102
+ }>, z.ZodObject<{
103
+ method: z.ZodLiteral<"produce">;
104
+ id: z.ZodNumber;
105
+ transportId: z.ZodString;
106
+ kind: z.ZodEnum<["audio", "video"]>;
107
+ /** Opaque to this package: only mediasoup interprets it. */
108
+ rtpParameters: z.ZodUnknown;
109
+ appData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ kind: "audio" | "video";
112
+ method: "produce";
113
+ id: number;
114
+ transportId: string;
115
+ rtpParameters?: unknown;
116
+ appData?: Record<string, unknown> | undefined;
117
+ }, {
118
+ kind: "audio" | "video";
119
+ method: "produce";
120
+ id: number;
121
+ transportId: string;
122
+ rtpParameters?: unknown;
123
+ appData?: Record<string, unknown> | undefined;
124
+ }>, z.ZodObject<{
125
+ method: z.ZodLiteral<"consume">;
126
+ id: z.ZodNumber;
127
+ transportId: z.ZodString;
128
+ producerId: z.ZodString;
129
+ rtpCapabilities: z.ZodUnknown;
130
+ }, "strip", z.ZodTypeAny, {
131
+ method: "consume";
132
+ id: number;
133
+ transportId: string;
134
+ producerId: string;
135
+ rtpCapabilities?: unknown;
136
+ }, {
137
+ method: "consume";
138
+ id: number;
139
+ transportId: string;
140
+ producerId: string;
141
+ rtpCapabilities?: unknown;
142
+ }>, z.ZodObject<{
143
+ method: z.ZodLiteral<"pauseProducer">;
144
+ id: z.ZodNumber;
145
+ producerId: z.ZodString;
146
+ }, "strip", z.ZodTypeAny, {
147
+ method: "pauseProducer";
148
+ id: number;
149
+ producerId: string;
150
+ }, {
151
+ method: "pauseProducer";
152
+ id: number;
153
+ producerId: string;
154
+ }>, z.ZodObject<{
155
+ method: z.ZodLiteral<"resumeProducer">;
156
+ id: z.ZodNumber;
157
+ producerId: z.ZodString;
158
+ }, "strip", z.ZodTypeAny, {
159
+ method: "resumeProducer";
160
+ id: number;
161
+ producerId: string;
162
+ }, {
163
+ method: "resumeProducer";
164
+ id: number;
165
+ producerId: string;
166
+ }>, z.ZodObject<{
167
+ method: z.ZodLiteral<"resumeConsumer">;
168
+ id: z.ZodNumber;
169
+ consumerId: z.ZodString;
170
+ }, "strip", z.ZodTypeAny, {
171
+ method: "resumeConsumer";
172
+ id: number;
173
+ consumerId: string;
174
+ }, {
175
+ method: "resumeConsumer";
176
+ id: number;
177
+ consumerId: string;
178
+ }>, z.ZodObject<{
179
+ method: z.ZodLiteral<"closeConsumer">;
180
+ id: z.ZodNumber;
181
+ consumerId: z.ZodString;
182
+ }, "strip", z.ZodTypeAny, {
183
+ method: "closeConsumer";
184
+ id: number;
185
+ consumerId: string;
186
+ }, {
187
+ method: "closeConsumer";
188
+ id: number;
189
+ consumerId: string;
190
+ }>, z.ZodObject<{
191
+ method: z.ZodLiteral<"closeProducer">;
192
+ id: z.ZodNumber;
193
+ producerId: z.ZodString;
194
+ }, "strip", z.ZodTypeAny, {
195
+ method: "closeProducer";
196
+ id: number;
197
+ producerId: string;
198
+ }, {
199
+ method: "closeProducer";
200
+ id: number;
201
+ producerId: string;
202
+ }>, z.ZodObject<{
203
+ method: z.ZodLiteral<"requestKeyFrame">;
204
+ id: z.ZodNumber;
205
+ consumerId: z.ZodString;
206
+ }, "strip", z.ZodTypeAny, {
207
+ method: "requestKeyFrame";
208
+ id: number;
209
+ consumerId: string;
210
+ }, {
211
+ method: "requestKeyFrame";
212
+ id: number;
213
+ consumerId: string;
214
+ }>, z.ZodObject<{
215
+ method: z.ZodLiteral<"leave">;
216
+ id: z.ZodNumber;
217
+ }, "strip", z.ZodTypeAny, {
218
+ method: "leave";
219
+ id: number;
220
+ }, {
221
+ method: "leave";
222
+ id: number;
223
+ }>]>;
224
+ export type RequestFrame = z.infer<typeof requestFrameSchema>;
225
+ export type RequestMethod = RequestFrame["method"];
226
+ export declare const responseFrameSchema: z.ZodUnion<[z.ZodObject<{
227
+ id: z.ZodNumber;
228
+ ok: z.ZodLiteral<true>;
229
+ data: z.ZodUnknown;
230
+ }, "strip", z.ZodTypeAny, {
231
+ id: number;
232
+ ok: true;
233
+ data?: unknown;
234
+ }, {
235
+ id: number;
236
+ ok: true;
237
+ data?: unknown;
238
+ }>, z.ZodObject<{
239
+ id: z.ZodNumber;
240
+ ok: z.ZodLiteral<false>;
241
+ /** The client sees a CODE, never why a token was refused. Telling a caller
242
+ * whether the signature or the room was wrong turns this into an oracle. */
243
+ code: z.ZodEnum<["unauthorized", "replayed", "protocol_version", "forbidden_transport", "forbidden", "not_subscribable", "subscription_limit", "room_closed", "no_such_room", "no_such_producer", "no_such_transport", "duplicate_identity", "node_draining", "capacity", "bad_request", "internal"]>;
244
+ message: z.ZodOptional<z.ZodString>;
245
+ }, "strip", z.ZodTypeAny, {
246
+ code: "unauthorized" | "replayed" | "protocol_version" | "forbidden_transport" | "forbidden" | "not_subscribable" | "subscription_limit" | "room_closed" | "no_such_room" | "no_such_producer" | "no_such_transport" | "duplicate_identity" | "node_draining" | "capacity" | "bad_request" | "internal";
247
+ id: number;
248
+ ok: false;
249
+ message?: string | undefined;
250
+ }, {
251
+ code: "unauthorized" | "replayed" | "protocol_version" | "forbidden_transport" | "forbidden" | "not_subscribable" | "subscription_limit" | "room_closed" | "no_such_room" | "no_such_producer" | "no_such_transport" | "duplicate_identity" | "node_draining" | "capacity" | "bad_request" | "internal";
252
+ id: number;
253
+ ok: false;
254
+ message?: string | undefined;
255
+ }>]>;
256
+ export type ResponseFrame = z.infer<typeof responseFrameSchema>;
257
+ /** A participant as everyone else sees them. Grants are NOT included: what
258
+ * someone else is permitted to do is not the room's business. */
259
+ export declare const peerSchema: z.ZodObject<{
260
+ identity: z.ZodString;
261
+ name: z.ZodOptional<z.ZodString>;
262
+ kind: z.ZodEnum<["human", "agent", "egress", "sip", "ingress"]>;
263
+ }, "strip", z.ZodTypeAny, {
264
+ identity: string;
265
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
266
+ name?: string | undefined;
267
+ }, {
268
+ identity: string;
269
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
270
+ name?: string | undefined;
271
+ }>;
272
+ export type Peer = z.infer<typeof peerSchema>;
273
+ export declare const eventFrameSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
274
+ event: z.ZodLiteral<"joined">;
275
+ identity: z.ZodString;
276
+ room: z.ZodString;
277
+ /** Everything the client needs to build its device before any transport. */
278
+ routerRtpCapabilities: z.ZodUnknown;
279
+ peers: z.ZodArray<z.ZodObject<{
280
+ identity: z.ZodString;
281
+ name: z.ZodOptional<z.ZodString>;
282
+ kind: z.ZodEnum<["human", "agent", "egress", "sip", "ingress"]>;
283
+ }, "strip", z.ZodTypeAny, {
284
+ identity: string;
285
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
286
+ name?: string | undefined;
287
+ }, {
288
+ identity: string;
289
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
290
+ name?: string | undefined;
291
+ }>, "many">;
292
+ /** Producers this participant is ALLOWED to see. The barrier is applied to
293
+ * the snapshot, not only at consume: an identity it may not receive must
294
+ * not be discoverable either. */
295
+ producers: z.ZodArray<z.ZodObject<{
296
+ producerId: z.ZodString;
297
+ identity: z.ZodString;
298
+ kind: z.ZodEnum<["audio", "video"]>;
299
+ }, "strip", z.ZodTypeAny, {
300
+ identity: string;
301
+ kind: "audio" | "video";
302
+ producerId: string;
303
+ }, {
304
+ identity: string;
305
+ kind: "audio" | "video";
306
+ producerId: string;
307
+ }>, "many">;
308
+ iceServers: z.ZodArray<z.ZodObject<{
309
+ urls: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
310
+ username: z.ZodOptional<z.ZodString>;
311
+ credential: z.ZodOptional<z.ZodString>;
312
+ }, "strip", z.ZodTypeAny, {
313
+ urls: string | string[];
314
+ username?: string | undefined;
315
+ credential?: string | undefined;
316
+ }, {
317
+ urls: string | string[];
318
+ username?: string | undefined;
319
+ credential?: string | undefined;
320
+ }>, "many">;
321
+ /** True while any `kind: "egress"` participant is present. A consent
322
+ * requirement, not a nicety. */
323
+ recording: z.ZodBoolean;
324
+ /**
325
+ * What this token was minted with, echoed back.
326
+ *
327
+ * The client already holds the token but must not parse it: a signed blob
328
+ * a client reads is a signed blob a client eventually trusts its own
329
+ * reading of. This is the node's understanding of the grants, which is the
330
+ * one that will actually be enforced, so a UI built from it cannot offer a
331
+ * control the node is about to refuse.
332
+ */
333
+ grants: z.ZodOptional<z.ZodObject<{
334
+ canPublish: z.ZodBoolean;
335
+ canSubscribe: z.ZodBoolean;
336
+ canPublishData: z.ZodBoolean;
337
+ subscribe: z.ZodOptional<z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
338
+ mode: z.ZodLiteral<"all">;
339
+ }, "strict", z.ZodTypeAny, {
340
+ mode: "all";
341
+ }, {
342
+ mode: "all";
343
+ }>, z.ZodObject<{
344
+ mode: z.ZodLiteral<"none">;
345
+ }, "strict", z.ZodTypeAny, {
346
+ mode: "none";
347
+ }, {
348
+ mode: "none";
349
+ }>, z.ZodObject<{
350
+ mode: z.ZodLiteral<"allow">;
351
+ identities: z.ZodArray<z.ZodString, "many">;
352
+ }, "strict", z.ZodTypeAny, {
353
+ mode: "allow";
354
+ identities: string[];
355
+ }, {
356
+ mode: "allow";
357
+ identities: string[];
358
+ }>, z.ZodObject<{
359
+ mode: z.ZodLiteral<"deny">;
360
+ identities: z.ZodArray<z.ZodString, "many">;
361
+ }, "strict", z.ZodTypeAny, {
362
+ mode: "deny";
363
+ identities: string[];
364
+ }, {
365
+ mode: "deny";
366
+ identities: string[];
367
+ }>]>>;
368
+ visibleTo: z.ZodOptional<z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
369
+ mode: z.ZodLiteral<"all">;
370
+ }, "strict", z.ZodTypeAny, {
371
+ mode: "all";
372
+ }, {
373
+ mode: "all";
374
+ }>, z.ZodObject<{
375
+ mode: z.ZodLiteral<"none">;
376
+ }, "strict", z.ZodTypeAny, {
377
+ mode: "none";
378
+ }, {
379
+ mode: "none";
380
+ }>, z.ZodObject<{
381
+ mode: z.ZodLiteral<"allow">;
382
+ identities: z.ZodArray<z.ZodString, "many">;
383
+ }, "strict", z.ZodTypeAny, {
384
+ mode: "allow";
385
+ identities: string[];
386
+ }, {
387
+ mode: "allow";
388
+ identities: string[];
389
+ }>, z.ZodObject<{
390
+ mode: z.ZodLiteral<"deny">;
391
+ identities: z.ZodArray<z.ZodString, "many">;
392
+ }, "strict", z.ZodTypeAny, {
393
+ mode: "deny";
394
+ identities: string[];
395
+ }, {
396
+ mode: "deny";
397
+ identities: string[];
398
+ }>]>>;
399
+ publishKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<["audio", "video", "screen"]>, "many">>;
400
+ subscribeExempt: z.ZodOptional<z.ZodBoolean>;
401
+ maxSubscriptions: z.ZodOptional<z.ZodNumber>;
402
+ }, "strict", z.ZodTypeAny, {
403
+ canPublish: boolean;
404
+ canSubscribe: boolean;
405
+ canPublishData: boolean;
406
+ subscribe?: {
407
+ mode: "all";
408
+ } | {
409
+ mode: "none";
410
+ } | {
411
+ mode: "allow";
412
+ identities: string[];
413
+ } | {
414
+ mode: "deny";
415
+ identities: string[];
416
+ } | undefined;
417
+ visibleTo?: {
418
+ mode: "all";
419
+ } | {
420
+ mode: "none";
421
+ } | {
422
+ mode: "allow";
423
+ identities: string[];
424
+ } | {
425
+ mode: "deny";
426
+ identities: string[];
427
+ } | undefined;
428
+ publishKinds?: ("audio" | "video" | "screen")[] | undefined;
429
+ subscribeExempt?: boolean | undefined;
430
+ maxSubscriptions?: number | undefined;
431
+ }, {
432
+ canPublish: boolean;
433
+ canSubscribe: boolean;
434
+ canPublishData: boolean;
435
+ subscribe?: {
436
+ mode: "all";
437
+ } | {
438
+ mode: "none";
439
+ } | {
440
+ mode: "allow";
441
+ identities: string[];
442
+ } | {
443
+ mode: "deny";
444
+ identities: string[];
445
+ } | undefined;
446
+ visibleTo?: {
447
+ mode: "all";
448
+ } | {
449
+ mode: "none";
450
+ } | {
451
+ mode: "allow";
452
+ identities: string[];
453
+ } | {
454
+ mode: "deny";
455
+ identities: string[];
456
+ } | undefined;
457
+ publishKinds?: ("audio" | "video" | "screen")[] | undefined;
458
+ subscribeExempt?: boolean | undefined;
459
+ maxSubscriptions?: number | undefined;
460
+ }>>;
461
+ }, "strip", z.ZodTypeAny, {
462
+ room: string;
463
+ identity: string;
464
+ event: "joined";
465
+ peers: {
466
+ identity: string;
467
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
468
+ name?: string | undefined;
469
+ }[];
470
+ producers: {
471
+ identity: string;
472
+ kind: "audio" | "video";
473
+ producerId: string;
474
+ }[];
475
+ iceServers: {
476
+ urls: string | string[];
477
+ username?: string | undefined;
478
+ credential?: string | undefined;
479
+ }[];
480
+ recording: boolean;
481
+ grants?: {
482
+ canPublish: boolean;
483
+ canSubscribe: boolean;
484
+ canPublishData: boolean;
485
+ subscribe?: {
486
+ mode: "all";
487
+ } | {
488
+ mode: "none";
489
+ } | {
490
+ mode: "allow";
491
+ identities: string[];
492
+ } | {
493
+ mode: "deny";
494
+ identities: string[];
495
+ } | undefined;
496
+ visibleTo?: {
497
+ mode: "all";
498
+ } | {
499
+ mode: "none";
500
+ } | {
501
+ mode: "allow";
502
+ identities: string[];
503
+ } | {
504
+ mode: "deny";
505
+ identities: string[];
506
+ } | undefined;
507
+ publishKinds?: ("audio" | "video" | "screen")[] | undefined;
508
+ subscribeExempt?: boolean | undefined;
509
+ maxSubscriptions?: number | undefined;
510
+ } | undefined;
511
+ routerRtpCapabilities?: unknown;
512
+ }, {
513
+ room: string;
514
+ identity: string;
515
+ event: "joined";
516
+ peers: {
517
+ identity: string;
518
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
519
+ name?: string | undefined;
520
+ }[];
521
+ producers: {
522
+ identity: string;
523
+ kind: "audio" | "video";
524
+ producerId: string;
525
+ }[];
526
+ iceServers: {
527
+ urls: string | string[];
528
+ username?: string | undefined;
529
+ credential?: string | undefined;
530
+ }[];
531
+ recording: boolean;
532
+ grants?: {
533
+ canPublish: boolean;
534
+ canSubscribe: boolean;
535
+ canPublishData: boolean;
536
+ subscribe?: {
537
+ mode: "all";
538
+ } | {
539
+ mode: "none";
540
+ } | {
541
+ mode: "allow";
542
+ identities: string[];
543
+ } | {
544
+ mode: "deny";
545
+ identities: string[];
546
+ } | undefined;
547
+ visibleTo?: {
548
+ mode: "all";
549
+ } | {
550
+ mode: "none";
551
+ } | {
552
+ mode: "allow";
553
+ identities: string[];
554
+ } | {
555
+ mode: "deny";
556
+ identities: string[];
557
+ } | undefined;
558
+ publishKinds?: ("audio" | "video" | "screen")[] | undefined;
559
+ subscribeExempt?: boolean | undefined;
560
+ maxSubscriptions?: number | undefined;
561
+ } | undefined;
562
+ routerRtpCapabilities?: unknown;
563
+ }>, z.ZodObject<{
564
+ event: z.ZodLiteral<"peerJoined">;
565
+ peer: z.ZodObject<{
566
+ identity: z.ZodString;
567
+ name: z.ZodOptional<z.ZodString>;
568
+ kind: z.ZodEnum<["human", "agent", "egress", "sip", "ingress"]>;
569
+ }, "strip", z.ZodTypeAny, {
570
+ identity: string;
571
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
572
+ name?: string | undefined;
573
+ }, {
574
+ identity: string;
575
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
576
+ name?: string | undefined;
577
+ }>;
578
+ }, "strip", z.ZodTypeAny, {
579
+ event: "peerJoined";
580
+ peer: {
581
+ identity: string;
582
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
583
+ name?: string | undefined;
584
+ };
585
+ }, {
586
+ event: "peerJoined";
587
+ peer: {
588
+ identity: string;
589
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
590
+ name?: string | undefined;
591
+ };
592
+ }>, z.ZodObject<{
593
+ event: z.ZodLiteral<"peerLeft">;
594
+ identity: z.ZodString;
595
+ }, "strip", z.ZodTypeAny, {
596
+ identity: string;
597
+ event: "peerLeft";
598
+ }, {
599
+ identity: string;
600
+ event: "peerLeft";
601
+ }>, z.ZodObject<{
602
+ event: z.ZodLiteral<"producerAppeared">;
603
+ producerId: z.ZodString;
604
+ identity: z.ZodString;
605
+ kind: z.ZodEnum<["audio", "video"]>;
606
+ }, "strip", z.ZodTypeAny, {
607
+ identity: string;
608
+ kind: "audio" | "video";
609
+ producerId: string;
610
+ event: "producerAppeared";
611
+ }, {
612
+ identity: string;
613
+ kind: "audio" | "video";
614
+ producerId: string;
615
+ event: "producerAppeared";
616
+ }>, z.ZodObject<{
617
+ event: z.ZodLiteral<"producerClosed">;
618
+ producerId: z.ZodString;
619
+ }, "strip", z.ZodTypeAny, {
620
+ producerId: string;
621
+ event: "producerClosed";
622
+ }, {
623
+ producerId: string;
624
+ event: "producerClosed";
625
+ }>, z.ZodObject<{
626
+ event: z.ZodLiteral<"producerPaused">;
627
+ producerId: z.ZodString;
628
+ paused: z.ZodBoolean;
629
+ }, "strip", z.ZodTypeAny, {
630
+ producerId: string;
631
+ event: "producerPaused";
632
+ paused: boolean;
633
+ }, {
634
+ producerId: string;
635
+ event: "producerPaused";
636
+ paused: boolean;
637
+ }>, z.ZodObject<{
638
+ event: z.ZodLiteral<"activeSpeakers">;
639
+ producerIds: z.ZodArray<z.ZodString, "many">;
640
+ audio: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
641
+ video: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
642
+ enforced: z.ZodOptional<z.ZodBoolean>;
643
+ speakers: z.ZodOptional<z.ZodArray<z.ZodObject<{
644
+ identity: z.ZodString;
645
+ producerId: z.ZodString;
646
+ volumeDb: z.ZodNumber;
647
+ }, "strip", z.ZodTypeAny, {
648
+ identity: string;
649
+ producerId: string;
650
+ volumeDb: number;
651
+ }, {
652
+ identity: string;
653
+ producerId: string;
654
+ volumeDb: number;
655
+ }>, "many">>;
656
+ }, "strip", z.ZodTypeAny, {
657
+ event: "activeSpeakers";
658
+ producerIds: string[];
659
+ audio?: string[] | undefined;
660
+ video?: string[] | undefined;
661
+ enforced?: boolean | undefined;
662
+ speakers?: {
663
+ identity: string;
664
+ producerId: string;
665
+ volumeDb: number;
666
+ }[] | undefined;
667
+ }, {
668
+ event: "activeSpeakers";
669
+ producerIds: string[];
670
+ audio?: string[] | undefined;
671
+ video?: string[] | undefined;
672
+ enforced?: boolean | undefined;
673
+ speakers?: {
674
+ identity: string;
675
+ producerId: string;
676
+ volumeDb: number;
677
+ }[] | undefined;
678
+ }>, z.ZodObject<{
679
+ event: z.ZodLiteral<"recordingChanged">;
680
+ recording: z.ZodBoolean;
681
+ }, "strip", z.ZodTypeAny, {
682
+ event: "recordingChanged";
683
+ recording: boolean;
684
+ }, {
685
+ event: "recordingChanged";
686
+ recording: boolean;
687
+ }>, z.ZodObject<{
688
+ event: z.ZodLiteral<"draining">;
689
+ reconnectAfterMs: z.ZodNumber;
690
+ }, "strip", z.ZodTypeAny, {
691
+ event: "draining";
692
+ reconnectAfterMs: number;
693
+ }, {
694
+ event: "draining";
695
+ reconnectAfterMs: number;
696
+ }>, z.ZodObject<{
697
+ event: z.ZodLiteral<"roomClosed">;
698
+ reason: z.ZodString;
699
+ }, "strip", z.ZodTypeAny, {
700
+ event: "roomClosed";
701
+ reason: string;
702
+ }, {
703
+ event: "roomClosed";
704
+ reason: string;
705
+ }>, z.ZodObject<{
706
+ event: z.ZodLiteral<"subscribeRuleChanged">;
707
+ subscribe: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
708
+ mode: z.ZodLiteral<"all">;
709
+ }, "strict", z.ZodTypeAny, {
710
+ mode: "all";
711
+ }, {
712
+ mode: "all";
713
+ }>, z.ZodObject<{
714
+ mode: z.ZodLiteral<"none">;
715
+ }, "strict", z.ZodTypeAny, {
716
+ mode: "none";
717
+ }, {
718
+ mode: "none";
719
+ }>, z.ZodObject<{
720
+ mode: z.ZodLiteral<"allow">;
721
+ identities: z.ZodArray<z.ZodString, "many">;
722
+ }, "strict", z.ZodTypeAny, {
723
+ mode: "allow";
724
+ identities: string[];
725
+ }, {
726
+ mode: "allow";
727
+ identities: string[];
728
+ }>, z.ZodObject<{
729
+ mode: z.ZodLiteral<"deny">;
730
+ identities: z.ZodArray<z.ZodString, "many">;
731
+ }, "strict", z.ZodTypeAny, {
732
+ mode: "deny";
733
+ identities: string[];
734
+ }, {
735
+ mode: "deny";
736
+ identities: string[];
737
+ }>]>;
738
+ }, "strip", z.ZodTypeAny, {
739
+ subscribe: {
740
+ mode: "all";
741
+ } | {
742
+ mode: "none";
743
+ } | {
744
+ mode: "allow";
745
+ identities: string[];
746
+ } | {
747
+ mode: "deny";
748
+ identities: string[];
749
+ };
750
+ event: "subscribeRuleChanged";
751
+ }, {
752
+ subscribe: {
753
+ mode: "all";
754
+ } | {
755
+ mode: "none";
756
+ } | {
757
+ mode: "allow";
758
+ identities: string[];
759
+ } | {
760
+ mode: "deny";
761
+ identities: string[];
762
+ };
763
+ event: "subscribeRuleChanged";
764
+ }>]>;
765
+ export type EventFrame = z.infer<typeof eventFrameSchema>;
766
+ export type EventName = EventFrame["event"];
767
+ /** Anything arriving from a node. */
768
+ export declare const serverFrameSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
769
+ id: z.ZodNumber;
770
+ ok: z.ZodLiteral<true>;
771
+ data: z.ZodUnknown;
772
+ }, "strip", z.ZodTypeAny, {
773
+ id: number;
774
+ ok: true;
775
+ data?: unknown;
776
+ }, {
777
+ id: number;
778
+ ok: true;
779
+ data?: unknown;
780
+ }>, z.ZodObject<{
781
+ id: z.ZodNumber;
782
+ ok: z.ZodLiteral<false>;
783
+ /** The client sees a CODE, never why a token was refused. Telling a caller
784
+ * whether the signature or the room was wrong turns this into an oracle. */
785
+ code: z.ZodEnum<["unauthorized", "replayed", "protocol_version", "forbidden_transport", "forbidden", "not_subscribable", "subscription_limit", "room_closed", "no_such_room", "no_such_producer", "no_such_transport", "duplicate_identity", "node_draining", "capacity", "bad_request", "internal"]>;
786
+ message: z.ZodOptional<z.ZodString>;
787
+ }, "strip", z.ZodTypeAny, {
788
+ code: "unauthorized" | "replayed" | "protocol_version" | "forbidden_transport" | "forbidden" | "not_subscribable" | "subscription_limit" | "room_closed" | "no_such_room" | "no_such_producer" | "no_such_transport" | "duplicate_identity" | "node_draining" | "capacity" | "bad_request" | "internal";
789
+ id: number;
790
+ ok: false;
791
+ message?: string | undefined;
792
+ }, {
793
+ code: "unauthorized" | "replayed" | "protocol_version" | "forbidden_transport" | "forbidden" | "not_subscribable" | "subscription_limit" | "room_closed" | "no_such_room" | "no_such_producer" | "no_such_transport" | "duplicate_identity" | "node_draining" | "capacity" | "bad_request" | "internal";
794
+ id: number;
795
+ ok: false;
796
+ message?: string | undefined;
797
+ }>]>, z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
798
+ event: z.ZodLiteral<"joined">;
799
+ identity: z.ZodString;
800
+ room: z.ZodString;
801
+ /** Everything the client needs to build its device before any transport. */
802
+ routerRtpCapabilities: z.ZodUnknown;
803
+ peers: z.ZodArray<z.ZodObject<{
804
+ identity: z.ZodString;
805
+ name: z.ZodOptional<z.ZodString>;
806
+ kind: z.ZodEnum<["human", "agent", "egress", "sip", "ingress"]>;
807
+ }, "strip", z.ZodTypeAny, {
808
+ identity: string;
809
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
810
+ name?: string | undefined;
811
+ }, {
812
+ identity: string;
813
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
814
+ name?: string | undefined;
815
+ }>, "many">;
816
+ /** Producers this participant is ALLOWED to see. The barrier is applied to
817
+ * the snapshot, not only at consume: an identity it may not receive must
818
+ * not be discoverable either. */
819
+ producers: z.ZodArray<z.ZodObject<{
820
+ producerId: z.ZodString;
821
+ identity: z.ZodString;
822
+ kind: z.ZodEnum<["audio", "video"]>;
823
+ }, "strip", z.ZodTypeAny, {
824
+ identity: string;
825
+ kind: "audio" | "video";
826
+ producerId: string;
827
+ }, {
828
+ identity: string;
829
+ kind: "audio" | "video";
830
+ producerId: string;
831
+ }>, "many">;
832
+ iceServers: z.ZodArray<z.ZodObject<{
833
+ urls: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
834
+ username: z.ZodOptional<z.ZodString>;
835
+ credential: z.ZodOptional<z.ZodString>;
836
+ }, "strip", z.ZodTypeAny, {
837
+ urls: string | string[];
838
+ username?: string | undefined;
839
+ credential?: string | undefined;
840
+ }, {
841
+ urls: string | string[];
842
+ username?: string | undefined;
843
+ credential?: string | undefined;
844
+ }>, "many">;
845
+ /** True while any `kind: "egress"` participant is present. A consent
846
+ * requirement, not a nicety. */
847
+ recording: z.ZodBoolean;
848
+ /**
849
+ * What this token was minted with, echoed back.
850
+ *
851
+ * The client already holds the token but must not parse it: a signed blob
852
+ * a client reads is a signed blob a client eventually trusts its own
853
+ * reading of. This is the node's understanding of the grants, which is the
854
+ * one that will actually be enforced, so a UI built from it cannot offer a
855
+ * control the node is about to refuse.
856
+ */
857
+ grants: z.ZodOptional<z.ZodObject<{
858
+ canPublish: z.ZodBoolean;
859
+ canSubscribe: z.ZodBoolean;
860
+ canPublishData: z.ZodBoolean;
861
+ subscribe: z.ZodOptional<z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
862
+ mode: z.ZodLiteral<"all">;
863
+ }, "strict", z.ZodTypeAny, {
864
+ mode: "all";
865
+ }, {
866
+ mode: "all";
867
+ }>, z.ZodObject<{
868
+ mode: z.ZodLiteral<"none">;
869
+ }, "strict", z.ZodTypeAny, {
870
+ mode: "none";
871
+ }, {
872
+ mode: "none";
873
+ }>, z.ZodObject<{
874
+ mode: z.ZodLiteral<"allow">;
875
+ identities: z.ZodArray<z.ZodString, "many">;
876
+ }, "strict", z.ZodTypeAny, {
877
+ mode: "allow";
878
+ identities: string[];
879
+ }, {
880
+ mode: "allow";
881
+ identities: string[];
882
+ }>, z.ZodObject<{
883
+ mode: z.ZodLiteral<"deny">;
884
+ identities: z.ZodArray<z.ZodString, "many">;
885
+ }, "strict", z.ZodTypeAny, {
886
+ mode: "deny";
887
+ identities: string[];
888
+ }, {
889
+ mode: "deny";
890
+ identities: string[];
891
+ }>]>>;
892
+ visibleTo: z.ZodOptional<z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
893
+ mode: z.ZodLiteral<"all">;
894
+ }, "strict", z.ZodTypeAny, {
895
+ mode: "all";
896
+ }, {
897
+ mode: "all";
898
+ }>, z.ZodObject<{
899
+ mode: z.ZodLiteral<"none">;
900
+ }, "strict", z.ZodTypeAny, {
901
+ mode: "none";
902
+ }, {
903
+ mode: "none";
904
+ }>, z.ZodObject<{
905
+ mode: z.ZodLiteral<"allow">;
906
+ identities: z.ZodArray<z.ZodString, "many">;
907
+ }, "strict", z.ZodTypeAny, {
908
+ mode: "allow";
909
+ identities: string[];
910
+ }, {
911
+ mode: "allow";
912
+ identities: string[];
913
+ }>, z.ZodObject<{
914
+ mode: z.ZodLiteral<"deny">;
915
+ identities: z.ZodArray<z.ZodString, "many">;
916
+ }, "strict", z.ZodTypeAny, {
917
+ mode: "deny";
918
+ identities: string[];
919
+ }, {
920
+ mode: "deny";
921
+ identities: string[];
922
+ }>]>>;
923
+ publishKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<["audio", "video", "screen"]>, "many">>;
924
+ subscribeExempt: z.ZodOptional<z.ZodBoolean>;
925
+ maxSubscriptions: z.ZodOptional<z.ZodNumber>;
926
+ }, "strict", z.ZodTypeAny, {
927
+ canPublish: boolean;
928
+ canSubscribe: boolean;
929
+ canPublishData: boolean;
930
+ subscribe?: {
931
+ mode: "all";
932
+ } | {
933
+ mode: "none";
934
+ } | {
935
+ mode: "allow";
936
+ identities: string[];
937
+ } | {
938
+ mode: "deny";
939
+ identities: string[];
940
+ } | undefined;
941
+ visibleTo?: {
942
+ mode: "all";
943
+ } | {
944
+ mode: "none";
945
+ } | {
946
+ mode: "allow";
947
+ identities: string[];
948
+ } | {
949
+ mode: "deny";
950
+ identities: string[];
951
+ } | undefined;
952
+ publishKinds?: ("audio" | "video" | "screen")[] | undefined;
953
+ subscribeExempt?: boolean | undefined;
954
+ maxSubscriptions?: number | undefined;
955
+ }, {
956
+ canPublish: boolean;
957
+ canSubscribe: boolean;
958
+ canPublishData: boolean;
959
+ subscribe?: {
960
+ mode: "all";
961
+ } | {
962
+ mode: "none";
963
+ } | {
964
+ mode: "allow";
965
+ identities: string[];
966
+ } | {
967
+ mode: "deny";
968
+ identities: string[];
969
+ } | undefined;
970
+ visibleTo?: {
971
+ mode: "all";
972
+ } | {
973
+ mode: "none";
974
+ } | {
975
+ mode: "allow";
976
+ identities: string[];
977
+ } | {
978
+ mode: "deny";
979
+ identities: string[];
980
+ } | undefined;
981
+ publishKinds?: ("audio" | "video" | "screen")[] | undefined;
982
+ subscribeExempt?: boolean | undefined;
983
+ maxSubscriptions?: number | undefined;
984
+ }>>;
985
+ }, "strip", z.ZodTypeAny, {
986
+ room: string;
987
+ identity: string;
988
+ event: "joined";
989
+ peers: {
990
+ identity: string;
991
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
992
+ name?: string | undefined;
993
+ }[];
994
+ producers: {
995
+ identity: string;
996
+ kind: "audio" | "video";
997
+ producerId: string;
998
+ }[];
999
+ iceServers: {
1000
+ urls: string | string[];
1001
+ username?: string | undefined;
1002
+ credential?: string | undefined;
1003
+ }[];
1004
+ recording: boolean;
1005
+ grants?: {
1006
+ canPublish: boolean;
1007
+ canSubscribe: boolean;
1008
+ canPublishData: boolean;
1009
+ subscribe?: {
1010
+ mode: "all";
1011
+ } | {
1012
+ mode: "none";
1013
+ } | {
1014
+ mode: "allow";
1015
+ identities: string[];
1016
+ } | {
1017
+ mode: "deny";
1018
+ identities: string[];
1019
+ } | undefined;
1020
+ visibleTo?: {
1021
+ mode: "all";
1022
+ } | {
1023
+ mode: "none";
1024
+ } | {
1025
+ mode: "allow";
1026
+ identities: string[];
1027
+ } | {
1028
+ mode: "deny";
1029
+ identities: string[];
1030
+ } | undefined;
1031
+ publishKinds?: ("audio" | "video" | "screen")[] | undefined;
1032
+ subscribeExempt?: boolean | undefined;
1033
+ maxSubscriptions?: number | undefined;
1034
+ } | undefined;
1035
+ routerRtpCapabilities?: unknown;
1036
+ }, {
1037
+ room: string;
1038
+ identity: string;
1039
+ event: "joined";
1040
+ peers: {
1041
+ identity: string;
1042
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
1043
+ name?: string | undefined;
1044
+ }[];
1045
+ producers: {
1046
+ identity: string;
1047
+ kind: "audio" | "video";
1048
+ producerId: string;
1049
+ }[];
1050
+ iceServers: {
1051
+ urls: string | string[];
1052
+ username?: string | undefined;
1053
+ credential?: string | undefined;
1054
+ }[];
1055
+ recording: boolean;
1056
+ grants?: {
1057
+ canPublish: boolean;
1058
+ canSubscribe: boolean;
1059
+ canPublishData: boolean;
1060
+ subscribe?: {
1061
+ mode: "all";
1062
+ } | {
1063
+ mode: "none";
1064
+ } | {
1065
+ mode: "allow";
1066
+ identities: string[];
1067
+ } | {
1068
+ mode: "deny";
1069
+ identities: string[];
1070
+ } | undefined;
1071
+ visibleTo?: {
1072
+ mode: "all";
1073
+ } | {
1074
+ mode: "none";
1075
+ } | {
1076
+ mode: "allow";
1077
+ identities: string[];
1078
+ } | {
1079
+ mode: "deny";
1080
+ identities: string[];
1081
+ } | undefined;
1082
+ publishKinds?: ("audio" | "video" | "screen")[] | undefined;
1083
+ subscribeExempt?: boolean | undefined;
1084
+ maxSubscriptions?: number | undefined;
1085
+ } | undefined;
1086
+ routerRtpCapabilities?: unknown;
1087
+ }>, z.ZodObject<{
1088
+ event: z.ZodLiteral<"peerJoined">;
1089
+ peer: z.ZodObject<{
1090
+ identity: z.ZodString;
1091
+ name: z.ZodOptional<z.ZodString>;
1092
+ kind: z.ZodEnum<["human", "agent", "egress", "sip", "ingress"]>;
1093
+ }, "strip", z.ZodTypeAny, {
1094
+ identity: string;
1095
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
1096
+ name?: string | undefined;
1097
+ }, {
1098
+ identity: string;
1099
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
1100
+ name?: string | undefined;
1101
+ }>;
1102
+ }, "strip", z.ZodTypeAny, {
1103
+ event: "peerJoined";
1104
+ peer: {
1105
+ identity: string;
1106
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
1107
+ name?: string | undefined;
1108
+ };
1109
+ }, {
1110
+ event: "peerJoined";
1111
+ peer: {
1112
+ identity: string;
1113
+ kind: "human" | "agent" | "egress" | "sip" | "ingress";
1114
+ name?: string | undefined;
1115
+ };
1116
+ }>, z.ZodObject<{
1117
+ event: z.ZodLiteral<"peerLeft">;
1118
+ identity: z.ZodString;
1119
+ }, "strip", z.ZodTypeAny, {
1120
+ identity: string;
1121
+ event: "peerLeft";
1122
+ }, {
1123
+ identity: string;
1124
+ event: "peerLeft";
1125
+ }>, z.ZodObject<{
1126
+ event: z.ZodLiteral<"producerAppeared">;
1127
+ producerId: z.ZodString;
1128
+ identity: z.ZodString;
1129
+ kind: z.ZodEnum<["audio", "video"]>;
1130
+ }, "strip", z.ZodTypeAny, {
1131
+ identity: string;
1132
+ kind: "audio" | "video";
1133
+ producerId: string;
1134
+ event: "producerAppeared";
1135
+ }, {
1136
+ identity: string;
1137
+ kind: "audio" | "video";
1138
+ producerId: string;
1139
+ event: "producerAppeared";
1140
+ }>, z.ZodObject<{
1141
+ event: z.ZodLiteral<"producerClosed">;
1142
+ producerId: z.ZodString;
1143
+ }, "strip", z.ZodTypeAny, {
1144
+ producerId: string;
1145
+ event: "producerClosed";
1146
+ }, {
1147
+ producerId: string;
1148
+ event: "producerClosed";
1149
+ }>, z.ZodObject<{
1150
+ event: z.ZodLiteral<"producerPaused">;
1151
+ producerId: z.ZodString;
1152
+ paused: z.ZodBoolean;
1153
+ }, "strip", z.ZodTypeAny, {
1154
+ producerId: string;
1155
+ event: "producerPaused";
1156
+ paused: boolean;
1157
+ }, {
1158
+ producerId: string;
1159
+ event: "producerPaused";
1160
+ paused: boolean;
1161
+ }>, z.ZodObject<{
1162
+ event: z.ZodLiteral<"activeSpeakers">;
1163
+ producerIds: z.ZodArray<z.ZodString, "many">;
1164
+ audio: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1165
+ video: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1166
+ enforced: z.ZodOptional<z.ZodBoolean>;
1167
+ speakers: z.ZodOptional<z.ZodArray<z.ZodObject<{
1168
+ identity: z.ZodString;
1169
+ producerId: z.ZodString;
1170
+ volumeDb: z.ZodNumber;
1171
+ }, "strip", z.ZodTypeAny, {
1172
+ identity: string;
1173
+ producerId: string;
1174
+ volumeDb: number;
1175
+ }, {
1176
+ identity: string;
1177
+ producerId: string;
1178
+ volumeDb: number;
1179
+ }>, "many">>;
1180
+ }, "strip", z.ZodTypeAny, {
1181
+ event: "activeSpeakers";
1182
+ producerIds: string[];
1183
+ audio?: string[] | undefined;
1184
+ video?: string[] | undefined;
1185
+ enforced?: boolean | undefined;
1186
+ speakers?: {
1187
+ identity: string;
1188
+ producerId: string;
1189
+ volumeDb: number;
1190
+ }[] | undefined;
1191
+ }, {
1192
+ event: "activeSpeakers";
1193
+ producerIds: string[];
1194
+ audio?: string[] | undefined;
1195
+ video?: string[] | undefined;
1196
+ enforced?: boolean | undefined;
1197
+ speakers?: {
1198
+ identity: string;
1199
+ producerId: string;
1200
+ volumeDb: number;
1201
+ }[] | undefined;
1202
+ }>, z.ZodObject<{
1203
+ event: z.ZodLiteral<"recordingChanged">;
1204
+ recording: z.ZodBoolean;
1205
+ }, "strip", z.ZodTypeAny, {
1206
+ event: "recordingChanged";
1207
+ recording: boolean;
1208
+ }, {
1209
+ event: "recordingChanged";
1210
+ recording: boolean;
1211
+ }>, z.ZodObject<{
1212
+ event: z.ZodLiteral<"draining">;
1213
+ reconnectAfterMs: z.ZodNumber;
1214
+ }, "strip", z.ZodTypeAny, {
1215
+ event: "draining";
1216
+ reconnectAfterMs: number;
1217
+ }, {
1218
+ event: "draining";
1219
+ reconnectAfterMs: number;
1220
+ }>, z.ZodObject<{
1221
+ event: z.ZodLiteral<"roomClosed">;
1222
+ reason: z.ZodString;
1223
+ }, "strip", z.ZodTypeAny, {
1224
+ event: "roomClosed";
1225
+ reason: string;
1226
+ }, {
1227
+ event: "roomClosed";
1228
+ reason: string;
1229
+ }>, z.ZodObject<{
1230
+ event: z.ZodLiteral<"subscribeRuleChanged">;
1231
+ subscribe: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
1232
+ mode: z.ZodLiteral<"all">;
1233
+ }, "strict", z.ZodTypeAny, {
1234
+ mode: "all";
1235
+ }, {
1236
+ mode: "all";
1237
+ }>, z.ZodObject<{
1238
+ mode: z.ZodLiteral<"none">;
1239
+ }, "strict", z.ZodTypeAny, {
1240
+ mode: "none";
1241
+ }, {
1242
+ mode: "none";
1243
+ }>, z.ZodObject<{
1244
+ mode: z.ZodLiteral<"allow">;
1245
+ identities: z.ZodArray<z.ZodString, "many">;
1246
+ }, "strict", z.ZodTypeAny, {
1247
+ mode: "allow";
1248
+ identities: string[];
1249
+ }, {
1250
+ mode: "allow";
1251
+ identities: string[];
1252
+ }>, z.ZodObject<{
1253
+ mode: z.ZodLiteral<"deny">;
1254
+ identities: z.ZodArray<z.ZodString, "many">;
1255
+ }, "strict", z.ZodTypeAny, {
1256
+ mode: "deny";
1257
+ identities: string[];
1258
+ }, {
1259
+ mode: "deny";
1260
+ identities: string[];
1261
+ }>]>;
1262
+ }, "strip", z.ZodTypeAny, {
1263
+ subscribe: {
1264
+ mode: "all";
1265
+ } | {
1266
+ mode: "none";
1267
+ } | {
1268
+ mode: "allow";
1269
+ identities: string[];
1270
+ } | {
1271
+ mode: "deny";
1272
+ identities: string[];
1273
+ };
1274
+ event: "subscribeRuleChanged";
1275
+ }, {
1276
+ subscribe: {
1277
+ mode: "all";
1278
+ } | {
1279
+ mode: "none";
1280
+ } | {
1281
+ mode: "allow";
1282
+ identities: string[];
1283
+ } | {
1284
+ mode: "deny";
1285
+ identities: string[];
1286
+ };
1287
+ event: "subscribeRuleChanged";
1288
+ }>]>]>;
1289
+ export type ServerFrame = z.infer<typeof serverFrameSchema>;
1290
+ export declare const isEvent: (frame: ServerFrame) => frame is EventFrame;
1291
+ //# sourceMappingURL=frames.d.ts.map