pmcf 1.50.1 → 1.52.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": "1.50.1",
3
+ "version": "1.52.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/cluster.mjs CHANGED
@@ -1,21 +1,32 @@
1
1
  import { Owner } from "./owner.mjs";
2
2
  import { addType } from "./types.mjs";
3
3
 
4
- const typeDefinition = {
4
+ const ClusterTypeDefinition = {
5
5
  name: "cluster",
6
6
  owners: [Owner.typeDefinition, "network", "root"],
7
7
  priority: 0.7,
8
8
  extends: Owner.typeDefinition,
9
- properties: {}
9
+ properties: {
10
+ masters: { type: "host", collection: true, writeable: true },
11
+ backups: { type: "host", collection: true, writeable: true },
12
+ }
10
13
  };
11
14
 
12
15
  export class Cluster extends Owner {
16
+
17
+ masters = new Set();
18
+ backups = new Set();
19
+
13
20
  static {
14
21
  addType(this);
15
22
  }
16
23
 
17
24
  static get typeDefinition() {
18
- return typeDefinition;
25
+ return ClusterTypeDefinition;
19
26
  }
20
27
 
28
+ constructor(owner, data) {
29
+ super(owner, data);
30
+ this.read(data, ClusterTypeDefinition);
31
+ }
21
32
  }
package/src/host.mjs CHANGED
@@ -129,6 +129,10 @@ export class Host extends Base {
129
129
  return this.#vendor || this.extends.find(e => e.vendor)?.vendor;
130
130
  }
131
131
 
132
+ get isTemplate() {
133
+ return this.isModel || this.name.match(/services\//); // TODO
134
+ }
135
+
132
136
  get isModel() {
133
137
  return this.#vendor || this.#chassis ? true : false;
134
138
  }
@@ -266,7 +270,10 @@ export class Host extends Base {
266
270
 
267
271
  set networkInterfaces(networkInterface) {
268
272
  this.#networkInterfaces.set(networkInterface.name, networkInterface);
269
- networkInterface.network?.addObject(this);
273
+
274
+ if (!this.isTemplate) {
275
+ networkInterface.network?.addObject(this);
276
+ }
270
277
  }
271
278
 
272
279
  *networkAddresses() {
@@ -308,7 +308,20 @@ export class Cluster extends Owner {
308
308
  };
309
309
  };
310
310
  };
311
- properties: {};
311
+ properties: {
312
+ masters: {
313
+ type: string;
314
+ collection: boolean;
315
+ writeable: boolean;
316
+ };
317
+ backups: {
318
+ type: string;
319
+ collection: boolean;
320
+ writeable: boolean;
321
+ };
322
+ };
312
323
  };
324
+ masters: Set<any>;
325
+ backups: Set<any>;
313
326
  }
314
327
  import { Owner } from "./owner.mjs";
package/types/host.d.mts CHANGED
@@ -155,6 +155,7 @@ export class Host extends Base {
155
155
  get chassis(): any;
156
156
  set vendor(value: any);
157
157
  get vendor(): any;
158
+ get isTemplate(): true | RegExpMatchArray;
158
159
  get isModel(): boolean;
159
160
  get model(): any;
160
161
  set extends(value: any[]);