pmcf 2.15.0 → 2.15.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.15.0",
3
+ "version": "2.15.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/service.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Base } from "./base.mjs";
2
2
  import { addType } from "./types.mjs";
3
+ import { objectFilter } from "./filter.mjs";
3
4
  import { asArray, isLocalhost } from "./utils.mjs";
4
5
  import { networkAddressProperties } from "./network-support.mjs";
5
6
  import {
@@ -59,6 +60,31 @@ const ServiceTypes = {
59
60
  }
60
61
  };
61
62
 
63
+ export const endpointProperties = {
64
+ port: { type: "number", collection: false, writeable: true },
65
+ protocol: {
66
+ type: "string",
67
+ collection: false,
68
+ writeable: true,
69
+ values: ["tcp", "udp"]
70
+ },
71
+ type: { type: "string", collection: false, writeable: true },
72
+ tls: {
73
+ type: "boolean",
74
+ collection: false,
75
+ writeable: false,
76
+ default: false
77
+ }
78
+ };
79
+
80
+ export const EndpointTypeDefinition = {
81
+ name: "endpoint",
82
+ owners: ["service"],
83
+ priority: 0.4,
84
+ specializations: {},
85
+ properties: endpointProperties
86
+ };
87
+
62
88
  export const ServiceTypeDefinition = {
63
89
  name: "service",
64
90
  owners: ["host", "cluster"],
@@ -78,23 +104,10 @@ export const ServiceTypeDefinition = {
78
104
  },
79
105
  properties: {
80
106
  ...networkAddressProperties,
107
+ ...endpointProperties,
81
108
  ipAddresses: { type: "string", collection: true, writeable: true },
82
- port: { type: "number", collection: false, writeable: true },
83
- protocol: {
84
- type: "string",
85
- collection: false,
86
- writeable: true,
87
- values: ["tcp", "udp"]
88
- },
89
109
  alias: { type: "string", collection: false, writeable: true },
90
- type: { type: "string", collection: false, writeable: true },
91
110
  weight: { type: "number", collection: false, writeable: true, default: 1 },
92
- tls: {
93
- type: "string",
94
- collection: false,
95
- writeable: false,
96
- default: false
97
- },
98
111
  systemd: { type: "string", collection: true, writeable: true }
99
112
  }
100
113
  };
@@ -191,6 +204,10 @@ export class Service extends Base {
191
204
  .flat();
192
205
  }
193
206
 
207
+ *findEndpoints(filter) {
208
+ yield* objectFilter(EndpointTypeDefinition, this.endpoints, filter);
209
+ }
210
+
194
211
  set alias(value) {
195
212
  this._alias = value;
196
213
  }
@@ -74,7 +74,7 @@ export class DHCPService extends Service {
74
74
  const dnsServerEndpoints = serviceEndpoints(network, {
75
75
  type: "dns",
76
76
  priority: "<10"
77
- });
77
+ }).filter(endpoint => endpoint.networkInterface.kind !== "loopback");
78
78
 
