pmcf 2.36.3 → 2.37.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.36.3",
3
+ "version": "2.37.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/endpoint.mjs CHANGED
@@ -53,3 +53,12 @@ export class DomainNameEndpoint {
53
53
  return `${this.address}[${this.port}]`;
54
54
  }
55
55
  }
56
+
57
+ export class HTTPEndpoint {
58
+ constructor(service, url, data) {
59
+ this.service = service;
60
+ this.url = url;
61
+ Object.assign(this, data);
62
+ }
63
+
64
+ }
package/src/service.mjs CHANGED
@@ -10,6 +10,9 @@ import {
10
10
  } from "./dns-utils.mjs";
11
11
 
12
12
  const ServiceTypes = {
13
+ "pacman-repo": {
14
+ extends: ["https"]
15
+ },
13
16
  ntp: { endpoints: [{ protocol: "udp", port: 123, tls: false }] },
14
17
  dns: { endpoints: [{ protocol: "udp", port: 53, tls: false }] },
15
18
  ldap: { endpoints: [{ protocol: "tcp", port: 389, tls: false }] },
@@ -22,7 +25,6 @@ const ServiceTypes = {
22
25
  http3: {
23
26
  extends: ["https"],
24
27
  type: "https",
25
- endpoints: [{ protocol: "tcp", port: 443, tls: true }],
26
28
  dnsRecord: {
27
29
  type: "HTTPS",
28
30
  parameters: { "no-default-alpn": undefined, alpn: "h3" }
@@ -61,6 +63,20 @@ const ServiceTypes = {
61
63
  }
62
64
  };
63
65
 
66
+ function serviceTypeEndpoints(type) {
67
+ let st = ServiceTypes[type];
68
+ if (st) {
69
+ if (st.extends) {
70
+ return st.extends.reduce(
71
+ (a, c) => [...a, ...(ServiceTypes[c]?.endpoints||[])],
72
+ st.endpoints || []
73
+ );
74
+ }
75
+
76
+ return st.endpoints;
77
+ }
78
+ }
79
+
64
80
  export const endpointProperties = {
65
81
  port: { type: "number", collection: false, writeable: true },
66
82
  protocol: {
@@ -173,7 +189,7 @@ export class Service extends Base {
173
189
  ? { type: this.type }
174
190
  : { type: this.type, port: this._port };
175
191
 
176
- const data = ServiceTypes[this.type]?.endpoints || [
192
+ const data = serviceTypeEndpoints(this.type) || [
177
193
  {
178
194
  tls: false
179
195
  }
@@ -318,9 +334,9 @@ export function serviceEndpoints(sources, options = {}) {
318
334
 
319
335
  const res = [...new Set(options.select ? all.map(options.select) : all)];
320
336
 
321
- if(options.limit < res.length) {
337
+ if (options.limit < res.length) {
322
338
  res.length = options.limit;
323
339
  }
324
-
340
+
325
341
  return options.join ? res.join(options.join) : res;
326
342
  }
@@ -18,3 +18,8 @@ export class DomainNameEndpoint {
18
18
  get address(): any;
19
19
  toString(): string;
20
20
  }
21
+ export class HTTPEndpoint {
22
+ constructor(service: any, url: any, data: any);
23
+ service: any;
24
+ url: any;
25
+ }