pipe-kan 0.23.2 → 0.23.3
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/dist/pipe-kan.js +47 -7
- package/package.json +1 -1
package/dist/pipe-kan.js
CHANGED
|
@@ -601,13 +601,53 @@ function createJiraCli(opts = {}) {
|
|
|
601
601
|
console.log("Refresh children skipped; no valid parent keys");
|
|
602
602
|
return "[]";
|
|
603
603
|
}
|
|
604
|
-
const
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
604
|
+
const CHUNK = 50;
|
|
605
|
+
const issues = [];
|
|
606
|
+
const seen = new Set;
|
|
607
|
+
let anyFailed = false;
|
|
608
|
+
function buildJql(chunkKeys, mode) {
|
|
609
|
+
const list = chunkKeys.map((key) => `"${key}"`).join(", ");
|
|
610
|
+
if (mode === "epic")
|
|
611
|
+
return `"Epic Link" in (${list})`;
|
|
612
|
+
if (mode === "parent")
|
|
613
|
+
return `parent in (${list})`;
|
|
614
|
+
return `(parent in (${list}) OR "Epic Link" in (${list}))`;
|
|
615
|
+
}
|
|
616
|
+
for (let i = 0;i < validKeys.length; i += CHUNK) {
|
|
617
|
+
const chunk = validKeys.slice(i, i + CHUNK);
|
|
618
|
+
const modes = ["or", "epic", "parent"];
|
|
619
|
+
let chunkIssues;
|
|
620
|
+
let lastError;
|
|
621
|
+
for (const mode of modes) {
|
|
622
|
+
try {
|
|
623
|
+
chunkIssues = JSON.parse(await listAll([
|
|
624
|
+
"issue",
|
|
625
|
+
"list",
|
|
626
|
+
"-q",
|
|
627
|
+
buildJql(chunk, mode)
|
|
628
|
+
]));
|
|
629
|
+
break;
|
|
630
|
+
} catch (err) {
|
|
631
|
+
lastError = err instanceof Error ? err.message : String(err);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
if (chunkIssues) {
|
|
635
|
+
for (const issue of chunkIssues) {
|
|
636
|
+
const key = issueKey(issue);
|
|
637
|
+
if (key && !seen.has(key)) {
|
|
638
|
+
seen.add(key);
|
|
639
|
+
issues.push(issue);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
} else {
|
|
643
|
+
anyFailed = true;
|
|
644
|
+
console.log(`Refresh children chunk ${i / CHUNK + 1} failed; ${lastError ?? "unknown error"}`);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
if (anyFailed && issues.length === 0) {
|
|
648
|
+
throw new Error("Epic children fetch failed for all batches");
|
|
649
|
+
}
|
|
650
|
+
return JSON.stringify(issues);
|
|
611
651
|
},
|
|
612
652
|
async move(key, status) {
|
|
613
653
|
const result = await runRetry(["issue", "move", key, status]);
|