pmcf 6.11.3 → 6.12.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/bin/pmcf-info +50 -13
- package/package.json +1 -1
- package/src/services/bind.mjs +0 -1
package/bin/pmcf-info
CHANGED
|
@@ -10,30 +10,67 @@ for (const expression of args) {
|
|
|
10
10
|
show(result);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
function show(value) {
|
|
13
|
+
function show(value, indent = 0) {
|
|
14
14
|
if (value instanceof Iterator) {
|
|
15
15
|
for (const v of value) {
|
|
16
16
|
show(v);
|
|
17
17
|
}
|
|
18
18
|
} else {
|
|
19
|
-
|
|
19
|
+
const type = value.constructor;
|
|
20
|
+
console.log(`${" ".repeat(indent)}${value.fullName}(${type.name}):`);
|
|
21
|
+
|
|
22
|
+
const ml = maxNameLength(type);
|
|
23
|
+
const name = attribute => " " + attribute.name.padEnd(ml) + ": ";
|
|
24
|
+
|
|
25
|
+
for (const [path, attribute] of extendingAttributeIterator(
|
|
26
|
+
type,
|
|
27
|
+
attribute =>
|
|
28
|
+
!attribute.key && !attribute.private && attribute.type.primitive
|
|
29
|
+
)) {
|
|
30
|
+
const v = value.attribute(attribute.name);
|
|
31
|
+
if (v !== undefined) {
|
|
32
|
+
if (attribute.collection) {
|
|
33
|
+
console.log(`${name(attribute)}${[...v]}`);
|
|
34
|
+
} else {
|
|
35
|
+
console.log(`${name(attribute)}${v}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
20
39
|
|
|
21
40
|
for (const [path, attribute] of extendingAttributeIterator(
|
|
22
|
-
|
|
23
|
-
attribute => !attribute.private
|
|
41
|
+
type,
|
|
42
|
+
attribute => !attribute.private && !attribute.type.primitive
|
|
24
43
|
)) {
|
|
25
|
-
|
|
44
|
+
const v = value[attribute.name];
|
|
45
|
+
if (v !== undefined) {
|
|
46
|
+
if (attribute.collection) {
|
|
47
|
+
console.log(name(attribute));
|
|
48
|
+
|
|
49
|
+
if (attribute.backpointer) {
|
|
50
|
+
for (const o of v.values()) {
|
|
51
|
+
show(o, indent + 2);
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
for (const o of v.values()) {
|
|
55
|
+
console.log(" ".repeat(indent + 2) + o.fullName);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
console.log(`${name(attribute)}${v.fullName}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
26
62
|
}
|
|
27
|
-
ex(value);
|
|
28
63
|
}
|
|
29
64
|
}
|
|
30
65
|
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
66
|
+
function maxNameLength(type) {
|
|
67
|
+
let maxLength = 0;
|
|
68
|
+
for (const [path, attribute] of extendingAttributeIterator(
|
|
69
|
+
type,
|
|
70
|
+
attribute => !attribute.key && !attribute.private
|
|
71
|
+
)) {
|
|
72
|
+
maxLength = Math.max(maxLength, attribute.name.length);
|
|
38
73
|
}
|
|
74
|
+
|
|
75
|
+
return maxLength;
|
|
39
76
|
}
|
package/package.json
CHANGED