pmcf 1.30.5 → 1.30.7
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/bin/pmcf-host-defs +1 -1
- package/package.json +2 -2
- package/src/base.mjs +11 -6
- package/src/model.mjs +2 -2
- package/src/owner.mjs +3 -5
- package/types/model.d.mts +1 -1
- package/types/owner.d.mts +1 -1
package/bin/pmcf-host-defs
CHANGED
|
@@ -55,7 +55,7 @@ async function generateNetworkDefs(host, dir) {
|
|
|
55
55
|
|
|
56
56
|
const networkSections = [sectionLines("Match", { Name: ni.name })];
|
|
57
57
|
|
|
58
|
-
for (const Address of ni.
|
|
58
|
+
for (const Address of ni.ipAddressesWithPrefixLength) {
|
|
59
59
|
networkSections.push(
|
|
60
60
|
"",
|
|
61
61
|
sectionLines("Address", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.7",
|
|
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.
|
|
46
|
+
"@types/node": "^22.13.0",
|
|
47
47
|
"ava": "^6.2.0",
|
|
48
48
|
"c8": "^10.1.3",
|
|
49
49
|
"documentation": "^14.0.3",
|
package/src/base.mjs
CHANGED
|
@@ -112,7 +112,7 @@ export class Base {
|
|
|
112
112
|
return new Set([...object].map(e => this.expand(e)));
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
/*return Object.fromEntries(
|
|
116
116
|
Object.entries(object).map(([k, v]) => [k, this.expand(v)])
|
|
117
117
|
);*/
|
|
118
118
|
}
|
|
@@ -189,12 +189,17 @@ export function extractFrom(object, propertyNames) {
|
|
|
189
189
|
for (const p of propertyNames) {
|
|
190
190
|
const value = object[p];
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
switch (typeof value) {
|
|
193
|
+
case "undefined":
|
|
194
|
+
break;
|
|
195
|
+
case "object":
|
|
196
|
+
if (value instanceof Base && value.name !== undefined) {
|
|
197
|
+
json[p] = { name: value.name, type: value.typeName };
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
break;
|
|
201
|
+
default:
|
|
196
202
|
json[p] = value;
|
|
197
|
-
}
|
|
198
203
|
}
|
|
199
204
|
}
|
|
200
205
|
return json;
|
package/src/model.mjs
CHANGED
|
@@ -464,9 +464,9 @@ export class NetworkInterface extends Base {
|
|
|
464
464
|
return this.#ipAddresses;
|
|
465
465
|
}
|
|
466
466
|
|
|
467
|
-
get
|
|
467
|
+
get ipAddressesWithPrefixLength() {
|
|
468
468
|
return this.#ipAddresses.map(a =>
|
|
469
|
-
isIPv4Address(a) ? `${a}/${this.network.
|
|
469
|
+
isIPv4Address(a) ? `${a}/${this.network.prefixLength}` : a
|
|
470
470
|
);
|
|
471
471
|
}
|
|
472
472
|
|
package/src/owner.mjs
CHANGED
|
@@ -84,8 +84,6 @@ export class Owner extends Base {
|
|
|
84
84
|
this.#membersByType.set(typeName, typeSlot);
|
|
85
85
|
}
|
|
86
86
|
typeSlot.set(fullName, object);
|
|
87
|
-
|
|
88
|
-
//console.log(this.toString(),"ADD", typeName, fullName, object.name, this.named(fullName)?.toString());
|
|
89
87
|
}
|
|
90
88
|
|
|
91
89
|
addObject(object) {
|
|
@@ -190,7 +188,7 @@ export class Owner extends Base {
|
|
|
190
188
|
|
|
191
189
|
_resolveBridges() {
|
|
192
190
|
for (const bridge of this.#bridges) {
|
|
193
|
-
this.info(bridgeToJSON(bridge));
|
|
191
|
+
//this.info(bridgeToJSON(bridge));
|
|
194
192
|
for (const network of bridge) {
|
|
195
193
|
if (typeof network === "string") {
|
|
196
194
|
const other = this.networkNamed(network);
|
|
@@ -287,7 +285,7 @@ export class Network extends Owner {
|
|
|
287
285
|
return super.networkNamed(name);
|
|
288
286
|
}
|
|
289
287
|
|
|
290
|
-
get
|
|
288
|
+
get prefixLength() {
|
|
291
289
|
const m = this.ipv4?.match(/\/(\d+)$/);
|
|
292
290
|
if (m) {
|
|
293
291
|
return parseInt(m[1]);
|
|
@@ -307,7 +305,7 @@ export class Network extends Owner {
|
|
|
307
305
|
...super.propertyNames,
|
|
308
306
|
"kind",
|
|
309
307
|
"ipv4",
|
|
310
|
-
"
|
|
308
|
+
"prefixLength",
|
|
311
309
|
"scope",
|
|
312
310
|
"metric",
|
|
313
311
|
"bridge"
|
package/types/model.d.mts
CHANGED
|
@@ -56,7 +56,7 @@ export class NetworkInterface extends Base {
|
|
|
56
56
|
set network(networkOrName: any);
|
|
57
57
|
get network(): any;
|
|
58
58
|
get ipAddresses(): any[];
|
|
59
|
-
get
|
|
59
|
+
get ipAddressesWithPrefixLength(): any[];
|
|
60
60
|
get ipv4Addresses(): any[];
|
|
61
61
|
get ipv6Addresses(): any[];
|
|
62
62
|
get scope(): any;
|