79
79
  const packageData = {
80
80
  dir,
@@ -144,9 +144,11 @@ export class DHCPService extends Service {
144
144
  domains.map(domain => {
145
145
  return {
146
146
  name: domain,
147
- "dns-servers": dnsServerEndpoints.map(endpoint => {
148
- return { "ip-address": endpoint.rawAddress };
149
- })
147
+ "dns-servers": dnsServerEndpoints
148
+ .filter(endpoint => isIPv4Address(endpoint.rawAddress))
149
+ .map(endpoint => {
150
+ return { "ip-address": endpoint.rawAddress };
151
+ })
150
152
  };
151
153
  });
152
154
 
@@ -240,6 +242,7 @@ export class DHCPService extends Service {
240
242
  {
241
243
  name: "domain-name-servers",
242
244
  data: dnsServerEndpoints
245
+ .filter(endpoint => isIPv4Address(endpoint.rawAddress))
243
246
  .map(endpoint => endpoint.rawAddress)
244
247
  .join(",")
245
248
  },
@@ -282,7 +285,10 @@ export class DHCPService extends Service {
282
285
  "option-data": [
283
286
  {
284
287
  name: "dns-servers",
285
- data: "2001:db8:2::45, 2001:db8:2::100"
288
+ data: dnsServerEndpoints
289
+ .filter(endpoint => isIPv6Address(endpoint.rawAddress))
290
+ .map(endpoint => endpoint.rawAddress)
291
+ .join(",")
286
292
  }
287
293
  ],
288
294
  subnet6: [
@@ -301,12 +307,6 @@ export class DHCPService extends Service {
301
307
  "delegated-len": 64
302
308
  }
303
309
  ],
304
- "option-data": [
305
- {
306
- name: "dns-servers",
307
- data: "2001:db8:2::dead:beef, 2001:db8:2::cafe:babe"
308
- }
309
- ],
310
310
  reservations: [
311
311
  {
312
312
  duid: "01:02:03:04:05:0A:0B:0C:0D:0E",
@@ -74,43 +74,43 @@ export class ExtraSourceService extends Service {
74
74
  collection: boolean;
75
75
  writeable: boolean;
76
76
  };
77
- port: {
77
+ alias: {
78
78
  type: string;
79
79
  collection: boolean;
80
80
  writeable: boolean;
81
81
  };
82
- protocol: {
82
+ weight: {
83
83
  type: string;
84
84
  collection: boolean;
85
85
  writeable: boolean;
86
- values: string[];
86
+ default: number;
87
87
  };
88
- alias: {
88
+ systemd: {
89
89
  type: string;
90
90
  collection: boolean;
91
91
  writeable: boolean;
92
92
  };
93
- type: {
93
+ port: {
94
94
  type: string;
95
95
  collection: boolean;
96
96
  writeable: boolean;
97
97
  };
98
- weight: {
98
+ protocol: {
99
99
  type: string;
100
100
  collection: boolean;
101
101
  writeable: boolean;
102
- default: number;
102
+ values: string[];
103
103
  };
104
- tls: {
104
+ type: {
105
105
  type: string;
106
106
  collection: boolean;
107
107
  writeable: boolean;
108
- default: boolean;
109
108
  };
110
- systemd: {
109
+ tls: {
111
110
  type: string;
112
111
  collection: boolean;
113
112
  writeable: boolean;
113
+ default: boolean;
114
114
  };
115
115
  hostName: {
116
116
  type: string;
@@ -1,9 +1,54 @@
1
1
  export function serviceAddresses(sources: any, filter: any, addressType?: string, addressFilter?: (a: any) => boolean): any[];
2
2
  export function serviceEndpoints(sources: any, filter: any): any[];
3
- export namespace ServiceTypeDefinition {
3
+ export namespace endpointProperties {
4
+ export namespace port {
5
+ let type: string;
6
+ let collection: boolean;
7
+ let writeable: boolean;
8
+ }
9
+ export namespace protocol {
10
+ let type_1: string;
11
+ export { type_1 as type };
12
+ let collection_1: boolean;
13
+ export { collection_1 as collection };
14
+ let writeable_1: boolean;
15
+ export { writeable_1 as writeable };
16
+ export let values: string[];
17
+ }
18
+ export namespace type_2 {
19
+ let type_3: string;
20
+ export { type_3 as type };
21
+ let collection_2: boolean;
22
+ export { collection_2 as collection };
23
+ let writeable_2: boolean;
24
+ export { writeable_2 as writeable };
25
+ }
26
+ export { type_2 as type };
27
+ export namespace tls {
28
+ let type_4: string;
29
+ export { type_4 as type };
30
+ let collection_3: boolean;
31
+ export { collection_3 as collection };
32
+ let writeable_3: boolean;
33
+ export { writeable_3 as writeable };
34
+ let _default: boolean;
35
+ export { _default as default };
36
+ }
37
+ }
38
+ export namespace EndpointTypeDefinition {
4
39
  export let name: string;
5
40
  export let owners: string[];
6
41
  export let priority: number;
42
+ export let specializations: {};
43
+ export { endpointProperties as properties };
44
+ }
45
+ export namespace ServiceTypeDefinition {
46
+ let name_1: string;
47
+ export { name_1 as name };
48
+ let owners_1: string[];
49
+ export { owners_1 as owners };
50
+ let priority_1: number;
51
+ export { priority_1 as priority };
7
52
  let _extends: {
8
53
  name: string;
9
54
  owners: any[];
@@ -52,7 +97,8 @@ export namespace ServiceTypeDefinition {
52
97
  };
53
98
  };
54
99
  export { _extends as extends };
55
- export let specializations: {};
100
+ let specializations_1: {};
101
+ export { specializations_1 as specializations };
56
102
  export function factoryFor(value: any): any;
57
103
  export let properties: {
58
104
  ipAddresses: {
@@ -60,43 +106,43 @@ export namespace ServiceTypeDefinition {
60
106
  collection: boolean;
61
107
  writeable: boolean;
62
108
  };
63
- port: {
109
+ alias: {
64
110
  type: string;
65
111
  collection: boolean;
66
112
  writeable: boolean;
67
113
  };
68
- protocol: {
114
+ weight: {
69
115
  type: string;
70
116
  collection: boolean;
71
117
  writeable: boolean;
72
- values: string[];
118
+ default: number;
73
119
  };
74
- alias: {
120
+ systemd: {
75
121
  type: string;
76
122
  collection: boolean;
77
123
  writeable: boolean;
78
124
  };
79
- type: {
125
+ port: {
80
126
  type: string;
81
127
  collection: boolean;
82
128
  writeable: boolean;
83
129
  };
84
- weight: {
130
+ protocol: {
85
131
  type: string;
86
132
  collection: boolean;
87
133
  writeable: boolean;
88
- default: number;
134
+ values: string[];
89
135
  };
90
- tls: {
136
+ type: {
91
137
  type: string;
92
138
  collection: boolean;
93
139
  writeable: boolean;
94
- default: boolean;
95
140
  };
96
- systemd: {
141
+ tls: {
97
142
  type: string;
98
143
  collection: boolean;
99
144
  writeable: boolean;
145
+ default: boolean;
100
146
  };
101
147
  hostName: {
102
148
  type: string;
@@ -185,43 +231,43 @@ export class Service extends Base {
185
231
  collection: boolean;
186
232
  writeable: boolean;
187
233
  };
188
- port: {
234
+ alias: {
189
235
  type: string;
190
236
  collection: boolean;
191
237
  writeable: boolean;
192
238
  };
193
- protocol: {
239
+ weight: {
194
240
  type: string;
195
241
  collection: boolean;
196
242
  writeable: boolean;
197
- values: string[];
243
+ default: number;
198
244
  };
199
- alias: {
245
+ systemd: {
200
246
  type: string;
201
247
  collection: boolean;
202
248
  writeable: boolean;
203
249
  };
204
- type: {
250
+ port: {
205
251
  type: string;
206
252
  collection: boolean;
207
253
  writeable: boolean;
208
254
  };
209
- weight: {
255
+ protocol: {
210
256
  type: string;
211
257
  collection: boolean;
212
258
  writeable: boolean;
213
- default: number;
259
+ values: string[];
214
260
  };
215
- tls: {
261
+ type: {
216
262
  type: string;
217
263
  collection: boolean;
218
264
  writeable: boolean;
219
- default: boolean;
220
265
  };
221
- systemd: {
266
+ tls: {
222
267
  type: string;
223
268
  collection: boolean;
224
269
  writeable: boolean;
270
+ default: boolean;
225
271
  };
226
272
  hostName: {
227
273
  type: string;
@@ -268,6 +314,7 @@ export class Service extends Base {
268
314
  get addresses(): any;
269
315
  get networks(): any;
270
316
  get endpoints(): any[];
317
+ findEndpoints(filter: any): Generator<any, void, any>;
271
318
  set alias(value: any);
272
319
  get alias(): any;
273
320
  set port(value: any);
@@ -60,43 +60,43 @@ export class DHCPService extends Service {
60
60
  collection: boolean;
61
61
  writeable: boolean;
62
62
  };
63
- port: {
63
+ alias: {
64
64
  type: string;
65
65
  collection: boolean;
66
66
  writeable: boolean;
67
67
  };
68
- protocol: {
68
+ weight: {
69
69
  type: string;
70
70
  collection: boolean;
71
71
  writeable: boolean;
72
- values: string[];
72
+ default: number;
73
73
  };
74
- alias: {
74
+ systemd: {
75
75
  type: string;
76
76
  collection: boolean;
77
77
  writeable: boolean;
78
78
  };
79
- type: {
79
+ port: {
80
80
  type: string;
81
81
  collection: boolean;
82
82
  writeable: boolean;
83
83
  };
84
- weight: {
84
+ protocol: {
85
85
  type: string;
86
86
  collection: boolean;
87
87
  writeable: boolean;
88
- default: number;
88
+ values: string[];
89
89
  };
90
- tls: {
90
+ type: {
91
91
  type: string;
92
92
  collection: boolean;
93
93
  writeable: boolean;
94
- default: boolean;
95
94
  };
96
- systemd: {
95
+ tls: {
97
96
  type: string;
98
97
  collection: boolean;
99
98
  writeable: boolean;
99
+ default: boolean;
100
100
  };
101
101
  hostName: {
102
102
  type: string;
@@ -185,43 +185,43 @@ export class DHCPService extends Service {
185
185
  collection: boolean;
186
186
  writeable: boolean;
187
187
  };
188
- port: {
188
+ alias: {
189
189
  type: string;
190
190
  collection: boolean;
191
191
  writeable: boolean;
192
192
  };
193
- protocol: {
193
+ weight: {
194
194
  type: string;
195
195
  collection: boolean;
196
196
  writeable: boolean;
197
- values: string[];
197
+ default: number;
198
198
  };
199
- alias: {
199
+ systemd: {
200
200
  type: string;
201
201
  collection: boolean;
202
202
  writeable: boolean;
203
203
  };
204
- type: {
204
+ port: {
205
205
  type: string;
206
206
  collection: boolean;
207
207
  writeable: boolean;
208
208
  };
209
- weight: {
209
+ protocol: {
210
210
  type: string;
211
211
  collection: boolean;
212
212
  writeable: boolean;
213
- default: number;
213
+ values: string[];
214
214
  };
215
- tls: {
215
+ type: {
216
216
  type: string;
217
217
  collection: boolean;
218
218
  writeable: boolean;
219
- default: boolean;
220
219
  };
221
- systemd: {
220
+ tls: {
222
221
  type: string;
223
222
  collection: boolean;
224
223
  writeable: boolean;
224
+ default: boolean;
225
225
  };
226
226
  hostName: {
227
227
  type: string;
@@ -60,43 +60,43 @@ export class DNSService extends ExtraSourceService {
60
60
  collection: boolean;
61
61
  writeable: boolean;
62
62
  };
63
- port: {
63
+ alias: {
64
64
  type: string;
65
65
  collection: boolean;
66
66
  writeable: boolean;
67
67
  };
68
- protocol: {
68
+ weight: {
69
69
  type: string;
70
70
  collection: boolean;
71
71
  writeable: boolean;
72
- values: string[];
72
+ default: number;
73
73
  };
74
- alias: {
74
+ systemd: {
75
75
  type: string;
76
76
  collection: boolean;
77
77
  writeable: boolean;
78
78
  };
79
- type: {
79
+ port: {
80
80
  type: string;
81
81
  collection: boolean;
82
82
  writeable: boolean;
83
83
  };
84
- weight: {
84
+ protocol: {
85
85
  type: string;
86
86
  collection: boolean;
87
87
  writeable: boolean;
88
- default: number;
88
+ values: string[];
89
89
  };
90
- tls: {
90
+ type: {
91
91
  type: string;
92
92
  collection: boolean;
93
93
  writeable: boolean;
94
- default: boolean;
95
94
  };
96
- systemd: {
95
+ tls: {
97
96
  type: string;
98
97
  collection: boolean;
99
98
  writeable: boolean;
99
+ default: boolean;
100
100
  };
101
101
  hostName: {
102
102
  type: string;
@@ -188,43 +188,43 @@ export class DNSService extends ExtraSourceService {
188
188
  collection: boolean;
189
189
  writeable: boolean;
190
190
  };
191
- port: {
191
+ alias: {
192
192
  type: string;
193
193
  collection: boolean;
194
194
  writeable: boolean;
195
195
  };
196
- protocol: {
196
+ weight: {
197
197
  type: string;
198
198
  collection: boolean;
199
199
  writeable: boolean;
200
- values: string[];
200
+ default: number;
201
201
  };
202
- alias: {
202
+ systemd: {
203
203
  type: string;
204
204
  collection: boolean;
205
205
  writeable: boolean;
206
206
  };
207
- type: {
207
+ port: {
208
208
  type: string;
209
209
  collection: boolean;
210
210
  writeable: boolean;
211
211
  };
212
- weight: {
212
+ protocol: {
213
213
  type: string;
214
214
  collection: boolean;
215
215
  writeable: boolean;
216
- default: number;
216
+ values: string[];
217
217
  };
218
- tls: {
218
+ type: {
219
219
  type: string;
220
220
  collection: boolean;
221
221
  writeable: boolean;
222
- default: boolean;
223
222
  };
224
- systemd: {
223
+ tls: {
225
224
  type: string;
226
225
  collection: boolean;
227
226
  writeable: boolean;
227
+ default: boolean;
228
228
  };
229
229
  hostName: {
230
230
  type: string;
@@ -60,43 +60,43 @@ export class NTPService extends ExtraSourceService {
60
60
  collection: boolean;
61
61
  writeable: boolean;
62
62
  };
63
- port: {
63
+ alias: {
64
64
  type: string;
65
65
  collection: boolean;
66
66
  writeable: boolean;
67
67
  };
68
- protocol: {
68
+ weight: {
69
69
  type: string;
70
70
  collection: boolean;
71
71
  writeable: boolean;
72
- values: string[];
72
+ default: number;
73
73
  };
74
- alias: {
74
+ systemd: {
75
75
  type: string;
76
76
  collection: boolean;
77
77
  writeable: boolean;
78
78
  };
79
- type: {
79
+ port: {
80
80
  type: string;
81
81
  collection: boolean;
82
82
  writeable: boolean;
83
83
  };
84
- weight: {
84
+ protocol: {
85
85
  type: string;
86
86
  collection: boolean;
87
87
  writeable: boolean;
88
- default: number;
88
+ values: string[];
89
89
  };
90
- tls: {
90
+ type: {
91
91
  type: string;
92
92
  collection: boolean;
93
93
  writeable: boolean;
94
- default: boolean;
95
94
  };
96
- systemd: {
95
+ tls: {
97
96
  type: string;
98
97
  collection: boolean;
99
98
  writeable: boolean;
99
+ default: boolean;
100
100
  };
101
101
  hostName: {
102
102
  type: string;
@@ -188,43 +188,43 @@ export class NTPService extends ExtraSourceService {
188
188
  collection: boolean;
189
189
  writeable: boolean;
190
190
  };
191
- port: {
191
+ alias: {
192
192
  type: string;
193
193
  collection: boolean;
194
194
  writeable: boolean;
195
195
  };
196
- protocol: {
196
+ weight: {
197
197
  type: string;
198
198
  collection: boolean;
199
199
  writeable: boolean;
200
- values: string[];
200
+ default: number;
201
201
  };
202
- alias: {
202
+ systemd: {
203
203
  type: string;
204
204
  collection: boolean;
205
205
  writeable: boolean;
206
206
  };
207
- type: {
207
+ port: {
208
208
  type: string;
209
209
  collection: boolean;
210
210
  writeable: boolean;
211
211
  };
212
- weight: {
212
+ protocol: {
213
213
  type: string;
214
214
  collection: boolean;
215
215
  writeable: boolean;
216
- default: number;
216
+ values: string[];
217
217
  };
218
- tls: {
218
+ type: {
219
219
  type: string;
220
220
  collection: boolean;
221
221
  writeable: boolean;
222
- default: boolean;
223
222
  };
224
- systemd: {
223
+ tls: {
225
224
  type: string;
226
225
  collection: boolean;
227
226
  writeable: boolean;
227
+ default: boolean;
228
228
  };
229
229
  hostName: {
230
230
  type: string;