pmcf 2.48.7 → 2.49.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.48.7",
3
+ "version": "2.49.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -47,7 +47,7 @@
47
47
  "dependencies": {
48
48
  "ip-utilties": "^1.3.3",
49
49
  "npm-pkgbuild": "^18.1.2",
50
- "pacc": "^3.4.1",
50
+ "pacc": "^3.4.2",
51
51
  "pkg-dir": "^8.0.0"
52
52
  },
53
53
  "devDependencies": {
package/src/endpoint.mjs CHANGED
@@ -1,24 +1,37 @@
1
- class _Endpoint {
2
- #port;
1
+ class BaseEndpoint {
3
2
  #type;
3
+
4
4
  constructor(service, data) {
5
5
  this.service = service;
6
- if (data.port !== undefined) {
7
- this.#port = data.port;
8
- delete data.port;
9
- }
10
6
 
11
7
  if (data.type !== undefined) {
12
8
  this.#type = data.type;
13
9
  delete data.type;
14
10
  }
15
- Object.assign(this, data);
16
11
  }
17
12
 
18
13
  get type() {
19
14
  return this.#type ?? this.service.type;
20
15
  }
21
16
 
17
+ toString() {
18
+ return `${this.type}`;
19
+ }
20
+ }
21
+
22
+ class PortEndpoint extends BaseEndpoint {
23
+ #port;
24
+ constructor(service, data) {
25
+ super(service, data);
26
+
27
+ if (data.port !== undefined) {
28
+ this.#port = data.port;
29
+ delete data.port;
30
+ }
31
+
32
+ Object.assign(this, data);
33
+ }
34
+
22
35
  get port() {
23
36
  return this.#port ?? this.service.port;
24
37
  }
@@ -28,7 +41,7 @@ class _Endpoint {
28
41
  }
29
42
  }
30
43
 
31
- export class Endpoint extends _Endpoint {
44
+ export class Endpoint extends PortEndpoint {
32
45
  constructor(service, networkAddress, data) {
33
46
  super(service, data);
34
47
  this.networkAddress = networkAddress;
@@ -59,7 +72,7 @@ export class Endpoint extends _Endpoint {
59
72
  }
60
73
  }
61
74
 
62
- export class DomainNameEndpoint extends _Endpoint {
75
+ export class DomainNameEndpoint extends PortEndpoint {
63
76
  constructor(service, domainName, data) {
64
77
  super(service, data);
65
78
  this.domainName = domainName;
@@ -74,7 +87,7 @@ export class DomainNameEndpoint extends _Endpoint {
74
87
  }
75
88
  }
76
89
 
77
- export class HTTPEndpoint extends _Endpoint {
90
+ export class HTTPEndpoint extends PortEndpoint {
78
91
  constructor(service, url, data) {
79
92
  super(service, data);
80
93
  this.url = url;
@@ -84,3 +97,18 @@ export class HTTPEndpoint extends _Endpoint {
84
97
  return this.url;
85
98
  }
86
99
  }
100
+
101
+ export class UnixEndpoint extends BaseEndpoint {
102
+ constructor(service, path, data) {
103
+ super(service, data);
104
+ this.path = path;
105
+ }
106
+
107
+ get family() {
108
+ return "unix";
109
+ }
110
+
111
+ get address() {
112
+ return this.path;
113
+ }
114
+ }
package/src/service.mjs CHANGED
@@ -208,6 +208,10 @@ export class Service extends Base {
208
208
 
209
209
  return filter ? result.filter(filter) : result;
210
210
  }
211
+
212
+ endpoint(filter) {
213
+ return this.endpoints(filter)[0];
214
+ }
211
215
 
212
216
  address(
213
217
  options = {
@@ -88,7 +88,7 @@ export class DHCPService extends Service {
88
88
  name: `kea-${this.location.name}-${host.name}`,
89
89
  description: `kea definitions for ${this.fullName}@${name}`,
90
90
  access: "private",
91
- dependencies: ["kea>=2.6.1"]
91
+ dependencies: ["kea>=2.6.2"]
92
92
  }
93
93
  };
94
94
 
@@ -1,4 +1,4 @@
1
- export class Endpoint extends _Endpoint {
1
+ export class Endpoint extends PortEndpoint {
2
2
  constructor(service: any, networkAddress: any, data: any);
3
3
  networkAddress: any;
4
4
  get socketAddress(): string;
@@ -8,22 +8,31 @@ export class Endpoint extends _Endpoint {
8
8
  get family(): any;
9
9
  get networkInterface(): any;
10
10
  }
11
- export class DomainNameEndpoint extends _Endpoint {
11
+ export class DomainNameEndpoint extends PortEndpoint {
12
12
  constructor(service: any, domainName: any, data: any);
13
13
  domainName: any;
14
14
  get networkInterface(): {};
15
15
  get address(): any;
16
16
  }
17
- export class HTTPEndpoint extends _Endpoint {
17
+ export class HTTPEndpoint extends PortEndpoint {
18
18
  constructor(service: any, url: any, data: any);
19
19
  url: any;
20
20
  get address(): any;
21
21
  }
22
- declare class _Endpoint {
22
+ export class UnixEndpoint extends BaseEndpoint {
23
+ constructor(service: any, path: any, data: any);
24
+ path: any;
25
+ get family(): string;
26
+ get address(): any;
27
+ }
28
+ declare class PortEndpoint extends BaseEndpoint {
29
+ get port(): any;
30
+ #private;
31
+ }
32
+ declare class BaseEndpoint {
23
33
  constructor(service: any, data: any);
24
34
  service: any;
25
35
  get type(): any;
26
- get port(): any;
27
36
  toString(): string;
28
37
  #private;
29
38
  }
@@ -316,6 +316,7 @@ export class Service extends Base {
316
316
  get networks(): Set<any>;
317
317
  get subnets(): Set<any>;
318
318
  endpoints(filter: any): any[];
319
+ endpoint(filter: any): any;
319
320
  address(options?: {
320
321
  endpoints: (e: any) => boolean;
321
322
  select: (e: any) => any;