pmcf 1.30.4 → 1.30.6
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 +1 -1
- package/src/model.mjs +20 -3
- package/src/owner.mjs +9 -2
- 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.6",
|
|
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
|
@@ -191,7 +191,7 @@ export function extractFrom(object, propertyNames) {
|
|
|
191
191
|
|
|
192
192
|
if (value !== undefined) {
|
|
193
193
|
if (value instanceof Base && value.name !== undefined) {
|
|
194
|
-
json[p] = { name: value.name };
|
|
194
|
+
json[p] = { name: value.name, type: value.typeName };
|
|
195
195
|
} else {
|
|
196
196
|
json[p] = value;
|
|
197
197
|
}
|
package/src/model.mjs
CHANGED
|
@@ -112,6 +112,14 @@ export class Location extends Owner {
|
|
|
112
112
|
get location() {
|
|
113
113
|
return this;
|
|
114
114
|
}
|
|
115
|
+
|
|
116
|
+
locationNamed(name) {
|
|
117
|
+
if (this.fullName === name) {
|
|
118
|
+
return this;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return super.locationNamed(name);
|
|
122
|
+
}
|
|
115
123
|
}
|
|
116
124
|
|
|
117
125
|
export class Host extends Base {
|
|
@@ -456,9 +464,9 @@ export class NetworkInterface extends Base {
|
|
|
456
464
|
return this.#ipAddresses;
|
|
457
465
|
}
|
|
458
466
|
|
|
459
|
-
get
|
|
467
|
+
get ipAddressesWithPrefixLength() {
|
|
460
468
|
return this.#ipAddresses.map(a =>
|
|
461
|
-
isIPv4Address(a) ? `${a}/${this.network.
|
|
469
|
+
isIPv4Address(a) ? `${a}/${this.network.prefixLength}` : a
|
|
462
470
|
);
|
|
463
471
|
}
|
|
464
472
|
|
|
@@ -529,5 +537,14 @@ export class NetworkInterface extends Base {
|
|
|
529
537
|
}
|
|
530
538
|
}
|
|
531
539
|
|
|
532
|
-
const _types = [
|
|
540
|
+
const _types = [
|
|
541
|
+
Location,
|
|
542
|
+
Network,
|
|
543
|
+
Subnet,
|
|
544
|
+
Host,
|
|
545
|
+
Cluster,
|
|
546
|
+
Service,
|
|
547
|
+
DNSService,
|
|
548
|
+
NetworkInterface
|
|
549
|
+
];
|
|
533
550
|
const _typesByName = Object.fromEntries(_types.map(t => [t.typeName, t]));
|
package/src/owner.mjs
CHANGED
|
@@ -280,7 +280,14 @@ export class Network extends Owner {
|
|
|
280
280
|
this.bridge = owner.addBridge(this, bridge);
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
|
|
283
|
+
networkNamed(name) {
|
|
284
|
+
if (this.fullName === name) {
|
|
285
|
+
return this;
|
|
286
|
+
}
|
|
287
|
+
return super.networkNamed(name);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
get prefixLength() {
|
|
284
291
|
const m = this.ipv4?.match(/\/(\d+)$/);
|
|
285
292
|
if (m) {
|
|
286
293
|
return parseInt(m[1]);
|
|
@@ -300,7 +307,7 @@ export class Network extends Owner {
|
|
|
300
307
|
...super.propertyNames,
|
|
301
308
|
"kind",
|
|
302
309
|
"ipv4",
|
|
303
|
-
"
|
|
310
|
+
"prefixLength",
|
|
304
311
|
"scope",
|
|
305
312
|
"metric",
|
|
306
313
|
"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;
|