@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
@@ -1,2 +1,236 @@
1
- export {};
1
+ // ---- Values -----------------------------------------------------------------
2
+ /** The values of the table below, before freezing. */
3
+ const streamSourceValues = {
4
+ /** `0` on the wire: no source named. */
5
+ None: "none",
6
+ /** `1` on the wire: a camera. */
7
+ Camera: "camera",
8
+ /** `2` on the wire: a screen. */
9
+ Screen: "screen",
10
+ /** `3` on the wire: a window. */
11
+ Window: "window",
12
+ /** `4` on the wire. */
13
+ Session: "session",
14
+ };
15
+ /**
16
+ * What a stream shows. The server stores any number, so a stream from a client
17
+ * that sends another value reports it as the number.
18
+ */
19
+ export const StreamSource =
20
+ /* @__PURE__ */ Object.freeze(streamSourceValues);
21
+ /** The values of the table below, before freezing. */
22
+ const streamAccessibilityValues = {
23
+ /** `0` on the wire. */
24
+ None: "none",
25
+ /** `1` on the wire: anyone. What `publish` sends unless told otherwise. */
26
+ Public: "public",
27
+ /** `2` on the wire: the publisher's contacts. */
28
+ Contacts: "contacts",
29
+ /** `3` on the wire. */
30
+ Private: "private",
31
+ };
32
+ /**
33
+ * Who a stream says may watch it. Only the publisher enforces it: the server
34
+ * relays every request. A value outside the four is reported as the number.
35
+ */
36
+ export const StreamAccessibility =
37
+ /* @__PURE__ */ Object.freeze(streamAccessibilityValues);
38
+ /** The values of the table below, before freezing. */
39
+ const streamTransportValues = {
40
+ /** From the publisher to each viewer directly. */
41
+ P2P: "p2p",
42
+ };
43
+ /**
44
+ * How a stream's media travels: `"p2p"`, from the publisher to each viewer
45
+ * directly, is the one mode this SDK publishes and watches. A server may
46
+ * announce a stream in another mode; it is reported as the number, and
47
+ * `watch` refuses it.
48
+ */
49
+ export const StreamTransport =
50
+ /* @__PURE__ */ Object.freeze(streamTransportValues);
51
+ // ---- Peers ------------------------------------------------------------------
52
+ /** The values of the table below, before freezing. */
53
+ const peerCloseCauseValues = {
54
+ /** Its own `close()`. */
55
+ Closed: "closed",
56
+ /** The other end leaving. */
57
+ Left: "left",
58
+ /** The stream ending. */
59
+ Stopped: "stopped",
60
+ /** The client's connection ending. */
61
+ Disconnected: "disconnected",
62
+ /** `Streams.dispose()`. */
63
+ Disposed: "disposed",
64
+ };
65
+ /**
66
+ * Why a peer closed.
67
+ */
68
+ export const PeerCloseCause =
69
+ /* @__PURE__ */ Object.freeze(peerCloseCauseValues);
70
+ /** The values of the table below, before freezing. */
71
+ const peerEventNameValues = {
72
+ /** A renegotiation offer from the publisher: an SDP. */
73
+ Offer: "offer",
74
+ /** The viewer's SDP answer. */
75
+ Answer: "answer",
76
+ /** An ICE candidate from the other end. */
77
+ Candidate: "candidate",
78
+ /** A signalling message that is none of the above. */
79
+ Signal: "signal",
80
+ /** The peer closing. */
81
+ Closed: "closed",
82
+ };
83
+ /**
84
+ * The names of the events `Peer.on()` takes, as constants.
85
+ * `on(PeerEventName.Offer, ...)` and `on("offer", ...)` are the same call,
86
+ * and both give the listener the same payload type.
87
+ */
88
+ export const PeerEventName =
89
+ /* @__PURE__ */ Object.freeze(peerEventNameValues);
90
+ // Each direction fails to compile when `PeerEvents` and `PeerEventName`
91
+ // drift: an event without a name, and a name that is not an event.
92
+ const peerEventNameCoverEvents = true;
93
+ const peerEventNameNamesAreEvents = true;
94
+ void peerEventNameCoverEvents;
95
+ void peerEventNameNamesAreEvents;
96
+ /** The values of the table below, before freezing. */
97
+ const joinRequestStateValues = {
98
+ /** Not yet accepted or denied. */
99
+ Pending: "pending",
100
+ /** Accepted. */
101
+ Accepted: "accepted",
102
+ /** Denied. */
103
+ Denied: "denied",
104
+ /** The answer did not reach the server. */
105
+ Failed: "failed",
106
+ /** The viewer left first. */
107
+ Withdrawn: "withdrawn",
108
+ /** The stream stopped. */
109
+ Ended: "ended",
110
+ };
111
+ /**
112
+ * Where a join request stands.
113
+ */
114
+ export const JoinRequestState =
115
+ /* @__PURE__ */ Object.freeze(joinRequestStateValues);
116
+ /** The values of the table below, before freezing. */
117
+ const joinRequestCloseCauseValues = {
118
+ /** The viewer took it back or left view. */
119
+ Withdrawn: "withdrawn",
120
+ /** The stream ended first. */
121
+ Ended: "ended",
122
+ };
123
+ /**
124
+ * Why a request stopped waiting for an answer.
125
+ */
126
+ export const JoinRequestCloseCause =
127
+ /* @__PURE__ */ Object.freeze(joinRequestCloseCauseValues);
128
+ /** The values of the table below, before freezing. */
129
+ const joinRequestEventNameValues = {
130
+ /**
131
+ * A request nobody had answered closing: the viewer withdrew it or left
132
+ * view, or the stream ended.
133
+ */
134
+ Closed: "closed",
135
+ };
136
+ /**
137
+ * The names of the events `JoinRequest.on()` takes, as constants.
138
+ * `on(JoinRequestEventName.Closed, ...)` and `on("closed", ...)` are the same call,
139
+ * and both give the listener the same payload type.
140
+ */
141
+ export const JoinRequestEventName =
142
+ /* @__PURE__ */ Object.freeze(joinRequestEventNameValues);
143
+ // Each direction fails to compile when `JoinRequestEvents` and `JoinRequestEventName`
144
+ // drift: an event without a name, and a name that is not an event.
145
+ const joinRequestEventNameCoverEvents = true;
146
+ const joinRequestEventNameNamesAreEvents = true;
147
+ void joinRequestEventNameCoverEvents;
148
+ void joinRequestEventNameNamesAreEvents;
149
+ /** The values of the table below, before freezing. */
150
+ const streamEndCauseValues = {
151
+ /** `stop()`. */
152
+ Stopped: "stopped",
153
+ /** The server's `notifystreamstopped`. */
154
+ Server: "server",
155
+ /**
156
+ * The server said its publisher no longer streams (`client_is_streaming`
157
+ * cleared) and no stop followed within two seconds.
158
+ */
159
+ Gone: "gone",
160
+ /** The client's connection ending. */
161
+ Disconnected: "disconnected",
162
+ /** `Streams.dispose()`. */
163
+ Disposed: "disposed",
164
+ };
165
+ /**
166
+ * Why a published stream ended.
167
+ */
168
+ export const StreamEndCause =
169
+ /* @__PURE__ */ Object.freeze(streamEndCauseValues);
170
+ /** The values of the table below, before freezing. */
171
+ const publishedStreamEventNameValues = {
172
+ /** A client asking to watch. */
173
+ Request: "request",
174
+ /** The stream ending. */
175
+ Ended: "ended",
176
+ };
177
+ /**
178
+ * The names of the events `PublishedStream.on()` takes, as constants.
179
+ * `on(PublishedStreamEventName.Request, ...)` and `on("request", ...)` are the same call,
180
+ * and both give the listener the same payload type.
181
+ */
182
+ export const PublishedStreamEventName =
183
+ /* @__PURE__ */ Object.freeze(publishedStreamEventNameValues);
184
+ // Each direction fails to compile when `PublishedStreamEvents` and `PublishedStreamEventName`
185
+ // drift: an event without a name, and a name that is not an event.
186
+ const publishedStreamEventNameCoverEvents = true;
187
+ const publishedStreamEventNameNamesAreEvents = true;
188
+ void publishedStreamEventNameCoverEvents;
189
+ void publishedStreamEventNameNamesAreEvents;
190
+ /** The values of the table below, before freezing. */
191
+ const streamWarningCodeValues = {
192
+ /** An SDP offer with no `m=audio` section. */
193
+ OfferWithoutAudio: "offer-without-audio",
194
+ };
195
+ /**
196
+ * Why `Streams` warns.
197
+ */
198
+ export const StreamWarningCode =
199
+ /* @__PURE__ */ Object.freeze(streamWarningCodeValues);
200
+ /** The values of the table below, before freezing. */
201
+ const streamsEventNameValues = {
202
+ /**
203
+ * A stream becoming known: it started while this client could see it, or
204
+ * discovery found it.
205
+ */
206
+ Started: "started",
207
+ /** What is known of a stream changing. */
208
+ Updated: "updated",
209
+ /** A stream ending. */
210
+ Stopped: "stopped",
211
+ /** A viewer being accepted into a stream. */
212
+ ViewerJoined: "viewerJoined",
213
+ /** A viewer leaving a stream. */
214
+ ViewerLeft: "viewerLeft",
215
+ /** A failure nobody awaits, such as a discovery request the server refused. */
216
+ Error: "error",
217
+ /**
218
+ * Something the SDK noticed and let through, such as an offer the
219
+ * TeamSpeak 6 client will not answer.
220
+ */
221
+ Warning: "warning",
222
+ };
223
+ /**
224
+ * The names of the events `Streams.on()` takes, as constants.
225
+ * `on(StreamsEventName.Started, ...)` and `on("started", ...)` are the same call,
226
+ * and both give the listener the same payload type.
227
+ */
228
+ export const StreamsEventName =
229
+ /* @__PURE__ */ Object.freeze(streamsEventNameValues);
230
+ // Each direction fails to compile when `StreamsEventMap` and `StreamsEventName`
231
+ // drift: an event without a name, and a name that is not an event.
232
+ const streamsEventNameCoverEvents = true;
233
+ const streamsEventNameNamesAreEvents = true;
234
+ void streamsEventNameCoverEvents;
235
+ void streamsEventNameNamesAreEvents;
2
236
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/stream/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/stream/types.ts"],"names":[],"mappings":"AAoDA,gFAAgF;AAEhF,sDAAsD;AACtD,MAAM,kBAAkB,GAAG;IACzB,wCAAwC;IACxC,IAAI,EAAE,MAAM;IACZ,iCAAiC;IACjC,MAAM,EAAE,QAAQ;IAChB,iCAAiC;IACjC,MAAM,EAAE,QAAQ;IAChB,iCAAiC;IACjC,MAAM,EAAE,QAAQ;IAChB,uBAAuB;IACvB,OAAO,EAAE,SAAS;CACV,CAAC;AACX;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY;AACvB,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAOpD,sDAAsD;AACtD,MAAM,yBAAyB,GAAG;IAChC,uBAAuB;IACvB,IAAI,EAAE,MAAM;IACZ,2EAA2E;IAC3E,MAAM,EAAE,QAAQ;IAChB,iDAAiD;IACjD,QAAQ,EAAE,UAAU;IACpB,uBAAuB;IACvB,OAAO,EAAE,SAAS;CACV,CAAC;AACX;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB;AAC9B,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAO3D,sDAAsD;AACtD,MAAM,qBAAqB,GAAG;IAC5B,kDAAkD;IAClD,GAAG,EAAE,KAAK;CACF,CAAC;AACX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe;AAC1B,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAyEvD,gFAAgF;AAEhF,sDAAsD;AACtD,MAAM,oBAAoB,GAAG;IAC3B,yBAAyB;IACzB,MAAM,EAAE,QAAQ;IAChB,6BAA6B;IAC7B,IAAI,EAAE,MAAM;IACZ,yBAAyB;IACzB,OAAO,EAAE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AAK,sCAAsC,CAAC;AAmH5C,sDAAsD;AACtD,MAAM,uBAAuB,GAAG;IAC9B,8CAA8C;IAC9C,iBAAiB,EAAE,qBAAqB;CAChC,CAAC;AACX;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB;AAC5B,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAgDzD,sDAAsD;AACtD,MAAM,sBAAsB,GAAG;IAC7B;;;OAGG;IACH,OAAO,EAAE,SAAS;IAClB,0CAA0C;IAC1C,OAAO,EAAE,SAAS;IAClB,uBAAuB;IACvB,OAAO,EAAE,SAAS;IAClB,6CAA6C;IAC7C,YAAY,EAAE,cAAc;IAC5B,iCAAiC;IACjC,UAAU,EAAE,YAAY;IACxB,+EAA+E;IAC/E,KAAK,EAAE,OAAO;IACd;;;OAGG;IACH,OAAO,EAAE,SAAS;CACV,CAAC;AACX;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB;AAC3B,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAQxD,gFAAgF;AAChF,mEAAmE;AACnE,MAAM,2BAA2B,GAIrB,IAAI,CAAC;AACjB,MAAM,8BAA8B,GAIxB,IAAI,CAAC;AACjB,KAAK,2BAA2B,CAAC;AACjC,KAAK,8BAA8B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honeybbq/teamspeak",
3
- "version": "1.0.0-beta.21",
3
+ "version": "1.0.0-beta.22",
4
4
  "description": "TeamSpeak SDK for TypeScript: an independent voice client for Node.js, and the typed commands, ids and errors every connection shares",
