pmcf 1.30.3 → 1.30.5

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.30.3",
3
+ "version": "1.30.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -191,7 +191,7 @@ export function extractFrom(object, propertyNames) {
191
191
 
192
192
  if (value !== undefined) {
193
193
  if (value instanceof Base && value.name !== undefined) {
194
- json[p] = { name: value.name };
194
+ json[p] = { name: value.name, type: value.typeName };
195
195
  } else {
196
196
  json[p] = value;
197
197
  }
package/src/model.mjs CHANGED
@@ -112,6 +112,14 @@ export class Location extends Owner {
112
112
  get location() {
113
113
  return this;
114
114
  }
115
+
116
+ locationNamed(name) {
117
+ if (this.fullName === name) {
118
+ return this;
119
+ }
120
+
121
+ return super.locationNamed(name);
122
+ }
115
123
  }
116
124
 
117
125
  export class Host extends Base {
@@ -134,10 +142,6 @@ export class Host extends Base {
134
142
  }
135
143
 
136
144
  static async prepareData(root, data) {
137
- if (data.location) {
138
- data.location = await root.load(data.location, { type: Location });
139
- }
140
-
141
145
  if (data.extends) {
142
146
  data.extends = await Promise.all(
143
147
  asArray(data.extends).map(e => root.load(e, { type: Host }))
@@ -362,7 +366,6 @@ export class Host extends Base {
362
366
  "distribution",
363
367
  "deployment",
364
368
  "master",
365
- "location",
366
369
  "model",
367
370
  "replaces",
368
371
  "depends",
@@ -534,5 +537,14 @@ export class NetworkInterface extends Base {
534
537
  }
535
538
  }
536
539
 
537
- const _types = [Location, Network, Subnet, Host, Cluster, Service, DNSService, NetworkInterface];
540
+ const _types = [
541
+ Location,
542
+ Network,
543
+ Subnet,
544
+ Host,
545
+ Cluster,
546
+ Service,
547
+ DNSService,
548
+ NetworkInterface
549
+ ];
538
550
  const _typesByName = Object.fromEntries(_types.map(t => [t.typeName, t]));
package/src/owner.mjs CHANGED
@@ -280,6 +280,13 @@ export class Network extends Owner {
280
280
  this.bridge = owner.addBridge(this, bridge);
281
281
  }
282
282
 
283
+ networkNamed(name) {
284
+ if (this.fullName === name) {
285
+ return this;
286
+ }
287
+ return super.networkNamed(name);
288
+ }
289
+
283
290
  get netmask() {
284
291
  const m = this.ipv4?.match(/\/(\d+)$/);
285
292
  if (m) {