@gitkraken/core-gitlens 0.7.1 → 0.8.0

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 (188) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/dist/git/cache.d.ts +18 -5
  3. package/dist/git/cache.js +26 -8
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/context.d.ts +5 -1
  6. package/dist/git/context.js.map +1 -1
  7. package/dist/git/errors.d.ts +28 -1
  8. package/dist/git/errors.js +45 -1
  9. package/dist/git/errors.js.map +1 -1
  10. package/dist/git/providers/branches.d.ts +5 -1
  11. package/dist/git/providers/commits.d.ts +24 -1
  12. package/dist/git/providers/config.d.ts +7 -1
  13. package/dist/git/providers/operations.d.ts +6 -0
  14. package/dist/git/providers/provider.d.ts +17 -0
  15. package/dist/git/providers/refs.d.ts +38 -3
  16. package/dist/git/providers/revision.d.ts +5 -1
  17. package/dist/git/providers/staging.d.ts +12 -0
  18. package/dist/git/providers/worktrees.d.ts +23 -3
  19. package/dist/git/run.types.d.ts +6 -0
  20. package/dist/git-cli/cliGitProvider.d.ts +17 -1
  21. package/dist/git-cli/cliGitProvider.js +37 -1
  22. package/dist/git-cli/cliGitProvider.js.map +1 -1
  23. package/dist/git-cli/exec/git.d.ts +12 -2
  24. package/dist/git-cli/exec/git.js +48 -17
  25. package/dist/git-cli/exec/git.js.map +1 -1
  26. package/dist/git-cli/exec/gitQueue.d.ts +4 -1
  27. package/dist/git-cli/exec/gitQueue.js +1 -1
  28. package/dist/git-cli/exec/gitQueue.js.map +1 -1
  29. package/dist/git-cli/providers/branches.d.ts +10 -1
  30. package/dist/git-cli/providers/branches.js +15 -8
  31. package/dist/git-cli/providers/branches.js.map +1 -1
  32. package/dist/git-cli/providers/commits.d.ts +23 -1
  33. package/dist/git-cli/providers/commits.js +57 -8
  34. package/dist/git-cli/providers/commits.js.map +1 -1
  35. package/dist/git-cli/providers/config.js +4 -3
  36. package/dist/git-cli/providers/config.js.map +1 -1
  37. package/dist/git-cli/providers/operations.d.ts +1 -0
  38. package/dist/git-cli/providers/operations.js +39 -3
  39. package/dist/git-cli/providers/operations.js.map +1 -1
  40. package/dist/git-cli/providers/patch.js +20 -41
  41. package/dist/git-cli/providers/patch.js.map +1 -1
  42. package/dist/git-cli/providers/pausedOperations.js +2 -2
  43. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  44. package/dist/git-cli/providers/refs.d.ts +15 -3
  45. package/dist/git-cli/providers/refs.js +115 -10
  46. package/dist/git-cli/providers/refs.js.map +1 -1
  47. package/dist/git-cli/providers/revision.d.ts +3 -1
  48. package/dist/git-cli/providers/revision.js +9 -5
  49. package/dist/git-cli/providers/revision.js.map +1 -1
  50. package/dist/git-cli/providers/staging.d.ts +8 -0
  51. package/dist/git-cli/providers/staging.js +59 -7
  52. package/dist/git-cli/providers/staging.js.map +1 -1
  53. package/dist/git-cli/providers/worktrees.d.ts +31 -2
  54. package/dist/git-cli/providers/worktrees.js +75 -7
  55. package/dist/git-cli/providers/worktrees.js.map +1 -1
  56. package/dist/ipc/discovery.js +1 -1
  57. package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
  58. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
  59. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
  60. package/dist/plus/git-github/api/github.d.ts +64 -3
  61. package/dist/plus/git-github/api/github.js +237 -24
  62. package/dist/plus/git-github/api/github.js.map +1 -1
  63. package/dist/plus/git-github/providers/github/branches.d.ts +3 -1
  64. package/dist/plus/git-github/providers/github/branches.js +2 -1
  65. package/dist/plus/git-github/providers/github/branches.js.map +1 -1
  66. package/dist/plus/git-github/providers/github/refs.d.ts +10 -3
  67. package/dist/plus/git-github/providers/github/refs.js +4 -4
  68. package/dist/plus/git-github/providers/github/refs.js.map +1 -1
  69. package/dist/plus/git-github/providers/github/revision.d.ts +3 -1
  70. package/dist/plus/git-github/providers/github/revision.js +1 -1
  71. package/dist/plus/git-github/providers/github/revision.js.map +1 -1
  72. package/dist/plus/integrations/collectionMetadata.d.ts +48 -3
  73. package/dist/plus/integrations/collectionMetadata.js +138 -8
  74. package/dist/plus/integrations/collectionMetadata.js.map +1 -1
  75. package/dist/plus/integrations/errors.d.ts +3 -1
  76. package/dist/plus/integrations/errors.js +7 -3
  77. package/dist/plus/integrations/errors.js.map +1 -1
  78. package/dist/plus/integrations/index.d.ts +6 -3
  79. package/dist/plus/integrations/index.js.map +1 -1
  80. package/dist/plus/integrations/integrationService.d.ts +36 -10
  81. package/dist/plus/integrations/integrationService.js +16 -3
  82. package/dist/plus/integrations/integrationService.js.map +1 -1
  83. package/dist/plus/integrations/manager.d.ts +107 -37
  84. package/dist/plus/integrations/models/gitHostIntegration.d.ts +129 -14
  85. package/dist/plus/integrations/models/gitHostIntegration.js +142 -18
  86. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  87. package/dist/plus/integrations/models/integration.d.ts +117 -11
  88. package/dist/plus/integrations/models/integration.js +175 -13
  89. package/dist/plus/integrations/models/integration.js.map +1 -1
  90. package/dist/plus/integrations/models/issuesIntegration.d.ts +18 -5
  91. package/dist/plus/integrations/models/issuesIntegration.js +42 -10
  92. package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
  93. package/dist/plus/integrations/providers/azure/azure.d.ts +1 -1
  94. package/dist/plus/integrations/providers/azure/azure.js +14 -18
  95. package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
  96. package/dist/plus/integrations/providers/azure/models.d.ts +29 -0
  97. package/dist/plus/integrations/providers/azure/models.js +112 -1
  98. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  99. package/dist/plus/integrations/providers/azureDevOps.d.ts +73 -3
  100. package/dist/plus/integrations/providers/azureDevOps.js +117 -3
  101. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  102. package/dist/plus/integrations/providers/azureDevOpsServer.js +2 -1
  103. package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
  104. package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +61 -0
  105. package/dist/plus/integrations/providers/bitbucket/bitbucket.js +165 -23
  106. package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
  107. package/dist/plus/integrations/providers/bitbucket/models.d.ts +6 -1
  108. package/dist/plus/integrations/providers/bitbucket/models.js +4 -3
  109. package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
  110. package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js +2 -2
  111. package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js.map +1 -1
  112. package/dist/plus/integrations/providers/bitbucket-server.d.ts +48 -2
  113. package/dist/plus/integrations/providers/bitbucket-server.js +51 -1
  114. package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
  115. package/dist/plus/integrations/providers/bitbucket.d.ts +45 -2
  116. package/dist/plus/integrations/providers/bitbucket.js +41 -2
  117. package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
  118. package/dist/plus/integrations/providers/github.d.ts +49 -5
  119. package/dist/plus/integrations/providers/github.js +102 -7
  120. package/dist/plus/integrations/providers/github.js.map +1 -1
  121. package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +35 -0
  122. package/dist/plus/integrations/providers/gitlab/gitlab.js +132 -15
  123. package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
  124. package/dist/plus/integrations/providers/gitlab/models.d.ts +1 -0
  125. package/dist/plus/integrations/providers/gitlab/models.js +1 -1
  126. package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
  127. package/dist/plus/integrations/providers/gitlab.d.ts +49 -2
  128. package/dist/plus/integrations/providers/gitlab.js +80 -4
  129. package/dist/plus/integrations/providers/gitlab.js.map +1 -1
  130. package/dist/plus/integrations/providers/jira-server.d.ts +3 -3
  131. package/dist/plus/integrations/providers/jira-server.js +5 -8
  132. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  133. package/dist/plus/integrations/providers/jira.d.ts +9 -0
  134. package/dist/plus/integrations/providers/jira.js +13 -1
  135. package/dist/plus/integrations/providers/jira.js.map +1 -1
  136. package/dist/plus/integrations/providers/linear.js +1 -1
  137. package/dist/plus/integrations/providers/models.d.ts +13 -2
  138. package/dist/plus/integrations/providers/models.js +11 -1
  139. package/dist/plus/integrations/providers/models.js.map +1 -1
  140. package/dist/plus/integrations/providers/providerErrors.d.ts +9 -1
  141. package/dist/plus/integrations/providers/providerErrors.js +10 -1
  142. package/dist/plus/integrations/providers/providerErrors.js.map +1 -1
  143. package/dist/plus/integrations/providers/providersApi.d.ts +60 -1
  144. package/dist/plus/integrations/providers/providersApi.js +137 -2
  145. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  146. package/dist/plus/integrations/providers/utils/providerPaging.d.ts +42 -0
  147. package/dist/plus/integrations/providers/utils/providerPaging.js +58 -1
  148. package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
  149. package/dist/plus/integrations/providers/utils.d.ts +1 -1
  150. package/dist/plus/integrations/reads/broaden.js +1 -1
  151. package/dist/plus/integrations/reads/context.d.ts +1 -1
  152. package/dist/plus/integrations/reads/counts.js +1 -1
  153. package/dist/plus/integrations/reads/currentAccount.d.ts +35 -0
  154. package/dist/plus/integrations/reads/currentAccount.js +46 -0
  155. package/dist/plus/integrations/reads/currentAccount.js.map +1 -0
  156. package/dist/plus/integrations/reads/drains.d.ts +5 -2
  157. package/dist/plus/integrations/reads/drains.js +8 -4
  158. package/dist/plus/integrations/reads/drains.js.map +1 -1
  159. package/dist/plus/integrations/reads/hierarchy.js +1 -1
  160. package/dist/plus/integrations/reads/hierarchy.utils.js +1 -1
  161. package/dist/plus/integrations/reads/issueBatch.d.ts +72 -12
  162. package/dist/plus/integrations/reads/issueBatch.js +193 -48
  163. package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
  164. package/dist/plus/integrations/reads/issueTracker.js +1 -1
  165. package/dist/plus/integrations/reads/issues.js +1 -1
  166. package/dist/plus/integrations/reads/pullRequestBatch.d.ts +57 -0
  167. package/dist/plus/integrations/reads/pullRequestBatch.js +80 -0
  168. package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -0
  169. package/dist/plus/integrations/reads/pullRequestBranches.d.ts +58 -0
  170. package/dist/plus/integrations/reads/pullRequestBranches.js +111 -0
  171. package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -0
  172. package/dist/plus/integrations/reads/pullRequests.js +3 -3
  173. package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
  174. package/dist/plus/integrations/reads/resolveRepository.js +1 -1
  175. package/dist/plus/integrations/reads/sweeps.js +4 -4
  176. package/dist/plus/integrations/reads/sweeps.js.map +1 -1
  177. package/dist/plus/integrations/results.d.ts +87 -6
  178. package/dist/plus/integrations/results.js +9 -2
  179. package/dist/plus/integrations/results.js.map +1 -1
  180. package/dist/utils/env/node/exec.js +3 -3
  181. package/dist/utils/env/node/exec.js.map +1 -1
  182. package/docs/integrations.md +175 -35
  183. package/docs/kepler-git-write-api-parity.md +239 -0
  184. package/docs/kepler-read-api-parity.md +75 -28
  185. package/package.json +1 -1
  186. package/dist/plus/integrations/reads/trackerIssue.d.ts +0 -33
  187. package/dist/plus/integrations/reads/trackerIssue.js +0 -60
  188. package/dist/plus/integrations/reads/trackerIssue.js.map +0 -1
