pmcf 1.38.2 → 1.39.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.38.2",
3
+ "version": "1.39.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -43,7 +43,7 @@
43
43
  "pacc": "^3.3.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@types/node": "^22.13.1",
46
+ "@types/node": "^22.13.2",
47
47
  "ava": "^6.2.0",
48
48
  "c8": "^10.1.3",
49
49
  "documentation": "^14.0.3",
package/src/model.mjs CHANGED
@@ -112,8 +112,6 @@ export class Root extends Location {
112
112
 
113
113
  this._addObject(type.typeName, fullName, object);
114
114
 
115
- //console.log("FINISH LOAD", object.fullName);
116
-
117
115
  return object;
118
116
  }
119
117
 
package/src/owner.mjs CHANGED
@@ -86,13 +86,13 @@ export class Owner extends Base {
86
86
  return typeSlot?.get(name) || this.owner?.typeNamed(typeName, name);
87
87
  }
88
88
 
89
- *typeList(typeName) {
89
+ typeList(typeName) {
90
90
  const typeSlot = this.#membersByType.get(typeName);
91
91
  if (typeSlot) {
92
- for (const object of typeSlot.values()) {
93
- yield object;
94
- }
92
+ return typeSlot.values();
95
93
  }
94
+
95
+ return [];
96
96
  }
97
97
 
98
98
  _addObject(typeName, fullName, object) {
@@ -105,7 +105,6 @@ export class Owner extends Base {
105
105
  }
106
106
 
107
107
  addObject(object) {
108
- this.owner?.addObject(object);
109
108
  this._addObject(object.typeName, object.fullName, object);
110
109
  }
111
110
 
@@ -153,57 +152,38 @@ export class Owner extends Base {
153
152
  }
154
153
 
155
154
  subnetNamed(name) {
156
- if (this !== this.location) {
157
- return this.location.subnetNamed(name);
158
- }
159
-
160
155
  return this.typeNamed("subnet", name);
161
156
  }
162
157
 
163
- subnets() {
164
- if (this !== this.location) {
165
- return this.location.subnets();
166
- }
167
-
168
- return this.typeList("subnet");
169
- }
170
-
171
- subnetForAddress(address) {
172
- for (const subnet of this.subnets()) {
173
- if (subnet.matchesAddress(address)) {
174
- return subnet;
175
- }
158
+ *subnets() {
159
+ if (this.owner) {
160
+ yield* this.owner.subnets();
176
161
  }
162
+ yield* this.typeList("subnet");
177
163
  }
178
164
 
179
165
  addSubnet(address) {
180
- if (this !== this.location) {
181
- return this.location.addSubnet(address);
182
- }
183
-
184
- if (address instanceof Subnet) {
185
- return address;
186
- }
187
-
188
166
  const { cidr } = normalizeCIDR(address);
189
167
 
190
- //console.log("ADD SUBNET", this.toString(), address, cidr);
191
-
192
168
  if (cidr) {
193
169
  let subnet = this.subnetNamed(cidr);
194
170
 
195
171
  if (!subnet) {
196
172
  subnet = new Subnet(this, { name: cidr });
197
-
198
- /*if(this.owner) {
199
- this.owner.addSubnet(subnet);
200
- }*/
201
173
  }
202
174
 
203
175
  return subnet;
204
176
  }
205
177
  }
206
178
 
179
+ subnetForAddress(address) {
180
+ for (const subnet of this.subnets()) {
181
+ if (subnet.matchesAddress(address)) {
182
+ return subnet;
183
+ }
184
+ }
185
+ }
186
+
207
187
  clusterNamed(name) {
208
188
  return this.typeNamed("cluster", name);
209
189
  }
@@ -389,6 +369,10 @@ export class Subnet extends Base {
389
369
  owner.addObject(this);
390
370
  }
391
371
 
372
+ get fullName() {
373
+ return this.name;
374
+ }
375
+
392
376
  matchesAddress(address) {
393
377
  return address.startsWith(this.prefix);
394
378
  }
package/types/owner.d.mts CHANGED
@@ -8,23 +8,23 @@ export class Owner extends Base {
8
8
  get dns(): DNSService;
9
9
  named(name: any): any;
10
10
  typeNamed(typeName: any, name: any): any;
11
- typeList(typeName: any): Generator<any, void, unknown>;
11
+ typeList(typeName: any): any;
12
12
  _addObject(typeName: any, fullName: any, object: any): void;
13
13
  addObject(object: any): void;
14
14
  service(filter: any): Promise<any>;
15
15
  services(filter: any): AsyncGenerator<any, void, unknown>;
16
16
  locationNamed(name: any): any;
17
- locations(): Generator<any, void, unknown>;
17
+ locations(): any;
18
18
  hostNamed(name: any): any;
19
- hosts(): Generator<any, void, unknown>;
19
+ hosts(): any;
20
20
  networkNamed(name: any): any;
21
- networks(): Generator<any, void, unknown>;
21
+ networks(): any;
22
22
  subnetNamed(name: any): any;
23
- subnets(): any;
24
- subnetForAddress(address: any): any;
23
+ subnets(): Generator<any, void, any>;
25
24
  addSubnet(address: any): any;
25
+ subnetForAddress(address: any): any;
26
26
  clusterNamed(name: any): any;
27
- clusters(): Generator<any, void, unknown>;
27
+ clusters(): any;
28
28
  addBridge(network: any, destinationNetworks: any): any;
29
29
  _resolveBridges(): void;
30
30
  networkAddresses(): AsyncGenerator<any, void, unknown>;