@kronos-integration/service-mqtt 1.0.6 → 1.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kronos-integration/service-mqtt",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "@kronos-integration/service": "^11.2.15",
40
40
  "model-attributes": "^4.3.0",
41
- "mqtt": "^5.13.2"
41
+ "mqtt": "^5.13.3"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@kronos-integration/test-interceptor": "^7.0.29",
@@ -1,4 +1,7 @@
1
- import { mergeAttributeDefinitions, prepareAttributesDefinitions } from "model-attributes";
1
+ import {
2
+ mergeAttributeDefinitions,
3
+ prepareAttributesDefinitions
4
+ } from "model-attributes";
2
5
  import { Service } from "@kronos-integration/service";
3
6
  import { connect } from "mqtt";
4
7
  import { TopicEndpoint } from "./topic-endpoint.mjs";
@@ -76,7 +79,9 @@ export class ServiceMQTT extends Service {
76
79
  }
77
80
 
78
81
  get topics() {
79
- return Object.keys(this.endpoints).filter(e => e.topic);
82
+ return Object.values(this.endpoints)
83
+ .filter(e => e.topic)
84
+ .map(e => e.name);
80
85
  }
81
86
 
82
87
  /**
@@ -117,6 +122,7 @@ export class ServiceMQTT extends Service {
117
122
  }
118
123
 
119
124
  async _stop() {
125
+ await this.client.endAsync();
120
126
  return super._stop();
121
127
  }
122
128
  }
@@ -1,5 +1,4 @@
1
1
  import { SendReceiveEndpoint } from "@kronos-integration/endpoint";
2
- import { Service } from "@kronos-integration/service";
3
2
 
4
3
  export class TopicEndpoint extends SendReceiveEndpoint {
5
4
  constructor(name, owner, options) {
@@ -19,6 +19,5 @@ test("endpoint factory", async t => {
19
19
 
20
20
  t.is(mqtt.endpoints["s1"].name, "s1");
21
21
  t.true(mqtt.endpoints["s1"] instanceof TopicEndpoint);
22
-
23
- // t.deepEqual(mqtt.topics, ["s1"]);
22
+ t.deepEqual(mqtt.topics, ["s1"]);
24
23
  });
@@ -6,7 +6,7 @@ export class ServiceMQTT extends Service {
6
6
  get options(): {
7
7
  [k: string]: any;
8
8
  };
9
- get topics(): string[];
9
+ get topics(): any[];
10
10
  /**
11
11
  * On demand create TopicEndpoint.
12
12
  * @param {string} name