@@ -7,9 +7,11 @@ import { ConfiguredIntegrationsChangeEvent } from "./authentication/configuredIn
7
7
  import { IssueFilter } from "./providerFilters.js";
8
8
  import { ConnectionStateChangeEvent, ProviderBroadenResult, ProviderOrganization, ProviderPagedResult, ProviderRepositoryShape, ProviderResult, ProviderSweepResult, ResolveRepositoryResult } from "./results.js";
9
9
  import { IssueCountResult, IssueCountScope, PullRequestCountResult, PullRequestCountScope } from "./reads/counts.js";
10
+ import { CurrentAccountResult } from "./reads/currentAccount.js";
10
11
  import { SupportedFilters } from "./reads/filters.js";
11
12
  import { IssueBatchResult, IssueBatchTarget } from "./reads/issueBatch.js";
12
- import { TrackerIssueResult } from "./reads/trackerIssue.js";
13
+ import { PullRequestBatchResult, PullRequestBatchTarget } from "./reads/pullRequestBatch.js";
14
+ import { PullRequestBranchResult, PullRequestBranchTarget } from "./reads/pullRequestBranches.js";
13
15
  //#region ../plus/integrations/src/manager.d.ts
14
16
  /** Neutral repository input accepted by repo-scoped provider reads. */
