pmcf 1.59.1 → 1.59.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.59.1",
3
+ "version": "1.59.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -203,8 +203,22 @@ export class Base {
203
203
  }
204
204
  }
205
205
 
206
+ named(name)
207
+ {
208
+ }
209
+
206
210
  typeNamed(typeName, name) {
207
- return this.owner?.typeNamed(typeName, name);
211
+ if (this.owner) {
212
+ const object = this.owner.typeNamed(typeName, name); // TODO split
213
+ if(object) {
214
+ return object;
215
+ }
216
+ }
217
+
218
+ const object = this.named(name);
219
+ if(object?.typeName === typeName) {
220
+ return object;
221
+ }
208
222
  }
209
223
 
210
224
  addObject(object) {
package/src/cluster.mjs CHANGED
@@ -15,8 +15,8 @@ const ClusterTypeDefinition = {
15
15
  };
16
16
 
17
17
  export class Cluster extends Owner {
18
- masters = new Set();
19
- backups = new Set();
18
+ #masters = new Set();
19
+ #backups = new Set();
20
20
 
21
21
  static {
22
22
  addType(this);
@@ -31,6 +31,26 @@ export class Cluster extends Owner {
31
31
  this.read(data, ClusterTypeDefinition);
32
32
  }
33
33
 
34
+ set masters(value)
35
+ {
36
+ this.#masters.add(value);
37
+ }
38
+
39
+ get masters()
40
+ {
41
+ return this.#masters;
42
+ }
43
+
44
+ set backups(value)
45
+ {
46
+ this.#backups.add(value);
47
+ }
48
+
49
+ get backups()
50
+ {
51
+ return this.#backups;
52
+ }
53
+
34
54
  get packageName() {
35
55
  return `${this.constructor.typeDefinition.name}-${this.owner.name}-${this.name}`;
36
56
  }
@@ -51,7 +71,7 @@ export class Cluster extends Owner {
51
71
  " auth_pass pass1234",
52
72
  " }",
53
73
  " virtual_ipaddress {",
54
- " 192.168.1.250",
74
+ ` ${ni.rawAddress}`,
55
75
  " }",
56
76
  "}"
57
77
  ];
package/src/host.mjs CHANGED
@@ -431,6 +431,10 @@ export class NetworkInterface extends Base {
431
431
  }
432
432
  }
433
433
 
434
+ get rawAddress() {
435
+ return this.rawAddresses[0];
436
+ }
437
+
434
438
  get rawAddresses() {
435
439
  return [...this.#ipAddresses].map(([address]) => address);
436
440
  }
package/src/owner.mjs CHANGED
@@ -223,15 +223,15 @@ export class Owner extends Base {
223
223
  this.#bridges.add(bridge);
224
224
  }
225
225
 
226
- for (const name of asIterator(destinationNetworks)) {
227
- const other = this.networkNamed(name);
226
+ for (const nameOrNetwork of asIterator(destinationNetworks)) {
227
+ const other = nameOrNetwork instanceof Owner ? nameOrNetwork : this.networkNamed(nameOrNetwork);
228
228
  if (other) {
229
229
  if (!bridge.has(other)) {
230
230
  bridge.add(other);
231
231
  other.bridge = bridge;
232
232
  }
233
233
  } else {
234
- bridge.add(name);
234
+ bridge.add(nameOrNetwork);
235
235
  this.finalize(() => this._resolveBridges());
236
236
  }
237
237
  }
package/types/base.d.mts CHANGED
@@ -46,6 +46,7 @@ export class Base {
46
46
  name: string;
47
47
  ownerFor(property: any, data: any): any;
48
48
  read(data: any, type: any): void;
49
+ named(name: any): void;
49
50
  typeNamed(typeName: any, name: any): any;
50
51
  addObject(object: any): any;
51
52
  forOwner(owner: any): any;
@@ -371,7 +371,10 @@ export class Cluster extends Owner {
371
371
  };
372
372
  };
373
373
  };
374
- masters: Set<any>;
375
- backups: Set<any>;
374
+ set masters(value: Set<any>);
375
+ get masters(): Set<any>;
376
+ set backups(value: Set<any>);
377
+ get backups(): Set<any>;
378
+ #private;
376
379
  }
377
380
  import { Owner } from "./owner.mjs";
package/types/host.d.mts CHANGED
@@ -310,6 +310,7 @@ export class NetworkInterface extends Base {
310
310
  addSubnet(address: any): any;
311
311
  set ipAddresses(value: Map<any, any>);
312
312
  get ipAddresses(): Map<any, any>;
313
+ get rawAddress(): any;
313
314
  get rawAddresses(): any[];
314
315
  get cidrAddresses(): any[];
315
316
  get rawIPv4Addresses(): any[];