pmcf 1.59.0 → 1.59.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 +1 -1
- package/src/owner.mjs +10 -8
- package/src/utils.mjs +11 -0
- package/types/utils.d.mts +1 -0
package/package.json
CHANGED
package/src/owner.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { asIterator, normalizeCIDR } from "./utils.mjs";
|
|
2
2
|
import { Base } from "./base.mjs";
|
|
3
3
|
import { Subnet } from "./subnet.mjs";
|
|
4
4
|
import { addType } from "./types.mjs";
|
|
@@ -90,17 +90,17 @@ export class Owner extends Base {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
typeNamed(typeName, name) {
|
|
93
|
-
const localName = name[0] === "/" ? name.substring(this.fullName.length + 1) : name;
|
|
94
|
-
|
|
95
93
|
const typeSlot = this.#membersByType.get(typeName);
|
|
96
94
|
if (typeSlot) {
|
|
97
|
-
const object = typeSlot.get(
|
|
95
|
+
const object = typeSlot.get(
|
|
96
|
+
name[0] === "/" ? name.substring(this.fullName.length + 1) : name
|
|
97
|
+
);
|
|
98
98
|
if (object) {
|
|
99
99
|
return object;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
return super.typeNamed(typeName,
|
|
103
|
+
return super.typeNamed(typeName, name);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
typeObject(typeName) {
|
|
@@ -223,11 +223,13 @@ export class Owner extends Base {
|
|
|
223
223
|
this.#bridges.add(bridge);
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
for (const name of
|
|
226
|
+
for (const name of asIterator(destinationNetworks)) {
|
|
227
227
|
const other = this.networkNamed(name);
|
|
228
228
|
if (other) {
|
|
229
|
-
bridge.
|
|
230
|
-
|
|
229
|
+
if (!bridge.has(other)) {
|
|
230
|
+
bridge.add(other);
|
|
231
|
+
other.bridge = bridge;
|
|
232
|
+
}
|
|
231
233
|
} else {
|
|
232
234
|
bridge.add(name);
|
|
233
235
|
this.finalize(() => this._resolveBridges());
|
package/src/utils.mjs
CHANGED
|
@@ -33,6 +33,17 @@ export function asArray(value) {
|
|
|
33
33
|
return Array.isArray(value) ? value : value === undefined ? [] : [value];
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
export function asIterator(value)
|
|
37
|
+
{
|
|
38
|
+
if(value === undefined) { return []; }
|
|
39
|
+
|
|
40
|
+
if(typeof value[Symbol.iterator] === 'function') {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return asArray(value);
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
export function isIPv4Address(address) {
|
|
37
48
|
return address.indexOf(".") >= 0;
|
|
38
49
|
}
|
package/types/utils.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ export function writeLines(dir: any, name: any, lines: any): Promise<void>;
|
|
|
2
2
|
export function sectionLines(sectionName: any, values: any): string[];
|
|
3
3
|
export function bridgeToJSON(bridge: any): any[];
|
|
4
4
|
export function asArray(value: any): any[];
|
|
5
|
+
export function asIterator(value: any): any;
|
|
5
6
|
export function isIPv4Address(address: any): boolean;
|
|
6
7
|
export function isIPv6Address(address: any): boolean;
|
|
7
8
|
export function isLinkLocal(address: any): any;
|