15
17
  export interface ProviderRepositoryInput {
@@ -594,66 +596,120 @@ export interface IntegrationManager {
594
596
  domain?: string;
595
597
  }): Promise<ProviderResult<IssueCountResult>>;
596
598
  /**
597
- * Resolves several issues BY COORDINATE — `(owner, repo, number)` — in one request.
599
+ * Resolves several issues BY IDENTITY in one call. Each target takes the form its provider addresses an issue
600
+ * by: a repository coordinate `(owner, repo, number)` on GitHub/GHE, GitLab and Azure DevOps (which also needs
601
+ * `project`, and ignores `repo`), or the tracker's own identifier within a resource `(resourceId, ABC-123)` on
602
+ * Jira and Linear. A call carrying the other form is refused whole.
598
603
  *
599
604
  * The read for "which issue does this branch name reference", which is an IDENTITY question rather than a
600
605
  * search. Emulating it by paging a scoped list and matching the identifier cannot prove absence without
601
606
  * walking the whole scope, so a miss stays unproven, uncacheable, and repeats its whole budget on every pass.
602
- * This answers it in one request per chunk, and a miss is final.
607
+ * Here a miss is final.
603
608
  *
604
609
  * Results are echoed under the caller's own `key`, so no positional matching is needed. Per-target isolation
605
- * is the rule: a chunk that fails upstream warns and drops only its own targets (with `fetchFailed` set) while
610
+ * is the rule: a read that fails upstream warns and drops only its own targets (with `fetchFailed` set) while
606
611
  * every other target still answers.
607
612
  *
608
613
  * `issue: undefined` means PROVEN ABSENT — the issue does not exist, or is not visible to this connection —
609
- * and is safe to cache. A target whose chunk failed is NOT returned at all, so the two are distinguishable;
610
- * caching a failure as an absence is exactly the bug this distinction prevents. GitHub/GHE only: a provider
611
- * that cannot batch refuses outright rather than degrading into N requests behind the caller's back.
614
+ * and is safe to cache. A target whose read failed is NOT returned at all, so the two are distinguishable;
615
+ * caching a failure as an absence is exactly the bug this distinction prevents. Uncached: the caller owns
616
+ * caching.
617
+ *
618
+ * GitHub/GHE resolve up to 25 coordinates per request. GitLab and Azure DevOps cost one request per target, with
619
+ * bounded concurrency; GitLab spends a second request to confirm a miss, and Azure DevOps trusts a miss only
620
+ * when its own error body says the work item or project does not exist. Jira (Cloud and Data Center) and Linear
621
+ * cost one request per target, so a key asked of several resources is one call; `resourceId` is trusted and the
622
+ * read does no resource discovery, and Jira Cloud also requires `resourceUrl`. Every other provider refuses
623
+ * outright — Bitbucket because it has no issues, Trello because its single-issue read can fall back to a capped
624
+ * board scan, which cannot prove an absence.
625
+ *
626
+ * A self-managed tracker (Jira Data Center) never falls back to the primary connection, unlike the paged reads:
627
+ * the call is refused unless `domain` names a host or `connectionId` a configured connection that has one, and
628
+ * every target's `resourceId` must name the host the read resolved to. Two self-hosted instances routinely issue
629
+ * the same keys, and a cached absence must name the host it was proven on.
612
630
  */
