pmcf 4.26.0 → 4.27.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/package.json +2 -2
- package/src/base.mjs +22 -2
- package/src/host.mjs +5 -13
- package/src/location.mjs +1 -2
- package/src/network.mjs +3 -2
- package/src/owner.mjs +3 -2
- package/src/service-owner.mjs +21 -0
- package/src/service.mjs +7 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.27.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"content-entry-transform": "^1.6.9",
|
|
55
55
|
"ip-utilties": "^3.0.4",
|
|
56
56
|
"npm-pkgbuild": "^20.7.3",
|
|
57
|
-
"pacc": "^9.3.
|
|
57
|
+
"pacc": "^9.3.1",
|
|
58
58
|
"package-directory": "^8.2.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
package/src/base.mjs
CHANGED
|
@@ -44,7 +44,7 @@ export class Base {
|
|
|
44
44
|
packaging: string_attribute_writable,
|
|
45
45
|
disabled: boolean_attribute_writable,
|
|
46
46
|
tags: string_set_attribute_writable,
|
|
47
|
-
owner: { ...default_attribute, type: "base" },
|
|
47
|
+
owner: { ...default_attribute, type: "base", owner: false },
|
|
48
48
|
type: string_attribute
|
|
49
49
|
};
|
|
50
50
|
|
|
@@ -149,6 +149,23 @@ export class Base {
|
|
|
149
149
|
return collected;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
get children() {
|
|
153
|
+
const all = [];
|
|
154
|
+
|
|
155
|
+
for (const [path, attribute] of extendingAttributeIterator(
|
|
156
|
+
this.constructor,
|
|
157
|
+
(name, attribute) => attribute.owner && !attribute.type.primitive
|
|
158
|
+
)) {
|
|
159
|
+
if (attribute.collection) {
|
|
160
|
+
all.push(...this[path].values());
|
|
161
|
+
} else {
|
|
162
|
+
all.push(this[path]);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return all;
|
|
167
|
+
}
|
|
168
|
+
|
|
152
169
|
/**
|
|
153
170
|
* Walk the object graph in some directions and deliver seen nodes.
|
|
154
171
|
* @param {string[]} directions
|
|
@@ -229,7 +246,10 @@ export class Base {
|
|
|
229
246
|
* @return {Iterable<[string,any]>} values
|
|
230
247
|
*/
|
|
231
248
|
*attributeIterator(filter) {
|
|
232
|
-
for (const [path, def] of extendingAttributeIterator(
|
|
249
|
+
for (const [path, def] of extendingAttributeIterator(
|
|
250
|
+
this.constructor,
|
|
251
|
+
filter
|
|
252
|
+
)) {
|
|
233
253
|
const name = path.join(".");
|
|
234
254
|
const value = this.attribute(name);
|
|
235
255
|
|
package/src/host.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
boolean_attribute_false,
|
|
11
11
|
addType
|
|
12
12
|
} from "pacc";
|
|
13
|
-
import {
|
|
13
|
+
import { NetworkInterface, addresses } from "pmcf";
|
|
14
14
|
import { ServiceOwner } from "./service-owner.mjs";
|
|
15
15
|
import { networkAddressAttributes } from "./network-support.mjs";
|
|
16
16
|
import { addHook } from "./hooks.mjs";
|
|
@@ -28,7 +28,7 @@ export class Host extends ServiceOwner {
|
|
|
28
28
|
static name = "host";
|
|
29
29
|
static priority = 1.9;
|
|
30
30
|
static owners = ["owner", "network", "root"];
|
|
31
|
-
static extends =
|
|
31
|
+
static extends = ServiceOwner;
|
|
32
32
|
static key = "name";
|
|
33
33
|
static attributes = {
|
|
34
34
|
...networkAddressAttributes,
|
|
@@ -37,11 +37,6 @@ export class Host extends ServiceOwner {
|
|
|
37
37
|
type: "network_interface",
|
|
38
38
|
collection: true
|
|
39
39
|
},
|
|
40
|
-
services: {
|
|
41
|
-
...default_attribute_writable,
|
|
42
|
-
type: "service",
|
|
43
|
-
collection: true
|
|
44
|
-
},
|
|
45
40
|
aliases: string_set_attribute_writable,
|
|
46
41
|
os: {
|
|
47
42
|
...string_attribute_writable,
|
|
@@ -82,12 +77,11 @@ export class Host extends ServiceOwner {
|
|
|
82
77
|
replaces: string_set_attribute_writable,
|
|
83
78
|
depends: string_set_attribute_writable,
|
|
84
79
|
provides: string_set_attribute_writable,
|
|
85
|
-
extends: { ...default_attribute_writable, type: "host", collection: true },
|
|
80
|
+
extends: { ...default_attribute_writable, type: "host", collection: true, owner: false },
|
|
86
81
|
model: string_attribute,
|
|
87
82
|
isModel: boolean_attribute_false
|
|
88
83
|
};
|
|
89
84
|
|
|
90
|
-
|
|
91
85
|
static {
|
|
92
86
|
addType(this);
|
|
93
87
|
}
|
|
@@ -111,16 +105,14 @@ export class Host extends ServiceOwner {
|
|
|
111
105
|
super.materializeExtends();
|
|
112
106
|
|
|
113
107
|
for (const host of this.walkDirections(["extends"])) {
|
|
114
|
-
|
|
115
|
-
|
|
116
108
|
for (const [name, ni] of host.networkInterfaces) {
|
|
117
|
-
const present = this._networkInterfaces.get(name);
|
|
109
|
+
const present = this._networkInterfaces.get(ni.name);
|
|
118
110
|
|
|
119
111
|
if (present) {
|
|
120
112
|
//console.log("LINK", present.fullName, ni.fullName,present.extends);
|
|
121
113
|
present.extends.add(ni);
|
|
122
114
|
} else {
|
|
123
|
-
this._networkInterfaces.set(name, ni.forOwner(this));
|
|
115
|
+
this._networkInterfaces.set(ni.name, ni.forOwner(this));
|
|
124
116
|
}
|
|
125
117
|
}
|
|
126
118
|
}
|
package/src/location.mjs
CHANGED
|
@@ -6,12 +6,11 @@ import { loadHooks } from "./hooks.mjs";
|
|
|
6
6
|
export class Location extends Owner {
|
|
7
7
|
static name = "location";
|
|
8
8
|
static priority = 2;
|
|
9
|
-
static owners = [Owner,
|
|
9
|
+
static owners = [Owner, Location, "root"];
|
|
10
10
|
static extends = Owner;
|
|
11
11
|
static key = "name";
|
|
12
12
|
static attributes = {};
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
static {
|
|
16
15
|
addType(this);
|
|
17
16
|
}
|
package/src/network.mjs
CHANGED
|
@@ -14,9 +14,10 @@ export class Network extends Owner {
|
|
|
14
14
|
bridge: {
|
|
15
15
|
...default_attribute_writable,
|
|
16
16
|
type: "network",
|
|
17
|
-
collection: true
|
|
17
|
+
collection: true,
|
|
18
|
+
owner: false
|
|
18
19
|
},
|
|
19
|
-
gateway: { ...default_attribute_writable, type: "host" }
|
|
20
|
+
gateway: { ...default_attribute_writable, type: "host", owner: false }
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
|
package/src/owner.mjs
CHANGED
|
@@ -23,11 +23,12 @@ export class Owner extends Base {
|
|
|
23
23
|
static key = "name";
|
|
24
24
|
static attributes = {
|
|
25
25
|
networks: networks_attribute,
|
|
26
|
-
hosts: { ...default_attribute_writable, type: "host", collection: true },
|
|
26
|
+
hosts: { ...default_attribute_writable, type: "host", collection: true, owner: true },
|
|
27
27
|
clusters: {
|
|
28
28
|
...default_attribute_writable,
|
|
29
29
|
type: "cluster",
|
|
30
|
-
collection: true
|
|
30
|
+
collection: true,
|
|
31
|
+
owner: true
|
|
31
32
|
},
|
|
32
33
|
subnets: {
|
|
33
34
|
...default_attribute_writable,
|
package/src/service-owner.mjs
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
default_attribute_writable,
|
|
3
|
+
addType
|
|
4
|
+
} from "pacc";
|
|
1
5
|
import { Base, Service } from "pmcf";
|
|
2
6
|
|
|
3
7
|
export class ServiceOwner extends Base {
|
|
8
|
+
static name = "service-owner";
|
|
9
|
+
static priority = 1.9;
|
|
10
|
+
static owners = ["owner", "network", "root"];
|
|
11
|
+
static extends = Base;
|
|
12
|
+
static key = "name";
|
|
13
|
+
static attributes = {
|
|
14
|
+
services: {
|
|
15
|
+
...default_attribute_writable,
|
|
16
|
+
type: "service",
|
|
17
|
+
collection: true
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
static {
|
|
22
|
+
addType(this);
|
|
23
|
+
}
|
|
24
|
+
|
|
4
25
|
_services = new Map();
|
|
5
26
|
|
|
6
27
|
set services(service) {
|
package/src/service.mjs
CHANGED
|
@@ -33,7 +33,7 @@ export const endpointAttributes = {
|
|
|
33
33
|
port: number_attribute_writable,
|
|
34
34
|
protocol: {
|
|
35
35
|
...string_attribute_writable,
|
|
36
|
-
values: ["tcp", "udp"]
|
|
36
|
+
values: ["tcp", "udp", "quic"]
|
|
37
37
|
},
|
|
38
38
|
type: string_attribute_writable,
|
|
39
39
|
types: string_set_attribute,
|
|
@@ -61,7 +61,12 @@ export class Service extends Base {
|
|
|
61
61
|
static attributes = {
|
|
62
62
|
...networkAddressAttributes,
|
|
63
63
|
...endpointAttributes,
|
|
64
|
-
extends: {
|
|
64
|
+
extends: {
|
|
65
|
+
...default_attribute_writable,
|
|
66
|
+
type: Service,
|
|
67
|
+
collection: true,
|
|
68
|
+
owner: false
|
|
69
|
+
},
|
|
65
70
|
alias: string_attribute_writable,
|
|
66
71
|
weight: { ...number_attribute_writable /*default: 1*/ },
|
|
67
72
|
systemdService: string_attribute_writable
|