@honeybbq/teamspeak 1.0.0-beta.21 → 1.0.0-beta.22

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 (127) hide show
  1. package/README.md +2 -1
  2. package/dist/client/crypto/identity.d.ts +15 -4
  3. package/dist/client/crypto/identity.d.ts.map +1 -1
  4. package/dist/client/crypto/identity.js +19 -1
  5. package/dist/client/crypto/identity.js.map +1 -1
  6. package/dist/client/crypto/index.d.ts +1 -1
  7. package/dist/client/crypto/index.d.ts.map +1 -1
  8. package/dist/client/crypto/index.js +1 -0
  9. package/dist/client/crypto/index.js.map +1 -1
  10. package/dist/client/discovery/resolver.d.ts.map +1 -1
  11. package/dist/client/discovery/resolver.js +9 -6
  12. package/dist/client/discovery/resolver.js.map +1 -1
  13. package/dist/client/handshake/license.js +1 -0
  14. package/dist/client/handshake/license.js.map +1 -1
  15. package/dist/client/index.d.ts +6 -5
  16. package/dist/client/index.d.ts.map +1 -1
  17. package/dist/client/index.js +4 -2
  18. package/dist/client/index.js.map +1 -1
  19. package/dist/client/trace.d.ts +4 -1
  20. package/dist/client/trace.d.ts.map +1 -1
  21. package/dist/client/transfer.d.ts +10 -1
  22. package/dist/client/transfer.d.ts.map +1 -1
  23. package/dist/client/transfer.js +10 -0
  24. package/dist/client/transfer.js.map +1 -1
  25. package/dist/client/transport/handler.d.ts.map +1 -1
  26. package/dist/client/transport/handler.js +3 -3
  27. package/dist/client/transport/handler.js.map +1 -1
  28. package/dist/client/transport/packet.d.ts +5 -0
  29. package/dist/client/transport/packet.d.ts.map +1 -1
  30. package/dist/client/transport/packet.js +9 -1
  31. package/dist/client/transport/packet.js.map +1 -1
  32. package/dist/client/types.d.ts +28 -1
  33. package/dist/client/types.d.ts.map +1 -1
  34. package/dist/client/types.js +21 -0
  35. package/dist/client/types.js.map +1 -1
  36. package/dist/client/view.d.ts +24 -8
  37. package/dist/client/view.d.ts.map +1 -1
  38. package/dist/client/view.js +24 -1
  39. package/dist/client/view.js.map +1 -1
  40. package/dist/core/api/channels.d.ts +3 -3
  41. package/dist/core/api/channels.d.ts.map +1 -1
  42. package/dist/core/api/clients.d.ts +13 -1
  43. package/dist/core/api/clients.d.ts.map +1 -1
  44. package/dist/core/api/clients.js +12 -0
  45. package/dist/core/api/clients.js.map +1 -1
  46. package/dist/core/api/command.d.ts +11 -3
  47. package/dist/core/api/command.d.ts.map +1 -1
  48. package/dist/core/api/command.js +8 -2
  49. package/dist/core/api/command.js.map +1 -1
  50. package/dist/core/api/groups.d.ts +2 -1
  51. package/dist/core/api/groups.d.ts.map +1 -1
  52. package/dist/core/api/groups.js.map +1 -1
  53. package/dist/core/api/instance.d.ts +5 -3
  54. package/dist/core/api/instance.d.ts.map +1 -1
  55. package/dist/core/api/instance.js.map +1 -1
  56. package/dist/core/api/server.d.ts +40 -10
  57. package/dist/core/api/server.d.ts.map +1 -1
  58. package/dist/core/api/server.js +2 -2
  59. package/dist/core/api/server.js.map +1 -1
  60. package/dist/core/command-name.d.ts +6 -0
  61. package/dist/core/command-name.d.ts.map +1 -1
  62. package/dist/core/command-name.js +6 -0
  63. package/dist/core/command-name.js.map +1 -1
  64. package/dist/core/enums.d.ts +94 -4
  65. package/dist/core/enums.d.ts.map +1 -1
  66. package/dist/core/enums.js +91 -4
  67. package/dist/core/enums.js.map +1 -1
  68. package/dist/core/index.d.ts +3 -3
  69. package/dist/core/index.d.ts.map +1 -1
  70. package/dist/core/index.js +2 -2
  71. package/dist/core/index.js.map +1 -1
  72. package/dist/core/property-name.d.ts +3 -3
  73. package/dist/core/property-name.d.ts.map +1 -1
  74. package/dist/core/property-name.js +3 -3
  75. package/dist/core/property-name.js.map +1 -1
  76. package/dist/core/types.d.ts +14 -4
  77. package/dist/core/types.d.ts.map +1 -1
  78. package/dist/core/types.js +16 -4
  79. package/dist/core/types.js.map +1 -1
  80. package/dist/query/client.d.ts +55 -1
  81. package/dist/query/client.d.ts.map +1 -1
  82. package/dist/query/client.js +53 -0
  83. package/dist/query/client.js.map +1 -1
  84. package/dist/query/index.d.ts +2 -2
  85. package/dist/query/index.d.ts.map +1 -1
  86. package/dist/query/index.js +1 -1
  87. package/dist/query/index.js.map +1 -1
  88. package/dist/query/options.d.ts +21 -1
  89. package/dist/query/options.d.ts.map +1 -1
  90. package/dist/query/options.js +34 -5
  91. package/dist/query/options.js.map +1 -1
  92. package/dist/stream/index.d.ts +2 -1
  93. package/dist/stream/index.d.ts.map +1 -1
  94. package/dist/stream/index.js +1 -0
  95. package/dist/stream/index.js.map +1 -1
  96. package/dist/stream/types.d.ts +243 -25
  97. package/dist/stream/types.d.ts.map +1 -1
  98. package/dist/stream/types.js +235 -1
  99. package/dist/stream/types.js.map +1 -1
  100. package/package.json +12 -10
  101. package/src/client/crypto/identity.ts +16 -5
  102. package/src/client/crypto/index.ts +1 -1
  103. package/src/client/discovery/resolver.ts +9 -6
  104. package/src/client/handshake/license.ts +1 -0
  105. package/src/client/index.ts +10 -5
  106. package/src/client/trace.ts +4 -1
  107. package/src/client/transfer.ts +11 -1
  108. package/src/client/transport/handler.ts +3 -2
  109. package/src/client/transport/packet.ts +10 -1
  110. package/src/client/types.ts +30 -1
  111. package/src/client/view.ts +24 -9
  112. package/src/core/api/channels.ts +3 -3
  113. package/src/core/api/clients.ts +14 -1
  114. package/src/core/api/command.ts +16 -5
  115. package/src/core/api/groups.ts +2 -1
  116. package/src/core/api/instance.ts +5 -3
  117. package/src/core/api/server.ts +39 -10
  118. package/src/core/command-name.ts +6 -0
  119. package/src/core/enums.ts +111 -4
  120. package/src/core/index.ts +12 -2
  121. package/src/core/property-name.ts +3 -3
  122. package/src/core/types.ts +19 -8
  123. package/src/query/client.ts +68 -6
  124. package/src/query/index.ts +1 -2
  125. package/src/query/options.ts +26 -13
  126. package/src/stream/index.ts +14 -8
  127. package/src/stream/types.ts +321 -27
