pmcf 6.15.0 → 6.16.1

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/bin/pmcf-info CHANGED
@@ -23,7 +23,7 @@ function show(value, indent = 0, short = false) {
23
23
  prefix(l) + attribute.name.padEnd(ml) + ": ";
24
24
 
25
25
  if (short) {
26
- console.log(`${prefix()}${value.name}:`);
26
+ console.log(`${prefix()}${value[type.key]}:`);
27
27
  } else {
28
28
  console.log(`${prefix()}${value.fullName}(${type.name}):`);
29
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "6.15.0",
3
+ "version": "6.16.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "aggregated-map": "^1.0.8",
54
- "content-entry-transform": "^1.6.9",
54
+ "content-entry-transform": "^1.7.0",
55
55
  "ip-utilties": "^3.8.1",
56
56
  "npm-pkgbuild": "^20.8.6",
57
57
  "pacc": "^10.4.1",
@@ -8,10 +8,14 @@ import {
8
8
  FAMILY_IPV6
9
9
  } from "ip-utilties";
10
10
  import {
11
+ default_collection_attribute,
11
12
  default_collection_attribute_writable,
12
13
  default_attribute_writable,
13
14
  duration_attribute_writable,
15
+ name_attribute,
16
+ string_attribute,
14
17
  string_set_attribute_writable,
18
+ string_set_attribute,
15
19
  boolean_attribute_writable_true,
16
20
  boolean_attribute_writable_false,
17
21
  integer_attribute_writable,
@@ -39,6 +43,34 @@ import { owner_attribute } from "../common-attributes.mjs";
39
43
 
40
44
  const bindNetworkAddressTypes = networkAddressType + "|bind_group";
41
45
 
46
+ class zone extends Base {
47
+ static priority = 1;
48
+ static key = "id";
49
+ static attributes = {
50
+ id: { ...name_attribute, name: "id" },
51
+ file: { ...string_attribute, name: "file" },
52
+ records: { ...string_set_attribute, name: "records" }
53
+ };
54
+
55
+ static {
56
+ addType(this);
57
+ }
58
+
59
+ records = new Set();
60
+
61
+ get domain() {
62
+ return this.id;
63
+ }
64
+
65
+ get directory() {
66
+ return this.source.name;
67
+ }
68
+
69
+ get file() {
70
+ return `${this.directory}/${this.domain}.zone`;
71
+ }
72
+ }
73
+
42
74
  class bind_group extends Base {
43
75
  static priority = 1;
44
76
  static attributes = {
@@ -64,6 +96,12 @@ class bind_group extends Base {
64
96
  type: networkAddressType + "|owner",
65
97
  name: "entries"
66
98
  },
99
+ zones: {
100
+ ...default_collection_attribute,
101
+ type: zone,
102
+ backpointer: owner_attribute,
103
+ name: "zones"
104
+ },
67
105
  sharedWith: {
68
106
  ...default_attribute_writable,
69
107
  name: "sharedWith",
@@ -171,6 +209,43 @@ class bind_group extends Base {
171
209
  ];
172
210
  }
173
211
 
212
+ get zones() {
213
+ const zs = new Map();
214
+
215
+ for (const source of this.entries) {
216
+ for (const domain of source.localDomains) {
217
+ const config = {
218
+ name: `${domain}.zone.conf`,
219
+ type: this.service.serverType,
220
+ zones: []
221
+ };
222
+
223
+ const z = new zone();
224
+
225
+ z.id = domain;
226
+ z.source = source;
227
+ z.owner = this;
228
+ z.config = config;
229
+ z.records = new Set(this.defaultRecords);
230
+
231
+ zs.set(z.id, z);
232
+
233
+ config.zones.push(z);
234
+
235
+ for (const {
236
+ address,
237
+ subnet,
238
+ networkInterface,
239
+ domainNames,
240
+ family
241
+ } of source.networkAddresses()) {
242
+ // console.log(address);
243
+ }
244
+ }
245
+ }
246
+ return zs;
247
+ }
248
+
174
249
  async packageContent(outputControl) {
175
250
  outputControl.packageData.sources.push(
176
251
  ...(await Array.fromAsync(
package/src/subnet.mjs CHANGED
@@ -54,12 +54,8 @@ export class Subnet {
54
54
  }
55
55
  }
56
56
 
57
- value(name) {
58
- const value = getAttribute(this, name);
59
-
60
- console.log("SUBNET VALUE", name, value);
61
-
62
- return value;
57
+ attribute(name) {
58
+ return getAttribute(this, name);
63
59
  }
64
60
 
65
61
  *_walkDirections(directions, seen) {}