pmcf 6.34.0 → 6.34.2

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/README.md CHANGED
@@ -78,29 +78,29 @@ generates config packages for:
78
78
  * [domainNames](#domainnames)
79
79
  * [InitializationContext](#initializationcontext)
80
80
  * [Parameters](#parameters-14)
81
- * [SkeletonNetworkInterface](#skeletonnetworkinterface)
82
- * [networkAddresses](#networkaddresses)
83
- * [Parameters](#parameters-15)
84
81
  * [zones](#zones)
85
82
  * [addressesStatement](#addressesstatement)
86
- * [Parameters](#parameters-16)
83
+ * [Parameters](#parameters-15)
87
84
  * [SystemdJournalRemoteService](#systemdjournalremoteservice)
88
85
  * [Properties](#properties)
89
86
  * [systemdConfigs](#systemdconfigs)
90
- * [Parameters](#parameters-17)
87
+ * [Parameters](#parameters-16)
91
88
  * [SystemdJournalUploadService](#systemdjournaluploadservice)
92
89
  * [Properties](#properties-1)
93
90
  * [systemdConfigs](#systemdconfigs-1)
94
- * [Parameters](#parameters-18)
91
+ * [Parameters](#parameters-17)
95
92
  * [NetworkAddress](#networkaddress)
96
- * [Parameters](#parameters-19)
93
+ * [Parameters](#parameters-18)
97
94
  * [subnet](#subnet)
98
95
  * [networkInterface](#networkinterface)
99
96
  * [address](#address)
100
97
  * [addresses](#addresses)
101
- * [Parameters](#parameters-20)
98
+ * [Parameters](#parameters-19)
102
99
  * [cidrAddresses](#cidraddresses)
103
- * [Parameters](#parameters-21)
100
+ * [Parameters](#parameters-20)
101
+ * [SkeletonNetworkInterface](#skeletonnetworkinterface)
102
+ * [networkAddresses](#networkaddresses)
103
+ * [Parameters](#parameters-21)
104
104
  * [families](#families)
105
105
  * [secretName](#secretname)
106
106
  * [directHosts](#directhosts)
@@ -295,18 +295,6 @@ Keeps track of all in flight object creations and loose ends during config initi
295
295
 
296
296
  * `directory` (optional, default `"/"`)
297
297
 
298
- ## SkeletonNetworkInterface
299
-
300
- **Extends ServiceOwner**
301
-
302
- ### networkAddresses
303
-
304
- #### Parameters
305
-
306
- * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
307
-
308
- Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
309
-
310
298
  ## zones
311
299
 
312
300
  Type: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<bind\_zone>
@@ -397,6 +385,18 @@ Returns **Iterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Re
397
385
 
398
386
  Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;
399
387
 
388
+ ## SkeletonNetworkInterface
389
+
390
+ **Extends ServiceOwner**
391
+
392
+ ### networkAddresses
393
+
394
+ #### Parameters
395
+
396
+ * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
397
+
398
+ Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
399
+
400
400
  ## families
401
401
 
402
402
  Returns **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;
@@ -450,6 +450,8 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl
450
450
 
451
451
  ## asArray
452
452
 
453
+ Convert scalar or iterable into Array.
454
+
453
455
  ### Parameters
454
456
 
455
457
  * `value` **any**&#x20;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "6.34.0",
3
+ "version": "6.34.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -53,7 +53,7 @@
53
53
  "aggregated-map": "^1.0.10",
54
54
  "content-entry-transform": "^1.7.1",
55
55
  "ip-utilties": "^3.13.0",
56
- "npm-pkgbuild": "^20.8.15",
56
+ "npm-pkgbuild": "^20.9.0",
57
57
  "pacc": "^11.2.3",
58
58
  "package-directory": "^8.2.0",
59
59
  "yaml": "^2.9.0"
package/src/base.mjs CHANGED
@@ -21,7 +21,8 @@ import {
21
21
  string_attribute_writable,
22
22
  string_set_attribute_writable,
23
23
  description_attribute_writable,
24
- boolean_attribute_writable
24
+ boolean_attribute_writable,
25
+ object_attribute
25
26
  } from "pacc";
26
27
  import { union } from "./utils.mjs";
27
28
  import { addType } from "pmcf";
@@ -43,14 +44,18 @@ export class Base {
43
44
  description: description_attribute_writable,
44
45
  type: type_attribute_writable,
45
46
  directory: { ...string_attribute_writable, name: "directory" },
46
- packaging: { ...string_set_attribute_writable, name: "packaging" },
47
47
  enabled: { ...boolean_attribute_writable, name: "enabled" },
48
48
  tags: { ...string_set_attribute_writable, name: "tags" },
49
- template: { ...boolean_attribute_writable, name: "template", private: true }
49
+ template: {
50
+ ...boolean_attribute_writable,
51
+ name: "template",
52
+ private: true
53
+ },
54
+
55
+ packaging: { ...string_set_attribute_writable, name: "packaging" },
56
+ // packageContentProperties: { ...object_attribute, writable: true, name: "packageContentProperties"}
50
57
  };
51
- /*asMapEntry = (attribute, value, object) => {
52
- console.log("asMapEntry",attribute?.name,value);
53
- return [value.name, value]; };*/
58
+
54
59
  static {
55
60
  addType(this);
56
61
  }
@@ -553,6 +558,15 @@ export class Base {
553
558
  ];
554
559
  }
555
560
 
561
+ /**
562
+ *
563
+ * @param {string} dir
564
+ * @returns {Object}
565
+ */
566
+ templateContentAttributes(dir) {
567
+ return { dir, pattern: "**/*" };
568
+ }
569
+
556
570
  /**
557
571
  *
558
572
  * @param {*} entryProperties
@@ -567,7 +581,7 @@ export class Base {
567
581
  if ((await stat(dir)).isDirectory) {
568
582
  yield transform(
569
583
  new FileContentProvider(
570
- { dir, pattern: "**/*" },
584
+ this.templateContentAttributes(dir),
571
585
  entryProperties,
572
586
  directoryProperties
573
587
  ),
package/src/host.mjs CHANGED
@@ -3,7 +3,6 @@ import { join } from "node:path";
3
3
  import { FileContentProvider } from "npm-pkgbuild";
4
4
  import { AggregatedMap } from "aggregated-map";
5
5
  import {
6
- default_collection_attribute_writable,
7
6
  string_attribute,
8
7
  string_attribute_writable,
9
8
  string_set_attribute_writable,
@@ -79,6 +78,7 @@ export class Host extends ServiceOwner {
79
78
  replaces: { ...string_set_attribute_writable, name: "replaces" },
80
79
  depends: { ...string_set_attribute_writable, name: "depends" },
81
80
  provides: { ...string_set_attribute_writable, name: "provides" },
81
+ optional: { ...string_set_attribute_writable, name: "optional" },
82
82
  extends: {
83
83
  ...extends_attribute,
84
84
  type: Host
@@ -71,7 +71,7 @@ export class InitializationContext {
71
71
  }
72
72
  if (value !== undefined) {
73
73
  if (typeof value === "object") {
74
- if (attribute.type && value instanceof attribute.type) {
74
+ if (typeof attribute.type === 'function' && value instanceof attribute.type) {
75
75
  return assign(attribute, object, value);
76
76
  }
77
77
  } else {
@@ -1,13 +1,7 @@
1
1
  import { join } from "node:path";
2
2
  import { createHmac } from "node:crypto";
3
3
  import { FileContentProvider } from "npm-pkgbuild";
4
- import {
5
- reverseArpa,
6
- FAMILY_IPV4,
7
- FAMILY_IPV6,
8
- ADDRESS_TYPE_LOOPBACK,
9
- addressType
10
- } from "ip-utilties";
4
+ import { reverseArpa, ADDRESS_TYPE_LOOPBACK, addressType } from "ip-utilties";
11
5
  import {
12
6
  default_collection_attribute,
13
7
  default_collection_attribute_writable,
@@ -798,6 +792,22 @@ export class bind extends CoreService {
798
792
  return false;
799
793
  }
800
794
 
795
+ templateContentAttributes(dir) {
796
+ const attr = super.templateContentAttributes(dir);
797
+
798
+ // attr.properties = this.packageContentProperties;
799
+
800
+ attr.properties = {
801
+ "usr/share/libalpm/scripts/*": { mode: "0777" },
802
+ "etc/named/**/*": { user: "named", group: "named" },
803
+ "var/lib/named": { user: "named", group: "named" }
804
+ };
805
+
806
+ console.log("templateContentAttributes", this.fullName, attr);
807
+
808
+ return attr;
809
+ }
810
+
801
811
  async *preparePackages(dir) {
802
812
  const permissions = this.packageContentPermissions;
803
813
  const packageData = this.packageData;
package/src/utils.mjs CHANGED
@@ -92,6 +92,7 @@ export function bridgeToJSON(bridge) {
92
92
  }
93
93
 
94
94
  /**
95
+ * Convert scalar or iterable into Array.
95
96
  * @param {any} value
96
97
  * @returns {Array<any>}
97
98
  */
@@ -124,7 +125,7 @@ export function asIterator(value) {
124
125
  return [value];
125
126
  }
126
127
 
127
- if (typeof value[Symbol.iterator] === "function") {
128
+ if (value[Symbol.iterator]) {
128
129
  return value;
129
130
  }
130
131