pmcf 3.1.2 → 3.2.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.1.2",
3
+ "version": "3.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,5 +1,6 @@
1
1
  import { join } from "node:path";
2
2
  import { FileContentProvider } from "npm-pkgbuild";
3
+ import { boolean_attribute_writeable_true } from "pacc";
3
4
  import { writeLines } from "../utils.mjs";
4
5
  import { addType } from "../types.mjs";
5
6
  import { Service, ServiceTypeDefinition } from "../service.mjs";
@@ -10,7 +11,12 @@ const InfluxdbServiceTypeDefinition = {
10
11
  owners: ServiceTypeDefinition.owners,
11
12
  extends: ServiceTypeDefinition,
12
13
  priority: 0.1,
13
- properties: {},
14
+ properties: {
15
+ "metrics-disabled": {
16
+ ...boolean_attribute_writeable_true,
17
+ isCommonOption: true
18
+ }
19
+ },
14
20
  service: {
15
21
  endpoints: [
16
22
  {
@@ -64,7 +70,12 @@ export class InfluxdbService extends Service {
64
70
  }
65
71
  };
66
72
 
67
- const lines = ["metrics-disabled: true"];
73
+ const lines = Object.entries(InfluxdbServiceTypeDefinition.properties)
74
+ .filter(
75
+ ([key, attribute]) =>
76
+ attribute.isCommonOption && this[key] !== undefined
77
+ )
78
+ .map(([key]) => `${key}: ${this[key]}`);
68
79
 
69
80
  await writeLines(join(dir, "etc", "influxdb"), "config.yml", lines);
70
81
 
@@ -1,5 +1,10 @@
1
1
  import { join } from "node:path";
2
2
  import { FileContentProvider } from "npm-pkgbuild";
3
+ import {
4
+ boolean_attribute_writeable_true,
5
+ boolean_attribute_writeable_false
6
+ } from "pacc";
7
+
3
8
  import { writeLines } from "../utils.mjs";
4
9
  import { addType } from "../types.mjs";
5
10
  import { Service, ServiceTypeDefinition } from "../service.mjs";
@@ -10,7 +15,16 @@ const MosquittoServiceTypeDefinition = {
10
15
  owners: ServiceTypeDefinition.owners,
11
16
  extends: ServiceTypeDefinition,
12
17
  priority: 0.1,
13
- properties: {},
18
+ properties: {
19
+ log_timestamp: {
20
+ ...boolean_attribute_writeable_false,
21
+ isCommonOption: true
22
+ },
23
+ allow_anonymous: {
24
+ ...boolean_attribute_writeable_false,
25
+ isCommonOption: true
26
+ }
27
+ },
14
28
  service: {
15
29
  extends: ["mqtt"]
16
30
  }
@@ -51,16 +65,21 @@ export class MosquittoService extends Service {
51
65
  }
52
66
  };
53
67
 
68
+ const lines = Object.entries(MosquittoServiceTypeDefinition.properties)
69
+ .filter(
70
+ ([key, attribute]) =>
71
+ attribute.isCommonOption && this[key] !== undefined
72
+ )
73
+ .map(([key]) => `${key}: ${this[key]}`);
74
+
54
75
  const endpoint = this.endpoint("mqtt");
55
76
 
56
- const lines = [
77
+ lines.push(
57
78
  `listener ${endpoint.port}`,
58
- "log_timestamp false",
59
- "allow_anonymous true",
60
79
  "persistence_location /var/lib/mosquitto",
61
80
  "password_file /etc/mosquitto/passwd",
62
81
  "acl_file /etc/mosquitto/acl"
63
- ];
82
+ );
64
83
 
65
84
  await writeLines(join(dir, "etc", "mosquitto"), "mosquitto.conf", lines);
66
85
 
@@ -537,7 +537,23 @@ export class InfluxdbService extends Service {
537
537
  };
538
538
  };
539
539
  priority: number;
540
- properties: {};
540
+ properties: {
541
+ "metrics-disabled": {
542
+ isCommonOption: boolean;
543
+ type: string;
544
+ isKey: boolean;
545
+ writable: boolean;
546
+ mandatory: boolean;
547
+ collection: boolean;
548
+ private?: boolean;
549
+ depends?: string;
550
+ description?: string;
551
+ default?: any;
552
+ set?: Function;
553
+ get?: Function;
554
+ env?: string[] | string;
555
+ };
556
+ };
541
557
  service: {
542
558
  endpoints: {
543
559
  family: string;
@@ -537,7 +537,38 @@ export class MosquittoService extends Service {
537
537
  };
538
538
  };
539
539
  priority: number;
540
- properties: {};
540
+ properties: {
541
+ log_timestamp: {
542
+ isCommonOption: boolean;
543
+ type: string;
544
+ isKey: boolean;
545
+ writable: boolean;
546
+ mandatory: boolean;
547
+ collection: boolean;
548
+ private?: boolean;
549
+ depends?: string;
550
+ description?: string;
551
+ default?: any;
552
+ set?: Function;
553
+ get?: Function;
554
+ env?: string[] | string;
555
+ };
556
+ allow_anonymous: {
557
+ isCommonOption: boolean;
558
+ type: string;
559
+ isKey: boolean;
560
+ writable: boolean;
561
+ mandatory: boolean;
562
+ collection: boolean;
563
+ private?: boolean;
564
+ depends?: string;
565
+ description?: string;
566
+ default?: any;
567
+ set?: Function;
568
+ get?: Function;
569
+ env?: string[] | string;
570
+ };
571
+ };
541
572
  service: {
542
573
  extends: string[];
543
574
  };