pmcf 1.47.0 → 1.47.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.47.0",
3
+ "version": "1.47.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -146,7 +146,11 @@ export class Base {
146
146
  this.owner.typeNamed(property.type.name, value) ||
147
147
  this.root.typeNamed(property.type.name, value); // TODO
148
148
 
149
- assign(property, object);
149
+ if (object) {
150
+ assign(property, object);
151
+ } else {
152
+ this.error("Not found", property.name, property.type.name, value);
153
+ }
150
154
  });
151
155
  }
152
156
  }
package/src/host.mjs CHANGED
@@ -140,7 +140,6 @@ export class Host extends Base {
140
140
 
141
141
  get extends() {
142
142
  return this.#extends;
143
- // return this.#extends.map(e => this.expand(e));
144
143
  }
145
144
 
146
145
  set provides(value) {
@@ -247,20 +246,24 @@ export class Host extends Base {
247
246
  }
248
247
  }
249
248
 
249
+ typeNamed(typeName, name) {
250
+ if (typeName === NetworkInterfaceTypeDefinition.name) {
251
+ const ni = this.#networkInterfaces.get(name);
252
+ if (ni) {
253
+ return ni;
254
+ }
255
+ }
256
+
257
+ return super.typeNamed(typeName, name);
258
+ }
259
+
250
260
  get networkInterfaces() {
251
261
  return this.#networkInterfaces;
252
262
  }
253
263
 
254
264
  set networkInterfaces(networkInterface) {
255
265
  this.#networkInterfaces.set(networkInterface.name, networkInterface);
256
-
257
- if (networkInterface.network) {
258
- networkInterface.network.addObject(this);
259
- }
260
- }
261
-
262
- networkInterfaceNamed(name) {
263
- return this.#networkInterfaces.get(name);
266
+ networkInterface.network?.addObject(this);
264
267
  }
265
268
 
266
269
  *networkAddresses() {
@@ -306,8 +309,8 @@ const NetworkInterfaceTypeDefinition = {
306
309
  cidrAddresses: { type: "string", collection: true, writeable: false },
307
310
  rawAddresses: { type: "string", collection: true, writeable: false },
308
311
  network: { type: "network", collection: false, writeable: true },
309
- destination: { type: "host", collection: false, writeable: true },
310
- arpbridge: { type: "host", collection: true, writeable: true }
312
+ destination: { type: "string", collection: false, writeable: true },
313
+ arpbridge: { type: "network_interface", collection: true, writeable: true }
311
314
  }
312
315
  };
313
316
 
@@ -333,7 +336,6 @@ export class NetworkInterface extends Base {
333
336
  constructor(owner, data) {
334
337
  super(owner, data);
335
338
  this.read(data, NetworkInterfaceTypeDefinition);
336
- //owner.addNetworkInterface(this);
337
339
  }
338
340
 
339
341
  addSubnet(address) {
@@ -404,6 +406,10 @@ export class NetworkInterface extends Base {
404
406
  return this.owner;
405
407
  }
406
408
 
409
+ get network_interface() {
410
+ return this;
411
+ }
412
+
407
413
  get network() {
408
414
  return this.#network || this.host.network;
409
415
  }
package/types/host.d.mts CHANGED
@@ -168,7 +168,6 @@ export class Host extends Base {
168
168
  findServices(filter: any): Generator<any, void, unknown>;
169
169
  set networkInterfaces(networkInterface: Map<any, any>);
170
170
  get networkInterfaces(): Map<any, any>;
171
- networkInterfaceNamed(name: any): any;
172
171
  networkAddresses(): Generator<{
173
172
  networkInterface: any;
174
173
  address: any;
@@ -302,6 +301,7 @@ export class NetworkInterface extends Base {
302
301
  subnetForAddress(address: any): any;
303
302
  get gateway(): any;
304
303
  get gatewayAddress(): any;
304
+ get network_interface(): this;
305
305
  set network(network: any);
306
306
  get network(): any;
307
307
  set scope(value: any);