@@ -32,33 +32,39 @@ export {
32
32
  export type {
33
33
  IceCandidate,
34
34
  JoinRequest,
35
- JoinRequestCloseCause,
36
35
  JoinRequestClosed,
37
36
  JoinRequestEvents,
38
- JoinRequestState,
39
37
  Peer,
40
38
  PeerClosed,
41
- PeerCloseCause,
42
39
  PeerEvents,
43
40
  PublishedStream,
44
41
  PublishedStreamEvents,
45
42
  PublishOptions,
46
43
  RawSignal,
47
- StreamAccessibility,
48
44
  StreamEnded,
49
- StreamEndCause,
50
45
  StreamInfo,
51
46
  StreamsClient,
52
47
  StreamsEventMap,
53
48
  StreamsOptions,
54
- StreamSource,
55
49
  StreamStoppedEvent,
56
- StreamTransport,
57
50
  StreamView,
58
51
  StreamWarning,
59
- StreamWarningCode,
60
52
  StreamViewerEvent,
61
53
  ViewerIdentity,
62
54
  ViewerPeer,
63
55
  WatchOptions,
64
56
  } from "./types.js";
57
+ export {
58
+ JoinRequestCloseCause,
59
+ JoinRequestEventName,
60
+ JoinRequestState,
61
+ PeerCloseCause,
62
+ PeerEventName,
63
+ PublishedStreamEventName,
64
+ StreamAccessibility,
65
+ StreamEndCause,
66
+ StreamsEventName,
67
+ StreamSource,
68
+ StreamTransport,
69
+ StreamWarningCode,
70
+ } from "./types.js";
@@ -52,25 +52,72 @@ export interface StreamsClient extends CommandExecutor {
52
52
 
53
53
  // ---- Values -----------------------------------------------------------------
54
54
 
55
+ /** The values of the table below, before freezing. */
56
+ const streamSourceValues = {
57
+ /** `0` on the wire: no source named. */
58
+ None: "none",
59
+ /** `1` on the wire: a camera. */
60
+ Camera: "camera",
61
+ /** `2` on the wire: a screen. */
62
+ Screen: "screen",
63
+ /** `3` on the wire: a window. */
64
+ Window: "window",
65
+ /** `4` on the wire. */
66
+ Session: "session",
67
+ } as const;
55
68
  /**
56
69
  * What a stream shows. The server stores any number, so a stream from a client
57
70
  * that sends another value reports it as the number.
58
71
  */
59
- export type StreamSource = "none" | "camera" | "screen" | "window" | "session";
60
-
72
+ export const StreamSource: typeof streamSourceValues =
73
+ /* @__PURE__ */ Object.freeze(streamSourceValues);
74
+ /**
75
+ * One of {@link StreamSource}. May gain members in a minor release: a
76
+ * `switch` over it needs a default case.
77
+ */
78
+ export type StreamSource = (typeof StreamSource)[keyof typeof StreamSource];
79
+
80
+ /** The values of the table below, before freezing. */
81
+ const streamAccessibilityValues = {
82
+ /** `0` on the wire. */
83
+ None: "none",
84
+ /** `1` on the wire: anyone. What `publish` sends unless told otherwise. */
85
+ Public: "public",
86
+ /** `2` on the wire: the publisher's contacts. */
87
+ Contacts: "contacts",
88
+ /** `3` on the wire. */
89
+ Private: "private",
90
+ } as const;
61
91
  /**
62
92
  * Who a stream says may watch it. Only the publisher enforces it: the server
63
93
  * relays every request. A value outside the four is reported as the number.
64
94
  */
65
- export type StreamAccessibility = "none" | "public" | "contacts" | "private";
95
+ export const StreamAccessibility: typeof streamAccessibilityValues =
96
+ /* @__PURE__ */ Object.freeze(streamAccessibilityValues);
97
+ /**
98
+ * One of {@link StreamAccessibility}. May gain members in a minor release: a
99
+ * `switch` over it needs a default case.
100
+ */
101
+ export type StreamAccessibility = (typeof StreamAccessibility)[keyof typeof StreamAccessibility];
66
102
 
103
+ /** The values of the table below, before freezing. */
104
+ const streamTransportValues = {
105
+ /** From the publisher to each viewer directly. */
106
+ P2P: "p2p",
107
+ } as const;
67
108
  /**
68
109
  * How a stream's media travels: `"p2p"`, from the publisher to each viewer
69
110
  * directly, is the one mode this SDK publishes and watches. A server may
70
111
  * announce a stream in another mode; it is reported as the number, and
71
112
  * `watch` refuses it.
72
113
  */
73
- export type StreamTransport = "p2p";
114
+ export const StreamTransport: typeof streamTransportValues =
115
+ /* @__PURE__ */ Object.freeze(streamTransportValues);
116
+ /**
117
+ * One of {@link StreamTransport}. May gain members in a minor release: a
118
+ * `switch` over it needs a default case.
119
+ */
120
+ export type StreamTransport = (typeof StreamTransport)[keyof typeof StreamTransport];
74
121
 
75
122
  /**
76
123
  * A stream, as the server describes it.
@@ -140,12 +187,29 @@ export interface RawSignal {
140
187
 
141
188
  // ---- Peers ------------------------------------------------------------------
142
189
 
190
+ /** The values of the table below, before freezing. */
191
+ const peerCloseCauseValues = {
192
+ /** Its own `close()`. */
193
+ Closed: "closed",
194
+ /** The other end leaving. */
195
+ Left: "left",
196
+ /** The stream ending. */
197
+ Stopped: "stopped",
198
+ /** The client's connection ending. */
199
+ Disconnected: "disconnected",
200
+ /** `Streams.dispose()`. */
201
+ Disposed: "disposed",
202
+ } as const;
143
203
  /**
144
- * Why a peer closed: `"closed"` for its own `close()`, `"left"` for the other
145
- * end leaving, `"stopped"` for the stream ending, `"disconnected"` for the
146
- * client's connection ending and `"disposed"` for `Streams.dispose()`.
204
+ * Why a peer closed.
147
205
  */
148
- export type PeerCloseCause = "closed" | "left" | "stopped" | "disconnected" | "disposed";
206
+ export const PeerCloseCause: typeof peerCloseCauseValues =
207
+ /* @__PURE__ */ Object.freeze(peerCloseCauseValues);
208
+ /**
209
+ * One of {@link PeerCloseCause}. May gain members in a minor release: a
210
+ * `switch` over it needs a default case.
211
+ */
212
+ export type PeerCloseCause = (typeof PeerCloseCause)[keyof typeof PeerCloseCause];
149
213
 
150
214
  /**
151
215
  * A peer closing.
@@ -175,6 +239,44 @@ export interface PeerEvents {
175
239
  closed: PeerClosed;
176
240
  }
177
241
 
242
+ /** The values of the table below, before freezing. */
243
+ const peerEventNameValues = {
244
+ /** A renegotiation offer from the publisher: an SDP. */
245
+ Offer: "offer",
246
+ /** The viewer's SDP answer. */
247
+ Answer: "answer",
248
+ /** An ICE candidate from the other end. */
249
+ Candidate: "candidate",
250
+ /** A signalling message that is none of the above. */
251
+ Signal: "signal",
252
+ /** The peer closing. */
253
+ Closed: "closed",
254
+ } as const;
255
+ /**
256
+ * The names of the events `Peer.on()` takes, as constants.
257
+ * `on(PeerEventName.Offer, ...)` and `on("offer", ...)` are the same call,
258
+ * and both give the listener the same payload type.
259
+ */
260
+ export const PeerEventName: typeof peerEventNameValues =
261
+ /* @__PURE__ */ Object.freeze(peerEventNameValues);
262
+ /**
263
+ * One of {@link PeerEventName}, and so a key of {@link PeerEvents}.
264
+ * May gain members in a minor release: a `switch` over it needs a default
265
+ * case.
266
+ */
267
+ export type PeerEventName = (typeof PeerEventName)[keyof typeof PeerEventName];
268
+
269
+ // Each direction fails to compile when `PeerEvents` and `PeerEventName`
270
+ // drift: an event without a name, and a name that is not an event.
271
+ const peerEventNameCoverEvents: [Exclude<keyof PeerEvents, PeerEventName>] extends [never]
272
+ ? true
273
+ : never = true;
274
+ const peerEventNameNamesAreEvents: [Exclude<PeerEventName, keyof PeerEvents>] extends [never]
275
+ ? true
276
+ : never = true;
277
+ void peerEventNameCoverEvents;
278
+ void peerEventNameNamesAreEvents;
279
+
178
280
  /**
179
281
  * One end of a stream's signalling with one other client. SDP and ICE are
180
282
  * opaque strings here: any WebRTC stack can be plugged in.
@@ -244,18 +346,50 @@ export interface ViewerIdentity {
244
346
  readonly nickname: string | undefined;
245
347
  }
246
348
 
349
+ /** The values of the table below, before freezing. */
350
+ const joinRequestStateValues = {
351
+ /** Not yet accepted or denied. */
352
+ Pending: "pending",
353
+ /** Accepted. */
354
+ Accepted: "accepted",
355
+ /** Denied. */
356
+ Denied: "denied",
357
+ /** The answer did not reach the server. */
358
+ Failed: "failed",
359
+ /** The viewer left first. */
360
+ Withdrawn: "withdrawn",
361
+ /** The stream stopped. */
362
+ Ended: "ended",
363
+ } as const;
247
364
  /**
248
- * Where a join request stands: `"pending"` until it is accepted or denied,
249
- * `"failed"` when the answer did not reach the server, `"withdrawn"` when the
250
- * viewer left first and `"ended"` when the stream stopped.
365
+ * Where a join request stands.
251
366
  */
252
- export type JoinRequestState = "pending" | "accepted" | "denied" | "failed" | "withdrawn" | "ended";
253
-
367
+ export const JoinRequestState: typeof joinRequestStateValues =
368
+ /* @__PURE__ */ Object.freeze(joinRequestStateValues);
369
+ /**
370
+ * One of {@link JoinRequestState}. May gain members in a minor release: a
371
+ * `switch` over it needs a default case.
372
+ */
373
+ export type JoinRequestState = (typeof JoinRequestState)[keyof typeof JoinRequestState];
374
+
375
+ /** The values of the table below, before freezing. */
376
+ const joinRequestCloseCauseValues = {
377
+ /** The viewer took it back or left view. */
378
+ Withdrawn: "withdrawn",
379
+ /** The stream ended first. */
380
+ Ended: "ended",
381
+ } as const;
254
382
  /**
255
- * Why a request stopped waiting for an answer: `"withdrawn"` when the viewer
256
- * took it back or left view, `"ended"` when the stream ended first.
383
+ * Why a request stopped waiting for an answer.
257
384
  */
258
- export type JoinRequestCloseCause = "withdrawn" | "ended";
385
+ export const JoinRequestCloseCause: typeof joinRequestCloseCauseValues =
386
+ /* @__PURE__ */ Object.freeze(joinRequestCloseCauseValues);
387
+ /**
388
+ * One of {@link JoinRequestCloseCause}. May gain members in a minor release: a
389
+ * `switch` over it needs a default case.
390
+ */
391
+ export type JoinRequestCloseCause =
392
+ (typeof JoinRequestCloseCause)[keyof typeof JoinRequestCloseCause];
259
393
 
260
394
  /**
261
395
  * A pending join request closing without an answer.
@@ -279,6 +413,43 @@ export interface JoinRequestEvents {
279
413
  closed: JoinRequestClosed;
280
414
  }
281
415
 
416
+ /** The values of the table below, before freezing. */
417
+ const joinRequestEventNameValues = {
418
+ /**
419
+ * A request nobody had answered closing: the viewer withdrew it or left
420
+ * view, or the stream ended.
421
+ */
422
+ Closed: "closed",
423
+ } as const;
424
+ /**
425
+ * The names of the events `JoinRequest.on()` takes, as constants.
426
+ * `on(JoinRequestEventName.Closed, ...)` and `on("closed", ...)` are the same call,
427
+ * and both give the listener the same payload type.
428
+ */
429
+ export const JoinRequestEventName: typeof joinRequestEventNameValues =
430
+ /* @__PURE__ */ Object.freeze(joinRequestEventNameValues);
431
+ /**
432
+ * One of {@link JoinRequestEventName}, and so a key of {@link JoinRequestEvents}.
433
+ * May gain members in a minor release: a `switch` over it needs a default
434
+ * case.
435
+ */
436
+ export type JoinRequestEventName = (typeof JoinRequestEventName)[keyof typeof JoinRequestEventName];
437
+
438
+ // Each direction fails to compile when `JoinRequestEvents` and `JoinRequestEventName`
439
+ // drift: an event without a name, and a name that is not an event.
440
+ const joinRequestEventNameCoverEvents: [
441
+ Exclude<keyof JoinRequestEvents, JoinRequestEventName>,
442
+ ] extends [never]
443
+ ? true
444
+ : never = true;
445
+ const joinRequestEventNameNamesAreEvents: [
446
+ Exclude<JoinRequestEventName, keyof JoinRequestEvents>,
447
+ ] extends [never]
448
+ ? true
449
+ : never = true;
450
+ void joinRequestEventNameCoverEvents;
451
+ void joinRequestEventNameNamesAreEvents;
452
+
282
453
  /**
283
454
  * A client asking to watch a stream this client publishes. The server relays
284
455
  * every request, from any channel, and enforces neither `viewerLimit` nor
@@ -317,14 +488,32 @@ export interface JoinRequest {
317
488
  deny(reason?: string): Promise<void>;
318
489
  }
319
490
 
491
+ /** The values of the table below, before freezing. */
492
+ const streamEndCauseValues = {
493
+ /** `stop()`. */
494
+ Stopped: "stopped",
495
+ /** The server's `notifystreamstopped`. */
496
+ Server: "server",
497
+ /**
498
+ * The server said its publisher no longer streams (`client_is_streaming`
499
+ * cleared) and no stop followed within two seconds.
500
+ */
501
+ Gone: "gone",
502
+ /** The client's connection ending. */
503
+ Disconnected: "disconnected",
504
+ /** `Streams.dispose()`. */
505
+ Disposed: "disposed",
506
+ } as const;
507
+ /**
508
+ * Why a published stream ended.
509
+ */
510
+ export const StreamEndCause: typeof streamEndCauseValues =
511
+ /* @__PURE__ */ Object.freeze(streamEndCauseValues);
320
512
  /**
321
- * Why a published stream ended: `"stopped"` for `stop()`, `"server"` for the
322
- * server's `notifystreamstopped`, `"gone"` when the server said its publisher
323
- * no longer streams (`client_is_streaming` cleared) and no stop followed within
324
- * two seconds, and
325
- * `"disconnected"` and `"disposed"` as for a peer.
513
+ * One of {@link StreamEndCause}. May gain members in a minor release: a
514
+ * `switch` over it needs a default case.
326
515
  */
327
- export type StreamEndCause = "stopped" | "server" | "gone" | "disconnected" | "disposed";
516
+ export type StreamEndCause = (typeof StreamEndCause)[keyof typeof StreamEndCause];
328
517
 
329
518
  /**
330
519
  * A published stream ending.
@@ -351,6 +540,43 @@ export interface PublishedStreamEvents {
351
540
  ended: StreamEnded;
352
541
  }
353
542
 
543
+ /** The values of the table below, before freezing. */
544
+ const publishedStreamEventNameValues = {
545
+ /** A client asking to watch. */
546
+ Request: "request",
547
+ /** The stream ending. */
548
+ Ended: "ended",
549
+ } as const;
550
+ /**
551
+ * The names of the events `PublishedStream.on()` takes, as constants.
552
+ * `on(PublishedStreamEventName.Request, ...)` and `on("request", ...)` are the same call,
553
+ * and both give the listener the same payload type.
554
+ */
555
+ export const PublishedStreamEventName: typeof publishedStreamEventNameValues =
556
+ /* @__PURE__ */ Object.freeze(publishedStreamEventNameValues);
557
+ /**
558
+ * One of {@link PublishedStreamEventName}, and so a key of {@link PublishedStreamEvents}.
559
+ * May gain members in a minor release: a `switch` over it needs a default
560
+ * case.
561
+ */
562
+ export type PublishedStreamEventName =
563
+ (typeof PublishedStreamEventName)[keyof typeof PublishedStreamEventName];
564
+
565
+ // Each direction fails to compile when `PublishedStreamEvents` and `PublishedStreamEventName`
566
+ // drift: an event without a name, and a name that is not an event.
567
+ const publishedStreamEventNameCoverEvents: [
568
+ Exclude<keyof PublishedStreamEvents, PublishedStreamEventName>,
569
+ ] extends [never]
570
+ ? true
571
+ : never = true;
572
+ const publishedStreamEventNameNamesAreEvents: [
573
+ Exclude<PublishedStreamEventName, keyof PublishedStreamEvents>,
574
+ ] extends [never]
575
+ ? true
576
+ : never = true;
577
+ void publishedStreamEventNameCoverEvents;
578
+ void publishedStreamEventNameNamesAreEvents;
579
+
354
580
  /**
355
581
  * A stream this client publishes.
356
582
  */
@@ -445,7 +671,10 @@ export interface StreamStoppedEvent {
445
671
  * `client_is_streaming` cleared or the publisher came into view not
446
672
  * streaming, without a stop reaching this client.
447
673
  */
448
- readonly cause: "server" | "stopped" | "gone";
674
+ readonly cause:
675
+ | typeof StreamEndCause.Server
676
+ | typeof StreamEndCause.Stopped
677
+ | typeof StreamEndCause.Gone;
449
678
  /** The stop reason the server reported; 0 unless the stopper gave one, and for `"gone"`. */
450
679
  readonly reason: number;
451
680
  }
@@ -461,11 +690,21 @@ export interface StreamViewerEvent {
461
690
  readonly clientId: ClientID;
462
691
  }
463
692
 
693
+ /** The values of the table below, before freezing. */
694
+ const streamWarningCodeValues = {
695
+ /** An SDP offer with no `m=audio` section. */
696
+ OfferWithoutAudio: "offer-without-audio",
697
+ } as const;
464
698
  /**
465
- * Why `Streams` warns: `"offer-without-audio"` for an SDP offer with no
466
- * `m=audio` section.
699
+ * Why `Streams` warns.
467
700
  */
468
- export type StreamWarningCode = "offer-without-audio";
701
+ export const StreamWarningCode: typeof streamWarningCodeValues =
702
+ /* @__PURE__ */ Object.freeze(streamWarningCodeValues);
703
+ /**
704
+ * One of {@link StreamWarningCode}. May gain members in a minor release: a
705
+ * `switch` over it needs a default case.
706
+ */
707
+ export type StreamWarningCode = (typeof StreamWarningCode)[keyof typeof StreamWarningCode];
469
708
 
470
709
  /**
471
710
  * Something the SDK noticed and did not stop: the offer or message goes out
@@ -486,7 +725,10 @@ export interface StreamWarning {
486
725
  * The events of `Streams`.
487
726
  */
488
727
  export interface StreamsEventMap {
489
- /** A stream becoming known: it started while this client could see it, or discovery found it. */
728
+ /**
729
+ * A stream becoming known: it started while this client could see it, or
730
+ * discovery found it.
731
+ */
490
732
  started: StreamInfo;
491
733
  /** What is known of a stream changing. */
492
734
  updated: StreamInfo;
@@ -504,3 +746,55 @@ export interface StreamsEventMap {
504
746
  */
505
747
  warning: StreamWarning;
506
748
  }
749
+
750
+ /** The values of the table below, before freezing. */
751
+ const streamsEventNameValues = {
752
+ /**
753
+ * A stream becoming known: it started while this client could see it, or
754
+ * discovery found it.
755
+ */
756
+ Started: "started",
757
+ /** What is known of a stream changing. */
758
+ Updated: "updated",
759
+ /** A stream ending. */
760
+ Stopped: "stopped",
761
+ /** A viewer being accepted into a stream. */
762
+ ViewerJoined: "viewerJoined",
763
+ /** A viewer leaving a stream. */
764
+ ViewerLeft: "viewerLeft",
765
+ /** A failure nobody awaits, such as a discovery request the server refused. */
766
+ Error: "error",
767
+ /**
768
+ * Something the SDK noticed and let through, such as an offer the
769
+ * TeamSpeak 6 client will not answer.
770
+ */
771
+ Warning: "warning",
772
+ } as const;
773
+ /**
774
+ * The names of the events `Streams.on()` takes, as constants.
775
+ * `on(StreamsEventName.Started, ...)` and `on("started", ...)` are the same call,
776
+ * and both give the listener the same payload type.
777
+ */
778
+ export const StreamsEventName: typeof streamsEventNameValues =
779
+ /* @__PURE__ */ Object.freeze(streamsEventNameValues);
780
+ /**
781
+ * One of {@link StreamsEventName}, and so a key of {@link StreamsEventMap}.
782
+ * May gain members in a minor release: a `switch` over it needs a default
783
+ * case.
784
+ */
785
+ export type StreamsEventName = (typeof StreamsEventName)[keyof typeof StreamsEventName];
786
+
787
+ // Each direction fails to compile when `StreamsEventMap` and `StreamsEventName`
788
+ // drift: an event without a name, and a name that is not an event.
789
+ const streamsEventNameCoverEvents: [Exclude<keyof StreamsEventMap, StreamsEventName>] extends [
790
+ never,
791
+ ]
792
+ ? true
793
+ : never = true;
794
+ const streamsEventNameNamesAreEvents: [Exclude<StreamsEventName, keyof StreamsEventMap>] extends [
795
+ never,
796
+ ]
797
+ ? true
798
+ : never = true;
799
+ void streamsEventNameCoverEvents;
800
+ void streamsEventNameNamesAreEvents;