pmcf 1.30.6 → 1.31.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 +1 -1
- package/src/base.mjs +21 -9
- package/src/model.mjs +1 -0
- package/src/owner.mjs +5 -3
- package/types/base.d.mts +1 -1
- package/types/model.d.mts +1 -2
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -112,7 +112,7 @@ export class Base {
|
|
|
112
112
|
return new Set([...object].map(e => this.expand(e)));
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
/*return Object.fromEntries(
|
|
116
116
|
Object.entries(object).map(([k, v]) => [k, this.expand(v)])
|
|
117
117
|
);*/
|
|
118
118
|
}
|
|
@@ -180,21 +180,33 @@ export class Base {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
toJSON() {
|
|
183
|
-
return extractFrom(this
|
|
183
|
+
return extractFrom(this);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
export function extractFrom(object
|
|
187
|
+
export function extractFrom(object) {
|
|
188
188
|
const json = {};
|
|
189
|
-
|
|
189
|
+
|
|
190
|
+
for (const p of object?.propertyNames || Object.keys(object)) {
|
|
190
191
|
const value = object[p];
|
|
191
192
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
switch (typeof value) {
|
|
194
|
+
case "undefined":
|
|
195
|
+
break;
|
|
196
|
+
case "object":
|
|
197
|
+
if (value instanceof Base) {
|
|
198
|
+
json[p] = { type: value.typeName };
|
|
199
|
+
if (value.name) {
|
|
200
|
+
json[p].name = value.name;
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
json[p] = Object.fromEntries(
|
|
204
|
+
Object.entries(value).map(([k, v]) => [k, extractFrom(v)])
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
default:
|
|
196
209
|
json[p] = value;
|
|
197
|
-
}
|
|
198
210
|
}
|
|
199
211
|
}
|
|
200
212
|
return json;
|
package/src/model.mjs
CHANGED
package/src/owner.mjs
CHANGED
|
@@ -10,6 +10,10 @@ export class Owner extends Base {
|
|
|
10
10
|
domain;
|
|
11
11
|
ntp = { servers: [] };
|
|
12
12
|
|
|
13
|
+
static get typeName() {
|
|
14
|
+
return "owner";
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
constructor(owner, data) {
|
|
14
18
|
super(owner, data);
|
|
15
19
|
|
|
@@ -84,8 +88,6 @@ export class Owner extends Base {
|
|
|
84
88
|
this.#membersByType.set(typeName, typeSlot);
|
|
85
89
|
}
|
|
86
90
|
typeSlot.set(fullName, object);
|
|
87
|
-
|
|
88
|
-
//console.log(this.toString(),"ADD", typeName, fullName, object.name, this.named(fullName)?.toString());
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
addObject(object) {
|
|
@@ -190,7 +192,7 @@ export class Owner extends Base {
|
|
|
190
192
|
|
|
191
193
|
_resolveBridges() {
|
|
192
194
|
for (const bridge of this.#bridges) {
|
|
193
|
-
this.info(bridgeToJSON(bridge));
|
|
195
|
+
//this.info(bridgeToJSON(bridge));
|
|
194
196
|
for (const network of bridge) {
|
|
195
197
|
if (typeof network === "string") {
|
|
196
198
|
const other = this.networkNamed(network);
|
package/types/base.d.mts
CHANGED
package/types/model.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export class Root extends Owner {
|
|
2
2
|
static get types(): {
|
|
3
|
-
[k: string]: typeof DNSService | typeof
|
|
3
|
+
[k: string]: typeof DNSService | typeof Owner | typeof Subnet | typeof Service | typeof Host | typeof NetworkInterface;
|
|
4
4
|
};
|
|
5
5
|
constructor(directory: any);
|
|
6
6
|
get fullName(): string;
|
|
@@ -69,6 +69,5 @@ export class NetworkInterface extends Base {
|
|
|
69
69
|
import { Owner } from "./owner.mjs";
|
|
70
70
|
import { DNSService } from "./dns.mjs";
|
|
71
71
|
import { Subnet } from "./owner.mjs";
|
|
72
|
-
import { Cluster } from "./cluster.mjs";
|
|
73
72
|
import { Service } from "./service.mjs";
|
|
74
73
|
import { Base } from "./base.mjs";
|