pmcf 1.30.7 → 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 +13 -6
- package/src/model.mjs +1 -0
- package/src/owner.mjs +4 -0
- package/types/base.d.mts +1 -1
- package/types/model.d.mts +1 -2
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -180,23 +180,30 @@ 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
|
switch (typeof value) {
|
|
193
194
|
case "undefined":
|
|
194
195
|
break;
|
|
195
196
|
case "object":
|
|
196
|
-
if (value instanceof Base
|
|
197
|
-
json[p] = {
|
|
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
|
+
);
|
|
198
206
|
}
|
|
199
|
-
|
|
200
207
|
break;
|
|
201
208
|
default:
|
|
202
209
|
json[p] = value;
|
package/src/model.mjs
CHANGED
package/src/owner.mjs
CHANGED
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";
|