pmcf 2.36.3 → 2.37.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.36.3",
3
+ "version": "2.37.0",
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,23 @@ 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
+ let ste = ServiceTypes[st.extends];
71
+
72
+ if (ste.endpoints) {
73
+ return st.endpoints
74
+ ? [...st.endpoints, ...ste.endpoints]
75
+ : ste.endpoints;
76
+ }
77
+ }
78
+
79
+ return st.endpoints;
80
+ }
81
+ }
82
+
64
83
  export const endpointProperties = {
65
84
  port: { type: "number", collection: false, writeable: true },
66
85
  protocol: {
@@ -173,7 +192,7 @@ export class Service extends Base {
173
192
  ? { type: this.type }
174
193
  : { type: this.type, port: this._port };
175
194
 
176
- const data = ServiceTypes[this.type]?.endpoints || [
195
+ const data = serviceTypeEndpoints(this.type) || [
177
196
  {
178
197
  tls: false
179
198
  }
@@ -318,9 +337,9 @@ export function serviceEndpoints(sources, options = {}) {
318
337
 
319
338
  const res = [...new Set(options.select ? all.map(options.select) : all)];
320
339
 
321
- if(options.limit < res.length) {
340
+ if (options.limit < res.length) {
322
341
  res.length = options.limit;
323
342
  }
324
-
343
+
325
344
  return options.join ? res.join(options.join) : res;
326
345
  }
@@ -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
+ }