613
631
  getIssuesBatch(options: {
614
632
  providerId: IntegrationIds;
615
633
  /** Each `key` must be unique — a duplicate refuses the whole call, since keys identify results. */
616
634
  targets: readonly IssueBatchTarget[];
617
635
  connectionId?: string;
618
- /** Self-managed host domain fallback; see {@link ProviderSweepTarget.domain}. */
636
+ /**
637
+ * Self-managed host domain; see {@link ProviderSweepTarget.domain}. A fallback for a git host, but required
638
+ * for a self-managed tracker unless `connectionId` names a configured host — see above.
639
+ */
619
640
  domain?: string;
620
641
  }): Promise<ProviderResult<IssueBatchResult>>;
621
642
  /**
622
- * Resolves one issue-tracker issue by key within a resource — the tracker counterpart of
623
- * {@link getIssuesBatch}, which cannot serve one.
624
- *
625
- * `issue: undefined` is a proven absence and may be cached. A failed read returns no item and sets
626
- * `fetchFailed`. `resourceId` is required and trusted; Jira Cloud also requires the resource's site URL so the
627
- * result retains its browser link. The read performs no resource discovery.
643
+ * Resolves several pull requests BY COORDINATE — `(owner, repo, number)`, plus `project` on Azure DevOps — in
644
+ * any state (open, closed or merged). The pull-request twin of {@link getIssuesBatch}, answering the same
645
+ * identity question: "which pull request does this branch or link name".
628
646
  *
629
- * Jira (Cloud and Data Center) and Linear only. Trello refuses: its single-issue read falls back to a capped
630
- * board scan for a numeric identifier, so it cannot prove absence.
647
+ * Results are echoed under the caller's own `key`, so no positional matching is needed. Per-target isolation
648
+ * is the rule: a read that fails upstream warns and drops only its own targets (with `fetchFailed` set) while
649
+ * every other target still answers.
631
650
  *
632
- * Jira Data Center is addressed per host and, unlike the paged reads, this one never falls back to the primary
633
- * connection: it requires a `domain` or a `connectionId` with a configured host and refuses otherwise, since two
634
- * self-hosted instances routinely issue the same keys and a cached absence must name the host it was proven on.
651
+ * - `{ key, pullRequest }` — found, whatever its state.
652
+ * - `{ key }` with no `pullRequest` — PROVEN ABSENT: the host answered not-found for the pull request or its
653
+ * repository, or it is not visible to this connection. Safe to cache.
654
+ * - No item for a key, with `fetchFailed` and a warning — the read could not check (auth, rate limit, network,
655
+ * missing session, an unmappable response). Never treat that as absent: caching a failure as an absence is
656
+ * exactly the bug this distinction prevents.
657
+ *
658
+ * UNCACHED, and deliberately not routed through the integration's cached single pull request read: that
659
+ * cache's key carries no connection, and the GitLens host's by-id bucket never expires a miss, so a proven
660
+ * absence would become permanent there — and a consumer would hold a second cache, with a different lifetime,
661
+ * for the same answer. The caller owns caching.
662
+ *
663
+ * Request cost: GitHub/GHE resolve up to 25 targets per request (one aliased GraphQL document). Every other
664
+ * host costs one request per target, run with bounded concurrency; GitLab spends a second request to confirm a
665
+ * miss, and Azure DevOps one more per target (two for a fork) to fill clone URLs.
635
666
  */
