pmcf 4.25.4 → 4.25.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/README.md +11 -11
- package/package.json +2 -2
- package/src/base.mjs +4 -0
- package/src/host.mjs +3 -5
- package/src/network-address.mjs +1 -1
- package/src/network-interfaces/skeleton.mjs +3 -4
- package/src/network.mjs +1 -1
- package/src/owner.mjs +29 -24
- package/src/subnet.mjs +2 -4
package/README.md
CHANGED
|
@@ -73,11 +73,11 @@ generates config packages for:
|
|
|
73
73
|
* [Parameters](#parameters-12)
|
|
74
74
|
* [port](#port-1)
|
|
75
75
|
* [id](#id)
|
|
76
|
-
* [InitializationContext](#initializationcontext)
|
|
77
|
-
* [Parameters](#parameters-13)
|
|
78
76
|
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
79
77
|
* [networkAddresses](#networkaddresses)
|
|
80
|
-
* [Parameters](#parameters-
|
|
78
|
+
* [Parameters](#parameters-13)
|
|
79
|
+
* [InitializationContext](#initializationcontext)
|
|
80
|
+
* [Parameters](#parameters-14)
|
|
81
81
|
* [SystemdJournalRemoteService](#systemdjournalremoteservice)
|
|
82
82
|
* [Properties](#properties)
|
|
83
83
|
* [systemdConfigs](#systemdconfigs)
|
|
@@ -263,14 +263,6 @@ Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
|
|
|
263
263
|
|
|
264
264
|
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
265
265
|
|
|
266
|
-
## InitializationContext
|
|
267
|
-
|
|
268
|
-
Keeps track of all in flight object creations and loose ends during config initialization.
|
|
269
|
-
|
|
270
|
-
### Parameters
|
|
271
|
-
|
|
272
|
-
* `directory` (optional, default `"/"`)
|
|
273
|
-
|
|
274
266
|
## SkeletonNetworkInterface
|
|
275
267
|
|
|
276
268
|
**Extends ServiceOwner**
|
|
@@ -283,6 +275,14 @@ Keeps track of all in flight object creations and loose ends during config initi
|
|
|
283
275
|
|
|
284
276
|
Returns **Iterable<[NetworkAddress](#networkaddress)>** 
|
|
285
277
|
|
|
278
|
+
## InitializationContext
|
|
279
|
+
|
|
280
|
+
Keeps track of all in flight object creations and loose ends during config initialization.
|
|
281
|
+
|
|
282
|
+
### Parameters
|
|
283
|
+
|
|
284
|
+
* `directory` (optional, default `"/"`)
|
|
285
|
+
|
|
286
286
|
## SystemdJournalRemoteService
|
|
287
287
|
|
|
288
288
|
**Extends Service**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "4.25.
|
|
3
|
+
"version": "4.25.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"aggregated-map": "^1.0.4",
|
|
54
54
|
"content-entry-transform": "^1.6.9",
|
|
55
55
|
"ip-utilties": "^3.0.4",
|
|
56
|
-
"npm-pkgbuild": "^20.
|
|
56
|
+
"npm-pkgbuild": "^20.7.1",
|
|
57
57
|
"pacc": "^9.2.13",
|
|
58
58
|
"package-directory": "^8.2.0"
|
|
59
59
|
},
|
package/src/base.mjs
CHANGED
|
@@ -561,6 +561,10 @@ export function extractFrom(
|
|
|
561
561
|
return object;
|
|
562
562
|
}
|
|
563
563
|
|
|
564
|
+
if (object instanceof Set) {
|
|
565
|
+
object = [...object];
|
|
566
|
+
}
|
|
567
|
+
|
|
564
568
|
if (typeof object[Symbol.iterator] === "function") {
|
|
565
569
|
object = [...object].map(o => (o instanceof Base ? extractFrom(o) : o));
|
|
566
570
|
|
package/src/host.mjs
CHANGED
|
@@ -433,15 +433,13 @@ export class Host extends ServiceOwner {
|
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
get subnets() {
|
|
436
|
-
|
|
436
|
+
let all = new Set();
|
|
437
437
|
|
|
438
438
|
for (const networkInterface of this.networkInterfaces.values()) {
|
|
439
|
-
|
|
440
|
-
sn.set(s.address, s);
|
|
441
|
-
}
|
|
439
|
+
all = all.union(networkInterface.subnets);
|
|
442
440
|
}
|
|
443
441
|
|
|
444
|
-
return
|
|
442
|
+
return all;
|
|
445
443
|
}
|
|
446
444
|
|
|
447
445
|
async publicKey(type = "ed25519") {
|
package/src/network-address.mjs
CHANGED
|
@@ -24,8 +24,7 @@ export class SkeletonNetworkInterface extends ServiceOwner {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
get services()
|
|
28
|
-
{
|
|
27
|
+
get services() {
|
|
29
28
|
return new AggregatedMap([super.services, this.owner.services]);
|
|
30
29
|
}
|
|
31
30
|
|
|
@@ -66,8 +65,8 @@ export class SkeletonNetworkInterface extends ServiceOwner {
|
|
|
66
65
|
this._network = network;
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
get subnets() {
|
|
69
|
+
return new Set(this.ipAddresses.values());
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
get ipAddresses() {
|
package/src/network.mjs
CHANGED
package/src/owner.mjs
CHANGED
|
@@ -54,6 +54,7 @@ export class Owner extends Base {
|
|
|
54
54
|
|
|
55
55
|
_membersByType = new Map();
|
|
56
56
|
_bridges = new Set();
|
|
57
|
+
_subnets = new Set();
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
60
|
* @return {boolean}
|
|
@@ -132,26 +133,34 @@ export class Owner extends Base {
|
|
|
132
133
|
}
|
|
133
134
|
|
|
134
135
|
addTypeObject(typeName, name, object) {
|
|
135
|
-
const typeSlot = this._membersByType.getOrInsertComputed(
|
|
136
|
+
const typeSlot = this._membersByType.getOrInsertComputed(
|
|
137
|
+
typeName,
|
|
138
|
+
() => new Map()
|
|
139
|
+
);
|
|
136
140
|
typeSlot.set(name, object);
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
addObject(object) {
|
|
140
|
-
if (object
|
|
141
|
-
this.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
if (object instanceof Subnet) {
|
|
145
|
+
this._subnets.add(object);
|
|
146
|
+
} else {
|
|
147
|
+
if (object.owner && object.owner !== this) {
|
|
148
|
+
this.addTypeObject(
|
|
149
|
+
object.typeName,
|
|
150
|
+
object.owner.name + "/" + object.name,
|
|
151
|
+
object
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.addTypeObject(object.typeName, object.name, object);
|
|
148
157
|
}
|
|
149
|
-
this.addTypeObject(object.typeName, object.name, object);
|
|
150
158
|
}
|
|
151
159
|
|
|
152
|
-
get services()
|
|
153
|
-
|
|
154
|
-
|
|
160
|
+
get services() {
|
|
161
|
+
return [...this.hosts]
|
|
162
|
+
.map(host => Array.from(host.services.values()))
|
|
163
|
+
.flat();
|
|
155
164
|
}
|
|
156
165
|
|
|
157
166
|
get locations() {
|
|
@@ -192,14 +201,11 @@ export class Owner extends Base {
|
|
|
192
201
|
}
|
|
193
202
|
|
|
194
203
|
subnetNamed(name) {
|
|
195
|
-
return this.
|
|
204
|
+
return [...this.subnets].find(s => s.name == name);
|
|
196
205
|
}
|
|
197
206
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
yield* this.owner.subnets();
|
|
201
|
-
}
|
|
202
|
-
yield* this.typeList("subnet");
|
|
207
|
+
get subnets() {
|
|
208
|
+
return this.unionFromDirections(["this", "owner"], "_subnets");
|
|
203
209
|
}
|
|
204
210
|
|
|
205
211
|
addSubnet(address) {
|
|
@@ -215,19 +221,18 @@ export class Owner extends Base {
|
|
|
215
221
|
subnet =
|
|
216
222
|
familyIP(address) === "IPv4" ? SUBNET_GLOBAL_IPV4 : SUBNET_GLOBAL_IPV6;
|
|
217
223
|
|
|
218
|
-
/*
|
|
219
224
|
this.error(
|
|
220
225
|
`Address without subnet ${address}`,
|
|
221
|
-
[...this.subnets
|
|
226
|
+
[...this.subnets].map(s => s.address)
|
|
222
227
|
);
|
|
223
|
-
*/
|
|
224
228
|
}
|
|
225
229
|
|
|
230
|
+
this._subnets.add(subnet);
|
|
226
231
|
return subnet;
|
|
227
232
|
}
|
|
228
233
|
|
|
229
234
|
subnetForAddress(address) {
|
|
230
|
-
for (const subnet of this.subnets
|
|
235
|
+
for (const subnet of this.subnets) {
|
|
231
236
|
if (subnet.matchesAddress(address)) {
|
|
232
237
|
return subnet;
|
|
233
238
|
}
|
|
@@ -301,7 +306,7 @@ export class Owner extends Base {
|
|
|
301
306
|
}
|
|
302
307
|
}
|
|
303
308
|
// enshure only one subnet address in the bridge
|
|
304
|
-
for (const subnet of network.subnets
|
|
309
|
+
for (const subnet of network.subnets) {
|
|
305
310
|
const present = subnets.get(subnet.address);
|
|
306
311
|
if (present) {
|
|
307
312
|
subnet.owner.addObject(present);
|
package/src/subnet.mjs
CHANGED
|
@@ -108,12 +108,10 @@ export const SUBNET_LOCALHOST_IPV6 = new Subnet(_owner, "::1/128");
|
|
|
108
108
|
export const SUBNET_LINK_LOCAL_IPV6 = new Subnet(_owner, "fe80::/64");
|
|
109
109
|
|
|
110
110
|
export function subnets(sources) {
|
|
111
|
-
|
|
111
|
+
let all = new Set();
|
|
112
112
|
|
|
113
113
|
for (const source of sources) {
|
|
114
|
-
|
|
115
|
-
all.add(subnet);
|
|
116
|
-
}
|
|
114
|
+
all = all.union(source.subnets);
|
|
117
115
|
}
|
|
118
116
|
|
|
119
117
|
return all;
|