5
5
  "keywords": [
6
6
  "client",
@@ -71,23 +71,24 @@
71
71
  "@changesets/changelog-github": "^1.0.1",
72
72
  "@changesets/cli": "^3.0.3",
73
73
  "@honeybbq/teamspeak": "link:.",
74
- "@microsoft/api-extractor": "7.59.4",
75
- "@types/node": "^26.6.5",
74
+ "@microsoft/api-extractor": "7.60.1",
75
+ "@types/node": "^26.6.6",
76
76
  "@types/ssh2": "^1.15.6",
77
+ "@vitest/coverage-v8": "5.0.5",
77
78
  "fast-check": "^4.10.2",
78
- "oxfmt": "^0.73.0",
79
- "oxlint": "^1.88.0",
80
- "oxlint-tsgolint": "^7.0.2004",
79
+ "oxfmt": "^0.75.0",
80
+ "oxlint": "^1.90.0",
81
+ "oxlint-tsgolint": "^7.0.2005",
81
82
  "publint": "^0.3.25",
82
83
  "ssh2": "^1.17.0",
83
- "tsx": "^4.21.0",
84
+ "tsx": "^4.23.15",
84
85
  "typedoc": "0.28.20",
85
86
  "typedoc-material-theme": "^1.4.1",
86
87
  "typescript": "^7.0.2",
87
- "typescript-api": "npm:typescript@^5.9.3",
88
- "vite": "^8.3.4",
88
+ "typescript-api": "npm:typescript@^6.0.3",
89
+ "vite": "^8.3.5",
89
90
  "vitest": "^5.0.5",
90
- "werift": "^0.25.1"
91
+ "werift": "^0.25.2"
91
92
  },
