pmcf 2.3.0 → 2.3.2

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.3.0",
3
+ "version": "2.3.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -289,11 +289,11 @@ export class Base {
289
289
  }
290
290
 
291
291
  get domains() {
292
- return this.owner?.domains || new Set();
292
+ return this.owner?.domains ?? new Set();
293
293
  }
294
294
 
295
295
  get localDomains() {
296
- return this.owner?.localDomains || new Set();
296
+ return this.owner?.localDomains ?? new Set();
297
297
  }
298
298
 
299
299
  get administratorEmail() {
@@ -317,12 +317,7 @@ export class Base {
317
317
  }
318
318
 
319
319
  get priority() {
320
- if (this._priority !== undefined) {
321
- return this._priority;
322
- }
323
- if (this.owner?.priority !== undefined) {
324
- return this.owner.priority;
325
- }
320
+ return this._priority ?? this.owner?.priority;
326
321
  }
327
322
 
328
323
  get smtp() {
@@ -351,7 +346,7 @@ export class Base {
351
346
  }
352
347
 
353
348
  get directory() {
354
- return this._directory || join(this.owner.directory, this.name);
349
+ return this._directory ?? join(this.owner.directory, this.name);
355
350
  }
356
351
 
357
352
  get fullName() {
@@ -417,7 +412,7 @@ export class Base {
417
412
  switch (typeof object) {
418
413
  case "string":
419
414
  return object.replaceAll(/\$\{([^\}]*)\}/g, (match, m1) => {
420
- return getAttribute(this, m1) || "${" + m1 + "}";
415
+ return getAttribute(this, m1) ?? "${" + m1 + "}";
421
416
  });
422
417
 
423
418
  case "object":
package/src/host.mjs CHANGED
@@ -138,7 +138,7 @@ export class Host extends Base {
138
138
  }
139
139
 
140
140
  get serial() {
141
- return this._serial || this.extends.find(e => e.serial)?.serial;
141
+ return this._serial ?? this.extends.find(e => e.serial)?.serial;
142
142
  }
143
143
 
144
144
  set deployment(value) {
@@ -146,7 +146,7 @@ export class Host extends Base {
146
146
  }
147
147
 
148
148
  get deployment() {
149
- return this._deployment || this.extends.find(e => e.deployment)?.deployment;
149
+ return this._deployment ?? this.extends.find(e => e.deployment)?.deployment;
150
150
  }
151
151
 
152
152
  set chassis(value) {
@@ -154,7 +154,7 @@ export class Host extends Base {
154
154
  }
155
155
 
156
156
  get chassis() {
157
- return this._chassis || this.extends.find(e => e.chassis)?.chassis;
157
+ return this._chassis ?? this.extends.find(e => e.chassis)?.chassis;
158
158
  }
159
159
 
160
160
  set vendor(value) {
@@ -162,7 +162,7 @@ export class Host extends Base {
162
162
  }
163
163
 
164
164
  get vendor() {
165
- return this._vendor || this.extends.find(e => e.vendor)?.vendor;
165
+ return this._vendor ?? this.extends.find(e => e.vendor)?.vendor;
166
166
  }
167
167
 
168
168
  set architecture(value) {
@@ -171,7 +171,7 @@ export class Host extends Base {
171
171
 
172
172
  get architecture() {
173
173
  return (
174
- this._architecture || this.extends.find(e => e.architecture)?.architecture
174
+ this._architecture ?? this.extends.find(e => e.architecture)?.architecture
175
175
  );
176
176
  }
177
177
 
@@ -258,7 +258,7 @@ export class Host extends Base {
258
258
  }
259
259
 
260
260
  get os() {
261
- return this._os || this.extends.find(e => e.os)?.os;
261
+ return this._os ?? this.extends.find(e => e.os)?.os;
262
262
  }
263
263
 
264
264
  set distribution(value) {
@@ -267,7 +267,7 @@ export class Host extends Base {
267
267
 
268
268
  get distribution() {
269
269
  return (
270
- this._distribution || this.extends.find(e => e.distribution)?.distribution
270
+ this._distribution ?? this.extends.find(e => e.distribution)?.distribution
271
271
  );
272
272
  }
273
273
 
@@ -580,7 +580,7 @@ export class NetworkInterface extends Base {
580
580
  }
581
581
 
582
582
  get hostName() {
583
- return this._hostName || this.host.hostName;
583
+ return this._hostName ?? this.host.hostName;
584
584
  }
585
585
 
586
586
  set hostName(value) {
@@ -602,7 +602,7 @@ export class NetworkInterface extends Base {
602
602
  }
603
603
 
604
604
  get network() {
605
- return this._network || this.host.network;
605
+ return this._network ?? this.host.network;
606
606
  }
607
607
 
608
608
  set network(network) {
@@ -614,7 +614,7 @@ export class NetworkInterface extends Base {
614
614
  }
615
615
 
616
616
  get scope() {
617
- return this._scope || this.network?.scope || "global";
617
+ return this._scope ?? this.network?.scope ?? "global";
618
618
  }
619
619
 
620
620
  set metric(value) {
@@ -622,7 +622,7 @@ export class NetworkInterface extends Base {
622
622
  }
623
623
 
624
624
  get metric() {
625
- return this._metric || this.network?.metric || 1004;
625
+ return this._metric ?? this.network?.metric ?? 1004;
626
626
  }
627
627
 
628
628
  set ssid(value) {
@@ -630,7 +630,7 @@ export class NetworkInterface extends Base {
630
630
  }
631
631
 
632
632
  get ssid() {
633
- return this._ssid || this.network?.ssid;
633
+ return this._ssid ?? this.network?.ssid;
634
634
  }
635
635
 
636
636
  set psk(value) {
@@ -638,7 +638,7 @@ export class NetworkInterface extends Base {
638
638
  }
639
639
 
640
640
  get psk() {
641
- return this._psk || this.network?.psk;
641
+ return this._psk ?? this.network?.psk;
642
642
  }
643
643
 
644
644
  set kind(value) {
@@ -646,6 +646,6 @@ export class NetworkInterface extends Base {
646
646
  }
647
647
 
648
648
  get kind() {
649
- return this._kind || this.network?.kind;
649
+ return this._kind ?? this.network?.kind;
650
650
  }
651
651
  }
package/src/owner.mjs CHANGED
@@ -314,7 +314,7 @@ export class Owner extends Base {
314
314
  }
315
315
 
316
316
  get country() {
317
- return this._country || this.owner?.country;
317
+ return this._country ?? this.owner?.country;
318
318
  }
319
319
 
320
320
  _locales = new Set();
@@ -341,7 +341,7 @@ export class Owner extends Base {
341
341
  }
342
342
 
343
343
  get timezone() {
344
- return this._timezone || this.owner?.timezone;
344
+ return this._timezone ?? this.owner?.timezone;
345
345
  }
346
346
 
347
347
  _administratorEmail;
@@ -369,7 +369,7 @@ export class Owner extends Base {
369
369
  }
370
370
 
371
371
  get domain() {
372
- return this._domain || this.owner?.domain;
372
+ return this._domain ?? this.owner?.domain;
373
373
  }
374
374
 
375
375
  get domains() {
package/src/service.mjs CHANGED
@@ -66,7 +66,7 @@ export const ServiceTypeDefinition = {
66
66
  priority: 0.4,
67
67
  extends: Base.typeDefinition,
68
68
  factoryFor(value) {
69
- const type = value.type || value.name;
69
+ const type = value.type ?? value.name;
70
70
 
71
71
  if (type === "dns") {
72
72
  delete value.type;
@@ -130,15 +130,15 @@ export class Service extends Base {
130
130
  }
131
131
 
132
132
  get ipAddressOrDomainName() {
133
- return this.rawAddress || this.domainName;
133
+ return this.rawAddress ?? this.domainName;
134
134
  }
135
135
 
136
136
  get rawAddresses() {
137
- return this._ipAddresses || this.owner.rawAddresses;
137
+ return this._ipAddresses ?? this.owner.rawAddresses;
138
138
  }
139
139
 
140
140
  get rawAddress() {
141
- return this._ipAddresses?.[0] || this.server.rawAddress;
141
+ return this._ipAddresses?.[0] ?? this.server.rawAddress;
142
142
  }
143
143
 
144
144
  set ipAddresses(value) {
@@ -164,7 +164,7 @@ export class Service extends Base {
164
164
  }
165
165
 
166
166
  get port() {
167
- return this._port || ServiceTypes[this.type]?.endpoints[0].port;
167
+ return this._port ?? ServiceTypes[this.type]?.endpoints[0].port;
168
168
  }
169
169
 
170
170
  set weight(value) {
@@ -172,15 +172,7 @@ export class Service extends Base {
172
172
  }
173
173
 
174
174
  get weight() {
175
- if (this._weight !== undefined) {
176
- return this._weight;
177
- }
178
-
179
- if (this.owner.weight !== undefined) {
180
- return this.owner.weight;
181
- }
182
-
183
- return 1;
175
+ return this._weight ?? this.owner.weight ?? 1;
184
176
  }
185
177
 
186
178
  set type(value) {
@@ -188,7 +180,7 @@ export class Service extends Base {
188
180
  }
189
181
 
190
182
  get type() {
191
- return this._type || this.name;
183
+ return this._type ?? this.name;
192
184
  }
193
185
 
194
186
  get protocol() {
@@ -196,7 +188,7 @@ export class Service extends Base {
196
188
  }
197
189
 
198
190
  get tls() {
199
- return ServiceTypes[this.type]?.tls || false;
191
+ return ServiceTypes[this.type]?.tls ?? false;
200
192
  }
201
193
 
202
194
  get systemdServices() {
@@ -214,12 +206,12 @@ export class Service extends Base {
214
206
  records.push(
215
207
  DNSRecord(
216
208
  dnsFullName(
217
- `_${ServiceTypes[this.type]?.type || this.type}._${
209
+ `_${ServiceTypes[this.type]?.type ?? this.type}._${
218
210
  ep.protocol
219
211
  }.${domainName}`
220
212
  ),
221
213
  "SRV",
222
- this.priority === undefined ? 10 : this.priority,
214
+ this.priority ?? 10,
223
215
  this.weight,
224
216
  ep.port,
225
217
  dnsFullName(this.domainName)
@@ -247,7 +239,7 @@ export class Service extends Base {
247
239
  DNSRecord(
248
240
  dnsFullName(domainName),
249
241
  dnsRecord.type,
250
- this.priority === undefined ? 10 : this.priority,
242
+ this.priority ?? 10,
251
243
  ".",
252
244
  dnsFormatParameters(parameters)
253
245
  )