pmcf 2.27.0 → 2.28.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/bin/pmcf-diagram CHANGED
@@ -9,38 +9,27 @@ const location = await root.load(args[0]);
9
9
  function q(str) {
10
10
  return str.match(/^\w+$/) ? str : `"${str}"`;
11
11
  }
12
- function id(str) {
13
- return q(str.replaceAll(/-/g, ""));
14
- }
15
12
 
16
13
  console.log("graph G {");
17
14
  console.log(" node [shape=record];");
18
15
  for await (const host of location.hosts()) {
19
16
  console.log(
20
- ` ${id(host.name)} [label="${host.name}|{${[
17
+ ` ${q(host.name)} [label="${host.name}|{${[
21
18
  ...host.networkInterfaces.values()
22
19
  ]
23
20
  .filter(ni => !ni.isTemplate && ni.kind !== "loopback")
24
- .map(ni => `<${id(ni.name)}> ${ni.name}`)
21
+ .map(ni => `<${q(ni.name)}> ${ni.name}`)
25
22
  .join("|")}}"];`
26
23
  );
27
24
  }
28
25
 
29
26
  for await (const network of location.networks()) {
30
27
  console.log(
31
- ` ${id(network.name)} [label="${network.name}\\n${[...network.subnets()]
28
+ ` ${q(network.name)} [label="${network.name}\\n${[...network.subnets()]
32
29
  .map(s => s.address)
33
30
  .join(" ")}" shape=circle];`
34
31
  );
35
32
 
36
- if (network.bridge) {
37
- for (const n of network.bridge) {
38
- if (n !== network) {
39
- console.log(` ${id(network.name)} -- ${id(n.name)};`);
40
- }
41
- }
42
- }
43
-
44
33
  for await (const na of network.networkAddresses(
45
34
  na =>
46
35
  na.networkInterface.network === network &&
@@ -48,11 +37,19 @@ for await (const network of location.networks()) {
48
37
  na.networkInterface.kind !== "loopback"
49
38
  )) {
50
39
  console.log(
51
- ` ${id(network.name)} -- ${id(na.networkInterface.host.name)}:${id(
40
+ ` ${q(network.name)} -- ${q(na.networkInterface.host.name)}:${q(
52
41
  na.networkInterface.name
53
42
  )}[label="${na.address}"];`
54
43
  );
55
44
  }
56
45
  }
57
46
 
47
+ for await (const cluster of location.clusters()) {
48
+ console.log(` ${[...cluster.members].map(b => `${q(b.host.name)}:${b.name}`).join(" -- ")};`);
49
+ }
50
+
51
+ for (const bridge of location.bridges) {
52
+ console.log(` ${[...bridge].map(b => q(b.name)).join(" -- ")};`);
53
+ }
54
+
58
55
  console.log("}");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.27.0",
3
+ "version": "2.28.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/cluster.mjs CHANGED
@@ -4,7 +4,6 @@ import { Owner } from "./owner.mjs";
4
4
  import { Host } from "./host.mjs";
5
5
  import { addType } from "./types.mjs";
6
6
  import { writeLines } from "./utils.mjs";
7
- import { cidrAddresses } from "./network-support.mjs";
8
7
 
9
8
  const ClusterTypeDefinition = {
10
9
  name: "cluster",
package/src/owner.mjs CHANGED
@@ -214,6 +214,11 @@ export class Owner extends Base {
214
214
  return this.typeList("cluster");
215
215
  }
216
216
 
217
+ get bridges()
218
+ {
219
+ return this._bridges;
220
+ }
221
+
217
222
  addBridge(network, destinationNetworks) {
218
223
  if (destinationNetworks) {
219
224
  let bridge;
package/types/owner.d.mts CHANGED
@@ -152,6 +152,7 @@ export class Owner extends Base {
152
152
  subnetForAddress(address: any): any;
153
153
  clusterNamed(name: any): any;
154
154
  clusters(): any;
155
+ get bridges(): Set<any>;
155
156
  addBridge(network: any, destinationNetworks: any): any;
156
157
  _resolveBridges(): void;
157
158
  get derivedPackaging(): Set<any>;