@bragduck/cli 2.9.5 → 2.9.7
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/bin/bragduck.js +62 -6
- package/dist/bin/bragduck.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/bragduck.js
CHANGED
|
@@ -3420,16 +3420,41 @@ var JiraService = class {
|
|
|
3420
3420
|
"issuetype"
|
|
3421
3421
|
];
|
|
3422
3422
|
const allIssues = [];
|
|
3423
|
+
const seenIssueKeys = /* @__PURE__ */ new Set();
|
|
3423
3424
|
let startAt = 0;
|
|
3424
3425
|
const maxResults = 100;
|
|
3426
|
+
const maxIterations = 1e3;
|
|
3427
|
+
let iterations = 0;
|
|
3425
3428
|
while (true) {
|
|
3429
|
+
iterations++;
|
|
3430
|
+
if (iterations > maxIterations) {
|
|
3431
|
+
logger.warning(
|
|
3432
|
+
`Reached maximum iteration limit (${maxIterations}). Stopping pagination to prevent infinite loop.`
|
|
3433
|
+
);
|
|
3434
|
+
break;
|
|
3435
|
+
}
|
|
3426
3436
|
const endpoint = `/rest/api/2/search?jql=${encodeURIComponent(jql)}&startAt=${startAt}&maxResults=${maxResults}&fields=${fields.join(",")}`;
|
|
3427
3437
|
try {
|
|
3428
3438
|
const response = await this.request(endpoint);
|
|
3429
|
-
|
|
3439
|
+
if (response.issues.length === 0) {
|
|
3440
|
+
logger.debug("No more results returned, stopping pagination");
|
|
3441
|
+
break;
|
|
3442
|
+
}
|
|
3443
|
+
let newIssuesCount = 0;
|
|
3444
|
+
for (const issue of response.issues) {
|
|
3445
|
+
if (!seenIssueKeys.has(issue.key)) {
|
|
3446
|
+
seenIssueKeys.add(issue.key);
|
|
3447
|
+
allIssues.push(issue);
|
|
3448
|
+
newIssuesCount++;
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3430
3451
|
logger.debug(
|
|
3431
|
-
`Fetched ${
|
|
3452
|
+
`Fetched ${newIssuesCount} new issues (total: ${allIssues.length} of ${response.total})${startAt + maxResults < response.total ? ", fetching next page..." : ""}`
|
|
3432
3453
|
);
|
|
3454
|
+
if (newIssuesCount === 0) {
|
|
3455
|
+
logger.debug("All results are duplicates, stopping pagination");
|
|
3456
|
+
break;
|
|
3457
|
+
}
|
|
3433
3458
|
if (startAt + maxResults >= response.total) {
|
|
3434
3459
|
break;
|
|
3435
3460
|
}
|
|
@@ -3447,7 +3472,10 @@ var JiraService = class {
|
|
|
3447
3472
|
break;
|
|
3448
3473
|
}
|
|
3449
3474
|
if (startAt === 0) {
|
|
3450
|
-
|
|
3475
|
+
logger.warning(
|
|
3476
|
+
"No accessible issues found. Some resources may be deleted, archived, or you may not have permission to view them."
|
|
3477
|
+
);
|
|
3478
|
+
return [];
|
|
3451
3479
|
}
|
|
3452
3480
|
startAt += maxResults;
|
|
3453
3481
|
continue;
|
|
@@ -3696,9 +3724,19 @@ var ConfluenceService = class {
|
|
|
3696
3724
|
async getPages(options = {}) {
|
|
3697
3725
|
const cql = this.buildCQL(options);
|
|
3698
3726
|
const allPages = [];
|
|
3727
|
+
const seenPageIds = /* @__PURE__ */ new Set();
|
|
3699
3728
|
let start = 0;
|
|
3700
3729
|
const limit = 100;
|
|
3730
|
+
const maxIterations = 1e3;
|
|
3731
|
+
let iterations = 0;
|
|
3701
3732
|
while (true) {
|
|
3733
|
+
iterations++;
|
|
3734
|
+
if (iterations > maxIterations) {
|
|
3735
|
+
logger.warning(
|
|
3736
|
+
`Reached maximum iteration limit (${maxIterations}). Stopping pagination to prevent infinite loop.`
|
|
3737
|
+
);
|
|
3738
|
+
break;
|
|
3739
|
+
}
|
|
3702
3740
|
const params = {
|
|
3703
3741
|
type: "page",
|
|
3704
3742
|
status: "current",
|
|
@@ -3713,10 +3751,25 @@ var ConfluenceService = class {
|
|
|
3713
3751
|
const endpoint = `/wiki/rest/api/content?${queryString}`;
|
|
3714
3752
|
try {
|
|
3715
3753
|
const response = await this.request(endpoint);
|
|
3716
|
-
|
|
3754
|
+
if (response.results.length === 0) {
|
|
3755
|
+
logger.debug("No more results returned, stopping pagination");
|
|
3756
|
+
break;
|
|
3757
|
+
}
|
|
3758
|
+
let newPagesCount = 0;
|
|
3759
|
+
for (const page of response.results) {
|
|
3760
|
+
if (!seenPageIds.has(page.id)) {
|
|
3761
|
+
seenPageIds.add(page.id);
|
|
3762
|
+
allPages.push(page);
|
|
3763
|
+
newPagesCount++;
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3717
3766
|
logger.debug(
|
|
3718
|
-
`Fetched ${
|
|
3767
|
+
`Fetched ${newPagesCount} new pages (total: ${allPages.length}, duplicates: ${response.results.length - newPagesCount})${response.size === limit ? ", fetching next page..." : ""}`
|
|
3719
3768
|
);
|
|
3769
|
+
if (newPagesCount === 0) {
|
|
3770
|
+
logger.debug("All results are duplicates, stopping pagination");
|
|
3771
|
+
break;
|
|
3772
|
+
}
|
|
3720
3773
|
if (response.size === 0 || response.size < limit) {
|
|
3721
3774
|
break;
|
|
3722
3775
|
}
|
|
@@ -3734,7 +3787,10 @@ var ConfluenceService = class {
|
|
|
3734
3787
|
break;
|
|
3735
3788
|
}
|
|
3736
3789
|
if (start === 0) {
|
|
3737
|
-
|
|
3790
|
+
logger.warning(
|
|
3791
|
+
"No accessible pages found. Some resources may be deleted, archived, or you may not have permission to view them."
|
|
3792
|
+
);
|
|
3793
|
+
return [];
|
|
3738
3794
|
}
|
|
3739
3795
|
start += limit;
|
|
3740
3796
|
continue;
|