@4players/odin-common 3.2.0 → 4.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 (89) hide show
  1. package/README.md +11 -5
  2. package/mod.d.ts +4431 -0
  3. package/mod.js +1182 -0
  4. package/mod.mjs +1065 -0
  5. package/package.json +6 -30
  6. package/eslint.config.mjs +0 -30
  7. package/lib/cjs/index.js +0 -44
  8. package/lib/cjs/plugin/api.js +0 -19
  9. package/lib/cjs/rpc/commands.js +0 -96
  10. package/lib/cjs/rpc/notifications.js +0 -39
  11. package/lib/cjs/schema/channels.js +0 -44
  12. package/lib/cjs/schema/media.js +0 -25
  13. package/lib/cjs/schema/message.js +0 -10
  14. package/lib/cjs/schema/peer.js +0 -34
  15. package/lib/cjs/schema/room.js +0 -136
  16. package/lib/cjs/schema/serialization.js +0 -15
  17. package/lib/cjs/schema/token.js +0 -33
  18. package/lib/cjs/schema/webrtc.js +0 -23
  19. package/lib/cjs/tsconfig.cjs.tsbuildinfo +0 -1
  20. package/lib/cjs/utility/base64.js +0 -29
  21. package/lib/cjs/utility/bytearray.js +0 -28
  22. package/lib/cjs/utility/codec.js +0 -89
  23. package/lib/cjs/utility/environment.js +0 -32
  24. package/lib/cjs/utility/iterable.js +0 -10
  25. package/lib/cjs/utility/json.js +0 -6
  26. package/lib/cjs/utility/log.js +0 -224
  27. package/lib/cjs/utility/msgpack.js +0 -11
  28. package/lib/cjs/utility/result.js +0 -31
  29. package/lib/cjs/utility/selector.js +0 -18
  30. package/lib/cjs/utility/sleep.js +0 -27
  31. package/lib/cjs/utility/strand.js +0 -38
  32. package/lib/cjs/utility/url.js +0 -27
  33. package/lib/cjs/utility/uuid.js +0 -11
  34. package/lib/cjs/utility/validation.js +0 -38
  35. package/lib/esm/index.js +0 -27
  36. package/lib/esm/plugin/api.js +0 -16
  37. package/lib/esm/rpc/commands.js +0 -93
  38. package/lib/esm/rpc/notifications.js +0 -36
  39. package/lib/esm/schema/channels.js +0 -40
  40. package/lib/esm/schema/media.js +0 -22
  41. package/lib/esm/schema/message.js +0 -7
  42. package/lib/esm/schema/peer.js +0 -31
  43. package/lib/esm/schema/room.js +0 -133
  44. package/lib/esm/schema/serialization.js +0 -12
  45. package/lib/esm/schema/token.js +0 -29
  46. package/lib/esm/schema/webrtc.js +0 -20
  47. package/lib/esm/tsconfig.esm.tsbuildinfo +0 -1
  48. package/lib/esm/utility/base64.js +0 -25
  49. package/lib/esm/utility/bytearray.js +0 -24
  50. package/lib/esm/utility/codec.js +0 -85
  51. package/lib/esm/utility/environment.js +0 -24
  52. package/lib/esm/utility/iterable.js +0 -7
  53. package/lib/esm/utility/json.js +0 -3
  54. package/lib/esm/utility/log.js +0 -210
  55. package/lib/esm/utility/msgpack.js +0 -7
  56. package/lib/esm/utility/result.js +0 -23
  57. package/lib/esm/utility/selector.js +0 -14
  58. package/lib/esm/utility/sleep.js +0 -22
  59. package/lib/esm/utility/strand.js +0 -34
  60. package/lib/esm/utility/url.js +0 -23
  61. package/lib/esm/utility/uuid.js +0 -7
  62. package/lib/esm/utility/validation.js +0 -27
  63. package/lib/index.d.ts +0 -27
  64. package/lib/plugin/api.d.ts +0 -159
  65. package/lib/rpc/commands.d.ts +0 -253
  66. package/lib/rpc/notifications.d.ts +0 -1626
  67. package/lib/schema/channels.d.ts +0 -11
  68. package/lib/schema/media.d.ts +0 -122
  69. package/lib/schema/message.d.ts +0 -12
  70. package/lib/schema/peer.d.ts +0 -226
  71. package/lib/schema/room.d.ts +0 -1673
  72. package/lib/schema/serialization.d.ts +0 -12
  73. package/lib/schema/token.d.ts +0 -58
  74. package/lib/schema/webrtc.d.ts +0 -42
  75. package/lib/utility/base64.d.ts +0 -3
  76. package/lib/utility/bytearray.d.ts +0 -4
  77. package/lib/utility/codec.d.ts +0 -15
  78. package/lib/utility/environment.d.ts +0 -6
  79. package/lib/utility/iterable.d.ts +0 -1
  80. package/lib/utility/json.d.ts +0 -4
  81. package/lib/utility/log.d.ts +0 -79
  82. package/lib/utility/msgpack.d.ts +0 -2
  83. package/lib/utility/result.d.ts +0 -18
  84. package/lib/utility/selector.d.ts +0 -7
  85. package/lib/utility/sleep.d.ts +0 -4
  86. package/lib/utility/strand.d.ts +0 -8
  87. package/lib/utility/url.d.ts +0 -3
  88. package/lib/utility/uuid.d.ts +0 -2
  89. package/lib/utility/validation.d.ts +0 -10
