pmcf 6.29.2 → 6.30.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.29.2",
3
+ "version": "6.30.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -52,7 +52,7 @@
52
52
  "dependencies": {
53
53
  "aggregated-map": "^1.0.10",
54
54
  "content-entry-transform": "^1.7.0",
55
- "ip-utilties": "^3.12.0",
55
+ "ip-utilties": "^3.13.0",
56
56
  "npm-pkgbuild": "^20.8.15",
57
57
  "pacc": "^11.2.2",
58
58
  "package-directory": "^8.2.0",
@@ -1,7 +1,13 @@
1
1
  import { join } from "node:path";
2
2
  import { createHmac } from "node:crypto";
3
3
  import { FileContentProvider } from "npm-pkgbuild";
4
- import { reverseArpa, FAMILY_IPV4, FAMILY_IPV6 } from "ip-utilties";
4
+ import {
5
+ reverseArpa,
6
+ FAMILY_IPV4,
7
+ FAMILY_IPV6,
8
+ ADDRESS_TYPE_LOOPBACK,
9
+ addressType
10
+ } from "ip-utilties";
5
11
  import {
6
12
  default_collection_attribute,
7
13
  default_collection_attribute_writable,
@@ -127,8 +133,12 @@ class bind_zone_config extends Base {
127
133
 
128
134
  /** @type {bind_zone[]} */ zones = [];
129
135
 
136
+ get service() {
137
+ return this.owner.service;
138
+ }
139
+
130
140
  get type() {
131
- return this.owner.service.serverType;
141
+ return this.service.serverType;
132
142
  }
133
143
 
134
144
  constructor(owner, name) {
@@ -156,12 +166,35 @@ class bind_zone_config extends Base {
156
166
  } else {
157
167
  content.push(` type ${this.type};`);
158
168
  content.push(` file \"${zone.file}\";`);
159
- if(this.type === 'secondary') {
160
- content.push(`# primaries {};`);
169
+
170
+ switch (this.type) {
171
+ case "primary":
172
+ content.push(
173
+ addressesStatement(
174
+ "allow-update",
175
+ group.allowUpdate,
176
+ "none;",
177
+ " "
178
+ )
179
+ );
180
+ break;
181
+ case "secondary":
182
+ const primaries = [...this.service.primaries]
183
+ .map(e => e.endpoints())
184
+ .flat()
185
+ .filter(
186
+ e =>
187
+ e.networkAddress &&
188
+ addressType(e.networkAddress.address) !==
189
+ ADDRESS_TYPE_LOOPBACK
190
+ )
191
+ .map(e => e.networkAddress.address);
192
+
193
+ content.push(
194
+ ...addressesStatement(". primaries", primaries, false, " ")
195
+ );
196
+ break;
161
197
  }
162
- content.push(
163
- addressesStatement("allow-update", group.allowUpdate, "none;", " ")
164
- );
165
198
  content.push(` notify ${yesno(group.notify)};`);
166
199
  }
167
200
  content.push(`};`, "");
@@ -221,7 +254,9 @@ export class bind_acl extends bind_object {
221
254
  async packageContent(outputControl) {
222
255
  const acls = addressesStatement(
223
256
  `acl ${this.name}`,
224
- addresses(this.entries, { aggregate: true })
257
+ addresses(this.entries, { aggregate: true }),
258
+ "any;",
259
+ " "
225
260
  );
226
261
 
227
262
  if (acls.length) {
@@ -582,25 +617,22 @@ class bind_group extends bind_object {
582
617
  function addressesStatement(prefix, objects, empty = false, indent = "") {
583
618
  const body = asArray(objects).map(value => {
584
619
  if (typeof value !== "string") {
585
- if (value.name) {
586
- value = value.name;
587
- } else {
588
- value = value.address;
589
-
590
- // console.log(value);
591
- //value = [...value];
592
- }
620
+ return value.name ?? value.address;
593
621
  }
594
622
 
595
- return `${indent}${value};`;
623
+ return value;
596
624
  });
597
625
 
598
- if (body.length) {
599
- return [`${indent}${prefix} {`, body, `${indent}};`];
626
+ if (body.length > 0) {
627
+ if (body.length < 3) {
628
+ return [`${prefix} {${body.map(b => ` ${b};`).join("")} };`];
629
+ }
630
+
631
+ return [`${prefix} {`, body.map(b => `${indent}${b};`), `${indent}};`];
600
632
  }
601
633
 
602
634
  if (empty) {
603
- return [`${indent}${prefix} {`, indent + " " + empty, `${indent}};`];
635
+ return [`${prefix} { ${empty} };`];
604
636
  }
605
637
 
606
638
  return [];