636
- getTrackerIssue(options: {
667
+ getPullRequestsBatch(options: {
637
668
  providerId: IntegrationIds;
638
- /**
639
- * Provider resource ID for the Atlassian site or Linear workspace. For Jira Data Center it is the host, the
640
- * instance's single resource as `listOrgs` reports it, and must name the host the read resolves to.
641
- */
642
- resourceId: string;
643
- /**
644
- * Jira site URL from resource discovery. Required for Jira Cloud so the result retains a browser link; Jira
645
- * Data Center builds it from the connection's own base URL.
646
- */
647
- resourceUrl?: string;
648
- /** The provider's own key, e.g. `ABC-123`. Not a number. */
649
- key: string;
669
+ /** Each `key` must be unique — a duplicate refuses the whole call, since keys identify results. */
670
+ targets: readonly PullRequestBatchTarget[];
650
671
  connectionId?: string;
651
- /**
652
- * Self-managed tracker host; see {@link ProviderSweepTarget.domain}. Ignored for the cloud trackers. Required
653
- * for Jira Data Center unless `connectionId` names a configured host — see above.
654
- */
672
+ /** Self-managed host domain fallback; see {@link ProviderSweepTarget.domain}. */
673
+ domain?: string;
674
+ }): Promise<ProviderResult<PullRequestBatchResult>>;
675
+ /**
676
+ * Finds, for each branch, every pull request whose head is that branch — in any state (open, closed or merged),
677
+ * most recently updated first, up to 10 per branch. "Which pull requests does this branch have", answered
678
+ * without the user's relationship to them, so a teammate's pull request from the user's branch is found too,
679
+ * which the account-wide sweeps can't do.
680
+ *
681
+ * A target names the repository the pull requests are opened AGAINST, the head branch's short name, and, for a
682
+ * branch in a fork, `headOwner` (the base repository's own owner, or none, means the base repository). A pull
683
+ * request matches only when its head repository is the right one — the base repository itself, or the fork
684
+ * `headOwner` owns — so a `main` in the base repository never claims every fork's `main`. The match is on the
685
+ * head branch NAME, so a merged pull request whose branch was since deleted is still found.
686
+ *
687
+ * Same result contract as {@link getPullRequestsBatch}, echoed under the caller's own `key`:
688
+ * - `{ key, pullRequests: [...] }` — found. `truncated` means more may match than were returned.
689
+ * - `{ key, pullRequests: [] }` with no `truncated` — PROVEN NONE: the host answered and nothing matched, or the
690
+ * base repository doesn't exist or isn't visible to this connection. Safe to cache.
691
+ * - No item for a key, with `fetchFailed` and a warning — the read could not check. Never treat that as none.
692
+ *
693
+ * UNCACHED, and not routed through the integration's cached single pull request read for a branch (see
694
+ * `IntegrationCacheProvider.getPullRequestForBranch`), which answers one pull request and, on several hosts,
695
+ * looks the branch ref up and so answers "none" once a merged branch is deleted. The caller owns caching.
696
+ *
697
+ * Request cost: GitHub/GHE answer up to 25 targets per request (one aliased GraphQL document, fetching up to 10
698
+ * full pull requests per target). Every other host costs one request per target, run with bounded concurrency;
699
+ * GitLab and Azure DevOps then resolve each matched pull request — typically 0–1 per branch — through
700
+ * {@link getPullRequestsBatch}'s own read, at that read's cost, so their rows are exactly its rows. Rows carry
701
+ * the list reads' fields on GitHub/GHE and Bitbucket Data Center and Bitbucket Cloud's by-id read's on
702
+ * Bitbucket Cloud. A `headOwner` naming another owner is refused on Bitbucket Data Center and Azure DevOps,
703
+ * where a fork can't be found by its owner.
704
+ */
705
+ getPullRequestsForBranches(options: {
706
+ providerId: IntegrationIds;
707
+ /** Each `key` must be unique — a duplicate refuses the whole call, since keys identify results. */
708
+ targets: readonly PullRequestBranchTarget[];
709
+ connectionId?: string;
710
+ /** Self-managed host domain fallback; see {@link ProviderSweepTarget.domain}. */
655
711
  domain?: string;
656
- }): Promise<ProviderResult<TrackerIssueResult>>;
712
+ }): Promise<ProviderResult<PullRequestBranchResult>>;
657
713
  /**
658
714
  * How many pull requests match each scope — the PR twin of {@link countIssues}, behind a "this will fetch ~N pull
659
715
  * requests" preview and a live count next to an unapplied filter. Same per-scope isolation, `key`-echo, and
@@ -743,6 +799,20 @@ export interface IntegrationManager {
743
799
  */
