pmcf 2.37.0 → 2.37.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": "2.37.0",
3
+ "version": "2.37.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/service.mjs CHANGED
@@ -67,13 +67,10 @@ function serviceTypeEndpoints(type) {
67
67
  let st = ServiceTypes[type];
68
68
  if (st) {
69
69
  if (st.extends) {
70
- let ste = ServiceTypes[st.extends];
71
-
72
- if (ste.endpoints) {
73
- return st.endpoints
74
- ? [...st.endpoints, ...ste.endpoints]
75
- : ste.endpoints;
76
- }
70
+ return st.extends.reduce(
71
+ (a, c) => [...a, ...(ServiceTypes[c]?.endpoints||[])],
72
+ st.endpoints || []
73
+ );
77
74
  }
78
75
 
79
76
  return st.endpoints;
@@ -316,7 +313,7 @@ export class Service extends Base {
316
313
  );
317
314
  } else {
318
315
  records.push(
319
- DNSRecord("@", dnsRecord.type, this.priority, dnsFullName(domainName))
316
+ DNSRecord("@", dnsRecord.type, this.priority ?? 10, dnsFullName(domainName))
320
317
  );
321
318
  }
322
319
  }
@@ -327,6 +324,17 @@ export class Service extends Base {
327
324
 
328
325
  export const sortByPriority = (a, b) => a.priority - b.priority;
329
326
 
327
+ /**
328
+ *
329
+ * @param {*} sources
330
+ * @param {Object} [options]
331
+ * @param {Function} [options.services] filter for services
332
+ * @param {Function} [options.endpoints] filter for endpoints
333
+ * @param {Function} [options.select] mapper from Endpoint into result
334
+ * @param {number} [options.limit] upper limit of # result items
335
+ * @param {string} [options.join] jount result into a string
336
+ * @returns {string|any}
337
+ */
330
338
  export function serviceEndpoints(sources, options = {}) {
331
339
  const all = asArray(sources)
332
340
  .map(ft => Array.from(ft.findServices(options.services)))
@@ -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;
@@ -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
  }