pmcf 4.0.2 → 4.0.4
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 +33 -30
- 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/types/base.d.mts +4 -4
- package/types/network-interfaces/wlan.d.mts +1 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
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
|
@@ -42,11 +42,11 @@ export class Base {
|
|
|
42
42
|
owner;
|
|
43
43
|
description;
|
|
44
44
|
name;
|
|
45
|
+
extends = [];
|
|
45
46
|
_tags = new Set();
|
|
46
47
|
_packaging = new Set();
|
|
47
48
|
_directory;
|
|
48
49
|
_finalize;
|
|
49
|
-
_extends = [];
|
|
50
50
|
_properties;
|
|
51
51
|
|
|
52
52
|
static {
|
|
@@ -208,11 +208,8 @@ export class Base {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
this.error(
|
|
211
|
-
"
|
|
212
|
-
|
|
213
|
-
value, "of", attribute.type.name,
|
|
214
|
-
this.root.named(value)?.type,
|
|
215
|
-
attribute.type?.map && attribute.type.map(t => t.name)
|
|
211
|
+
`No such object "${value}" (${attribute.type.name}) for attribute ${name}`,
|
|
212
|
+
this.root.named(value)?.toString()
|
|
216
213
|
);
|
|
217
214
|
});
|
|
218
215
|
}
|
|
@@ -288,14 +285,6 @@ export class Base {
|
|
|
288
285
|
|
|
289
286
|
_applyExtends() {}
|
|
290
287
|
|
|
291
|
-
set extends(value) {
|
|
292
|
-
this._extends.push(value);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
get extends() {
|
|
296
|
-
return this._extends;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
288
|
named(name) {}
|
|
300
289
|
|
|
301
290
|
typeNamed(typeName, name) {
|
|
@@ -316,10 +305,21 @@ export class Base {
|
|
|
316
305
|
return this.owner.addObject(object);
|
|
317
306
|
}
|
|
318
307
|
|
|
308
|
+
*owners() {
|
|
309
|
+
if (this.owner) {
|
|
310
|
+
yield* this.owner.thisAndOwners();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
*thisAndOwners() {
|
|
315
|
+
yield this;
|
|
316
|
+
yield* this.owners();
|
|
317
|
+
}
|
|
318
|
+
|
|
319
319
|
forOwner(owner) {
|
|
320
320
|
if (this.owner !== owner) {
|
|
321
321
|
const newObject = Object.create(this);
|
|
322
|
-
|
|
322
|
+
newObject.extends = [...this.extends];
|
|
323
323
|
newObject.owner = owner;
|
|
324
324
|
return newObject;
|
|
325
325
|
}
|
|
@@ -551,27 +551,31 @@ export class Base {
|
|
|
551
551
|
return this.name?.indexOf("*") >= 0 || this.owner?.isTemplate || false;
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
-
get properties() {
|
|
555
|
-
return this._properties;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
554
|
get globals() {
|
|
559
555
|
return Object.assign(
|
|
560
556
|
{},
|
|
561
557
|
this.properties,
|
|
562
|
-
this.
|
|
563
|
-
this.owner?.owner?.properties,
|
|
564
|
-
this.owner?.owner?.owner?.properties,
|
|
558
|
+
...[...this.owners()].map(o => o.properties),
|
|
565
559
|
globals
|
|
566
560
|
);
|
|
567
561
|
}
|
|
568
562
|
|
|
563
|
+
get properties() {
|
|
564
|
+
return this._properties;
|
|
565
|
+
}
|
|
566
|
+
|
|
569
567
|
property(name) {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
568
|
+
let value = this._properties?.[name];
|
|
569
|
+
if (value !== undefined) {
|
|
570
|
+
return value;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
for (const o of this.owners()) {
|
|
574
|
+
const value = o.property(name);
|
|
575
|
+
if (value !== undefined) {
|
|
576
|
+
return value;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
575
579
|
}
|
|
576
580
|
|
|
577
581
|
/**
|
|
@@ -685,7 +689,7 @@ export function extractFrom(
|
|
|
685
689
|
|
|
686
690
|
const json = {};
|
|
687
691
|
|
|
688
|
-
|
|
692
|
+
for (; typeDefinition; typeDefinition = typeDefinition.extends) {
|
|
689
693
|
for (const [path, def] of attributeIterator(
|
|
690
694
|
typeDefinition.attributes,
|
|
691
695
|
filterPublic
|
|
@@ -740,8 +744,7 @@ export function extractFrom(
|
|
|
740
744
|
json[name] = value;
|
|
741
745
|
}
|
|
742
746
|
}
|
|
743
|
-
|
|
744
|
-
} while (typeDefinition);
|
|
747
|
+
}
|
|
745
748
|
|
|
746
749
|
return json;
|
|
747
750
|
}
|
|
@@ -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/types/base.d.mts
CHANGED
|
@@ -48,20 +48,20 @@ export class Base {
|
|
|
48
48
|
owner: Base;
|
|
49
49
|
description: any;
|
|
50
50
|
name: string;
|
|
51
|
+
extends: any[];
|
|
51
52
|
_tags: Set<any>;
|
|
52
53
|
_packaging: Set<any>;
|
|
53
54
|
_directory: any;
|
|
54
55
|
_finalize: any;
|
|
55
|
-
_extends: any[];
|
|
56
56
|
_properties: any;
|
|
57
57
|
ownerFor(attribute: any, data: any): any;
|
|
58
58
|
read(data: any, type?: any): void;
|
|
59
59
|
_applyExtends(): void;
|
|
60
|
-
set extends(value: any[]);
|
|
61
|
-
get extends(): any[];
|
|
62
60
|
named(name: any): void;
|
|
63
61
|
typeNamed(typeName: any, name: any): any;
|
|
64
62
|
addObject(object: any): any;
|
|
63
|
+
owners(): any;
|
|
64
|
+
thisAndOwners(): any;
|
|
65
65
|
forOwner(owner: any): any;
|
|
66
66
|
isNamed(name: any): boolean;
|
|
67
67
|
relativeName(name: any): any;
|
|
@@ -117,8 +117,8 @@ export class Base {
|
|
|
117
117
|
set tags(value: Set<any>);
|
|
118
118
|
get tags(): Set<any>;
|
|
119
119
|
get isTemplate(): any;
|
|
120
|
-
get properties(): any;
|
|
121
120
|
get globals(): any;
|
|
121
|
+
get properties(): any;
|
|
122
122
|
property(name: any): any;
|
|
123
123
|
/**
|
|
124
124
|
*
|
|
@@ -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
|
};
|