pmcf 2.51.4 → 2.51.5

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.51.4",
3
+ "version": "2.51.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/endpoint.mjs CHANGED
@@ -93,20 +93,32 @@ export class HTTPEndpoint extends PortEndpoint {
93
93
  constructor(service, address, data) {
94
94
  super(service, data);
95
95
 
96
- for (const name of ["path"]) {
97
- if (data[name] !== undefined) {
98
- this[name] = data[name];
99
- }
100
- }
101
-
102
96
  if (typeof address === "string") {
97
+ this.url = new URL(address);
98
+ } else if (address instanceof URL) {
103
99
  this.url = address;
104
100
  } else {
105
- this.url = "http://" + address.address + ":" + data.port + data.path;
106
- this.host = address.address;
101
+ this.url = new URL(
102
+ "http://" +
103
+ (address.family === "IPv6"
104
+ ? "[" + address.address + "]"
105
+ : address.address) +
106
+ ":" +
107
+ data.port +
108
+ data.path
109
+ );
110
+ this.hostname = address.address;
107
111
  }
108
112
  }
109
113
 
114
+ get port() {
115
+ return this.url.port || 80;
116
+ }
117
+
118
+ get pathname() {
119
+ return this.url.pathname;
120
+ }
121
+
110
122
  get address() {
111
123
  return this.url;
112
124
  }
package/src/service.mjs CHANGED
@@ -38,7 +38,7 @@ const ServiceTypes = {
38
38
  ssh: { endpoints: [{ protocol: "tcp", port: 22, tls: false }] },
39
39
  imap: { endpoints: [{ protocol: "tcp", port: 143, tls: false }] },
40
40
  imaps: { endpoints: [{ protocol: "tcp", port: 993, tls: true }] },
41
- dhcp: { endpoints: [{ port: 547, protocol: "udp", tls: false }] },
41
+ dhcp: { endpoints: [{ protocol: "udp", port: 547, tls: false }] },
42
42
  "dhcpv6-client": {
43
43
  endpoints: [
44
44
  { protocol: "tcp", port: 546, tls: false },
@@ -208,7 +208,7 @@ export class Service extends Base {
208
208
 
209
209
  return filter ? result.filter(filter) : result;
210
210
  }
211
-
211
+
212
212
  endpoint(filter) {
213
213
  return this.endpoints(filter)[0];
214
214
  }
@@ -216,7 +216,7 @@ export class Service extends Base {
216
216
  address(
217
217
  options = {
218
218
  endpoints: e => e.networkInterface?.kind !== "loopbak",
219
- select: e => e.domainName||e.address,
219
+ select: e => e.domainName || e.address,
220
220
  limit: 1,
221
221
  join: ""
222
222
  }
@@ -275,7 +275,10 @@ export class Service extends Base {
275
275
 
276
276
  if (hasSVRRecords) {
277
277
  for (const ep of this.endpoints(
278
- e => e.protocol && e.networkInterface && e.networkInterface.kind !== "loopback"
278
+ e =>
279
+ e.protocol &&
280
+ e.networkInterface &&
281
+ e.networkInterface.kind !== "loopback"
279
282
  )) {
280
283
  records.push(
281
284
  DNSRecord(
@@ -16,9 +16,11 @@ export class DomainNameEndpoint extends PortEndpoint {
16
16
  }
17
17
  export class HTTPEndpoint extends PortEndpoint {
18
18
  constructor(service: any, address: any, data: any);
19
- url: string;
20
- host: any;
21
- get address(): string;
19
+ url: URL;
20
+ hostname: any;
21
+ get port(): string | 80;
22
+ get pathname(): string;
23
+ get address(): URL;
22
24
  }
23
25
  export class UnixEndpoint extends BaseEndpoint {
24
26
  constructor(service: any, path: any, data: any);