pmcf 1.6.2 → 1.6.3
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 +1 -1
- package/src/model.mjs +5 -7
- package/types/model.d.mts +1 -1
package/package.json
CHANGED
package/src/model.mjs
CHANGED
|
@@ -243,7 +243,7 @@ export class World extends Owner {
|
|
|
243
243
|
|
|
244
244
|
type = await type.prepareData(this, data);
|
|
245
245
|
object = new type(owner, data);
|
|
246
|
-
this
|
|
246
|
+
this.addObject(object);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
return object;
|
|
@@ -259,6 +259,10 @@ export class World extends Owner {
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
+
addObject(object) {
|
|
263
|
+
this.#byName.set(object.name, object);
|
|
264
|
+
}
|
|
265
|
+
|
|
262
266
|
async named(name) {
|
|
263
267
|
await this.load();
|
|
264
268
|
return this.#byName.get(name);
|
|
@@ -298,12 +302,6 @@ export class World extends Owner {
|
|
|
298
302
|
return this._loadType(name, Host);
|
|
299
303
|
}
|
|
300
304
|
|
|
301
|
-
async *subnets() {
|
|
302
|
-
for await (const location of this.locations()) {
|
|
303
|
-
yield* location.subnets();
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
305
|
async *networkAddresses() {
|
|
308
306
|
for await (const host of this.hosts()) {
|
|
309
307
|
for (const networkAddresses of host.networkAddresses()) {
|
package/types/model.d.mts
CHANGED
|
@@ -50,13 +50,13 @@ export class World extends Owner {
|
|
|
50
50
|
get world(): this;
|
|
51
51
|
_loadType(name: any, type: any): Promise<any>;
|
|
52
52
|
load(): Promise<void>;
|
|
53
|
+
addObject(object: any): void;
|
|
53
54
|
named(name: any): Promise<any>;
|
|
54
55
|
locations(): AsyncGenerator<Location, void, unknown>;
|
|
55
56
|
hosts(): AsyncGenerator<Host, void, unknown>;
|
|
56
57
|
domains(): AsyncGenerator<any, void, unknown>;
|
|
57
58
|
location(name: any): Promise<any>;
|
|
58
59
|
host(name: any): Promise<any>;
|
|
59
|
-
subnets(): AsyncGenerator<any, void, unknown>;
|
|
60
60
|
networkAddresses(): AsyncGenerator<{
|
|
61
61
|
address: any;
|
|
62
62
|
networkInterface: any;
|