mqtt-plus 1.4.22 → 1.4.23

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/.ase/service.log CHANGED
@@ -26,3 +26,24 @@ ase: [2026-05-14 17:11:46.437]: [INFO]: mcp: POST /mcp [initialize]
26
26
  ase: [2026-05-14 17:11:46.451]: [INFO]: mcp: POST /mcp [notifications/initialized]
27
27
  ase: [2026-05-14 17:11:46.453]: [INFO]: mcp: POST /mcp [tools/list]
28
28
  ase: [2026-05-14 17:11:46.456]: [INFO]: mcp: GET /mcp
29
+ ase: [2026-05-14 17:42:46.329]: [INFO]: service: idle timeout reached, stopping
30
+ ase: [2026-06-08 17:52:21.737]: [INFO]: service: listening on port 43130
31
+ ase: [2026-06-08 17:52:21.839]: [INFO]: mcp: POST /mcp [initialize]
32
+ ase: [2026-06-08 17:52:21.856]: [INFO]: mcp: POST /mcp [notifications/initialized]
33
+ ase: [2026-06-08 17:52:21.859]: [INFO]: mcp: POST /mcp [tools/list]
34
+ ase: [2026-06-08 17:52:21.864]: [INFO]: mcp: GET /mcp
35
+ ase: [2026-06-08 20:09:05.091]: [INFO]: mcp: POST /mcp [initialize]
36
+ ase: [2026-06-08 20:09:05.111]: [INFO]: mcp: POST /mcp [notifications/initialized]
37
+ ase: [2026-06-08 20:09:05.114]: [INFO]: mcp: POST /mcp [tools/list]
38
+ ase: [2026-06-08 20:09:05.118]: [INFO]: mcp: GET /mcp
39
+ ase: [2026-06-08 20:14:06.973]: [INFO]: mcp: GET /mcp
40
+ ase: [2026-06-08 20:19:08.840]: [INFO]: mcp: GET /mcp
41
+ ase: [2026-06-08 20:24:10.717]: [INFO]: mcp: GET /mcp
42
+ ase: [2026-06-08 20:27:23.946]: [INFO]: mcp: POST /mcp [initialize]
43
+ ase: [2026-06-08 20:27:23.954]: [INFO]: mcp: POST /mcp [notifications/initialized]
44
+ ase: [2026-06-08 20:27:23.957]: [INFO]: mcp: POST /mcp [tools/list]
45
+ ase: [2026-06-08 20:27:23.960]: [INFO]: mcp: GET /mcp
46
+ ase: [2026-06-08 20:29:30.052]: [INFO]: mcp: POST /mcp [initialize]
47
+ ase: [2026-06-08 20:29:30.063]: [INFO]: mcp: POST /mcp [notifications/initialized]
48
+ ase: [2026-06-08 20:29:30.065]: [INFO]: mcp: POST /mcp [tools/list]
49
+ ase: [2026-06-08 20:29:30.073]: [INFO]: mcp: GET /mcp
package/.ase/service.yaml CHANGED
@@ -1 +1 @@
1
- port: 42082
1
+ port: 43130
package/CHANGELOG.md CHANGED
@@ -2,10 +2,12 @@
2
2
  ChangeLog
3
3
  =========
4
4
 
5
- 1.4.22 (2026-05-14)
5
+ 1.4.22 (2026-06-08)
6
6
  -------------------
7
7
 
8
+ - IMPROVEMENT: derive instance id from MQTT client's clientId when none is explicitly provided
8
9
  - UPDATE: upgrade NPM dependencies
10
+ - CLEANUP: add .ase directory to .gitignore
9
11
 
10
12
  1.4.21 (2026-05-13)
11
13
  -------------------
@@ -21,6 +21,7 @@
21
21
  ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
22
  ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
23
  */
24
+ import { nanoid } from "nanoid";
24
25
  import { TraceTrait } from "./mqtt-plus-trace";
25
26
  import { ensureError } from "./mqtt-plus-error";
26
27
  import { PLazy } from "./mqtt-plus-util";
@@ -55,6 +56,18 @@ export class BaseTrait extends TraceTrait {
55
56
  }
56
57
  /* store MQTT client */
57
58
  this.mqtt = mqtt;
59
+ /* resolve the instance "id": if the user did not provide an
60
+ explicit one, fetch the "clientId" from the underlying MQTT
61
+ client, and only as a last resort fall back to a generated id
62
+ (e.g. for the fake proxy MQTT client without a real clientId) */
63
+ if (this.options.id === "") {
64
+ const clientId = mqtt.isFakeProxy
65
+ ? undefined
66
+ : mqtt.options?.clientId;
67
+ this.options.id = (typeof clientId === "string" && clientId !== "")
68
+ ? clientId
69
+ : nanoid();
70
+ }
58
71
  /* hook into the MQTT message processing */
59
72
  this.log("info", "hooking into MQTT client");
60
73
  this.messageHandler = (topic, message, packet) => {
@@ -21,15 +21,13 @@
21
21
  ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
22
  ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
23
  */
24
- /* external requirements */
25
- import { nanoid } from "nanoid";
26
24
  /* Options trait */
27
25
  export class OptionsTrait {
28
26
  /* construct API class */
29
27
  constructor(options = {}) {
30
28
  /* determine options and provide defaults */
31
29
  this.options = {
32
- id: nanoid(),
30
+ id: "", /* intentionally resolved later in BaseTrait */
33
31
  codec: "cbor",
34
32
  timeout: 10 * 1000,
35
33
  share: "",
@@ -402,7 +402,7 @@ function run(...args) {
402
402
  var OptionsTrait = class {
403
403
  constructor(options = {}) {
404
404
  this.options = {
405
- id: (0, nanoid.nanoid)(),
405
+ id: "",
406
406
  codec: "cbor",
407
407
  timeout: 10 * 1e3,
408
408
  share: "",
@@ -931,6 +931,10 @@ var BaseTrait = class extends TraceTrait {
931
931
  } });
932
932
  }
933
933
  this.mqtt = mqtt;
934
+ if (this.options.id === "") {
935
+ const clientId = mqtt.isFakeProxy ? void 0 : mqtt.options?.clientId;
936
+ this.options.id = typeof clientId === "string" && clientId !== "" ? clientId : (0, nanoid.nanoid)();
937
+ }
934
938
  this.log("info", "hooking into MQTT client");
935
939
  this.messageHandler = (topic, message, packet) => {
936
940
  if (this.destroyed) return;
@@ -375,7 +375,7 @@ function run(...args) {
375
375
  var OptionsTrait = class {
376
376
  constructor(options = {}) {
377
377
  this.options = {
378
- id: nanoid(),
378
+ id: "",
379
379
  codec: "cbor",
380
380
  timeout: 10 * 1e3,
381
381
  share: "",
@@ -904,6 +904,10 @@ var BaseTrait = class extends TraceTrait {
904
904
  } });
905
905
  }
906
906
  this.mqtt = mqtt;
907
+ if (this.options.id === "") {
908
+ const clientId = mqtt.isFakeProxy ? void 0 : mqtt.options?.clientId;
909
+ this.options.id = typeof clientId === "string" && clientId !== "" ? clientId : nanoid();
910
+ }
907
911
  this.log("info", "hooking into MQTT client");
908
912
  this.messageHandler = (topic, message, packet) => {
909
913
  if (this.destroyed) return;