azdo-cli 0.2.0-develop.104 → 0.2.0-develop.107
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/README.md +1 -1
- package/dist/index.js +29 -5
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -64,9 +64,20 @@ function stringifyFieldValue(value) {
|
|
|
64
64
|
function buildExtraFields(fields, requested) {
|
|
65
65
|
const result = {};
|
|
66
66
|
for (const name of requested) {
|
|
67
|
-
|
|
67
|
+
let val = fields[name];
|
|
68
|
+
let resolvedName = name;
|
|
69
|
+
if (val === void 0) {
|
|
70
|
+
const nameSuffix = name.split(".").pop().toLowerCase();
|
|
71
|
+
const match = Object.keys(fields).find(
|
|
72
|
+
(k) => k.split(".").pop().toLowerCase() === nameSuffix
|
|
73
|
+
);
|
|
74
|
+
if (match !== void 0) {
|
|
75
|
+
val = fields[match];
|
|
76
|
+
resolvedName = match;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
68
79
|
if (val !== void 0 && val !== null) {
|
|
69
|
-
result[
|
|
80
|
+
result[resolvedName] = stringifyFieldValue(val);
|
|
70
81
|
}
|
|
71
82
|
}
|
|
72
83
|
return Object.keys(result).length > 0 ? result : null;
|
|
@@ -1477,6 +1488,14 @@ function stringifyValue(value) {
|
|
|
1477
1488
|
if (typeof value === "object") return JSON.stringify(value);
|
|
1478
1489
|
return String(value);
|
|
1479
1490
|
}
|
|
1491
|
+
function formatRichValue(raw) {
|
|
1492
|
+
const md = htmlToMarkdown(raw);
|
|
1493
|
+
const lines = md.split("\n").filter((l) => l.trim() !== "");
|
|
1494
|
+
const preview = lines.slice(0, 5);
|
|
1495
|
+
const suffix = lines.length > 5 ? `
|
|
1496
|
+
\u2026 (${lines.length - 5} more lines)` : "";
|
|
1497
|
+
return preview.join("\n ") + suffix;
|
|
1498
|
+
}
|
|
1480
1499
|
function formatFieldList(fields) {
|
|
1481
1500
|
const entries = Object.entries(fields).sort(([a], [b]) => a.localeCompare(b));
|
|
1482
1501
|
const maxKeyLen = Math.min(
|
|
@@ -1484,9 +1503,14 @@ function formatFieldList(fields) {
|
|
|
1484
1503
|
50
|
|
1485
1504
|
);
|
|
1486
1505
|
return entries.map(([key, value]) => {
|
|
1487
|
-
const
|
|
1488
|
-
|
|
1489
|
-
|
|
1506
|
+
const raw = stringifyValue(value);
|
|
1507
|
+
if (raw === "") return `${key.padEnd(maxKeyLen + 2)}(empty)`;
|
|
1508
|
+
if (typeof value === "string" && isHtml(value)) {
|
|
1509
|
+
const preview = formatRichValue(value);
|
|
1510
|
+
return `${key.padEnd(maxKeyLen + 2)}[rich text]
|
|
1511
|
+
${preview}`;
|
|
1512
|
+
}
|
|
1513
|
+
return `${key.padEnd(maxKeyLen + 2)}${raw}`;
|
|
1490
1514
|
}).join("\n");
|
|
1491
1515
|
}
|
|
1492
1516
|
function createListFieldsCommand() {
|