744
800
  domain?: string;
745
801
  }): Promise<ResolveRepositoryResult>;
802
+ /**
803
+ * Who the connection is signed in as on a git host. `account` is never absent without a warning. Goes through
804
+ * the host-supplied `IntegrationManagerCacheProvider.getCurrentAccount` cache rather than adding a second one.
805
+ * Issue trackers refuse: they have only a per-resource account, not a per-connection one.
806
+ */
807
+ getCurrentAccount(options: {
808
+ providerId: IntegrationIds;
809
+ connectionId?: string;
810
+ /**
811
+ * Explicit self-managed host domain. Used only when the requested connection has no configured domain;
812
+ * it must come from the trusted authentication configuration, not repository or remote data.
813
+ */
814
+ domain?: string;
815
+ }): Promise<CurrentAccountResult>;
746
816
  }
747
817
  //#endregion
748
818
  //# sourceMappingURL=manager.d.ts.map
@@ -2,17 +2,17 @@ import { PagedResult } from "../../../utils/paging.js";
2
2
  import { ResourceDescriptor } from "../../../git/models/resourceDescriptor.js";
3
3
  import { IssueOrPullRequestState } from "../../../git/models/issueOrPullRequest.js";
4
4
  import { IssueSearchCriteria, IssueShape } from "../../../git/models/issue.js";
5
- import { PullRequest, PullRequestFilter, PullRequestMergeMethod, PullRequestSearchCriteria, PullRequestStackInfo, PullRequestStateFilter } from "../../../git/models/pullRequest.js";
5
+ import { PullRequest, PullRequestFilter, PullRequestMergeMethod, PullRequestSearchCriteria, PullRequestShape, PullRequestStackInfo, PullRequestStateFilter } from "../../../git/models/pullRequest.js";
6
6
  import { Account as Account$1, UnidentifiedAuthor } from "../../../git/models/author.js";
7
7
  import { DefaultBranch } from "../../../git/models/defaultBranch.js";
8
8
  import { RepositoryMetadata } from "../../../git/models/repositoryMetadata.js";
9
9
  import { PullRequestUrlIdentity } from "../../../git/utils/pullRequest.utils.js";
10
10
  import { ProviderAuthenticationSession } from "../authentication/models.js";
11
11
  import { IntegrationIds } from "../constants.js";
12
+ import { ProviderOrganization } from "../results.js";
12
13
  import { ProviderPullRequestCount, ProviderPullRequestSearchPage } from "./pullRequestReads.js";
13
14
  import { MyIssuesForReposOptions, ProviderIssueSearchPage, ProviderSearchCount } from "./issueReads.js";
14
- import { IntegrationBase, IntegrationResult, IntegrationType } from "./integration.js";
15
- import { ProviderOrganization } from "../results.js";
15
+ import { BatchSlot, IntegrationBase, IntegrationResult, IntegrationType } from "./integration.js";
16
16
  import { ProviderApiPagedResult, ProviderHierarchyResult, ProviderIssue, ProviderPullRequest, ProviderRepoInput, ProviderReposInput, ProviderRepository } from "../providers/models.js";
17
17
  import { CollectionMetadata } from "@gitkraken/provider-apis";
18
18
  //#region ../plus/integrations/src/models/gitHostIntegration.d.ts
@@ -392,8 +392,10 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
392
392
  criteria?: IssueSearchCriteria;
393
393
  }[], cancellation?: AbortSignal): Promise<ProviderSearchCount[] | undefined>;
