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 +1 -1
- package/src/model.mjs +0 -2
- package/src/owner.mjs +23 -25
- package/types/owner.d.mts +7 -6
package/package.json
CHANGED
package/src/model.mjs
CHANGED
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
|
-
|
|
89
|
+
typeList(typeName) {
|
|
90
90
|
const typeSlot = this.#membersByType.get(typeName);
|
|
91
91
|
if (typeSlot) {
|
|
92
|
-
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
156
|
+
return this.typeNamed("subnet", name) || this.owner?.subnetNamed(name);
|
|
157
|
+
}
|
|
159
158
|
|
|
160
|
-
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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):
|
|
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():
|
|
17
|
+
locations(): any;
|
|
18
18
|
hostNamed(name: any): any;
|
|
19
|
-
hosts():
|
|
19
|
+
hosts(): any;
|
|
20
20
|
networkNamed(name: any): any;
|
|
21
|
-
networks():
|
|
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():
|
|
28
|
+
clusters(): any;
|
|
28
29
|
addBridge(network: any, destinationNetworks: any): any;
|
|
29
30
|
_resolveBridges(): void;
|
|
30
31
|
networkAddresses(): AsyncGenerator<any, void, unknown>;
|