pmcf 2.37.1 → 2.38.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 CHANGED
@@ -27,6 +27,8 @@
27
27
  * [subnet](#subnet)
28
28
  * [networkInterface](#networkinterface)
29
29
  * [address](#address)
30
+ * [serviceEndpoints](#serviceendpoints)
31
+ * [Parameters](#parameters-2)
30
32
 
31
33
  ## networkAddresses
32
34
 
@@ -56,6 +58,21 @@ Type: NetworkInterface
56
58
 
57
59
  Type: ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [Uint16Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array))
58
60
 
61
+ ## serviceEndpoints
62
+
63
+ ### Parameters
64
+
65
+ * `sources` **any** 
66
+ * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** (optional, default `{}`)
67
+
68
+ * `options.services` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** filter for services
69
+ * `options.endpoints` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** filter for endpoints
70
+ * `options.select` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** mapper from Endpoint into result
71
+ * `options.limit` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** upper limit of # result items
72
+ * `options.join` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** jount result into a string
73
+
74
+ Returns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | any)** 
75
+
59
76
  # install
60
77
 
61
78
  With [npm](http://npmjs.org) do:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.37.1",
3
+ "version": "2.38.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/service.mjs CHANGED
@@ -232,14 +232,6 @@ export class Service extends Base {
232
232
  return this.endpoints()[0].port;
233
233
  }
234
234
 
235
- get protocol() {
236
- return this.endpoints()[0].protocol;
237
- }
238
-
239
- get tls() {
240
- return this.endpoints()[0].tls;
241
- }
242
-
243
235
  set weight(value) {
244
236
  this._weight = value;
245
237
  }
@@ -313,7 +305,7 @@ export class Service extends Base {
313
305
  );
314
306
  } else {
315
307
  records.push(
316
- DNSRecord("@", dnsRecord.type, this.priority, dnsFullName(domainName))
308
+ DNSRecord("@", dnsRecord.type, this.priority ?? 10, dnsFullName(domainName))
317
309
  );
318
310
  }
319
311
  }
@@ -324,6 +316,17 @@ export class Service extends Base {
324
316
 
325
317
  export const sortByPriority = (a, b) => a.priority - b.priority;
326
318
 
319
+ /**
320
+ *
321
+ * @param {*} sources
322
+ * @param {Object} [options]
323
+ * @param {Function} [options.services] filter for services
324
+ * @param {Function} [options.endpoints] filter for endpoints
325
+ * @param {Function} [options.select] mapper from Endpoint into result
326
+ * @param {number} [options.limit] upper limit of # result items
327
+ * @param {string} [options.join] jount result into a string
328
+ * @returns {string|any}
329
+ */
327
330
  export function serviceEndpoints(sources, options = {}) {
328
331
  const all = asArray(sources)
329
332
  .map(ft => Array.from(ft.findServices(options.services)))
@@ -335,11 +335,10 @@ async function generateZoneDefs(dns, location, packageData) {
335
335
  addHook(
336
336
  packageData.properties.hooks,
337
337
  "post_upgrade",
338
- // `rm -f ${foreignZones.map(zone => `/var/lib/named/${zone.file}.jnl`)}\n` +
339
- // "systemctl try-reload-or-restart named\n" +
340
- `/usr/bin/named-hostname-info ${foreignZones
341
- .map(zone => zone.id)
342
- .join(" ")}|/usr/bin/named-hostname-update`
338
+ `rm -f ${foreignZones.map(zone => `/var/lib/named/${zone.file}.jnl`)}\n` +
339
+ `/usr/bin/named-hostname-info ${foreignZones
340
+ .map(zone => zone.id)
341
+ .join(" ")}|/usr/bin/named-hostname-update`
343
342
  );
344
343
  }
345
344
 
@@ -1,4 +1,21 @@
1
- export function serviceEndpoints(sources: any, options?: {}): string | any[];
1
+ /**
2
+ *
3
+ * @param {*} sources
4
+ * @param {Object} [options]
5
+ * @param {Function} [options.services] filter for services
6
+ * @param {Function} [options.endpoints] filter for endpoints
7
+ * @param {Function} [options.select] mapper from Endpoint into result
8
+ * @param {number} [options.limit] upper limit of # result items
9
+ * @param {string} [options.join] jount result into a string
10
+ * @returns {string|any}
11
+ */
12
+ export function serviceEndpoints(sources: any, options?: {
13
+ services?: Function;
14
+ endpoints?: Function;
15
+ select?: Function;
16
+ limit?: number;
17
+ join?: string;
18
+ }): string | any;
2
19
  export namespace endpointProperties {
3
20
  export namespace port {
4
21
  let type: string;
@@ -303,8 +320,6 @@ export class Service extends Base {
303
320
  get alias(): any;
304
321
  set port(value: any);
305
322
  get port(): any;
306
- get protocol(): any;
307
- get tls(): any;
308
323
  set weight(value: any);
309
324
  get weight(): any;
310
325
  set type(value: any);
@@ -247,8 +247,8 @@ export class SystemdResolvedService extends ExtraSourceService {
247
247
  systemdConfig(name: any): {
248
248
  name: string;
249
249
  content: (string | {
250
- DNS: string | any[];
251
- FallbackDNS: string | any[];
250
+ DNS: any;
251
+ FallbackDNS: any;
252
252
  Domains: string;
253
253
  DNSSEC: string;
254
254
  MulticastDNS: string;
@@ -247,7 +247,7 @@ export class SystemdTimesyncdService extends ExtraSourceService {
247
247
  systemdConfig(name: any): {
248
248
  name: string;
249
249
  content: (string | {
250
- NTP: string | any[];
250
+ NTP: any;
251
251
  })[];
252
252
  };
253
253
  }