pmcf 4.22.6 → 4.23.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/README.md +38 -25
- package/package.json +1 -1
- package/src/base.mjs +25 -10
- package/src/cluster.mjs +1 -1
- package/src/host.mjs +16 -1
- package/src/initialization-context.mjs +5 -5
- package/src/network-interfaces/skeleton.mjs +4 -4
- package/src/owner.mjs +1 -1
- package/src/service-owner.mjs +22 -18
package/README.md
CHANGED
|
@@ -43,72 +43,74 @@ generates config packages for:
|
|
|
43
43
|
|
|
44
44
|
* [Base](#base)
|
|
45
45
|
* [Parameters](#parameters)
|
|
46
|
-
* [
|
|
46
|
+
* [mapFromDirections](#mapfromdirections)
|
|
47
47
|
* [Parameters](#parameters-1)
|
|
48
|
-
* [
|
|
48
|
+
* [unionFromDirections](#unionfromdirections)
|
|
49
49
|
* [Parameters](#parameters-2)
|
|
50
|
-
* [
|
|
50
|
+
* [walkDirections](#walkdirections)
|
|
51
51
|
* [Parameters](#parameters-3)
|
|
52
|
-
* [
|
|
52
|
+
* [extendedAttribute](#extendedattribute)
|
|
53
53
|
* [Parameters](#parameters-4)
|
|
54
|
-
* [
|
|
54
|
+
* [propertyIterator](#propertyiterator)
|
|
55
55
|
* [Parameters](#parameters-5)
|
|
56
|
+
* [getProperties](#getproperties)
|
|
57
|
+
* [Parameters](#parameters-6)
|
|
56
58
|
* [priority](#priority)
|
|
57
59
|
* [expression](#expression)
|
|
58
|
-
* [Parameters](#parameters-6)
|
|
59
|
-
* [templateContent](#templatecontent)
|
|
60
60
|
* [Parameters](#parameters-7)
|
|
61
|
+
* [templateContent](#templatecontent)
|
|
62
|
+
* [Parameters](#parameters-8)
|
|
61
63
|
* [isTemplate](#istemplate)
|
|
62
64
|
* [property](#property)
|
|
63
|
-
* [Parameters](#parameters-8)
|
|
64
|
-
* [expand](#expand)
|
|
65
65
|
* [Parameters](#parameters-9)
|
|
66
|
+
* [expand](#expand)
|
|
67
|
+
* [Parameters](#parameters-10)
|
|
66
68
|
* [PortEndpoint](#portendpoint)
|
|
67
|
-
* [Parameters](#parameters-
|
|
69
|
+
* [Parameters](#parameters-11)
|
|
68
70
|
* [port](#port)
|
|
69
71
|
* [socketAddress](#socketaddress)
|
|
70
72
|
* [HTTPEndpoint](#httpendpoint)
|
|
71
|
-
* [Parameters](#parameters-
|
|
73
|
+
* [Parameters](#parameters-12)
|
|
72
74
|
* [port](#port-1)
|
|
73
75
|
* [id](#id)
|
|
74
76
|
* [InitializationContext](#initializationcontext)
|
|
75
|
-
* [Parameters](#parameters-
|
|
77
|
+
* [Parameters](#parameters-13)
|
|
76
78
|
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
77
79
|
* [networkAddresses](#networkaddresses)
|
|
78
|
-
* [Parameters](#parameters-
|
|
80
|
+
* [Parameters](#parameters-14)
|
|
79
81
|
* [SystemdJournalRemoteService](#systemdjournalremoteservice)
|
|
80
82
|
* [Properties](#properties)
|
|
81
83
|
* [systemdConfigs](#systemdconfigs)
|
|
82
|
-
* [Parameters](#parameters-
|
|
84
|
+
* [Parameters](#parameters-15)
|
|
83
85
|
* [SystemdJournalUploadService](#systemdjournaluploadservice)
|
|
84
86
|
* [Properties](#properties-1)
|
|
85
87
|
* [systemdConfigs](#systemdconfigs-1)
|
|
86
|
-
* [Parameters](#parameters-
|
|
88
|
+
* [Parameters](#parameters-16)
|
|
87
89
|
* [NetworkAddress](#networkaddress)
|
|
88
|
-
* [Parameters](#parameters-
|
|
90
|
+
* [Parameters](#parameters-17)
|
|
89
91
|
* [subnet](#subnet)
|
|
90
92
|
* [networkInterface](#networkinterface)
|
|
91
93
|
* [address](#address)
|
|
92
94
|
* [addresses](#addresses)
|
|
93
|
-
* [Parameters](#parameters-17)
|
|
94
|
-
* [cidrAddresses](#cidraddresses)
|
|
95
95
|
* [Parameters](#parameters-18)
|
|
96
|
+
* [cidrAddresses](#cidraddresses)
|
|
97
|
+
* [Parameters](#parameters-19)
|
|
96
98
|
* [secretName](#secretname)
|
|
97
99
|
* [isTemplate](#istemplate-1)
|
|
98
100
|
* [named](#named)
|
|
99
|
-
* [Parameters](#parameters-19)
|
|
100
|
-
* [serviceEndpoints](#serviceendpoints)
|
|
101
101
|
* [Parameters](#parameters-20)
|
|
102
|
-
* [
|
|
102
|
+
* [serviceEndpoints](#serviceendpoints)
|
|
103
103
|
* [Parameters](#parameters-21)
|
|
104
|
-
* [
|
|
104
|
+
* [domainName](#domainname)
|
|
105
105
|
* [Parameters](#parameters-22)
|
|
106
|
-
* [
|
|
106
|
+
* [domainFromDominName](#domainfromdominname)
|
|
107
107
|
* [Parameters](#parameters-23)
|
|
108
|
-
* [
|
|
108
|
+
* [sectionLines](#sectionlines)
|
|
109
109
|
* [Parameters](#parameters-24)
|
|
110
|
-
* [
|
|
110
|
+
* [asArray](#asarray)
|
|
111
111
|
* [Parameters](#parameters-25)
|
|
112
|
+
* [asIterator](#asiterator)
|
|
113
|
+
* [Parameters](#parameters-26)
|
|
112
114
|
|
|
113
115
|
## Base
|
|
114
116
|
|
|
@@ -120,6 +122,17 @@ properties: use defined values to support attribute value definitions
|
|
|
120
122
|
* `owner` **[Base](#base)** 
|
|
121
123
|
* `data` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
122
124
|
|
|
125
|
+
### mapFromDirections
|
|
126
|
+
|
|
127
|
+
Deliver AggregatedMap of all property Maps.
|
|
128
|
+
|
|
129
|
+
#### Parameters
|
|
130
|
+
|
|
131
|
+
* `directions` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** 
|
|
132
|
+
* `property` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
133
|
+
|
|
134
|
+
Returns **[Map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)\<any, any>** 
|
|
135
|
+
|
|
123
136
|
### unionFromDirections
|
|
124
137
|
|
|
125
138
|
Deliver union set of all property values.
|
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
description_attribute_writable,
|
|
25
25
|
boolean_attribute_writable
|
|
26
26
|
} from "pacc";
|
|
27
|
+
import { AggregatedMap } from "aggregated-map";
|
|
27
28
|
import { union } from "./utils.mjs";
|
|
28
29
|
|
|
29
30
|
/**
|
|
@@ -36,15 +37,15 @@ export class Base {
|
|
|
36
37
|
static key = "name";
|
|
37
38
|
static priority = 0;
|
|
38
39
|
static attributes = {
|
|
39
|
-
owner: { ...default_attribute, type: "base" },
|
|
40
|
-
type: string_attribute,
|
|
41
40
|
name: name_attribute_writable,
|
|
42
41
|
description: description_attribute_writable,
|
|
43
42
|
priority: number_attribute_writable,
|
|
44
43
|
directory: string_attribute_writable,
|
|
45
44
|
packaging: string_attribute_writable,
|
|
46
45
|
disabled: boolean_attribute_writable,
|
|
47
|
-
tags: string_set_attribute_writable
|
|
46
|
+
tags: string_set_attribute_writable,
|
|
47
|
+
owner: { ...default_attribute, type: "base" },
|
|
48
|
+
type: string_attribute
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
static typeDefinition = this;
|
|
@@ -127,6 +128,18 @@ export class Base {
|
|
|
127
128
|
return this.owner.addObject(object);
|
|
128
129
|
}
|
|
129
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Deliver AggregatedMap of all property Maps.
|
|
133
|
+
* @param {string[]} directions
|
|
134
|
+
* @param {string} property
|
|
135
|
+
* @returns {Map<any,any>}
|
|
136
|
+
*/
|
|
137
|
+
mapFromDirections(directions, property) {
|
|
138
|
+
return new AggregatedMap(
|
|
139
|
+
[...this.walkDirections(directions)].map(node => node[property])
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
130
143
|
/**
|
|
131
144
|
* Deliver union set of all property values.
|
|
132
145
|
* @param {string[]} directions
|
|
@@ -142,6 +155,11 @@ export class Base {
|
|
|
142
155
|
return collected;
|
|
143
156
|
}
|
|
144
157
|
|
|
158
|
+
/*get this()
|
|
159
|
+
{
|
|
160
|
+
return [this];
|
|
161
|
+
}*/
|
|
162
|
+
|
|
145
163
|
/**
|
|
146
164
|
* Walk the object graph in some directions and deliver seen nodes.
|
|
147
165
|
* @param {string[]} directions
|
|
@@ -168,10 +186,12 @@ export class Base {
|
|
|
168
186
|
if (value) {
|
|
169
187
|
if (value[Symbol.iterator]) {
|
|
170
188
|
for (const node of value) {
|
|
171
|
-
yield
|
|
189
|
+
yield node;
|
|
190
|
+
yield* node._walkDirections(directions, false, seen);
|
|
172
191
|
}
|
|
173
192
|
} else {
|
|
174
|
-
yield
|
|
193
|
+
yield value;
|
|
194
|
+
yield* value._walkDirections(directions, false, seen);
|
|
175
195
|
}
|
|
176
196
|
}
|
|
177
197
|
}
|
|
@@ -329,11 +349,6 @@ export class Base {
|
|
|
329
349
|
return this.owner?.services || [];
|
|
330
350
|
}
|
|
331
351
|
|
|
332
|
-
// TODO get rid of
|
|
333
|
-
get aggregatedServices() {
|
|
334
|
-
return this.services;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
352
|
set directory(directory) {
|
|
338
353
|
this._directory = directory;
|
|
339
354
|
}
|
package/src/cluster.mjs
CHANGED
package/src/host.mjs
CHANGED
|
@@ -113,6 +113,21 @@ export class Host extends ServiceOwner {
|
|
|
113
113
|
super.materializeExtends();
|
|
114
114
|
|
|
115
115
|
for (const host of this.walkDirections(["extends"])) {
|
|
116
|
+
for (const [name, service] of host.services) {
|
|
117
|
+
const present = this._services.get(name);
|
|
118
|
+
if (present) {
|
|
119
|
+
/* console.log(
|
|
120
|
+
"LINK",
|
|
121
|
+
present.fullName,
|
|
122
|
+
service.fullName,
|
|
123
|
+
present.extends
|
|
124
|
+
);*/
|
|
125
|
+
present.extends.add(service);
|
|
126
|
+
} else {
|
|
127
|
+
this._services.set(name, service.forOwner(this));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
116
131
|
for (const [name, ni] of host.networkInterfaces) {
|
|
117
132
|
const present = this._networkInterfaces.get(name);
|
|
118
133
|
|
|
@@ -461,7 +476,7 @@ export class Host extends ServiceOwner {
|
|
|
461
476
|
|
|
462
477
|
//console.log([...this.walkDirections(["extends"])].map(e => e.fullName));
|
|
463
478
|
|
|
464
|
-
for (const service of this.
|
|
479
|
+
for (const service of this.services) {
|
|
465
480
|
//console.log("SERVICE",service.name);
|
|
466
481
|
|
|
467
482
|
if (service.systemdConfigs) {
|
|
@@ -194,7 +194,7 @@ export class InitializationContext {
|
|
|
194
194
|
this._read(object, data, type);
|
|
195
195
|
|
|
196
196
|
if (data.extends) {
|
|
197
|
-
//console.log("EXTENDS", type.name, object.fullName
|
|
197
|
+
//console.log("EXTENDS", type.name, object.fullName); // data.extends);
|
|
198
198
|
object.materializeExtends();
|
|
199
199
|
}
|
|
200
200
|
}
|
|
@@ -237,6 +237,10 @@ export class InitializationContext {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
this.instantiateAndAssign(object, name, attribute, value);
|
|
240
|
+
|
|
241
|
+
/*if (name === "alias" && value) {
|
|
242
|
+
console.log("READ ALIAS", object.fullName, object.alias, value);
|
|
243
|
+
}*/
|
|
240
244
|
}
|
|
241
245
|
}
|
|
242
246
|
}
|
|
@@ -265,10 +269,6 @@ export class InitializationContext {
|
|
|
265
269
|
const object = this.typeFactory(type, owner, data);
|
|
266
270
|
this.root.addTypeObject(type.clazz.typeName, name, object);
|
|
267
271
|
|
|
268
|
-
/*if(object.name === undefined || object.name.length === 0) {
|
|
269
|
-
throw "NO name";
|
|
270
|
-
}*/
|
|
271
|
-
|
|
272
272
|
return object;
|
|
273
273
|
}
|
|
274
274
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
+
import { AggregatedMap } from "aggregated-map";
|
|
2
3
|
import { writeLines, sectionLines } from "../utils.mjs";
|
|
3
4
|
import { NetworkAddress, Host, cidrAddresses } from "pmcf";
|
|
4
5
|
import { ServiceOwner } from "../service-owner.mjs";
|
|
@@ -23,10 +24,9 @@ export class SkeletonNetworkInterface extends ServiceOwner {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
get
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
: this.services;
|
|
27
|
+
get services()
|
|
28
|
+
{
|
|
29
|
+
return new AggregatedMap([super.services, this.owner.services]);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
get hosts() {
|
package/src/owner.mjs
CHANGED
package/src/service-owner.mjs
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import { Base, Service } from "pmcf";
|
|
2
2
|
|
|
3
3
|
export class ServiceOwner extends Base {
|
|
4
|
-
|
|
4
|
+
_services = new Map();
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
set services(service) {
|
|
7
|
+
this._services.set(service.name, service);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
get services() {
|
|
11
|
+
return this.mapFromDirections(["this", "extends"], "_services");
|
|
9
12
|
}
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
addObject(object)
|
|
15
|
+
{
|
|
16
|
+
if(object instanceof Service) {
|
|
17
|
+
this._services.set(object.name, object);
|
|
14
18
|
}
|
|
19
|
+
|
|
20
|
+
super.addObject(object);
|
|
15
21
|
}
|
|
16
22
|
|
|
17
|
-
|
|
23
|
+
_materializeExtends() {
|
|
18
24
|
super.materializeExtends();
|
|
19
25
|
|
|
20
26
|
for (const serviceOwner of this.walkDirections(["extends"])) {
|
|
@@ -24,27 +30,25 @@ export class ServiceOwner extends Base {
|
|
|
24
30
|
serviceOwner.fullName
|
|
25
31
|
);*/
|
|
26
32
|
|
|
27
|
-
for (const service of serviceOwner.services) {
|
|
28
|
-
const present = this.services.
|
|
33
|
+
for (const service of serviceOwner.services.values()) {
|
|
34
|
+
const present = this.services.get(service.name);
|
|
29
35
|
|
|
30
36
|
if (present) {
|
|
31
37
|
//console.log("LINK SERVICE", this.fullName, present.fullName, service.fullName);
|
|
32
38
|
present.extends.add(service);
|
|
33
39
|
} else {
|
|
34
40
|
//console.log("ADD SERVICE", this.fullName, service.fullName);
|
|
35
|
-
|
|
41
|
+
|
|
42
|
+
const s = service.forOwner(this);
|
|
43
|
+
this._services.set(s.name, s);
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
|
-
|
|
39
|
-
/*for (const service of this.services) {
|
|
40
|
-
service.materializeExtends();
|
|
41
|
-
}*/
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
_traverse(...args) {
|
|
46
50
|
if (super._traverse(...args)) {
|
|
47
|
-
for (const service of this.
|
|
51
|
+
for (const service of this._services.values()) {
|
|
48
52
|
service._traverse(...args);
|
|
49
53
|
}
|
|
50
54
|
|
|
@@ -55,7 +59,7 @@ export class ServiceOwner extends Base {
|
|
|
55
59
|
|
|
56
60
|
typeNamed(typeName, name) {
|
|
57
61
|
if (typeName === "service") {
|
|
58
|
-
const service = this.services.
|
|
62
|
+
const service = this.services.get(name);
|
|
59
63
|
if (service) {
|
|
60
64
|
return service;
|
|
61
65
|
}
|
|
@@ -73,6 +77,6 @@ export class ServiceOwner extends Base {
|
|
|
73
77
|
* @returns {Service|undefined}
|
|
74
78
|
*/
|
|
75
79
|
named(name) {
|
|
76
|
-
return this.services.
|
|
80
|
+
return this.services.get(name);
|
|
77
81
|
}
|
|
78
82
|
}
|