pmcf 6.40.6 → 6.41.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/README.md CHANGED
@@ -82,29 +82,29 @@ generates config packages for:
82
82
  * [domainNames](#domainnames)
83
83
  * [InitializationContext](#initializationcontext)
84
84
  * [Parameters](#parameters-14)
85
+ * [SkeletonNetworkInterface](#skeletonnetworkinterface)
86
+ * [networkAddresses](#networkaddresses)
87
+ * [Parameters](#parameters-15)
85
88
  * [zones](#zones)
86
89
  * [addressesStatement](#addressesstatement)
87
- * [Parameters](#parameters-15)
90
+ * [Parameters](#parameters-16)
88
91
  * [SystemdJournalRemoteService](#systemdjournalremoteservice)
89
92
  * [Properties](#properties)
90
93
  * [systemdConfigs](#systemdconfigs)
91
- * [Parameters](#parameters-16)
94
+ * [Parameters](#parameters-17)
92
95
  * [SystemdJournalUploadService](#systemdjournaluploadservice)
93
96
  * [Properties](#properties-1)
94
97
  * [systemdConfigs](#systemdconfigs-1)
95
- * [Parameters](#parameters-17)
98
+ * [Parameters](#parameters-18)
96
99
  * [NetworkAddress](#networkaddress)
97
- * [Parameters](#parameters-18)
100
+ * [Parameters](#parameters-19)
98
101
  * [subnet](#subnet)
99
102
  * [networkInterface](#networkinterface)
100
103
  * [address](#address)
101
104
  * [addresses](#addresses)
102
- * [Parameters](#parameters-19)
103
- * [cidrAddresses](#cidraddresses)
104
105
  * [Parameters](#parameters-20)
105
- * [SkeletonNetworkInterface](#skeletonnetworkinterface)
106
- * [networkAddresses](#networkaddresses)
107
- * [Parameters](#parameters-21)
106
+ * [cidrAddresses](#cidraddresses)
107
+ * [Parameters](#parameters-21)
108
108
  * [families](#families)
109
109
  * [secretName](#secretname)
110
110
  * [directHosts](#directhosts)
@@ -309,6 +309,18 @@ Keeps track of all in flight object creations and loose ends during config initi
309
309
 
310
310
  * `directory` (optional, default `"/"`)
311
311
 
312
+ ## SkeletonNetworkInterface
313
+
314
+ **Extends ServiceOwner**
315
+
316
+ ### networkAddresses
317
+
318
+ #### Parameters
319
+
320
+ * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
321
+
322
+ Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
323
+
312
324
  ## zones
313
325
 
314
326
  Type: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<bind\_zone>
@@ -399,18 +411,6 @@ Returns **Iterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Re
399
411
 
400
412
  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;
401
413
 
402
- ## SkeletonNetworkInterface
403
-
404
- **Extends ServiceOwner**
405
-
406
- ### networkAddresses
407
-
408
- #### Parameters
409
-
410
- * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
411
-
412
- Returns **Iterable<[NetworkAddress](#networkaddress)>**&#x20;
413
-
414
414
  ## families
415
415
 
416
416
  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;
package/bin/pmcf-package CHANGED
@@ -43,7 +43,9 @@ const publishingDetails = createPublishingDetails(
43
43
 
44
44
  let suffixId = 1;
45
45
 
46
- for (const object of [...args.map(arg => root.expression(arg))].flat()) {
46
+ for (const object of [
47
+ ...args.map(arg => asArray(root.expression(arg)))
48
+ ].flat()) {
47
49
  if (object.isTemplate) {
48
50
  continue;
49
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "6.40.6",
3
+ "version": "6.41.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/content.mjs CHANGED
@@ -155,7 +155,7 @@ export class content extends core {
155
155
  get packaging() {
156
156
  const all = this.unionFromDirections(["this", "extends"], "_packaging");
157
157
  if (all.size === 0) {
158
- const content = this.host.content;
158
+ const content = this.host?.content;
159
159
  if (content && content !== this) {
160
160
  return content.packaging;
161
161
  }
@@ -1,4 +1,9 @@
1
- import { FAMILY_IPV4, FAMILY_IPV6 } from "ip-utilties";
1
+ import {
2
+ FAMILY_IPV4,
3
+ FAMILY_IPV6,
4
+ ADDRESS_TYPE_LOOPBACK,
5
+ addressType
6
+ } from "ip-utilties";
2
7
  import {
3
8
  string_attribute_writable,
4
9
  number_attribute_writable,
@@ -380,3 +385,19 @@ export function serviceEndpoints(sources, options = {}) {
380
385
 
381
386
  return options.join ? res.join(options.join) : res;
382
387
  }
388
+
389
+ export function endpoints(entries) {
390
+ return asArray(entries)
391
+ .map(e => e.endpoints())
392
+ .flat();
393
+ }
394
+
395
+ export function endpointAddresses(entries) {
396
+ return endpoints(entries)
397
+ .filter(
398
+ e =>
399
+ e.networkAddress &&
400
+ addressType(e.networkAddress.address) !== ADDRESS_TYPE_LOOPBACK
401
+ )
402
+ .map(e => e.networkAddress.address);
403
+ }
package/src/host.mjs CHANGED
@@ -314,7 +314,7 @@ export class Host extends ServiceOwner {
314
314
  const packageData = await this.packageData;
315
315
 
316
316
  packageData.sources.push(
317
- await Array.fromAsync(this.templateContent()),
317
+ ...await Array.fromAsync(this.templateContent()),
318
318
  new FileContentProvider({
319
319
  dir,
320
320
  pattern: ["**/*", "**/.ssh/*"],
@@ -1,7 +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 { reverseArpa, ADDRESS_TYPE_LOOPBACK, addressType } from "ip-utilties";
4
+ import { reverseArpa } from "ip-utilties";
5
5
  import {
6
6
  default_collection_attribute,
7
7
  default_collection_attribute_writable,
@@ -22,6 +22,7 @@ import {
22
22
  base,
23
23
  CoreService,
24
24
  Endpoint,
25
+ endpointAddresses,
25
26
  addresses,
26
27
  networkAddressType,
27
28
  addType,
@@ -188,6 +189,8 @@ class bind_zone_config extends base {
188
189
  " "
189
190
  )
190
191
  );
192
+
193
+ // content.push(`update-policy { grant updates zonesub ANY; };`);
191
194
  break;
192
195
  case SECONDARY:
193
196
  const primaries = endpointAddresses(this.service.primaries);
@@ -647,18 +650,6 @@ class bind_view extends bind_object {
647
650
  }
648
651
  }
649
652
 
650
- function endpointAddresses(entries) {
651
- return asArray(entries)
652
- .map(e => e.endpoints())
653
- .flat()
654
- .filter(
655
- e =>
656
- e.networkAddress &&
657
- addressType(e.networkAddress.address) !== ADDRESS_TYPE_LOOPBACK
658
- )
659
- .map(e => e.networkAddress.address);
660
- }
661
-
662
653
  /**
663
654
  *
664
655
  * @param {string} prefix
@@ -802,7 +793,9 @@ export class bind extends CoreService {
802
793
  async *preparePackages(dir) {
803
794
  const packageData = await this.packageData;
804
795
 
805
- packageData.sources = await Array.fromAsync(this.templateContent());
796
+ packageData.sources.push(
797
+ ...(await Array.fromAsync(this.templateContent()))
798
+ );
806
799
 
807
800
  let hasContent = packageData.sources.length > 0;
808
801
 
@@ -10,13 +10,16 @@ import {
10
10
  string_attribute_writable,
11
11
  number_attribute_writable,
12
12
  boolean_attribute_writable_true,
13
+ default_collection_attribute_writable,
13
14
  extendingAttributeIterator
14
15
  } from "pacc";
15
16
  import {
16
17
  addType,
17
18
  CoreService,
19
+ Endpoint,
20
+ endpointAddresses,
18
21
  sortDescendingByPriority,
19
- serviceEndpoints,
22
+ endpoints,
20
23
  SUBNET_LOCALHOST_IPV4,
21
24
  SUBNET_LOCALHOST_IPV6,
22
25
  FAMILY_UNIX
@@ -25,6 +28,12 @@ import { writeLines } from "../utils.mjs";
25
28
 
26
29
  export class kea extends CoreService {
27
30
  static attributes = {
31
+ dnsServers: {
32
+ ...default_collection_attribute_writable,
33
+ type: Endpoint,
34
+ name: "dnsServers",
35
+ deferredExpression: true
36
+ },
28
37
  "ddns-send-updates": {
29
38
  ...boolean_attribute_writable_true,
30
39
  name: "ddns-send-updates",
@@ -146,14 +155,22 @@ export class kea extends CoreService {
146
155
 
147
156
  //console.log(source.fullName, [...source.hosts.keys()]);
148
157
 
149
- const dnsServerEndpoints = serviceEndpoints(source, {
150
- services: "services[types[dns] && priority>=300]",
151
- endpoints: endpoint => endpoint.networkInterface?.kind !== "loopback"
152
- });
158
+ const dnsServerEndpoints = endpoints(this.dnsServers).filter(
159
+ e => e.networkInterface?.kind !== "loopback"
160
+ );
153
161
 
154
162
  const packageData = await this.packageData;
155
163
 
156
- packageData.sources.push(new FileContentProvider(dir + "/"));
164
+ packageData.sources.push(
165
+ ...(await Array.fromAsync(this.templateContent()))
166
+ );
167
+
168
+ packageData.sources.push(
169
+ new FileContentProvider({
170
+ dir: dir + "/",
171
+ permissions: this.content?.permissions
172
+ })
173
+ );
157
174
 
158
175
  const peers = async family =>
159
176
  Array.from(
package/src/subnet.mjs CHANGED
@@ -77,7 +77,7 @@ export class Subnet extends core {
77
77
  return [
78
78
  this.family === FAMILY_IPV6
79
79
  ? this.cidr
80
- : rangeIP(this.prefix, this.prefixLength, 51, 6).map(a => decodeIP(a))
80
+ : rangeIP(this.prefix, this.prefixLength, 51, 20).map(a => decodeIP(a))
81
81
  ];
82
82
  }
83
83