pmcf 6.3.9 → 6.4.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": "6.3.9",
3
+ "version": "6.4.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -52,17 +52,18 @@
52
52
  "dependencies": {
53
53
  "aggregated-map": "^1.0.7",
54
54
  "content-entry-transform": "^1.6.9",
55
- "ip-utilties": "^3.4.0",
55
+ "ip-utilties": "^3.5.3",
56
56
  "npm-pkgbuild": "^20.8.1",
57
57
  "pacc": "^10.4.1",
58
- "package-directory": "^8.2.0"
58
+ "package-directory": "^8.2.0",
59
+ "yaml": "^2.9.0"
59
60
  },
60
61
  "devDependencies": {
61
62
  "@types/node": "^26.1.1",
62
63
  "ava": "^8.0.1",
63
64
  "c8": "^11.0.0",
64
65
  "documentation": "^14.0.3",
65
- "semantic-release": "^25.0.5"
66
+ "semantic-release": "^25.0.6"
66
67
  },
67
68
  "overrides": {
68
69
  "c8": {
package/src/base.mjs CHANGED
@@ -260,7 +260,7 @@ export class Base {
260
260
  * @return {Iterable<[string,any]>} values
261
261
  */
262
262
  *attributeIterator(filter) {
263
- for (const [path, def] of extendingAttributeIterator(
263
+ for (const [path, attribute] of extendingAttributeIterator(
264
264
  this.constructor,
265
265
  filter
266
266
  )) {
@@ -268,7 +268,7 @@ export class Base {
268
268
  const value = this.attribute(name);
269
269
 
270
270
  if (value !== undefined) {
271
- yield [def.externalName ?? name, toExternal(value, def), path, def];
271
+ yield [attribute.externalName ?? name, toExternal(value, attribute), path, attribute];
272
272
  }
273
273
  }
274
274
  }
@@ -1,7 +1,6 @@
1
1
  import { join } from "node:path";
2
- import { FAMILY_IPV4, FAMILY_IPV6 } from "ip-utilties";
2
+ import { FAMILY_IPV4, FAMILY_IPV6, isLinkLocal } from "ip-utilties";
3
3
  import { FileContentProvider } from "npm-pkgbuild";
4
- import { isLinkLocal } from "ip-utilties";
5
4
  import { serviceEndpoints, addType, ExtraSourceService, FAMILY_UNIX } from "pmcf";
6
5
  import { writeLines } from "../utils.mjs";
7
6
 
@@ -1,13 +1,10 @@
1
1
  import { join } from "node:path";
2
+ import { stringify } from "yaml";
2
3
  import { FAMILY_IPV4, FAMILY_IPV6 } from "ip-utilties";
3
4
  import { FileContentProvider } from "npm-pkgbuild";
4
5
  import { boolean_attribute_writable_true } from "pacc";
5
6
  import { CoreService, addType } from "pmcf";
6
- import {
7
- writeLines,
8
- setionLinesFromPropertyIterator,
9
- filterConfigurable
10
- } from "../utils.mjs";
7
+ import { writeLines, filterConfigurable } from "../utils.mjs";
11
8
 
12
9
  export class influxdb extends CoreService {
13
10
  static attributes = {
@@ -49,8 +46,12 @@ export class influxdb extends CoreService {
49
46
  await writeLines(
50
47
  join(dir, "etc", "influxdb"),
51
48
  "config.yml",
52
- setionLinesFromPropertyIterator(
53
- this.attributeIterator(filterConfigurable)
49
+ stringify(
50
+ Object.fromEntries(
51
+ [...this.attributeIterator(filterConfigurable)].map(
52
+ ([name, value, path, attribute]) => [attribute.externalName, value]
53
+ )
54
+ )
54
55
  )
55
56
  );
56
57
 
@@ -1,5 +1,12 @@
1
+ import { join } from "node:path";
2
+ import { FileContentProvider } from "npm-pkgbuild";
1
3
  import { port_attribute, string_attribute_writable } from "pacc";
2
4
  import { CoreService, addType } from "pmcf";
5
+ import {
6
+ writeLines,
7
+ setionLinesFromAttributeIterator,
8
+ filterConfigurable
9
+ } from "../utils.mjs";
3
10
 
4
11
  export class mosquitto extends CoreService {
5
12
  static attributes = {
@@ -57,6 +64,16 @@ export class mosquitto extends CoreService {
57
64
  )
58
65
  );
59
66
 
67
+ packageData.sources.push(new FileContentProvider(dir + "/"));
68
+
69
+ await writeLines(
70
+ join(dir, "etc", "mosquitto"),
71
+ "moquitto.conf",
72
+ setionLinesFromAttributeIterator(
73
+ this.attributeIterator(filterConfigurable), " "
74
+ )
75
+ );
76
+
60
77
  yield packageData;
61
78
  }
62
79
  }
@@ -11,7 +11,7 @@ import {
11
11
  filterConfigurable,
12
12
  yesno,
13
13
  sectionLines,
14
- setionLinesFromPropertyIterator
14
+ setionLinesFromAttributeIterator
15
15
  } from "../utils.mjs";
16
16
 
17
17
  export class SystemdResolvedService extends ExtraSourceService {
@@ -110,7 +110,7 @@ export class SystemdResolvedService extends ExtraSourceService {
110
110
  return {
111
111
  serviceName: this.systemdService,
112
112
  configFileName: `etc/systemd/resolved.conf.d/${name}.conf`,
113
- //content: [...setionLinesFromPropertyIterator(this.attributeIterator( filterConfigurable)), "A=1"]
113
+ //content: [...setionLinesFromAttributeIterator(this.attributeIterator( filterConfigurable)), "A=1"]
114
114
  content: sectionLines("Resolve", {
115
115
  DNS: serviceEndpoints(this, options(300, 399, 4)),
116
116
  FallbackDNS: serviceEndpoints(this, options(100, 199, 4)),
package/src/utils.mjs CHANGED
@@ -77,12 +77,12 @@ export function sectionLines(sectionName, values) {
77
77
  return lines;
78
78
  }
79
79
 
80
- export function* setionLinesFromPropertyIterator(properties) {
80
+ export function* setionLinesFromAttributeIterator(properties, separator="=") {
81
81
  for (const [name, value, path, attribute] of properties) {
82
82
  if (attribute.attributes) {
83
83
  yield `[${name}]`;
84
84
  } else {
85
- yield `${name}=${value}`;
85
+ yield `${name}${separator}${value}`;
86
86
  }
87
87
  }
88
88
  }