@bragduck/cli 2.9.2 → 2.9.5

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.
@@ -3424,18 +3424,36 @@ var JiraService = class {
3424
3424
  const maxResults = 100;
3425
3425
  while (true) {
3426
3426
  const endpoint = `/rest/api/2/search?jql=${encodeURIComponent(jql)}&startAt=${startAt}&maxResults=${maxResults}&fields=${fields.join(",")}`;
3427
- const response = await this.request(endpoint);
3428
- allIssues.push(...response.issues);
3429
- logger.debug(
3430
- `Fetched ${response.issues.length} issues (total: ${allIssues.length} of ${response.total})${startAt + maxResults < response.total ? ", fetching next page..." : ""}`
3431
- );
3432
- if (startAt + maxResults >= response.total) {
3433
- break;
3434
- }
3435
- if (options.limit && allIssues.length >= options.limit) {
3436
- return allIssues.slice(0, options.limit).map((issue) => this.transformIssueToCommit(issue));
3427
+ try {
3428
+ const response = await this.request(endpoint);
3429
+ allIssues.push(...response.issues);
3430
+ logger.debug(
3431
+ `Fetched ${response.issues.length} issues (total: ${allIssues.length} of ${response.total})${startAt + maxResults < response.total ? ", fetching next page..." : ""}`
3432
+ );
3433
+ if (startAt + maxResults >= response.total) {
3434
+ break;
3435
+ }
3436
+ if (options.limit && allIssues.length >= options.limit) {
3437
+ return allIssues.slice(0, options.limit).map((issue) => this.transformIssueToCommit(issue));
3438
+ }
3439
+ startAt += maxResults;
3440
+ } catch (error) {
3441
+ if (error instanceof JiraError && error.message.includes("no longer available")) {
3442
+ logger.warning(`Skipping unavailable Jira resource: ${error.message}`);
3443
+ if (allIssues.length > 0) {
3444
+ logger.info(
3445
+ `Returning ${allIssues.length} available issues (some resources were unavailable)`
3446
+ );
3447
+ break;
3448
+ }
3449
+ if (startAt === 0) {
3450
+ throw error;
3451
+ }
3452
+ startAt += maxResults;
3453
+ continue;
3454
+ }
3455
+ throw error;
3437
3456
  }
3438
- startAt += maxResults;
3439
3457
  }
3440
3458
  return allIssues.map((issue) => this.transformIssueToCommit(issue));
3441
3459
  }
@@ -3693,18 +3711,36 @@ var ConfluenceService = class {
3693
3711
  }
3694
3712
  const queryString = Object.entries(params).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
3695
3713
  const endpoint = `/wiki/rest/api/content?${queryString}`;
3696
- const response = await this.request(endpoint);
3697
- allPages.push(...response.results);
3698
- logger.debug(
3699
- `Fetched ${response.results.length} pages (total: ${allPages.length})${response.results.length === limit ? ", fetching next page..." : ""}`
3700
- );
3701
- if (response.results.length < limit) {
3702
- break;
3703
- }
3704
- if (options.limit && allPages.length >= options.limit) {
3705
- return allPages.slice(0, options.limit).map((page) => this.transformPageToCommit(page));
3714
+ try {
3715
+ const response = await this.request(endpoint);
3716
+ allPages.push(...response.results);
3717
+ logger.debug(
3718
+ `Fetched ${response.size} pages (total: ${allPages.length})${response.size === limit ? ", fetching next page..." : ""}`
3719
+ );
3720
+ if (response.size === 0 || response.size < limit) {
3721
+ break;
3722
+ }
3723
+ if (options.limit && allPages.length >= options.limit) {
3724
+ return allPages.slice(0, options.limit).map((page) => this.transformPageToCommit(page));
3725
+ }
3726
+ start += limit;
3727
+ } catch (error) {
3728
+ if (error instanceof ConfluenceError && error.message.includes("no longer available")) {
3729
+ logger.warning(`Skipping unavailable Confluence resource: ${error.message}`);
3730
+ if (allPages.length > 0) {
3731
+ logger.info(
3732
+ `Returning ${allPages.length} available pages (some resources were unavailable)`
3733
+ );
3734
+ break;
3735
+ }
3736
+ if (start === 0) {
3737
+ throw error;
3738
+ }
3739
+ start += limit;
3740
+ continue;
3741
+ }
3742
+ throw error;
3706
3743
  }
3707
- start += limit;
3708
3744
  }
3709
3745
  return allPages.map((page) => this.transformPageToCommit(page));
3710
3746
  }
@@ -4620,7 +4656,7 @@ async function syncAllAuthenticatedServices(options) {
4620
4656
  } catch (error) {
4621
4657
  const err = error;
4622
4658
  logger.log("");
4623
- logger.warn(`Failed to sync ${serviceLabel}: ${err.message}`);
4659
+ logger.warning(`Failed to sync ${serviceLabel}: ${err.message}`);
4624
4660
  logger.log("");
4625
4661
  results.push({ service, created: 0, skipped: 0, error: err.message });
4626
4662
  }