pmcf 3.21.2 → 3.22.0

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": "pmcf",
3
- "version": "3.21.2",
3
+ "version": "3.22.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,8 +1,13 @@
1
1
  import { join } from "node:path";
2
2
  import { FileContentProvider } from "npm-pkgbuild";
3
- import { boolean_attribute_writable_true, addType } from "pacc";
3
+ import {
4
+ boolean_attribute_writable_true,
5
+ port_attribute,
6
+ string_attribute_writable,
7
+ addType
8
+ } from "pacc";
4
9
  import { addServiceType } from "pmcf";
5
- import { writeLines } from "../utils.mjs";
10
+ import { writeLines, filterConfigurable } from "../utils.mjs";
6
11
  import { Service, ServiceTypeDefinition } from "../service.mjs";
7
12
 
8
13
  const MosquittoServiceTypeDefinition = {
@@ -12,13 +17,30 @@ const MosquittoServiceTypeDefinition = {
12
17
  owners: ServiceTypeDefinition.owners,
13
18
  key: "name",
14
19
  attributes: {
15
- log_timestamp: {
20
+ /*log_timestamp: {
16
21
  ...boolean_attribute_writable_true,
17
- isCommonOption: true
22
+ configurable: true
18
23
  },
19
24
  allow_anonymous: {
20
25
  ...boolean_attribute_writable_true,
21
- isCommonOption: true
26
+ configurable: true
27
+ },*/
28
+ listener: {
29
+ ...port_attribute,
30
+ writable: true,
31
+ configurable: true
32
+ },
33
+ persistence_location: {
34
+ ...string_attribute_writable,
35
+ configurable: true
36
+ },
37
+ password_file: {
38
+ ...string_attribute_writable,
39
+ configurable: true
40
+ },
41
+ acl_file: {
42
+ ...string_attribute_writable,
43
+ configurable: true
22
44
  }
23
45
  },
24
46
  service: {
@@ -40,6 +62,10 @@ export class MosquittoService extends Service {
40
62
  return MosquittoServiceTypeDefinition.name;
41
63
  }
42
64
 
65
+ get listener() {
66
+ return this.endpoint("mqtt").port;
67
+ }
68
+
43
69
  async *preparePackages(dir) {
44
70
  const host = this.host;
45
71
  const name = host.name;
@@ -56,24 +82,14 @@ export class MosquittoService extends Service {
56
82
  }
57
83
  };
58
84
 
59
- const lines = Object.entries(MosquittoServiceTypeDefinition.attributes)
60
- .filter(
61
- ([key, attribute]) =>
62
- attribute.isCommonOption && this[key] !== undefined
85
+ await writeLines(
86
+ join(dir, "etc", "mosquitto"),
87
+ "mosquitto.conf",
88
+ Object.entries(this.getProperties(filterConfigurable)).map(
89
+ ([name, value]) => `${name} ${value}`
63
90
  )
64
- .map(([key]) => `${key}: ${this[key]}`);
65
-
66
- const endpoint = this.endpoint("mqtt");
67
-
68
- lines.push(
69
- `listener ${endpoint.port}`,
70
- "persistence_location /var/lib/mosquitto",
71
- "password_file /etc/mosquitto/passwd",
72
- "acl_file /etc/mosquitto/acl"
73
91
  );
74
92
 
75
- await writeLines(join(dir, "etc", "mosquitto"), "mosquitto.conf", lines);
76
-
77
93
  yield packageData;
78
94
  }
79
95
  }
@@ -743,8 +743,52 @@ export class MosquittoService extends Service {
743
743
  })[];
744
744
  key: string;
745
745
  attributes: {
746
- log_timestamp: {
747
- isCommonOption: boolean;
746
+ listener: {
747
+ writable: boolean;
748
+ configurable: boolean;
749
+ type: object;
750
+ isKey: boolean;
751
+ mandatory: boolean;
752
+ collection: boolean;
753
+ private?: boolean;
754
+ credential?: boolean;
755
+ persistent?: boolean;
756
+ depends?: string;
757
+ description?: string;
758
+ default?: any;
759
+ set?: Function;
760
+ get?: Function;
761
+ toInternal?: Function;
762
+ toExternal?: Function;
763
+ values?: Set<any>;
764
+ externalName?: string;
765
+ env?: string[] | string;
766
+ additionalValues?: object;
767
+ };
768
+ persistence_location: {
769
+ configurable: boolean;
770
+ type: object;
771
+ isKey: boolean;
772
+ writable: boolean;
773
+ mandatory: boolean;
774
+ collection: boolean;
775
+ private?: boolean;
776
+ credential?: boolean;
777
+ persistent?: boolean;
778
+ depends?: string;
779
+ description?: string;
780
+ default?: any;
781
+ set?: Function;
782
+ get?: Function;
783
+ toInternal?: Function;
784
+ toExternal?: Function;
785
+ values?: Set<any>;
786
+ externalName?: string;
787
+ env?: string[] | string;
788
+ additionalValues?: object;
789
+ };
790
+ password_file: {
791
+ configurable: boolean;
748
792
  type: object;
749
793
  isKey: boolean;
750
794
  writable: boolean;
@@ -765,8 +809,8 @@ export class MosquittoService extends Service {
765
809
  env?: string[] | string;
766
810
  additionalValues?: object;
767
811
  };
768
- allow_anonymous: {
769
- isCommonOption: boolean;
812
+ acl_file: {
813
+ configurable: boolean;
770
814
  type: object;
771
815
  isKey: boolean;
772
816
  writable: boolean;
@@ -793,6 +837,7 @@ export class MosquittoService extends Service {
793
837
  };
794
838
  };
795
839
  get type(): string;
840
+ get listener(): any;
796
841
  preparePackages(dir: any): AsyncGenerator<{
797
842
  dir: any;
798
843
  sources: FileContentProvider[];