pmcf 6.32.2 → 6.32.4

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.32.2",
3
+ "version": "6.32.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -100,22 +100,28 @@ export class Base {
100
100
  }
101
101
 
102
102
  materializeExtends() {
103
- /*
104
- console.log(
105
- "materializeExtends",
106
- this.fullName,
107
- this.owner?.fullName,
108
- [...this.extends].map(n => n.fullName)
109
- );*/
110
-
111
103
  for (const [path, attribute] of extendingAttributeIterator(
112
104
  this.constructor,
113
- attribute =>
114
- attribute.collection &&
115
- !attribute.type.primitive &&
116
- !attribute.deferredExpression
105
+ attribute => attribute.collection && !attribute.type.primitive
117
106
  )) {
107
+ if (attribute.deferredExpression) {
108
+ const name = attribute.name;
109
+ if (!this.hasOwnProperty(name)) {
110
+ for (const e of this.walkDirections(["extends"])) {
111
+ if (e.hasOwnProperty(name)) {
112
+ Object.defineProperty(this, name, {
113
+ get: () => e[name]
114
+ });
115
+ break;
116
+ }
117
+ }
118
+ }
119
+
120
+ continue;
121
+ }
122
+
118
123
  const collection = this[attribute.name];
124
+
119
125
  if (typeof collection?.get === "function") {
120
126
  for (const [name, extending] of this.mapFromDirections(
121
127
  ["extends"],
@@ -191,16 +191,7 @@ class bind_zone_config extends Base {
191
191
  );
192
192
  break;
193
193
  case "secondary":
194
- const primaries = [...this.service.primaries]
195
- .map(e => e.endpoints())
196
- .flat()
197
- .filter(
198
- e =>
199
- e.networkAddress &&
200
- addressType(e.networkAddress.address) !==
201
- ADDRESS_TYPE_LOOPBACK
202
- )
203
- .map(e => e.networkAddress.address);
194
+ const primaries = endpointAddresses(this.service.primaries);
204
195
 
205
196
  content.push(
206
197
  ...addressesStatement(" primaries", primaries, false, " ")
@@ -649,6 +640,29 @@ class bind_group extends bind_object {
649
640
  }
650
641
  }
651
642
 
643
+ function endpointAddresses(entries) {
644
+ if (entries === undefined) {
645
+ return [];
646
+ }
647
+
648
+ /*
649
+ [...this.forwarders]
650
+ .map(e => e.endpoints())
651
+ .flat()
652
+ .filter(e => e.networkAddress)
653
+ .map(e => e.networkAddress?.address);
654
+ */
655
+ return [...entries]
656
+ .map(e => e.endpoints())
657
+ .flat()
658
+ .filter(
659
+ e =>
660
+ e.networkAddress &&
661
+ addressType(e.networkAddress.address) !== ADDRESS_TYPE_LOOPBACK
662
+ )
663
+ .map(e => e.networkAddress.address);
664
+ }
665
+
652
666
  /**
653
667
  *
654
668
  * @param {string} prefix
@@ -784,17 +798,13 @@ export class bind extends CoreService {
784
798
  async writeForwarders(outputControl) {
785
799
  // TODO formulate everything as pacc expression
786
800
 
787
- /*
801
+ /*
788
802
  console.log("F",this.extends);
789
803
  console.log("F0",this.fullName);
790
804
  console.log("F1",this.forwarders);
791
805
  */
792
- const forwarders = [...this.forwarders]
793
- .map(e => e.endpoints())
794
- .flat()
795
- .filter(e => e.networkAddress)
796
- .map(e => e.networkAddress?.address);
797
-
806
+ const forwarders = endpointAddresses(this.forwarders);
807
+
798
808
  if (forwarders.length) {
799
809
  await writeLines(
800
810
  join(outputControl.dir, "etc/named/options"),