@kronos-integration/service-mqtt 3.3.3 → 3.3.5
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 +3 -3
- package/src/service-mqtt.mjs +6 -3
- package/tests/mqtt-ava.mjs +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/service-mqtt",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target es2024 --lib es2024 -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@kronos-integration/service": "^13.1.
|
|
39
|
+
"@kronos-integration/service": "^13.1.10",
|
|
40
40
|
"mqtt": "^5.13.3",
|
|
41
|
-
"pacc": "^
|
|
41
|
+
"pacc": "^4.2.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"ava": "^6.4.1",
|
package/src/service-mqtt.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
prepareAttributesDefinitions,
|
|
3
|
-
|
|
3
|
+
string_attribute,
|
|
4
4
|
url_attribute,
|
|
5
5
|
boolean_attribute,
|
|
6
6
|
username_attribute,
|
|
@@ -37,12 +37,12 @@ export class ServiceMQTT extends Service {
|
|
|
37
37
|
needsRestart: true
|
|
38
38
|
},
|
|
39
39
|
keepalive: {
|
|
40
|
-
...
|
|
40
|
+
...integer_attribute,
|
|
41
41
|
default: 60,
|
|
42
42
|
isConnectionOption: true
|
|
43
43
|
},
|
|
44
44
|
clean: { ...boolean_attribute, isConnectionOption: true },
|
|
45
|
-
clientId: { ...
|
|
45
|
+
clientId: { ...string_attribute, isConnectionOption: true },
|
|
46
46
|
connectTimeout: { ...timeout_attribute, isConnectionOption: true },
|
|
47
47
|
reconnectPeriod: {
|
|
48
48
|
...integer_attribute,
|
|
@@ -113,6 +113,9 @@ export class ServiceMQTT extends Service {
|
|
|
113
113
|
if (ep) {
|
|
114
114
|
ep.send(message);
|
|
115
115
|
}
|
|
116
|
+
else {
|
|
117
|
+
this.error(`no endpoint for topic ${topic}`);
|
|
118
|
+
}
|
|
116
119
|
});
|
|
117
120
|
}
|
|
118
121
|
|
package/tests/mqtt-ava.mjs
CHANGED
|
@@ -16,7 +16,8 @@ test("factory", async t => {
|
|
|
16
16
|
url: "mqtt://localhost",
|
|
17
17
|
endpoints: {
|
|
18
18
|
s1: { topic: true, connected: r1 },
|
|
19
|
-
s2: { topic: "s2b", connected: r1 }
|
|
19
|
+
s2: { topic: "s2b", connected: r1 },
|
|
20
|
+
"s2/*/a": { topic: true, connected: r1 }
|
|
20
21
|
}
|
|
21
22
|
});
|
|
22
23
|
|
|
@@ -25,7 +26,7 @@ test("factory", async t => {
|
|
|
25
26
|
t.is(mqtt.endpoints["s1"].name, "s1");
|
|
26
27
|
t.is(mqtt.endpoints["s2"].name, "s2");
|
|
27
28
|
t.true(mqtt.endpoints["s1"] instanceof TopicEndpoint);
|
|
28
|
-
t.deepEqual(mqtt.topics, ["s1", "s2b"]);
|
|
29
|
+
t.deepEqual(mqtt.topics, ["s1", "s2b", "s2/*/a"]);
|
|
29
30
|
});
|
|
30
31
|
|
|
31
32
|
test("start / stop", async t => {
|