pmcf 6.24.1 → 6.26.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/bin/pmcf-info +28 -8
- package/package.json +1 -1
- package/src/initialization-context.mjs +1 -1
- package/src/service-types.mjs +76 -11
- package/src/services/bind.mjs +4 -16
- package/src/type.mjs +5 -3
package/bin/pmcf-info
CHANGED
|
@@ -2,15 +2,25 @@
|
|
|
2
2
|
import { extendingAttributeIterator } from "pacc";
|
|
3
3
|
import { prepare } from "../src/cli.mjs";
|
|
4
4
|
|
|
5
|
-
const { root, args, options } = await prepare({
|
|
5
|
+
const { root, args, options } = await prepare({
|
|
6
|
+
maxDepth: {
|
|
7
|
+
type: "string",
|
|
8
|
+
short: "m"
|
|
9
|
+
}
|
|
10
|
+
});
|
|
6
11
|
|
|
7
12
|
for (const expression of args) {
|
|
8
13
|
const result = root.expression(expression);
|
|
9
14
|
|
|
10
|
-
show(result);
|
|
15
|
+
show(result, 0, { short: false, maxDepth: options.maxDepth });
|
|
11
16
|
}
|
|
12
17
|
|
|
13
|
-
function show(value, indent = 0,
|
|
18
|
+
function show(value, indent = 0, options = { short: false, maxDepth: 5 }) {
|
|
19
|
+
if (indent >= options.maxDepth) {
|
|
20
|
+
console.log("...");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
14
24
|
switch (typeof value) {
|
|
15
25
|
case "string":
|
|
16
26
|
case "number":
|
|
@@ -23,7 +33,7 @@ function show(value, indent = 0, short = false) {
|
|
|
23
33
|
|
|
24
34
|
if (value instanceof Iterator || Array.isArray(value)) {
|
|
25
35
|
for (const v of value) {
|
|
26
|
-
show(v, indent);
|
|
36
|
+
show(v, indent, options);
|
|
27
37
|
}
|
|
28
38
|
} else {
|
|
29
39
|
const type = value.constructor;
|
|
@@ -32,7 +42,12 @@ function show(value, indent = 0, short = false) {
|
|
|
32
42
|
const name = (attribute, l = indent + 1) =>
|
|
33
43
|
prefix(l) + attribute.name.padEnd(ml) + ": ";
|
|
34
44
|
|
|
35
|
-
if (
|
|
45
|
+
if (value instanceof Set || Array.isArray(value)) {
|
|
46
|
+
console.log([...value].join(" "));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (options.short) {
|
|
36
51
|
console.log(`${prefix()}${value[type.key]}:`);
|
|
37
52
|
} else {
|
|
38
53
|
console.log(`${prefix()}${value.fullName}(${type.name}):`);
|
|
@@ -71,9 +86,14 @@ function show(value, indent = 0, short = false) {
|
|
|
71
86
|
if (v !== undefined) {
|
|
72
87
|
if (attribute.collection) {
|
|
73
88
|
if (attribute.backpointer) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
89
|
+
if (indent + 2 >= options.maxDepth) {
|
|
90
|
+
console.log(name(attribute), "...");
|
|
91
|
+
} else {
|
|
92
|
+
console.log(name(attribute));
|
|
93
|
+
|
|
94
|
+
for (const o of v.values()) {
|
|
95
|
+
show(o, indent + 2, { ...options, short: true });
|
|
96
|
+
}
|
|
77
97
|
}
|
|
78
98
|
} else {
|
|
79
99
|
const l = [...v];
|
package/package.json
CHANGED
|
@@ -48,7 +48,7 @@ export class InitializationContext {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
instantiateAndAssign(object, attribute, value) {
|
|
51
|
-
if (attribute.type.primitive || attribute.
|
|
51
|
+
if (attribute.type.primitive || attribute.deferredExpression) {
|
|
52
52
|
return assign(attribute, object, value);
|
|
53
53
|
}
|
|
54
54
|
if (value !== undefined) {
|
package/src/service-types.mjs
CHANGED
|
@@ -77,14 +77,38 @@ export const ServiceTypes = {
|
|
|
77
77
|
},
|
|
78
78
|
ldap: {
|
|
79
79
|
endpoints: [
|
|
80
|
-
{
|
|
81
|
-
|
|
80
|
+
{
|
|
81
|
+
family: FAMILY_IPV4,
|
|
82
|
+
scheme: "ldap",
|
|
83
|
+
protocol: "tcp",
|
|
84
|
+
port: 389,
|
|
85
|
+
tls: false
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
family: FAMILY_IPV6,
|
|
89
|
+
scheme: "ldap",
|
|
90
|
+
protocol: "tcp",
|
|
91
|
+
port: 389,
|
|
92
|
+
tls: false
|
|
93
|
+
}
|
|
82
94
|
]
|
|
83
95
|
},
|
|
84
96
|
ldaps: {
|
|
85
97
|
endpoints: [
|
|
86
|
-
{
|
|
87
|
-
|
|
98
|
+
{
|
|
99
|
+
family: FAMILY_IPV4,
|
|
100
|
+
scheme: "ldaps",
|
|
101
|
+
protocol: "tcp",
|
|
102
|
+
port: 636,
|
|
103
|
+
tls: true
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
family: FAMILY_IPV6,
|
|
107
|
+
scheme: "ldaps",
|
|
108
|
+
protocol: "tcp",
|
|
109
|
+
port: 636,
|
|
110
|
+
tls: true
|
|
111
|
+
}
|
|
88
112
|
]
|
|
89
113
|
},
|
|
90
114
|
ldapi: {
|
|
@@ -92,21 +116,57 @@ export const ServiceTypes = {
|
|
|
92
116
|
},
|
|
93
117
|
http: {
|
|
94
118
|
endpoints: [
|
|
95
|
-
{
|
|
96
|
-
|
|
119
|
+
{
|
|
120
|
+
family: FAMILY_IPV4,
|
|
121
|
+
scheme: "http",
|
|
122
|
+
protocol: "tcp",
|
|
123
|
+
port: 80,
|
|
124
|
+
tls: false
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
family: FAMILY_IPV6,
|
|
128
|
+
scheme: "http",
|
|
129
|
+
protocol: "tcp",
|
|
130
|
+
port: 80,
|
|
131
|
+
tls: false
|
|
132
|
+
}
|
|
97
133
|
]
|
|
98
134
|
},
|
|
99
135
|
https: {
|
|
100
136
|
endpoints: [
|
|
101
|
-
{
|
|
102
|
-
|
|
137
|
+
{
|
|
138
|
+
family: FAMILY_IPV4,
|
|
139
|
+
scheme: "https",
|
|
140
|
+
protocol: "tcp",
|
|
141
|
+
port: 443,
|
|
142
|
+
tls: true
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
family: FAMILY_IPV6,
|
|
146
|
+
scheme: "https",
|
|
147
|
+
protocol: "tcp",
|
|
148
|
+
port: 443,
|
|
149
|
+
tls: true
|
|
150
|
+
}
|
|
103
151
|
],
|
|
104
152
|
dnsRecord: { type: "HTTPS", parameters: { alpn: "h2" } }
|
|
105
153
|
},
|
|
106
154
|
http3: {
|
|
107
155
|
endpoints: [
|
|
108
|
-
{
|
|
109
|
-
|
|
156
|
+
{
|
|
157
|
+
family: FAMILY_IPV4,
|
|
158
|
+
scheme: "https",
|
|
159
|
+
protocol: "udp",
|
|
160
|
+
port: 443,
|
|
161
|
+
tls: true
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
family: FAMILY_IPV6,
|
|
165
|
+
scheme: "https",
|
|
166
|
+
protocol: "udp",
|
|
167
|
+
port: 443,
|
|
168
|
+
tls: true
|
|
169
|
+
}
|
|
110
170
|
],
|
|
111
171
|
dnsRecord: {
|
|
112
172
|
type: "HTTPS",
|
|
@@ -168,13 +228,18 @@ export const ServiceTypes = {
|
|
|
168
228
|
{ family: FAMILY_IPV6, protocol: "udp", port: 546, tls: false }
|
|
169
229
|
]
|
|
170
230
|
},
|
|
171
|
-
"dhcpv6-server": {
|
|
231
|
+
"dhcpv6-server": {
|
|
232
|
+
endpoints: [{ family: FAMILY_IPV6, port: 547, tls: false }]
|
|
233
|
+
},
|
|
172
234
|
smb: {
|
|
173
235
|
endpoints: [
|
|
174
236
|
{ family: FAMILY_IPV4, protocol: "tcp", port: 445, tls: false },
|
|
175
237
|
{ family: FAMILY_IPV6, protocol: "tcp", port: 445, tls: false }
|
|
176
238
|
]
|
|
177
239
|
},
|
|
240
|
+
nginx: {
|
|
241
|
+
extends: ["http", "https", "http3"]
|
|
242
|
+
},
|
|
178
243
|
timemachine: {
|
|
179
244
|
extends: ["smb"],
|
|
180
245
|
dnsRecord: {
|
package/src/services/bind.mjs
CHANGED
|
@@ -205,7 +205,7 @@ class bind_group extends Base {
|
|
|
205
205
|
...default_collection_attribute_writable,
|
|
206
206
|
type: NetworkAddress,
|
|
207
207
|
name: "entries",
|
|
208
|
-
|
|
208
|
+
deferredExpression: true
|
|
209
209
|
},
|
|
210
210
|
domains: {
|
|
211
211
|
...string_set_attribute,
|
|
@@ -245,10 +245,6 @@ class bind_group extends Base {
|
|
|
245
245
|
...boolean_attribute_writable_false,
|
|
246
246
|
name: "hasSVRRecords"
|
|
247
247
|
},
|
|
248
|
-
hasLinkLocalAdresses: {
|
|
249
|
-
...boolean_attribute_writable_false,
|
|
250
|
-
name: "hasLinkLocalAdresses"
|
|
251
|
-
},
|
|
252
248
|
hasLocationRecord: {
|
|
253
249
|
...boolean_attribute_writable_true,
|
|
254
250
|
name: "hasLocationRecord"
|
|
@@ -283,23 +279,14 @@ class bind_group extends Base {
|
|
|
283
279
|
notify = true;
|
|
284
280
|
hasCatalog = true;
|
|
285
281
|
hasSVRRecords = true;
|
|
286
|
-
hasLinkLocalAdresses = bind_group.attributes.hasLinkLocalAdresses.default;
|
|
287
282
|
recordTTL = "1W";
|
|
288
283
|
|
|
289
|
-
set entries(value) {
|
|
290
|
-
this._entries = value;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
get entries() {
|
|
294
|
-
return this._entries ? this.expression(this._entries) : [];
|
|
295
|
-
}
|
|
296
|
-
|
|
297
284
|
/**
|
|
298
285
|
* Type of the group.
|
|
299
286
|
* @return {string} view | unknown
|
|
300
287
|
*/
|
|
301
288
|
get type() {
|
|
302
|
-
if (this.sharedWith || this.
|
|
289
|
+
if (this.sharedWith || this.entries) {
|
|
303
290
|
return "view";
|
|
304
291
|
}
|
|
305
292
|
|
|
@@ -367,7 +354,8 @@ class bind_group extends Base {
|
|
|
367
354
|
}
|
|
368
355
|
|
|
369
356
|
get zones() {
|
|
370
|
-
const
|
|
357
|
+
const e = this.entries;
|
|
358
|
+
const entries = e === undefined ? [] : [...e];
|
|
371
359
|
|
|
372
360
|
if (!this._zones && entries.length > 0) {
|
|
373
361
|
this._zoneConfigs = new Map();
|
package/src/type.mjs
CHANGED
|
@@ -33,13 +33,15 @@ export function assign(attribute, object, value) {
|
|
|
33
33
|
value ??= attribute.default;
|
|
34
34
|
|
|
35
35
|
if (value !== undefined) {
|
|
36
|
-
// set
|
|
36
|
+
// set backpointer early so that parent properties can be found during load
|
|
37
37
|
if (attribute.backpointer) {
|
|
38
38
|
assign(attribute.backpointer, value, object);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
if (attribute.
|
|
42
|
-
object
|
|
41
|
+
if (attribute.deferredExpression) {
|
|
42
|
+
Object.defineProperty(object, attribute.name, {
|
|
43
|
+
get: () => object.expression(value)
|
|
44
|
+
});
|
|
43
45
|
return value;
|
|
44
46
|
}
|
|
45
47
|
|