pmcf 4.0.1 → 4.0.3
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 +2 -2
- package/src/base.mjs +31 -19
- package/src/network-interfaces/ethernet.mjs +1 -1
- package/src/network-interfaces/loopback.mjs +1 -1
- package/src/network-interfaces/wlan.mjs +7 -3
- package/src/owner.mjs +11 -2
- package/src/service.mjs +4 -0
- package/types/base.d.mts +3 -1
- package/types/network-interfaces/wlan.d.mts +1 -21
- package/types/service.d.mts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"ip-utilties": "^2.0.2",
|
|
57
57
|
"npm-pkgbuild": "^19.1.3",
|
|
58
|
-
"pacc": "^7.
|
|
58
|
+
"pacc": "^7.2.0",
|
|
59
59
|
"package-directory": "^8.1.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
package/src/base.mjs
CHANGED
|
@@ -208,10 +208,8 @@ export class Base {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
this.error(
|
|
211
|
-
"
|
|
212
|
-
|
|
213
|
-
attribute.type?.map && attribute.type.map(t => t.name),
|
|
214
|
-
value
|
|
211
|
+
`No such object "${value}" (${attribute.type.name}) for attribute ${name}`,
|
|
212
|
+
this.root.named(value)?.toString()
|
|
215
213
|
);
|
|
216
214
|
});
|
|
217
215
|
}
|
|
@@ -315,6 +313,17 @@ export class Base {
|
|
|
315
313
|
return this.owner.addObject(object);
|
|
316
314
|
}
|
|
317
315
|
|
|
316
|
+
*owners() {
|
|
317
|
+
if (this.owner) {
|
|
318
|
+
yield* this.owner.thisAndOwners();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
*thisAndOwners() {
|
|
323
|
+
yield this;
|
|
324
|
+
yield* this.owners();
|
|
325
|
+
}
|
|
326
|
+
|
|
318
327
|
forOwner(owner) {
|
|
319
328
|
if (this.owner !== owner) {
|
|
320
329
|
const newObject = Object.create(this);
|
|
@@ -550,27 +559,31 @@ export class Base {
|
|
|
550
559
|
return this.name?.indexOf("*") >= 0 || this.owner?.isTemplate || false;
|
|
551
560
|
}
|
|
552
561
|
|
|
553
|
-
get properties() {
|
|
554
|
-
return this._properties;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
562
|
get globals() {
|
|
558
563
|
return Object.assign(
|
|
559
564
|
{},
|
|
560
565
|
this.properties,
|
|
561
|
-
this.
|
|
562
|
-
this.owner?.owner?.properties,
|
|
563
|
-
this.owner?.owner?.owner?.properties,
|
|
566
|
+
...[...this.owners()].map(o => o.properties),
|
|
564
567
|
globals
|
|
565
568
|
);
|
|
566
569
|
}
|
|
567
570
|
|
|
571
|
+
get properties() {
|
|
572
|
+
return this._properties;
|
|
573
|
+
}
|
|
574
|
+
|
|
568
575
|
property(name) {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
576
|
+
let value = this._properties?.[name];
|
|
577
|
+
if (value !== undefined) {
|
|
578
|
+
return value;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
for (const o of this.owners()) {
|
|
582
|
+
const value = o.property(name);
|
|
583
|
+
if (value !== undefined) {
|
|
584
|
+
return value;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
574
587
|
}
|
|
575
588
|
|
|
576
589
|
/**
|
|
@@ -684,7 +697,7 @@ export function extractFrom(
|
|
|
684
697
|
|
|
685
698
|
const json = {};
|
|
686
699
|
|
|
687
|
-
|
|
700
|
+
for (; typeDefinition; typeDefinition = typeDefinition.extends) {
|
|
688
701
|
for (const [path, def] of attributeIterator(
|
|
689
702
|
typeDefinition.attributes,
|
|
690
703
|
filterPublic
|
|
@@ -739,8 +752,7 @@ export function extractFrom(
|
|
|
739
752
|
json[name] = value;
|
|
740
753
|
}
|
|
741
754
|
}
|
|
742
|
-
|
|
743
|
-
} while (typeDefinition);
|
|
755
|
+
}
|
|
744
756
|
|
|
745
757
|
return json;
|
|
746
758
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { mkdir } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
string_attribute_writable,
|
|
5
|
+
secret_attribute_writable,
|
|
6
|
+
addType
|
|
7
|
+
} from "pacc";
|
|
4
8
|
import { writeLines, sectionLines } from "../utils.mjs";
|
|
5
9
|
import { NetworkInterfaceTypeDefinition } from "./network-interface.mjs";
|
|
6
10
|
import {
|
|
@@ -16,7 +20,7 @@ const WLANNetworkInterfaceTypeDefinition = {
|
|
|
16
20
|
key: "name",
|
|
17
21
|
attributes: {
|
|
18
22
|
ssid: string_attribute_writable,
|
|
19
|
-
psk:
|
|
23
|
+
psk: secret_attribute_writable,
|
|
20
24
|
secretName: string_attribute_writable
|
|
21
25
|
}
|
|
22
26
|
};
|
|
@@ -31,7 +35,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
|
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
static isCommonName(name) {
|
|
34
|
-
return name.match(
|
|
38
|
+
return name.match(/^wlan\d+$/);
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
static get typeDefinition() {
|
package/src/owner.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
default_attribute_writable,
|
|
4
4
|
string_collection_attribute_writable,
|
|
5
5
|
string_attribute_writable,
|
|
6
|
+
boolean_attribute_writable_false,
|
|
6
7
|
email_attribute,
|
|
7
8
|
addType,
|
|
8
|
-
types
|
|
9
|
-
boolean_attribute_writable_false
|
|
9
|
+
types
|
|
10
10
|
} from "pacc";
|
|
11
11
|
import { asIterator } from "./utils.mjs";
|
|
12
12
|
import { Base } from "./base.mjs";
|
|
@@ -147,6 +147,15 @@ export class Owner extends Base {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
addObject(object) {
|
|
150
|
+
if (object.owner && object.owner !== this) {
|
|
151
|
+
this.addTypeObject(
|
|
152
|
+
object.typeName,
|
|
153
|
+
object.owner.name + "/" + object.name,
|
|
154
|
+
object
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
150
159
|
this.addTypeObject(object.typeName, object.name, object);
|
|
151
160
|
}
|
|
152
161
|
|
package/src/service.mjs
CHANGED
package/types/base.d.mts
CHANGED
|
@@ -62,6 +62,8 @@ export class Base {
|
|
|
62
62
|
named(name: any): void;
|
|
63
63
|
typeNamed(typeName: any, name: any): any;
|
|
64
64
|
addObject(object: any): any;
|
|
65
|
+
owners(): any;
|
|
66
|
+
thisAndOwners(): any;
|
|
65
67
|
forOwner(owner: any): any;
|
|
66
68
|
isNamed(name: any): boolean;
|
|
67
69
|
relativeName(name: any): any;
|
|
@@ -117,8 +119,8 @@ export class Base {
|
|
|
117
119
|
set tags(value: Set<any>);
|
|
118
120
|
get tags(): Set<any>;
|
|
119
121
|
get isTemplate(): any;
|
|
120
|
-
get properties(): any;
|
|
121
122
|
get globals(): any;
|
|
123
|
+
get properties(): any;
|
|
122
124
|
property(name: any): any;
|
|
123
125
|
/**
|
|
124
126
|
*
|
|
@@ -1647,27 +1647,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
|
|
|
1647
1647
|
key: string;
|
|
1648
1648
|
attributes: {
|
|
1649
1649
|
ssid: import("pacc").AttributeDefinition;
|
|
1650
|
-
psk:
|
|
1651
|
-
writable: boolean;
|
|
1652
|
-
type: object;
|
|
1653
|
-
isKey: boolean;
|
|
1654
|
-
mandatory: boolean;
|
|
1655
|
-
collection: boolean;
|
|
1656
|
-
private?: boolean;
|
|
1657
|
-
credential?: boolean;
|
|
1658
|
-
persistent?: boolean;
|
|
1659
|
-
depends?: string;
|
|
1660
|
-
description?: string;
|
|
1661
|
-
default?: any;
|
|
1662
|
-
set?: Function;
|
|
1663
|
-
get?: Function;
|
|
1664
|
-
toInternal?: Function;
|
|
1665
|
-
toExternal?: Function;
|
|
1666
|
-
values?: Set<any>;
|
|
1667
|
-
externalName?: string;
|
|
1668
|
-
env?: string[] | string;
|
|
1669
|
-
additionalValues?: object;
|
|
1670
|
-
};
|
|
1650
|
+
psk: import("pacc").AttributeDefinition;
|
|
1671
1651
|
secretName: import("pacc").AttributeDefinition;
|
|
1672
1652
|
};
|
|
1673
1653
|
};
|
package/types/service.d.mts
CHANGED
|
@@ -614,6 +614,7 @@ export class Service extends Base {
|
|
|
614
614
|
get domainName(): string;
|
|
615
615
|
get networks(): Set<any>;
|
|
616
616
|
get subnets(): Set<any>;
|
|
617
|
+
get services(): this[];
|
|
617
618
|
get serviceTypeEndpoints(): any;
|
|
618
619
|
endpoints(filter: any): (UnixEndpoint | HTTPEndpoint | Endpoint | DomainNameEndpoint)[];
|
|
619
620
|
endpoint(filter: any): UnixEndpoint | HTTPEndpoint | Endpoint | DomainNameEndpoint;
|