pmcf 1.38.2 → 1.38.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.38.2",
3
+ "version": "1.38.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
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) {
@@ -153,11 +153,15 @@ export class Owner extends Base {
153
153
  }
154
154
 
155
155
  subnetNamed(name) {
156
- if (this !== this.location) {
157
- return this.location.subnetNamed(name);
158
- }
156
+ return this.typeNamed("subnet", name) || this.owner?.subnetNamed(name);
157
+ }
159
158
 
160
- return this.typeNamed("subnet", name);
159
+ *_subnets() {
160
+ if (this.owner) {
161
+ yield* this.owner.subnets();
162
+ } else {
163
+ yield* this.typeList("subnet");
164
+ }
161
165
  }
162
166
 
163
167
  subnets() {
@@ -168,42 +172,36 @@ export class Owner extends Base {
168
172
  return this.typeList("subnet");
169
173
  }
170
174
 
171
- subnetForAddress(address) {
172
- for (const subnet of this.subnets()) {
173
- if (subnet.matchesAddress(address)) {
174
- return subnet;
175
- }
175
+ addSubnet(address) {
176
+ if (address instanceof Subnet) {
177
+ return address;
176
178
  }
177
- }
178
179
 
179
- addSubnet(address) {
180
180
  if (this !== this.location) {
181
181
  return this.location.addSubnet(address);
182
182
  }
183
183
 
184
- if (address instanceof Subnet) {
185
- return address;
186
- }
187
-
188
184
  const { cidr } = normalizeCIDR(address);
189
185
 
190
- //console.log("ADD SUBNET", this.toString(), address, cidr);
191
-
192
186
  if (cidr) {
193
187
  let subnet = this.subnetNamed(cidr);
194
188
 
195
189
  if (!subnet) {
196
190
  subnet = new Subnet(this, { name: cidr });
197
-
198
- /*if(this.owner) {
199
- this.owner.addSubnet(subnet);
200
- }*/
201
191
  }
202
192
 
203
193
  return subnet;
204
194
  }
205
195
  }
206
196
 
197
+ subnetForAddress(address) {
198
+ for (const subnet of this.subnets()) {
199
+ if (subnet.matchesAddress(address)) {
200
+ return subnet;
201
+ }
202
+ }
203
+ }
204
+
207
205
  clusterNamed(name) {
208
206
  return this.typeNamed("cluster", name);
209
207
  }
package/types/owner.d.mts CHANGED
@@ -8,23 +8,24 @@ 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(): Generator<any, void, any>;
23
24
  subnets(): any;
24
- subnetForAddress(address: any): any;
25
25
  addSubnet(address: any): any;
26
+ subnetForAddress(address: any): any;
26
27
  clusterNamed(name: any): any;
27
- clusters(): Generator<any, void, unknown>;
28
+ clusters(): any;
28
29
  addBridge(network: any, destinationNetworks: any): any;
29
30
  _resolveBridges(): void;
30
31
  networkAddresses(): AsyncGenerator<any, void, unknown>;