node-ts 8.0.0 → 8.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/node-ts.d.ts CHANGED
@@ -9,14 +9,14 @@ type MapLike<T> = Record<string, T>;
9
9
  * Client that can be used to connect to a TeamSpeak server query API.
10
10
  */
11
11
  export declare class TeamSpeakClient extends EventEmitter {
12
- private readonly host;
13
- private readonly port;
14
12
  private queue;
15
13
  private _executing;
16
14
  private socket;
17
15
  private isConnected;
18
16
  private static readonly DefaultHost;
19
17
  private static readonly DefaultPort;
18
+ private readonly host;
19
+ private readonly port;
20
20
  /**
21
21
  * Creates a new instance of TeamSpeakClient for a specific remote host:port.
22
22
  * @param {string = TeamSpeakClient.DefaultHost} host Remote host of the TeamSpeak server. Can be an IP address or a host name.
package/lib/node-ts.js CHANGED
@@ -5,19 +5,19 @@
5
5
  import * as net from "node:net";
6
6
  import { EventEmitter } from "node:events";
7
7
  import { chunksToLinesAsync, chomp } from "@rauschma/stringio";
8
- import { escape, unescape } from "./queryStrings.js";
8
+ import { escapeQueryString, unescapeQueryString } from "./queryStrings.js";
9
9
  /**
10
10
  * Client that can be used to connect to a TeamSpeak server query API.
11
11
  */
12
12
  export class TeamSpeakClient extends EventEmitter {
13
- host;
14
- port;
15
13
  queue = [];
16
14
  _executing;
17
15
  socket;
18
16
  isConnected = false;
19
17
  static DefaultHost = "localhost";
20
18
  static DefaultPort = 10011;
19
+ host;
20
+ port;
21
21
  /**
22
22
  * Creates a new instance of TeamSpeakClient for a specific remote host:port.
23
23
  * @param {string = TeamSpeakClient.DefaultHost} host Remote host of the TeamSpeak server. Can be an IP address or a host name.
@@ -129,15 +129,15 @@ export class TeamSpeakClient extends EventEmitter {
129
129
  return Promise.reject(new Error("Empty command"));
130
130
  if (!this.isConnected)
131
131
  return Promise.reject(new Error("Not connected to any server. Call \"connect()\" before sending anything."));
132
- let tosend = escape(cmd);
132
+ let tosend = escapeQueryString(cmd);
133
133
  for (const v of options)
134
- tosend += ` -${escape(v)}`;
134
+ tosend += ` -${escapeQueryString(v)}`;
135
135
  for (const key in params) {
136
136
  if (!params.hasOwnProperty(key))
137
137
  continue;
138
138
  const value = params[key];
139
139
  if (!Array.isArray(value)) {
140
- tosend += ` ${escape(key.toString())}=${escape(value.toString())}`;
140
+ tosend += ` ${escapeQueryString(key.toString())}=${escapeQueryString(value.toString())}`;
141
141
  }
142
142
  }
143
143
  // Handle multiple arrays correctly
@@ -153,7 +153,7 @@ export class TeamSpeakClient extends EventEmitter {
153
153
  for (let i = 0; i < firstArray.length; ++i) {
154
154
  let segment = "";
155
155
  for (const key of arrayParamKeys) {
156
- segment += `${escape(key)}=${escape(params[key][i])} `;
156
+ segment += `${escapeQueryString(key)}=${escapeQueryString(params[key][i])} `;
157
157
  }
158
158
  escapedSegments += `${segment.slice(0, -1)}|`;
159
159
  }
@@ -208,8 +208,8 @@ export class TeamSpeakClient extends EventEmitter {
208
208
  thisrec[v] = "";
209
209
  continue;
210
210
  }
211
- const key = unescape(v.substr(0, v.indexOf("=")));
212
- const value = unescape(v.substr(v.indexOf("=") + 1));
211
+ const key = unescapeQueryString(v.substr(0, v.indexOf("=")));
212
+ const value = unescapeQueryString(v.substr(v.indexOf("=") + 1));
213
213
  thisrec[key] = (Number.parseInt(value, 10).toString() == value) ? Number.parseInt(value, 10) : value;
214
214
  }
215
215
  return thisrec;
@@ -3,10 +3,10 @@
3
3
  * @param {string} s The string to escape.
4
4
  * @return {string} An escaped string.
5
5
  */
6
- export declare function escape(s: string): string;
6
+ export declare function escapeQueryString(s: string): string;
7
7
  /**
8
8
  * Unescapes a string so it can be used for processing the response of the api.
9
9
  * @param {string} s The string to unescape.
10
10
  * @return {string} An unescaped string.
11
11
  */
12
- export declare function unescape(s: string): string;
12
+ export declare function unescapeQueryString(s: string): string;
@@ -3,7 +3,7 @@
3
3
  * @param {string} s The string to escape.
4
4
  * @return {string} An escaped string.
5
5
  */
6
- export function escape(s) {
6
+ export function escapeQueryString(s) {
7
7
  let r = String(s);
8
8
  r = r.replace(/\\/g, "\\\\"); // Backslash
9
9
  r = r.replace(/\//g, "\\/"); // Slash
@@ -21,7 +21,7 @@ export function escape(s) {
21
21
  * @param {string} s The string to unescape.
22
22
  * @return {string} An unescaped string.
23
23
  */
24
- export function unescape(s) {
24
+ export function unescapeQueryString(s) {
25
25
  let r = String(s);
26
26
  r = r.replace(/\\s/g, " "); // Whitespace
27
27
  r = r.replace(/\\p/g, "|"); // Pipe
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Niklas Mollenhauer <nikeee@outlook.com>",
3
3
  "name": "node-ts",
4
4
  "description": "TeamSpeak® 3 Server Query client for node.js implemented using TypeScript",
5
- "version": "8.0.0",
5
+ "version": "8.0.2",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git://github.com/nikeee/node-ts.git"
@@ -12,11 +12,11 @@
12
12
  "types": "lib/index.d.ts",
13
13
  "dependencies": {
14
14
  "@rauschma/stringio": "^1.4.0",
15
- "@types/node": "^22.13.1"
15
+ "@types/node": "^22.13.11"
16
16
  },
17
17
  "devDependencies": {
18
18
  "rimraf": "^6.0.1",
19
- "typescript": "^5.7.3"
19
+ "typescript": "^5.8.2"
20
20
  },
21
21
  "scripts": {
22
22
  "test": "tsc --noEmit",