package/mod.d.ts ADDED
@@ -0,0 +1,4431 @@
1
+ declare module "src/schema/serialization" {
2
+ import { z } from "zod";
3
+ export const ByteArraySchema: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
4
+ export type ByteArray = z.infer<typeof ByteArraySchema>;
5
+ const LiteralSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
6
+ type Literal = z.infer<typeof LiteralSchema>;
7
+ export type Json = Literal | {
8
+ [key: string]: Json;
9
+ } | Json[];
10
+ export const JsonSchema: z.ZodType<Json>;
11
+ export const MessagePackRpcSchema: z.ZodUnion<[z.ZodTuple<[z.ZodLiteral<0>, z.ZodNumber, z.ZodString, z.ZodUnknown], null>, z.ZodTuple<[z.ZodLiteral<1>, z.ZodNumber, z.ZodNullable<z.ZodString>, z.ZodUnknown], null>, z.ZodTuple<[z.ZodLiteral<2>, z.ZodString, z.ZodUnknown], null>]>;
12
+ export type MessagePackRpc = z.infer<typeof MessagePackRpcSchema>;
13
+ }
14
+ declare module "src/schema/token" {
15
+ import { z } from "zod";
16
+ export const TokenAudienceSchema: z.ZodEnum<["sfu", "gateway"]>;
17
+ export const TokenSubjectSchema: z.ZodEnum<["connect", "roomclose", "roomupdate", "roombanclient", "roomsendmessage"]>;
18
+ export const TokenClaimsSchema: z.ZodObject<{
19
+ uid: z.ZodString;
20
+ cid: z.ZodOptional<z.ZodString>;
21
+ rid: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
22
+ nsp: z.ZodOptional<z.ZodString>;
23
+ adr: z.ZodOptional<z.ZodString>;
24
+ aud: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["sfu", "gateway"]>, z.ZodArray<z.ZodEnum<["sfu", "gateway"]>, "many">]>>;
25
+ sub: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["connect", "roomclose", "roomupdate", "roombanclient", "roomsendmessage"]>, z.ZodArray<z.ZodEnum<["connect", "roomclose", "roomupdate", "roombanclient", "roomsendmessage"]>, "many">]>>;
26
+ exp: z.ZodOptional<z.ZodNumber>;
27
+ nbf: z.ZodOptional<z.ZodNumber>;
28
+ ups: z.ZodOptional<z.ZodString>;
29
+ tgs: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
30
+ tsp: z.ZodOptional<z.ZodNumber>;
31
+ internal: z.ZodOptional<z.ZodObject<{
32
+ server: z.ZodOptional<z.ZodString>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ server?: string;
35
+ }, {
36
+ server?: string;
37
+ }>>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ sub?: "connect" | "roomclose" | "roomupdate" | "roombanclient" | "roomsendmessage" | ("connect" | "roomclose" | "roomupdate" | "roombanclient" | "roomsendmessage")[];
40
+ internal?: {
41
+ server?: string;
42
+ };
43
+ uid?: string;
44
+ cid?: string;
45
+ rid?: string | string[];
46
+ nsp?: string;
47
+ adr?: string;
48
+ aud?: "sfu" | "gateway" | ("sfu" | "gateway")[];
49
+ exp?: number;
50
+ nbf?: number;
51
+ ups?: string;
52
+ tgs?: string | string[];
53
+ tsp?: number;
54
+ }, {
55
+ sub?: "connect" | "roomclose" | "roomupdate" | "roombanclient" | "roomsendmessage" | ("connect" | "roomclose" | "roomupdate" | "roombanclient" | "roomsendmessage")[];
56
+ internal?: {
57
+ server?: string;
58
+ };
59
+ uid?: string;
60
+ cid?: string;
61
+ rid?: string | string[];
62
+ nsp?: string;
63
+ adr?: string;
64
+ aud?: "sfu" | "gateway" | ("sfu" | "gateway")[];
65
+ exp?: number;
66
+ nbf?: number;
67
+ ups?: string;
68
+ tgs?: string | string[];
69
+ tsp?: number;
70
+ }>;
71
+ export type TokenClaims = z.infer<typeof TokenClaimsSchema>;
72
+ export function oneOrMany<T extends z.ZodTypeAny>(type: T): z.ZodUnion<[T, z.ZodArray<T, "many">]>;
73
+ }
74
+ declare module "src/schema/media" {
75
+ import * as z from "zod";
76
+ export const MediaIdSchema: z.ZodNumber;
77
+ export type MediaId = z.infer<typeof MediaIdSchema>;
78
+ export const MediaAudioPropertiesSchema: z.ZodObject<{
79
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
80
+ uid: z.ZodOptional<z.ZodString>;
81
+ customType: z.ZodOptional<z.ZodString>;
82
+ }, "strip", z.ZodTypeAny, {
83
+ uid?: string;
84
+ kind?: "audio";
85
+ customType?: string;
86
+ }, {
87
+ uid?: string;
88
+ kind?: "audio";
89
+ customType?: string;
90
+ }>;
91
+ export type MediaAudioProperties = z.infer<typeof MediaAudioPropertiesSchema>;
92
+ export const MediaVideoPropertiesSchema: z.ZodObject<{
93
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
94
+ codec: z.ZodOptional<z.ZodString>;
95
+ uid: z.ZodOptional<z.ZodString>;
96
+ customType: z.ZodOptional<z.ZodString>;
97
+ }, "strip", z.ZodTypeAny, {
98
+ codec?: string;
99
+ uid?: string;
100
+ kind?: "video";
101
+ customType?: string;
102
+ }, {
103
+ codec?: string;
104
+ uid?: string;
105
+ kind?: "video";
106
+ customType?: string;
107
+ }>;
108
+ export type MediaVideoProperties = z.infer<typeof MediaVideoPropertiesSchema>;
109
+ export const MediaPropertiesSchema: z.ZodUnion<[z.ZodObject<{
110
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
111
+ uid: z.ZodOptional<z.ZodString>;
112
+ customType: z.ZodOptional<z.ZodString>;
113
+ }, "strip", z.ZodTypeAny, {
114
+ uid?: string;
115
+ kind?: "audio";
116
+ customType?: string;
117
+ }, {
118
+ uid?: string;
119
+ kind?: "audio";
120
+ customType?: string;
121
+ }>, z.ZodObject<{
122
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
123
+ codec: z.ZodOptional<z.ZodString>;
124
+ uid: z.ZodOptional<z.ZodString>;
125
+ customType: z.ZodOptional<z.ZodString>;
126
+ }, "strip", z.ZodTypeAny, {
127
+ codec?: string;
128
+ uid?: string;
129
+ kind?: "video";
130
+ customType?: string;
131
+ }, {
132
+ codec?: string;
133
+ uid?: string;
134
+ kind?: "video";
135
+ customType?: string;
136
+ }>]>;
137
+ export type MediaProperties = z.infer<typeof MediaPropertiesSchema>;
138
+ export const MediaSchema: z.ZodObject<{
139
+ id: z.ZodNumber;
140
+ properties: z.ZodUnion<[z.ZodObject<{
141
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
142
+ uid: z.ZodOptional<z.ZodString>;
143
+ customType: z.ZodOptional<z.ZodString>;
144
+ }, "strip", z.ZodTypeAny, {
145
+ uid?: string;
146
+ kind?: "audio";
147
+ customType?: string;
148
+ }, {
149
+ uid?: string;
150
+ kind?: "audio";
151
+ customType?: string;
152
+ }>, z.ZodObject<{
153
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
154
+ codec: z.ZodOptional<z.ZodString>;
155
+ uid: z.ZodOptional<z.ZodString>;
156
+ customType: z.ZodOptional<z.ZodString>;
157
+ }, "strip", z.ZodTypeAny, {
158
+ codec?: string;
159
+ uid?: string;
160
+ kind?: "video";
161
+ customType?: string;
162
+ }, {
163
+ codec?: string;
164
+ uid?: string;
165
+ kind?: "video";
166
+ customType?: string;
167
+ }>]>;
168
+ paused: z.ZodBoolean;
169
+ }, "strip", z.ZodTypeAny, {
170
+ id?: number;
171
+ paused?: boolean;
172
+ properties?: {
173
+ uid?: string;
174
+ kind?: "audio";
175
+ customType?: string;
176
+ } | {
177
+ codec?: string;
178
+ uid?: string;
179
+ kind?: "video";
180
+ customType?: string;
181
+ };
182
+ }, {
183
+ id?: number;
184
+ paused?: boolean;
185
+ properties?: {
186
+ uid?: string;
187
+ kind?: "audio";
188
+ customType?: string;
189
+ } | {
190
+ codec?: string;
191
+ uid?: string;
192
+ kind?: "video";
193
+ customType?: string;
194
+ };
195
+ }>;
196
+ export type Media = z.infer<typeof MediaSchema>;
197
+ }
198
+ declare module "src/schema/peer" {
199
+ import * as z from "zod";
200
+ export const PeerIdSchema: z.ZodNumber;
201
+ export type PeerId = z.infer<typeof PeerIdSchema>;
202
+ export const PeerPositionSchema: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
203
+ export type PeerPosition = z.infer<typeof PeerPositionSchema>;
204
+ export const PeerSchema: z.ZodObject<{
205
+ id: z.ZodNumber;
206
+ user_id: z.ZodString;
207
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
208
+ medias: z.ZodArray<z.ZodObject<{
209
+ id: z.ZodNumber;
210
+ properties: z.ZodUnion<[z.ZodObject<{
211
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
212
+ uid: z.ZodOptional<z.ZodString>;
213
+ customType: z.ZodOptional<z.ZodString>;
214
+ }, "strip", z.ZodTypeAny, {
215
+ uid?: string;
216
+ kind?: "audio";
217
+ customType?: string;
218
+ }, {
219
+ uid?: string;
220
+ kind?: "audio";
221
+ customType?: string;
222
+ }>, z.ZodObject<{
223
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
224
+ codec: z.ZodOptional<z.ZodString>;
225
+ uid: z.ZodOptional<z.ZodString>;
226
+ customType: z.ZodOptional<z.ZodString>;
227
+ }, "strip", z.ZodTypeAny, {
228
+ codec?: string;
229
+ uid?: string;
230
+ kind?: "video";
231
+ customType?: string;
232
+ }, {
233
+ codec?: string;
234
+ uid?: string;
235
+ kind?: "video";
236
+ customType?: string;
237
+ }>]>;
238
+ paused: z.ZodBoolean;
239
+ }, "strip", z.ZodTypeAny, {
240
+ id?: number;
241
+ paused?: boolean;
242
+ properties?: {
243
+ uid?: string;
244
+ kind?: "audio";
245
+ customType?: string;
246
+ } | {
247
+ codec?: string;
248
+ uid?: string;
249
+ kind?: "video";
250
+ customType?: string;
251
+ };
252
+ }, {
253
+ id?: number;
254
+ paused?: boolean;
255
+ properties?: {
256
+ uid?: string;
257
+ kind?: "audio";
258
+ customType?: string;
259
+ } | {
260
+ codec?: string;
261
+ uid?: string;
262
+ kind?: "video";
263
+ customType?: string;
264
+ };
265
+ }>, "many">;
266
+ }, "strip", z.ZodTypeAny, {
267
+ id?: number;
268
+ user_id?: string;
269
+ user_data?: Uint8Array<ArrayBufferLike>;
270
+ medias?: {
271
+ id?: number;
272
+ paused?: boolean;
273
+ properties?: {
274
+ uid?: string;
275
+ kind?: "audio";
276
+ customType?: string;
277
+ } | {
278
+ codec?: string;
279
+ uid?: string;
280
+ kind?: "video";
281
+ customType?: string;
282
+ };
283
+ }[];
284
+ }, {
285
+ id?: number;
286
+ user_id?: string;
287
+ user_data?: Uint8Array<ArrayBufferLike>;
288
+ medias?: {
289
+ id?: number;
290
+ paused?: boolean;
291
+ properties?: {
292
+ uid?: string;
293
+ kind?: "audio";
294
+ customType?: string;
295
+ } | {
296
+ codec?: string;
297
+ uid?: string;
298
+ kind?: "video";
299
+ customType?: string;
300
+ };
301
+ }[];
302
+ }>;
303
+ export type Peer = z.infer<typeof PeerSchema>;
304
+ export const PeerUpdateSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
305
+ kind: z.ZodLiteral<"UserDataChanged">;
306
+ peer_id: z.ZodNumber;
307
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
308
+ }, "strip", z.ZodTypeAny, {
309
+ kind?: "UserDataChanged";
310
+ user_data?: Uint8Array<ArrayBufferLike>;
311
+ peer_id?: number;
312
+ }, {
313
+ kind?: "UserDataChanged";
314
+ user_data?: Uint8Array<ArrayBufferLike>;
315
+ peer_id?: number;
316
+ }>, z.ZodObject<{
317
+ kind: z.ZodLiteral<"MediaStarted">;
318
+ peer_id: z.ZodNumber;
319
+ media: z.ZodObject<{
320
+ id: z.ZodNumber;
321
+ properties: z.ZodUnion<[z.ZodObject<{
322
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
323
+ uid: z.ZodOptional<z.ZodString>;
324
+ customType: z.ZodOptional<z.ZodString>;
325
+ }, "strip", z.ZodTypeAny, {
326
+ uid?: string;
327
+ kind?: "audio";
328
+ customType?: string;
329
+ }, {
330
+ uid?: string;
331
+ kind?: "audio";
332
+ customType?: string;
333
+ }>, z.ZodObject<{
334
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
335
+ codec: z.ZodOptional<z.ZodString>;
336
+ uid: z.ZodOptional<z.ZodString>;
337
+ customType: z.ZodOptional<z.ZodString>;
338
+ }, "strip", z.ZodTypeAny, {
339
+ codec?: string;
340
+ uid?: string;
341
+ kind?: "video";
342
+ customType?: string;
343
+ }, {
344
+ codec?: string;
345
+ uid?: string;
346
+ kind?: "video";
347
+ customType?: string;
348
+ }>]>;
349
+ paused: z.ZodBoolean;
350
+ }, "strip", z.ZodTypeAny, {
351
+ id?: number;
352
+ paused?: boolean;
353
+ properties?: {
354
+ uid?: string;
355
+ kind?: "audio";
356
+ customType?: string;
357
+ } | {
358
+ codec?: string;
359
+ uid?: string;
360
+ kind?: "video";
361
+ customType?: string;
362
+ };
363
+ }, {
364
+ id?: number;
365
+ paused?: boolean;
366
+ properties?: {
367
+ uid?: string;
368
+ kind?: "audio";
369
+ customType?: string;
370
+ } | {
371
+ codec?: string;
372
+ uid?: string;
373
+ kind?: "video";
374
+ customType?: string;
375
+ };
376
+ }>;
377
+ }, "strip", z.ZodTypeAny, {
378
+ media?: {
379
+ id?: number;
380
+ paused?: boolean;
381
+ properties?: {
382
+ uid?: string;
383
+ kind?: "audio";
384
+ customType?: string;
385
+ } | {
386
+ codec?: string;
387
+ uid?: string;
388
+ kind?: "video";
389
+ customType?: string;
390
+ };
391
+ };
392
+ kind?: "MediaStarted";
393
+ peer_id?: number;
394
+ }, {
395
+ media?: {
396
+ id?: number;
397
+ paused?: boolean;
398
+ properties?: {
399
+ uid?: string;
400
+ kind?: "audio";
401
+ customType?: string;
402
+ } | {
403
+ codec?: string;
404
+ uid?: string;
405
+ kind?: "video";
406
+ customType?: string;
407
+ };
408
+ };
409
+ kind?: "MediaStarted";
410
+ peer_id?: number;
411
+ }>, z.ZodObject<{
412
+ kind: z.ZodLiteral<"MediaStopped">;
413
+ peer_id: z.ZodNumber;
414
+ media_id: z.ZodNumber;
415
+ }, "strip", z.ZodTypeAny, {
416
+ kind?: "MediaStopped";
417
+ peer_id?: number;
418
+ media_id?: number;
419
+ }, {
420
+ kind?: "MediaStopped";
421
+ peer_id?: number;
422
+ media_id?: number;
423
+ }>]>;
424
+ export type PeerUpdate = z.infer<typeof PeerUpdateSchema>;
425
+ }
426
+ declare module "src/schema/channels" {
427
+ import * as z from "zod";
428
+ export class ChannelSet {
429
+ private value;
430
+ constructor(value?: bigint);
431
+ from(...channels: number[]): ChannelSet;
432
+ contains(channel: number): boolean;
433
+ insert(channel: number): void;
434
+ remove(channel: number): void;
435
+ [Symbol.iterator](): Iterator<number>;
436
+ }
437
+ export const ChannelSetSchema: z.ZodEffects<z.ZodBigInt, ChannelSet, bigint>;
438
+ }
439
+ declare module "src/schema/room" {
440
+ import * as z from "zod";
441
+ export namespace RoomV1 {
442
+ const RoomIdSchema: z.ZodString;
443
+ type RoomId = z.infer<typeof RoomIdSchema>;
444
+ const RoomSchema: z.ZodObject<{
445
+ id: z.ZodString;
446
+ customer: z.ZodString;
447
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
448
+ peers: z.ZodArray<z.ZodObject<{
449
+ id: z.ZodNumber;
450
+ user_id: z.ZodString;
451
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
452
+ medias: z.ZodArray<z.ZodObject<{
453
+ id: z.ZodNumber;
454
+ properties: z.ZodUnion<[z.ZodObject<{
455
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
456
+ uid: z.ZodOptional<z.ZodString>;
457
+ customType: z.ZodOptional<z.ZodString>;
458
+ }, "strip", z.ZodTypeAny, {
459
+ uid?: string;
460
+ kind?: "audio";
461
+ customType?: string;
462
+ }, {
463
+ uid?: string;
464
+ kind?: "audio";
465
+ customType?: string;
466
+ }>, z.ZodObject<{
467
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
468
+ codec: z.ZodOptional<z.ZodString>;
469
+ uid: z.ZodOptional<z.ZodString>;
470
+ customType: z.ZodOptional<z.ZodString>;
471
+ }, "strip", z.ZodTypeAny, {
472
+ codec?: string;
473
+ uid?: string;
474
+ kind?: "video";
475
+ customType?: string;
476
+ }, {
477
+ codec?: string;
478
+ uid?: string;
479
+ kind?: "video";
480
+ customType?: string;
481
+ }>]>;
482
+ paused: z.ZodBoolean;
483
+ }, "strip", z.ZodTypeAny, {
484
+ id?: number;
485
+ paused?: boolean;
486
+ properties?: {
487
+ uid?: string;
488
+ kind?: "audio";
489
+ customType?: string;
490
+ } | {
491
+ codec?: string;
492
+ uid?: string;
493
+ kind?: "video";
494
+ customType?: string;
495
+ };
496
+ }, {
497
+ id?: number;
498
+ paused?: boolean;
499
+ properties?: {
500
+ uid?: string;
501
+ kind?: "audio";
502
+ customType?: string;
503
+ } | {
504
+ codec?: string;
505
+ uid?: string;
506
+ kind?: "video";
507
+ customType?: string;
508
+ };
509
+ }>, "many">;
510
+ }, "strip", z.ZodTypeAny, {
511
+ id?: number;
512
+ user_id?: string;
513
+ user_data?: Uint8Array<ArrayBufferLike>;
514
+ medias?: {
515
+ id?: number;
516
+ paused?: boolean;
517
+ properties?: {
518
+ uid?: string;
519
+ kind?: "audio";
520
+ customType?: string;
521
+ } | {
522
+ codec?: string;
523
+ uid?: string;
524
+ kind?: "video";
525
+ customType?: string;
526
+ };
527
+ }[];
528
+ }, {
529
+ id?: number;
530
+ user_id?: string;
531
+ user_data?: Uint8Array<ArrayBufferLike>;
532
+ medias?: {
533
+ id?: number;
534
+ paused?: boolean;
535
+ properties?: {
536
+ uid?: string;
537
+ kind?: "audio";
538
+ customType?: string;
539
+ } | {
540
+ codec?: string;
541
+ uid?: string;
542
+ kind?: "video";
543
+ customType?: string;
544
+ };
545
+ }[];
546
+ }>, "many">;
547
+ }, "strip", z.ZodTypeAny, {
548
+ id?: string;
549
+ user_data?: Uint8Array<ArrayBufferLike>;
550
+ customer?: string;
551
+ peers?: {
552
+ id?: number;
553
+ user_id?: string;
554
+ user_data?: Uint8Array<ArrayBufferLike>;
555
+ medias?: {
556
+ id?: number;
557
+ paused?: boolean;
558
+ properties?: {
559
+ uid?: string;
560
+ kind?: "audio";
561
+ customType?: string;
562
+ } | {
563
+ codec?: string;
564
+ uid?: string;
565
+ kind?: "video";
566
+ customType?: string;
567
+ };
568
+ }[];
569
+ }[];
570
+ }, {
571
+ id?: string;
572
+ user_data?: Uint8Array<ArrayBufferLike>;
573
+ customer?: string;
574
+ peers?: {
575
+ id?: number;
576
+ user_id?: string;
577
+ user_data?: Uint8Array<ArrayBufferLike>;
578
+ medias?: {
579
+ id?: number;
580
+ paused?: boolean;
581
+ properties?: {
582
+ uid?: string;
583
+ kind?: "audio";
584
+ customType?: string;
585
+ } | {
586
+ codec?: string;
587
+ uid?: string;
588
+ kind?: "video";
589
+ customType?: string;
590
+ };
591
+ }[];
592
+ }[];
593
+ }>;
594
+ type Room = z.infer<typeof RoomSchema>;
595
+ const RoomUpdateSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
596
+ kind: z.ZodLiteral<"Joined">;
597
+ room: z.ZodObject<{
598
+ id: z.ZodString;
599
+ customer: z.ZodString;
600
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
601
+ peers: z.ZodArray<z.ZodObject<{
602
+ id: z.ZodNumber;
603
+ user_id: z.ZodString;
604
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
605
+ medias: z.ZodArray<z.ZodObject<{
606
+ id: z.ZodNumber;
607
+ properties: z.ZodUnion<[z.ZodObject<{
608
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
609
+ uid: z.ZodOptional<z.ZodString>;
610
+ customType: z.ZodOptional<z.ZodString>;
611
+ }, "strip", z.ZodTypeAny, {
612
+ uid?: string;
613
+ kind?: "audio";
614
+ customType?: string;
615
+ }, {
616
+ uid?: string;
617
+ kind?: "audio";
618
+ customType?: string;
619
+ }>, z.ZodObject<{
620
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
621
+ codec: z.ZodOptional<z.ZodString>;
622
+ uid: z.ZodOptional<z.ZodString>;
623
+ customType: z.ZodOptional<z.ZodString>;
624
+ }, "strip", z.ZodTypeAny, {
625
+ codec?: string;
626
+ uid?: string;
627
+ kind?: "video";
628
+ customType?: string;
629
+ }, {
630
+ codec?: string;
631
+ uid?: string;
632
+ kind?: "video";
633
+ customType?: string;
634
+ }>]>;
635
+ paused: z.ZodBoolean;
636
+ }, "strip", z.ZodTypeAny, {
637
+ id?: number;
638
+ paused?: boolean;
639
+ properties?: {
640
+ uid?: string;
641
+ kind?: "audio";
642
+ customType?: string;
643
+ } | {
644
+ codec?: string;
645
+ uid?: string;
646
+ kind?: "video";
647
+ customType?: string;
648
+ };
649
+ }, {
650
+ id?: number;
651
+ paused?: boolean;
652
+ properties?: {
653
+ uid?: string;
654
+ kind?: "audio";
655
+ customType?: string;
656
+ } | {
657
+ codec?: string;
658
+ uid?: string;
659
+ kind?: "video";
660
+ customType?: string;
661
+ };
662
+ }>, "many">;
663
+ }, "strip", z.ZodTypeAny, {
664
+ id?: number;
665
+ user_id?: string;
666
+ user_data?: Uint8Array<ArrayBufferLike>;
667
+ medias?: {
668
+ id?: number;
669
+ paused?: boolean;
670
+ properties?: {
671
+ uid?: string;
672
+ kind?: "audio";
673
+ customType?: string;
674
+ } | {
675
+ codec?: string;
676
+ uid?: string;
677
+ kind?: "video";
678
+ customType?: string;
679
+ };
680
+ }[];
681
+ }, {
682
+ id?: number;
683
+ user_id?: string;
684
+ user_data?: Uint8Array<ArrayBufferLike>;
685
+ medias?: {
686
+ id?: number;
687
+ paused?: boolean;
688
+ properties?: {
689
+ uid?: string;
690
+ kind?: "audio";
691
+ customType?: string;
692
+ } | {
693
+ codec?: string;
694
+ uid?: string;
695
+ kind?: "video";
696
+ customType?: string;
697
+ };
698
+ }[];
699
+ }>, "many">;
700
+ }, "strip", z.ZodTypeAny, {
701
+ id?: string;
702
+ user_data?: Uint8Array<ArrayBufferLike>;
703
+ customer?: string;
704
+ peers?: {
705
+ id?: number;
706
+ user_id?: string;
707
+ user_data?: Uint8Array<ArrayBufferLike>;
708
+ medias?: {
709
+ id?: number;
710
+ paused?: boolean;
711
+ properties?: {
712
+ uid?: string;
713
+ kind?: "audio";
714
+ customType?: string;
715
+ } | {
716
+ codec?: string;
717
+ uid?: string;
718
+ kind?: "video";
719
+ customType?: string;
720
+ };
721
+ }[];
722
+ }[];
723
+ }, {
724
+ id?: string;
725
+ user_data?: Uint8Array<ArrayBufferLike>;
726
+ customer?: string;
727
+ peers?: {
728
+ id?: number;
729
+ user_id?: string;
730
+ user_data?: Uint8Array<ArrayBufferLike>;
731
+ medias?: {
732
+ id?: number;
733
+ paused?: boolean;
734
+ properties?: {
735
+ uid?: string;
736
+ kind?: "audio";
737
+ customType?: string;
738
+ } | {
739
+ codec?: string;
740
+ uid?: string;
741
+ kind?: "video";
742
+ customType?: string;
743
+ };
744
+ }[];
745
+ }[];
746
+ }>;
747
+ media_ids: z.ZodArray<z.ZodNumber, "many">;
748
+ own_peer_id: z.ZodNumber;
749
+ }, "strip", z.ZodTypeAny, {
750
+ kind?: "Joined";
751
+ room?: {
752
+ id?: string;
753
+ user_data?: Uint8Array<ArrayBufferLike>;
754
+ customer?: string;
755
+ peers?: {
756
+ id?: number;
757
+ user_id?: string;
758
+ user_data?: Uint8Array<ArrayBufferLike>;
759
+ medias?: {
760
+ id?: number;
761
+ paused?: boolean;
762
+ properties?: {
763
+ uid?: string;
764
+ kind?: "audio";
765
+ customType?: string;
766
+ } | {
767
+ codec?: string;
768
+ uid?: string;
769
+ kind?: "video";
770
+ customType?: string;
771
+ };
772
+ }[];
773
+ }[];
774
+ };
775
+ media_ids?: number[];
776
+ own_peer_id?: number;
777
+ }, {
778
+ kind?: "Joined";
779
+ room?: {
780
+ id?: string;
781
+ user_data?: Uint8Array<ArrayBufferLike>;
782
+ customer?: string;
783
+ peers?: {
784
+ id?: number;
785
+ user_id?: string;
786
+ user_data?: Uint8Array<ArrayBufferLike>;
787
+ medias?: {
788
+ id?: number;
789
+ paused?: boolean;
790
+ properties?: {
791
+ uid?: string;
792
+ kind?: "audio";
793
+ customType?: string;
794
+ } | {
795
+ codec?: string;
796
+ uid?: string;
797
+ kind?: "video";
798
+ customType?: string;
799
+ };
800
+ }[];
801
+ }[];
802
+ };
803
+ media_ids?: number[];
804
+ own_peer_id?: number;
805
+ }>, z.ZodObject<{
806
+ kind: z.ZodLiteral<"Left">;
807
+ reason: z.ZodEnum<["RoomClosing", "ServerClosing", "PeerKicked"]>;
808
+ }, "strip", z.ZodTypeAny, {
809
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
810
+ kind?: "Left";
811
+ }, {
812
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
813
+ kind?: "Left";
814
+ }>, z.ZodObject<{
815
+ kind: z.ZodLiteral<"UserDataChanged">;
816
+ user_data: z.ZodOptional<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>>;
817
+ }, "strip", z.ZodTypeAny, {
818
+ kind?: "UserDataChanged";
819
+ user_data?: Uint8Array<ArrayBufferLike>;
820
+ }, {
821
+ kind?: "UserDataChanged";
822
+ user_data?: Uint8Array<ArrayBufferLike>;
823
+ }>, z.ZodObject<{
824
+ kind: z.ZodLiteral<"PeerJoined">;
825
+ peer: z.ZodObject<{
826
+ id: z.ZodNumber;
827
+ user_id: z.ZodString;
828
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
829
+ medias: z.ZodArray<z.ZodObject<{
830
+ id: z.ZodNumber;
831
+ properties: z.ZodUnion<[z.ZodObject<{
832
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
833
+ uid: z.ZodOptional<z.ZodString>;
834
+ customType: z.ZodOptional<z.ZodString>;
835
+ }, "strip", z.ZodTypeAny, {
836
+ uid?: string;
837
+ kind?: "audio";
838
+ customType?: string;
839
+ }, {
840
+ uid?: string;
841
+ kind?: "audio";
842
+ customType?: string;
843
+ }>, z.ZodObject<{
844
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
845
+ codec: z.ZodOptional<z.ZodString>;
846
+ uid: z.ZodOptional<z.ZodString>;
847
+ customType: z.ZodOptional<z.ZodString>;
848
+ }, "strip", z.ZodTypeAny, {
849
+ codec?: string;
850
+ uid?: string;
851
+ kind?: "video";
852
+ customType?: string;
853
+ }, {
854
+ codec?: string;
855
+ uid?: string;
856
+ kind?: "video";
857
+ customType?: string;
858
+ }>]>;
859
+ paused: z.ZodBoolean;
860
+ }, "strip", z.ZodTypeAny, {
861
+ id?: number;
862
+ paused?: boolean;
863
+ properties?: {
864
+ uid?: string;
865
+ kind?: "audio";
866
+ customType?: string;
867
+ } | {
868
+ codec?: string;
869
+ uid?: string;
870
+ kind?: "video";
871
+ customType?: string;
872
+ };
873
+ }, {
874
+ id?: number;
875
+ paused?: boolean;
876
+ properties?: {
877
+ uid?: string;
878
+ kind?: "audio";
879
+ customType?: string;
880
+ } | {
881
+ codec?: string;
882
+ uid?: string;
883
+ kind?: "video";
884
+ customType?: string;
885
+ };
886
+ }>, "many">;
887
+ }, "strip", z.ZodTypeAny, {
888
+ id?: number;
889
+ user_id?: string;
890
+ user_data?: Uint8Array<ArrayBufferLike>;
891
+ medias?: {
892
+ id?: number;
893
+ paused?: boolean;
894
+ properties?: {
895
+ uid?: string;
896
+ kind?: "audio";
897
+ customType?: string;
898
+ } | {
899
+ codec?: string;
900
+ uid?: string;
901
+ kind?: "video";
902
+ customType?: string;
903
+ };
904
+ }[];
905
+ }, {
906
+ id?: number;
907
+ user_id?: string;
908
+ user_data?: Uint8Array<ArrayBufferLike>;
909
+ medias?: {
910
+ id?: number;
911
+ paused?: boolean;
912
+ properties?: {
913
+ uid?: string;
914
+ kind?: "audio";
915
+ customType?: string;
916
+ } | {
917
+ codec?: string;
918
+ uid?: string;
919
+ kind?: "video";
920
+ customType?: string;
921
+ };
922
+ }[];
923
+ }>;
924
+ }, "strip", z.ZodTypeAny, {
925
+ kind?: "PeerJoined";
926
+ peer?: {
927
+ id?: number;
928
+ user_id?: string;
929
+ user_data?: Uint8Array<ArrayBufferLike>;
930
+ medias?: {
931
+ id?: number;
932
+ paused?: boolean;
933
+ properties?: {
934
+ uid?: string;
935
+ kind?: "audio";
936
+ customType?: string;
937
+ } | {
938
+ codec?: string;
939
+ uid?: string;
940
+ kind?: "video";
941
+ customType?: string;
942
+ };
943
+ }[];
944
+ };
945
+ }, {
946
+ kind?: "PeerJoined";
947
+ peer?: {
948
+ id?: number;
949
+ user_id?: string;
950
+ user_data?: Uint8Array<ArrayBufferLike>;
951
+ medias?: {
952
+ id?: number;
953
+ paused?: boolean;
954
+ properties?: {
955
+ uid?: string;
956
+ kind?: "audio";
957
+ customType?: string;
958
+ } | {
959
+ codec?: string;
960
+ uid?: string;
961
+ kind?: "video";
962
+ customType?: string;
963
+ };
964
+ }[];
965
+ };
966
+ }>, z.ZodObject<{
967
+ kind: z.ZodLiteral<"PeerLeft">;
968
+ peer_id: z.ZodNumber;
969
+ }, "strip", z.ZodTypeAny, {
970
+ kind?: "PeerLeft";
971
+ peer_id?: number;
972
+ }, {
973
+ kind?: "PeerLeft";
974
+ peer_id?: number;
975
+ }>]>;
976
+ type RoomUpdate = z.infer<typeof RoomUpdateSchema>;
977
+ const RoomUpdatesSchema: z.ZodObject<{
978
+ updates: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
979
+ kind: z.ZodLiteral<"Joined">;
980
+ room: z.ZodObject<{
981
+ id: z.ZodString;
982
+ customer: z.ZodString;
983
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
984
+ peers: z.ZodArray<z.ZodObject<{
985
+ id: z.ZodNumber;
986
+ user_id: z.ZodString;
987
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
988
+ medias: z.ZodArray<z.ZodObject<{
989
+ id: z.ZodNumber;
990
+ properties: z.ZodUnion<[z.ZodObject<{
991
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
992
+ uid: z.ZodOptional<z.ZodString>;
993
+ customType: z.ZodOptional<z.ZodString>;
994
+ }, "strip", z.ZodTypeAny, {
995
+ uid?: string;
996
+ kind?: "audio";
997
+ customType?: string;
998
+ }, {
999
+ uid?: string;
1000
+ kind?: "audio";
1001
+ customType?: string;
1002
+ }>, z.ZodObject<{
1003
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
1004
+ codec: z.ZodOptional<z.ZodString>;
1005
+ uid: z.ZodOptional<z.ZodString>;
1006
+ customType: z.ZodOptional<z.ZodString>;
1007
+ }, "strip", z.ZodTypeAny, {
1008
+ codec?: string;
1009
+ uid?: string;
1010
+ kind?: "video";
1011
+ customType?: string;
1012
+ }, {
1013
+ codec?: string;
1014
+ uid?: string;
1015
+ kind?: "video";
1016
+ customType?: string;
1017
+ }>]>;
1018
+ paused: z.ZodBoolean;
1019
+ }, "strip", z.ZodTypeAny, {
1020
+ id?: number;
1021
+ paused?: boolean;
1022
+ properties?: {
1023
+ uid?: string;
1024
+ kind?: "audio";
1025
+ customType?: string;
1026
+ } | {
1027
+ codec?: string;
1028
+ uid?: string;
1029
+ kind?: "video";
1030
+ customType?: string;
1031
+ };
1032
+ }, {
1033
+ id?: number;
1034
+ paused?: boolean;
1035
+ properties?: {
1036
+ uid?: string;
1037
+ kind?: "audio";
1038
+ customType?: string;
1039
+ } | {
1040
+ codec?: string;
1041
+ uid?: string;
1042
+ kind?: "video";
1043
+ customType?: string;
1044
+ };
1045
+ }>, "many">;
1046
+ }, "strip", z.ZodTypeAny, {
1047
+ id?: number;
1048
+ user_id?: string;
1049
+ user_data?: Uint8Array<ArrayBufferLike>;
1050
+ medias?: {
1051
+ id?: number;
1052
+ paused?: boolean;
1053
+ properties?: {
1054
+ uid?: string;
1055
+ kind?: "audio";
1056
+ customType?: string;
1057
+ } | {
1058
+ codec?: string;
1059
+ uid?: string;
1060
+ kind?: "video";
1061
+ customType?: string;
1062
+ };
1063
+ }[];
1064
+ }, {
1065
+ id?: number;
1066
+ user_id?: string;
1067
+ user_data?: Uint8Array<ArrayBufferLike>;
1068
+ medias?: {
1069
+ id?: number;
1070
+ paused?: boolean;
1071
+ properties?: {
1072
+ uid?: string;
1073
+ kind?: "audio";
1074
+ customType?: string;
1075
+ } | {
1076
+ codec?: string;
1077
+ uid?: string;
1078
+ kind?: "video";
1079
+ customType?: string;
1080
+ };
1081
+ }[];
1082
+ }>, "many">;
1083
+ }, "strip", z.ZodTypeAny, {
1084
+ id?: string;
1085
+ user_data?: Uint8Array<ArrayBufferLike>;
1086
+ customer?: string;
1087
+ peers?: {
1088
+ id?: number;
1089
+ user_id?: string;
1090
+ user_data?: Uint8Array<ArrayBufferLike>;
1091
+ medias?: {
1092
+ id?: number;
1093
+ paused?: boolean;
1094
+ properties?: {
1095
+ uid?: string;
1096
+ kind?: "audio";
1097
+ customType?: string;
1098
+ } | {
1099
+ codec?: string;
1100
+ uid?: string;
1101
+ kind?: "video";
1102
+ customType?: string;
1103
+ };
1104
+ }[];
1105
+ }[];
1106
+ }, {
1107
+ id?: string;
1108
+ user_data?: Uint8Array<ArrayBufferLike>;
1109
+ customer?: string;
1110
+ peers?: {
1111
+ id?: number;
1112
+ user_id?: string;
1113
+ user_data?: Uint8Array<ArrayBufferLike>;
1114
+ medias?: {
1115
+ id?: number;
1116
+ paused?: boolean;
1117
+ properties?: {
1118
+ uid?: string;
1119
+ kind?: "audio";
1120
+ customType?: string;
1121
+ } | {
1122
+ codec?: string;
1123
+ uid?: string;
1124
+ kind?: "video";
1125
+ customType?: string;
1126
+ };
1127
+ }[];
1128
+ }[];
1129
+ }>;
1130
+ media_ids: z.ZodArray<z.ZodNumber, "many">;
1131
+ own_peer_id: z.ZodNumber;
1132
+ }, "strip", z.ZodTypeAny, {
1133
+ kind?: "Joined";
1134
+ room?: {
1135
+ id?: string;
1136
+ user_data?: Uint8Array<ArrayBufferLike>;
1137
+ customer?: string;
1138
+ peers?: {
1139
+ id?: number;
1140
+ user_id?: string;
1141
+ user_data?: Uint8Array<ArrayBufferLike>;
1142
+ medias?: {
1143
+ id?: number;
1144
+ paused?: boolean;
1145
+ properties?: {
1146
+ uid?: string;
1147
+ kind?: "audio";
1148
+ customType?: string;
1149
+ } | {
1150
+ codec?: string;
1151
+ uid?: string;
1152
+ kind?: "video";
1153
+ customType?: string;
1154
+ };
1155
+ }[];
1156
+ }[];
1157
+ };
1158
+ media_ids?: number[];
1159
+ own_peer_id?: number;
1160
+ }, {
1161
+ kind?: "Joined";
1162
+ room?: {
1163
+ id?: string;
1164
+ user_data?: Uint8Array<ArrayBufferLike>;
1165
+ customer?: string;
1166
+ peers?: {
1167
+ id?: number;
1168
+ user_id?: string;
1169
+ user_data?: Uint8Array<ArrayBufferLike>;
1170
+ medias?: {
1171
+ id?: number;
1172
+ paused?: boolean;
1173
+ properties?: {
1174
+ uid?: string;
1175
+ kind?: "audio";
1176
+ customType?: string;
1177
+ } | {
1178
+ codec?: string;
1179
+ uid?: string;
1180
+ kind?: "video";
1181
+ customType?: string;
1182
+ };
1183
+ }[];
1184
+ }[];
1185
+ };
1186
+ media_ids?: number[];
1187
+ own_peer_id?: number;
1188
+ }>, z.ZodObject<{
1189
+ kind: z.ZodLiteral<"Left">;
1190
+ reason: z.ZodEnum<["RoomClosing", "ServerClosing", "PeerKicked"]>;
1191
+ }, "strip", z.ZodTypeAny, {
1192
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
1193
+ kind?: "Left";
1194
+ }, {
1195
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
1196
+ kind?: "Left";
1197
+ }>, z.ZodObject<{
1198
+ kind: z.ZodLiteral<"UserDataChanged">;
1199
+ user_data: z.ZodOptional<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>>;
1200
+ }, "strip", z.ZodTypeAny, {
1201
+ kind?: "UserDataChanged";
1202
+ user_data?: Uint8Array<ArrayBufferLike>;
1203
+ }, {
1204
+ kind?: "UserDataChanged";
1205
+ user_data?: Uint8Array<ArrayBufferLike>;
1206
+ }>, z.ZodObject<{
1207
+ kind: z.ZodLiteral<"PeerJoined">;
1208
+ peer: z.ZodObject<{
1209
+ id: z.ZodNumber;
1210
+ user_id: z.ZodString;
1211
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
1212
+ medias: z.ZodArray<z.ZodObject<{
1213
+ id: z.ZodNumber;
1214
+ properties: z.ZodUnion<[z.ZodObject<{
1215
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
1216
+ uid: z.ZodOptional<z.ZodString>;
1217
+ customType: z.ZodOptional<z.ZodString>;
1218
+ }, "strip", z.ZodTypeAny, {
1219
+ uid?: string;
1220
+ kind?: "audio";
1221
+ customType?: string;
1222
+ }, {
1223
+ uid?: string;
1224
+ kind?: "audio";
1225
+ customType?: string;
1226
+ }>, z.ZodObject<{
1227
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
1228
+ codec: z.ZodOptional<z.ZodString>;
1229
+ uid: z.ZodOptional<z.ZodString>;
1230
+ customType: z.ZodOptional<z.ZodString>;
1231
+ }, "strip", z.ZodTypeAny, {
1232
+ codec?: string;
1233
+ uid?: string;
1234
+ kind?: "video";
1235
+ customType?: string;
1236
+ }, {
1237
+ codec?: string;
1238
+ uid?: string;
1239
+ kind?: "video";
1240
+ customType?: string;
1241
+ }>]>;
1242
+ paused: z.ZodBoolean;
1243
+ }, "strip", z.ZodTypeAny, {
1244
+ id?: number;
1245
+ paused?: boolean;
1246
+ properties?: {
1247
+ uid?: string;
1248
+ kind?: "audio";
1249
+ customType?: string;
1250
+ } | {
1251
+ codec?: string;
1252
+ uid?: string;
1253
+ kind?: "video";
1254
+ customType?: string;
1255
+ };
1256
+ }, {
1257
+ id?: number;
1258
+ paused?: boolean;
1259
+ properties?: {
1260
+ uid?: string;
1261
+ kind?: "audio";
1262
+ customType?: string;
1263
+ } | {
1264
+ codec?: string;
1265
+ uid?: string;
1266
+ kind?: "video";
1267
+ customType?: string;
1268
+ };
1269
+ }>, "many">;
1270
+ }, "strip", z.ZodTypeAny, {
1271
+ id?: number;
1272
+ user_id?: string;
1273
+ user_data?: Uint8Array<ArrayBufferLike>;
1274
+ medias?: {
1275
+ id?: number;
1276
+ paused?: boolean;
1277
+ properties?: {
1278
+ uid?: string;
1279
+ kind?: "audio";
1280
+ customType?: string;
1281
+ } | {
1282
+ codec?: string;
1283
+ uid?: string;
1284
+ kind?: "video";
1285
+ customType?: string;
1286
+ };
1287
+ }[];
1288
+ }, {
1289
+ id?: number;
1290
+ user_id?: string;
1291
+ user_data?: Uint8Array<ArrayBufferLike>;
1292
+ medias?: {
1293
+ id?: number;
1294
+ paused?: boolean;
1295
+ properties?: {
1296
+ uid?: string;
1297
+ kind?: "audio";
1298
+ customType?: string;
1299
+ } | {
1300
+ codec?: string;
1301
+ uid?: string;
1302
+ kind?: "video";
1303
+ customType?: string;
1304
+ };
1305
+ }[];
1306
+ }>;
1307
+ }, "strip", z.ZodTypeAny, {
1308
+ kind?: "PeerJoined";
1309
+ peer?: {
1310
+ id?: number;
1311
+ user_id?: string;
1312
+ user_data?: Uint8Array<ArrayBufferLike>;
1313
+ medias?: {
1314
+ id?: number;
1315
+ paused?: boolean;
1316
+ properties?: {
1317
+ uid?: string;
1318
+ kind?: "audio";
1319
+ customType?: string;
1320
+ } | {
1321
+ codec?: string;
1322
+ uid?: string;
1323
+ kind?: "video";
1324
+ customType?: string;
1325
+ };
1326
+ }[];
1327
+ };
1328
+ }, {
1329
+ kind?: "PeerJoined";
1330
+ peer?: {
1331
+ id?: number;
1332
+ user_id?: string;
1333
+ user_data?: Uint8Array<ArrayBufferLike>;
1334
+ medias?: {
1335
+ id?: number;
1336
+ paused?: boolean;
1337
+ properties?: {
1338
+ uid?: string;
1339
+ kind?: "audio";
1340
+ customType?: string;
1341
+ } | {
1342
+ codec?: string;
1343
+ uid?: string;
1344
+ kind?: "video";
1345
+ customType?: string;
1346
+ };
1347
+ }[];
1348
+ };
1349
+ }>, z.ZodObject<{
1350
+ kind: z.ZodLiteral<"PeerLeft">;
1351
+ peer_id: z.ZodNumber;
1352
+ }, "strip", z.ZodTypeAny, {
1353
+ kind?: "PeerLeft";
1354
+ peer_id?: number;
1355
+ }, {
1356
+ kind?: "PeerLeft";
1357
+ peer_id?: number;
1358
+ }>]>, "many">;
1359
+ }, "strip", z.ZodTypeAny, {
1360
+ updates?: ({
1361
+ kind?: "Joined";
1362
+ room?: {
1363
+ id?: string;
1364
+ user_data?: Uint8Array<ArrayBufferLike>;
1365
+ customer?: string;
1366
+ peers?: {
1367
+ id?: number;
1368
+ user_id?: string;
1369
+ user_data?: Uint8Array<ArrayBufferLike>;
1370
+ medias?: {
1371
+ id?: number;
1372
+ paused?: boolean;
1373
+ properties?: {
1374
+ uid?: string;
1375
+ kind?: "audio";
1376
+ customType?: string;
1377
+ } | {
1378
+ codec?: string;
1379
+ uid?: string;
1380
+ kind?: "video";
1381
+ customType?: string;
1382
+ };
1383
+ }[];
1384
+ }[];
1385
+ };
1386
+ media_ids?: number[];
1387
+ own_peer_id?: number;
1388
+ } | {
1389
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
1390
+ kind?: "Left";
1391
+ } | {
1392
+ kind?: "UserDataChanged";
1393
+ user_data?: Uint8Array<ArrayBufferLike>;
1394
+ } | {
1395
+ kind?: "PeerJoined";
1396
+ peer?: {
1397
+ id?: number;
1398
+ user_id?: string;
1399
+ user_data?: Uint8Array<ArrayBufferLike>;
1400
+ medias?: {
1401
+ id?: number;
1402
+ paused?: boolean;
1403
+ properties?: {
1404
+ uid?: string;
1405
+ kind?: "audio";
1406
+ customType?: string;
1407
+ } | {
1408
+ codec?: string;
1409
+ uid?: string;
1410
+ kind?: "video";
1411
+ customType?: string;
1412
+ };
1413
+ }[];
1414
+ };
1415
+ } | {
1416
+ kind?: "PeerLeft";
1417
+ peer_id?: number;
1418
+ })[];
1419
+ }, {
1420
+ updates?: ({
1421
+ kind?: "Joined";
1422
+ room?: {
1423
+ id?: string;
1424
+ user_data?: Uint8Array<ArrayBufferLike>;
1425
+ customer?: string;
1426
+ peers?: {
1427
+ id?: number;
1428
+ user_id?: string;
1429
+ user_data?: Uint8Array<ArrayBufferLike>;
1430
+ medias?: {
1431
+ id?: number;
1432
+ paused?: boolean;
1433
+ properties?: {
1434
+ uid?: string;
1435
+ kind?: "audio";
1436
+ customType?: string;
1437
+ } | {
1438
+ codec?: string;
1439
+ uid?: string;
1440
+ kind?: "video";
1441
+ customType?: string;
1442
+ };
1443
+ }[];
1444
+ }[];
1445
+ };
1446
+ media_ids?: number[];
1447
+ own_peer_id?: number;
1448
+ } | {
1449
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
1450
+ kind?: "Left";
1451
+ } | {
1452
+ kind?: "UserDataChanged";
1453
+ user_data?: Uint8Array<ArrayBufferLike>;
1454
+ } | {
1455
+ kind?: "PeerJoined";
1456
+ peer?: {
1457
+ id?: number;
1458
+ user_id?: string;
1459
+ user_data?: Uint8Array<ArrayBufferLike>;
1460
+ medias?: {
1461
+ id?: number;
1462
+ paused?: boolean;
1463
+ properties?: {
1464
+ uid?: string;
1465
+ kind?: "audio";
1466
+ customType?: string;
1467
+ } | {
1468
+ codec?: string;
1469
+ uid?: string;
1470
+ kind?: "video";
1471
+ customType?: string;
1472
+ };
1473
+ }[];
1474
+ };
1475
+ } | {
1476
+ kind?: "PeerLeft";
1477
+ peer_id?: number;
1478
+ })[];
1479
+ }>;
1480
+ type RoomUpdates = z.infer<typeof RoomUpdatesSchema>;
1481
+ const RoomStatusSchema: z.ZodEnum<["Joining", "Joined", "Closed"]>;
1482
+ type RoomStatus = z.infer<typeof RoomStatusSchema>;
1483
+ const RoomStatusChangedSchema: z.ZodObject<{
1484
+ status: z.ZodEnum<["Joining", "Joined", "Closed"]>;
1485
+ message: z.ZodOptional<z.ZodString>;
1486
+ }, "strip", z.ZodTypeAny, {
1487
+ message?: string;
1488
+ status?: "Joined" | "Joining" | "Closed";
1489
+ }, {
1490
+ message?: string;
1491
+ status?: "Joined" | "Joining" | "Closed";
1492
+ }>;
1493
+ type RoomStatusChanged = z.infer<typeof RoomStatusChangedSchema>;
1494
+ }
1495
+ export namespace RoomV2 {
1496
+ const ParametersSchema: z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>;
1497
+ const PeerProperties: z.ZodObject<{
1498
+ user_data: z.ZodOptional<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>>;
1499
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1500
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
1501
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
1502
+ }, "strip", z.ZodTypeAny, {
1503
+ user_data?: Uint8Array<ArrayBufferLike>;
1504
+ tags?: string[];
1505
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1506
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1507
+ }, {
1508
+ user_data?: Uint8Array<ArrayBufferLike>;
1509
+ tags?: string[];
1510
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1511
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1512
+ }>;
1513
+ const PingSchema: z.ZodObject<{
1514
+ Ping: z.ZodObject<{
1515
+ id: z.ZodNumber;
1516
+ }, "strip", z.ZodTypeAny, {
1517
+ id?: number;
1518
+ }, {
1519
+ id?: number;
1520
+ }>;
1521
+ }, "strip", z.ZodTypeAny, {
1522
+ Ping?: {
1523
+ id?: number;
1524
+ };
1525
+ }, {
1526
+ Ping?: {
1527
+ id?: number;
1528
+ };
1529
+ }>;
1530
+ const ChangeSelfSchema: z.ZodObject<{
1531
+ ChangeSelf: z.ZodObject<Omit<{
1532
+ user_data: z.ZodOptional<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>>;
1533
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1534
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
1535
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
1536
+ }, "tags">, "strip", z.ZodTypeAny, {
1537
+ user_data?: Uint8Array<ArrayBufferLike>;
1538
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1539
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1540
+ }, {
1541
+ user_data?: Uint8Array<ArrayBufferLike>;
1542
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1543
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1544
+ }>;
1545
+ }, "strip", z.ZodTypeAny, {
1546
+ ChangeSelf?: {
1547
+ user_data?: Uint8Array<ArrayBufferLike>;
1548
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1549
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1550
+ };
1551
+ }, {
1552
+ ChangeSelf?: {
1553
+ user_data?: Uint8Array<ArrayBufferLike>;
1554
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1555
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1556
+ };
1557
+ }>;
1558
+ const SetAudioMaskSchema: z.ZodObject<{
1559
+ SetAudioMask: z.ZodObject<{
1560
+ peer_id: z.ZodNumber;
1561
+ mask: z.ZodEffects<z.ZodBigInt, import("src/schema/channels").ChannelSet, bigint>;
1562
+ }, "strip", z.ZodTypeAny, {
1563
+ mask?: import("src/schema/channels").ChannelSet;
1564
+ peer_id?: number;
1565
+ }, {
1566
+ mask?: bigint;
1567
+ peer_id?: number;
1568
+ }>;
1569
+ }, "strip", z.ZodTypeAny, {
1570
+ SetAudioMask?: {
1571
+ mask?: import("src/schema/channels").ChannelSet;
1572
+ peer_id?: number;
1573
+ };
1574
+ }, {
1575
+ SetAudioMask?: {
1576
+ mask?: bigint;
1577
+ peer_id?: number;
1578
+ };
1579
+ }>;
1580
+ const SendMessageSchema: z.ZodObject<{
1581
+ SendMessage: z.ZodObject<{
1582
+ peer_ids: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
1583
+ message: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
1584
+ }, "strip", z.ZodTypeAny, {
1585
+ message?: Uint8Array<ArrayBufferLike>;
1586
+ peer_ids?: number[];
1587
+ }, {
1588
+ message?: Uint8Array<ArrayBufferLike>;
1589
+ peer_ids?: number[];
1590
+ }>;
1591
+ }, "strip", z.ZodTypeAny, {
1592
+ SendMessage?: {
1593
+ message?: Uint8Array<ArrayBufferLike>;
1594
+ peer_ids?: number[];
1595
+ };
1596
+ }, {
1597
+ SendMessage?: {
1598
+ message?: Uint8Array<ArrayBufferLike>;
1599
+ peer_ids?: number[];
1600
+ };
1601
+ }>;
1602
+ const CallSchema: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
1603
+ Ping: z.ZodObject<{
1604
+ id: z.ZodNumber;
1605
+ }, "strip", z.ZodTypeAny, {
1606
+ id?: number;
1607
+ }, {
1608
+ id?: number;
1609
+ }>;
1610
+ }, "strip", z.ZodTypeAny, {
1611
+ Ping?: {
1612
+ id?: number;
1613
+ };
1614
+ }, {
1615
+ Ping?: {
1616
+ id?: number;
1617
+ };
1618
+ }>, z.ZodObject<{
1619
+ ChangeSelf: z.ZodObject<Omit<{
1620
+ user_data: z.ZodOptional<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>>;
1621
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1622
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
1623
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
1624
+ }, "tags">, "strip", z.ZodTypeAny, {
1625
+ user_data?: Uint8Array<ArrayBufferLike>;
1626
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1627
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1628
+ }, {
1629
+ user_data?: Uint8Array<ArrayBufferLike>;
1630
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1631
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1632
+ }>;
1633
+ }, "strip", z.ZodTypeAny, {
1634
+ ChangeSelf?: {
1635
+ user_data?: Uint8Array<ArrayBufferLike>;
1636
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1637
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1638
+ };
1639
+ }, {
1640
+ ChangeSelf?: {
1641
+ user_data?: Uint8Array<ArrayBufferLike>;
1642
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1643
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1644
+ };
1645
+ }>]>, z.ZodObject<{
1646
+ SetAudioMask: z.ZodObject<{
1647
+ peer_id: z.ZodNumber;
1648
+ mask: z.ZodEffects<z.ZodBigInt, import("src/schema/channels").ChannelSet, bigint>;
1649
+ }, "strip", z.ZodTypeAny, {
1650
+ mask?: import("src/schema/channels").ChannelSet;
1651
+ peer_id?: number;
1652
+ }, {
1653
+ mask?: bigint;
1654
+ peer_id?: number;
1655
+ }>;
1656
+ }, "strip", z.ZodTypeAny, {
1657
+ SetAudioMask?: {
1658
+ mask?: import("src/schema/channels").ChannelSet;
1659
+ peer_id?: number;
1660
+ };
1661
+ }, {
1662
+ SetAudioMask?: {
1663
+ mask?: bigint;
1664
+ peer_id?: number;
1665
+ };
1666
+ }>]>, z.ZodObject<{
1667
+ SendMessage: z.ZodObject<{
1668
+ peer_ids: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
1669
+ message: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
1670
+ }, "strip", z.ZodTypeAny, {
1671
+ message?: Uint8Array<ArrayBufferLike>;
1672
+ peer_ids?: number[];
1673
+ }, {
1674
+ message?: Uint8Array<ArrayBufferLike>;
1675
+ peer_ids?: number[];
1676
+ }>;
1677
+ }, "strip", z.ZodTypeAny, {
1678
+ SendMessage?: {
1679
+ message?: Uint8Array<ArrayBufferLike>;
1680
+ peer_ids?: number[];
1681
+ };
1682
+ }, {
1683
+ SendMessage?: {
1684
+ message?: Uint8Array<ArrayBufferLike>;
1685
+ peer_ids?: number[];
1686
+ };
1687
+ }>]>;
1688
+ type Call = z.infer<typeof CallSchema>;
1689
+ const PongSchema: z.ZodObject<{
1690
+ Pong: z.ZodObject<{
1691
+ id: z.ZodNumber;
1692
+ }, "strip", z.ZodTypeAny, {
1693
+ id?: number;
1694
+ }, {
1695
+ id?: number;
1696
+ }>;
1697
+ }, "strip", z.ZodTypeAny, {
1698
+ Pong?: {
1699
+ id?: number;
1700
+ };
1701
+ }, {
1702
+ Pong?: {
1703
+ id?: number;
1704
+ };
1705
+ }>;
1706
+ const JoinedSchema: z.ZodObject<{
1707
+ Joined: z.ZodObject<{
1708
+ own_peer_id: z.ZodNumber;
1709
+ room_id: z.ZodString;
1710
+ customer: z.ZodString;
1711
+ }, "strip", z.ZodTypeAny, {
1712
+ customer?: string;
1713
+ own_peer_id?: number;
1714
+ room_id?: string;
1715
+ }, {
1716
+ customer?: string;
1717
+ own_peer_id?: number;
1718
+ room_id?: string;
1719
+ }>;
1720
+ }, "strip", z.ZodTypeAny, {
1721
+ Joined?: {
1722
+ customer?: string;
1723
+ own_peer_id?: number;
1724
+ room_id?: string;
1725
+ };
1726
+ }, {
1727
+ Joined?: {
1728
+ customer?: string;
1729
+ own_peer_id?: number;
1730
+ room_id?: string;
1731
+ };
1732
+ }>;
1733
+ const LeftSchema: z.ZodObject<{
1734
+ Left: z.ZodObject<{
1735
+ reason: z.ZodEnum<["room_closing", "server_closing", "peer_kicked"]>;
1736
+ }, "strip", z.ZodTypeAny, {
1737
+ reason?: "room_closing" | "server_closing" | "peer_kicked";
1738
+ }, {
1739
+ reason?: "room_closing" | "server_closing" | "peer_kicked";
1740
+ }>;
1741
+ }, "strip", z.ZodTypeAny, {
1742
+ Left?: {
1743
+ reason?: "room_closing" | "server_closing" | "peer_kicked";
1744
+ };
1745
+ }, {
1746
+ Left?: {
1747
+ reason?: "room_closing" | "server_closing" | "peer_kicked";
1748
+ };
1749
+ }>;
1750
+ const PeerJoinedSchema: z.ZodObject<{
1751
+ PeerJoined: z.ZodObject<{
1752
+ user_data: z.ZodOptional<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>>;
1753
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1754
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
1755
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
1756
+ } & {
1757
+ peer_id: z.ZodNumber;
1758
+ user_id: z.ZodString;
1759
+ }, "strip", z.ZodTypeAny, {
1760
+ user_id?: string;
1761
+ user_data?: Uint8Array<ArrayBufferLike>;
1762
+ peer_id?: number;
1763
+ tags?: string[];
1764
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1765
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1766
+ }, {
1767
+ user_id?: string;
1768
+ user_data?: Uint8Array<ArrayBufferLike>;
1769
+ peer_id?: number;
1770
+ tags?: string[];
1771
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1772
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1773
+ }>;
1774
+ }, "strip", z.ZodTypeAny, {
1775
+ PeerJoined?: {
1776
+ user_id?: string;
1777
+ user_data?: Uint8Array<ArrayBufferLike>;
1778
+ peer_id?: number;
1779
+ tags?: string[];
1780
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1781
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1782
+ };
1783
+ }, {
1784
+ PeerJoined?: {
1785
+ user_id?: string;
1786
+ user_data?: Uint8Array<ArrayBufferLike>;
1787
+ peer_id?: number;
1788
+ tags?: string[];
1789
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1790
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1791
+ };
1792
+ }>;
1793
+ const PeerLeftSchema: z.ZodObject<{
1794
+ PeerLeft: z.ZodObject<{
1795
+ peer_id: z.ZodNumber;
1796
+ }, "strip", z.ZodTypeAny, {
1797
+ peer_id?: number;
1798
+ }, {
1799
+ peer_id?: number;
1800
+ }>;
1801
+ }, "strip", z.ZodTypeAny, {
1802
+ PeerLeft?: {
1803
+ peer_id?: number;
1804
+ };
1805
+ }, {
1806
+ PeerLeft?: {
1807
+ peer_id?: number;
1808
+ };
1809
+ }>;
1810
+ const PeerChangedSchema: z.ZodObject<{
1811
+ PeerChanged: z.ZodObject<{
1812
+ user_data: z.ZodOptional<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>>;
1813
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1814
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
1815
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
1816
+ } & {
1817
+ peer_id: z.ZodNumber;
1818
+ }, "strip", z.ZodTypeAny, {
1819
+ user_data?: Uint8Array<ArrayBufferLike>;
1820
+ peer_id?: number;
1821
+ tags?: string[];
1822
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1823
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1824
+ }, {
1825
+ user_data?: Uint8Array<ArrayBufferLike>;
1826
+ peer_id?: number;
1827
+ tags?: string[];
1828
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1829
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1830
+ }>;
1831
+ }, "strip", z.ZodTypeAny, {
1832
+ PeerChanged?: {
1833
+ user_data?: Uint8Array<ArrayBufferLike>;
1834
+ peer_id?: number;
1835
+ tags?: string[];
1836
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1837
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1838
+ };
1839
+ }, {
1840
+ PeerChanged?: {
1841
+ user_data?: Uint8Array<ArrayBufferLike>;
1842
+ peer_id?: number;
1843
+ tags?: string[];
1844
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1845
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1846
+ };
1847
+ }>;
1848
+ const NewReconnectTokenSchema: z.ZodObject<{
1849
+ NewReconnectToken: z.ZodObject<{
1850
+ token: z.ZodString;
1851
+ }, "strip", z.ZodTypeAny, {
1852
+ token?: string;
1853
+ }, {
1854
+ token?: string;
1855
+ }>;
1856
+ }, "strip", z.ZodTypeAny, {
1857
+ NewReconnectToken?: {
1858
+ token?: string;
1859
+ };
1860
+ }, {
1861
+ NewReconnectToken?: {
1862
+ token?: string;
1863
+ };
1864
+ }>;
1865
+ const MessageReceivedSchema: z.ZodObject<{
1866
+ MessageReceived: z.ZodObject<{
1867
+ sender_peer_id: z.ZodNumber;
1868
+ message: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
1869
+ }, "strip", z.ZodTypeAny, {
1870
+ message?: Uint8Array<ArrayBufferLike>;
1871
+ sender_peer_id?: number;
1872
+ }, {
1873
+ message?: Uint8Array<ArrayBufferLike>;
1874
+ sender_peer_id?: number;
1875
+ }>;
1876
+ }, "strip", z.ZodTypeAny, {
1877
+ MessageReceived?: {
1878
+ message?: Uint8Array<ArrayBufferLike>;
1879
+ sender_peer_id?: number;
1880
+ };
1881
+ }, {
1882
+ MessageReceived?: {
1883
+ message?: Uint8Array<ArrayBufferLike>;
1884
+ sender_peer_id?: number;
1885
+ };
1886
+ }>;
1887
+ const ErrorSchema: z.ZodObject<{
1888
+ Error: z.ZodObject<{
1889
+ message: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
1890
+ }, "strip", z.ZodTypeAny, {
1891
+ message?: Uint8Array<ArrayBufferLike>;
1892
+ }, {
1893
+ message?: Uint8Array<ArrayBufferLike>;
1894
+ }>;
1895
+ }, "strip", z.ZodTypeAny, {
1896
+ Error?: {
1897
+ message?: Uint8Array<ArrayBufferLike>;
1898
+ };
1899
+ }, {
1900
+ Error?: {
1901
+ message?: Uint8Array<ArrayBufferLike>;
1902
+ };
1903
+ }>;
1904
+ const EventSchema: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
1905
+ Pong: z.ZodObject<{
1906
+ id: z.ZodNumber;
1907
+ }, "strip", z.ZodTypeAny, {
1908
+ id?: number;
1909
+ }, {
1910
+ id?: number;
1911
+ }>;
1912
+ }, "strip", z.ZodTypeAny, {
1913
+ Pong?: {
1914
+ id?: number;
1915
+ };
1916
+ }, {
1917
+ Pong?: {
1918
+ id?: number;
1919
+ };
1920
+ }>, z.ZodObject<{
1921
+ Joined: z.ZodObject<{
1922
+ own_peer_id: z.ZodNumber;
1923
+ room_id: z.ZodString;
1924
+ customer: z.ZodString;
1925
+ }, "strip", z.ZodTypeAny, {
1926
+ customer?: string;
1927
+ own_peer_id?: number;
1928
+ room_id?: string;
1929
+ }, {
1930
+ customer?: string;
1931
+ own_peer_id?: number;
1932
+ room_id?: string;
1933
+ }>;
1934
+ }, "strip", z.ZodTypeAny, {
1935
+ Joined?: {
1936
+ customer?: string;
1937
+ own_peer_id?: number;
1938
+ room_id?: string;
1939
+ };
1940
+ }, {
1941
+ Joined?: {
1942
+ customer?: string;
1943
+ own_peer_id?: number;
1944
+ room_id?: string;
1945
+ };
1946
+ }>]>, z.ZodObject<{
1947
+ Left: z.ZodObject<{
1948
+ reason: z.ZodEnum<["room_closing", "server_closing", "peer_kicked"]>;
1949
+ }, "strip", z.ZodTypeAny, {
1950
+ reason?: "room_closing" | "server_closing" | "peer_kicked";
1951
+ }, {
1952
+ reason?: "room_closing" | "server_closing" | "peer_kicked";
1953
+ }>;
1954
+ }, "strip", z.ZodTypeAny, {
1955
+ Left?: {
1956
+ reason?: "room_closing" | "server_closing" | "peer_kicked";
1957
+ };
1958
+ }, {
1959
+ Left?: {
1960
+ reason?: "room_closing" | "server_closing" | "peer_kicked";
1961
+ };
1962
+ }>]>, z.ZodObject<{
1963
+ PeerJoined: z.ZodObject<{
1964
+ user_data: z.ZodOptional<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>>;
1965
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1966
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
1967
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
1968
+ } & {
1969
+ peer_id: z.ZodNumber;
1970
+ user_id: z.ZodString;
1971
+ }, "strip", z.ZodTypeAny, {
1972
+ user_id?: string;
1973
+ user_data?: Uint8Array<ArrayBufferLike>;
1974
+ peer_id?: number;
1975
+ tags?: string[];
1976
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1977
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1978
+ }, {
1979
+ user_id?: string;
1980
+ user_data?: Uint8Array<ArrayBufferLike>;
1981
+ peer_id?: number;
1982
+ tags?: string[];
1983
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1984
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1985
+ }>;
1986
+ }, "strip", z.ZodTypeAny, {
1987
+ PeerJoined?: {
1988
+ user_id?: string;
1989
+ user_data?: Uint8Array<ArrayBufferLike>;
1990
+ peer_id?: number;
1991
+ tags?: string[];
1992
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
1993
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
1994
+ };
1995
+ }, {
1996
+ PeerJoined?: {
1997
+ user_id?: string;
1998
+ user_data?: Uint8Array<ArrayBufferLike>;
1999
+ peer_id?: number;
2000
+ tags?: string[];
2001
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
2002
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
2003
+ };
2004
+ }>]>, z.ZodObject<{
2005
+ PeerLeft: z.ZodObject<{
2006
+ peer_id: z.ZodNumber;
2007
+ }, "strip", z.ZodTypeAny, {
2008
+ peer_id?: number;
2009
+ }, {
2010
+ peer_id?: number;
2011
+ }>;
2012
+ }, "strip", z.ZodTypeAny, {
2013
+ PeerLeft?: {
2014
+ peer_id?: number;
2015
+ };
2016
+ }, {
2017
+ PeerLeft?: {
2018
+ peer_id?: number;
2019
+ };
2020
+ }>]>, z.ZodObject<{
2021
+ PeerChanged: z.ZodObject<{
2022
+ user_data: z.ZodOptional<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>>;
2023
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2024
+ audio_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
2025
+ video_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("src/schema/serialization").Json, z.ZodTypeDef, import("src/schema/serialization").Json>>>;
2026
+ } & {
2027
+ peer_id: z.ZodNumber;
2028
+ }, "strip", z.ZodTypeAny, {
2029
+ user_data?: Uint8Array<ArrayBufferLike>;
2030
+ peer_id?: number;
2031
+ tags?: string[];
2032
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
2033
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
2034
+ }, {
2035
+ user_data?: Uint8Array<ArrayBufferLike>;
2036
+ peer_id?: number;
2037
+ tags?: string[];
2038
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
2039
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
2040
+ }>;
2041
+ }, "strip", z.ZodTypeAny, {
2042
+ PeerChanged?: {
2043
+ user_data?: Uint8Array<ArrayBufferLike>;
2044
+ peer_id?: number;
2045
+ tags?: string[];
2046
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
2047
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
2048
+ };
2049
+ }, {
2050
+ PeerChanged?: {
2051
+ user_data?: Uint8Array<ArrayBufferLike>;
2052
+ peer_id?: number;
2053
+ tags?: string[];
2054
+ audio_parameters?: Record<string, import("src/schema/serialization").Json>;
2055
+ video_parameters?: Record<string, import("src/schema/serialization").Json>;
2056
+ };
2057
+ }>]>, z.ZodObject<{
2058
+ NewReconnectToken: z.ZodObject<{
2059
+ token: z.ZodString;
2060
+ }, "strip", z.ZodTypeAny, {
2061
+ token?: string;
2062
+ }, {
2063
+ token?: string;
2064
+ }>;
2065
+ }, "strip", z.ZodTypeAny, {
2066
+ NewReconnectToken?: {
2067
+ token?: string;
2068
+ };
2069
+ }, {
2070
+ NewReconnectToken?: {
2071
+ token?: string;
2072
+ };
2073
+ }>]>, z.ZodObject<{
2074
+ MessageReceived: z.ZodObject<{
2075
+ sender_peer_id: z.ZodNumber;
2076
+ message: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
2077
+ }, "strip", z.ZodTypeAny, {
2078
+ message?: Uint8Array<ArrayBufferLike>;
2079
+ sender_peer_id?: number;
2080
+ }, {
2081
+ message?: Uint8Array<ArrayBufferLike>;
2082
+ sender_peer_id?: number;
2083
+ }>;
2084
+ }, "strip", z.ZodTypeAny, {
2085
+ MessageReceived?: {
2086
+ message?: Uint8Array<ArrayBufferLike>;
2087
+ sender_peer_id?: number;
2088
+ };
2089
+ }, {
2090
+ MessageReceived?: {
2091
+ message?: Uint8Array<ArrayBufferLike>;
2092
+ sender_peer_id?: number;
2093
+ };
2094
+ }>]>, z.ZodObject<{
2095
+ Error: z.ZodObject<{
2096
+ message: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
2097
+ }, "strip", z.ZodTypeAny, {
2098
+ message?: Uint8Array<ArrayBufferLike>;
2099
+ }, {
2100
+ message?: Uint8Array<ArrayBufferLike>;
2101
+ }>;
2102
+ }, "strip", z.ZodTypeAny, {
2103
+ Error?: {
2104
+ message?: Uint8Array<ArrayBufferLike>;
2105
+ };
2106
+ }, {
2107
+ Error?: {
2108
+ message?: Uint8Array<ArrayBufferLike>;
2109
+ };
2110
+ }>]>;
2111
+ type Event = z.infer<typeof EventSchema>;
2112
+ }
2113
+ }
2114
+ declare module "src/schema/message" {
2115
+ import { z } from "zod";
2116
+ export const MessageReceivedSchema: z.ZodObject<{
2117
+ sender_peer_id: z.ZodNumber;
2118
+ message: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
2119
+ }, "strip", z.ZodTypeAny, {
2120
+ message?: Uint8Array<ArrayBufferLike>;
2121
+ sender_peer_id?: number;
2122
+ }, {
2123
+ message?: Uint8Array<ArrayBufferLike>;
2124
+ sender_peer_id?: number;
2125
+ }>;
2126
+ export type MessageReceived = z.infer<typeof MessageReceivedSchema>;
2127
+ }
2128
+ declare module "src/schema/webrtc" {
2129
+ import * as z from "zod";
2130
+ export const WebRtcUpdateSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2131
+ kind: z.ZodLiteral<"Sdp">;
2132
+ type: z.ZodEnum<["Answer", "Offer"]>;
2133
+ sdp: z.ZodString;
2134
+ media_map: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodString], null>, "many">;
2135
+ }, "strip", z.ZodTypeAny, {
2136
+ type?: "Answer" | "Offer";
2137
+ kind?: "Sdp";
2138
+ sdp?: string;
2139
+ media_map?: [number, string, ...unknown[]][];
2140
+ }, {
2141
+ type?: "Answer" | "Offer";
2142
+ kind?: "Sdp";
2143
+ sdp?: string;
2144
+ media_map?: [number, string, ...unknown[]][];
2145
+ }>, z.ZodObject<{
2146
+ kind: z.ZodLiteral<"Trickle">;
2147
+ candidate: z.ZodString;
2148
+ spd_mid: z.ZodOptional<z.ZodString>;
2149
+ spd_mline_index: z.ZodOptional<z.ZodNumber>;
2150
+ username_fragment: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
2151
+ }, "strip", z.ZodTypeAny, {
2152
+ candidate?: string;
2153
+ kind?: "Trickle";
2154
+ spd_mid?: string;
2155
+ spd_mline_index?: number;
2156
+ username_fragment?: string;
2157
+ }, {
2158
+ candidate?: string;
2159
+ kind?: "Trickle";
2160
+ spd_mid?: string;
2161
+ spd_mline_index?: number;
2162
+ username_fragment?: string;
2163
+ }>, z.ZodObject<{
2164
+ kind: z.ZodLiteral<"TrickleFinished">;
2165
+ }, "strip", z.ZodTypeAny, {
2166
+ kind?: "TrickleFinished";
2167
+ }, {
2168
+ kind?: "TrickleFinished";
2169
+ }>]>;
2170
+ export type WebRtcUpdate = z.infer<typeof WebRtcUpdateSchema>;
2171
+ }
2172
+ declare module "src/rpc/commands" {
2173
+ import { type infer, z } from "zod";
2174
+ export type { infer as Infer };
2175
+ export type Commands = Record<string, {
2176
+ request: z.ZodTypeAny;
2177
+ response: z.ZodTypeAny;
2178
+ }>;
2179
+ export const MainCommandsRpc: {
2180
+ Hello: {
2181
+ request: z.ZodObject<{
2182
+ stream: z.ZodLiteral<"main">;
2183
+ }, "strip", z.ZodTypeAny, {
2184
+ stream?: "main";
2185
+ }, {
2186
+ stream?: "main";
2187
+ }>;
2188
+ response: z.ZodNull;
2189
+ };
2190
+ JoinRoom: {
2191
+ request: z.ZodObject<{
2192
+ token: z.ZodString;
2193
+ room_id: z.ZodString;
2194
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
2195
+ position: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
2196
+ }, "strip", z.ZodTypeAny, {
2197
+ position?: [number, number, number, ...unknown[]] | [number, number, ...unknown[]];
2198
+ user_data?: Uint8Array<ArrayBufferLike>;
2199
+ room_id?: string;
2200
+ token?: string;
2201
+ }, {
2202
+ position?: [number, number, number, ...unknown[]] | [number, number, ...unknown[]];
2203
+ user_data?: Uint8Array<ArrayBufferLike>;
2204
+ room_id?: string;
2205
+ token?: string;
2206
+ }>;
2207
+ response: z.ZodObject<{
2208
+ peer_id: z.ZodNumber;
2209
+ stream_id: z.ZodOptional<z.ZodNumber>;
2210
+ token: z.ZodOptional<z.ZodString>;
2211
+ }, "strip", z.ZodTypeAny, {
2212
+ peer_id?: number;
2213
+ token?: string;
2214
+ stream_id?: number;
2215
+ }, {
2216
+ peer_id?: number;
2217
+ token?: string;
2218
+ stream_id?: number;
2219
+ }>;
2220
+ };
2221
+ WebRtcUpdate: {
2222
+ request: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2223
+ kind: z.ZodLiteral<"Sdp">;
2224
+ type: z.ZodEnum<["Answer", "Offer"]>;
2225
+ sdp: z.ZodString;
2226
+ media_map: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodString], null>, "many">;
2227
+ }, "strip", z.ZodTypeAny, {
2228
+ type?: "Answer" | "Offer";
2229
+ kind?: "Sdp";
2230
+ sdp?: string;
2231
+ media_map?: [number, string, ...unknown[]][];
2232
+ }, {
2233
+ type?: "Answer" | "Offer";
2234
+ kind?: "Sdp";
2235
+ sdp?: string;
2236
+ media_map?: [number, string, ...unknown[]][];
2237
+ }>, z.ZodObject<{
2238
+ kind: z.ZodLiteral<"Trickle">;
2239
+ candidate: z.ZodString;
2240
+ spd_mid: z.ZodOptional<z.ZodString>;
2241
+ spd_mline_index: z.ZodOptional<z.ZodNumber>;
2242
+ username_fragment: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
2243
+ }, "strip", z.ZodTypeAny, {
2244
+ candidate?: string;
2245
+ kind?: "Trickle";
2246
+ spd_mid?: string;
2247
+ spd_mline_index?: number;
2248
+ username_fragment?: string;
2249
+ }, {
2250
+ candidate?: string;
2251
+ kind?: "Trickle";
2252
+ spd_mid?: string;
2253
+ spd_mline_index?: number;
2254
+ username_fragment?: string;
2255
+ }>, z.ZodObject<{
2256
+ kind: z.ZodLiteral<"TrickleFinished">;
2257
+ }, "strip", z.ZodTypeAny, {
2258
+ kind?: "TrickleFinished";
2259
+ }, {
2260
+ kind?: "TrickleFinished";
2261
+ }>]>;
2262
+ response: z.ZodNull;
2263
+ };
2264
+ RequestReconnectToken: {
2265
+ request: z.ZodObject<{
2266
+ peer_id: z.ZodOptional<z.ZodNumber>;
2267
+ }, "strip", z.ZodTypeAny, {
2268
+ peer_id?: number;
2269
+ }, {
2270
+ peer_id?: number;
2271
+ }>;
2272
+ response: z.ZodString;
2273
+ };
2274
+ Ping: {
2275
+ request: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
2276
+ response: z.ZodNull;
2277
+ };
2278
+ };
2279
+ export type MainCommands = typeof MainCommandsRpc;
2280
+ export const RoomCommandsRpc: {
2281
+ Hello: {
2282
+ request: z.ZodObject<{
2283
+ stream: z.ZodLiteral<"room">;
2284
+ token: z.ZodString;
2285
+ room_id: z.ZodString;
2286
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
2287
+ position: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
2288
+ }, "strip", z.ZodTypeAny, {
2289
+ stream?: "room";
2290
+ position?: [number, number, number, ...unknown[]] | [number, number, ...unknown[]];
2291
+ user_data?: Uint8Array<ArrayBufferLike>;
2292
+ room_id?: string;
2293
+ token?: string;
2294
+ }, {
2295
+ stream?: "room";
2296
+ position?: [number, number, number, ...unknown[]] | [number, number, ...unknown[]];
2297
+ user_data?: Uint8Array<ArrayBufferLike>;
2298
+ room_id?: string;
2299
+ token?: string;
2300
+ }>;
2301
+ response: z.ZodNull;
2302
+ };
2303
+ UpdatePeer: {
2304
+ request: z.ZodObject<{
2305
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
2306
+ }, "strip", z.ZodTypeAny, {
2307
+ user_data?: Uint8Array<ArrayBufferLike>;
2308
+ }, {
2309
+ user_data?: Uint8Array<ArrayBufferLike>;
2310
+ }>;
2311
+ response: z.ZodNull;
2312
+ };
2313
+ StartMedia: {
2314
+ request: z.ZodObject<{
2315
+ media_id: z.ZodNumber;
2316
+ properties: z.ZodUnion<[z.ZodObject<{
2317
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
2318
+ uid: z.ZodOptional<z.ZodString>;
2319
+ customType: z.ZodOptional<z.ZodString>;
2320
+ }, "strip", z.ZodTypeAny, {
2321
+ uid?: string;
2322
+ kind?: "audio";
2323
+ customType?: string;
2324
+ }, {
2325
+ uid?: string;
2326
+ kind?: "audio";
2327
+ customType?: string;
2328
+ }>, z.ZodObject<{
2329
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
2330
+ codec: z.ZodOptional<z.ZodString>;
2331
+ uid: z.ZodOptional<z.ZodString>;
2332
+ customType: z.ZodOptional<z.ZodString>;
2333
+ }, "strip", z.ZodTypeAny, {
2334
+ codec?: string;
2335
+ uid?: string;
2336
+ kind?: "video";
2337
+ customType?: string;
2338
+ }, {
2339
+ codec?: string;
2340
+ uid?: string;
2341
+ kind?: "video";
2342
+ customType?: string;
2343
+ }>]>;
2344
+ }, "strip", z.ZodTypeAny, {
2345
+ properties?: {
2346
+ uid?: string;
2347
+ kind?: "audio";
2348
+ customType?: string;
2349
+ } | {
2350
+ codec?: string;
2351
+ uid?: string;
2352
+ kind?: "video";
2353
+ customType?: string;
2354
+ };
2355
+ media_id?: number;
2356
+ }, {
2357
+ properties?: {
2358
+ uid?: string;
2359
+ kind?: "audio";
2360
+ customType?: string;
2361
+ } | {
2362
+ codec?: string;
2363
+ uid?: string;
2364
+ kind?: "video";
2365
+ customType?: string;
2366
+ };
2367
+ media_id?: number;
2368
+ }>;
2369
+ response: z.ZodNull;
2370
+ };
2371
+ StopMedia: {
2372
+ request: z.ZodObject<{
2373
+ media_id: z.ZodNumber;
2374
+ }, "strip", z.ZodTypeAny, {
2375
+ media_id?: number;
2376
+ }, {
2377
+ media_id?: number;
2378
+ }>;
2379
+ response: z.ZodNull;
2380
+ };
2381
+ PauseMedia: {
2382
+ request: z.ZodObject<{
2383
+ media_id: z.ZodNumber;
2384
+ }, "strip", z.ZodTypeAny, {
2385
+ media_id?: number;
2386
+ }, {
2387
+ media_id?: number;
2388
+ }>;
2389
+ response: z.ZodNull;
2390
+ };
2391
+ ResumeMedia: {
2392
+ request: z.ZodObject<{
2393
+ media_id: z.ZodNumber;
2394
+ }, "strip", z.ZodTypeAny, {
2395
+ media_id?: number;
2396
+ }, {
2397
+ media_id?: number;
2398
+ }>;
2399
+ response: z.ZodNull;
2400
+ };
2401
+ SetPeerPosition: {
2402
+ request: z.ZodObject<{
2403
+ position: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
2404
+ }, "strip", z.ZodTypeAny, {
2405
+ position?: [number, number, number, ...unknown[]] | [number, number, ...unknown[]];
2406
+ }, {
2407
+ position?: [number, number, number, ...unknown[]] | [number, number, ...unknown[]];
2408
+ }>;
2409
+ response: z.ZodNull;
2410
+ };
2411
+ SendMessage: {
2412
+ request: z.ZodObject<{
2413
+ target_peer_ids: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
2414
+ message: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
2415
+ }, "strip", z.ZodTypeAny, {
2416
+ message?: Uint8Array<ArrayBufferLike>;
2417
+ target_peer_ids?: number[];
2418
+ }, {
2419
+ message?: Uint8Array<ArrayBufferLike>;
2420
+ target_peer_ids?: number[];
2421
+ }>;
2422
+ response: z.ZodNull;
2423
+ };
2424
+ };
2425
+ export type RoomCommands = typeof RoomCommandsRpc;
2426
+ }
2427
+ declare module "src/rpc/notifications" {
2428
+ import * as z from "zod";
2429
+ export type Notifications = Record<string, z.ZodTypeAny>;
2430
+ export const MainNotificationSchema: z.ZodObject<{
2431
+ name: z.ZodLiteral<"WebRtcUpdate">;
2432
+ properties: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2433
+ kind: z.ZodLiteral<"Sdp">;
2434
+ type: z.ZodEnum<["Answer", "Offer"]>;
2435
+ sdp: z.ZodString;
2436
+ media_map: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodString], null>, "many">;
2437
+ }, "strip", z.ZodTypeAny, {
2438
+ type?: "Answer" | "Offer";
2439
+ kind?: "Sdp";
2440
+ sdp?: string;
2441
+ media_map?: [number, string, ...unknown[]][];
2442
+ }, {
2443
+ type?: "Answer" | "Offer";
2444
+ kind?: "Sdp";
2445
+ sdp?: string;
2446
+ media_map?: [number, string, ...unknown[]][];
2447
+ }>, z.ZodObject<{
2448
+ kind: z.ZodLiteral<"Trickle">;
2449
+ candidate: z.ZodString;
2450
+ spd_mid: z.ZodOptional<z.ZodString>;
2451
+ spd_mline_index: z.ZodOptional<z.ZodNumber>;
2452
+ username_fragment: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
2453
+ }, "strip", z.ZodTypeAny, {
2454
+ candidate?: string;
2455
+ kind?: "Trickle";
2456
+ spd_mid?: string;
2457
+ spd_mline_index?: number;
2458
+ username_fragment?: string;
2459
+ }, {
2460
+ candidate?: string;
2461
+ kind?: "Trickle";
2462
+ spd_mid?: string;
2463
+ spd_mline_index?: number;
2464
+ username_fragment?: string;
2465
+ }>, z.ZodObject<{
2466
+ kind: z.ZodLiteral<"TrickleFinished">;
2467
+ }, "strip", z.ZodTypeAny, {
2468
+ kind?: "TrickleFinished";
2469
+ }, {
2470
+ kind?: "TrickleFinished";
2471
+ }>]>;
2472
+ }, "strip", z.ZodTypeAny, {
2473
+ name?: "WebRtcUpdate";
2474
+ properties?: {
2475
+ type?: "Answer" | "Offer";
2476
+ kind?: "Sdp";
2477
+ sdp?: string;
2478
+ media_map?: [number, string, ...unknown[]][];
2479
+ } | {
2480
+ candidate?: string;
2481
+ kind?: "Trickle";
2482
+ spd_mid?: string;
2483
+ spd_mline_index?: number;
2484
+ username_fragment?: string;
2485
+ } | {
2486
+ kind?: "TrickleFinished";
2487
+ };
2488
+ }, {
2489
+ name?: "WebRtcUpdate";
2490
+ properties?: {
2491
+ type?: "Answer" | "Offer";
2492
+ kind?: "Sdp";
2493
+ sdp?: string;
2494
+ media_map?: [number, string, ...unknown[]][];
2495
+ } | {
2496
+ candidate?: string;
2497
+ kind?: "Trickle";
2498
+ spd_mid?: string;
2499
+ spd_mline_index?: number;
2500
+ username_fragment?: string;
2501
+ } | {
2502
+ kind?: "TrickleFinished";
2503
+ };
2504
+ }>;
2505
+ export type MainNotification = z.infer<typeof MainNotificationSchema>;
2506
+ export const MainNotificationsRpc: {
2507
+ WebRtcUpdate: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2508
+ kind: z.ZodLiteral<"Sdp">;
2509
+ type: z.ZodEnum<["Answer", "Offer"]>;
2510
+ sdp: z.ZodString;
2511
+ media_map: z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodString], null>, "many">;
2512
+ }, "strip", z.ZodTypeAny, {
2513
+ type?: "Answer" | "Offer";
2514
+ kind?: "Sdp";
2515
+ sdp?: string;
2516
+ media_map?: [number, string, ...unknown[]][];
2517
+ }, {
2518
+ type?: "Answer" | "Offer";
2519
+ kind?: "Sdp";
2520
+ sdp?: string;
2521
+ media_map?: [number, string, ...unknown[]][];
2522
+ }>, z.ZodObject<{
2523
+ kind: z.ZodLiteral<"Trickle">;
2524
+ candidate: z.ZodString;
2525
+ spd_mid: z.ZodOptional<z.ZodString>;
2526
+ spd_mline_index: z.ZodOptional<z.ZodNumber>;
2527
+ username_fragment: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
2528
+ }, "strip", z.ZodTypeAny, {
2529
+ candidate?: string;
2530
+ kind?: "Trickle";
2531
+ spd_mid?: string;
2532
+ spd_mline_index?: number;
2533
+ username_fragment?: string;
2534
+ }, {
2535
+ candidate?: string;
2536
+ kind?: "Trickle";
2537
+ spd_mid?: string;
2538
+ spd_mline_index?: number;
2539
+ username_fragment?: string;
2540
+ }>, z.ZodObject<{
2541
+ kind: z.ZodLiteral<"TrickleFinished">;
2542
+ }, "strip", z.ZodTypeAny, {
2543
+ kind?: "TrickleFinished";
2544
+ }, {
2545
+ kind?: "TrickleFinished";
2546
+ }>]>;
2547
+ };
2548
+ export type MainNotifications = typeof MainNotificationsRpc;
2549
+ export const RoomNotificationSchema: z.ZodUnion<[z.ZodObject<{
2550
+ name: z.ZodLiteral<"RoomStatusChanged">;
2551
+ properties: z.ZodObject<{
2552
+ status: z.ZodEnum<["Joining", "Joined", "Closed"]>;
2553
+ message: z.ZodOptional<z.ZodString>;
2554
+ }, "strip", z.ZodTypeAny, {
2555
+ message?: string;
2556
+ status?: "Joined" | "Joining" | "Closed";
2557
+ }, {
2558
+ message?: string;
2559
+ status?: "Joined" | "Joining" | "Closed";
2560
+ }>;
2561
+ }, "strip", z.ZodTypeAny, {
2562
+ name?: "RoomStatusChanged";
2563
+ properties?: {
2564
+ message?: string;
2565
+ status?: "Joined" | "Joining" | "Closed";
2566
+ };
2567
+ }, {
2568
+ name?: "RoomStatusChanged";
2569
+ properties?: {
2570
+ message?: string;
2571
+ status?: "Joined" | "Joining" | "Closed";
2572
+ };
2573
+ }>, z.ZodObject<{
2574
+ name: z.ZodLiteral<"RoomUpdated">;
2575
+ properties: z.ZodObject<{
2576
+ updates: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2577
+ kind: z.ZodLiteral<"Joined">;
2578
+ room: z.ZodObject<{
2579
+ id: z.ZodString;
2580
+ customer: z.ZodString;
2581
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
2582
+ peers: z.ZodArray<z.ZodObject<{
2583
+ id: z.ZodNumber;
2584
+ user_id: z.ZodString;
2585
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
2586
+ medias: z.ZodArray<z.ZodObject<{
2587
+ id: z.ZodNumber;
2588
+ properties: z.ZodUnion<[z.ZodObject<{
2589
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
2590
+ uid: z.ZodOptional<z.ZodString>;
2591
+ customType: z.ZodOptional<z.ZodString>;
2592
+ }, "strip", z.ZodTypeAny, {
2593
+ uid?: string;
2594
+ kind?: "audio";
2595
+ customType?: string;
2596
+ }, {
2597
+ uid?: string;
2598
+ kind?: "audio";
2599
+ customType?: string;
2600
+ }>, z.ZodObject<{
2601
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
2602
+ codec: z.ZodOptional<z.ZodString>;
2603
+ uid: z.ZodOptional<z.ZodString>;
2604
+ customType: z.ZodOptional<z.ZodString>;
2605
+ }, "strip", z.ZodTypeAny, {
2606
+ codec?: string;
2607
+ uid?: string;
2608
+ kind?: "video";
2609
+ customType?: string;
2610
+ }, {
2611
+ codec?: string;
2612
+ uid?: string;
2613
+ kind?: "video";
2614
+ customType?: string;
2615
+ }>]>;
2616
+ paused: z.ZodBoolean;
2617
+ }, "strip", z.ZodTypeAny, {
2618
+ id?: number;
2619
+ paused?: boolean;
2620
+ properties?: {
2621
+ uid?: string;
2622
+ kind?: "audio";
2623
+ customType?: string;
2624
+ } | {
2625
+ codec?: string;
2626
+ uid?: string;
2627
+ kind?: "video";
2628
+ customType?: string;
2629
+ };
2630
+ }, {
2631
+ id?: number;
2632
+ paused?: boolean;
2633
+ properties?: {
2634
+ uid?: string;
2635
+ kind?: "audio";
2636
+ customType?: string;
2637
+ } | {
2638
+ codec?: string;
2639
+ uid?: string;
2640
+ kind?: "video";
2641
+ customType?: string;
2642
+ };
2643
+ }>, "many">;
2644
+ }, "strip", z.ZodTypeAny, {
2645
+ id?: number;
2646
+ user_id?: string;
2647
+ user_data?: Uint8Array<ArrayBufferLike>;
2648
+ medias?: {
2649
+ id?: number;
2650
+ paused?: boolean;
2651
+ properties?: {
2652
+ uid?: string;
2653
+ kind?: "audio";
2654
+ customType?: string;
2655
+ } | {
2656
+ codec?: string;
2657
+ uid?: string;
2658
+ kind?: "video";
2659
+ customType?: string;
2660
+ };
2661
+ }[];
2662
+ }, {
2663
+ id?: number;
2664
+ user_id?: string;
2665
+ user_data?: Uint8Array<ArrayBufferLike>;
2666
+ medias?: {
2667
+ id?: number;
2668
+ paused?: boolean;
2669
+ properties?: {
2670
+ uid?: string;
2671
+ kind?: "audio";
2672
+ customType?: string;
2673
+ } | {
2674
+ codec?: string;
2675
+ uid?: string;
2676
+ kind?: "video";
2677
+ customType?: string;
2678
+ };
2679
+ }[];
2680
+ }>, "many">;
2681
+ }, "strip", z.ZodTypeAny, {
2682
+ id?: string;
2683
+ user_data?: Uint8Array<ArrayBufferLike>;
2684
+ customer?: string;
2685
+ peers?: {
2686
+ id?: number;
2687
+ user_id?: string;
2688
+ user_data?: Uint8Array<ArrayBufferLike>;
2689
+ medias?: {
2690
+ id?: number;
2691
+ paused?: boolean;
2692
+ properties?: {
2693
+ uid?: string;
2694
+ kind?: "audio";
2695
+ customType?: string;
2696
+ } | {
2697
+ codec?: string;
2698
+ uid?: string;
2699
+ kind?: "video";
2700
+ customType?: string;
2701
+ };
2702
+ }[];
2703
+ }[];
2704
+ }, {
2705
+ id?: string;
2706
+ user_data?: Uint8Array<ArrayBufferLike>;
2707
+ customer?: string;
2708
+ peers?: {
2709
+ id?: number;
2710
+ user_id?: string;
2711
+ user_data?: Uint8Array<ArrayBufferLike>;
2712
+ medias?: {
2713
+ id?: number;
2714
+ paused?: boolean;
2715
+ properties?: {
2716
+ uid?: string;
2717
+ kind?: "audio";
2718
+ customType?: string;
2719
+ } | {
2720
+ codec?: string;
2721
+ uid?: string;
2722
+ kind?: "video";
2723
+ customType?: string;
2724
+ };
2725
+ }[];
2726
+ }[];
2727
+ }>;
2728
+ media_ids: z.ZodArray<z.ZodNumber, "many">;
2729
+ own_peer_id: z.ZodNumber;
2730
+ }, "strip", z.ZodTypeAny, {
2731
+ kind?: "Joined";
2732
+ room?: {
2733
+ id?: string;
2734
+ user_data?: Uint8Array<ArrayBufferLike>;
2735
+ customer?: string;
2736
+ peers?: {
2737
+ id?: number;
2738
+ user_id?: string;
2739
+ user_data?: Uint8Array<ArrayBufferLike>;
2740
+ medias?: {
2741
+ id?: number;
2742
+ paused?: boolean;
2743
+ properties?: {
2744
+ uid?: string;
2745
+ kind?: "audio";
2746
+ customType?: string;
2747
+ } | {
2748
+ codec?: string;
2749
+ uid?: string;
2750
+ kind?: "video";
2751
+ customType?: string;
2752
+ };
2753
+ }[];
2754
+ }[];
2755
+ };
2756
+ media_ids?: number[];
2757
+ own_peer_id?: number;
2758
+ }, {
2759
+ kind?: "Joined";
2760
+ room?: {
2761
+ id?: string;
2762
+ user_data?: Uint8Array<ArrayBufferLike>;
2763
+ customer?: string;
2764
+ peers?: {
2765
+ id?: number;
2766
+ user_id?: string;
2767
+ user_data?: Uint8Array<ArrayBufferLike>;
2768
+ medias?: {
2769
+ id?: number;
2770
+ paused?: boolean;
2771
+ properties?: {
2772
+ uid?: string;
2773
+ kind?: "audio";
2774
+ customType?: string;
2775
+ } | {
2776
+ codec?: string;
2777
+ uid?: string;
2778
+ kind?: "video";
2779
+ customType?: string;
2780
+ };
2781
+ }[];
2782
+ }[];
2783
+ };
2784
+ media_ids?: number[];
2785
+ own_peer_id?: number;
2786
+ }>, z.ZodObject<{
2787
+ kind: z.ZodLiteral<"Left">;
2788
+ reason: z.ZodEnum<["RoomClosing", "ServerClosing", "PeerKicked"]>;
2789
+ }, "strip", z.ZodTypeAny, {
2790
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
2791
+ kind?: "Left";
2792
+ }, {
2793
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
2794
+ kind?: "Left";
2795
+ }>, z.ZodObject<{
2796
+ kind: z.ZodLiteral<"UserDataChanged">;
2797
+ user_data: z.ZodOptional<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>>;
2798
+ }, "strip", z.ZodTypeAny, {
2799
+ kind?: "UserDataChanged";
2800
+ user_data?: Uint8Array<ArrayBufferLike>;
2801
+ }, {
2802
+ kind?: "UserDataChanged";
2803
+ user_data?: Uint8Array<ArrayBufferLike>;
2804
+ }>, z.ZodObject<{
2805
+ kind: z.ZodLiteral<"PeerJoined">;
2806
+ peer: z.ZodObject<{
2807
+ id: z.ZodNumber;
2808
+ user_id: z.ZodString;
2809
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
2810
+ medias: z.ZodArray<z.ZodObject<{
2811
+ id: z.ZodNumber;
2812
+ properties: z.ZodUnion<[z.ZodObject<{
2813
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
2814
+ uid: z.ZodOptional<z.ZodString>;
2815
+ customType: z.ZodOptional<z.ZodString>;
2816
+ }, "strip", z.ZodTypeAny, {
2817
+ uid?: string;
2818
+ kind?: "audio";
2819
+ customType?: string;
2820
+ }, {
2821
+ uid?: string;
2822
+ kind?: "audio";
2823
+ customType?: string;
2824
+ }>, z.ZodObject<{
2825
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
2826
+ codec: z.ZodOptional<z.ZodString>;
2827
+ uid: z.ZodOptional<z.ZodString>;
2828
+ customType: z.ZodOptional<z.ZodString>;
2829
+ }, "strip", z.ZodTypeAny, {
2830
+ codec?: string;
2831
+ uid?: string;
2832
+ kind?: "video";
2833
+ customType?: string;
2834
+ }, {
2835
+ codec?: string;
2836
+ uid?: string;
2837
+ kind?: "video";
2838
+ customType?: string;
2839
+ }>]>;
2840
+ paused: z.ZodBoolean;
2841
+ }, "strip", z.ZodTypeAny, {
2842
+ id?: number;
2843
+ paused?: boolean;
2844
+ properties?: {
2845
+ uid?: string;
2846
+ kind?: "audio";
2847
+ customType?: string;
2848
+ } | {
2849
+ codec?: string;
2850
+ uid?: string;
2851
+ kind?: "video";
2852
+ customType?: string;
2853
+ };
2854
+ }, {
2855
+ id?: number;
2856
+ paused?: boolean;
2857
+ properties?: {
2858
+ uid?: string;
2859
+ kind?: "audio";
2860
+ customType?: string;
2861
+ } | {
2862
+ codec?: string;
2863
+ uid?: string;
2864
+ kind?: "video";
2865
+ customType?: string;
2866
+ };
2867
+ }>, "many">;
2868
+ }, "strip", z.ZodTypeAny, {
2869
+ id?: number;
2870
+ user_id?: string;
2871
+ user_data?: Uint8Array<ArrayBufferLike>;
2872
+ medias?: {
2873
+ id?: number;
2874
+ paused?: boolean;
2875
+ properties?: {
2876
+ uid?: string;
2877
+ kind?: "audio";
2878
+ customType?: string;
2879
+ } | {
2880
+ codec?: string;
2881
+ uid?: string;
2882
+ kind?: "video";
2883
+ customType?: string;
2884
+ };
2885
+ }[];
2886
+ }, {
2887
+ id?: number;
2888
+ user_id?: string;
2889
+ user_data?: Uint8Array<ArrayBufferLike>;
2890
+ medias?: {
2891
+ id?: number;
2892
+ paused?: boolean;
2893
+ properties?: {
2894
+ uid?: string;
2895
+ kind?: "audio";
2896
+ customType?: string;
2897
+ } | {
2898
+ codec?: string;
2899
+ uid?: string;
2900
+ kind?: "video";
2901
+ customType?: string;
2902
+ };
2903
+ }[];
2904
+ }>;
2905
+ }, "strip", z.ZodTypeAny, {
2906
+ kind?: "PeerJoined";
2907
+ peer?: {
2908
+ id?: number;
2909
+ user_id?: string;
2910
+ user_data?: Uint8Array<ArrayBufferLike>;
2911
+ medias?: {
2912
+ id?: number;
2913
+ paused?: boolean;
2914
+ properties?: {
2915
+ uid?: string;
2916
+ kind?: "audio";
2917
+ customType?: string;
2918
+ } | {
2919
+ codec?: string;
2920
+ uid?: string;
2921
+ kind?: "video";
2922
+ customType?: string;
2923
+ };
2924
+ }[];
2925
+ };
2926
+ }, {
2927
+ kind?: "PeerJoined";
2928
+ peer?: {
2929
+ id?: number;
2930
+ user_id?: string;
2931
+ user_data?: Uint8Array<ArrayBufferLike>;
2932
+ medias?: {
2933
+ id?: number;
2934
+ paused?: boolean;
2935
+ properties?: {
2936
+ uid?: string;
2937
+ kind?: "audio";
2938
+ customType?: string;
2939
+ } | {
2940
+ codec?: string;
2941
+ uid?: string;
2942
+ kind?: "video";
2943
+ customType?: string;
2944
+ };
2945
+ }[];
2946
+ };
2947
+ }>, z.ZodObject<{
2948
+ kind: z.ZodLiteral<"PeerLeft">;
2949
+ peer_id: z.ZodNumber;
2950
+ }, "strip", z.ZodTypeAny, {
2951
+ kind?: "PeerLeft";
2952
+ peer_id?: number;
2953
+ }, {
2954
+ kind?: "PeerLeft";
2955
+ peer_id?: number;
2956
+ }>]>, "many">;
2957
+ }, "strip", z.ZodTypeAny, {
2958
+ updates?: ({
2959
+ kind?: "Joined";
2960
+ room?: {
2961
+ id?: string;
2962
+ user_data?: Uint8Array<ArrayBufferLike>;
2963
+ customer?: string;
2964
+ peers?: {
2965
+ id?: number;
2966
+ user_id?: string;
2967
+ user_data?: Uint8Array<ArrayBufferLike>;
2968
+ medias?: {
2969
+ id?: number;
2970
+ paused?: boolean;
2971
+ properties?: {
2972
+ uid?: string;
2973
+ kind?: "audio";
2974
+ customType?: string;
2975
+ } | {
2976
+ codec?: string;
2977
+ uid?: string;
2978
+ kind?: "video";
2979
+ customType?: string;
2980
+ };
2981
+ }[];
2982
+ }[];
2983
+ };
2984
+ media_ids?: number[];
2985
+ own_peer_id?: number;
2986
+ } | {
2987
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
2988
+ kind?: "Left";
2989
+ } | {
2990
+ kind?: "UserDataChanged";
2991
+ user_data?: Uint8Array<ArrayBufferLike>;
2992
+ } | {
2993
+ kind?: "PeerJoined";
2994
+ peer?: {
2995
+ id?: number;
2996
+ user_id?: string;
2997
+ user_data?: Uint8Array<ArrayBufferLike>;
2998
+ medias?: {
2999
+ id?: number;
3000
+ paused?: boolean;
3001
+ properties?: {
3002
+ uid?: string;
3003
+ kind?: "audio";
3004
+ customType?: string;
3005
+ } | {
3006
+ codec?: string;
3007
+ uid?: string;
3008
+ kind?: "video";
3009
+ customType?: string;
3010
+ };
3011
+ }[];
3012
+ };
3013
+ } | {
3014
+ kind?: "PeerLeft";
3015
+ peer_id?: number;
3016
+ })[];
3017
+ }, {
3018
+ updates?: ({
3019
+ kind?: "Joined";
3020
+ room?: {
3021
+ id?: string;
3022
+ user_data?: Uint8Array<ArrayBufferLike>;
3023
+ customer?: string;
3024
+ peers?: {
3025
+ id?: number;
3026
+ user_id?: string;
3027
+ user_data?: Uint8Array<ArrayBufferLike>;
3028
+ medias?: {
3029
+ id?: number;
3030
+ paused?: boolean;
3031
+ properties?: {
3032
+ uid?: string;
3033
+ kind?: "audio";
3034
+ customType?: string;
3035
+ } | {
3036
+ codec?: string;
3037
+ uid?: string;
3038
+ kind?: "video";
3039
+ customType?: string;
3040
+ };
3041
+ }[];
3042
+ }[];
3043
+ };
3044
+ media_ids?: number[];
3045
+ own_peer_id?: number;
3046
+ } | {
3047
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
3048
+ kind?: "Left";
3049
+ } | {
3050
+ kind?: "UserDataChanged";
3051
+ user_data?: Uint8Array<ArrayBufferLike>;
3052
+ } | {
3053
+ kind?: "PeerJoined";
3054
+ peer?: {
3055
+ id?: number;
3056
+ user_id?: string;
3057
+ user_data?: Uint8Array<ArrayBufferLike>;
3058
+ medias?: {
3059
+ id?: number;
3060
+ paused?: boolean;
3061
+ properties?: {
3062
+ uid?: string;
3063
+ kind?: "audio";
3064
+ customType?: string;
3065
+ } | {
3066
+ codec?: string;
3067
+ uid?: string;
3068
+ kind?: "video";
3069
+ customType?: string;
3070
+ };
3071
+ }[];
3072
+ };
3073
+ } | {
3074
+ kind?: "PeerLeft";
3075
+ peer_id?: number;
3076
+ })[];
3077
+ }>;
3078
+ }, "strip", z.ZodTypeAny, {
3079
+ name?: "RoomUpdated";
3080
+ properties?: {
3081
+ updates?: ({
3082
+ kind?: "Joined";
3083
+ room?: {
3084
+ id?: string;
3085
+ user_data?: Uint8Array<ArrayBufferLike>;
3086
+ customer?: string;
3087
+ peers?: {
3088
+ id?: number;
3089
+ user_id?: string;
3090
+ user_data?: Uint8Array<ArrayBufferLike>;
3091
+ medias?: {
3092
+ id?: number;
3093
+ paused?: boolean;
3094
+ properties?: {
3095
+ uid?: string;
3096
+ kind?: "audio";
3097
+ customType?: string;
3098
+ } | {
3099
+ codec?: string;
3100
+ uid?: string;
3101
+ kind?: "video";
3102
+ customType?: string;
3103
+ };
3104
+ }[];
3105
+ }[];
3106
+ };
3107
+ media_ids?: number[];
3108
+ own_peer_id?: number;
3109
+ } | {
3110
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
3111
+ kind?: "Left";
3112
+ } | {
3113
+ kind?: "UserDataChanged";
3114
+ user_data?: Uint8Array<ArrayBufferLike>;
3115
+ } | {
3116
+ kind?: "PeerJoined";
3117
+ peer?: {
3118
+ id?: number;
3119
+ user_id?: string;
3120
+ user_data?: Uint8Array<ArrayBufferLike>;
3121
+ medias?: {
3122
+ id?: number;
3123
+ paused?: boolean;
3124
+ properties?: {
3125
+ uid?: string;
3126
+ kind?: "audio";
3127
+ customType?: string;
3128
+ } | {
3129
+ codec?: string;
3130
+ uid?: string;
3131
+ kind?: "video";
3132
+ customType?: string;
3133
+ };
3134
+ }[];
3135
+ };
3136
+ } | {
3137
+ kind?: "PeerLeft";
3138
+ peer_id?: number;
3139
+ })[];
3140
+ };
3141
+ }, {
3142
+ name?: "RoomUpdated";
3143
+ properties?: {
3144
+ updates?: ({
3145
+ kind?: "Joined";
3146
+ room?: {
3147
+ id?: string;
3148
+ user_data?: Uint8Array<ArrayBufferLike>;
3149
+ customer?: string;
3150
+ peers?: {
3151
+ id?: number;
3152
+ user_id?: string;
3153
+ user_data?: Uint8Array<ArrayBufferLike>;
3154
+ medias?: {
3155
+ id?: number;
3156
+ paused?: boolean;
3157
+ properties?: {
3158
+ uid?: string;
3159
+ kind?: "audio";
3160
+ customType?: string;
3161
+ } | {
3162
+ codec?: string;
3163
+ uid?: string;
3164
+ kind?: "video";
3165
+ customType?: string;
3166
+ };
3167
+ }[];
3168
+ }[];
3169
+ };
3170
+ media_ids?: number[];
3171
+ own_peer_id?: number;
3172
+ } | {
3173
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
3174
+ kind?: "Left";
3175
+ } | {
3176
+ kind?: "UserDataChanged";
3177
+ user_data?: Uint8Array<ArrayBufferLike>;
3178
+ } | {
3179
+ kind?: "PeerJoined";
3180
+ peer?: {
3181
+ id?: number;
3182
+ user_id?: string;
3183
+ user_data?: Uint8Array<ArrayBufferLike>;
3184
+ medias?: {
3185
+ id?: number;
3186
+ paused?: boolean;
3187
+ properties?: {
3188
+ uid?: string;
3189
+ kind?: "audio";
3190
+ customType?: string;
3191
+ } | {
3192
+ codec?: string;
3193
+ uid?: string;
3194
+ kind?: "video";
3195
+ customType?: string;
3196
+ };
3197
+ }[];
3198
+ };
3199
+ } | {
3200
+ kind?: "PeerLeft";
3201
+ peer_id?: number;
3202
+ })[];
3203
+ };
3204
+ }>, z.ZodObject<{
3205
+ name: z.ZodLiteral<"PeerUpdated">;
3206
+ properties: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3207
+ kind: z.ZodLiteral<"UserDataChanged">;
3208
+ peer_id: z.ZodNumber;
3209
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
3210
+ }, "strip", z.ZodTypeAny, {
3211
+ kind?: "UserDataChanged";
3212
+ user_data?: Uint8Array<ArrayBufferLike>;
3213
+ peer_id?: number;
3214
+ }, {
3215
+ kind?: "UserDataChanged";
3216
+ user_data?: Uint8Array<ArrayBufferLike>;
3217
+ peer_id?: number;
3218
+ }>, z.ZodObject<{
3219
+ kind: z.ZodLiteral<"MediaStarted">;
3220
+ peer_id: z.ZodNumber;
3221
+ media: z.ZodObject<{
3222
+ id: z.ZodNumber;
3223
+ properties: z.ZodUnion<[z.ZodObject<{
3224
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
3225
+ uid: z.ZodOptional<z.ZodString>;
3226
+ customType: z.ZodOptional<z.ZodString>;
3227
+ }, "strip", z.ZodTypeAny, {
3228
+ uid?: string;
3229
+ kind?: "audio";
3230
+ customType?: string;
3231
+ }, {
3232
+ uid?: string;
3233
+ kind?: "audio";
3234
+ customType?: string;
3235
+ }>, z.ZodObject<{
3236
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
3237
+ codec: z.ZodOptional<z.ZodString>;
3238
+ uid: z.ZodOptional<z.ZodString>;
3239
+ customType: z.ZodOptional<z.ZodString>;
3240
+ }, "strip", z.ZodTypeAny, {
3241
+ codec?: string;
3242
+ uid?: string;
3243
+ kind?: "video";
3244
+ customType?: string;
3245
+ }, {
3246
+ codec?: string;
3247
+ uid?: string;
3248
+ kind?: "video";
3249
+ customType?: string;
3250
+ }>]>;
3251
+ paused: z.ZodBoolean;
3252
+ }, "strip", z.ZodTypeAny, {
3253
+ id?: number;
3254
+ paused?: boolean;
3255
+ properties?: {
3256
+ uid?: string;
3257
+ kind?: "audio";
3258
+ customType?: string;
3259
+ } | {
3260
+ codec?: string;
3261
+ uid?: string;
3262
+ kind?: "video";
3263
+ customType?: string;
3264
+ };
3265
+ }, {
3266
+ id?: number;
3267
+ paused?: boolean;
3268
+ properties?: {
3269
+ uid?: string;
3270
+ kind?: "audio";
3271
+ customType?: string;
3272
+ } | {
3273
+ codec?: string;
3274
+ uid?: string;
3275
+ kind?: "video";
3276
+ customType?: string;
3277
+ };
3278
+ }>;
3279
+ }, "strip", z.ZodTypeAny, {
3280
+ media?: {
3281
+ id?: number;
3282
+ paused?: boolean;
3283
+ properties?: {
3284
+ uid?: string;
3285
+ kind?: "audio";
3286
+ customType?: string;
3287
+ } | {
3288
+ codec?: string;
3289
+ uid?: string;
3290
+ kind?: "video";
3291
+ customType?: string;
3292
+ };
3293
+ };
3294
+ kind?: "MediaStarted";
3295
+ peer_id?: number;
3296
+ }, {
3297
+ media?: {
3298
+ id?: number;
3299
+ paused?: boolean;
3300
+ properties?: {
3301
+ uid?: string;
3302
+ kind?: "audio";
3303
+ customType?: string;
3304
+ } | {
3305
+ codec?: string;
3306
+ uid?: string;
3307
+ kind?: "video";
3308
+ customType?: string;
3309
+ };
3310
+ };
3311
+ kind?: "MediaStarted";
3312
+ peer_id?: number;
3313
+ }>, z.ZodObject<{
3314
+ kind: z.ZodLiteral<"MediaStopped">;
3315
+ peer_id: z.ZodNumber;
3316
+ media_id: z.ZodNumber;
3317
+ }, "strip", z.ZodTypeAny, {
3318
+ kind?: "MediaStopped";
3319
+ peer_id?: number;
3320
+ media_id?: number;
3321
+ }, {
3322
+ kind?: "MediaStopped";
3323
+ peer_id?: number;
3324
+ media_id?: number;
3325
+ }>]>;
3326
+ }, "strip", z.ZodTypeAny, {
3327
+ name?: "PeerUpdated";
3328
+ properties?: {
3329
+ kind?: "UserDataChanged";
3330
+ user_data?: Uint8Array<ArrayBufferLike>;
3331
+ peer_id?: number;
3332
+ } | {
3333
+ media?: {
3334
+ id?: number;
3335
+ paused?: boolean;
3336
+ properties?: {
3337
+ uid?: string;
3338
+ kind?: "audio";
3339
+ customType?: string;
3340
+ } | {
3341
+ codec?: string;
3342
+ uid?: string;
3343
+ kind?: "video";
3344
+ customType?: string;
3345
+ };
3346
+ };
3347
+ kind?: "MediaStarted";
3348
+ peer_id?: number;
3349
+ } | {
3350
+ kind?: "MediaStopped";
3351
+ peer_id?: number;
3352
+ media_id?: number;
3353
+ };
3354
+ }, {
3355
+ name?: "PeerUpdated";
3356
+ properties?: {
3357
+ kind?: "UserDataChanged";
3358
+ user_data?: Uint8Array<ArrayBufferLike>;
3359
+ peer_id?: number;
3360
+ } | {
3361
+ media?: {
3362
+ id?: number;
3363
+ paused?: boolean;
3364
+ properties?: {
3365
+ uid?: string;
3366
+ kind?: "audio";
3367
+ customType?: string;
3368
+ } | {
3369
+ codec?: string;
3370
+ uid?: string;
3371
+ kind?: "video";
3372
+ customType?: string;
3373
+ };
3374
+ };
3375
+ kind?: "MediaStarted";
3376
+ peer_id?: number;
3377
+ } | {
3378
+ kind?: "MediaStopped";
3379
+ peer_id?: number;
3380
+ media_id?: number;
3381
+ };
3382
+ }>, z.ZodObject<{
3383
+ name: z.ZodLiteral<"MessageReceived">;
3384
+ properties: z.ZodObject<{
3385
+ sender_peer_id: z.ZodNumber;
3386
+ message: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
3387
+ }, "strip", z.ZodTypeAny, {
3388
+ message?: Uint8Array<ArrayBufferLike>;
3389
+ sender_peer_id?: number;
3390
+ }, {
3391
+ message?: Uint8Array<ArrayBufferLike>;
3392
+ sender_peer_id?: number;
3393
+ }>;
3394
+ }, "strip", z.ZodTypeAny, {
3395
+ name?: "MessageReceived";
3396
+ properties?: {
3397
+ message?: Uint8Array<ArrayBufferLike>;
3398
+ sender_peer_id?: number;
3399
+ };
3400
+ }, {
3401
+ name?: "MessageReceived";
3402
+ properties?: {
3403
+ message?: Uint8Array<ArrayBufferLike>;
3404
+ sender_peer_id?: number;
3405
+ };
3406
+ }>]>;
3407
+ export type RoomNotification = z.infer<typeof RoomNotificationSchema>;
3408
+ export const RoomNotificationsRpc: {
3409
+ RoomStatusChanged: z.ZodObject<{
3410
+ status: z.ZodEnum<["Joining", "Joined", "Closed"]>;
3411
+ message: z.ZodOptional<z.ZodString>;
3412
+ }, "strip", z.ZodTypeAny, {
3413
+ message?: string;
3414
+ status?: "Joined" | "Joining" | "Closed";
3415
+ }, {
3416
+ message?: string;
3417
+ status?: "Joined" | "Joining" | "Closed";
3418
+ }>;
3419
+ RoomUpdated: z.ZodObject<{
3420
+ updates: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3421
+ kind: z.ZodLiteral<"Joined">;
3422
+ room: z.ZodObject<{
3423
+ id: z.ZodString;
3424
+ customer: z.ZodString;
3425
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
3426
+ peers: z.ZodArray<z.ZodObject<{
3427
+ id: z.ZodNumber;
3428
+ user_id: z.ZodString;
3429
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
3430
+ medias: z.ZodArray<z.ZodObject<{
3431
+ id: z.ZodNumber;
3432
+ properties: z.ZodUnion<[z.ZodObject<{
3433
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
3434
+ uid: z.ZodOptional<z.ZodString>;
3435
+ customType: z.ZodOptional<z.ZodString>;
3436
+ }, "strip", z.ZodTypeAny, {
3437
+ uid?: string;
3438
+ kind?: "audio";
3439
+ customType?: string;
3440
+ }, {
3441
+ uid?: string;
3442
+ kind?: "audio";
3443
+ customType?: string;
3444
+ }>, z.ZodObject<{
3445
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
3446
+ codec: z.ZodOptional<z.ZodString>;
3447
+ uid: z.ZodOptional<z.ZodString>;
3448
+ customType: z.ZodOptional<z.ZodString>;
3449
+ }, "strip", z.ZodTypeAny, {
3450
+ codec?: string;
3451
+ uid?: string;
3452
+ kind?: "video";
3453
+ customType?: string;
3454
+ }, {
3455
+ codec?: string;
3456
+ uid?: string;
3457
+ kind?: "video";
3458
+ customType?: string;
3459
+ }>]>;
3460
+ paused: z.ZodBoolean;
3461
+ }, "strip", z.ZodTypeAny, {
3462
+ id?: number;
3463
+ paused?: boolean;
3464
+ properties?: {
3465
+ uid?: string;
3466
+ kind?: "audio";
3467
+ customType?: string;
3468
+ } | {
3469
+ codec?: string;
3470
+ uid?: string;
3471
+ kind?: "video";
3472
+ customType?: string;
3473
+ };
3474
+ }, {
3475
+ id?: number;
3476
+ paused?: boolean;
3477
+ properties?: {
3478
+ uid?: string;
3479
+ kind?: "audio";
3480
+ customType?: string;
3481
+ } | {
3482
+ codec?: string;
3483
+ uid?: string;
3484
+ kind?: "video";
3485
+ customType?: string;
3486
+ };
3487
+ }>, "many">;
3488
+ }, "strip", z.ZodTypeAny, {
3489
+ id?: number;
3490
+ user_id?: string;
3491
+ user_data?: Uint8Array<ArrayBufferLike>;
3492
+ medias?: {
3493
+ id?: number;
3494
+ paused?: boolean;
3495
+ properties?: {
3496
+ uid?: string;
3497
+ kind?: "audio";
3498
+ customType?: string;
3499
+ } | {
3500
+ codec?: string;
3501
+ uid?: string;
3502
+ kind?: "video";
3503
+ customType?: string;
3504
+ };
3505
+ }[];
3506
+ }, {
3507
+ id?: number;
3508
+ user_id?: string;
3509
+ user_data?: Uint8Array<ArrayBufferLike>;
3510
+ medias?: {
3511
+ id?: number;
3512
+ paused?: boolean;
3513
+ properties?: {
3514
+ uid?: string;
3515
+ kind?: "audio";
3516
+ customType?: string;
3517
+ } | {
3518
+ codec?: string;
3519
+ uid?: string;
3520
+ kind?: "video";
3521
+ customType?: string;
3522
+ };
3523
+ }[];
3524
+ }>, "many">;
3525
+ }, "strip", z.ZodTypeAny, {
3526
+ id?: string;
3527
+ user_data?: Uint8Array<ArrayBufferLike>;
3528
+ customer?: string;
3529
+ peers?: {
3530
+ id?: number;
3531
+ user_id?: string;
3532
+ user_data?: Uint8Array<ArrayBufferLike>;
3533
+ medias?: {
3534
+ id?: number;
3535
+ paused?: boolean;
3536
+ properties?: {
3537
+ uid?: string;
3538
+ kind?: "audio";
3539
+ customType?: string;
3540
+ } | {
3541
+ codec?: string;
3542
+ uid?: string;
3543
+ kind?: "video";
3544
+ customType?: string;
3545
+ };
3546
+ }[];
3547
+ }[];
3548
+ }, {
3549
+ id?: string;
3550
+ user_data?: Uint8Array<ArrayBufferLike>;
3551
+ customer?: string;
3552
+ peers?: {
3553
+ id?: number;
3554
+ user_id?: string;
3555
+ user_data?: Uint8Array<ArrayBufferLike>;
3556
+ medias?: {
3557
+ id?: number;
3558
+ paused?: boolean;
3559
+ properties?: {
3560
+ uid?: string;
3561
+ kind?: "audio";
3562
+ customType?: string;
3563
+ } | {
3564
+ codec?: string;
3565
+ uid?: string;
3566
+ kind?: "video";
3567
+ customType?: string;
3568
+ };
3569
+ }[];
3570
+ }[];
3571
+ }>;
3572
+ media_ids: z.ZodArray<z.ZodNumber, "many">;
3573
+ own_peer_id: z.ZodNumber;
3574
+ }, "strip", z.ZodTypeAny, {
3575
+ kind?: "Joined";
3576
+ room?: {
3577
+ id?: string;
3578
+ user_data?: Uint8Array<ArrayBufferLike>;
3579
+ customer?: string;
3580
+ peers?: {
3581
+ id?: number;
3582
+ user_id?: string;
3583
+ user_data?: Uint8Array<ArrayBufferLike>;
3584
+ medias?: {
3585
+ id?: number;
3586
+ paused?: boolean;
3587
+ properties?: {
3588
+ uid?: string;
3589
+ kind?: "audio";
3590
+ customType?: string;
3591
+ } | {
3592
+ codec?: string;
3593
+ uid?: string;
3594
+ kind?: "video";
3595
+ customType?: string;
3596
+ };
3597
+ }[];
3598
+ }[];
3599
+ };
3600
+ media_ids?: number[];
3601
+ own_peer_id?: number;
3602
+ }, {
3603
+ kind?: "Joined";
3604
+ room?: {
3605
+ id?: string;
3606
+ user_data?: Uint8Array<ArrayBufferLike>;
3607
+ customer?: string;
3608
+ peers?: {
3609
+ id?: number;
3610
+ user_id?: string;
3611
+ user_data?: Uint8Array<ArrayBufferLike>;
3612
+ medias?: {
3613
+ id?: number;
3614
+ paused?: boolean;
3615
+ properties?: {
3616
+ uid?: string;
3617
+ kind?: "audio";
3618
+ customType?: string;
3619
+ } | {
3620
+ codec?: string;
3621
+ uid?: string;
3622
+ kind?: "video";
3623
+ customType?: string;
3624
+ };
3625
+ }[];
3626
+ }[];
3627
+ };
3628
+ media_ids?: number[];
3629
+ own_peer_id?: number;
3630
+ }>, z.ZodObject<{
3631
+ kind: z.ZodLiteral<"Left">;
3632
+ reason: z.ZodEnum<["RoomClosing", "ServerClosing", "PeerKicked"]>;
3633
+ }, "strip", z.ZodTypeAny, {
3634
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
3635
+ kind?: "Left";
3636
+ }, {
3637
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
3638
+ kind?: "Left";
3639
+ }>, z.ZodObject<{
3640
+ kind: z.ZodLiteral<"UserDataChanged">;
3641
+ user_data: z.ZodOptional<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>>;
3642
+ }, "strip", z.ZodTypeAny, {
3643
+ kind?: "UserDataChanged";
3644
+ user_data?: Uint8Array<ArrayBufferLike>;
3645
+ }, {
3646
+ kind?: "UserDataChanged";
3647
+ user_data?: Uint8Array<ArrayBufferLike>;
3648
+ }>, z.ZodObject<{
3649
+ kind: z.ZodLiteral<"PeerJoined">;
3650
+ peer: z.ZodObject<{
3651
+ id: z.ZodNumber;
3652
+ user_id: z.ZodString;
3653
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
3654
+ medias: z.ZodArray<z.ZodObject<{
3655
+ id: z.ZodNumber;
3656
+ properties: z.ZodUnion<[z.ZodObject<{
3657
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
3658
+ uid: z.ZodOptional<z.ZodString>;
3659
+ customType: z.ZodOptional<z.ZodString>;
3660
+ }, "strip", z.ZodTypeAny, {
3661
+ uid?: string;
3662
+ kind?: "audio";
3663
+ customType?: string;
3664
+ }, {
3665
+ uid?: string;
3666
+ kind?: "audio";
3667
+ customType?: string;
3668
+ }>, z.ZodObject<{
3669
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
3670
+ codec: z.ZodOptional<z.ZodString>;
3671
+ uid: z.ZodOptional<z.ZodString>;
3672
+ customType: z.ZodOptional<z.ZodString>;
3673
+ }, "strip", z.ZodTypeAny, {
3674
+ codec?: string;
3675
+ uid?: string;
3676
+ kind?: "video";
3677
+ customType?: string;
3678
+ }, {
3679
+ codec?: string;
3680
+ uid?: string;
3681
+ kind?: "video";
3682
+ customType?: string;
3683
+ }>]>;
3684
+ paused: z.ZodBoolean;
3685
+ }, "strip", z.ZodTypeAny, {
3686
+ id?: number;
3687
+ paused?: boolean;
3688
+ properties?: {
3689
+ uid?: string;
3690
+ kind?: "audio";
3691
+ customType?: string;
3692
+ } | {
3693
+ codec?: string;
3694
+ uid?: string;
3695
+ kind?: "video";
3696
+ customType?: string;
3697
+ };
3698
+ }, {
3699
+ id?: number;
3700
+ paused?: boolean;
3701
+ properties?: {
3702
+ uid?: string;
3703
+ kind?: "audio";
3704
+ customType?: string;
3705
+ } | {
3706
+ codec?: string;
3707
+ uid?: string;
3708
+ kind?: "video";
3709
+ customType?: string;
3710
+ };
3711
+ }>, "many">;
3712
+ }, "strip", z.ZodTypeAny, {
3713
+ id?: number;
3714
+ user_id?: string;
3715
+ user_data?: Uint8Array<ArrayBufferLike>;
3716
+ medias?: {
3717
+ id?: number;
3718
+ paused?: boolean;
3719
+ properties?: {
3720
+ uid?: string;
3721
+ kind?: "audio";
3722
+ customType?: string;
3723
+ } | {
3724
+ codec?: string;
3725
+ uid?: string;
3726
+ kind?: "video";
3727
+ customType?: string;
3728
+ };
3729
+ }[];
3730
+ }, {
3731
+ id?: number;
3732
+ user_id?: string;
3733
+ user_data?: Uint8Array<ArrayBufferLike>;
3734
+ medias?: {
3735
+ id?: number;
3736
+ paused?: boolean;
3737
+ properties?: {
3738
+ uid?: string;
3739
+ kind?: "audio";
3740
+ customType?: string;
3741
+ } | {
3742
+ codec?: string;
3743
+ uid?: string;
3744
+ kind?: "video";
3745
+ customType?: string;
3746
+ };
3747
+ }[];
3748
+ }>;
3749
+ }, "strip", z.ZodTypeAny, {
3750
+ kind?: "PeerJoined";
3751
+ peer?: {
3752
+ id?: number;
3753
+ user_id?: string;
3754
+ user_data?: Uint8Array<ArrayBufferLike>;
3755
+ medias?: {
3756
+ id?: number;
3757
+ paused?: boolean;
3758
+ properties?: {
3759
+ uid?: string;
3760
+ kind?: "audio";
3761
+ customType?: string;
3762
+ } | {
3763
+ codec?: string;
3764
+ uid?: string;
3765
+ kind?: "video";
3766
+ customType?: string;
3767
+ };
3768
+ }[];
3769
+ };
3770
+ }, {
3771
+ kind?: "PeerJoined";
3772
+ peer?: {
3773
+ id?: number;
3774
+ user_id?: string;
3775
+ user_data?: Uint8Array<ArrayBufferLike>;
3776
+ medias?: {
3777
+ id?: number;
3778
+ paused?: boolean;
3779
+ properties?: {
3780
+ uid?: string;
3781
+ kind?: "audio";
3782
+ customType?: string;
3783
+ } | {
3784
+ codec?: string;
3785
+ uid?: string;
3786
+ kind?: "video";
3787
+ customType?: string;
3788
+ };
3789
+ }[];
3790
+ };
3791
+ }>, z.ZodObject<{
3792
+ kind: z.ZodLiteral<"PeerLeft">;
3793
+ peer_id: z.ZodNumber;
3794
+ }, "strip", z.ZodTypeAny, {
3795
+ kind?: "PeerLeft";
3796
+ peer_id?: number;
3797
+ }, {
3798
+ kind?: "PeerLeft";
3799
+ peer_id?: number;
3800
+ }>]>, "many">;
3801
+ }, "strip", z.ZodTypeAny, {
3802
+ updates?: ({
3803
+ kind?: "Joined";
3804
+ room?: {
3805
+ id?: string;
3806
+ user_data?: Uint8Array<ArrayBufferLike>;
3807
+ customer?: string;
3808
+ peers?: {
3809
+ id?: number;
3810
+ user_id?: string;
3811
+ user_data?: Uint8Array<ArrayBufferLike>;
3812
+ medias?: {
3813
+ id?: number;
3814
+ paused?: boolean;
3815
+ properties?: {
3816
+ uid?: string;
3817
+ kind?: "audio";
3818
+ customType?: string;
3819
+ } | {
3820
+ codec?: string;
3821
+ uid?: string;
3822
+ kind?: "video";
3823
+ customType?: string;
3824
+ };
3825
+ }[];
3826
+ }[];
3827
+ };
3828
+ media_ids?: number[];
3829
+ own_peer_id?: number;
3830
+ } | {
3831
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
3832
+ kind?: "Left";
3833
+ } | {
3834
+ kind?: "UserDataChanged";
3835
+ user_data?: Uint8Array<ArrayBufferLike>;
3836
+ } | {
3837
+ kind?: "PeerJoined";
3838
+ peer?: {
3839
+ id?: number;
3840
+ user_id?: string;
3841
+ user_data?: Uint8Array<ArrayBufferLike>;
3842
+ medias?: {
3843
+ id?: number;
3844
+ paused?: boolean;
3845
+ properties?: {
3846
+ uid?: string;
3847
+ kind?: "audio";
3848
+ customType?: string;
3849
+ } | {
3850
+ codec?: string;
3851
+ uid?: string;
3852
+ kind?: "video";
3853
+ customType?: string;
3854
+ };
3855
+ }[];
3856
+ };
3857
+ } | {
3858
+ kind?: "PeerLeft";
3859
+ peer_id?: number;
3860
+ })[];
3861
+ }, {
3862
+ updates?: ({
3863
+ kind?: "Joined";
3864
+ room?: {
3865
+ id?: string;
3866
+ user_data?: Uint8Array<ArrayBufferLike>;
3867
+ customer?: string;
3868
+ peers?: {
3869
+ id?: number;
3870
+ user_id?: string;
3871
+ user_data?: Uint8Array<ArrayBufferLike>;
3872
+ medias?: {
3873
+ id?: number;
3874
+ paused?: boolean;
3875
+ properties?: {
3876
+ uid?: string;
3877
+ kind?: "audio";
3878
+ customType?: string;
3879
+ } | {
3880
+ codec?: string;
3881
+ uid?: string;
3882
+ kind?: "video";
3883
+ customType?: string;
3884
+ };
3885
+ }[];
3886
+ }[];
3887
+ };
3888
+ media_ids?: number[];
3889
+ own_peer_id?: number;
3890
+ } | {
3891
+ reason?: "RoomClosing" | "ServerClosing" | "PeerKicked";
3892
+ kind?: "Left";
3893
+ } | {
3894
+ kind?: "UserDataChanged";
3895
+ user_data?: Uint8Array<ArrayBufferLike>;
3896
+ } | {
3897
+ kind?: "PeerJoined";
3898
+ peer?: {
3899
+ id?: number;
3900
+ user_id?: string;
3901
+ user_data?: Uint8Array<ArrayBufferLike>;
3902
+ medias?: {
3903
+ id?: number;
3904
+ paused?: boolean;
3905
+ properties?: {
3906
+ uid?: string;
3907
+ kind?: "audio";
3908
+ customType?: string;
3909
+ } | {
3910
+ codec?: string;
3911
+ uid?: string;
3912
+ kind?: "video";
3913
+ customType?: string;
3914
+ };
3915
+ }[];
3916
+ };
3917
+ } | {
3918
+ kind?: "PeerLeft";
3919
+ peer_id?: number;
3920
+ })[];
3921
+ }>;
3922
+ PeerUpdated: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3923
+ kind: z.ZodLiteral<"UserDataChanged">;
3924
+ peer_id: z.ZodNumber;
3925
+ user_data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
3926
+ }, "strip", z.ZodTypeAny, {
3927
+ kind?: "UserDataChanged";
3928
+ user_data?: Uint8Array<ArrayBufferLike>;
3929
+ peer_id?: number;
3930
+ }, {
3931
+ kind?: "UserDataChanged";
3932
+ user_data?: Uint8Array<ArrayBufferLike>;
3933
+ peer_id?: number;
3934
+ }>, z.ZodObject<{
3935
+ kind: z.ZodLiteral<"MediaStarted">;
3936
+ peer_id: z.ZodNumber;
3937
+ media: z.ZodObject<{
3938
+ id: z.ZodNumber;
3939
+ properties: z.ZodUnion<[z.ZodObject<{
3940
+ kind: z.ZodOptional<z.ZodLiteral<"audio">>;
3941
+ uid: z.ZodOptional<z.ZodString>;
3942
+ customType: z.ZodOptional<z.ZodString>;
3943
+ }, "strip", z.ZodTypeAny, {
3944
+ uid?: string;
3945
+ kind?: "audio";
3946
+ customType?: string;
3947
+ }, {
3948
+ uid?: string;
3949
+ kind?: "audio";
3950
+ customType?: string;
3951
+ }>, z.ZodObject<{
3952
+ kind: z.ZodOptional<z.ZodLiteral<"video">>;
3953
+ codec: z.ZodOptional<z.ZodString>;
3954
+ uid: z.ZodOptional<z.ZodString>;
3955
+ customType: z.ZodOptional<z.ZodString>;
3956
+ }, "strip", z.ZodTypeAny, {
3957
+ codec?: string;
3958
+ uid?: string;
3959
+ kind?: "video";
3960
+ customType?: string;
3961
+ }, {
3962
+ codec?: string;
3963
+ uid?: string;
3964
+ kind?: "video";
3965
+ customType?: string;
3966
+ }>]>;
3967
+ paused: z.ZodBoolean;
3968
+ }, "strip", z.ZodTypeAny, {
3969
+ id?: number;
3970
+ paused?: boolean;
3971
+ properties?: {
3972
+ uid?: string;
3973
+ kind?: "audio";
3974
+ customType?: string;
3975
+ } | {
3976
+ codec?: string;
3977
+ uid?: string;
3978
+ kind?: "video";
3979
+ customType?: string;
3980
+ };
3981
+ }, {
3982
+ id?: number;
3983
+ paused?: boolean;
3984
+ properties?: {
3985
+ uid?: string;
3986
+ kind?: "audio";
3987
+ customType?: string;
3988
+ } | {
3989
+ codec?: string;
3990
+ uid?: string;
3991
+ kind?: "video";
3992
+ customType?: string;
3993
+ };
3994
+ }>;
3995
+ }, "strip", z.ZodTypeAny, {
3996
+ media?: {
3997
+ id?: number;
3998
+ paused?: boolean;
3999
+ properties?: {
4000
+ uid?: string;
4001
+ kind?: "audio";
4002
+ customType?: string;
4003
+ } | {
4004
+ codec?: string;
4005
+ uid?: string;
4006
+ kind?: "video";
4007
+ customType?: string;
4008
+ };
4009
+ };
4010
+ kind?: "MediaStarted";
4011
+ peer_id?: number;
4012
+ }, {
4013
+ media?: {
4014
+ id?: number;
4015
+ paused?: boolean;
4016
+ properties?: {
4017
+ uid?: string;
4018
+ kind?: "audio";
4019
+ customType?: string;
4020
+ } | {
4021
+ codec?: string;
4022
+ uid?: string;
4023
+ kind?: "video";
4024
+ customType?: string;
4025
+ };
4026
+ };
4027
+ kind?: "MediaStarted";
4028
+ peer_id?: number;
4029
+ }>, z.ZodObject<{
4030
+ kind: z.ZodLiteral<"MediaStopped">;
4031
+ peer_id: z.ZodNumber;
4032
+ media_id: z.ZodNumber;
4033
+ }, "strip", z.ZodTypeAny, {
4034
+ kind?: "MediaStopped";
4035
+ peer_id?: number;
4036
+ media_id?: number;
4037
+ }, {
4038
+ kind?: "MediaStopped";
4039
+ peer_id?: number;
4040
+ media_id?: number;
4041
+ }>]>;
4042
+ MessageReceived: z.ZodObject<{
4043
+ sender_peer_id: z.ZodNumber;
4044
+ message: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
4045
+ }, "strip", z.ZodTypeAny, {
4046
+ message?: Uint8Array<ArrayBufferLike>;
4047
+ sender_peer_id?: number;
4048
+ }, {
4049
+ message?: Uint8Array<ArrayBufferLike>;
4050
+ sender_peer_id?: number;
4051
+ }>;
4052
+ };
4053
+ export type RoomNotifications = typeof RoomNotificationsRpc;
4054
+ }
4055
+ declare module "src/utility/result" {
4056
+ export function assert(condition: unknown, message: string): asserts condition;
4057
+ export function fail(message: string): never;
4058
+ export type Failure = {
4059
+ type: "Failure";
4060
+ reason: string;
4061
+ };
4062
+ export type Success<T> = {
4063
+ type: "Success";
4064
+ value: T;
4065
+ };
4066
+ export type Result<T> = Success<T> | Failure;
4067
+ export function success<T>(value: T): Success<T>;
4068
+ export function success(value: void): Success<void>;
4069
+ export function failure(reason: string): Failure;
4070
+ export function unwrap<T>(result: Result<T>): T;
4071
+ export function unwrapOr<T>(result: Result<T>, fallback: T): T;
4072
+ export type Accept<T> = (result: T) => void;
4073
+ export type Reject = (reason: Error) => void;
4074
+ }
4075
+ declare module "src/utility/base64" {
4076
+ import { type Result } from "src/utility/result";
4077
+ export function fromBase64(base64: string): Result<string>;
4078
+ export function fromBase64Url(base64uri: string): Result<string>;
4079
+ }
4080
+ declare module "src/utility/bytearray" {
4081
+ import type { ByteArray, Json } from "src/schema/serialization";
4082
+ import { type Result } from "src/utility/result";
4083
+ export function toBytes(value: Json): Result<ByteArray>;
4084
+ export function fromBytes(bytes: ByteArray): Result<Json>;
4085
+ }
4086
+ declare module "src/utility/codec" {
4087
+ import { type Result } from "src/utility/result";
4088
+ const validCodecs: readonly ["VP8", "VP9", "AV1", "H264"];
4089
+ export type Codec = (typeof validCodecs)[number];
4090
+ export class VideoCodec {
4091
+ readonly codec: Codec;
4092
+ readonly channels = 0;
4093
+ readonly clockRate = 90000;
4094
+ constructor(codec: Codec);
4095
+ isValid(): boolean;
4096
+ isSupported(): RTCRtpCodec | null;
4097
+ getPayloadType(): Result<number>;
4098
+ getMimeType(): Result<string>;
4099
+ getSdpFmtpLine(): Result<string>;
4100
+ }
4101
+ }
4102
+ declare module "src/utility/iterable" {
4103
+ export function find<T>(entries: Iterable<T>, predicate: (entry: T) => boolean): T | undefined;
4104
+ }
4105
+ declare module "src/utility/environment" {
4106
+ export function isAudioCapable(): boolean;
4107
+ export function isSharedArrayBufferCapable(): boolean;
4108
+ export function isBlinkBrowser(): boolean;
4109
+ export function isElectronBrowser(): boolean;
4110
+ export function isFirefoxBrowser(): boolean;
4111
+ export function isSafariBrowser(): boolean;
4112
+ }
4113
+ declare module "src/utility/json" {
4114
+ import type { Json } from "src/schema/serialization";
4115
+ export function toRaw<T extends Json>(value: T): Json;
4116
+ }
4117
+ declare module "src/utility/selector" {
4118
+ export class Selector<T extends Array<() => PromiseLike<U>>, U> {
4119
+ private readonly _Generators;
4120
+ private readonly _Futures;
4121
+ constructor(_Generators: T);
4122
+ next(): Promise<Awaited<ReturnType<T[number]>>>;
4123
+ static addIndex<T>(generator: () => PromiseLike<T>, index: number): Promise<[T, number]>;
4124
+ }
4125
+ }
4126
+ declare module "src/utility/sleep" {
4127
+ export function sleep(ms: number, value: void): Promise<void>;
4128
+ export function sleep<T extends string>(ms: number, value: T): Promise<T>;
4129
+ export function abortableSleep(ms: number, signal: AbortSignal): Promise<void | "aborted">;
4130
+ export function nextTick(): Promise<void>;
4131
+ }
4132
+ declare module "src/utility/strand" {
4133
+ export class Strand<T extends unknown[] = []> {
4134
+ private readonly _Tasks;
4135
+ private _Running;
4136
+ private _Values;
4137
+ constructor(...values: T);
4138
+ enqueue<U>(task: (...values: T) => Promise<U>): Promise<U>;
4139
+ private execute;
4140
+ }
4141
+ }
4142
+ declare module "src/utility/url" {
4143
+ import { type Result } from "src/utility/result";
4144
+ export function normalizeUrl(url: string): Result<URL>;
4145
+ export function extendUrl(base: URL, path: string): Result<URL>;
4146
+ }
4147
+ declare module "src/utility/uuid" {
4148
+ export function generateUUID(): string;
4149
+ export function validateUUID(uuid: string): boolean;
4150
+ }
4151
+ declare module "src/utility/validation" {
4152
+ import type { Failure, Result, Success } from "src/utility/result";
4153
+ export function isProperty<T extends object>(object: T, name: string): name is Extract<keyof T, string>;
4154
+ export function isFunction(value: unknown): value is (...args: [unknown]) => unknown;
4155
+ export function isNull(value: unknown): boolean;
4156
+ export function isNumber(value: unknown): value is number;
4157
+ export function isObject(value: unknown): value is object;
4158
+ export function isString(value: unknown): value is string;
4159
+ export function isUndefined(value: unknown): value is undefined;
4160
+ export function isFailure<T>(result: Result<T>): result is Failure;
4161
+ export function isSuccess<T>(result: Result<T>): result is Success<T>;
4162
+ }
4163
+ declare module "src/utility/log" {
4164
+ import { type Result } from "src/utility/result";
4165
+ export enum LogVerbosity {
4166
+ NONE = 0,
4167
+ ERROR = 1,
4168
+ WARN = 2,
4169
+ INFO = 3,
4170
+ DEBUG = 4
4171
+ }
4172
+ export type LogLevel = (typeof LogVerbosity)[LogLevelName];
4173
+ export type LogLevelName = Exclude<keyof typeof LogVerbosity, number>;
4174
+ export const LogLevels: LogLevel[];
4175
+ export const LogLevelNames: LogLevelName[];
4176
+ export const LogSymbols: {
4177
+ [Level in LogLevel]: string;
4178
+ };
4179
+ export const LogFunctions: {
4180
+ [Level in LogLevel]: (...data: unknown[]) => void;
4181
+ };
4182
+ export function getLevelByName(name: LogLevelName): Result<LogLevel>;
4183
+ export function getLevelName(level: LogLevel): Result<LogLevelName>;
4184
+ export interface LoggerOptions {
4185
+ handlers?: LogHandler[];
4186
+ }
4187
+ export function getLogger(name?: string): Logger;
4188
+ export function error<T>(msg: () => T, ...args: unknown[]): T | undefined;
4189
+ export function error<T>(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T;
4190
+ export function warn<T>(msg: () => T, ...args: unknown[]): T | undefined;
4191
+ export function warn<T>(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T;
4192
+ export function info<T>(msg: () => T, ...args: unknown[]): T | undefined;
4193
+ export function info<T>(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T;
4194
+ export function debug<T>(msg: () => T, ...args: unknown[]): T | undefined;
4195
+ export function debug<T>(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T;
4196
+ export class Logger {
4197
+ readonly name: string;
4198
+ private _Level;
4199
+ private _Handlers;
4200
+ constructor(level: LogLevel | LogLevelName, name?: string, options?: LoggerOptions);
4201
+ get level(): LogLevel;
4202
+ set level(value: LogLevel);
4203
+ get levelName(): LogLevelName;
4204
+ set levelName(value: LogLevelName);
4205
+ get handlers(): LogHandler[];
4206
+ addHandler(handler: LogHandler): void;
4207
+ removeHandler(handler: LogHandler): void;
4208
+ log<T>(level: LogLevel, msg: (T extends GenericFunction ? never : T) | (() => T), ...args: unknown[]): T | undefined;
4209
+ error<T>(msg: () => T, ...args: unknown[]): T | undefined;
4210
+ error<T>(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T;
4211
+ warn<T>(msg: () => T, ...args: unknown[]): T | undefined;
4212
+ warn<T>(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T;
4213
+ info<T>(msg: () => T, ...args: unknown[]): T | undefined;
4214
+ info<T>(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T;
4215
+ debug<T>(msg: () => T, ...args: unknown[]): T | undefined;
4216
+ debug<T>(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T;
4217
+ private asString;
4218
+ }
4219
+ type GenericFunction = (...args: unknown[]) => unknown;
4220
+ type FormatterFunction = (record: LogRecord) => string;
4221
+ export interface LogRecord {
4222
+ readonly date: Date;
4223
+ readonly level: LogLevel;
4224
+ readonly levelName: LogLevelName;
4225
+ readonly logger: string;
4226
+ readonly message: string;
4227
+ readonly args: unknown[];
4228
+ }
4229
+ export const DEFAULT_FORMATTER: FormatterFunction;
4230
+ export const PRETTY_FORMATTER: FormatterFunction;
4231
+ export class LogHandler {
4232
+ private _Level;
4233
+ private _FormatterFn;
4234
+ constructor(level: LogLevel | LogLevelName, formatter?: FormatterFunction);
4235
+ get level(): LogLevel;
4236
+ set level(value: LogLevel);
4237
+ get levelName(): LogLevelName;
4238
+ set levelName(value: LogLevelName);
4239
+ handle(record: LogRecord): void;
4240
+ log(formattedString: string, record: LogRecord): void;
4241
+ }
4242
+ }
4243
+ declare module "src/plugin/api" {
4244
+ export const MinDBFS = -758.596;
4245
+ export namespace Backend {
4246
+ type UID = string;
4247
+ type OnStatusChanged = (status: "started" | "stopped") => void;
4248
+ type OnEvent = (method: string, properties: unknown) => void;
4249
+ type Version = "5";
4250
+ enum Transport {
4251
+ H3 = "h3",
4252
+ WebRTC = "webrtc"
4253
+ }
4254
+ interface Plugin {
4255
+ readonly version: Version;
4256
+ readonly playbackVolume: PlaybackVolume;
4257
+ readonly supportedTransports: (Transport.WebRTC | Transport.H3)[];
4258
+ joinRoom(parameters: JoinRoomParameters): Room;
4259
+ createAudioPlayback(parameters: CreateAudioPlaybackParameters): Promise<AudioPlayback>;
4260
+ createAudioCapture(parameters: CreateAudioCaptureParameters): Promise<AudioCapture>;
4261
+ createVideoCapture(ms: MediaStream, options?: VideoInputOptions): Promise<VideoCapture>;
4262
+ createVideoPlayback(parameters: CreateVideoPlaybackParameters): Promise<VideoPlayback>;
4263
+ enumerateDevices(): Promise<Array<Device>>;
4264
+ setOutputVolume(volume: PlaybackVolume): void;
4265
+ setOutputDevice(device: DeviceParameters): Promise<void>;
4266
+ close(): void;
4267
+ }
4268
+ interface Device {
4269
+ readonly type: "AudioPlayback" | "AudioCapture";
4270
+ readonly name: string;
4271
+ readonly id: string;
4272
+ readonly isDefault: boolean;
4273
+ }
4274
+ interface DeviceParameters {
4275
+ readonly device?: Device;
4276
+ onStatusChanged?: OnStatusChanged;
4277
+ }
4278
+ interface Activity {
4279
+ isSilent: boolean;
4280
+ rmsDBFS: number;
4281
+ }
4282
+ interface JitterStats {
4283
+ packetsSeen: number;
4284
+ packetsProcessed: number;
4285
+ packetsTooEarly: number;
4286
+ packetsTooLate: number;
4287
+ packetsDropped: number;
4288
+ packetsInvalid: number;
4289
+ packetsRepeated: number;
4290
+ packetsLost: number;
4291
+ }
4292
+ interface ConnectionStats {
4293
+ bytesSent: number;
4294
+ bytesReceived: number;
4295
+ packetsSent: number;
4296
+ packetsReceived: number;
4297
+ rtt: number;
4298
+ }
4299
+ interface JoinRoomParameters {
4300
+ readonly gateway: string | undefined;
4301
+ readonly token: string;
4302
+ readonly roomId?: string;
4303
+ readonly userData?: Uint8Array;
4304
+ readonly position?: [number, number, number];
4305
+ readonly cipher?: SetupCipherSettings;
4306
+ readonly onEvent: OnEvent;
4307
+ readonly transport?: Transport;
4308
+ }
4309
+ interface Room {
4310
+ readonly token: string;
4311
+ readonly cipher: Cipher | undefined;
4312
+ connectionStats: ConnectionStats;
4313
+ request(method: string, properties: unknown): Promise<unknown>;
4314
+ link(media: Media): Promise<void>;
4315
+ unlink(media: Media): void;
4316
+ close(): void;
4317
+ }
4318
+ interface Media {
4319
+ readonly customType?: string;
4320
+ close(): void;
4321
+ }
4322
+ interface AudioMedia extends Media {
4323
+ readonly activity: Activity;
4324
+ }
4325
+ interface CreateAudioPlaybackParameters {
4326
+ readonly uid: UID;
4327
+ readonly volume?: PlaybackVolume;
4328
+ readonly customType?: string;
4329
+ }
4330
+ interface CreateVideoPlaybackParameters {
4331
+ readonly uid: UID;
4332
+ readonly customType?: string;
4333
+ }
4334
+ interface AudioPlayback extends AudioMedia {
4335
+ readonly volume: PlaybackVolume;
4336
+ readonly uid: UID;
4337
+ jitterStats: JitterStats;
4338
+ setVolume(value: PlaybackVolume): Promise<void>;
4339
+ }
4340
+ interface CreateAudioCaptureParameters extends Partial<DeviceParameters> {
4341
+ readonly volume?: CaptureVolume;
4342
+ readonly vad?: VadConfig;
4343
+ readonly apm?: ApmConfig;
4344
+ }
4345
+ interface AudioCapture extends AudioMedia {
4346
+ readonly volume: CaptureVolume;
4347
+ readonly vad?: VadConfig;
4348
+ readonly apm?: ApmConfig;
4349
+ setVad(config: VadConfig): void;
4350
+ setApm(config: ApmConfig): Promise<void>;
4351
+ setDevice(device: DeviceParameters): Promise<void>;
4352
+ setVolume(value: CaptureVolume): Promise<void>;
4353
+ }
4354
+ interface VideoCapture extends Media {
4355
+ mediaStream?: MediaStream;
4356
+ setDevice(ms: MediaStream): Promise<void>;
4357
+ }
4358
+ interface VideoPlayback extends Media {
4359
+ readonly mediaStream?: MediaStream;
4360
+ readonly uid: UID;
4361
+ }
4362
+ type PlaybackVolume = [number, number];
4363
+ type CaptureVolume = "muted" | number;
4364
+ interface VadConfig {
4365
+ voiceActivity?: SensitivityRange;
4366
+ volumeGate?: SensitivityRange;
4367
+ }
4368
+ interface SensitivityRange {
4369
+ attackThreshold: number;
4370
+ releaseThreshold: number;
4371
+ }
4372
+ interface ApmConfig {
4373
+ echoCanceller: boolean;
4374
+ highPassFilter: boolean;
4375
+ preAmplifier: boolean;
4376
+ captureLevelAdjustment: boolean;
4377
+ noiseSuppression: "None" | "Low" | "Moderate" | "High" | "VeryHigh";
4378
+ transientSuppressor: boolean;
4379
+ gainController: boolean;
4380
+ }
4381
+ type SetupCipherSettings = {
4382
+ type: "OdinCrypto";
4383
+ } & OdinCryptoSettings;
4384
+ type CipherSettings = OdinCryptoSettings;
4385
+ interface OdinCryptoSettings {
4386
+ password: string | null;
4387
+ }
4388
+ enum PeerCipherStatus {
4389
+ InvalidPassword = -1,
4390
+ Unknown = 0,
4391
+ Unencrypted = 1,
4392
+ Encrypted = 2
4393
+ }
4394
+ interface Cipher {
4395
+ configure(settings: CipherSettings): void;
4396
+ getPeerStatus(peerId: number): PeerCipherStatus;
4397
+ }
4398
+ type VideoInputOptions = {
4399
+ codec?: "H264" | "VP8" | "VP9";
4400
+ customType?: string;
4401
+ };
4402
+ }
4403
+ }
4404
+ declare module "src/mod" {
4405
+ export * as zod from "zod";
4406
+ export * from "src/schema/serialization";
4407
+ export * from "src/schema/token";
4408
+ export * from "src/schema/room";
4409
+ export * from "src/schema/peer";
4410
+ export * from "src/schema/media";
4411
+ export * from "src/schema/message";
4412
+ export * from "src/schema/webrtc";
4413
+ export * from "src/schema/channels";
4414
+ export * from "src/rpc/commands";
4415
+ export * from "src/rpc/notifications";
4416
+ export * from "src/utility/base64";
4417
+ export * from "src/utility/bytearray";
4418
+ export * from "src/utility/codec";
4419
+ export * from "src/utility/iterable";
4420
+ export * from "src/utility/environment";
4421
+ export * from "src/utility/json";
4422
+ export * from "src/utility/result";
4423
+ export * from "src/utility/selector";
4424
+ export * from "src/utility/sleep";
4425
+ export * from "src/utility/strand";
4426
+ export * from "src/utility/url";
4427
+ export * from "src/utility/uuid";
4428
+ export * from "src/utility/validation";
4429
+ export * from "src/utility/log";
4430
+ export * from "src/plugin/api";
4431
+ }