394
394
  /**
395
- * Result-returning wrapper for the BATCH issue read: resolves several `(owner, repo, number)` coordinates in
396
- * one request. Recovers thrown errors into `{ error }` like the reads around it.
395
+ * Result-returning wrapper for the BATCH issue read: resolves several `(owner, repo, number)` coordinates, plus
396
+ * `project` on Azure DevOps, in ONE call to {@link getProviderIssuesBatch}. One settled slot per input
397
+ * coordinate: `fulfilled` with `undefined` means the issue does not exist or is not visible to this token;
398
+ * `rejected` means that target could not be checked, never that it is absent.
397
399
  *
398
400
  * Distinct from every search on this class, and deliberately so. A search answers "what matches"; this answers
399
401
  * "does this exact issue exist", which is the question a caller correlating a branch name to an issue is
@@ -402,26 +404,139 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
402
404
  * miss instead of re-walking for it forever.
403
405
  *
404
406
  * Results come back POSITIONALLY — one per input coordinate, in order — for the same reason
405
- * {@link countIssuesResult} does: a caller's key must never reach the provider query. `undefined` in a slot
406
- * means the issue does not exist or is not visible to this token, never that the read failed.
407
+ * {@link countIssuesResult} does: a caller's key must never reach the provider query.
408
+ *
409
+ * Failure isolation happens PER TARGET, mirroring {@link getPullRequestsBatchResult}: the whole call counts
410
+ * as a failure against the integration's request-exception budget only when EVERY slot rejected, and not even
411
+ * then when a credential that checks out was refused by each target's own scope (`settleBatchRefusals`).
412
+ * Server errors and timeouts on the targets show one notice however many hit one, and cost a strike only as
413
+ * part of that whole-call failure (`reportDeferredRequestFailures`), so a call never spends more than one.
407
414
  */
408
415
  getIssuesBatchResult(coordinates: readonly {
409
416
  owner: string;
410
417
  repo: string;
411
418
  number: number;
412
- }[], cancellation?: AbortSignal, connectionId?: string): Promise<IntegrationResult<(IssueShape | undefined)[] | undefined>>;
419
+ project?: string;
420
+ }[], cancellation?: AbortSignal, connectionId?: string): Promise<IntegrationResult<BatchSlot<IssueShape | undefined>[] | undefined>>;
413
421
  /**
414
- * OPTIONAL: only a provider that can resolve SEVERAL issues by coordinate in one request implements this.
415
- * GitHub aliases its point read into one document; the SDK exposes only a singular `getIssue` for every other
416
- * provider, and there is no plural variant to build on. A provider that can't answer doesn't implement it and
417
- * the facade refuses the read, so a caller keeps its own per-issue path rather than being handed a batch that
418
- * silently degraded into N requests.
422
+ * OPTIONAL: one settled slot per input coordinate, in order, in the same shape the list reads return for this
423
+ * provider. `fulfilled` with `undefined` is a PROVEN ABSENCE a caller may cache; `rejected` means that target
424
+ * could not be checked — never conflate the two, so a host implements this only where it can tell them apart.
425
+ *
426
+ * GitHub/GHE alias up to 25 coordinates into one document and so chunk internally; a chunk that throws rejects
427
+ * every slot in that chunk, not the ones in other chunks. GitLab and Azure DevOps read one issue per request and
428
+ * fan out with `mapSettledBounded`, so one target's failure rejects only its own slot. Bitbucket has no issues.
419
429
  */
