pmcf 1.51.0 → 1.52.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.51.0",
3
+ "version": "1.52.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -131,13 +131,17 @@ export class Base {
131
131
  case "string":
132
132
  {
133
133
  value = this.expand(value);
134
- const object = this.typeNamed(property.type.name, value);
134
+ let object = this.typeNamed(property.type.name, value);
135
135
 
136
136
  if (object) {
137
137
  assign(property, object);
138
138
  } else {
139
139
  if (property.type.constructWithIdentifierOnly) {
140
- new property.type.clazz(this.ownerFor(property, value), value);
140
+ object = new property.type.clazz(
141
+ this.ownerFor(property, value),
142
+ value
143
+ );
144
+ this.addObject(object);
141
145
  } else {
142
146
  this.finalize(() => {
143
147
  value = this.expand(value);
package/src/host.mjs CHANGED
@@ -79,14 +79,19 @@ export class Host extends Base {
79
79
  if (data.extends) {
80
80
  this.finalize(() => {
81
81
  for (const host of this.extends) {
82
+ host.execFinalize();
82
83
  this.depends = host.depends;
83
84
  this.provides = host.provides;
84
85
  this.replaces = host.replaces;
85
86
 
86
- for (const service of host.findServices()) {
87
+ for (const service of host.services) {
87
88
  this.services = service.forOwner(this);
88
89
  }
89
90
  }
91
+
92
+ this.#depends = this.expand(this.depends);
93
+ this.#provides = this.expand(this.provides);
94
+ this.#replaces = this.expand(this.replaces);
90
95
  });
91
96
  }
92
97
  }
@@ -129,6 +134,10 @@ export class Host extends Base {
129
134
  return this.#vendor || this.extends.find(e => e.vendor)?.vendor;
130
135
  }
131
136
 
137
+ get isTemplate() {
138
+ return this.isModel || this.name.match(/services\//); // TODO
139
+ }
140
+
132
141
  get isModel() {
133
142
  return this.#vendor || this.#chassis ? true : false;
134
143
  }
@@ -256,6 +265,12 @@ export class Host extends Base {
256
265
  return ni;
257
266
  }
258
267
  }
268
+ if (typeName === "service") {
269
+ const service = this.services.find(s => s.name === name);
270
+ if (service) {
271
+ return service;
272
+ }
273
+ }
259
274
 
260
275
  return super.typeNamed(typeName, name);
261
276
  }
@@ -266,7 +281,10 @@ export class Host extends Base {
266
281
 
267
282
  set networkInterfaces(networkInterface) {
268
283
  this.#networkInterfaces.set(networkInterface.name, networkInterface);
269
- networkInterface.network?.addObject(this);
284
+
285
+ if (!this.isTemplate) {
286
+ networkInterface.network?.addObject(this);
287
+ }
270
288
  }
271
289
 
272
290
  *networkAddresses() {
package/src/owner.mjs CHANGED
@@ -46,7 +46,6 @@ export class Owner extends Base {
46
46
  constructor(owner, data) {
47
47
  super(owner, data);
48
48
  this.read(data, OwnerTypeDefinition);
49
- owner?.addObject(this);
50
49
  }
51
50
 
52
51
  _traverse(...args) {
package/src/service.mjs CHANGED
@@ -51,7 +51,6 @@ export class Service extends Base {
51
51
  constructor(owner, data) {
52
52
  super(owner, data);
53
53
  this.read(data, ServiceTypeDefinition);
54
- // owner.addService(this);
55
54
  }
56
55
 
57
56
  forOwner(owner) {
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[]);