92
93
  "peerDependencies": {
93
94
  "ssh2": "^1.17.0"
@@ -103,6 +104,7 @@
103
104
  "scripts": {
104
105
  "build": "tsc -p tsconfig.build.json",
105
106
  "test": "vitest run --project @honeybbq/teamspeak --project scripts",
107
+ "test:coverage": "vitest run --coverage --project @honeybbq/teamspeak --project scripts",
106
108
  "test:watch": "vitest",
107
109
  "lint": "oxlint --deny-warnings .",
108
110
  "fmt": "oxfmt .",
@@ -246,6 +246,13 @@ function generateKey(): KeyObject {
246
246
  return generateKeyPairSync("ec", { namedCurve: "prime256v1" }).privateKey;
247
247
  }
248
248
 
249
+ /** The values of the table below, before freezing. */
250
+ const uidAlgorithmValues = {
251
+ /** SHA-1, 20 bytes: a TeamSpeak 3 server. */
252
+ SHA1: "sha1",
253
+ /** SHA-256, 32 bytes: a TeamSpeak 6 server. */
254
+ SHA256: "sha256",
255
+ } as const;
249
256
  /**
250
257
  * The hash a server uses for `client_unique_identifier`, keyed by the server's
251
258
  * major version.
@@ -254,16 +261,20 @@ function generateKey(): KeyObject {
254
261
  * 6 switched to SHA-256 (32 bytes). The algorithm is not negotiable on the
255
262
  * wire, so a client that guesses wrong computes a UID that matches nothing the
256
263
  * server ever sends — self-identification by UID silently fails.
257
- *
258
- * May gain members in a minor release, should a server generation change the
259
- * hash again: a `switch` over it needs a default case.
260
264
  */
261
- export type UIDAlgorithm = "sha1" | "sha256";
265
+ export const UIDAlgorithm: typeof uidAlgorithmValues =
266
+ /* @__PURE__ */ Object.freeze(uidAlgorithmValues);
267
+ /**
268
+ * One of {@link UIDAlgorithm}. May gain members in a minor release, should a
269
+ * server generation change the hash again: a `switch` over it needs a default
270
+ * case.
271
+ */
272
+ export type UIDAlgorithm = (typeof UIDAlgorithm)[keyof typeof UIDAlgorithm];
262
273
 
263
274
  /** Pick the UID hash from a `virtualserver_version` string, e.g. "6.0.0-beta13.1". */
264
275
  export function uidAlgorithmForVersion(version: string): UIDAlgorithm {
265
276
  const major = Number.parseInt(version, 10);
266
- return Number.isNaN(major) || major < 6 ? "sha1" : "sha256";
277
+ return Number.isNaN(major) || major < 6 ? UIDAlgorithm.SHA1 : UIDAlgorithm.SHA256;
267
278
  }
268
279
 
269
280
  /**
@@ -9,7 +9,7 @@ export {
9
9
  hash512,
10
10
  importPublicKey,
11
11
  } from "./identity.js";
12
- export type { UIDAlgorithm } from "./identity.js";
12
+ export { UIDAlgorithm } from "./identity.js";
13
13
  export { Crypt } from "./crypt.js";
14
14
  export type { KeyNonce } from "./crypt.js";
15
15
  export { EAX, aesCmac } from "./eax.js";
@@ -1,5 +1,6 @@
1
1
  import { resolveSrv } from "node:dns/promises";
2
2
  import { createConnection } from "node:net";
3
+ import { ResolveSource } from "../types.js";
3
4
  import type { ResolvedAddr } from "../types.js";
4
5
  import { isIpAddress, joinHostPort, splitHostPort } from "../address.js";
5
6
  import { abortable } from "../abort.js";
@@ -58,7 +59,7 @@ export class Resolver {
58
59
  options.signal?.throwIfAborted();
59
60
  if (!budget.aborted) throw error;
60
61
  const { host, port } = splitHostPort(inputAddr);
61
- return [{ addr: joinHostPort(host, port), source: "Direct" }];
62
+ return [{ addr: joinHostPort(host, port), source: ResolveSource.Direct }];
62
63
  }
63
64
  }
64
65
 
@@ -73,7 +74,7 @@ export class Resolver {
73
74
  const { host, port } = splitHostPort(inputAddr);
74
75
 
75
76
  if (isIpAddress(host)) {
76
- return [{ addr: joinHostPort(host, port), source: "Direct" }];
77
+ return [{ addr: joinHostPort(host, port), source: ResolveSource.Direct }];
77
78
  }
78
79
 
79
80
  // A dot-less name may be a server nickname, which only the TeamSpeak
@@ -94,18 +95,20 @@ export class Resolver {
94
95
  // TSDNS via SRV _tsdns._tcp.<domain>
95
96
  const tsdnsSrv = await this.#resolveTSDNSSRV(domainList, host, signal);
96
97
  if (tsdnsSrv) {
97
- return this.#setCache(inputAddr, [{ addr: tsdnsSrv, source: "TSDNS-SRV" }]);
98
+ return this.#setCache(inputAddr, [{ addr: tsdnsSrv, source: ResolveSource.TSDNSSRV }]);
98
99
  }
99
100
 
100
101
  // TSDNS direct :41144
101
102
  const tsdnsDirect = await this.#resolveTSDNSDirect(domainList, host, signal);
102
103
  if (tsdnsDirect) {
103
- return this.#setCache(inputAddr, [{ addr: tsdnsDirect, source: "TSDNS-Direct" }]);
104
+ return this.#setCache(inputAddr, [{ addr: tsdnsDirect, source: ResolveSource.TSDNSDirect }]);
104
105
  }
105
106
 
106
107
  signal.throwIfAborted();
107
108
  // Plain DNS fallback
108
- const fallback: ResolvedAddr[] = [{ addr: joinHostPort(host, port), source: "Direct" }];
109
+ const fallback: ResolvedAddr[] = [
110
+ { addr: joinHostPort(host, port), source: ResolveSource.Direct },
111
+ ];
109
112
  return this.#setCache(inputAddr, fallback);
110
113
  }
111
114
 
@@ -130,7 +133,7 @@ export class Resolver {
130
133
  if (!srvs || srvs.length === 0) return null;
131
134
  return orderSrvRecords(srvs).map((srv) => ({
132
135
  addr: joinHostPort(srv.name.replace(/\.$/, ""), String(srv.port)),
133
- source: "SRV",
136
+ source: ResolveSource.SRV,
134
137
  }));
135
138
  } catch {
136
139
  return null;
@@ -78,6 +78,7 @@ function parseLicenseBlock(data: Uint8Array): { block: LicenseBlock; consumed: n
78
78
  if (data.length < MIN_BLOCK_LEN) throw new Error("license too short");
79
79
  if (data[0] !== 0) throw new Error(`wrong key kind in license: ${data[0]}`);
80
80
 
81
+ // oxlint-disable-next-line typescript/no-unsafe-enum-assignment -- read off the wire; parseBlockPayload refuses a value no member names
81
82
  const blockType = data[33] as LicenseBlockType;
82
83
 
83
84
  // Timestamps are seconds since Unix epoch offset by 0x50e22700
@@ -10,9 +10,10 @@
10
10
 
11
11
  // The client
12
12
  export { Client } from "./client.js";
13
- export { EventName, GroupWhisperType, GroupWhisperScope } from "./types.js";
13
+ export { EventName, GroupWhisperType, GroupWhisperScope, ResolveSource } from "./types.js";
14
14
 
15
- export type { ServerView, ViewChangedEvent, ViewReadyEvent, ViewStatus } from "./view.js";
15
+ export { ViewStatus } from "./view.js";
16
+ export type { ServerView, ViewChangedEvent, ViewReadyEvent } from "./view.js";
16
17
 
17
18
  export type {
18
19
  EventMap,
@@ -47,11 +48,15 @@ export * from "./api/avatars.js";
47
48
  export * from "./api/files.js";
48
49
 
49
50
  // File transfer data
50
- export { dialFileTransfer, uploadFileData, downloadFileData } from "./transfer.js";
51
+ export {
52
+ dialFileTransfer,
53
+ uploadFileData,
54
+ downloadFileData,
55
+ FileTransferStage,
56
+ } from "./transfer.js";
51
57
  export type {
52
58
  FileTransferOptions,
53
59
  FileTransferTrace,
54
- FileTransferStage,
55
60
  FileTransferDialStartInfo,
56
61
  FileTransferDialDoneInfo,
57
62
  FileTransferProgressInfo,
@@ -99,4 +104,4 @@ export {
99
104
  uidAlgorithmForVersion,
100
105
  MAX_SECURITY_LEVEL,
101
106
  } from "./crypto/index.js";
102
- export type { UIDAlgorithm } from "./crypto/index.js";
107
+ export { UIDAlgorithm } from "./crypto/index.js";
@@ -44,7 +44,10 @@ export interface ResolveDoneInfo extends AttemptInfo {
44
44
  readonly addr: string;
45
45
  /** The `host:port` that will be dialled. */
46
46
  readonly target: string;
47
- /** What the resolver reports as the source of the answer dialled; may be empty. */
47
+ /**
48
+ * What the resolver reports as the source of the answer dialled: one of
49
+ * `ResolveSource` for the built-in resolver. May be empty.
50
+ */
48
51
  readonly source: string;
49
52
  /** Every answer the resolver gave, in order; empty when the address is used as given. */
50
53
  readonly candidates: readonly ResolvedAddr[];
@@ -44,8 +44,18 @@ export function failedToConnect(error: unknown): boolean {
44
44
  return typeof error === "object" && error !== null && failedBeforeConnect.has(error);
45
45
  }
46
46
 
47
+ /** The values of the table below, before freezing. */
48
+ const fileTransferStageValues = {
49
+ /** Reaching the transfer port, before the key is written. */
50
+ Dial: "dial",
51
+ /** After the connection opened, while the key or the file moved. */
52
+ Transfer: "transfer",
53
+ } as const;
47
54
  /** Where a failed transfer failed. */
48
- export type FileTransferStage = "dial" | "transfer";
55
+ export const FileTransferStage: typeof fileTransferStageValues =
56
+ /* @__PURE__ */ Object.freeze(fileTransferStageValues);
57
+ /** One of {@link FileTransferStage}. */
58
+ export type FileTransferStage = (typeof FileTransferStage)[keyof typeof FileTransferStage];
49
59
 
50
60
  /** The file transfer port is about to be dialled. */
51
61
  export interface FileTransferDialStartInfo {
@@ -10,6 +10,7 @@ import {
10
10
  PacketType,
11
11
  PacketFlags,
12
12
  packetType,
13
+ packetTypeOfByte,
13
14
  packetFlags,
14
15
  buildC2SHeader,
15
16
  parseS2CHeader,
@@ -563,7 +564,7 @@ export class PacketHandler {
563
564
  if (!this.#conn) return;
564
565
  if (data.length > TAG_SIZE + HEADER_SIZE - 1) {
565
566
  this.#traffic.recordSent(
566
- data[TAG_SIZE + HEADER_SIZE - 1]! & 0x0f,
567
+ packetTypeOfByte(data[TAG_SIZE + HEADER_SIZE - 1]!),
567
568
  data.length,
568
569
  performance.now(),
569
570
  );
@@ -597,7 +598,7 @@ export class PacketHandler {
597
598
  const parsed = parseS2CHeader(header);
598
599
  // Init1 belongs to the start of the handshake; once crypto init has
599
600
  // completed, another one can only restart a session that is already set up.
600
- const parsedType: PacketType = parsed.typeFlagged & 0x0f;
601
+ const parsedType = packetTypeOfByte(parsed.typeFlagged);
601
602
  if (parsedType === PacketType.Init1 && this.#crypt.cryptoInitComplete) return;
602
603
 
603
604
  const p: Packet = {
@@ -27,8 +27,17 @@ export interface Packet {
27
27
  receivedAt: number; // performance.now(), a monotonic clock
28
28
  }
29
29
 
30
+ /**
31
+ * The packet type in the low nibble of a type byte, as it came off the wire:
32
+ * the nibble can also hold 9 to 15, which name no type.
33
+ */
34
+ export function packetTypeOfByte(typeByte: number): PacketType {
35
+ // oxlint-disable-next-line typescript/no-unsafe-enum-assignment -- read off the wire, where the nibble can be any value
36
+ return typeByte & 0x0f;
37
+ }
38
+
30
39
  export function packetType(p: Packet): PacketType {
31
- return p.typeFlagged & 0x0f;
40
+ return packetTypeOfByte(p.typeFlagged);
32
41
  }
33
42
 
34
43
  export function packetFlags(p: Packet): number {
@@ -385,6 +385,32 @@ export type EventMiddleware = (next: (event: ServerEvent) => void) => (event: Se
385
385
 
386
386
  // ---- Resolved address (from discovery) --------------------------------------
387
387
 
388
+ /** The values of the table below, before freezing. */
389
+ const resolveSourceValues = {
390
+ /** A `_ts3._udp` SRV record of the host named the address. */
391
+ SRV: "SRV",
392
+ /**
393
+ * A TSDNS server, found through a `_tsdns._tcp` SRV record of the host's
394
+ * domain, named the address.
395
+ */
396
+ TSDNSSRV: "TSDNS-SRV",
397
+ /** A TSDNS server on the host's domain, at its default port, named the address. */
398
+ TSDNSDirect: "TSDNS-Direct",
399
+ /**
400
+ * The address as given: an IP address, a name nothing else answered for, or
401
+ * any name once resolution ran out of time.
402
+ */
403
+ Direct: "Direct",
404
+ } as const;
405
+ /** How the built-in resolver found an address, as `ResolvedAddr` records it. */
406
+ export const ResolveSource: typeof resolveSourceValues =
407
+ /* @__PURE__ */ Object.freeze(resolveSourceValues);
408
+ /**
409
+ * One of {@link ResolveSource}. May gain members in a minor release: a
410
+ * `switch` over it needs a default case.
411
+ */
412
+ export type ResolveSource = (typeof ResolveSource)[keyof typeof ResolveSource];
413
+
388
414
  /**
389
415
  * An address a server's name resolved to. Only `addr` is needed to connect;
390
416
  * the rest describes the answer.
@@ -392,7 +418,10 @@ export type EventMiddleware = (next: (event: ServerEvent) => void) => (event: Se
392
418
  export interface ResolvedAddr {
393
419
  /** The endpoint, as `host:port`. */
394
420
  readonly addr: string;
395
- /** How it was found, such as `SRV`, `TSDNS-SRV`, `TSDNS-Direct` or `Direct`. */
421
+ /**
422
+ * How it was found. The built-in resolver sets one of `ResolveSource`; a
423
+ * plain string, since an `AddrResolver` of your own may set any.
424
+ */
396
425
  readonly source?: string | undefined;
397
426
  /** When the answer stops being valid; unset for no stated lifetime. */
398
427
  readonly expiry?: Date | undefined;
@@ -21,20 +21,35 @@ import {
21
21
  import { parseIconID } from "../core/internal.js";
22
22
  import { abortReason } from "./abort.js";
23
23
 
24
+ /** The values of the table below, before freezing. */
25
+ const viewStatusValues = {
26
+ /** This client has not tried to connect. */
27
+ Empty: "empty",
28
+ /**
29
+ * A connection is being made and the server has not finished its welcome.
30
+ * The view holds what has arrived, which is not yet the tree.
31
+ */
32
+ Loading: "loading",
33
+ /** The welcome is complete and the connection is up. The view follows the server's notifications. */
34
+ Live: "live",
35
+ /**
36
+ * The connection ended. The view still holds what it last knew, which no
37
+ * longer changes; the next `connect()` clears it.
38
+ */
39
+ Stale: "stale",
40
+ } as const;
24
41
  /**
25
42
  * Where a {@link ServerView} is in a connection's life.
26
43
  *
27
- * - `"empty"`: this client has not tried to connect.
28
- * - `"loading"`: a connection is being made and the server has not finished
29
- * its welcome. The view holds what has arrived, which is not yet the tree.
30
- * - `"live"`: the welcome is complete and the connection is up. The view
31
- * follows the server's notifications.
32
- * - `"stale"`: the connection ended. The view still holds what it last knew,
33
- * which no longer changes; the next `connect()` clears it.
44
+ * @experimental New in 1.x and may change in a minor release.
45
+ */
46
+ export const ViewStatus: typeof viewStatusValues = /* @__PURE__ */ Object.freeze(viewStatusValues);
47
+ /**
48
+ * One of {@link ViewStatus}.
34
49
  *
35
50
  * @experimental New in 1.x and may change in a minor release.
36
51
  */
37
- export type ViewStatus = "empty" | "loading" | "live" | "stale";
52
+ export type ViewStatus = (typeof ViewStatus)[keyof typeof ViewStatus];
38
53
 
39
54
  /**
40
55
  * What `viewReady` delivers.
@@ -322,7 +337,7 @@ export class ViewStore {
322
337
 
323
338
  #logger: Logger;
324
339
  #selfID: () => number;
325
- #status: ViewStatus = "empty";
340
+ #status: ViewStatus = ViewStatus.Empty;
326
341
  #revision = 0;
327
342
  #tree = ChannelTree.from([]);
328
343
  /** The `channellist` rows of the welcome in progress, in arrival order. */
@@ -36,7 +36,7 @@ import type { ChannelID, ClientDBID } from "../command/ids.js";
36
36
  import { asChannelID } from "../command/ids.js";
37
37
  import { NoDataError } from "../errors.js";
38
38
  import { ErrorCode } from "../errorcode.js";
39
- import type { Codec } from "../enums.js";
39
+ import type { BannerMode, Codec } from "../enums.js";
40
40
  import type { Permission } from "../permission.js";
41
41
 
42
42
  /**
@@ -111,8 +111,8 @@ export interface ChannelSettings {
111
111
  readonly namePhonetic?: string | undefined;
112
112
  /** The URL of the channel's banner image (`channel_banner_gfx_url`); needs `b_channel_modify_banner`. */
113
113
  readonly bannerURL?: string | undefined;
114
- /** How the banner is scaled (`channel_banner_mode`); needs `b_channel_modify_banner`. */
115
- readonly bannerMode?: number | undefined;
114
+ /** How the banner is fitted to the channel (`channel_banner_mode`); needs `b_channel_modify_banner`. */
115
+ readonly bannerMode?: BannerMode | undefined;
116
116
  }
117
117
 
118
118
  const settingNames: WireNames<ChannelSettings> = {