420
430
  protected getProviderIssuesBatch?(session: ProviderAuthenticationSession, coordinates: readonly {
421
431
  owner: string;
422
432
  repo: string;
423
433
  number: number;
424
- }[], cancellation?: AbortSignal): Promise<(IssueShape | undefined)[] | undefined>;
434
+ project?: string;
435
+ }[], cancellation?: AbortSignal): Promise<PromiseSettledResult<IssueShape | undefined>[] | undefined>;
436
+ /**
437
+ * Result-returning wrapper for the BATCH pull request read: resolves several coordinates, in any state, BY
438
+ * IDENTITY, in ONE call to {@link getProviderPullRequestsBatch}. One settled slot per input coordinate:
439
+ * `fulfilled` with `undefined` means the pull request does not exist or is not visible to this token;
440
+ * `rejected` means that target could not be checked, never that it is absent.
441
+ *
442
+ * Failure isolation happens PER TARGET, not per call: a hook that reads one pull request per request (every
443
+ * host but GitHub/GHE) fans its coordinates out itself and settles each independently, so one bad target
444
+ * rejects only its own slot. Mirrors {@link getMyPullRequestsForReposResult}'s per-repo fan-out — the whole
445
+ * call counts as a failure against the integration's request-exception budget only when EVERY slot rejected,
446
+ * and not even then when a credential that checks out was refused by each target's own scope
447
+ * (`settleBatchRefusals`). Server errors and timeouts on the targets show one notice however many hit one, and
448
+ * cost a strike only as part of that whole-call failure (`reportDeferredRequestFailures`).
449
+ */
450
+ getPullRequestsBatchResult(coordinates: readonly {
451
+ owner: string;
452
+ repo: string;
453
+ number: number;
454
+ project?: string;
455
+ }[], options?: {
456
+ currentAccount?: {
457
+ id: string;
458
+ username?: string;
459
+ };
460
+ }, cancellation?: AbortSignal, connectionId?: string): Promise<IntegrationResult<BatchSlot<PullRequestShape | undefined>[] | undefined>>;
461
+ /**
462
+ * OPTIONAL: resolves several coordinates, returning one settled slot per input coordinate, in order, in the
463
+ * same shape the list reads return for this provider. `fulfilled` with `undefined` is a PROVEN ABSENCE a
464
+ * caller may cache; `rejected` means that target could not be checked — never conflate the two.
465
+ *
466
+ * A provider that reads one pull request per upstream request (every host but GitHub/GHE) fans its
467
+ * coordinates out with `mapSettledBounded`, so one target's failure rejects only its own slot instead of
468
+ * taking the whole call down. GitHub/GHE alias up to 25 coordinates into one document and so chunk
469
+ * internally; a chunk that throws rejects every slot in that chunk, not the ones in other chunks.
470
+ */
471
+ protected getProviderPullRequestsBatch?(session: ProviderAuthenticationSession, coordinates: readonly {
472
+ owner: string;
473
+ repo: string;
474
+ number: number;
475
+ project?: string;
476
+ }[], options: {
477
+ currentAccount?: {
478
+ id: string;
479
+ username?: string;
480
+ };
481
+ } | undefined, cancellation?: AbortSignal): Promise<PromiseSettledResult<PullRequestShape | undefined>[] | undefined>;
482
+ /**
483
+ * Result-returning wrapper for the pull-requests-by-branch read: for each target, every pull request whose head
484
+ * is that branch, in any state, in ONE call to {@link getProviderPullRequestsForBranches}. One settled slot
485
+ * per target: `fulfilled` with an empty list means the host answered and nothing matched; `rejected` means
486
+ * that target could not be checked, never that it has no pull requests.
487
+ *
488
+ * Uncached, and deliberately not built on {@link getPullRequestForBranch}: that read caches through
489
+ * `IntegrationCacheProvider.getPullRequestForBranch`, answers one pull request, and on several hosts looks the
490
+ * branch ref up, which answers "none" once a merged pull request's branch is deleted.
491
+ *
492
+ * Failure isolation is per target, as in {@link getPullRequestsBatchResult}: the whole call counts against the
493
+ * request-exception budget only when EVERY slot rejected, and not when each target's own scope refused a
494
+ * credential that checks out. Server errors and timeouts on the targets show one notice however many hit one, and
495
+ * cost a strike only as part of that whole-call failure.
496
+ */
497
+ getPullRequestsForBranchesResult(targets: readonly {
498
+ owner: string;
499
+ repo: string;
500
+ project?: string;
501
+ branch: string;
502
+ headOwner?: string;
503
+ }[], options: {
504
+ currentAccount?: {
505
+ id: string;
506
+ username?: string;
507
+ };
508
+ limit: number;
509
+ }, cancellation?: AbortSignal, connectionId?: string): Promise<IntegrationResult<BatchSlot<{
510
+ pullRequests: PullRequestShape[];
511
+ truncated: boolean;
512
+ }>[] | undefined>>;
513
+ /**
514
+ * OPTIONAL: one settled slot per target, in order. A fulfilled slot lists the matching pull requests, newest
515
+ * first and at most `options.limit` of them, in the same shape the list reads return for this provider where
516
+ * the host allows it; `truncated` means more may match than were returned.
517
+ *
518
+ * A row matches only when its head branch is the target's `branch` AND its head repository is the base
519
+ * repository itself (`headOwner` omitted) or the fork `headOwner` owns — a same-named branch in some other
520
+ * fork is a different branch. A host that reads one target per request fans out with `mapSettledBounded`, so
521
+ * one target's failure rejects only its own slot; GitHub/GHE alias up to 25 targets per request, and a request
522
+ * that throws rejects only its own targets.
523
+ */
524
+ protected getProviderPullRequestsForBranches?(session: ProviderAuthenticationSession, targets: readonly {
525
+ owner: string;
526
+ repo: string;
527
+ project?: string;
528
+ branch: string;
529
+ headOwner?: string;
530
+ }[], options: {
531
+ currentAccount?: {
532
+ id: string;
533
+ username?: string;
534
+ };
535
+ limit: number;
536
+ }, cancellation?: AbortSignal): Promise<PromiseSettledResult<{
537
+ pullRequests: PullRequestShape[];
538
+ truncated: boolean;
539
+ }>[] | undefined>;
425
540
  /**
426
541
  * The PR twin of {@link countIssuesResult}: counts each scope's pull requests, transferring none where the
427
542
  * provider has a count query. Each slot is a {@link ProviderPullRequestCount}, so a provider that can only count