mqtt-json-rpc 3.0.0 → 3.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/README.md CHANGED
@@ -12,6 +12,16 @@ MQTT-JSON-RPC
12
12
  [![github (author stars)](https://img.shields.io/github/stars/rse?logo=github&label=author%20stars&color=%233377aa)](https://github.com/rse)
13
13
  [![github (author followers)](https://img.shields.io/github/followers/rse?label=author%20followers&logo=github&color=%234477aa)](https://github.com/rse)
14
14
 
15
+ > [!Note]
16
+ > This package is no longer actively developed, as it
17
+ > already evolved into a more sophisticated solution named
18
+ > [**MQTT+**](https://github.com/rse/mqtt-plus). **MQTT+**
19
+ > encodes packets as CBOR by default, uses an own packet format
20
+ > (allowing sender and receiver information), uses shorter NanoIDs
21
+ > instead of longer UUIDs for identification of sender, receiver and
22
+ > requests, and additionally provides bi-directional resource transfer
23
+ > via chunk streaming.
24
+
15
25
  Installation
16
26
  ------------
17
27
 
@@ -6391,7 +6391,7 @@ function requireMap() {
6391
6391
  * Returns a new Iterator object that contains the [key, value] pairs for
6392
6392
  * each element in the Map object in insertion order.
6393
6393
  *
6394
- * @returns {MapIterator<any>} Key value pairs.
6394
+ * @returns {MapIterator<[unknown, unknown]>} Key value pairs.
6395
6395
  * @yields {any[]} Key value pairs.
6396
6396
  */
6397
6397
  *entries() {
@@ -6403,7 +6403,7 @@ function requireMap() {
6403
6403
  * Returns a new Iterator object that contains the [key, value] pairs for
6404
6404
  * each element in the Map object in insertion order.
6405
6405
  *
6406
- * @returns {MapIterator<any>} Key value pairs.
6406
+ * @returns {MapIterator<[unknown, unknown]>} Key value pairs.
6407
6407
  */
6408
6408
  [Symbol.iterator]() {
6409
6409
  return this.entries();
@@ -7035,14 +7035,14 @@ class Codec {
7035
7035
  if (this.type === "cbor") {
7036
7036
  try {
7037
7037
  result = CBOR.encode(data);
7038
- } catch (_ex) {
7039
- throw new Error("failed to encode CBOR format");
7038
+ } catch (ex) {
7039
+ throw new Error("failed to encode CBOR format", { cause: ex });
7040
7040
  }
7041
7041
  } else if (this.type === "json") {
7042
7042
  try {
7043
7043
  result = JSON.stringify(data);
7044
- } catch (_ex) {
7045
- throw new Error("failed to encode JSON format");
7044
+ } catch (ex) {
7045
+ throw new Error("failed to encode JSON format", { cause: ex });
7046
7046
  }
7047
7047
  } else
7048
7048
  throw new Error("invalid format");
@@ -7053,14 +7053,14 @@ class Codec {
7053
7053
  if (this.type === "cbor" && typeof data === "object" && data instanceof Buffer) {
7054
7054
  try {
7055
7055
  result = CBOR.decode(data);
7056
- } catch (_ex) {
7057
- throw new Error("failed to decode CBOR format");
7056
+ } catch (ex) {
7057
+ throw new Error("failed to decode CBOR format", { cause: ex });
7058
7058
  }
7059
7059
  } else if (this.type === "json" && typeof data === "string") {
7060
7060
  try {
7061
7061
  result = JSON.parse(data);
7062
- } catch (_ex) {
7063
- throw new Error("failed to decode JSON format");
7062
+ } catch (ex) {
7063
+ throw new Error("failed to decode JSON format", { cause: ex });
7064
7064
  }
7065
7065
  } else
7066
7066
  throw new Error("invalid format or wrong data type");
@@ -6390,7 +6390,7 @@ function requireMap() {
6390
6390
  * Returns a new Iterator object that contains the [key, value] pairs for
6391
6391
  * each element in the Map object in insertion order.
6392
6392
  *
6393
- * @returns {MapIterator<any>} Key value pairs.
6393
+ * @returns {MapIterator<[unknown, unknown]>} Key value pairs.
6394
6394
  * @yields {any[]} Key value pairs.
6395
6395
  */
6396
6396
  *entries() {
@@ -6402,7 +6402,7 @@ function requireMap() {
6402
6402
  * Returns a new Iterator object that contains the [key, value] pairs for
6403
6403
  * each element in the Map object in insertion order.
6404
6404
  *
6405
- * @returns {MapIterator<any>} Key value pairs.
6405
+ * @returns {MapIterator<[unknown, unknown]>} Key value pairs.
6406
6406
  */
6407
6407
  [Symbol.iterator]() {
6408
6408
  return this.entries();
@@ -7034,14 +7034,14 @@ class Codec {
7034
7034
  if (this.type === "cbor") {
7035
7035
  try {
7036
7036
  result = CBOR.encode(data);
7037
- } catch (_ex) {
7038
- throw new Error("failed to encode CBOR format");
7037
+ } catch (ex) {
7038
+ throw new Error("failed to encode CBOR format", { cause: ex });
7039
7039
  }
7040
7040
  } else if (this.type === "json") {
7041
7041
  try {
7042
7042
  result = JSON.stringify(data);
7043
- } catch (_ex) {
7044
- throw new Error("failed to encode JSON format");
7043
+ } catch (ex) {
7044
+ throw new Error("failed to encode JSON format", { cause: ex });
7045
7045
  }
7046
7046
  } else
7047
7047
  throw new Error("invalid format");
@@ -7052,14 +7052,14 @@ class Codec {
7052
7052
  if (this.type === "cbor" && typeof data === "object" && data instanceof Buffer) {
7053
7053
  try {
7054
7054
  result = CBOR.decode(data);
7055
- } catch (_ex) {
7056
- throw new Error("failed to decode CBOR format");
7055
+ } catch (ex) {
7056
+ throw new Error("failed to decode CBOR format", { cause: ex });
7057
7057
  }
7058
7058
  } else if (this.type === "json" && typeof data === "string") {
7059
7059
  try {
7060
7060
  result = JSON.parse(data);
7061
- } catch (_ex) {
7062
- throw new Error("failed to decode JSON format");
7061
+ } catch (ex) {
7062
+ throw new Error("failed to decode JSON format", { cause: ex });
7063
7063
  }
7064
7064
  } else
7065
7065
  throw new Error("invalid format or wrong data type");
@@ -35,16 +35,16 @@ class Codec {
35
35
  try {
36
36
  result = CBOR.encode(data);
37
37
  }
38
- catch (_ex) {
39
- throw new Error("failed to encode CBOR format");
38
+ catch (ex) {
39
+ throw new Error("failed to encode CBOR format", { cause: ex });
40
40
  }
41
41
  }
42
42
  else if (this.type === "json") {
43
43
  try {
44
44
  result = JSON.stringify(data);
45
45
  }
46
- catch (_ex) {
47
- throw new Error("failed to encode JSON format");
46
+ catch (ex) {
47
+ throw new Error("failed to encode JSON format", { cause: ex });
48
48
  }
49
49
  }
50
50
  else
@@ -57,16 +57,16 @@ class Codec {
57
57
  try {
58
58
  result = CBOR.decode(data);
59
59
  }
60
- catch (_ex) {
61
- throw new Error("failed to decode CBOR format");
60
+ catch (ex) {
61
+ throw new Error("failed to decode CBOR format", { cause: ex });
62
62
  }
63
63
  }
64
64
  else if (this.type === "json" && typeof data === "string") {
65
65
  try {
66
66
  result = JSON.parse(data);
67
67
  }
68
- catch (_ex) {
69
- throw new Error("failed to decode JSON format");
68
+ catch (ex) {
69
+ throw new Error("failed to decode JSON format", { cause: ex });
70
70
  }
71
71
  }
72
72
  else