@kronos-integration/service-mqtt 3.2.2 → 3.3.1

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": "3.2.2",
3
+ "version": "3.3.1",
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.3",
39
+ "@kronos-integration/service": "^13.1.4",
40
40
  "mqtt": "^5.13.3",
41
- "pacc": "^3.11.1"
41
+ "pacc": "^3.13.2"
42
42
  },
43
43
  "devDependencies": {
44
44
  "ava": "^6.4.1",
@@ -3,7 +3,8 @@ import {
3
3
  default_attribute,
4
4
  url_attribute,
5
5
  boolean_attribute,
6
- secret_attribute,
6
+ username_attribute,
7
+ password_attribute,
7
8
  timeout_attribute
8
9
  } from "pacc";
9
10
  import { Service } from "@kronos-integration/service";
@@ -34,14 +35,20 @@ export class ServiceMQTT extends Service {
34
35
  description: "url of the mqtt server",
35
36
  needsRestart: true
36
37
  },
37
- clean: boolean_attribute,
38
- clientId: default_attribute,
39
- connectTimeout: timeout_attribute,
38
+ keepalive: {
39
+ ...default_attribute,
40
+ default: 60,
41
+ isConnectionOption: true
42
+ },
43
+ clean: { ...boolean_attribute, isConnectionOption: true },
44
+ clientId: { ...default_attribute, isConnectionOption: true },
45
+ connectTimeout: { ...timeout_attribute, isConnectionOption: true },
40
46
  reconnectPeriod: {
47
+ isConnectionOption: true,
41
48
  type: "integer"
42
49
  },
43
- username: secret_attribute,
44
- password: secret_attribute
50
+ username: username_attribute,
51
+ password: password_attribute
45
52
  },
46
53
  Service.attributes
47
54
  );
@@ -77,13 +84,16 @@ export class ServiceMQTT extends Service {
77
84
  await super._start();
78
85
 
79
86
  const options = Object.fromEntries(
80
- ["clean", "clientId", "connectTimeout", "reconnectPeriod"]
81
- .filter(key => this[key] !== undefined)
82
- .map(key => [key, this[key]])
87
+ Object.entries(this.attributes)
88
+ .filter(
89
+ ([name, attribute]) =>
90
+ attribute.isConnectionOption && this[name] !== undefined
91
+ )
92
+ .map(([name]) => [name, this[name]])
83
93
  );
84
94
 
85
- options.password = await this.getCredential("password");
86
95
  options.username = await this.getCredential("username");
96
+ options.password = await this.getCredential("password");
87
97
 
88
98
  const client = connect(this.url, options);
89
99