pmcf 6.18.1 → 6.19.0
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 +32 -26
- package/package.json +2 -2
- package/src/base.mjs +7 -1
- package/src/initialization-context.mjs +3 -9
- package/src/network-address.mjs +26 -14
- package/src/network-interfaces/network-interface.mjs +9 -2
- package/src/network.mjs +1 -1
- package/src/owner.mjs +1 -1
- package/src/subnet.mjs +7 -6
- package/src/type.mjs +11 -6
package/README.md
CHANGED
|
@@ -42,83 +42,89 @@ generates config packages for:
|
|
|
42
42
|
### Table of Contents
|
|
43
43
|
|
|
44
44
|
* [Base](#base)
|
|
45
|
+
* [Parameters](#parameters)
|
|
45
46
|
* [mapFromDirections](#mapfromdirections)
|
|
46
|
-
* [Parameters](#parameters)
|
|
47
|
-
* [unionFromDirections](#unionfromdirections)
|
|
48
47
|
* [Parameters](#parameters-1)
|
|
49
|
-
* [
|
|
48
|
+
* [unionFromDirections](#unionfromdirections)
|
|
50
49
|
* [Parameters](#parameters-2)
|
|
51
|
-
* [
|
|
50
|
+
* [walkDirections](#walkdirections)
|
|
52
51
|
* [Parameters](#parameters-3)
|
|
53
|
-
* [
|
|
52
|
+
* [attribute](#attribute)
|
|
54
53
|
* [Parameters](#parameters-4)
|
|
55
|
-
* [
|
|
54
|
+
* [attributeIterator](#attributeiterator)
|
|
56
55
|
* [Parameters](#parameters-5)
|
|
57
|
-
* [
|
|
56
|
+
* [getAttributes](#getattributes)
|
|
58
57
|
* [Parameters](#parameters-6)
|
|
58
|
+
* [property](#property)
|
|
59
|
+
* [Parameters](#parameters-7)
|
|
59
60
|
* [priority](#priority)
|
|
60
61
|
* [expression](#expression)
|
|
61
|
-
* [Parameters](#parameters-7)
|
|
62
|
-
* [templateContent](#templatecontent)
|
|
63
62
|
* [Parameters](#parameters-8)
|
|
63
|
+
* [templateContent](#templatecontent)
|
|
64
|
+
* [Parameters](#parameters-9)
|
|
64
65
|
* [isTemplate](#istemplate)
|
|
65
66
|
* [expand](#expand)
|
|
66
|
-
* [Parameters](#parameters-
|
|
67
|
+
* [Parameters](#parameters-10)
|
|
67
68
|
* [serviceEndpoints](#serviceendpoints)
|
|
68
|
-
* [Parameters](#parameters-10)
|
|
69
|
-
* [PortEndpoint](#portendpoint)
|
|
70
69
|
* [Parameters](#parameters-11)
|
|
70
|
+
* [PortEndpoint](#portendpoint)
|
|
71
|
+
* [Parameters](#parameters-12)
|
|
71
72
|
* [port](#port)
|
|
72
73
|
* [socketAddress](#socketaddress)
|
|
73
74
|
* [HTTPEndpoint](#httpendpoint)
|
|
74
|
-
* [Parameters](#parameters-
|
|
75
|
+
* [Parameters](#parameters-13)
|
|
75
76
|
* [port](#port-1)
|
|
76
77
|
* [id](#id)
|
|
77
78
|
* [domainNames](#domainnames)
|
|
78
79
|
* [InitializationContext](#initializationcontext)
|
|
79
|
-
* [Parameters](#parameters-
|
|
80
|
+
* [Parameters](#parameters-14)
|
|
80
81
|
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
81
82
|
* [networkAddresses](#networkaddresses)
|
|
82
|
-
* [Parameters](#parameters-
|
|
83
|
+
* [Parameters](#parameters-15)
|
|
83
84
|
* [type](#type)
|
|
84
85
|
* [SystemdJournalRemoteService](#systemdjournalremoteservice)
|
|
85
86
|
* [Properties](#properties)
|
|
86
87
|
* [systemdConfigs](#systemdconfigs)
|
|
87
|
-
* [Parameters](#parameters-
|
|
88
|
+
* [Parameters](#parameters-16)
|
|
88
89
|
* [SystemdJournalUploadService](#systemdjournaluploadservice)
|
|
89
90
|
* [Properties](#properties-1)
|
|
90
91
|
* [systemdConfigs](#systemdconfigs-1)
|
|
91
|
-
* [Parameters](#parameters-
|
|
92
|
+
* [Parameters](#parameters-17)
|
|
92
93
|
* [NetworkAddress](#networkaddress)
|
|
93
|
-
* [Parameters](#parameters-
|
|
94
|
+
* [Parameters](#parameters-18)
|
|
94
95
|
* [subnet](#subnet)
|
|
95
96
|
* [networkInterface](#networkinterface)
|
|
96
97
|
* [address](#address)
|
|
97
98
|
* [addresses](#addresses)
|
|
98
|
-
* [Parameters](#parameters-18)
|
|
99
|
-
* [cidrAddresses](#cidraddresses)
|
|
100
99
|
* [Parameters](#parameters-19)
|
|
100
|
+
* [cidrAddresses](#cidraddresses)
|
|
101
|
+
* [Parameters](#parameters-20)
|
|
101
102
|
* [families](#families)
|
|
102
103
|
* [secretName](#secretname)
|
|
103
104
|
* [directHosts](#directhosts)
|
|
104
105
|
* [subnetForAddress](#subnetforaddress)
|
|
105
|
-
* [Parameters](#parameters-20)
|
|
106
|
-
* [domainName](#domainname)
|
|
107
106
|
* [Parameters](#parameters-21)
|
|
108
|
-
* [
|
|
107
|
+
* [domainName](#domainname)
|
|
109
108
|
* [Parameters](#parameters-22)
|
|
110
|
-
* [
|
|
109
|
+
* [domainFromDominName](#domainfromdominname)
|
|
111
110
|
* [Parameters](#parameters-23)
|
|
112
|
-
* [
|
|
111
|
+
* [sectionLines](#sectionlines)
|
|
113
112
|
* [Parameters](#parameters-24)
|
|
114
|
-
* [
|
|
113
|
+
* [asArray](#asarray)
|
|
115
114
|
* [Parameters](#parameters-25)
|
|
115
|
+
* [asIterator](#asiterator)
|
|
116
|
+
* [Parameters](#parameters-26)
|
|
116
117
|
|
|
117
118
|
## Base
|
|
118
119
|
|
|
119
120
|
attributes: as declared in the types
|
|
120
121
|
properties: use defined values to support attribute value definitions
|
|
121
122
|
|
|
123
|
+
### Parameters
|
|
124
|
+
|
|
125
|
+
* `owner`  
|
|
126
|
+
* `data`  
|
|
127
|
+
|
|
122
128
|
### mapFromDirections
|
|
123
129
|
|
|
124
130
|
Deliver AggregatedMap of all property Maps.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.19.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"content-entry-transform": "^1.7.0",
|
|
55
55
|
"ip-utilties": "^3.10.0",
|
|
56
56
|
"npm-pkgbuild": "^20.8.9",
|
|
57
|
-
"pacc": "^11.0.
|
|
57
|
+
"pacc": "^11.0.2",
|
|
58
58
|
"package-directory": "^8.2.0",
|
|
59
59
|
"yaml": "^2.9.0"
|
|
60
60
|
},
|
package/src/base.mjs
CHANGED
|
@@ -37,9 +37,9 @@ export class Base {
|
|
|
37
37
|
static key = "name";
|
|
38
38
|
static priority = 0;
|
|
39
39
|
static attributes = {
|
|
40
|
+
owner: owner_attribute,
|
|
40
41
|
name: name_attribute_writable,
|
|
41
42
|
description: description_attribute_writable,
|
|
42
|
-
owner: owner_attribute,
|
|
43
43
|
type: type_attribute,
|
|
44
44
|
directory: { ...string_attribute_writable, name: "directory" },
|
|
45
45
|
packaging: { ...string_set_attribute_writable, name: "packaging" },
|
|
@@ -66,6 +66,12 @@ export class Base {
|
|
|
66
66
|
_packaging = new Set();
|
|
67
67
|
_directory;
|
|
68
68
|
|
|
69
|
+
constructor(owner, data) {
|
|
70
|
+
if (owner) {
|
|
71
|
+
this.owner = owner;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
69
75
|
set owner(value) {
|
|
70
76
|
if (this === value || this === value?.owner) {
|
|
71
77
|
this.error("Unable to own myself", value.fullName);
|
|
@@ -48,7 +48,7 @@ export class InitializationContext {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
instantiateAndAssign(object, attribute, value) {
|
|
51
|
-
if (attribute.type.primitive) {
|
|
51
|
+
if (attribute.type.primitive || attribute.expression) {
|
|
52
52
|
return assign(attribute, object, value);
|
|
53
53
|
}
|
|
54
54
|
if (value !== undefined) {
|
|
@@ -178,15 +178,9 @@ export class InitializationContext {
|
|
|
178
178
|
attribute => attribute.type === type && attribute.collection
|
|
179
179
|
)) {
|
|
180
180
|
try {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
// set backointer early so that parent properties can be found during load
|
|
184
|
-
if (attribute.backpointer) {
|
|
185
|
-
assign(attribute.backpointer, object, owner);
|
|
186
|
-
}
|
|
187
|
-
return assign(attribute, owner, this.read(object, data));
|
|
181
|
+
return assign(attribute, owner, this.read(create(type, owner, data), data));
|
|
188
182
|
} catch (e) {
|
|
189
|
-
this.error(`Unable to assign ${type.name}.${attribute.name}`, data);
|
|
183
|
+
this.error(`Unable to assign ${type.name}.${attribute.name}`, e, data);
|
|
190
184
|
}
|
|
191
185
|
}
|
|
192
186
|
|
package/src/network-address.mjs
CHANGED
|
@@ -14,20 +14,20 @@ import { NetworkInterface } from "./network-interfaces/network-interface.mjs";
|
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
16
|
export class NetworkAddress {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
static name = "network-address";
|
|
18
|
+
static priority = 1;
|
|
19
|
+
static key = "address";
|
|
20
|
+
static attributes = {
|
|
21
|
+
address: { ...name_attribute, name: "address" },
|
|
22
|
+
cidrAddress: { ...string_attribute, name: "cidrAddress" },
|
|
23
|
+
networkInterface: {
|
|
24
|
+
...default_attribute,
|
|
25
|
+
name: "networkInterface",
|
|
26
|
+
type: "network_interface"
|
|
27
|
+
},
|
|
28
|
+
family: { ...string_attribute, name: "family" }
|
|
29
|
+
};
|
|
30
|
+
|
|
31
31
|
static {
|
|
32
32
|
addType(this);
|
|
33
33
|
}
|
|
@@ -48,10 +48,18 @@ export class NetworkAddress {
|
|
|
48
48
|
this.subnet = subnet;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
get host() {
|
|
52
|
+
return this.networkInterface.host;
|
|
53
|
+
}
|
|
54
|
+
|
|
51
55
|
get domainNames() {
|
|
52
56
|
return this.networkInterface.domainNames;
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
get domains() {
|
|
60
|
+
return this.networkInterface.domains;
|
|
61
|
+
}
|
|
62
|
+
|
|
55
63
|
get family() {
|
|
56
64
|
return familyIP(this.address);
|
|
57
65
|
}
|
|
@@ -60,6 +68,10 @@ export class NetworkAddress {
|
|
|
60
68
|
return formatCIDR(this.address, this.subnet.prefixLength);
|
|
61
69
|
}
|
|
62
70
|
|
|
71
|
+
get fullName() {
|
|
72
|
+
return `${this.networkInterface.fullName}/${decodeIP(this.address)}`;
|
|
73
|
+
}
|
|
74
|
+
|
|
63
75
|
toString() {
|
|
64
76
|
return `${this.networkInterface.fullName} ${decodeIP(this.address)}`;
|
|
65
77
|
}
|
|
@@ -107,10 +107,17 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
107
107
|
set hostName(value) {
|
|
108
108
|
this._hostName = value;
|
|
109
109
|
}
|
|
110
|
+
|
|
111
|
+
get domains() {
|
|
112
|
+
if (!this.host) {
|
|
113
|
+
return new Set();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return this.host.localDomains;
|
|
117
|
+
}
|
|
110
118
|
|
|
111
119
|
get domainNames() {
|
|
112
|
-
if(!this.host) {
|
|
113
|
-
//console.log("NO HOST",this.fullName);
|
|
120
|
+
if (!this.host) {
|
|
114
121
|
return new Set();
|
|
115
122
|
}
|
|
116
123
|
return this.hostName
|
package/src/network.mjs
CHANGED
|
@@ -53,7 +53,7 @@ export class Network extends Owner {
|
|
|
53
53
|
|
|
54
54
|
get subnets() {
|
|
55
55
|
if (!this._subnets.get("fe80::/64")) {
|
|
56
|
-
const linkLocal = new Subnet("fe80::/64");
|
|
56
|
+
const linkLocal = new Subnet(this, "fe80::/64");
|
|
57
57
|
this._subnets.set(linkLocal.address, linkLocal);
|
|
58
58
|
//assign(subnets_attribute, this, linkLocal);
|
|
59
59
|
}
|
package/src/owner.mjs
CHANGED
|
@@ -135,7 +135,7 @@ export class Owner extends ServiceOwner {
|
|
|
135
135
|
if (cidr && prefixLength !== 0) {
|
|
136
136
|
return (
|
|
137
137
|
this._subnets.get(cidr) ||
|
|
138
|
-
assign(subnets_attribute, this, new Subnet(cidr))
|
|
138
|
+
assign(subnets_attribute, this, new Subnet(this, cidr))
|
|
139
139
|
);
|
|
140
140
|
}
|
|
141
141
|
|
package/src/subnet.mjs
CHANGED
|
@@ -33,8 +33,9 @@ export class Subnet {
|
|
|
33
33
|
|
|
34
34
|
networks = new Set();
|
|
35
35
|
|
|
36
|
-
constructor(address) {
|
|
37
|
-
const { longPrefix, prefix, prefixLength, cidr, family } =
|
|
36
|
+
constructor(owner, address) {
|
|
37
|
+
const { longPrefix, prefix, prefixLength, cidr, family } =
|
|
38
|
+
normalizeCIDR(address);
|
|
38
39
|
|
|
39
40
|
this.address = cidr;
|
|
40
41
|
this.prefix = prefix;
|
|
@@ -99,7 +100,7 @@ export class Subnet {
|
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
|
|
102
|
-
export const SUBNET_GLOBAL_IPV4 = new Subnet("0.0.0.0/0");
|
|
103
|
-
export const SUBNET_GLOBAL_IPV6 = new Subnet("::0/0");
|
|
104
|
-
export const SUBNET_LOCALHOST_IPV4 = new Subnet("127.0.0.1/8");
|
|
105
|
-
export const SUBNET_LOCALHOST_IPV6 = new Subnet("::1/128");
|
|
103
|
+
export const SUBNET_GLOBAL_IPV4 = new Subnet(undefined, "0.0.0.0/0");
|
|
104
|
+
export const SUBNET_GLOBAL_IPV6 = new Subnet(undefined, "::0/0");
|
|
105
|
+
export const SUBNET_LOCALHOST_IPV4 = new Subnet(undefined, "127.0.0.1/8");
|
|
106
|
+
export const SUBNET_LOCALHOST_IPV6 = new Subnet(undefined, "::1/128");
|
package/src/type.mjs
CHANGED
|
@@ -3,8 +3,7 @@ import { normalizeIP } from "ip-utilties";
|
|
|
3
3
|
import { addServiceType } from "pmcf";
|
|
4
4
|
import { asArray } from "./utils.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
const SLASH = {...DOT, str: "/" };
|
|
6
|
+
const SLASH = { ...DOT, str: "/" };
|
|
8
7
|
|
|
9
8
|
registerToken(SLASH);
|
|
10
9
|
|
|
@@ -34,16 +33,22 @@ export function assign(attribute, object, value) {
|
|
|
34
33
|
value ??= attribute.default;
|
|
35
34
|
|
|
36
35
|
if (value !== undefined) {
|
|
36
|
+
// set backointer early so that parent properties can be found during load
|
|
37
|
+
if (attribute.backpointer) {
|
|
38
|
+
assign(attribute.backpointer, value, object);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (attribute.expression) { // TODO
|
|
42
|
+
object[attribute.name] = value;
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
|
|
37
46
|
if (attribute.values) {
|
|
38
47
|
if (!attribute.values.has(value)) {
|
|
39
48
|
error("unkown value", attribute);
|
|
40
49
|
}
|
|
41
50
|
}
|
|
42
51
|
|
|
43
|
-
if (attribute.backpointer) {
|
|
44
|
-
assign(attribute.backpointer, value, object);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
52
|
if (attribute.collection) {
|
|
48
53
|
const current = object[attribute.name];
|
|
49
54
|
|