pmcf 6.44.0 → 6.44.2

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": "6.44.0",
3
+ "version": "6.44.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/cluster.mjs CHANGED
@@ -63,7 +63,7 @@ export class Cluster extends Host {
63
63
  const packageData = await host.packageData;
64
64
 
65
65
  packageData.sources.push(
66
- await Array.fromAsync(this.templateContent()),
66
+ ...(await Array.fromAsync(this.templateContent())),
67
67
  new FileContentProvider({
68
68
  dir: packageStagingDir,
69
69
  pattern: "**/*",
@@ -2,6 +2,17 @@ import { asArray } from "pacc";
2
2
  import { FAMILY_IPV6 } from "ip-utilties";
3
3
  import { FAMILY_UNIX, FAMILY_IPV4_IPV6 } from "./endpoint.mjs";
4
4
 
5
+ const TCP = "tcp";
6
+ const UDP = "udp";
7
+
8
+ /**
9
+ * @typedef {object} ServiceType
10
+ * @property {string} name
11
+ * @property {Array<Object>} services
12
+ * @property {Array<ServiceType>} extends
13
+ * @property {Array<object>} endpoints
14
+ *
15
+ */
5
16
  export const ServiceTypes = {
6
17
  "alpm-repo": {
7
18
  extends: ["https"]
@@ -13,13 +24,13 @@ export const ServiceTypes = {
13
24
  syslog: {
14
25
  endpoints: [
15
26
  {
16
- protocol: "udp",
27
+ protocol: UDP,
17
28
  family: FAMILY_IPV4_IPV6,
18
29
  port: 514,
19
30
  tls: false
20
31
  },
21
32
  {
22
- protocol: "tcp",
33
+ protocol: TCP,
23
34
  family: FAMILY_IPV4_IPV6,
24
35
  port: 514,
25
36
  tls: false
@@ -28,33 +39,33 @@ export const ServiceTypes = {
28
39
  },
29
40
  mqtt: {
30
41
  endpoints: [
31
- { family: FAMILY_IPV4_IPV6, protocol: "tcp", port: 1883, tls: false }
42
+ { family: FAMILY_IPV4_IPV6, protocol: TCP, port: 1883, tls: false }
32
43
  ]
33
44
  },
34
45
  "secure-mqtt": {
35
46
  endpoints: [
36
- { family: FAMILY_IPV4_IPV6, protocol: "tcp", port: 8883, tls: true }
47
+ { family: FAMILY_IPV4_IPV6, protocol: TCP, port: 8883, tls: true }
37
48
  ]
38
49
  },
39
50
  ntp: {
40
51
  endpoints: [
41
- { family: FAMILY_IPV4_IPV6, protocol: "udp", port: 123, tls: false }
52
+ { family: FAMILY_IPV4_IPV6, protocol: UDP, port: 123, tls: false }
42
53
  ]
43
54
  },
44
55
  dns: {
45
56
  endpoints: [
46
- { family: FAMILY_IPV4_IPV6, protocol: "udp", port: 53, tls: false }
57
+ { family: FAMILY_IPV4_IPV6, protocol: UDP, port: 53, tls: false }
47
58
  ]
48
59
  },
49
60
  mdns: {
50
61
  endpoints: [
51
- { family: FAMILY_IPV4_IPV6, protocol: "udp", port: 5353, tls: false }
62
+ { family: FAMILY_IPV4_IPV6, protocol: UDP, port: 5353, tls: false }
52
63
  ]
53
64
  },
54
65
  llmnr: {
55
66
  endpoints: [
56
- { family: FAMILY_IPV4_IPV6, protocol: "udp", port: 5355, tls: false },
57
- { family: FAMILY_IPV4_IPV6, protocol: "tcp", port: 5355, tls: false }
67
+ { family: FAMILY_IPV4_IPV6, protocol: UDP, port: 5355, tls: false },
68
+ { family: FAMILY_IPV4_IPV6, protocol: TCP, port: 5355, tls: false }
58
69
  ]
59
70
  },
60
71
  ldap: {
@@ -62,7 +73,7 @@ export const ServiceTypes = {
62
73
  {
63
74
  family: FAMILY_IPV4_IPV6,
64
75
  scheme: "ldap",
65
- protocol: "tcp",
76
+ protocol: TCP,
66
77
  port: 389,
67
78
  tls: false
68
79
  }
@@ -73,7 +84,7 @@ export const ServiceTypes = {
73
84
  {
74
85
  family: FAMILY_IPV4_IPV6,
75
86
  scheme: "ldaps",
76
- protocol: "tcp",
87
+ protocol: TCP,
77
88
  port: 636,
78
89
  tls: true
79
90
  }
@@ -87,7 +98,7 @@ export const ServiceTypes = {
87
98
  {
88
99
  family: FAMILY_IPV4_IPV6,
89
100
  scheme: "http",
90
- protocol: "tcp",
101
+ protocol: TCP,
91
102
  port: 80,
92
103
  tls: false
93
104
  }
@@ -98,7 +109,7 @@ export const ServiceTypes = {
98
109
  {
99
110
  family: FAMILY_IPV4_IPV6,
100
111
  scheme: "https",
101
- protocol: "tcp",
112
+ protocol: TCP,
102
113
  port: 443,
103
114
  tls: true
104
115
  }
@@ -110,7 +121,7 @@ export const ServiceTypes = {
110
121
  {
111
122
  family: FAMILY_IPV4_IPV6,
112
123
  scheme: "https",
113
- protocol: "udp",
124
+ protocol: UDP,
114
125
  port: 443,
115
126
  tls: true
116
127
  }
@@ -122,54 +133,54 @@ export const ServiceTypes = {
122
133
  },
123
134
  rtsp: {
124
135
  endpoints: [
125
- { family: FAMILY_IPV4_IPV6, protocol: "tcp", port: 554, tls: false }
136
+ { family: FAMILY_IPV4_IPV6, protocol: TCP, port: 554, tls: false }
126
137
  ]
127
138
  },
128
139
  smtp: {
129
140
  endpoints: [
130
- { family: FAMILY_IPV4_IPV6, protocol: "tcp", port: 25, tls: false }
141
+ { family: FAMILY_IPV4_IPV6, protocol: TCP, port: 25, tls: false }
131
142
  ],
132
143
  dnsRecord: { type: "MX" }
133
144
  },
134
145
  smtps: {
135
146
  endpoints: [
136
- { family: FAMILY_IPV4_IPV6, protocol: "tcp", port: 465, tls: true }
147
+ { family: FAMILY_IPV4_IPV6, protocol: TCP, port: 465, tls: true }
137
148
  ],
138
149
  dnsRecord: { type: "MX" }
139
150
  },
140
151
  submission: {
141
152
  endpoints: [
142
- { family: FAMILY_IPV4_IPV6, protocol: "tcp", port: 587, tls: false }
153
+ { family: FAMILY_IPV4_IPV6, protocol: TCP, port: 587, tls: false }
143
154
  ]
144
155
  },
145
156
  lmtp: {
146
157
  endpoints: [
147
- { family: FAMILY_IPV4_IPV6, protocol: "tcp", port: 24, tls: false }
158
+ { family: FAMILY_IPV4_IPV6, protocol: TCP, port: 24, tls: false }
148
159
  ]
149
160
  },
150
161
  ssh: {
151
162
  endpoints: [
152
- { family: FAMILY_IPV4_IPV6, protocol: "tcp", port: 22, tls: false }
163
+ { family: FAMILY_IPV4_IPV6, protocol: TCP, port: 22, tls: false }
153
164
  ]
154
165
  },
155
166
  imap: {
156
167
  endpoints: [
157
- { family: FAMILY_IPV4_IPV6, protocol: "tcp", port: 143, tls: false }
168
+ { family: FAMILY_IPV4_IPV6, protocol: TCP, port: 143, tls: false }
158
169
  ]
159
170
  },
160
171
  imaps: {
161
172
  endpoints: [
162
- { family: FAMILY_IPV4_IPV6, protocol: "tcp", port: 993, tls: true }
173
+ { family: FAMILY_IPV4_IPV6, protocol: TCP, port: 993, tls: true }
163
174
  ]
164
175
  },
165
176
  dhcp: {
166
177
  endpoints: [
167
- { family: FAMILY_IPV4_IPV6, protocol: "udp", port: 547, tls: false }
178
+ { family: FAMILY_IPV4_IPV6, protocol: UDP, port: 547, tls: false }
168
179
  ]
169
180
  },
170
181
  "dhcpv6-client": {
171
182
  endpoints: [
172
- { family: FAMILY_IPV4_IPV6, protocol: "tcp", port: 546, tls: false }
183
+ { family: FAMILY_IPV4_IPV6, protocol: TCP, port: 546, tls: false }
173
184
  ]
174
185
  },
175
186
  "dhcpv6-server": {
@@ -177,7 +188,7 @@ export const ServiceTypes = {
177
188
  },
178
189
  smb: {
179
190
  endpoints: [
180
- { family: FAMILY_IPV4_IPV6, protocol: "tcp", port: 445, tls: false }
191
+ { family: FAMILY_IPV4_IPV6, protocol: TCP, port: 445, tls: false }
181
192
  ]
182
193
  },
183
194
  nginx: {
@@ -198,13 +209,13 @@ export const ServiceTypes = {
198
209
  pcp: {
199
210
  // rfc6887
200
211
  endpoints: [
201
- { family: FAMILY_IPV4_IPV6, protocol: "udp", port: 5351, tls: false }
212
+ { family: FAMILY_IPV4_IPV6, protocol: UDP, port: 5351, tls: false }
202
213
  ]
203
214
  },
204
215
  "pcp-multicast": {
205
216
  // rfc6887
206
217
  endpoints: [
207
- { family: FAMILY_IPV4_IPV6, protocol: "udp", port: 5350, tls: false }
218
+ { family: FAMILY_IPV4_IPV6, protocol: UDP, port: 5350, tls: false }
208
219
  ]
209
220
  }
210
221
  };
@@ -258,6 +269,12 @@ export function serviceTypes(type) {
258
269
  return new Set();
259
270
  }
260
271
 
272
+ /**
273
+ *
274
+ * @param {ServiceType} type
275
+ * @param {boolean} bundeledToo
276
+ * @returns {Array<Object>}
277
+ */
261
278
  export function serviceTypeEndpoints(type, bundeledToo) {
262
279
  if (type) {
263
280
  const aggregator = (acc, type) => {
@@ -15,6 +15,7 @@ export class mosquitto extends CoreService {
15
15
  name: "listener",
16
16
  writable: true,
17
17
  configurable: true
18
+ // endpoints[type='mqtt']/port
18
19
  },
19
20
  persistence_location: {
20
21
  ...string_attribute_writable,
@@ -40,29 +41,25 @@ export class mosquitto extends CoreService {
40
41
  addType(this);
41
42
  }
42
43
 
44
+ set listener(value) {
45
+ this._listener = value;
46
+ }
47
+
43
48
  get listener() {
44
- return this.endpoint("mqtt").port;
49
+ return this._listener ?? this.endpoint("mqtt").port;
45
50
  }
46
51
 
47
52
  async *preparePackages(dir) {
48
- /*
49
- const pm = this.root.named("/services/primary-SW/mosquitto");
50
- const wd = [...this.walkDirections(["this", "extends"])];
51
-
52
- console.log(
53
- "MOSQUITTO",
54
- this.fullName,
55
- [...this.extends].map(n => n.fullName),
56
- pm.fullName,
57
- [...pm.extends].map(n => n.fullName),
58
- wd.map(n => [n.fullName, n.directory])
59
- );*/
60
-
61
53
  const packageData = await this.packageData;
62
54
 
63
- packageData.sources = await Array.fromAsync(this.templateContent());
64
-
65
- packageData.sources.push(new FileContentProvider({ dir: dir + "/" }));
55
+ packageData.sources.push(
56
+ ...(await Array.fromAsync(this.templateContent())),
57
+ new FileContentProvider({
58
+ dir,
59
+ pattern: ["**/*"],
60
+ permissions: this.content.permissions
61
+ })
62
+ );
66
63
 
67
64
  await writeLines(
68
65
  join(dir, "etc", "mosquitto"),