pmcf 2.60.10 → 2.62.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.60.10",
3
+ "version": "2.62.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -19,7 +19,8 @@
19
19
  "iwd",
20
20
  "kea",
21
21
  "keepalived",
22
- "systemd"
22
+ "systemd",
23
+ "openldap"
23
24
  ],
24
25
  "contributors": [
25
26
  {
@@ -46,12 +47,12 @@
46
47
  },
47
48
  "dependencies": {
48
49
  "ip-utilties": "^1.4.6",
49
- "npm-pkgbuild": "^18.2.9",
50
+ "npm-pkgbuild": "^18.2.10",
50
51
  "pacc": "^3.4.4",
51
52
  "pkg-dir": "^8.0.0"
52
53
  },
53
54
  "devDependencies": {
54
- "@types/node": "^22.15.24",
55
+ "@types/node": "^22.15.29",
55
56
  "ava": "^6.3.0",
56
57
  "c8": "^10.1.3",
57
58
  "documentation": "^14.0.3",
package/src/base.mjs CHANGED
@@ -41,6 +41,7 @@ export class Base {
41
41
  _packaging = new Set();
42
42
  _directory;
43
43
  _finalize;
44
+ _properties;
44
45
 
45
46
  static {
46
47
  addType(this);
@@ -221,6 +222,10 @@ export class Base {
221
222
  }
222
223
  };
223
224
 
225
+ if(data?.properties) {
226
+ this._properties = data.properties;
227
+ }
228
+
224
229
  for (const property of Object.values(type.properties)) {
225
230
  if (property.writeable) {
226
231
  const value = data[property.name];
@@ -452,6 +457,15 @@ export class Base {
452
457
  return false;
453
458
  }
454
459
 
460
+ property(name) {
461
+ const value = this._properties?.[name];
462
+ if(value === undefined && this.owner) {
463
+ return this.owner.property(name);
464
+ }
465
+
466
+ return value;
467
+ }
468
+
455
469
  expand(object) {
456
470
  if (this.isTemplate) {
457
471
  return object;
@@ -460,7 +474,7 @@ export class Base {
460
474
  switch (typeof object) {
461
475
  case "string":
462
476
  return object.replaceAll(/\$\{([^\}]*)\}/g, (match, m1) => {
463
- return getAttribute(this, m1) ?? "${" + m1 + "}";
477
+ return this.property(m1) ?? getAttribute(this, m1) ?? "${" + m1 + "}";
464
478
  });
465
479
 
466
480
  case "object":
package/src/module.mjs CHANGED
@@ -20,6 +20,7 @@ export * from "./endpoint.mjs";
20
20
  export * from "./services/bind.mjs";
21
21
  export * from "./services/chrony.mjs";
22
22
  export * from "./services/kea.mjs";
23
+ export * from "./services/openldap.mjs";
23
24
  export * from "./services/systemd-journal.mjs";
24
25
  export * from "./services/systemd-journal-remote.mjs";
25
26
  export * from "./services/systemd-journal-upload.mjs";
@@ -0,0 +1,63 @@
1
+ import { join } from "node:path";
2
+ import { FileContentProvider } from "npm-pkgbuild";
3
+ import { addType } from "../types.mjs";
4
+ import {
5
+ ServiceTypeDefinition,
6
+ Service
7
+ } from "../service.mjs";
8
+ import { writeLines } from "../utils.mjs";
9
+
10
+ const OpenLDAPServiceTypeDefinition = {
11
+ name: "openldap",
12
+ specializationOf: ServiceTypeDefinition,
13
+ owners: ServiceTypeDefinition.owners,
14
+ extends: ServiceTypeDefinition,
15
+ priority: 0.1,
16
+ properties: {}
17
+ };
18
+
19
+ export class OpenLDAPService extends Service {
20
+ static {
21
+ addType(this);
22
+ }
23
+
24
+ static get typeDefinition() {
25
+ return OpenLDAPServiceTypeDefinition;
26
+ }
27
+
28
+ constructor(owner, data) {
29
+ super(owner, data);
30
+ this.read(data, OpenLDAPServiceTypeDefinition);
31
+ }
32
+
33
+ get type() {
34
+ return "openldap";
35
+ }
36
+
37
+ async *preparePackages(dir) {
38
+ const network = this.network;
39
+ const host = this.host;
40
+ const name = host.name;
41
+
42
+ console.log("openldap", name, network.name);
43
+
44
+ const packageData = {
45
+ dir,
46
+ sources: [new FileContentProvider(dir + "/")],
47
+ outputs: this.outputs,
48
+ properties: {
49
+ name: `openldap-${this.location.name}-${name}`,
50
+ description: `openldap definitions for ${this.fullName}@${name}`,
51
+ access: "private",
52
+ dependencies: ["openldap>=2.6.10"]
53
+ }
54
+ };
55
+
56
+ await writeLines(join(packageData.dir, "etc/conf.d"), "slapd", [
57
+ "SLAPD_OPTIONS=-d 9",
58
+ "SLAPD_URLS=ldap:/// ldaps:///"
59
+ ]);
60
+
61
+ yield packageData;
62
+ }
63
+ }
package/types/base.d.mts CHANGED
@@ -61,6 +61,7 @@ export class Base {
61
61
  _packaging: Set<any>;
62
62
  _directory: any;
63
63
  _finalize: any;
64
+ _properties: any;
64
65
  ownerFor(property: any, data: any): any;
65
66
  read(data: any, type: any): void;
66
67
  named(name: any): void;
@@ -106,6 +107,7 @@ export class Base {
106
107
  set tags(value: Set<any>);
107
108
  get tags(): Set<any>;
108
109
  get isTemplate(): boolean;
110
+ property(name: any): any;
109
111
  expand(object: any): any;
110
112
  finalize(action: any): void;
111
113
  execFinalize(): void;
@@ -20,6 +20,7 @@ export * from "./endpoint.mjs";
20
20
  export * from "./services/bind.mjs";
21
21
  export * from "./services/chrony.mjs";
22
22
  export * from "./services/kea.mjs";
23
+ export * from "./services/openldap.mjs";
23
24
  export * from "./services/systemd-journal.mjs";
24
25
  export * from "./services/systemd-journal-remote.mjs";
25
26
  export * from "./services/systemd-journal-upload.mjs";
@@ -0,0 +1,260 @@
1
+ export class OpenLDAPService extends Service {
2
+ static get typeDefinition(): {
3
+ name: string;
4
+ specializationOf: {
5
+ name: string;
6
+ owners: string[];
7
+ priority: number;
8
+ extends: {
9
+ name: string;
10
+ owners: any[];
11
+ properties: {
12
+ owner: {
13
+ type: string;
14
+ collection: boolean;
15
+ writeable: boolean;
16
+ };
17
+ type: {
18
+ type: string;
19
+ collection: boolean;
20
+ writeable: boolean;
21
+ };
22
+ name: {
23
+ type: string;
24
+ collection: boolean;
25
+ identifier: boolean;
26
+ writeable: boolean;
27
+ };
28
+ description: {
29
+ type: string;
30
+ collection: boolean;
31
+ writeable: boolean;
32
+ };
33
+ priority: {
34
+ type: string;
35
+ collection: boolean;
36
+ writeable: boolean;
37
+ };
38
+ directory: {
39
+ type: string;
40
+ collection: boolean;
41
+ writeable: boolean;
42
+ };
43
+ packaging: {
44
+ type: string;
45
+ collection: boolean;
46
+ writeable: boolean;
47
+ };
48
+ tags: {
49
+ type: string;
50
+ collection: boolean;
51
+ writeable: boolean;
52
+ };
53
+ };
54
+ };
55
+ specializations: {};
56
+ factoryFor(owner: any, value: any): any;
57
+ properties: {
58
+ alias: {
59
+ type: string;
60
+ collection: boolean;
61
+ writeable: boolean;
62
+ };
63
+ weight: {
64
+ type: string;
65
+ collection: boolean;
66
+ writeable: boolean;
67
+ default: number;
68
+ };
69
+ systemd: {
70
+ type: string;
71
+ collection: boolean;
72
+ writeable: boolean;
73
+ };
74
+ port: {
75
+ type: string;
76
+ collection: boolean;
77
+ writeable: boolean;
78
+ };
79
+ protocol: {
80
+ type: string;
81
+ collection: boolean;
82
+ writeable: boolean;
83
+ values: string[];
84
+ };
85
+ type: {
86
+ type: string;
87
+ collection: boolean;
88
+ writeable: boolean;
89
+ };
90
+ tls: {
91
+ type: string;
92
+ collection: boolean;
93
+ writeable: boolean;
94
+ default: boolean;
95
+ };
96
+ hostName: {
97
+ type: string;
98
+ collection: boolean;
99
+ writeable: boolean;
100
+ };
101
+ cidrAddresses: {
102
+ type: string;
103
+ collection: boolean;
104
+ writeable: boolean;
105
+ };
106
+ cidrAddress: {
107
+ type: string;
108
+ collection: boolean;
109
+ writeable: boolean;
110
+ };
111
+ addresses: {
112
+ type: string;
113
+ collection: boolean;
114
+ writeable: boolean;
115
+ };
116
+ address: {
117
+ type: string;
118
+ collection: boolean;
119
+ writeable: boolean;
120
+ };
121
+ };
122
+ };
123
+ owners: string[];
124
+ extends: {
125
+ name: string;
126
+ owners: string[];
127
+ priority: number;
128
+ extends: {
129
+ name: string;
130
+ owners: any[];
131
+ properties: {
132
+ owner: {
133
+ type: string;
134
+ collection: boolean;
135
+ writeable: boolean;
136
+ };
137
+ type: {
138
+ type: string;
139
+ collection: boolean;
140
+ writeable: boolean;
141
+ };
142
+ name: {
143
+ type: string;
144
+ collection: boolean;
145
+ identifier: boolean;
146
+ writeable: boolean;
147
+ };
148
+ description: {
149
+ type: string;
150
+ collection: boolean;
151
+ writeable: boolean;
152
+ };
153
+ priority: {
154
+ type: string;
155
+ collection: boolean;
156
+ writeable: boolean;
157
+ };
158
+ directory: {
159
+ type: string;
160
+ collection: boolean;
161
+ writeable: boolean;
162
+ };
163
+ packaging: {
164
+ type: string;
165
+ collection: boolean;
166
+ writeable: boolean;
167
+ };
168
+ tags: {
169
+ type: string;
170
+ collection: boolean;
171
+ writeable: boolean;
172
+ };
173
+ };
174
+ };
175
+ specializations: {};
176
+ factoryFor(owner: any, value: any): any;
177
+ properties: {
178
+ alias: {
179
+ type: string;
180
+ collection: boolean;
181
+ writeable: boolean;
182
+ };
183
+ weight: {
184
+ type: string;
185
+ collection: boolean;
186
+ writeable: boolean;
187
+ default: number;
188
+ };
189
+ systemd: {
190
+ type: string;
191
+ collection: boolean;
192
+ writeable: boolean;
193
+ };
194
+ port: {
195
+ type: string;
196
+ collection: boolean;
197
+ writeable: boolean;
198
+ };
199
+ protocol: {
200
+ type: string;
201
+ collection: boolean;
202
+ writeable: boolean;
203
+ values: string[];
204
+ };
205
+ type: {
206
+ type: string;
207
+ collection: boolean;
208
+ writeable: boolean;
209
+ };
210
+ tls: {
211
+ type: string;
212
+ collection: boolean;
213
+ writeable: boolean;
214
+ default: boolean;
215
+ };
216
+ hostName: {
217
+ type: string;
218
+ collection: boolean;
219
+ writeable: boolean;
220
+ };
221
+ cidrAddresses: {
222
+ type: string;
223
+ collection: boolean;
224
+ writeable: boolean;
225
+ };
226
+ cidrAddress: {
227
+ type: string;
228
+ collection: boolean;
229
+ writeable: boolean;
230
+ };
231
+ addresses: {
232
+ type: string;
233
+ collection: boolean;
234
+ writeable: boolean;
235
+ };
236
+ address: {
237
+ type: string;
238
+ collection: boolean;
239
+ writeable: boolean;
240
+ };
241
+ };
242
+ };
243
+ priority: number;
244
+ properties: {};
245
+ };
246
+ get type(): string;
247
+ preparePackages(dir: any): AsyncGenerator<{
248
+ dir: any;
249
+ sources: FileContentProvider[];
250
+ outputs: Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
251
+ properties: {
252
+ name: string;
253
+ description: string;
254
+ access: string;
255
+ dependencies: string[];
256
+ };
257
+ }, void, unknown>;
258
+ }
259
+ import { Service } from "../service.mjs";
260
+ import { FileContentProvider } from "npm-pkgbuild";