pmcf 1.72.0 → 1.73.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": "1.72.0",
3
+ "version": "1.73.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/cluster.mjs CHANGED
@@ -56,24 +56,27 @@ export class Cluster extends Host {
56
56
  }
57
57
 
58
58
  async *preparePackages(stagingDir) {
59
- const result = {
60
- sources: [],
61
- properties: {
62
- description: `${this.typeName} definitions for ${this.fullName}`,
63
- access: "private"
64
- }
65
- };
66
-
67
- let interfaces = new Set();
68
-
69
- for (const cluster of this.owner.clusters()) {
70
- interfaces = interfaces.union(cluster.masters.union(cluster.backups));
71
- }
72
-
73
- for (const ni of interfaces) {
59
+ for (const ni of [...this.owner.clusters()].reduce(
60
+ (all, cluster) => all.union(cluster.members),
61
+ new Set()
62
+ )) {
74
63
  const host = ni.host;
75
64
  const name = `keepalived-${host.name}`;
76
65
  const packageStagingDir = join(stagingDir, name);
66
+ const result = {
67
+ sources: [
68
+ new FileContentProvider(packageStagingDir + "/")[
69
+ Symbol.asyncIterator
70
+ ]()
71
+ ],
72
+ outputs: host.outputs,
73
+ properties: {
74
+ name,
75
+ description: `${this.typeName} definitions for ${this.fullName}`,
76
+ access: "private",
77
+ dependencies: ["keepalived"]
78
+ }
79
+ };
77
80
 
78
81
  const cfg = [
79
82
  "global_defs {",
@@ -146,13 +149,6 @@ export class Cluster extends Host {
146
149
  cfg
147
150
  );
148
151
 
149
- (result.outputs = host.outputs), (result.properties.name = name);
150
- result.properties.dependencies = ["keepalived"];
151
-
152
- result.sources.push(
153
- new FileContentProvider(packageStagingDir + "/")[Symbol.asyncIterator]()
154
- );
155
-
156
152
  yield result;
157
153
  }
158
154
  }
package/src/owner.mjs CHANGED
@@ -128,9 +128,7 @@ export class Owner extends Base {
128
128
 
129
129
  *findServices(filter) {
130
130
  for (const host of this.hosts()) {
131
- for (const service of host.findServices(filter)) {
132
- yield service;
133
- }
131
+ yield* host.findServices(filter);
134
132
  }
135
133
  }
136
134
 
@@ -143,7 +141,7 @@ export class Owner extends Base {
143
141
  }
144
142
 
145
143
  hostNamed(name) {
146
- return this.typeNamed("host", name);
144
+ return this.typeNamed("host", name) || this.typeNamed("cluster", name);
147
145
  }
148
146
 
149
147
  *hosts() {
@@ -363,5 +361,4 @@ export class Owner extends Base {
363
361
  yield location.domain;
364
362
  }
365
363
  }
366
-
367
364
  }
package/src/service.mjs CHANGED
@@ -3,16 +3,17 @@ import { addType } from "./types.mjs";
3
3
  import { asArray } from "./utils.mjs";
4
4
 
5
5
  const ServiceTypes = {
6
- dns: { protocol: "udp", port: 53 },
7
- ldap: { protocol: "tcp", port: 389 },
8
- http: { protocol: "tcp", port: 80 },
9
- https: { protocol: "tcp", port: 443 },
10
- rtsp: { protocol: "tcp", port: 554 },
11
- smtp: { protocol: "tcp", port: 25 },
12
- ssh: { protocol: "tcp", port: 22 },
13
- imap: { protocol: "tcp", port: 143 },
14
- imaps: { protocol: "tcp", port: 993 },
15
- dhcp: {}
6
+ dns: { protocol: "udp", port: 53, tls: false },
7
+ ldap: { protocol: "tcp", port: 389, tls: false },
8
+ ldaps: { protocol: "tcp", port: 636, tls: true },
9
+ http: { protocol: "tcp", port: 80, tls: false },
10
+ https: { protocol: "tcp", port: 443, tls: true },
11
+ rtsp: { protocol: "tcp", port: 554, tls: false },
12
+ smtp: { protocol: "tcp", port: 25, tls: false },
13
+ ssh: { protocol: "tcp", port: 22, tls: false },
14
+ imap: { protocol: "tcp", port: 143, tls: false },
15
+ imaps: { protocol: "tcp", port: 993, tls: true },
16
+ dhcp: { tls: false }
16
17
  };
17
18
 
18
19
  const ServiceTypeDefinition = {
@@ -29,7 +30,8 @@ const ServiceTypeDefinition = {
29
30
  master: { type: "boolean", collection: false, writeable: true },
30
31
  priority: { type: "number", collection: false, writeable: true },
31
32
  weight: { type: "number", collection: false, writeable: true },
32
- srvPrefix: { type: "string", collection: false, writeable: false }
33
+ srvPrefix: { type: "string", collection: false, writeable: false },
34
+ tls: { type: "string", collection: false, writeable: false }
33
35
  }
34
36
  };
35
37
 
@@ -158,6 +160,10 @@ export class Service extends Base {
158
160
  return ServiceTypes[this.type]?.protocol;
159
161
  }
160
162
 
163
+ get tls() {
164
+ return ServiceTypes[this.type]?.tls || false;
165
+ }
166
+
161
167
  get srvPrefix() {
162
168
  const st = ServiceTypes[this.type];
163
169
  if (st?.protocol) {
@@ -403,10 +403,13 @@ export class Cluster extends Host {
403
403
  get backups(): Set<any>;
404
404
  get members(): Set<any>;
405
405
  preparePackages(stagingDir: any): AsyncGenerator<{
406
- sources: any[];
406
+ sources: AsyncGenerator<any, void, unknown>[];
407
+ outputs: any;
407
408
  properties: {
409
+ name: string;
408
410
  description: string;
409
411
  access: string;
412
+ dependencies: string[];
410
413
  };
411
414
  }, void, unknown>;
412
415
  #private;
package/types/owner.d.mts CHANGED
@@ -194,7 +194,6 @@ export class Owner extends Base {
194
194
  typeList(typeName: any): any;
195
195
  addTypeObject(typeName: any, name: any, object: any): void;
196
196
  addObject(object: any): void;
197
- findServices(filter: any): Generator<any, void, unknown>;
198
197
  locationNamed(name: any): any;
199
198
  locations(): any;
200
199
  hostNamed(name: any): any;
@@ -87,6 +87,11 @@ export class Service extends Base {
87
87
  collection: boolean;
88
88
  writeable: boolean;
89
89
  };
90
+ tls: {
91
+ type: string;
92
+ collection: boolean;
93
+ writeable: boolean;
94
+ };
90
95
  };
91
96
  };
92
97
  alias: any;
@@ -106,6 +111,7 @@ export class Service extends Base {
106
111
  get type(): any;
107
112
  get master(): any;
108
113
  get protocol(): any;
114
+ get tls(): any;
109
115
  get srvPrefix(): string;
110
116
  #private;
111
117
  }