azdo-cli 0.2.0-develop.93 → 0.2.0-develop.94

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -55,12 +55,18 @@ async function readResponseMessage(response) {
55
55
  function normalizeFieldList(fields) {
56
56
  return Array.from(new Set(fields.map((f) => f.trim()).filter((f) => f.length > 0)));
57
57
  }
58
+ function stringifyFieldValue(value) {
59
+ if (typeof value === "object" && value !== null) {
60
+ return JSON.stringify(value);
61
+ }
62
+ return String(value);
63
+ }
58
64
  function buildExtraFields(fields, requested) {
59
65
  const result = {};
60
66
  for (const name of requested) {
61
67
  const val = fields[name];
62
68
  if (val !== void 0 && val !== null) {
63
- result[name] = typeof val === "object" ? JSON.stringify(val) : String(val);
69
+ result[name] = stringifyFieldValue(val);
64
70
  }
65
71
  }
66
72
  return Object.keys(result).length > 0 ? result : null;
@@ -158,13 +164,13 @@ async function getWorkItemFieldValue(context, id, pat, fieldName) {
158
164
  if (value === void 0 || value === null || value === "") {
159
165
  return null;
160
166
  }
161
- return typeof value === "object" ? JSON.stringify(value) : `${value}`;
167
+ return stringifyFieldValue(value);
162
168
  }
163
169
  async function updateWorkItem(context, id, pat, fieldName, operations) {
164
170
  const result = await applyWorkItemPatch(context, id, pat, operations);
165
171
  const title = result.fields["System.Title"];
166
- const lastOp = operations[operations.length - 1];
167
- const fieldValue = lastOp.value ?? null;
172
+ const lastOp = operations.at(-1);
173
+ const fieldValue = lastOp?.value ?? null;
168
174
  return {
169
175
  id: result.id,
170
176
  rev: result.rev,
@@ -664,8 +670,7 @@ function formatWorkItem(workItem, short, markdown = false) {
664
670
  if (short) {
665
671
  lines.push(...summarizeDescription(descriptionText, label));
666
672
  } else {
667
- lines.push("Description:");
668
- lines.push(descriptionText);
673
+ lines.push("Description:", descriptionText);
669
674
  }
670
675
  return lines.join("\n");
671
676
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azdo-cli",
3
- "version": "0.2.0-develop.93",
3
+ "version": "0.2.0-develop.94",
4
4
  "description": "Azure DevOps CLI tool",
5
5
  "type": "module",
6
6
  "bin": {