@gitkraken/core-gitlens 0.45.0 → 0.46.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 (235) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/dist/git/models/remote.js +2 -2
  3. package/dist/git/models/remote.js.map +1 -1
  4. package/dist/git/remotes/matcher.js +25 -3
  5. package/dist/git/remotes/matcher.js.map +1 -1
  6. package/dist/git/utils/branchLanded.utils.d.ts +7 -0
  7. package/dist/git/utils/branchLanded.utils.js +10 -1
  8. package/dist/git/utils/branchLanded.utils.js.map +1 -1
  9. package/dist/git/utils/remote.utils.d.ts +1 -0
  10. package/dist/git/utils/remote.utils.js +14 -5
  11. package/dist/git/utils/remote.utils.js.map +1 -1
  12. package/dist/git-cli/parsers/logParser.js +227 -468
  13. package/dist/git-cli/parsers/logParser.js.map +1 -1
  14. package/dist/git-cli/parsers/refParser.js +4 -4
  15. package/dist/git-cli/parsers/refParser.js.map +1 -1
  16. package/dist/git-cli/providers/branches.d.ts +5 -0
  17. package/dist/git-cli/providers/branches.js +25 -21
  18. package/dist/git-cli/providers/branches.js.map +1 -1
  19. package/dist/plus/git-github/api/github.d.ts +6 -1
  20. package/dist/plus/git-github/api/github.js +14 -4
  21. package/dist/plus/git-github/api/github.js.map +1 -1
  22. package/dist/plus/git-github/api/issueWrites.d.ts +6 -1
  23. package/dist/plus/git-github/api/issueWrites.js +61 -31
  24. package/dist/plus/git-github/api/issueWrites.js.map +1 -1
  25. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.d.ts +44 -0
  26. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js +199 -0
  27. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js.map +1 -0
  28. package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +7 -0
  29. package/dist/plus/integrations/authentication/configuredIntegrationService.js +53 -7
  30. package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
  31. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +2 -38
  32. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +0 -199
  33. package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +4 -2
  34. package/dist/plus/integrations/authentication/integrationAuthenticationService.js +12 -1
  35. package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
  36. package/dist/plus/integrations/authentication/models.d.ts +0 -1
  37. package/dist/plus/integrations/authentication/models.js +1 -2
  38. package/dist/plus/integrations/authentication/models.js.map +1 -1
  39. package/dist/plus/integrations/constants.d.ts +0 -10
  40. package/dist/plus/integrations/constants.js +1 -95
  41. package/dist/plus/integrations/constants.js.map +1 -1
  42. package/dist/plus/integrations/context.d.ts +13 -13
  43. package/dist/plus/integrations/index.d.ts +39 -24
  44. package/dist/plus/integrations/index.js +40 -8
  45. package/dist/plus/integrations/index.js.map +1 -1
  46. package/dist/plus/integrations/integrationService.d.ts +15 -22
  47. package/dist/plus/integrations/integrationService.js +39 -12
  48. package/dist/plus/integrations/integrationService.js.map +1 -1
  49. package/dist/plus/integrations/lite.js +1 -1
  50. package/dist/plus/integrations/lite.js.map +1 -1
  51. package/dist/plus/integrations/manager.d.ts +65 -17
  52. package/dist/plus/integrations/models/actionablePullRequest.d.ts +213 -0
  53. package/dist/plus/integrations/models/actionablePullRequest.js +25 -0
  54. package/dist/plus/integrations/models/actionablePullRequest.js.map +1 -0
  55. package/dist/plus/integrations/models/gitHostIntegration.d.ts +13 -46
  56. package/dist/plus/integrations/models/gitHostIntegration.js +15 -4
  57. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  58. package/dist/plus/integrations/models/integration.d.ts +10 -175
  59. package/dist/plus/integrations/models/integration.js +11 -72
  60. package/dist/plus/integrations/models/integration.js.map +1 -1
  61. package/dist/plus/integrations/models/issuesIntegration.d.ts +9 -5
  62. package/dist/plus/integrations/models/issuesIntegration.js +5 -3
  63. package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
  64. package/dist/plus/integrations/models/publicIntegration.d.ts +252 -0
  65. package/dist/plus/integrations/models/publicIntegration.js +21 -0
  66. package/dist/plus/integrations/models/publicIntegration.js.map +1 -0
  67. package/dist/plus/integrations/providerFilters.d.ts +58 -0
  68. package/dist/plus/integrations/providerFilters.js.map +1 -1
  69. package/dist/plus/integrations/providers/actionablePullRequests.d.ts +19 -0
  70. package/dist/plus/integrations/providers/actionablePullRequests.js +32 -0
  71. package/dist/plus/integrations/providers/actionablePullRequests.js.map +1 -0
  72. package/dist/plus/integrations/providers/apiClients.d.ts +1 -2
  73. package/dist/plus/integrations/providers/apiClients.js.map +1 -1
  74. package/dist/plus/integrations/providers/asana.d.ts +3 -2
  75. package/dist/plus/integrations/providers/asana.js +2 -1
  76. package/dist/plus/integrations/providers/asana.js.map +1 -1
  77. package/dist/plus/integrations/providers/azure/azure.d.ts +1 -1
  78. package/dist/plus/integrations/providers/azure/azure.utils.d.ts +10 -3
  79. package/dist/plus/integrations/providers/azure/azure.utils.js +5 -1
  80. package/dist/plus/integrations/providers/azure/azure.utils.js.map +1 -1
  81. package/dist/plus/integrations/providers/azure/models.d.ts +1 -5
  82. package/dist/plus/integrations/providers/azure/models.js +1 -1
  83. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  84. package/dist/plus/integrations/providers/azureDevOps.d.ts +8 -5
  85. package/dist/plus/integrations/providers/azureDevOps.js +2 -1
  86. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  87. package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +5 -4
  88. package/dist/plus/integrations/providers/azureDevOpsServer.js +3 -1
  89. package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
  90. package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +2 -2
  91. package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
  92. package/dist/plus/integrations/providers/bitbucket/models.d.ts +1 -1
  93. package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
  94. package/dist/plus/integrations/providers/bitbucket-server.d.ts +5 -4
  95. package/dist/plus/integrations/providers/bitbucket-server.js +2 -1
  96. package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
  97. package/dist/plus/integrations/providers/bitbucket.d.ts +4 -3
  98. package/dist/plus/integrations/providers/bitbucket.js +2 -1
  99. package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
  100. package/dist/plus/integrations/providers/github/github.d.ts +0 -1
  101. package/dist/plus/integrations/providers/github/github.js +1 -1
  102. package/dist/plus/integrations/providers/github/github.js.map +1 -1
  103. package/dist/plus/integrations/providers/github.d.ts +11 -6
  104. package/dist/plus/integrations/providers/github.js +70 -26
  105. package/dist/plus/integrations/providers/github.js.map +1 -1
  106. package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +2 -2
  107. package/dist/plus/integrations/providers/gitlab/gitlab.js +1 -2
  108. package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
  109. package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts +14 -1
  110. package/dist/plus/integrations/providers/gitlab/gitlab.utils.js.map +1 -1
  111. package/dist/plus/integrations/providers/gitlab/models.d.ts +2 -10
  112. package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
  113. package/dist/plus/integrations/providers/gitlab.d.ts +7 -5
  114. package/dist/plus/integrations/providers/gitlab.js +2 -1
  115. package/dist/plus/integrations/providers/gitlab.js.map +1 -1
  116. package/dist/plus/integrations/providers/jira-server.d.ts +4 -4
  117. package/dist/plus/integrations/providers/jira-server.js +3 -2
  118. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  119. package/dist/plus/integrations/providers/jira.d.ts +3 -3
  120. package/dist/plus/integrations/providers/jira.js +3 -2
  121. package/dist/plus/integrations/providers/jira.js.map +1 -1
  122. package/dist/plus/integrations/providers/jiraIssueByKey.d.ts +1 -1
  123. package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
  124. package/dist/plus/integrations/providers/linear.d.ts +4 -3
  125. package/dist/plus/integrations/providers/linear.js +3 -2
  126. package/dist/plus/integrations/providers/linear.js.map +1 -1
  127. package/dist/plus/integrations/providers/linearIssuesEtag.d.ts +1 -1
  128. package/dist/plus/integrations/providers/linearIssuesEtag.js +1 -1
  129. package/dist/plus/integrations/providers/linearIssuesEtag.js.map +1 -1
  130. package/dist/plus/integrations/providers/metadata.d.ts +136 -0
  131. package/dist/plus/integrations/providers/metadata.js +513 -0
  132. package/dist/plus/integrations/providers/metadata.js.map +1 -0
  133. package/dist/plus/integrations/providers/models.d.ts +10 -206
  134. package/dist/plus/integrations/providers/models.js +8 -539
  135. package/dist/plus/integrations/providers/models.js.map +1 -1
  136. package/dist/plus/integrations/providers/providersApi.d.ts +3 -2
  137. package/dist/plus/integrations/providers/providersApi.js +2 -1
  138. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  139. package/dist/plus/integrations/providers/trello.d.ts +1 -1
  140. package/dist/plus/integrations/providers/trello.js +2 -1
  141. package/dist/plus/integrations/providers/trello.js.map +1 -1
  142. package/dist/plus/integrations/providers/utils/providerPaging.d.ts +2 -0
  143. package/dist/plus/integrations/providers/utils/providerPaging.js +3 -2
  144. package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
  145. package/dist/plus/integrations/providers/utils.d.ts +119 -10
  146. package/dist/plus/integrations/providers/utils.js +57 -3
  147. package/dist/plus/integrations/providers/utils.js.map +1 -1
  148. package/dist/plus/integrations/reads/autolinks.d.ts +1 -1
  149. package/dist/plus/integrations/reads/autolinks.js +1 -1
  150. package/dist/plus/integrations/reads/autolinks.js.map +1 -1
  151. package/dist/plus/integrations/reads/broaden.d.ts +1 -1
  152. package/dist/plus/integrations/reads/broaden.js +3 -2
  153. package/dist/plus/integrations/reads/broaden.js.map +1 -1
  154. package/dist/plus/integrations/reads/context.d.ts +1 -1
  155. package/dist/plus/integrations/reads/counts.d.ts +1 -88
  156. package/dist/plus/integrations/reads/counts.js +4 -2
  157. package/dist/plus/integrations/reads/counts.js.map +1 -1
  158. package/dist/plus/integrations/reads/currentAccount.d.ts +1 -18
  159. package/dist/plus/integrations/reads/currentAccount.js.map +1 -1
  160. package/dist/plus/integrations/reads/drains.d.ts +3 -3
  161. package/dist/plus/integrations/reads/drains.js +1 -1
  162. package/dist/plus/integrations/reads/drains.js.map +1 -1
  163. package/dist/plus/integrations/reads/etag.d.ts +174 -3
  164. package/dist/plus/integrations/reads/etag.js +69 -14
  165. package/dist/plus/integrations/reads/etag.js.map +1 -1
  166. package/dist/plus/integrations/reads/filters.d.ts +3 -61
  167. package/dist/plus/integrations/reads/filters.js +1 -1
  168. package/dist/plus/integrations/reads/filters.js.map +1 -1
  169. package/dist/plus/integrations/reads/hierarchy.d.ts +1 -1
  170. package/dist/plus/integrations/reads/hierarchy.js +4 -2
  171. package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
  172. package/dist/plus/integrations/reads/issueBatch.d.ts +2 -102
  173. package/dist/plus/integrations/reads/issueBatch.js +3 -4
  174. package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
  175. package/dist/plus/integrations/reads/issueTracker.d.ts +1 -1
  176. package/dist/plus/integrations/reads/issueTracker.js +4 -3
  177. package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
  178. package/dist/plus/integrations/reads/issues.d.ts +1 -1
  179. package/dist/plus/integrations/reads/issues.js +4 -2
  180. package/dist/plus/integrations/reads/issues.js.map +1 -1
  181. package/dist/plus/integrations/reads/paging.d.ts +1 -1
  182. package/dist/plus/integrations/reads/paging.js +1 -1
  183. package/dist/plus/integrations/reads/paging.js.map +1 -1
  184. package/dist/plus/integrations/reads/pullRequestActivity.d.ts +1 -24
  185. package/dist/plus/integrations/reads/pullRequestActivity.js +2 -1
  186. package/dist/plus/integrations/reads/pullRequestActivity.js.map +1 -1
  187. package/dist/plus/integrations/reads/pullRequestBatch.d.ts +2 -56
  188. package/dist/plus/integrations/reads/pullRequestBatch.js +23 -3
  189. package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
  190. package/dist/plus/integrations/reads/pullRequestBranches.d.ts +1 -47
  191. package/dist/plus/integrations/reads/pullRequestBranches.js +2 -1
  192. package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
  193. package/dist/plus/integrations/reads/pullRequestCheckLogs.d.ts +1 -15
  194. package/dist/plus/integrations/reads/pullRequestCheckLogs.js +2 -1
  195. package/dist/plus/integrations/reads/pullRequestCheckLogs.js.map +1 -1
  196. package/dist/plus/integrations/reads/pullRequests.js +4 -2
  197. package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
  198. package/dist/plus/integrations/reads/pullRequestsForCommits.d.ts +1 -16
  199. package/dist/plus/integrations/reads/pullRequestsForCommits.js +2 -1
  200. package/dist/plus/integrations/reads/pullRequestsForCommits.js.map +1 -1
  201. package/dist/plus/integrations/reads/resolveRepository.js +10 -5
  202. package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
  203. package/dist/plus/integrations/reads/searchIssues.js +2 -1
  204. package/dist/plus/integrations/reads/searchIssues.js.map +1 -1
  205. package/dist/plus/integrations/reads/searchPullRequests.js +2 -1
  206. package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
  207. package/dist/plus/integrations/reads/sweeps.d.ts +1 -1
  208. package/dist/plus/integrations/reads/sweeps.js +3 -2
  209. package/dist/plus/integrations/reads/sweeps.js.map +1 -1
  210. package/dist/plus/integrations/reads/warnings.d.ts +1 -1
  211. package/dist/plus/integrations/reads/warnings.js +1 -1
  212. package/dist/plus/integrations/reads/warnings.js.map +1 -1
  213. package/dist/plus/integrations/results.d.ts +324 -2
  214. package/dist/plus/integrations/results.js.map +1 -1
  215. package/dist/plus/integrations/telemetry.d.ts +0 -10
  216. package/dist/plus/integrations/telemetry.js +0 -11
  217. package/dist/plus/integrations/utils/domain.utils.d.ts +1 -0
  218. package/dist/plus/integrations/utils/domain.utils.js +10 -2
  219. package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
  220. package/dist/plus/integrations/utils/integration.utils.d.ts +1 -6
  221. package/dist/plus/integrations/utils/integration.utils.js +2 -9
  222. package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
  223. package/dist/utils/keys/chord.d.ts +13 -2
  224. package/dist/utils/keys/chord.js +76 -17
  225. package/dist/utils/keys/chord.js.map +1 -1
  226. package/dist/utils/keys/keybinding.d.ts +12 -0
  227. package/dist/utils/keys/keybinding.js +52 -2
  228. package/dist/utils/keys/keybinding.js.map +1 -1
  229. package/dist/utils/markdown.d.ts +21 -0
  230. package/dist/utils/markdown.js +33 -1
  231. package/dist/utils/markdown.js.map +1 -1
  232. package/docs/integrations.md +99 -16
  233. package/package.json +5 -1
  234. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +0 -1
  235. package/dist/plus/integrations/telemetry.js.map +0 -1
@@ -1,7 +1,9 @@
1
1
  import { reconcileOmissionsWithFailure } from "../results.js";
2
2
  import { mergeAssessmentInto } from "../collectionMetadata.js";
3
- import { providersMetadata, toPullRequestRow } from "../providers/models.js";
4
- import { isGitHostIntegration, isIssuesHostIntegrationId, warnOnMissingSessionForDomain } from "../utils/integration.utils.js";
3
+ import { providersMetadata } from "../providers/metadata.js";
4
+ import { isIssuesHostIntegrationId, warnOnMissingSessionForDomain } from "../utils/integration.utils.js";
5
+ import { toPullRequestRow } from "../providers/models.js";
6
+ import { isGitHostIntegration } from "../models/publicIntegration.js";
5
7
  import { drainToRequestedPage, isPageNumberAdvanceable, pageToCursor, refusedPage, resolveContinuation, resolveCurrentPage, toProviderPageInfo } from "./paging.js";
6
8
  import { gitHostOnlySurfaceWarning, truncationWarning, unsupportedAccountWidePullRequestFiltersWarning, unsupportedFiltersWarning } from "./warnings.js";
7
9
  import { getPullRequestViewers, runCaptured } from "./drains.js";
@@ -1 +1 @@
1
- {"version":3,"file":"pullRequests.js","names":[],"sources":["../../../../../plus/integrations/src/reads/pullRequests.ts"],"sourcesContent":["import type { PullRequest, PullRequestShape, PullRequestStateFilter } from '@gitlens/git/models/pullRequest.js';\nimport { mergeAssessmentInto } from '../collectionMetadata.js';\nimport type { IntegrationIds } from '../constants.js';\nimport type { ProviderPullRequest, ProviderReposInput, PullRequestFilter } from '../providers/models.js';\nimport { PagingMode, providersMetadata, toPullRequestRow } from '../providers/models.js';\nimport type { ProviderPagedResult } from '../results.js';\nimport { reconcileOmissionsWithFailure } from '../results.js';\nimport {\n\tisGitHostIntegration,\n\tisIssuesHostIntegrationId,\n\twarnOnMissingSessionForDomain,\n} from '../utils/integration.utils.js';\nimport type { ProviderReadContext } from './context.js';\nimport { getPullRequestViewers, runCaptured } from './drains.js';\nimport { resolveAccountWidePullRequestFilters, resolvePullRequestFilters } from './filters.js';\nimport {\n\tdrainToRequestedPage,\n\tisPageNumberAdvanceable,\n\tpageToCursor,\n\trefusedPage,\n\tresolveContinuation,\n\tresolveCurrentPage,\n\ttoProviderPageInfo,\n} from './paging.js';\nimport {\n\tgitHostOnlySurfaceWarning,\n\ttruncationWarning,\n\tunsupportedAccountWidePullRequestFiltersWarning,\n\tunsupportedFiltersWarning,\n} from './warnings.js';\n\nexport async function listPullRequestsPage(\n\tctx: ProviderReadContext,\n\toptions: {\n\t\tproviderId: IntegrationIds;\n\t\trepos?: ProviderReposInput;\n\t\tstates?: PullRequestStateFilter[];\n\t\t/**\n\t\t * PR relationship filters (e.g. `[Author, Assignee, ReviewRequested]`). On repo-scoped reads members\n\t\t * combine as provider query constraints (normally an intersection); on account-wide reads they form an\n\t\t * exact OR union. The whole set is validated against the selected path's capability.\n\t\t */\n\t\tfilters?: PullRequestFilter[];\n\t\t/**\n\t\t * Account-wide only: include review-requested PRs when the provider's native \"my PRs\" query omits them.\n\t\t * This extends the provider-native result; it is not a narrowing filter.\n\t\t */\n\t\tincludeReviewRequested?: boolean;\n\t\tpage?: number;\n\t\tcursor?: string;\n\t\t/**\n\t\t * Requests the lightweight row shape (see {@link IntegrationManager.listPullRequestsPage}). Opt-in\n\t\t * only, and only on the repo-scoped branch: the account-wide branch has always read the lightweight\n\t\t * shape and keeps doing so, so an explicit `false` does not widen it back to the full projection.\n\t\t */\n\t\tsummary?: boolean;\n\t\t/** See {@link IntegrationManager.listPullRequestsPage}. */\n\t\tscopeConcurrency?: number;\n\t\t/** See {@link IntegrationManager.listPullRequestsPage}. */\n\t\tincludeRemoteInfo?: boolean;\n\t\t/** See {@link IntegrationManager.listPullRequestsPage}. Account-wide only: the repo-scoped read ignores it. */\n\t\tmergeQueue?: boolean;\n\t\titemsPerPage?: number;\n\t\tforceSync?: boolean;\n\t\tconnectionId?: string;\n\t\t/**\n\t\t * Explicit self-managed host domain when no configured connection supplies one. The value must come\n\t\t * from the trusted authentication configuration, not repository or remote data.\n\t\t */\n\t\tdomain?: string;\n\t},\n): Promise<ProviderPagedResult<PullRequestShape>> {\n\t// Truncated as well as floored, like every other paged read here: `page` is reported back as\n\t// `page.currentPage` and compared against the position a drain reached, and neither can be fractional.\n\tconst page = Math.max(1, Math.trunc(options.page ?? 1));\n\tif (isIssuesHostIntegrationId(options.providerId)) {\n\t\treturn refusedPage(\n\t\t\tpage,\n\t\t\t[gitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, 'pull request reads')],\n\t\t\ttrue,\n\t\t);\n\t}\n\n\tconst integration = await ctx.getIntegrationForRead(options.providerId, options.connectionId, options.domain);\n\tif (integration == null) {\n\t\t// A supplied connection or domain that no longer resolves is a broken target, not an empty account —\n\t\t// surface a no-connection warning + fetchFailed rather than a silent empty page.\n\t\tconst early = ctx.earlyReturnConnectionWarnings(options.providerId, options.connectionId, options.domain);\n\t\treturn refusedPage(page, early.warnings, early.fetchFailed);\n\t}\n\tif (!isGitHostIntegration(integration)) {\n\t\treturn refusedPage(\n\t\t\tpage,\n\t\t\t[gitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, 'pull request reads')],\n\t\t\ttrue,\n\t\t);\n\t}\n\n\tawait ctx.forceRefreshIfRequested(integration, options.forceSync, options.connectionId);\n\n\tconst domain = ctx.domainForRead(integration, options.providerId, options.connectionId, options.domain);\n\t// With no repos this is an account-wide \"my PRs\" read; the repo-scoped core rejects an empty `repos`\n\t// input, so route to the account-wide, inherently user-scoped core instead (see drainPullRequests).\n\t// That provider-defined path takes no `pageSize`. A page-only request is handled by walking any opaque\n\t// continuations it supplies below. Do NOT synthesize a page-number cursor for it: cursor-based queries\n\t// (e.g. GitHub `involves:`) ignore a page number and would return their first page.\n\tconst accountWide = (options.repos?.length ?? 0) === 0;\n\tconst cursor = accountWide ? options.cursor : (options.cursor ?? pageToCursor(page));\n\n\tconst resolvedFilters = accountWide\n\t\t? resolveAccountWidePullRequestFilters(options.providerId, options.filters)\n\t\t: resolvePullRequestFilters(options.providerId, options.filters);\n\tif (resolvedFilters.unsupported) {\n\t\treturn refusedPage(\n\t\t\tpage,\n\t\t\t[\n\t\t\t\taccountWide\n\t\t\t\t\t? unsupportedAccountWidePullRequestFiltersWarning(\n\t\t\t\t\t\t\toptions.providerId,\n\t\t\t\t\t\t\tdomain,\n\t\t\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t\t\toptions.filters ?? [],\n\t\t\t\t\t\t)\n\t\t\t\t\t: unsupportedFiltersWarning(options.providerId, domain, options.connectionId),\n\t\t\t],\n\t\t\ttrue,\n\t\t);\n\t}\n\n\t// Everything but the cursor, shared by the initial read and the drain's re-reads below so the two cannot\n\t// drift. `summary` is the reason this matters beyond tidiness: a re-read that dropped it would both\n\t// revert to the full payload — on the very path that issues the most requests — and return rows of a\n\t// different shape than the first page, since a summary row reports `headCommit`/`commitCount` as absent.\n\t// `summary` is pinned true here rather than forwarded: this branch has never had a full projection to\n\t// fall back to (see the option's doc), so honoring an explicit `false` would promise a widening the read\n\t// cannot deliver.\n\tconst accountWideInput = {\n\t\tstate: options.states,\n\t\tincludeReviewRequested: options.includeReviewRequested ?? false,\n\t\tfilters: resolvedFilters.filters,\n\t\tsummary: true,\n\t\tmergeQueue: options.mergeQueue,\n\t};\n\t// `filters` scopes the read to the current user (the core resolves the account for these), so it returns\n\t// the user's PRs. `pageSize` rides along so PagingMode.Repo hosts (GitLab, Bitbucket, Bitbucket Data Center,\n\t// Azure), whose per-repo cursor path ignores a synthesized page-number cursor, honor the requested size.\n\tconst scopedInput = {\n\t\tstate: options.states,\n\t\tfilters: resolvedFilters.filters,\n\t\tpageSize: options.itemsPerPage,\n\t\tsummary: options.summary,\n\t\tscopeConcurrency: options.scopeConcurrency,\n\t\tincludeRemoteInfo: options.includeRemoteInfo,\n\t};\n\tconst readPage = (pageCursor: string | undefined, requestedPage?: number) =>\n\t\trunCaptured(\n\t\t\toptions.providerId,\n\t\t\tdomain,\n\t\t\toptions.connectionId,\n\t\t\t() =>\n\t\t\t\taccountWide\n\t\t\t\t\t? integration.getMyPullRequestsForUserResult(\n\t\t\t\t\t\t\t{ ...accountWideInput, cursor: pageCursor },\n\t\t\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t\t)\n\t\t\t\t\t: integration.getMyPullRequestsForReposResult(\n\t\t\t\t\t\t\toptions.repos ?? [],\n\t\t\t\t\t\t\t{ ...scopedInput, cursor: pageCursor, page: requestedPage },\n\t\t\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t\t),\n\t\t\t{\n\t\t\t\twarnOnMissingSession: warnOnMissingSessionForDomain(options.providerId, options.domain),\n\t\t\t},\n\t\t);\n\tconst { value, warning } = await readPage(cursor, options.page != null ? page : undefined);\n\n\tlet items = value?.values ?? [];\n\t// Cursor-only account-wide reads start at page 1; a page-only request is advanced through opaque\n\t// continuations below. Repo-scoped reads report the requested page unless the provider reports its own.\n\tlet paged = toProviderPageInfo(items.length, value?.paging);\n\tlet allMetadata = value?.metadata;\n\t// Convert the SDK collection metadata into scope-aware warnings + failure/truncation flags, appending\n\t// them to any captured thrown-error warning without discarding the partial result's items.\n\tconst warnings = warning != null ? [warning] : [];\n\tlet pageFetchFailed = warning != null && value == null;\n\tlet drainedGap = false;\n\n\t// Cursor-only reads ignore a synthesized page-number cursor, so a page-only request is advanced through\n\t// the provider's own continuations (see drainToRequestedPage).\n\tif (\n\t\t(accountWide || providersMetadata[options.providerId]?.pullRequestsPagingMode === PagingMode.Repos) &&\n\t\toptions.page != null &&\n\t\tpage > 1 &&\n\t\toptions.cursor == null &&\n\t\tpaged.page.currentPage === 1\n\t) {\n\t\tconst drained = await drainToRequestedPage<ProviderPullRequest | PullRequest>(\n\t\t\t{ items: items, paged: paged, metadata: allMetadata, fetchFailed: pageFetchFailed },\n\t\t\t{\n\t\t\t\trequestedPage: page,\n\t\t\t\titemsPerPage: options.itemsPerPage,\n\t\t\t\twarnings: warnings,\n\t\t\t\t// A drain advances through provider continuations, so only the cursor positions these reads.\n\t\t\t\treadPage: (cursor: string) => readPage(cursor),\n\t\t\t},\n\t\t);\n\t\titems = drained.items;\n\t\tpaged = drained.paged;\n\t\tallMetadata = drained.metadata;\n\t\tpageFetchFailed = drained.fetchFailed;\n\t\tdrainedGap = drained.unexpectedGap === true;\n\t}\n\n\tconst assessment = mergeAssessmentInto(warnings, options.providerId, domain, options.connectionId, allMetadata);\n\t// Never advertise `hasMore` without a continuation the caller can act on. The account-wide read has no\n\t// page to synthesize, and neither does a host that doesn't honor a page number — see\n\t// {@link IntegrationService.isPageNumberAdvanceable} for which do and why absence of a declared mode\n\t// does NOT count as one.\n\tconst pageAdvanceable =\n\t\t!accountWide && isPageNumberAdvanceable(providersMetadata[options.providerId]?.pullRequestsPagingMode);\n\tconst continuation = resolveContinuation(paged, pageAdvanceable ? paged.page.currentPage + 1 : undefined);\n\t// A single-page provider read that couldn't confirm completeness sets `paging.truncated`; surface it\n\t// as a terminal `page.truncated` (not `hasMore`, which has no cursor to advance) so the caller knows\n\t// the page may be incomplete. Metadata incompleteness is an independent source of the same signal.\n\tconst truncated = continuation.truncated || assessment.truncated;\n\tif (truncated && warnings.length === 0) {\n\t\t// `exhausted`, never `page-budget`: a paged read has no budget the caller can raise. Ordinary\n\t\t// continuation is already expressed by `hasMore`/`cursor`, so reaching here means this page itself\n\t\t// couldn't be completed — raising anything would return the same page.\n\t\twarnings.push(\n\t\t\ttruncationWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tdomain,\n\t\t\t\toptions.connectionId,\n\t\t\t\t'Pull request',\n\t\t\t\tassessment.fetchFailed || pageFetchFailed ? 'interrupted' : 'exhausted',\n\t\t\t),\n\t\t);\n\t}\n\t// A metadata omission from an earlier page asserts the read succeeded; a later page may since have failed.\n\treconcileOmissionsWithFailure(warnings, assessment.fetchFailed || pageFetchFailed);\n\tconst viewers = await getPullRequestViewers(integration, options.connectionId, items);\n\tconst projection = accountWide ? 'account-summary' : options.summary ? 'repos-summary' : 'repos';\n\treturn {\n\t\t// Normalize the raw rows to the GitLens-owned shape at the surface boundary.\n\t\titems: items.map((pr, i) =>\n\t\t\ttoPullRequestRow(pr, integration, { currentAccount: viewers[i], projection: projection }),\n\t\t),\n\t\twarnings: warnings,\n\t\t// The account-wide read can't take a page size, so don't echo the requested `itemsPerPage` as if it\n\t\t// had been applied — report what came back.\n\t\tpage: {\n\t\t\t...paged.page,\n\t\t\t// Positional, per ProviderPageInfo.currentPage: the drain (above) already advanced `paged.page`,\n\t\t\t// and a caller-threaded cursor advanced the provider, so neither leaves a cursor-only read stuck\n\t\t\t// reporting page 1.\n\t\t\tcurrentPage: resolveCurrentPage({\n\t\t\t\tproviderPage: paged.page.currentPage,\n\t\t\t\trequestedPage: page,\n\t\t\t\tsuppliedCursor: options.cursor,\n\t\t\t\tpageAdvanceable: pageAdvanceable,\n\t\t\t}),\n\t\t\titemsPerPage: accountWide ? items.length : paged.page.itemsPerPage,\n\t\t\ttruncated: truncated || undefined,\n\t\t},\n\t\thasMore: continuation.hasMore,\n\t\tcursor: continuation.cursor,\n\t\t// A metadata failure means items are incomplete even when the read didn't throw; a thrown error with\n\t\t// no recovered value is the pre-existing failure case.\n\t\tfetchFailed: assessment.fetchFailed || pageFetchFailed || undefined,\n\t\trequestFailed: assessment.requestFailed || pageFetchFailed,\n\t\tunexpectedGap: drainedGap || (paged.hasMore === true && paged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AAa,QAAQ,kBAAkB;CACxC;CAEA,MAAM,aAAa,oBAAoB,UAAU,QAAQ,YAAY,QAAQ,QAAQ,cAAc,WAAW;CAK9G,MAAM,kBACL,CAAC,eAAe,wBAAwB,kBAAkB,QAAQ,WAAW,EAAE,sBAAsB;CACtG,MAAM,eAAe,oBAAoB,OAAO,kBAAkB,MAAM,KAAK,cAAc,IAAI,KAAA,CAAS;CAIxG,MAAM,YAAY,aAAa,aAAa,WAAW;CACvD,IAAI,aAAa,SAAS,WAAW,GAIpC,SAAS,KACR,kBACC,QAAQ,YACR,QACA,QAAQ,cACR,gBACA,WAAW,eAAe,kBAAkB,gBAAgB,WAC7D,CACD;CAGD,8BAA8B,UAAU,WAAW,eAAe,eAAe;CACjF,MAAM,UAAU,MAAM,sBAAsB,aAAa,QAAQ,cAAc,KAAK;CACpF,MAAM,aAAa,cAAc,oBAAoB,QAAQ,UAAU,kBAAkB;CACzF,OAAO;EAEN,OAAO,MAAM,KAAK,IAAI,MACrB,iBAAiB,IAAI,aAAa;GAAE,gBAAgB,QAAQ;GAAgB;EAAW,CAAC,CACzF;EACU;EAGV,MAAM;GACL,GAAG,MAAM;GAIT,aAAa,mBAAmB;IAC/B,cAAc,MAAM,KAAK;IACzB,eAAe;IACf,gBAAgB,QAAQ;IACP;GAClB,CAAC;GACD,cAAc,cAAc,MAAM,SAAS,MAAM,KAAK;GACtD,WAAW,aAAa,KAAA;EACzB;EACA,SAAS,aAAa;EACtB,QAAQ,aAAa;EAGrB,aAAa,WAAW,eAAe,mBAAmB,KAAA;EAC1D,eAAe,WAAW,iBAAiB;EAC3C,eAAe,cAAe,MAAM,YAAY,QAAQ,MAAM,UAAU,QAAQ,CAAC;CAClF;AACD"}
1
+ {"version":3,"file":"pullRequests.js","names":[],"sources":["../../../../../plus/integrations/src/reads/pullRequests.ts"],"sourcesContent":["import type { PullRequest, PullRequestShape, PullRequestStateFilter } from '@gitlens/git/models/pullRequest.js';\nimport { mergeAssessmentInto } from '../collectionMetadata.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { isGitHostIntegration } from '../models/publicIntegration.js';\nimport { PagingMode, providersMetadata } from '../providers/metadata.js';\nimport type { ProviderPullRequest, ProviderReposInput, PullRequestFilter } from '../providers/models.js';\nimport { toPullRequestRow } from '../providers/models.js';\nimport type { ProviderPagedResult } from '../results.js';\nimport { reconcileOmissionsWithFailure } from '../results.js';\nimport { isIssuesHostIntegrationId, warnOnMissingSessionForDomain } from '../utils/integration.utils.js';\nimport type { ProviderReadContext } from './context.js';\nimport { getPullRequestViewers, runCaptured } from './drains.js';\nimport { resolveAccountWidePullRequestFilters, resolvePullRequestFilters } from './filters.js';\nimport {\n\tdrainToRequestedPage,\n\tisPageNumberAdvanceable,\n\tpageToCursor,\n\trefusedPage,\n\tresolveContinuation,\n\tresolveCurrentPage,\n\ttoProviderPageInfo,\n} from './paging.js';\nimport {\n\tgitHostOnlySurfaceWarning,\n\ttruncationWarning,\n\tunsupportedAccountWidePullRequestFiltersWarning,\n\tunsupportedFiltersWarning,\n} from './warnings.js';\n\nexport async function listPullRequestsPage(\n\tctx: ProviderReadContext,\n\toptions: {\n\t\tproviderId: IntegrationIds;\n\t\trepos?: ProviderReposInput;\n\t\tstates?: PullRequestStateFilter[];\n\t\t/**\n\t\t * PR relationship filters (e.g. `[Author, Assignee, ReviewRequested]`). On repo-scoped reads members\n\t\t * combine as provider query constraints (normally an intersection); on account-wide reads they form an\n\t\t * exact OR union. The whole set is validated against the selected path's capability.\n\t\t */\n\t\tfilters?: PullRequestFilter[];\n\t\t/**\n\t\t * Account-wide only: include review-requested PRs when the provider's native \"my PRs\" query omits them.\n\t\t * This extends the provider-native result; it is not a narrowing filter.\n\t\t */\n\t\tincludeReviewRequested?: boolean;\n\t\tpage?: number;\n\t\tcursor?: string;\n\t\t/**\n\t\t * Requests the lightweight row shape (see {@link IntegrationManager.listPullRequestsPage}). Opt-in\n\t\t * only, and only on the repo-scoped branch: the account-wide branch has always read the lightweight\n\t\t * shape and keeps doing so, so an explicit `false` does not widen it back to the full projection.\n\t\t */\n\t\tsummary?: boolean;\n\t\t/** See {@link IntegrationManager.listPullRequestsPage}. */\n\t\tscopeConcurrency?: number;\n\t\t/** See {@link IntegrationManager.listPullRequestsPage}. */\n\t\tincludeRemoteInfo?: boolean;\n\t\t/** See {@link IntegrationManager.listPullRequestsPage}. Account-wide only: the repo-scoped read ignores it. */\n\t\tmergeQueue?: boolean;\n\t\titemsPerPage?: number;\n\t\tforceSync?: boolean;\n\t\tconnectionId?: string;\n\t\t/**\n\t\t * Explicit self-managed host domain when no configured connection supplies one. The value must come\n\t\t * from the trusted authentication configuration, not repository or remote data.\n\t\t */\n\t\tdomain?: string;\n\t},\n): Promise<ProviderPagedResult<PullRequestShape>> {\n\t// Truncated as well as floored, like every other paged read here: `page` is reported back as\n\t// `page.currentPage` and compared against the position a drain reached, and neither can be fractional.\n\tconst page = Math.max(1, Math.trunc(options.page ?? 1));\n\tif (isIssuesHostIntegrationId(options.providerId)) {\n\t\treturn refusedPage(\n\t\t\tpage,\n\t\t\t[gitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, 'pull request reads')],\n\t\t\ttrue,\n\t\t);\n\t}\n\n\tconst integration = await ctx.getIntegrationForRead(options.providerId, options.connectionId, options.domain);\n\tif (integration == null) {\n\t\t// A supplied connection or domain that no longer resolves is a broken target, not an empty account —\n\t\t// surface a no-connection warning + fetchFailed rather than a silent empty page.\n\t\tconst early = ctx.earlyReturnConnectionWarnings(options.providerId, options.connectionId, options.domain);\n\t\treturn refusedPage(page, early.warnings, early.fetchFailed);\n\t}\n\tif (!isGitHostIntegration(integration)) {\n\t\treturn refusedPage(\n\t\t\tpage,\n\t\t\t[gitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, 'pull request reads')],\n\t\t\ttrue,\n\t\t);\n\t}\n\n\tawait ctx.forceRefreshIfRequested(integration, options.forceSync, options.connectionId);\n\n\tconst domain = ctx.domainForRead(integration, options.providerId, options.connectionId, options.domain);\n\t// With no repos this is an account-wide \"my PRs\" read; the repo-scoped core rejects an empty `repos`\n\t// input, so route to the account-wide, inherently user-scoped core instead (see drainPullRequests).\n\t// That provider-defined path takes no `pageSize`. A page-only request is handled by walking any opaque\n\t// continuations it supplies below. Do NOT synthesize a page-number cursor for it: cursor-based queries\n\t// (e.g. GitHub `involves:`) ignore a page number and would return their first page.\n\tconst accountWide = (options.repos?.length ?? 0) === 0;\n\tconst cursor = accountWide ? options.cursor : (options.cursor ?? pageToCursor(page));\n\n\tconst resolvedFilters = accountWide\n\t\t? resolveAccountWidePullRequestFilters(options.providerId, options.filters)\n\t\t: resolvePullRequestFilters(options.providerId, options.filters);\n\tif (resolvedFilters.unsupported) {\n\t\treturn refusedPage(\n\t\t\tpage,\n\t\t\t[\n\t\t\t\taccountWide\n\t\t\t\t\t? unsupportedAccountWidePullRequestFiltersWarning(\n\t\t\t\t\t\t\toptions.providerId,\n\t\t\t\t\t\t\tdomain,\n\t\t\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t\t\toptions.filters ?? [],\n\t\t\t\t\t\t)\n\t\t\t\t\t: unsupportedFiltersWarning(options.providerId, domain, options.connectionId),\n\t\t\t],\n\t\t\ttrue,\n\t\t);\n\t}\n\n\t// Everything but the cursor, shared by the initial read and the drain's re-reads below so the two cannot\n\t// drift. `summary` is the reason this matters beyond tidiness: a re-read that dropped it would both\n\t// revert to the full payload — on the very path that issues the most requests — and return rows of a\n\t// different shape than the first page, since a summary row reports `headCommit`/`commitCount` as absent.\n\t// `summary` is pinned true here rather than forwarded: this branch has never had a full projection to\n\t// fall back to (see the option's doc), so honoring an explicit `false` would promise a widening the read\n\t// cannot deliver.\n\tconst accountWideInput = {\n\t\tstate: options.states,\n\t\tincludeReviewRequested: options.includeReviewRequested ?? false,\n\t\tfilters: resolvedFilters.filters,\n\t\tsummary: true,\n\t\tmergeQueue: options.mergeQueue,\n\t};\n\t// `filters` scopes the read to the current user (the core resolves the account for these), so it returns\n\t// the user's PRs. `pageSize` rides along so PagingMode.Repo hosts (GitLab, Bitbucket, Bitbucket Data Center,\n\t// Azure), whose per-repo cursor path ignores a synthesized page-number cursor, honor the requested size.\n\tconst scopedInput = {\n\t\tstate: options.states,\n\t\tfilters: resolvedFilters.filters,\n\t\tpageSize: options.itemsPerPage,\n\t\tsummary: options.summary,\n\t\tscopeConcurrency: options.scopeConcurrency,\n\t\tincludeRemoteInfo: options.includeRemoteInfo,\n\t};\n\tconst readPage = (pageCursor: string | undefined, requestedPage?: number) =>\n\t\trunCaptured(\n\t\t\toptions.providerId,\n\t\t\tdomain,\n\t\t\toptions.connectionId,\n\t\t\t() =>\n\t\t\t\taccountWide\n\t\t\t\t\t? integration.getMyPullRequestsForUserResult(\n\t\t\t\t\t\t\t{ ...accountWideInput, cursor: pageCursor },\n\t\t\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t\t)\n\t\t\t\t\t: integration.getMyPullRequestsForReposResult(\n\t\t\t\t\t\t\toptions.repos ?? [],\n\t\t\t\t\t\t\t{ ...scopedInput, cursor: pageCursor, page: requestedPage },\n\t\t\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t\t),\n\t\t\t{\n\t\t\t\twarnOnMissingSession: warnOnMissingSessionForDomain(options.providerId, options.domain),\n\t\t\t},\n\t\t);\n\tconst { value, warning } = await readPage(cursor, options.page != null ? page : undefined);\n\n\tlet items = value?.values ?? [];\n\t// Cursor-only account-wide reads start at page 1; a page-only request is advanced through opaque\n\t// continuations below. Repo-scoped reads report the requested page unless the provider reports its own.\n\tlet paged = toProviderPageInfo(items.length, value?.paging);\n\tlet allMetadata = value?.metadata;\n\t// Convert the SDK collection metadata into scope-aware warnings + failure/truncation flags, appending\n\t// them to any captured thrown-error warning without discarding the partial result's items.\n\tconst warnings = warning != null ? [warning] : [];\n\tlet pageFetchFailed = warning != null && value == null;\n\tlet drainedGap = false;\n\n\t// Cursor-only reads ignore a synthesized page-number cursor, so a page-only request is advanced through\n\t// the provider's own continuations (see drainToRequestedPage).\n\tif (\n\t\t(accountWide || providersMetadata[options.providerId]?.pullRequestsPagingMode === PagingMode.Repos) &&\n\t\toptions.page != null &&\n\t\tpage > 1 &&\n\t\toptions.cursor == null &&\n\t\tpaged.page.currentPage === 1\n\t) {\n\t\tconst drained = await drainToRequestedPage<ProviderPullRequest | PullRequest>(\n\t\t\t{ items: items, paged: paged, metadata: allMetadata, fetchFailed: pageFetchFailed },\n\t\t\t{\n\t\t\t\trequestedPage: page,\n\t\t\t\titemsPerPage: options.itemsPerPage,\n\t\t\t\twarnings: warnings,\n\t\t\t\t// A drain advances through provider continuations, so only the cursor positions these reads.\n\t\t\t\treadPage: (cursor: string) => readPage(cursor),\n\t\t\t},\n\t\t);\n\t\titems = drained.items;\n\t\tpaged = drained.paged;\n\t\tallMetadata = drained.metadata;\n\t\tpageFetchFailed = drained.fetchFailed;\n\t\tdrainedGap = drained.unexpectedGap === true;\n\t}\n\n\tconst assessment = mergeAssessmentInto(warnings, options.providerId, domain, options.connectionId, allMetadata);\n\t// Never advertise `hasMore` without a continuation the caller can act on. The account-wide read has no\n\t// page to synthesize, and neither does a host that doesn't honor a page number — see\n\t// {@link IntegrationService.isPageNumberAdvanceable} for which do and why absence of a declared mode\n\t// does NOT count as one.\n\tconst pageAdvanceable =\n\t\t!accountWide && isPageNumberAdvanceable(providersMetadata[options.providerId]?.pullRequestsPagingMode);\n\tconst continuation = resolveContinuation(paged, pageAdvanceable ? paged.page.currentPage + 1 : undefined);\n\t// A single-page provider read that couldn't confirm completeness sets `paging.truncated`; surface it\n\t// as a terminal `page.truncated` (not `hasMore`, which has no cursor to advance) so the caller knows\n\t// the page may be incomplete. Metadata incompleteness is an independent source of the same signal.\n\tconst truncated = continuation.truncated || assessment.truncated;\n\tif (truncated && warnings.length === 0) {\n\t\t// `exhausted`, never `page-budget`: a paged read has no budget the caller can raise. Ordinary\n\t\t// continuation is already expressed by `hasMore`/`cursor`, so reaching here means this page itself\n\t\t// couldn't be completed — raising anything would return the same page.\n\t\twarnings.push(\n\t\t\ttruncationWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tdomain,\n\t\t\t\toptions.connectionId,\n\t\t\t\t'Pull request',\n\t\t\t\tassessment.fetchFailed || pageFetchFailed ? 'interrupted' : 'exhausted',\n\t\t\t),\n\t\t);\n\t}\n\t// A metadata omission from an earlier page asserts the read succeeded; a later page may since have failed.\n\treconcileOmissionsWithFailure(warnings, assessment.fetchFailed || pageFetchFailed);\n\tconst viewers = await getPullRequestViewers(integration, options.connectionId, items);\n\tconst projection = accountWide ? 'account-summary' : options.summary ? 'repos-summary' : 'repos';\n\treturn {\n\t\t// Normalize the raw rows to the GitLens-owned shape at the surface boundary.\n\t\titems: items.map((pr, i) =>\n\t\t\ttoPullRequestRow(pr, integration, { currentAccount: viewers[i], projection: projection }),\n\t\t),\n\t\twarnings: warnings,\n\t\t// The account-wide read can't take a page size, so don't echo the requested `itemsPerPage` as if it\n\t\t// had been applied — report what came back.\n\t\tpage: {\n\t\t\t...paged.page,\n\t\t\t// Positional, per ProviderPageInfo.currentPage: the drain (above) already advanced `paged.page`,\n\t\t\t// and a caller-threaded cursor advanced the provider, so neither leaves a cursor-only read stuck\n\t\t\t// reporting page 1.\n\t\t\tcurrentPage: resolveCurrentPage({\n\t\t\t\tproviderPage: paged.page.currentPage,\n\t\t\t\trequestedPage: page,\n\t\t\t\tsuppliedCursor: options.cursor,\n\t\t\t\tpageAdvanceable: pageAdvanceable,\n\t\t\t}),\n\t\t\titemsPerPage: accountWide ? items.length : paged.page.itemsPerPage,\n\t\t\ttruncated: truncated || undefined,\n\t\t},\n\t\thasMore: continuation.hasMore,\n\t\tcursor: continuation.cursor,\n\t\t// A metadata failure means items are incomplete even when the read didn't throw; a thrown error with\n\t\t// no recovered value is the pre-existing failure case.\n\t\tfetchFailed: assessment.fetchFailed || pageFetchFailed || undefined,\n\t\trequestFailed: assessment.requestFailed || pageFetchFailed,\n\t\tunexpectedGap: drainedGap || (paged.hasMore === true && paged.cursor ==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,QAAQ,kBAAkB;CACxC;CAEA,MAAM,aAAa,oBAAoB,UAAU,QAAQ,YAAY,QAAQ,QAAQ,cAAc,WAAW;CAK9G,MAAM,kBACL,CAAC,eAAe,wBAAwB,kBAAkB,QAAQ,WAAW,EAAE,sBAAsB;CACtG,MAAM,eAAe,oBAAoB,OAAO,kBAAkB,MAAM,KAAK,cAAc,IAAI,KAAA,CAAS;CAIxG,MAAM,YAAY,aAAa,aAAa,WAAW;CACvD,IAAI,aAAa,SAAS,WAAW,GAIpC,SAAS,KACR,kBACC,QAAQ,YACR,QACA,QAAQ,cACR,gBACA,WAAW,eAAe,kBAAkB,gBAAgB,WAC7D,CACD;CAGD,8BAA8B,UAAU,WAAW,eAAe,eAAe;CACjF,MAAM,UAAU,MAAM,sBAAsB,aAAa,QAAQ,cAAc,KAAK;CACpF,MAAM,aAAa,cAAc,oBAAoB,QAAQ,UAAU,kBAAkB;CACzF,OAAO;EAEN,OAAO,MAAM,KAAK,IAAI,MACrB,iBAAiB,IAAI,aAAa;GAAE,gBAAgB,QAAQ;GAAgB;EAAW,CAAC,CACzF;EACU;EAGV,MAAM;GACL,GAAG,MAAM;GAIT,aAAa,mBAAmB;IAC/B,cAAc,MAAM,KAAK;IACzB,eAAe;IACf,gBAAgB,QAAQ;IACP;GAClB,CAAC;GACD,cAAc,cAAc,MAAM,SAAS,MAAM,KAAK;GACtD,WAAW,aAAa,KAAA;EACzB;EACA,SAAS,aAAa;EACtB,QAAQ,aAAa;EAGrB,aAAa,WAAW,eAAe,mBAAmB,KAAA;EAC1D,eAAe,WAAW,iBAAiB;EAC3C,eAAe,cAAe,MAAM,YAAY,QAAQ,MAAM,UAAU,QAAQ,CAAC;CAClF;AACD"}
@@ -1,22 +1,7 @@
1
- import { PullRequestShape } from "../../../git/models/pullRequest.js";
2
1
  import { IntegrationIds } from "../constants.js";
3
- import { ProviderResult } from "../results.js";
2
+ import { ProviderResult, PullRequestForCommitResult } from "../results.js";
4
3
  import { ProviderReadContext } from "./context.js";
5
4
  //#region ../plus/integrations/src/reads/pullRequestsForCommits.d.ts
6
- /** The answer for one SHA of {@link getPullRequestsForCommits}'s input. */
7
- export interface PullRequestForCommitResult {
8
- /** The SHA as the caller passed it (trimmed), echoed so no positional matching is needed. */
9
- sha: string;
10
- /**
11
- * The pull request the commit belongs to, or `undefined` when the host ANSWERED that it has none (or when the SHA
12
- * is the working tree's all-zero one, which is never sent): a resolved "none" a caller can cache. A SHA whose read
13
- * FAILED is not returned at all and sets `fetchFailed`.
14
- *
15
- * When a commit belongs to several, the one the single-commit lookup returns, which each host picks its own way —
16
- * see {@link IntegrationManager.getPullRequestsForCommits}.
17
- */
18
- pullRequest?: PullRequestShape;
19
- }
20
5
  export declare function getPullRequestsForCommits(ctx: ProviderReadContext, options: {
21
6
  providerId: IntegrationIds;
22
7
  /**
@@ -1,7 +1,8 @@
1
1
  import { CancellationError } from "../../../utils/cancellation.js";
2
2
  import { isAzureProviderId } from "../providers/providerErrors.js";
3
3
  import { appendDedupedWarning } from "../results.js";
4
- import { isGitHostIntegration, isIssuesHostIntegrationId } from "../utils/integration.utils.js";
4
+ import { isIssuesHostIntegrationId } from "../utils/integration.utils.js";
5
+ import { isGitHostIntegration } from "../models/publicIntegration.js";
5
6
  import { gitHostOnlySurfaceWarning, otherWarning, unsupportedWarning } from "./warnings.js";
6
7
  import { runCaptured } from "./drains.js";
7
8
  import { appendBatchSlotWarning } from "./batchEtags.js";
@@ -1 +1 @@
1
- {"version":3,"file":"pullRequestsForCommits.js","names":[],"sources":["../../../../../plus/integrations/src/reads/pullRequestsForCommits.ts"],"sourcesContent":["import type { PullRequestShape } from '@gitlens/git/models/pullRequest.js';\nimport { CancellationError } from '@gitlens/utils/cancellation.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { isAzureProviderId } from '../providers/providerErrors.js';\nimport type { ProviderResult, ProviderWarning } from '../results.js';\nimport { appendDedupedWarning } from '../results.js';\nimport { isGitHostIntegration, isIssuesHostIntegrationId } from '../utils/integration.utils.js';\nimport { appendBatchSlotWarning } from './batchEtags.js';\nimport type { ProviderReadContext } from './context.js';\nimport { runCaptured } from './drains.js';\nimport { trimCoordinateFields, unresolvedIntegration } from './issueBatch.js';\nimport { gitHostOnlySurfaceWarning, otherWarning, unsupportedWarning } from './warnings.js';\n\n/** The answer for one SHA of {@link getPullRequestsForCommits}'s input. */\nexport interface PullRequestForCommitResult {\n\t/** The SHA as the caller passed it (trimmed), echoed so no positional matching is needed. */\n\tsha: string;\n\t/**\n\t * The pull request the commit belongs to, or `undefined` when the host ANSWERED that it has none (or when the SHA\n\t * is the working tree's all-zero one, which is never sent): a resolved \"none\" a caller can cache. A SHA whose read\n\t * FAILED is not returned at all and sets `fetchFailed`.\n\t *\n\t * When a commit belongs to several, the one the single-commit lookup returns, which each host picks its own way —\n\t * see {@link IntegrationManager.getPullRequestsForCommits}.\n\t */\n\tpullRequest?: PullRequestShape;\n}\n\nexport async function getPullRequestsForCommits(\n\tctx: ProviderReadContext,\n\toptions: {\n\t\tproviderId: IntegrationIds;\n\t\t/**\n\t\t * GitHub owner, GitLab namespace path (may be nested), Bitbucket workspace, Bitbucket Data Center project key, or\n\t\t * Azure DevOps organization.\n\t\t */\n\t\towner: string;\n\t\t/** Repository name or slug. */\n\t\trepo: string;\n\t\t/** Azure DevOps project. Required there, ignored elsewhere. */\n\t\tproject?: string;\n\t\t/** See {@link IntegrationManager.getPullRequestsForCommits}. Repeats (ignoring case) are resolved once. */\n\t\tshas: readonly string[];\n\t\tconnectionId?: string;\n\t\t/**\n\t\t * Explicit self-managed host domain. Used only when the requested connection has no configured domain;\n\t\t * it must come from the trusted authentication configuration, not repository or remote data.\n\t\t */\n\t\tdomain?: string;\n\t\t/** See {@link IntegrationManager.getPullRequestsForCommits}. */\n\t\tmergeQueue?: boolean;\n\t\t/** See {@link IntegrationManager.getPullRequestsForCommits}. */\n\t\tcancellation?: AbortSignal;\n\t},\n): Promise<ProviderResult<PullRequestForCommitResult>> {\n\tconst cancellation = options.cancellation;\n\tif (cancellation?.aborted) throw new CancellationError();\n\n\tconst refused = (warning: ProviderWarning): ProviderResult<PullRequestForCommitResult> => ({\n\t\titems: [],\n\t\twarnings: [warning],\n\t\tfetchFailed: true,\n\t});\n\tconst surface = 'Pull requests by commit';\n\n\tif (isIssuesHostIntegrationId(options.providerId)) {\n\t\treturn refused(gitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, surface));\n\t}\n\n\tif (options.shas.length === 0) return { items: [], warnings: [] };\n\n\tconst repo = trimCoordinateFields({ owner: options.owner, repo: options.repo, project: options.project });\n\tconst invalid = findInvalidRepository(options.providerId, repo) ?? findInvalidSha(options.shas);\n\tif (invalid != null) {\n\t\treturn refused(otherWarning(options.providerId, undefined, options.connectionId, invalid));\n\t}\n\n\tconst shas: string[] = [];\n\tconst asked: string[] = [];\n\tconst seen = new Set<string>();\n\tfor (const sha of options.shas) {\n\t\tconst trimmed = sha.trim();\n\t\tconst normalized = trimmed.toLowerCase();\n\t\tif (seen.has(normalized)) continue;\n\n\t\tseen.add(normalized);\n\t\tshas.push(trimmed);\n\t\tasked.push(normalized);\n\t}\n\n\tconst integration = await ctx.getIntegrationForRead(options.providerId, options.connectionId, options.domain);\n\tif (cancellation?.aborted) throw new CancellationError();\n\tif (integration == null) {\n\t\treturn unresolvedIntegration(ctx, options.providerId, options.connectionId, options.domain);\n\t}\n\tif (!isGitHostIntegration(integration)) {\n\t\treturn refused(gitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, surface));\n\t}\n\n\tconst domain = ctx.domainForRead(integration, options.providerId, options.connectionId, options.domain);\n\tconst mergeQueue = options.mergeQueue ?? ctx.getPullRequestReadOptions().mergeQueue === true;\n\n\tconst warnings: ProviderWarning[] = [];\n\tlet fetchFailed = false;\n\n\tconst { value: slots, warning } = await runCaptured(\n\t\toptions.providerId,\n\t\tdomain,\n\t\toptions.connectionId,\n\t\t() =>\n\t\t\tintegration.getPullRequestsForCommitsResult(\n\t\t\t\trepo,\n\t\t\t\tasked,\n\t\t\t\t{ mergeQueue: mergeQueue },\n\t\t\t\tcancellation,\n\t\t\t\toptions.connectionId,\n\t\t\t),\n\t\t// KEEP: a missing session must warn on the primary path too, which otherwise reads it as not connected.\n\t\t{ warnOnMissingSession: true },\n\t);\n\tif (cancellation?.aborted) throw new CancellationError();\n\n\tif (warning != null) {\n\t\tappendDedupedWarning(warnings, { ...warning, targetKeys: shas });\n\t}\n\n\tif (slots == null) {\n\t\tif (warning == null) {\n\t\t\tappendDedupedWarning(warnings, {\n\t\t\t\t...unsupportedWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t`${surface} is not supported by '${options.providerId}'.`,\n\t\t\t\t),\n\t\t\t\ttargetKeys: shas,\n\t\t\t});\n\t\t}\n\t\treturn { items: [], warnings: warnings, fetchFailed: true };\n\t}\n\n\tconst items: PullRequestForCommitResult[] = [];\n\tfor (let i = 0; i < shas.length; i++) {\n\t\tconst slot = slots[i];\n\t\tif (slot.status === 'rejected') {\n\t\t\tappendBatchSlotWarning(warnings, options.providerId, domain, options.connectionId, slot, shas[i]);\n\t\t\tfetchFailed = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\titems.push({ sha: shas[i], ...(slot.value != null ? { pullRequest: slot.value } : {}) });\n\t}\n\n\treturn { items: items, warnings: warnings, fetchFailed: fetchFailed || undefined };\n}\n\nfunction findInvalidRepository(\n\tproviderId: IntegrationIds,\n\trepo: { owner: string; repo: string; project?: string },\n): string | undefined {\n\tif (repo.owner.length === 0 || repo.repo.length === 0) {\n\t\treturn `Pull requests by commit requires a non-empty owner and repo.`;\n\t}\n\tif (isAzureProviderId(providerId) && !repo.project) {\n\t\treturn `Pull requests by commit requires a project for '${providerId}'.`;\n\t}\n\treturn undefined;\n}\n\nconst fullShaRegex = /^[0-9a-f]{40}$/i;\n\nfunction findInvalidSha(shas: readonly string[]): string | undefined {\n\tfor (const sha of shas) {\n\t\tif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G,CAAC;CACxF;CAEA,OAAO;EAAS;EAAiB;EAAU,aAAa,eAAe,KAAA;CAAU;AAClF;AAEA,SAAS,sBACR,YACA,MACqB;CACrB,IAAI,KAAK,MAAM,WAAW,KAAK,KAAK,KAAK,WAAW,GACnD,OAAO;CAER,IAAI,kBAAkB,UAAU,KAAK,CAAC,KAAK,SAC1C,OAAO,mDAAmD,WAAW;AAGvE;AAEA,MAAM,eAAe;AAErB,SAAS,eAAe,MAA6C;CACpE,KAAK,MAAM,OAAO,MACjB,IAAI,CAAC,aAAa,KAAK,IAAI,KAAK,CAAC,GAChC,OAAO,gCAAgC,IAAI;AAI9C"}
1
+ {"version":3,"file":"pullRequestsForCommits.js","names":[],"sources":["../../../../../plus/integrations/src/reads/pullRequestsForCommits.ts"],"sourcesContent":["import { CancellationError } from '@gitlens/utils/cancellation.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { isGitHostIntegration } from '../models/publicIntegration.js';\nimport { isAzureProviderId } from '../providers/providerErrors.js';\nimport type { ProviderResult, ProviderWarning, PullRequestForCommitResult } from '../results.js';\nimport { appendDedupedWarning } from '../results.js';\nimport { isIssuesHostIntegrationId } from '../utils/integration.utils.js';\nimport { appendBatchSlotWarning } from './batchEtags.js';\nimport type { ProviderReadContext } from './context.js';\nimport { runCaptured } from './drains.js';\nimport { trimCoordinateFields, unresolvedIntegration } from './issueBatch.js';\nimport { gitHostOnlySurfaceWarning, otherWarning, unsupportedWarning } from './warnings.js';\n\nexport async function getPullRequestsForCommits(\n\tctx: ProviderReadContext,\n\toptions: {\n\t\tproviderId: IntegrationIds;\n\t\t/**\n\t\t * GitHub owner, GitLab namespace path (may be nested), Bitbucket workspace, Bitbucket Data Center project key, or\n\t\t * Azure DevOps organization.\n\t\t */\n\t\towner: string;\n\t\t/** Repository name or slug. */\n\t\trepo: string;\n\t\t/** Azure DevOps project. Required there, ignored elsewhere. */\n\t\tproject?: string;\n\t\t/** See {@link IntegrationManager.getPullRequestsForCommits}. Repeats (ignoring case) are resolved once. */\n\t\tshas: readonly string[];\n\t\tconnectionId?: string;\n\t\t/**\n\t\t * Explicit self-managed host domain. Used only when the requested connection has no configured domain;\n\t\t * it must come from the trusted authentication configuration, not repository or remote data.\n\t\t */\n\t\tdomain?: string;\n\t\t/** See {@link IntegrationManager.getPullRequestsForCommits}. */\n\t\tmergeQueue?: boolean;\n\t\t/** See {@link IntegrationManager.getPullRequestsForCommits}. */\n\t\tcancellation?: AbortSignal;\n\t},\n): Promise<ProviderResult<PullRequestForCommitResult>> {\n\tconst cancellation = options.cancellation;\n\tif (cancellation?.aborted) throw new CancellationError();\n\n\tconst refused = (warning: ProviderWarning): ProviderResult<PullRequestForCommitResult> => ({\n\t\titems: [],\n\t\twarnings: [warning],\n\t\tfetchFailed: true,\n\t});\n\tconst surface = 'Pull requests by commit';\n\n\tif (isIssuesHostIntegrationId(options.providerId)) {\n\t\treturn refused(gitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, surface));\n\t}\n\n\tif (options.shas.length === 0) return { items: [], warnings: [] };\n\n\tconst repo = trimCoordinateFields({ owner: options.owner, repo: options.repo, project: options.project });\n\tconst invalid = findInvalidRepository(options.providerId, repo) ?? findInvalidSha(options.shas);\n\tif (invalid != null) {\n\t\treturn refused(otherWarning(options.providerId, undefined, options.connectionId, invalid));\n\t}\n\n\tconst shas: string[] = [];\n\tconst asked: string[] = [];\n\tconst seen = new Set<string>();\n\tfor (const sha of options.shas) {\n\t\tconst trimmed = sha.trim();\n\t\tconst normalized = trimmed.toLowerCase();\n\t\tif (seen.has(normalized)) continue;\n\n\t\tseen.add(normalized);\n\t\tshas.push(trimmed);\n\t\tasked.push(normalized);\n\t}\n\n\tconst integration = await ctx.getIntegrationForRead(options.providerId, options.connectionId, options.domain);\n\tif (cancellation?.aborted) throw new CancellationError();\n\tif (integration == null) {\n\t\treturn unresolvedIntegration(ctx, options.providerId, options.connectionId, options.domain);\n\t}\n\tif (!isGitHostIntegration(integration)) {\n\t\treturn refused(gitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, surface));\n\t}\n\n\tconst domain = ctx.domainForRead(integration, options.providerId, options.connectionId, options.domain);\n\tconst mergeQueue = options.mergeQueue ?? ctx.getPullRequestReadOptions().mergeQueue === true;\n\n\tconst warnings: ProviderWarning[] = [];\n\tlet fetchFailed = false;\n\n\tconst { value: slots, warning } = await runCaptured(\n\t\toptions.providerId,\n\t\tdomain,\n\t\toptions.connectionId,\n\t\t() =>\n\t\t\tintegration.getPullRequestsForCommitsResult(\n\t\t\t\trepo,\n\t\t\t\tasked,\n\t\t\t\t{ mergeQueue: mergeQueue },\n\t\t\t\tcancellation,\n\t\t\t\toptions.connectionId,\n\t\t\t),\n\t\t// KEEP: a missing session must warn on the primary path too, which otherwise reads it as not connected.\n\t\t{ warnOnMissingSession: true },\n\t);\n\tif (cancellation?.aborted) throw new CancellationError();\n\n\tif (warning != null) {\n\t\tappendDedupedWarning(warnings, { ...warning, targetKeys: shas });\n\t}\n\n\tif (slots == null) {\n\t\tif (warning == null) {\n\t\t\tappendDedupedWarning(warnings, {\n\t\t\t\t...unsupportedWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t`${surface} is not supported by '${options.providerId}'.`,\n\t\t\t\t),\n\t\t\t\ttargetKeys: shas,\n\t\t\t});\n\t\t}\n\t\treturn { items: [], warnings: warnings, fetchFailed: true };\n\t}\n\n\tconst items: PullRequestForCommitResult[] = [];\n\tfor (let i = 0; i < shas.length; i++) {\n\t\tconst slot = slots[i];\n\t\tif (slot.status === 'rejected') {\n\t\t\tappendBatchSlotWarning(warnings, options.providerId, domain, options.connectionId, slot, shas[i]);\n\t\t\tfetchFailed = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\titems.push({ sha: shas[i], ...(slot.value != null ? { pullRequest: slot.value } : {}) });\n\t}\n\n\treturn { items: items, warnings: warnings, fetchFailed: fetchFailed || undefined };\n}\n\nfunction findInvalidRepository(\n\tproviderId: IntegrationIds,\n\trepo: { owner: string; repo: string; project?: string },\n): string | undefined {\n\tif (repo.owner.length === 0 || repo.repo.length === 0) {\n\t\treturn `Pull requests by commit requires a non-empty owner and repo.`;\n\t}\n\tif (isAzureProviderId(providerId) && !repo.project) {\n\t\treturn `Pull requests by commit requires a project for '${providerId}'.`;\n\t}\n\treturn undefined;\n}\n\nconst fullShaRegex = /^[0-9a-f]{40}$/i;\n\nfunction findInvalidSha(shas: readonly string[]): string | undefined {\n\tfor (const sha of shas) {\n\t\tif (!fullShaRegex.test(sha.trim())) {\n\t\t\treturn `Pull requests by commit got '${sha}'; pass each commit as its full 40-character SHA.`;\n\t\t}\n\t}\n\treturn undefined;\n}\n"],"mappings":";;;;;;;;;;AAaA,eAAsB,0BACrB,KACA,SAwBsD;CACtD,MAAM,eAAe,QAAQ;CAC7B,IAAI,cAAc,SAAS,MAAM,IAAI,kBAAkB;CAEvD,MAAM,WAAW,aAA0E;EAC1F,OAAO,CAAC;EACR,UAAU,CAAC,OAAO;EAClB,aAAa;CACd;CACA,MAAM,UAAU;CAEhB,IAAI,0BAA0B,QAAQ,UAAU,GAC/C,OAAO,QAAQ,0BAA0B,QAAQ,YAAY,KAAA,GAAW,QAAQ,cAAc,OAAO,CAAC;CAGvG,IAAI,QAAQ,KAAK,WAAW,GAAG,OAAO;EAAE,OAAO,CAAC;EAAG,UAAU,CAAC;CAAE;CAEhE,MAAM,OAAO,qBAAqB;EAAE,OAAO,QAAQ;EAAO,MAAM,QAAQ;EAAM,SAAS,QAAQ;CAAQ,CAAC;CACxG,MAAM,UAAU,sBAAsB,QAAQ,YAAY,IAAI,KAAK,eAAe,QAAQ,IAAI;CAC9F,IAAI,WAAW,MACd,OAAO,QAAQ,aAAa,QAAQ,YAAY,KAAA,GAAW,QAAQ,cAAc,OAAO,CAAC;CAG1F,MAAM,OAAiB,CAAC;CACxB,MAAM,QAAkB,CAAC;CACzB,MAAM,uBAAO,IAAI,IAAY;CAC7B,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D;CAEA,MAAM,QAAsC,CAAC;CAC7C,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACrC,MAAM,OAAO,MAAM;EACnB,IAAI,KAAK,WAAW,YAAY;GAC/B,uBAAuB,UAAU,QAAQ,YAAY,QAAQ,QAAQ,cAAc,MAAM,KAAK,EAAE;GAChG,cAAc;GACd;EACD;EAEA,MAAM,KAAK;GAAE,KAAK,KAAK;GAAI,GAAI,KAAK,SAAS,OAAO,EAAE,aAAa,KAAK,MAAM,IAAI,CAAC;EAAG,CAAC;CACxF;CAEA,OAAO;EAAS;EAAiB;EAAU,aAAa,eAAe,KAAA;CAAU;AAClF;AAEA,SAAS,sBACR,YACA,MACqB;CACrB,IAAI,KAAK,MAAM,WAAW,KAAK,KAAK,KAAK,WAAW,GACnD,OAAO;CAER,IAAI,kBAAkB,UAAU,KAAK,CAAC,KAAK,SAC1C,OAAO,mDAAmD,WAAW;AAGvE;AAEA,MAAM,eAAe;AAErB,SAAS,eAAe,MAA6C;CACpE,KAAK,MAAM,OAAO,MACjB,IAAI,CAAC,aAAa,KAAK,IAAI,KAAK,CAAC,GAChC,OAAO,gCAAgC,IAAI;AAI9C"}
@@ -5,10 +5,10 @@ import { createRemoteProviderMatcher } from "../../../git/remotes/matcher.js";
5
5
  import "../constants.js";
6
6
  import { toProviderWarning } from "../results.js";
7
7
  import { mergeAssessmentInto } from "../collectionMetadata.js";
8
+ import { isAzureCloudDomain, isBitbucketCloudDomain, isGitHubDotCom, isGitLabDotCom } from "../providers/metadata.js";
8
9
  import { decodePathSegment, getRemoteHostMatcher, hostFromDomain, isWebRemoteScheme } from "../utils/domain.utils.js";
9
- import { isAzureCloudDomain, isBitbucketCloudDomain, isGitHubDotCom, isGitLabDotCom } from "../providers/models.js";
10
10
  import { getIntegrationIdForRemote, getSelfManagedBaseUrl, isGitCloudHostIntegrationId, isGitSelfManagedHostIntegrationId, remoteProviderTypeForConfig, remoteProviderTypeForIntegration } from "../utils/integration.utils.js";
11
- import { isIssuesIntegration } from "../models/issuesIntegration.js";
11
+ import { isIssuesIntegration } from "../models/publicIntegration.js";
12
12
  import { noConnectionWarning } from "./warnings.js";
13
13
  import { getAzureRepositoryIdentity } from "../providers/azure/azure.utils.js";
14
14
  //#region ../plus/integrations/src/reads/resolveRepository.ts
@@ -26,8 +26,8 @@ async function resolveRepository(ctx, options) {
26
26
  const [scheme, parsedDomain, parsedPath] = parseGitRemoteUrl(options.remoteUrl);
27
27
  const path = trimTrailingSlashes(parsedPath);
28
28
  const hostsMatch = getRemoteHostMatcher(scheme);
29
- const parsedHost = hostFromDomain(parsedDomain);
30
- const explicitHost = hostFromDomain(options.host);
29
+ const parsedHost = hostFromRemoteDomain(parsedDomain, scheme);
30
+ const explicitHost = hostFromRemoteDomain(options.host, scheme);
31
31
  if (parsedHost != null && explicitHost != null && !hostsMatch(parsedHost, explicitHost)) return result("host-mismatch");
32
32
  const matcherDomain = parsedDomain || options.host || "";
33
33
  if (options.providerId != null && isGitCloudHostIntegrationId(options.providerId)) {
@@ -42,7 +42,7 @@ async function resolveRepository(ctx, options) {
42
42
  let id = options.providerId ?? getIntegrationIdForRemote(provider);
43
43
  if (id == null && provider.id === "azure-devops" && provider.custom) id = "azure-devops-server";
44
44
  if (id == null) return result("unsupported-provider");
45
- const urlHost = hostFromDomain(provider.domain);
45
+ const urlHost = hostFromRemoteDomain(provider.domain, scheme);
46
46
  let trustedHost = options.connectionId != null || options.domain != null ? hostFromDomain(ctx.resolveDomainForRead(id, options.connectionId, options.domain)) : void 0;
47
47
  let connectionId = options.connectionId;
48
48
  let providerRepo;
@@ -180,6 +180,11 @@ function getForkInfo(repo) {
180
180
  }
181
181
  };
182
182
  }
183
+ function hostFromRemoteDomain(domain, scheme) {
184
+ const value = domain?.trim();
185
+ if (!value || !isWebRemoteScheme(scheme) || value.includes("://")) return hostFromDomain(value);
186
+ return hostFromDomain(`${scheme}${value}`);
187
+ }
183
188
  /** Whether `path` is `{x}/_git/{repo}`, the Azure repository path the remote parser reads without a project segment. */
184
189
  function isProjectlessAzurePath(path) {
185
190
  const segments = path?.split("/");
@@ -1 +1 @@
1
- {"version":3,"file":"resolveRepository.js","names":[],"sources":["../../../../../plus/integrations/src/reads/resolveRepository.ts"],"sourcesContent":["import type { RemoteProvider } from '@gitlens/git/models/remoteProvider.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport type { RemoteProviderConfig } from '@gitlens/git/remotes/matcher.js';\nimport { createRemoteProviderMatcher } from '@gitlens/git/remotes/matcher.js';\nimport { parseGitRemoteUrl } from '@gitlens/git/utils/remote.utils.js';\nimport { trimTrailingSlashes } from '@gitlens/utils/path.js';\nimport type { ConfiguredIntegrationDescriptor } from '../authentication/models.js';\nimport { mergeAssessmentInto } from '../collectionMetadata.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId } from '../constants.js';\nimport { AuthenticationError, RequestNotFoundError } from '../errors.js';\nimport { isIssuesIntegration } from '../models/issuesIntegration.js';\nimport { getAzureRepositoryIdentity } from '../providers/azure/azure.utils.js';\nimport type { ProviderRepository } from '../providers/models.js';\nimport { isAzureCloudDomain, isBitbucketCloudDomain, isGitHubDotCom, isGitLabDotCom } from '../providers/models.js';\nimport type { ProviderWarning, RepositoryIdentity, RepositoryResolution, ResolveRepositoryResult } from '../results.js';\nimport { toProviderWarning } from '../results.js';\nimport { decodePathSegment, getRemoteHostMatcher, hostFromDomain, isWebRemoteScheme } from '../utils/domain.utils.js';\nimport {\n\tgetIntegrationIdForRemote,\n\tgetSelfManagedBaseUrl,\n\tisGitCloudHostIntegrationId,\n\tisGitSelfManagedHostIntegrationId,\n\tremoteProviderTypeForConfig,\n\tremoteProviderTypeForIntegration,\n} from '../utils/integration.utils.js';\nimport type { RepositoryResolutionContext } from './context.js';\nimport { noConnectionWarning } from './warnings.js';\n\ntype ResolveRepositoryOptions = {\n\tproviderId?: IntegrationIds;\n\tremoteUrl: string;\n\thost?: string;\n\tconnectionId?: string;\n\t/**\n\t * Explicit self-managed host domain used to select the integration instance. Used only when the requested\n\t * connection has no configured domain; it must come from the trusted authentication configuration, not\n\t * repository or remote data.\n\t */\n\tdomain?: string;\n};\n\n/**\n * Resolution of a remote URL to a provider repository identity — the facade's equivalent of `gk repo resolve`.\n *\n * Unlike every other read here, this one's input is REPOSITORY data, so most of the code below is about not\n * letting that data choose the credentials: an explicit cloud `providerId` must agree with the remote's canonical\n * host, and a self-managed host resolves only against a domain the user already authenticated. The\n * `host-mismatch` returns are those guards, not edge cases — resolving `owner/repo` against the wrong account\n * would hand back a confidently wrong identity and seed the domain-keyed instance cache from remote data.\n */\nexport async function resolveRepository(\n\tctx: RepositoryResolutionContext,\n\toptions: ResolveRepositoryOptions,\n): Promise<ResolveRepositoryResult> {\n\tconst result = (status: RepositoryResolution['status']): ResolveRepositoryResult => ({\n\t\tresolution: { status: status },\n\t});\n\n\tconst [scheme, parsedDomain, parsedPath] = parseGitRemoteUrl(options.remoteUrl);\n\t// Git accepts a trailing slash but no provider's path carries one: GitLab wouldn't find it, and a host that does\n\t// would report the slashless name as a rename.\n\tconst path = trimTrailingSlashes(parsedPath);\n\t// An SSH remote's port belongs to its SSH daemon, not to the web authority a connection is keyed by.\n\tconst hostsMatch = getRemoteHostMatcher(scheme);\n\tconst parsedHost = hostFromDomain(parsedDomain);\n\tconst explicitHost = hostFromDomain(options.host);\n\tif (parsedHost != null && explicitHost != null && !hostsMatch(parsedHost, explicitHost)) {\n\t\treturn result('host-mismatch');\n\t}\n\n\tconst matcherDomain = parsedDomain || options.host || '';\n\n\t// An explicit cloud provider must agree with the remote's canonical cloud host. Without this guard the\n\t// synthetic matcher below can reinterpret, for example, a gitlab.com URL as GitHub and then resolve a\n\t// homonymous owner/repo through the wrong account. Match once without caller configs/synthetic entries;\n\t// Azure's matcher also normalizes ssh.dev.azure.com and vs-ssh.visualstudio.com to their web host.\n\tif (options.providerId != null && isGitCloudHostIntegrationId(options.providerId)) {\n\t\tconst nativeProvider = createRemoteProviderMatcher([])(options.remoteUrl, matcherDomain, path, scheme);\n\t\tconst nativeId = nativeProvider != null ? getIntegrationIdForRemote(nativeProvider) : undefined;\n\t\tconst nativeDomain = nativeProvider?.domain ?? matcherDomain;\n\t\tconst canonicalHost =\n\t\t\toptions.providerId === GitCloudHostIntegrationId.GitHub\n\t\t\t\t? isGitHubDotCom(nativeDomain)\n\t\t\t\t: options.providerId === GitCloudHostIntegrationId.GitLab\n\t\t\t\t\t? isGitLabDotCom(nativeDomain)\n\t\t\t\t\t: options.providerId === GitCloudHostIntegrationId.Bitbucket\n\t\t\t\t\t\t? isBitbucketCloudDomain(nativeDomain)\n\t\t\t\t\t\t: isAzureCloudDomain(nativeDomain);\n\t\tif (nativeId !== options.providerId || !canonicalHost) return result('host-mismatch');\n\t}\n\n\tlet provider = createRemoteProviderMatcher(buildMatcherConfigs(ctx, options, parsedDomain))(\n\t\toptions.remoteUrl,\n\t\tmatcherDomain,\n\t\tpath,\n\t\tscheme,\n\t);\n\tif (provider == null) return result('invalid-remote-url');\n\n\tlet id = options.providerId ?? getIntegrationIdForRemote(provider);\n\t// Custom Azure DevOps Server domains matched via getRemoteConfigs return undefined from\n\t// getIntegrationIdForRemote because the provider is marked custom; map them to the server id so the\n\t// project-scoped lookup uses that host's configured connection and API base URL.\n\tif (id == null && provider.id === 'azure-devops' && provider.custom) {\n\t\tid = GitSelfManagedHostIntegrationId.AzureDevOpsServer;\n\t}\n\tif (id == null) return result('unsupported-provider');\n\n\t// On a self-managed host, resolve only against a TRUSTED host: the pinned connection's configured\n\t// domain, the explicit `domain`, or — when neither was supplied — a configured host matching the\n\t// remote's. That last case keeps `remoteUrl` (repository-supplied) out of the trusted path: it selects\n\t// among hosts the user already authenticated and can never introduce a new one. Resolving `owner/repo`\n\t// against some other host's account would, if that host has the same owner/repo, return a confidently\n\t// wrong identity — and would seed the domain-keyed integration cache (never evicted before dispose) with\n\t// an entry derived from repository data.\n\tconst urlHost = hostFromDomain(provider.domain);\n\t// Normalize BOTH sides before comparing: a stored connection domain is usually a full URL\n\t// (`https://git.example.com`) while `urlHost` is already a bare host, so a raw compare would fail on\n\t// scheme/trailing-slash alone and wrongly reject a correctly-configured connection.\n\tlet trustedHost =\n\t\toptions.connectionId != null || options.domain != null\n\t\t\t? hostFromDomain(ctx.resolveDomainForRead(id, options.connectionId, options.domain))\n\t\t\t: undefined;\n\tlet connectionId = options.connectionId;\n\tlet providerRepo: ResourceDescriptor | undefined;\n\tif (isGitSelfManagedHostIntegrationId(id)) {\n\t\tif (path.split('/').some(segment => /^(?:\\.|%2e){1,2}$/i.test(segment) || /%2f|%5c|\\\\/i.test(segment))) {\n\t\t\treturn result('invalid-remote-url');\n\t\t}\n\n\t\tconst configured = ctx.getConfigured(id);\n\t\tconst configuredHosts = configured.map(c => hostFromDomain(c.domain));\n\t\tif (trustedHost == null && urlHost != null) {\n\t\t\tconst matchingHosts = new Set(configuredHosts.filter(host => hostsMatch(host, urlHost)));\n\t\t\tif (matchingHosts.size > 1) return result('host-mismatch');\n\n\t\t\ttrustedHost = matchingHosts.values().next().value;\n\t\t}\n\t\t// A configured host that doesn't match the remote's is a genuine mismatch. With nothing configured\n\t\t// there is no host to mismatch against — it's simply not connected, so fall through to the\n\t\t// `unauthorized` path below (still WITHOUT resolving by the URL domain, so repo data can't seed the\n\t\t// cache).\n\t\tif (trustedHost == null && configuredHosts.length !== 0) return result('host-mismatch');\n\t\tif (trustedHost != null && urlHost != null && !hostsMatch(trustedHost, urlHost)) {\n\t\t\treturn result('host-mismatch');\n\t\t}\n\n\t\tconst installation = matchInstallation(\n\t\t\tctx,\n\t\t\toptions,\n\t\t\tid,\n\t\t\tconfigured.filter(c => hostFromDomain(c.domain) === trustedHost),\n\t\t\t{ scheme: scheme, domain: parsedDomain, path: path },\n\t\t);\n\t\tif (typeof installation === 'string') return result(installation);\n\n\t\tif (installation != null) {\n\t\t\tprovider = installation.provider;\n\t\t\tconnectionId = installation.connectionId;\n\t\t\tproviderRepo = installation.repoDesc;\n\t\t}\n\t}\n\n\tconst owner = provider.owner;\n\tconst name = provider.repoName;\n\tif (owner == null || name == null) return result('invalid-remote-url');\n\n\tproviderRepo ??= provider.repoDesc;\n\n\tlet integration;\n\ttry {\n\t\t// Resolve the instance through the trusted target (as `getIntegrationForRead` does):\n\t\t// `resolveReadSession` looks the session up against the instance's domain-scoped descriptor, so\n\t\t// selecting the instance by the URL domain could miss the session and degrade to `no-connection`.\n\t\tintegration = isGitSelfManagedHostIntegrationId(id)\n\t\t\t? trustedHost != null\n\t\t\t\t? await ctx.getIntegrationForRead(id, connectionId, trustedHost)\n\t\t\t\t: undefined\n\t\t\t: await ctx.getIntegrationForDomain(id, provider.domain);\n\t} catch {\n\t\tintegration = undefined;\n\t}\n\tif (integration == null) {\n\t\t// Attach a warning, as the thrown-AuthenticationError branch below does: a consumer driving auth\n\t\t// recovery off `warning.kind` would otherwise get nothing for an unresolvable target.\n\t\treturn {\n\t\t\tresolution: {\n\t\t\t\tstatus: 'unauthorized',\n\t\t\t\twarning: noConnectionWarning(id, provider.domain, connectionId),\n\t\t\t},\n\t\t};\n\t}\n\t// Issue trackers have no `getRepo` client; a git host without `getRepoFn` leaves `getRepoInfo`\n\t// undefined. Either way this provider can't resolve repositories.\n\tif (isIssuesIntegration(integration) || integration.getRepoInfo == null) {\n\t\treturn result('unsupported-provider');\n\t}\n\n\t// Azure repos are org + project scoped; the remote provider exposes project as `providerDesc.repoDomain`.\n\tconst project = provider.id === 'azure-devops' ? provider.providerDesc?.repoDomain : undefined;\n\tconst domain = trustedHost ?? provider.domain;\n\n\t// Azure's lookup is project-scoped and returns `undefined` without one, which the connection-gap branch\n\t// below would misreport as `unauthorized` (driving a pointless reconnect). A remote URL that carries no\n\t// project simply can't address an Azure repo.\n\tif (provider.id === 'azure-devops' && project == null) return result('invalid-remote-url');\n\n\t// Azure names the repository bare and its project apart, where the remote names `{project}/_git/{repo}`.\n\tconst repositoryName =\n\t\tproject != null ? getAzureRepositoryIdentity({ owner: owner, name: name }).repositoryName : name;\n\n\ttry {\n\t\tconst repo = await integration.getRepoInfo({\n\t\t\t...providerRepo,\n\t\t\towner: owner,\n\t\t\tname: name,\n\t\t\tproject: project,\n\t\t\tconnectionId: connectionId,\n\t\t});\n\t\tif (repo == null) {\n\t\t\t// `getRepoInfo` returns undefined only when no session could be resolved (not connected, or the\n\t\t\t// requested connection is gone) — a real 404 throws below. So this is a connection gap. Attach a\n\t\t\t// warning so a consumer driving auth recovery off `warning.kind` sees the same signal it gets from\n\t\t\t// the thrown-AuthenticationError branch below; without it, the most common unauthorized case is\n\t\t\t// silent.\n\t\t\treturn {\n\t\t\t\tresolution: {\n\t\t\t\t\tstatus: 'unauthorized',\n\t\t\t\t\twarning: noConnectionWarning(id, domain, connectionId),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Prefer the provider's canonical namespace/name (GitHub's REST/GraphQL lookup follows the 301\n\t\t// rename redirect, so a stale old name resolves to the new canonical identity), falling back to where the\n\t\t// repository was read when the response omits them. `renamed` is a case-insensitive compare of that against\n\t\t// canonical, mirroring gkcli's `EqualFold`, so hosts that merely echo the input casing (e.g.\n\t\t// Bitbucket Server/Azure) don't get spuriously flagged. An Azure DevOps Server remote's path may be read as\n\t\t// another collection and project than the parser read (see `AzureDevOpsServerIntegration.getRepositoryTarget`),\n\t\t// which is no rename, so the compare is against where it was read. Owner and name are compared joined, because\n\t\t// the sides split a GitLab nested group differently: the remote at its first slash, the SDK at its last.\n\t\tconst readAt = repo.readAt ?? { owner: owner, name: repositoryName, project: project };\n\t\tconst canonicalOwner = repo.namespace || readAt.owner;\n\t\tconst canonicalName = repo.name || readAt.name;\n\t\tconst readAtProject = project != null ? readAt.project || project : undefined;\n\t\tconst canonicalProject = readAtProject != null ? repo.project || readAtProject : undefined;\n\t\tconst differs = (a: string | undefined, b: string | undefined) => a?.toLowerCase() !== b?.toLowerCase();\n\t\tconst renamed =\n\t\t\tdiffers(`${canonicalOwner}/${canonicalName}`, `${readAt.owner}/${readAt.name}`) ||\n\t\t\tdiffers(canonicalProject, readAtProject);\n\n\t\tconst identity: RepositoryIdentity = {\n\t\t\tproviderId: id,\n\t\t\tdomain: domain,\n\t\t\towner: canonicalOwner,\n\t\t\tname: canonicalName,\n\t\t\tproject: canonicalProject,\n\t\t\tremoteUrl: options.remoteUrl,\n\t\t\trenamed: renamed,\n\t\t\t...getForkInfo(repo),\n\t\t};\n\t\treturn { resolution: { status: 'resolved', identity: identity } };\n\t} catch (ex) {\n\t\t// Order matters: 404 throws RequestNotFoundError (not `undefined`), so check not-found before auth\n\t\t// and before the generic 5xx/unknown bucket — never classify a 401/403 as not-found.\n\t\tlet resolution: RepositoryResolution;\n\t\tif (ex instanceof RequestNotFoundError) {\n\t\t\tresolution = { status: 'not-found' };\n\t\t} else if (ex instanceof AuthenticationError) {\n\t\t\t// One repository refusing a credential that works (e.g. GitHub's OAuth App access restrictions) is that\n\t\t\t// repository's warning, scoped and with its cause, not a dead connection's.\n\t\t\tlet warning = toProviderWarning(id, domain, connectionId, ex);\n\t\t\ttry {\n\t\t\t\tconst failure = await integration.settleRepositoryRefusal(\n\t\t\t\t\t{\n\t\t\t\t\t\towner: owner,\n\t\t\t\t\t\tname: repositoryName,\n\t\t\t\t\t\tproject: project,\n\t\t\t\t\t\tconnectionId: connectionId,\n\t\t\t\t\t},\n\t\t\t\t\tex,\n\t\t\t\t);\n\t\t\t\tif (failure != null) {\n\t\t\t\t\tconst warnings: ProviderWarning[] = [];\n\t\t\t\t\tmergeAssessmentInto(warnings, id, domain, connectionId, {\n\t\t\t\t\t\tcompleteness: 'partial',\n\t\t\t\t\t\tfailures: [failure],\n\t\t\t\t\t});\n\t\t\t\t\twarning = warnings[0] ?? warning;\n\t\t\t\t}\n\t\t\t} catch (credentialError) {\n\t\t\t\tif (credentialError instanceof AuthenticationError) {\n\t\t\t\t\twarning = toProviderWarning(id, domain, connectionId, credentialError);\n\t\t\t\t}\n\t\t\t}\n\t\t\tresolution = {\n\t\t\t\tstatus: 'unauthorized',\n\t\t\t\twarning: warning,\n\t\t\t};\n\t\t} else {\n\t\t\tresolution = { status: 'undetermined', warning: toProviderWarning(id, domain, connectionId, ex) };\n\t\t}\n\t\treturn { resolution: resolution };\n\t}\n}\n\n/**\n * The fork fields of a provider repository. `namespace` is the owner, workspace, project key, Azure organization or\n * GitLab group path (`group/subgroup`), as the SDK uses it elsewhere. A named parent is itself a report of a fork, so\n * it settles an unreported `isFork` to `true`; one beside `isFork: false` contradicts the flag and is dropped. So is\n * one with an empty namespace or name: the type allows it, and GitLab's is split from a path the server sends, which\n * leaves no namespace when it has no `/`. It can't address a repository, but the fork is still reported.\n */\nfunction getForkInfo(repo: ProviderRepository): Pick<RepositoryIdentity, 'isFork' | 'parent'> {\n\tconst { isFork, parent } = repo;\n\tif (isFork === false || !parent?.namespace || !parent.name) return { isFork: isFork };\n\n\treturn {\n\t\tisFork: true,\n\t\tparent: {\n\t\t\towner: parent.namespace,\n\t\t\tname: parent.name,\n\t\t\t...(parent.project ? { project: parent.project } : {}),\n\t\t},\n\t};\n}\n\n/** Whether `path` is `{x}/_git/{repo}`, the Azure repository path the remote parser reads without a project segment. */\nfunction isProjectlessAzurePath(path: string | undefined): boolean {\n\tconst segments = path?.split('/');\n\treturn segments?.length === 3 && decodePathSegment(segments[1]).toLowerCase() === '_git';\n}\n\n/**\n * Narrows a web remote on a self-managed host to the configured installation it lives under: the pinned\n * connection's or, unpinned, the one whose installation path is the longest prefix of the remote's, so two\n * installations behind one host each resolve with their own credentials. The provider is re-matched against the\n * path relative to that installation, because the remote parsers expect the repository path to start at the\n * host root. An SSH remote carries no installation path, so it is left to the host-level checks.\n */\nfunction matchInstallation(\n\tctx: RepositoryResolutionContext,\n\toptions: ResolveRepositoryOptions,\n\tid: GitSelfManagedHostIntegrationId,\n\tconnections: ConfiguredIntegrationDescriptor[],\n\tremote: { scheme: string; domain: string; path: string },\n):\n\t| { provider: RemoteProvider; connectionId: string | undefined; repoDesc: ResourceDescriptor }\n\t| 'host-mismatch'\n\t| 'invalid-remote-url'\n\t| undefined {\n\tif (!isWebRemoteScheme(remote.scheme)) return undefined;\n\n\tconst installationPath = (connection: ConfiguredIntegrationDescriptor | undefined): string | undefined => {\n\t\tconst baseUrl = getSelfManagedBaseUrl(\n\t\t\tid,\n\t\t\tconnection != null ? (connection.baseUrl ?? connection.domain) : options.domain,\n\t\t);\n\t\treturn baseUrl != null ? trimTrailingSlashes(new URL(baseUrl).pathname) : undefined;\n\t};\n\n\t// The connection an unpinned read already targets comes first, so it wins a tie between installations.\n\tconst defaultConnection = connections.find(c => c.primary) ?? connections[0];\n\t// A cloud sync serves the host's cloud-scoped default instead, even over a local primary (see\n\t// `getStoredSession`), so an unpinned read reaches the default's installation only when both agree.\n\tconst cloudConnections = connections.filter(c => c.cloud);\n\tconst cloudDefault = cloudConnections.find(c => c.primary) ?? cloudConnections[0];\n\tconst isDefaultReadable =\n\t\tdefaultConnection?.cloud !== false ||\n\t\tcloudDefault == null ||\n\t\tinstallationPath(cloudDefault) === installationPath(defaultConnection);\n\t// Whether an unpinned read can reach this connection's session: the default one is read without an id, any\n\t// other only by a real cloud token id. Session lookup treats every connection id as one, and a local (PAT)\n\t// descriptor's or domain-derived legacy id is not (see `getConfiguredConnectionId`).\n\tconst isReadable = (connection: ConfiguredIntegrationDescriptor | undefined): boolean =>\n\t\toptions.connectionId != null ||\n\t\t(connection === defaultConnection\n\t\t\t? isDefaultReadable\n\t\t\t: connection?.cloud === true && hostFromDomain(connection.id) !== connection.domain);\n\n\tconst candidates: (ConfiguredIntegrationDescriptor | undefined)[] =\n\t\toptions.connectionId != null\n\t\t\t? connections.filter(c => c.id === options.connectionId)\n\t\t\t: [defaultConnection, ...connections.filter(c => c !== defaultConnection)];\n\t// With no configured candidate, the explicit (trusted) `domain` is the only installation address there is.\n\tif (!candidates.length) {\n\t\tcandidates.push(undefined);\n\t}\n\n\tconst remotePath = `/${remote.path}`;\n\tconst remoteSegments = remote.path.split('/');\n\t// The remote's path below an installation, or `undefined` when it isn't under it. Azure DevOps Server runs on\n\t// IIS, which serves its paths decoded and case-insensitively, so it compares segment by segment.\n\tconst relativeTo = (basePath: string): string | undefined => {\n\t\tif (id !== GitSelfManagedHostIntegrationId.AzureDevOpsServer) {\n\t\t\treturn remotePath.startsWith(`${basePath}/`) ? remotePath.slice(basePath.length + 1) : undefined;\n\t\t}\n\n\t\tconst baseSegments = basePath.split('/').filter(Boolean);\n\t\tconst isUnder =\n\t\t\tremoteSegments.length > baseSegments.length &&\n\t\t\tbaseSegments.every(\n\t\t\t\t(segment, i) =>\n\t\t\t\t\tdecodePathSegment(segment).toLowerCase() === decodePathSegment(remoteSegments[i]).toLowerCase(),\n\t\t\t);\n\t\treturn isUnder ? remoteSegments.slice(baseSegments.length).join('/') : undefined;\n\t};\n\tlet match: { connection: ConfiguredIntegrationDescriptor | undefined; basePath: string } | undefined;\n\tlet checked = false;\n\tfor (const connection of candidates) {\n\t\tconst basePath = installationPath(connection);\n\t\tif (basePath == null) continue;\n\n\t\tchecked = true;\n\t\tif (relativeTo(basePath) == null) continue;\n\n\t\t// The longest installation wins; on a tie, a readable connection replaces an unreadable one.\n\t\tconst isBetter =\n\t\t\tmatch == null ||\n\t\t\tbasePath.length > match.basePath.length ||\n\t\t\t(basePath.length === match.basePath.length && !isReadable(match.connection) && isReadable(connection));\n\t\tif (isBetter) {\n\t\t\tmatch = { connection: connection, basePath: basePath };\n\t\t}\n\t}\n\tif (match == null) return checked ? 'host-mismatch' : undefined;\n\t// Reading through the default connection instead would address its installation with a path relative to\n\t// another one, so an unreachable installation fails closed.\n\tif (!isReadable(match.connection)) return 'host-mismatch';\n\n\tconst connectionId =\n\t\toptions.connectionId ?? (match.connection !== defaultConnection ? match.connection?.id : undefined);\n\n\tconst matcher = createRemoteProviderMatcher(\n\t\tbuildMatcherConfigs(ctx, { ...options, providerId: id }, remote.domain),\n\t);\n\tconst rematch = (path: string) => matcher(options.remoteUrl, remote.domain, relativeTo(path) ?? '', remote.scheme);\n\tlet basePath = match.basePath;\n\tlet provider = rematch(basePath);\n\tif (id !== GitSelfManagedHostIntegrationId.AzureDevOpsServer) {\n\t\treturn provider != null\n\t\t\t? { provider: provider, connectionId: connectionId, repoDesc: provider.repoDesc }\n\t\t\t: 'invalid-remote-url';\n\t}\n\n\t// An Azure DevOps Server address may name the collection as well as the virtual directory; the parser expects\n\t// the collection in the path, so re-base on the address's parent when no project was found. A relative\n\t// `{x}/_git/{repo}` re-bases too: `x` is a collection only if the address is the installation rather than a\n\t// collection, which the path can't tell, so the integration settles it against the collections it discovers.\n\tif (basePath && (provider?.providerDesc?.repoDomain == null || isProjectlessAzurePath(relativeTo(basePath)))) {\n\t\tbasePath = basePath.slice(0, basePath.lastIndexOf('/'));\n\t\tprovider = rematch(basePath);\n\t}\n\tif (provider == null) return 'invalid-remote-url';\n\n\t// Requests address the repository's virtual directory from the host root, not from the installation the\n\t// re-match made it relative to; the absolute form also tells a directory apart from a collection of that name.\n\tconst repoDesc = provider.repoDesc;\n\tconst relative = typeof repoDesc.virtualDirectory === 'string' ? repoDesc.virtualDirectory : undefined;\n\tconst virtualDirectory =\n\t\t[...basePath.split('/').filter(Boolean).map(decodePathSegment), ...(relative?.split('/') ?? [])].join('/') ||\n\t\tundefined;\n\treturn {\n\t\tprovider: provider,\n\t\tconnectionId: connectionId,\n\t\trepoDesc: { ...repoDesc, virtualDirectory: virtualDirectory },\n\t};\n}\n\n/**\n * The remote-matcher configs for this resolution: the user's own host remote configs (self-managed/custom\n * domains), plus a synthetic exact-domain entry for an explicit `providerId` + host so a custom domain still maps\n * to the right provider for path parsing.\n */\nfunction buildMatcherConfigs(\n\tctx: RepositoryResolutionContext,\n\toptions: { providerId?: IntegrationIds; host?: string },\n\tparsedDomain: string,\n): RemoteProviderConfig[] {\n\tconst configs: RemoteProviderConfig[] = [];\n\tfor (const cfg of ctx.getRemoteConfigs()) {\n\t\tconst type = remoteProviderTypeForConfig(cfg.type);\n\t\tif (type == null) continue;\n\n\t\t// Forward both domain- and regex-based custom remotes (carrying any protocol override), so a\n\t\t// regex-configured host resolves instead of falling through to `unsupported`.\n\t\tif (cfg.domain) {\n\t\t\tconfigs.push({ type: type, domain: cfg.domain, protocol: cfg.protocol });\n\t\t} else if (cfg.regex) {\n\t\t\tconfigs.push({ type: type, regex: cfg.regex, protocol: cfg.protocol });\n\t\t}\n\t}\n\tif (options.providerId == null) return configs;\n\n\tconst type = remoteProviderTypeForIntegration(options.providerId);\n\tconst domain = parsedDomain || options.host;\n\tif (type == null || !domain) return configs;\n\n\t// The synthetic exact-domain entry is unshifted to the front, so it wins the match over the user's own\n\t// config for the same host. Carry that config's protocol override across (matched by domain or regex,\n\t// mirroring `ignoreSSLErrors`) so a self-managed host configured for a custom protocol — e.g. plain\n\t// `http` — isn't silently downgraded to the provider default here.\n\tconst lowerDomain = domain.toLowerCase();\n\tconst protocol = configs.find(c => {\n\t\tif (c.type !== type) return false;\n\t\tif (c.domain != null) return c.domain.toLowerCase() === lowerDomain;\n\n\t\t// Truthy (not just non-null): an empty regex would compile to a match-everything pattern.\n\t\tif (c.regex) {\n\t\t\ttry {\n\t\t\t\treturn new RegExp(c.regex, 'i').test(lowerDomain);\n\t\t\t} catch {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t})?.protocol;\n\tconfigs.unshift({ type: type, domain: domain, protocol: protocol });\n\treturn configs;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmDA,eAAsB,kBACrB,KACA,SACmC;CACnC,MAAM,UAAU,YAAqE,EACpF,YAAY,EAAU,OAAO,EAC9B;CAEA,MAAM,CAAC,QAAQ,cAAc,cAAc,kBAAkB,QAAQ,SAAS;CAG9E,MAAM,OAAO,oBAAoB,UAAU;CAE3C,MAAM,aAAa,qBAAqB,MAAM;CAC9C,MAAM,aAAa,eAAe,YAAY;CAC9C,MAAM,eAAe,eAAe,QAAQ,IA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UAAU;GAAE,GAAG;GAA4B;EAAiB;CAC7D;AACD;;;;;;AAOA,SAAS,oBACR,KACA,SACA,cACyB;CACzB,MAAM,UAAkC,CAAC;CACzC,KAAK,MAAM,OAAO,IAAI,iBAAiB,GAAG;EACzC,MAAM,OAAO,4BAA4B,IAAI,IAAI;EACjD,IAAI,QAAQ,MAAM;EAIlB,IAAI,IAAI,QACP,QAAQ,KAAK;GAAQ;GAAM,QAAQ,IAAI;GAAQ,UAAU,IAAI;EAAS,CAAC;OACjE,IAAI,IAAI,OACd,QAAQ,KAAK;GAAQ;GAAM,OAAO,IAAI;GAAO,UAAU,IAAI;EAAS,CAAC;CAEvE;CACA,IAAI,QAAQ,cAAc,MAAM,OAAO;CAEvC,MAAM,OAAO,iCAAiC,QAAQ,UAAU;CAChE,MAAM,SAAS,gBAAgB,QAAQ;CACvC,IAAI,QAAQ,QAAQ,CAAC,QAAQ,OAAO;CAMpC,MAAM,cAAc,OAAO,YAAY;CACvC,MAAM,WAAW,QAAQ,MAAK,MAAK;EAClC,IAAI,EAAE,SAAS,MAAM,OAAO;EAC5B,IAAI,EAAE,UAAU,MAAM,OAAO,EAAE,OAAO,YAAY,MAAM;EAGxD,IAAI,EAAE,OACL,IAAI;GACH,OAAO,IAAI,OAAO,EAAE,OAAO,GAAG,CAAC,CAAC,KAAK,WAAW;EACjD,QAAQ;GACP,OAAO;EACR;EAGD,OAAO;CACR,CAAC,CAAC,EAAE;CACJ,QAAQ,QAAQ;EAAQ;EAAc;EAAkB;CAAS,CAAC;CAClE,OAAO;AACR"}
1
+ {"version":3,"file":"resolveRepository.js","names":[],"sources":["../../../../../plus/integrations/src/reads/resolveRepository.ts"],"sourcesContent":["import type { RemoteProvider } from '@gitlens/git/models/remoteProvider.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport type { RemoteProviderConfig } from '@gitlens/git/remotes/matcher.js';\nimport { createRemoteProviderMatcher } from '@gitlens/git/remotes/matcher.js';\nimport { parseGitRemoteUrl } from '@gitlens/git/utils/remote.utils.js';\nimport { trimTrailingSlashes } from '@gitlens/utils/path.js';\nimport type { ConfiguredIntegrationDescriptor } from '../authentication/models.js';\nimport { mergeAssessmentInto } from '../collectionMetadata.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId } from '../constants.js';\nimport { AuthenticationError, RequestNotFoundError } from '../errors.js';\nimport { isIssuesIntegration } from '../models/publicIntegration.js';\nimport { getAzureRepositoryIdentity } from '../providers/azure/azure.utils.js';\nimport { isAzureCloudDomain, isBitbucketCloudDomain, isGitHubDotCom, isGitLabDotCom } from '../providers/metadata.js';\nimport type { ProviderRepository } from '../providers/models.js';\nimport type { ProviderWarning, RepositoryIdentity, RepositoryResolution, ResolveRepositoryResult } from '../results.js';\nimport { toProviderWarning } from '../results.js';\nimport { decodePathSegment, getRemoteHostMatcher, hostFromDomain, isWebRemoteScheme } from '../utils/domain.utils.js';\nimport {\n\tgetIntegrationIdForRemote,\n\tgetSelfManagedBaseUrl,\n\tisGitCloudHostIntegrationId,\n\tisGitSelfManagedHostIntegrationId,\n\tremoteProviderTypeForConfig,\n\tremoteProviderTypeForIntegration,\n} from '../utils/integration.utils.js';\nimport type { RepositoryResolutionContext } from './context.js';\nimport { noConnectionWarning } from './warnings.js';\n\ntype ResolveRepositoryOptions = {\n\tproviderId?: IntegrationIds;\n\tremoteUrl: string;\n\thost?: string;\n\tconnectionId?: string;\n\t/**\n\t * Explicit self-managed host domain used to select the integration instance. Used only when the requested\n\t * connection has no configured domain; it must come from the trusted authentication configuration, not\n\t * repository or remote data.\n\t */\n\tdomain?: string;\n};\n\n/**\n * Resolution of a remote URL to a provider repository identity — the facade's equivalent of `gk repo resolve`.\n *\n * Unlike every other read here, this one's input is REPOSITORY data, so most of the code below is about not\n * letting that data choose the credentials: an explicit cloud `providerId` must agree with the remote's canonical\n * host, and a self-managed host resolves only against a domain the user already authenticated. The\n * `host-mismatch` returns are those guards, not edge cases — resolving `owner/repo` against the wrong account\n * would hand back a confidently wrong identity and seed the domain-keyed instance cache from remote data.\n */\nexport async function resolveRepository(\n\tctx: RepositoryResolutionContext,\n\toptions: ResolveRepositoryOptions,\n): Promise<ResolveRepositoryResult> {\n\tconst result = (status: RepositoryResolution['status']): ResolveRepositoryResult => ({\n\t\tresolution: { status: status },\n\t});\n\n\tconst [scheme, parsedDomain, parsedPath] = parseGitRemoteUrl(options.remoteUrl);\n\t// Git accepts a trailing slash but no provider's path carries one: GitLab wouldn't find it, and a host that does\n\t// would report the slashless name as a rename.\n\tconst path = trimTrailingSlashes(parsedPath);\n\t// An SSH remote's port belongs to its SSH daemon, not to the web authority a connection is keyed by.\n\tconst hostsMatch = getRemoteHostMatcher(scheme);\n\tconst parsedHost = hostFromRemoteDomain(parsedDomain, scheme);\n\tconst explicitHost = hostFromRemoteDomain(options.host, scheme);\n\tif (parsedHost != null && explicitHost != null && !hostsMatch(parsedHost, explicitHost)) {\n\t\treturn result('host-mismatch');\n\t}\n\n\tconst matcherDomain = parsedDomain || options.host || '';\n\n\t// An explicit cloud provider must agree with the remote's canonical cloud host. Without this guard the\n\t// synthetic matcher below can reinterpret, for example, a gitlab.com URL as GitHub and then resolve a\n\t// homonymous owner/repo through the wrong account. Match once without caller configs/synthetic entries;\n\t// Azure's matcher also normalizes ssh.dev.azure.com and vs-ssh.visualstudio.com to their web host.\n\tif (options.providerId != null && isGitCloudHostIntegrationId(options.providerId)) {\n\t\tconst nativeProvider = createRemoteProviderMatcher([])(options.remoteUrl, matcherDomain, path, scheme);\n\t\tconst nativeId = nativeProvider != null ? getIntegrationIdForRemote(nativeProvider) : undefined;\n\t\tconst nativeDomain = nativeProvider?.domain ?? matcherDomain;\n\t\tconst canonicalHost =\n\t\t\toptions.providerId === GitCloudHostIntegrationId.GitHub\n\t\t\t\t? isGitHubDotCom(nativeDomain)\n\t\t\t\t: options.providerId === GitCloudHostIntegrationId.GitLab\n\t\t\t\t\t? isGitLabDotCom(nativeDomain)\n\t\t\t\t\t: options.providerId === GitCloudHostIntegrationId.Bitbucket\n\t\t\t\t\t\t? isBitbucketCloudDomain(nativeDomain)\n\t\t\t\t\t\t: isAzureCloudDomain(nativeDomain);\n\t\tif (nativeId !== options.providerId || !canonicalHost) return result('host-mismatch');\n\t}\n\n\tlet provider = createRemoteProviderMatcher(buildMatcherConfigs(ctx, options, parsedDomain))(\n\t\toptions.remoteUrl,\n\t\tmatcherDomain,\n\t\tpath,\n\t\tscheme,\n\t);\n\tif (provider == null) return result('invalid-remote-url');\n\n\tlet id = options.providerId ?? getIntegrationIdForRemote(provider);\n\t// Custom Azure DevOps Server domains matched via getRemoteConfigs return undefined from\n\t// getIntegrationIdForRemote because the provider is marked custom; map them to the server id so the\n\t// project-scoped lookup uses that host's configured connection and API base URL.\n\tif (id == null && provider.id === 'azure-devops' && provider.custom) {\n\t\tid = GitSelfManagedHostIntegrationId.AzureDevOpsServer;\n\t}\n\tif (id == null) return result('unsupported-provider');\n\n\t// On a self-managed host, resolve only against a TRUSTED host: the pinned connection's configured\n\t// domain, the explicit `domain`, or — when neither was supplied — a configured host matching the\n\t// remote's. That last case keeps `remoteUrl` (repository-supplied) out of the trusted path: it selects\n\t// among hosts the user already authenticated and can never introduce a new one. Resolving `owner/repo`\n\t// against some other host's account would, if that host has the same owner/repo, return a confidently\n\t// wrong identity — and would seed the domain-keyed integration cache (never evicted before dispose) with\n\t// an entry derived from repository data.\n\tconst urlHost = hostFromRemoteDomain(provider.domain, scheme);\n\t// Normalize BOTH sides before comparing: a stored connection domain is usually a full URL\n\t// (`https://git.example.com`) while `urlHost` is already a bare host, so a raw compare would fail on\n\t// scheme/trailing-slash alone and wrongly reject a correctly-configured connection.\n\tlet trustedHost =\n\t\toptions.connectionId != null || options.domain != null\n\t\t\t? hostFromDomain(ctx.resolveDomainForRead(id, options.connectionId, options.domain))\n\t\t\t: undefined;\n\tlet connectionId = options.connectionId;\n\tlet providerRepo: ResourceDescriptor | undefined;\n\tif (isGitSelfManagedHostIntegrationId(id)) {\n\t\tif (path.split('/').some(segment => /^(?:\\.|%2e){1,2}$/i.test(segment) || /%2f|%5c|\\\\/i.test(segment))) {\n\t\t\treturn result('invalid-remote-url');\n\t\t}\n\n\t\tconst configured = ctx.getConfigured(id);\n\t\tconst configuredHosts = configured.map(c => hostFromDomain(c.domain));\n\t\tif (trustedHost == null && urlHost != null) {\n\t\t\tconst matchingHosts = new Set(configuredHosts.filter(host => hostsMatch(host, urlHost)));\n\t\t\tif (matchingHosts.size > 1) return result('host-mismatch');\n\n\t\t\ttrustedHost = matchingHosts.values().next().value;\n\t\t}\n\t\t// A configured host that doesn't match the remote's is a genuine mismatch. With nothing configured\n\t\t// there is no host to mismatch against — it's simply not connected, so fall through to the\n\t\t// `unauthorized` path below (still WITHOUT resolving by the URL domain, so repo data can't seed the\n\t\t// cache).\n\t\tif (trustedHost == null && configuredHosts.length !== 0) return result('host-mismatch');\n\t\tif (trustedHost != null && urlHost != null && !hostsMatch(trustedHost, urlHost)) {\n\t\t\treturn result('host-mismatch');\n\t\t}\n\n\t\tconst installation = matchInstallation(\n\t\t\tctx,\n\t\t\toptions,\n\t\t\tid,\n\t\t\tconfigured.filter(c => hostFromDomain(c.domain) === trustedHost),\n\t\t\t{ scheme: scheme, domain: parsedDomain, path: path },\n\t\t);\n\t\tif (typeof installation === 'string') return result(installation);\n\n\t\tif (installation != null) {\n\t\t\tprovider = installation.provider;\n\t\t\tconnectionId = installation.connectionId;\n\t\t\tproviderRepo = installation.repoDesc;\n\t\t}\n\t}\n\n\tconst owner = provider.owner;\n\tconst name = provider.repoName;\n\tif (owner == null || name == null) return result('invalid-remote-url');\n\n\tproviderRepo ??= provider.repoDesc;\n\n\tlet integration;\n\ttry {\n\t\t// Resolve the instance through the trusted target (as `getIntegrationForRead` does):\n\t\t// `resolveReadSession` looks the session up against the instance's domain-scoped descriptor, so\n\t\t// selecting the instance by the URL domain could miss the session and degrade to `no-connection`.\n\t\tintegration = isGitSelfManagedHostIntegrationId(id)\n\t\t\t? trustedHost != null\n\t\t\t\t? await ctx.getIntegrationForRead(id, connectionId, trustedHost)\n\t\t\t\t: undefined\n\t\t\t: await ctx.getIntegrationForDomain(id, provider.domain);\n\t} catch {\n\t\tintegration = undefined;\n\t}\n\tif (integration == null) {\n\t\t// Attach a warning, as the thrown-AuthenticationError branch below does: a consumer driving auth\n\t\t// recovery off `warning.kind` would otherwise get nothing for an unresolvable target.\n\t\treturn {\n\t\t\tresolution: {\n\t\t\t\tstatus: 'unauthorized',\n\t\t\t\twarning: noConnectionWarning(id, provider.domain, connectionId),\n\t\t\t},\n\t\t};\n\t}\n\t// Issue trackers have no `getRepo` client; a git host without `getRepoFn` leaves `getRepoInfo`\n\t// undefined. Either way this provider can't resolve repositories.\n\tif (isIssuesIntegration(integration) || integration.getRepoInfo == null) {\n\t\treturn result('unsupported-provider');\n\t}\n\n\t// Azure repos are org + project scoped; the remote provider exposes project as `providerDesc.repoDomain`.\n\tconst project = provider.id === 'azure-devops' ? provider.providerDesc?.repoDomain : undefined;\n\tconst domain = trustedHost ?? provider.domain;\n\n\t// Azure's lookup is project-scoped and returns `undefined` without one, which the connection-gap branch\n\t// below would misreport as `unauthorized` (driving a pointless reconnect). A remote URL that carries no\n\t// project simply can't address an Azure repo.\n\tif (provider.id === 'azure-devops' && project == null) return result('invalid-remote-url');\n\n\t// Azure names the repository bare and its project apart, where the remote names `{project}/_git/{repo}`.\n\tconst repositoryName =\n\t\tproject != null ? getAzureRepositoryIdentity({ owner: owner, name: name }).repositoryName : name;\n\n\ttry {\n\t\tconst repo = await integration.getRepoInfo({\n\t\t\t...providerRepo,\n\t\t\towner: owner,\n\t\t\tname: name,\n\t\t\tproject: project,\n\t\t\tconnectionId: connectionId,\n\t\t});\n\t\tif (repo == null) {\n\t\t\t// `getRepoInfo` returns undefined only when no session could be resolved (not connected, or the\n\t\t\t// requested connection is gone) — a real 404 throws below. So this is a connection gap. Attach a\n\t\t\t// warning so a consumer driving auth recovery off `warning.kind` sees the same signal it gets from\n\t\t\t// the thrown-AuthenticationError branch below; without it, the most common unauthorized case is\n\t\t\t// silent.\n\t\t\treturn {\n\t\t\t\tresolution: {\n\t\t\t\t\tstatus: 'unauthorized',\n\t\t\t\t\twarning: noConnectionWarning(id, domain, connectionId),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\t// Prefer the provider's canonical namespace/name (GitHub's REST/GraphQL lookup follows the 301\n\t\t// rename redirect, so a stale old name resolves to the new canonical identity), falling back to where the\n\t\t// repository was read when the response omits them. `renamed` is a case-insensitive compare of that against\n\t\t// canonical, mirroring gkcli's `EqualFold`, so hosts that merely echo the input casing (e.g.\n\t\t// Bitbucket Server/Azure) don't get spuriously flagged. An Azure DevOps Server remote's path may be read as\n\t\t// another collection and project than the parser read (see `AzureDevOpsServerIntegration.getRepositoryTarget`),\n\t\t// which is no rename, so the compare is against where it was read. Owner and name are compared joined, because\n\t\t// the sides split a GitLab nested group differently: the remote at its first slash, the SDK at its last.\n\t\tconst readAt = repo.readAt ?? { owner: owner, name: repositoryName, project: project };\n\t\tconst canonicalOwner = repo.namespace || readAt.owner;\n\t\tconst canonicalName = repo.name || readAt.name;\n\t\tconst readAtProject = project != null ? readAt.project || project : undefined;\n\t\tconst canonicalProject = readAtProject != null ? repo.project || readAtProject : undefined;\n\t\tconst differs = (a: string | undefined, b: string | undefined) => a?.toLowerCase() !== b?.toLowerCase();\n\t\tconst renamed =\n\t\t\tdiffers(`${canonicalOwner}/${canonicalName}`, `${readAt.owner}/${readAt.name}`) ||\n\t\t\tdiffers(canonicalProject, readAtProject);\n\n\t\tconst identity: RepositoryIdentity = {\n\t\t\tproviderId: id,\n\t\t\tdomain: domain,\n\t\t\towner: canonicalOwner,\n\t\t\tname: canonicalName,\n\t\t\tproject: canonicalProject,\n\t\t\tremoteUrl: options.remoteUrl,\n\t\t\trenamed: renamed,\n\t\t\t...getForkInfo(repo),\n\t\t};\n\t\treturn { resolution: { status: 'resolved', identity: identity } };\n\t} catch (ex) {\n\t\t// Order matters: 404 throws RequestNotFoundError (not `undefined`), so check not-found before auth\n\t\t// and before the generic 5xx/unknown bucket — never classify a 401/403 as not-found.\n\t\tlet resolution: RepositoryResolution;\n\t\tif (ex instanceof RequestNotFoundError) {\n\t\t\tresolution = { status: 'not-found' };\n\t\t} else if (ex instanceof AuthenticationError) {\n\t\t\t// One repository refusing a credential that works (e.g. GitHub's OAuth App access restrictions) is that\n\t\t\t// repository's warning, scoped and with its cause, not a dead connection's.\n\t\t\tlet warning = toProviderWarning(id, domain, connectionId, ex);\n\t\t\ttry {\n\t\t\t\tconst failure = await integration.settleRepositoryRefusal(\n\t\t\t\t\t{\n\t\t\t\t\t\towner: owner,\n\t\t\t\t\t\tname: repositoryName,\n\t\t\t\t\t\tproject: project,\n\t\t\t\t\t\tconnectionId: connectionId,\n\t\t\t\t\t},\n\t\t\t\t\tex,\n\t\t\t\t);\n\t\t\t\tif (failure != null) {\n\t\t\t\t\tconst warnings: ProviderWarning[] = [];\n\t\t\t\t\tmergeAssessmentInto(warnings, id, domain, connectionId, {\n\t\t\t\t\t\tcompleteness: 'partial',\n\t\t\t\t\t\tfailures: [failure],\n\t\t\t\t\t});\n\t\t\t\t\twarning = warnings[0] ?? warning;\n\t\t\t\t}\n\t\t\t} catch (credentialError) {\n\t\t\t\tif (credentialError instanceof AuthenticationError) {\n\t\t\t\t\twarning = toProviderWarning(id, domain, connectionId, credentialError);\n\t\t\t\t}\n\t\t\t}\n\t\t\tresolution = {\n\t\t\t\tstatus: 'unauthorized',\n\t\t\t\twarning: warning,\n\t\t\t};\n\t\t} else {\n\t\t\tresolution = { status: 'undetermined', warning: toProviderWarning(id, domain, connectionId, ex) };\n\t\t}\n\t\treturn { resolution: resolution };\n\t}\n}\n\n/**\n * The fork fields of a provider repository. `namespace` is the owner, workspace, project key, Azure organization or\n * GitLab group path (`group/subgroup`), as the SDK uses it elsewhere. A named parent is itself a report of a fork, so\n * it settles an unreported `isFork` to `true`; one beside `isFork: false` contradicts the flag and is dropped. So is\n * one with an empty namespace or name: the type allows it, and GitLab's is split from a path the server sends, which\n * leaves no namespace when it has no `/`. It can't address a repository, but the fork is still reported.\n */\nfunction getForkInfo(repo: ProviderRepository): Pick<RepositoryIdentity, 'isFork' | 'parent'> {\n\tconst { isFork, parent } = repo;\n\tif (isFork === false || !parent?.namespace || !parent.name) return { isFork: isFork };\n\n\treturn {\n\t\tisFork: true,\n\t\tparent: {\n\t\t\towner: parent.namespace,\n\t\t\tname: parent.name,\n\t\t\t...(parent.project ? { project: parent.project } : {}),\n\t\t},\n\t};\n}\n\nfunction hostFromRemoteDomain(domain: string | undefined, scheme: string): string | undefined {\n\tconst value = domain?.trim();\n\tif (!value || !isWebRemoteScheme(scheme) || value.includes('://')) return hostFromDomain(value);\n\n\treturn hostFromDomain(`${scheme}${value}`);\n}\n\n/** Whether `path` is `{x}/_git/{repo}`, the Azure repository path the remote parser reads without a project segment. */\nfunction isProjectlessAzurePath(path: string | undefined): boolean {\n\tconst segments = path?.split('/');\n\treturn segments?.length === 3 && decodePathSegment(segments[1]).toLowerCase() === '_git';\n}\n\n/**\n * Narrows a web remote on a self-managed host to the configured installation it lives under: the pinned\n * connection's or, unpinned, the one whose installation path is the longest prefix of the remote's, so two\n * installations behind one host each resolve with their own credentials. The provider is re-matched against the\n * path relative to that installation, because the remote parsers expect the repository path to start at the\n * host root. An SSH remote carries no installation path, so it is left to the host-level checks.\n */\nfunction matchInstallation(\n\tctx: RepositoryResolutionContext,\n\toptions: ResolveRepositoryOptions,\n\tid: GitSelfManagedHostIntegrationId,\n\tconnections: ConfiguredIntegrationDescriptor[],\n\tremote: { scheme: string; domain: string; path: string },\n):\n\t| { provider: RemoteProvider; connectionId: string | undefined; repoDesc: ResourceDescriptor }\n\t| 'host-mismatch'\n\t| 'invalid-remote-url'\n\t| undefined {\n\tif (!isWebRemoteScheme(remote.scheme)) return undefined;\n\n\tconst installationPath = (connection: ConfiguredIntegrationDescriptor | undefined): string | undefined => {\n\t\tconst baseUrl = getSelfManagedBaseUrl(\n\t\t\tid,\n\t\t\tconnection != null ? (connection.baseUrl ?? connection.domain) : options.domain,\n\t\t);\n\t\treturn baseUrl != null ? trimTrailingSlashes(new URL(baseUrl).pathname) : undefined;\n\t};\n\n\t// The connection an unpinned read already targets comes first, so it wins a tie between installations.\n\tconst defaultConnection = connections.find(c => c.primary) ?? connections[0];\n\t// A cloud sync serves the host's cloud-scoped default instead, even over a local primary (see\n\t// `getStoredSession`), so an unpinned read reaches the default's installation only when both agree.\n\tconst cloudConnections = connections.filter(c => c.cloud);\n\tconst cloudDefault = cloudConnections.find(c => c.primary) ?? cloudConnections[0];\n\tconst isDefaultReadable =\n\t\tdefaultConnection?.cloud !== false ||\n\t\tcloudDefault == null ||\n\t\tinstallationPath(cloudDefault) === installationPath(defaultConnection);\n\t// Whether an unpinned read can reach this connection's session: the default one is read without an id, any\n\t// other only by a real cloud token id. Session lookup treats every connection id as one, and a local (PAT)\n\t// descriptor's or domain-derived legacy id is not (see `getConfiguredConnectionId`).\n\tconst isReadable = (connection: ConfiguredIntegrationDescriptor | undefined): boolean =>\n\t\toptions.connectionId != null ||\n\t\t(connection === defaultConnection\n\t\t\t? isDefaultReadable\n\t\t\t: connection?.cloud === true && hostFromDomain(connection.id) !== connection.domain);\n\n\tconst candidates: (ConfiguredIntegrationDescriptor | undefined)[] =\n\t\toptions.connectionId != null\n\t\t\t? connections.filter(c => c.id === options.connectionId)\n\t\t\t: [defaultConnection, ...connections.filter(c => c !== defaultConnection)];\n\t// With no configured candidate, the explicit (trusted) `domain` is the only installation address there is.\n\tif (!candidates.length) {\n\t\tcandidates.push(undefined);\n\t}\n\n\tconst remotePath = `/${remote.path}`;\n\tconst remoteSegments = remote.path.split('/');\n\t// The remote's path below an installation, or `undefined` when it isn't under it. Azure DevOps Server runs on\n\t// IIS, which serves its paths decoded and case-insensitively, so it compares segment by segment.\n\tconst relativeTo = (basePath: string): string | undefined => {\n\t\tif (id !== GitSelfManagedHostIntegrationId.AzureDevOpsServer) {\n\t\t\treturn remotePath.startsWith(`${basePath}/`) ? remotePath.slice(basePath.length + 1) : undefined;\n\t\t}\n\n\t\tconst baseSegments = basePath.split('/').filter(Boolean);\n\t\tconst isUnder =\n\t\t\tremoteSegments.length > baseSegments.length &&\n\t\t\tbaseSegments.every(\n\t\t\t\t(segment, i) =>\n\t\t\t\t\tdecodePathSegment(segment).toLowerCase() === decodePathSegment(remoteSegments[i]).toLowerCase(),\n\t\t\t);\n\t\treturn isUnder ? remoteSegments.slice(baseSegments.length).join('/') : undefined;\n\t};\n\tlet match: { connection: ConfiguredIntegrationDescriptor | undefined; basePath: string } | undefined;\n\tlet checked = false;\n\tfor (const connection of candidates) {\n\t\tconst basePath = installationPath(connection);\n\t\tif (basePath == null) continue;\n\n\t\tchecked = true;\n\t\tif (relativeTo(basePath) == null) continue;\n\n\t\t// The longest installation wins; on a tie, a readable connection replaces an unreadable one.\n\t\tconst isBetter =\n\t\t\tmatch == null ||\n\t\t\tbasePath.length > match.basePath.length ||\n\t\t\t(basePath.length === match.basePath.length && !isReadable(match.connection) && isReadable(connection));\n\t\tif (isBetter) {\n\t\t\tmatch = { connection: connection, basePath: basePath };\n\t\t}\n\t}\n\tif (match == null) return checked ? 'host-mismatch' : undefined;\n\t// Reading through the default connection instead would address its installation with a path relative to\n\t// another one, so an unreachable installation fails closed.\n\tif (!isReadable(match.connection)) return 'host-mismatch';\n\n\tconst connectionId =\n\t\toptions.connectionId ?? (match.connection !== defaultConnection ? match.connection?.id : undefined);\n\n\tconst matcher = createRemoteProviderMatcher(\n\t\tbuildMatcherConfigs(ctx, { ...options, providerId: id }, remote.domain),\n\t);\n\tconst rematch = (path: string) => matcher(options.remoteUrl, remote.domain, relativeTo(path) ?? '', remote.scheme);\n\tlet basePath = match.basePath;\n\tlet provider = rematch(basePath);\n\tif (id !== GitSelfManagedHostIntegrationId.AzureDevOpsServer) {\n\t\treturn provider != null\n\t\t\t? { provider: provider, connectionId: connectionId, repoDesc: provider.repoDesc }\n\t\t\t: 'invalid-remote-url';\n\t}\n\n\t// An Azure DevOps Server address may name the collection as well as the virtual directory; the parser expects\n\t// the collection in the path, so re-base on the address's parent when no project was found. A relative\n\t// `{x}/_git/{repo}` re-bases too: `x` is a collection only if the address is the installation rather than a\n\t// collection, which the path can't tell, so the integration settles it against the collections it discovers.\n\tif (basePath && (provider?.providerDesc?.repoDomain == null || isProjectlessAzurePath(relativeTo(basePath)))) {\n\t\tbasePath = basePath.slice(0, basePath.lastIndexOf('/'));\n\t\tprovider = rematch(basePath);\n\t}\n\tif (provider == null) return 'invalid-remote-url';\n\n\t// Requests address the repository's virtual directory from the host root, not from the installation the\n\t// re-match made it relative to; the absolute form also tells a directory apart from a collection of that name.\n\tconst repoDesc = provider.repoDesc;\n\tconst relative = typeof repoDesc.virtualDirectory === 'string' ? repoDesc.virtualDirectory : undefined;\n\tconst virtualDirectory =\n\t\t[...basePath.split('/').filter(Boolean).map(decodePathSegment), ...(relative?.split('/') ?? [])].join('/') ||\n\t\tundefined;\n\treturn {\n\t\tprovider: provider,\n\t\tconnectionId: connectionId,\n\t\trepoDesc: { ...repoDesc, virtualDirectory: virtualDirectory },\n\t};\n}\n\n/**\n * The remote-matcher configs for this resolution: the user's own host remote configs (self-managed/custom\n * domains), plus a synthetic exact-domain entry for an explicit `providerId` + host so a custom domain still maps\n * to the right provider for path parsing.\n */\nfunction buildMatcherConfigs(\n\tctx: RepositoryResolutionContext,\n\toptions: { providerId?: IntegrationIds; host?: string },\n\tparsedDomain: string,\n): RemoteProviderConfig[] {\n\tconst configs: RemoteProviderConfig[] = [];\n\tfor (const cfg of ctx.getRemoteConfigs()) {\n\t\tconst type = remoteProviderTypeForConfig(cfg.type);\n\t\tif (type == null) continue;\n\n\t\t// Forward both domain- and regex-based custom remotes (carrying any protocol override), so a\n\t\t// regex-configured host resolves instead of falling through to `unsupported`.\n\t\tif (cfg.domain) {\n\t\t\tconfigs.push({ type: type, domain: cfg.domain, protocol: cfg.protocol });\n\t\t} else if (cfg.regex) {\n\t\t\tconfigs.push({ type: type, regex: cfg.regex, protocol: cfg.protocol });\n\t\t}\n\t}\n\tif (options.providerId == null) return configs;\n\n\tconst type = remoteProviderTypeForIntegration(options.providerId);\n\tconst domain = parsedDomain || options.host;\n\tif (type == null || !domain) return configs;\n\n\t// The synthetic exact-domain entry is unshifted to the front, so it wins the match over the user's own\n\t// config for the same host. Carry that config's protocol override across (matched by domain or regex,\n\t// mirroring `ignoreSSLErrors`) so a self-managed host configured for a custom protocol — e.g. plain\n\t// `http` — isn't silently downgraded to the provider default here.\n\tconst lowerDomain = domain.toLowerCase();\n\tconst protocol = configs.find(c => {\n\t\tif (c.type !== type) return false;\n\t\tif (c.domain != null) return c.domain.toLowerCase() === lowerDomain;\n\n\t\t// Truthy (not just non-null): an empty regex would compile to a match-everything pattern.\n\t\tif (c.regex) {\n\t\t\ttry {\n\t\t\t\treturn new RegExp(c.regex, 'i').test(lowerDomain);\n\t\t\t} catch {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t})?.protocol;\n\tconfigs.unshift({ type: type, domain: domain, protocol: protocol });\n\treturn configs;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmDA,eAAsB,kBACrB,KACA,SACmC;CACnC,MAAM,UAAU,YAAqE,EACpF,YAAY,EAAU,OAAO,EAC9B;CAEA,MAAM,CAAC,QAAQ,cAAc,cAAc,kBAAkB,QAAQ,SAAS;CAG9E,MAAM,OAAO,oBAAoB,UAAU;CAE3C,MAAM,aAAa,qBAAqB,MAAM;CAC9C,MAAM,aAAa,qBAAqB,cAAc,MAAM;CAC5D,MAAM,eAAe,qBAAqB,QAAQ,MAAM,MAAM;CAC9D,IAAI,cAAc,QAAQ,gBAAgB,QAAQ,CAAC,WAAW,YAAY,YAAY,GACrF,OAAO,OAAO,eAAe;CAG9B,MAAM,gBAAgB,gBAAgB,QAAQ,QAAQ;CAMtD,IAAI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CAAE,CAAC,CAAC,KAAK,GAAG,KACzG,KAAA;CACD,OAAO;EACI;EACI;EACd,UAAU;GAAE,GAAG;GAA4B;EAAiB;CAC7D;AACD;;;;;;AAOA,SAAS,oBACR,KACA,SACA,cACyB;CACzB,MAAM,UAAkC,CAAC;CACzC,KAAK,MAAM,OAAO,IAAI,iBAAiB,GAAG;EACzC,MAAM,OAAO,4BAA4B,IAAI,IAAI;EACjD,IAAI,QAAQ,MAAM;EAIlB,IAAI,IAAI,QACP,QAAQ,KAAK;GAAQ;GAAM,QAAQ,IAAI;GAAQ,UAAU,IAAI;EAAS,CAAC;OACjE,IAAI,IAAI,OACd,QAAQ,KAAK;GAAQ;GAAM,OAAO,IAAI;GAAO,UAAU,IAAI;EAAS,CAAC;CAEvE;CACA,IAAI,QAAQ,cAAc,MAAM,OAAO;CAEvC,MAAM,OAAO,iCAAiC,QAAQ,UAAU;CAChE,MAAM,SAAS,gBAAgB,QAAQ;CACvC,IAAI,QAAQ,QAAQ,CAAC,QAAQ,OAAO;CAMpC,MAAM,cAAc,OAAO,YAAY;CACvC,MAAM,WAAW,QAAQ,MAAK,MAAK;EAClC,IAAI,EAAE,SAAS,MAAM,OAAO;EAC5B,IAAI,EAAE,UAAU,MAAM,OAAO,EAAE,OAAO,YAAY,MAAM;EAGxD,IAAI,EAAE,OACL,IAAI;GACH,OAAO,IAAI,OAAO,EAAE,OAAO,GAAG,CAAC,CAAC,KAAK,WAAW;EACjD,QAAQ;GACP,OAAO;EACR;EAGD,OAAO;CACR,CAAC,CAAC,EAAE;CACJ,QAAQ,QAAQ;EAAQ;EAAc;EAAkB;CAAS,CAAC;CAClE,OAAO;AACR"}
@@ -1,5 +1,6 @@
1
1
  import { effectiveIssueSort } from "../../../git/utils/issue.utils.js";
2
- import { isGitHostIntegration, isIssuesHostIntegrationId, warnOnMissingSessionForDomain } from "../utils/integration.utils.js";
2
+ import { isIssuesHostIntegrationId, warnOnMissingSessionForDomain } from "../utils/integration.utils.js";
3
+ import { isGitHostIntegration } from "../models/publicIntegration.js";
3
4
  import { drainFlatPagesToRequestedPage, refusedPage, resolveContinuation, resolveCurrentPage, usableCursor } from "./paging.js";
4
5
  import { gitHostOnlySurfaceWarning, issueSearchCapResultWarning, issuesUnsupportedWarning, otherWarning, truncationWarning, unsupportedIssueSearchCriteriaWarning, unusableSearchScopeMessage } from "./warnings.js";
5
6
  import { runCaptured } from "./drains.js";
@@ -1 +1 @@
1
- {"version":3,"file":"searchIssues.js","names":[],"sources":["../../../../../plus/integrations/src/reads/searchIssues.ts"],"sourcesContent":["import type { IssueSearchCriteria, IssueShape } from '@gitlens/git/models/issue.js';\nimport { effectiveIssueSort } from '@gitlens/git/utils/issue.utils.js';\nimport type { IntegrationIds } from '../constants.js';\nimport type { ProviderReposInput } from '../providers/models.js';\nimport type { ProviderPagedResult, ProviderWarning } from '../results.js';\nimport {\n\tisGitHostIntegration,\n\tisIssuesHostIntegrationId,\n\twarnOnMissingSessionForDomain,\n} from '../utils/integration.utils.js';\nimport type { ProviderReadContext } from './context.js';\nimport { runCaptured } from './drains.js';\nimport { resolveIssueSearchCriteria, resolveIssueSearchScope } from './filters.js';\nimport {\n\tdrainFlatPagesToRequestedPage,\n\trefusedPage,\n\tresolveContinuation,\n\tresolveCurrentPage,\n\tusableCursor,\n} from './paging.js';\nimport {\n\tgitHostOnlySurfaceWarning,\n\tissueSearchCapResultWarning,\n\tissuesUnsupportedWarning,\n\totherWarning,\n\ttruncationWarning,\n\tunsupportedIssueSearchCriteriaWarning,\n\tunusableSearchScopeMessage,\n} from './warnings.js';\n\n/**\n * The FILTERED issue search: issues matching structured criteria over a repository/org scope, with no forced\n * relationship to the current user.\n *\n * A sibling of `listIssuesPage` rather than a mode of it, deliberately. That read is already two divergent\n * branches (a cursor-composite account-wide path and a page-draining repo-scoped one) around a documented\n * contract where `filters` REPLACES the provider's definition of \"my issues\". This search answers a different\n * question — its relationships include two that are not about the user at all — and routes around the SDK's\n * repo-scoped read entirely, whose over-limit recovery walk can spend up to 128 requests and still return an\n * incomplete set. Folding the two together would multiply that branch matrix and put every existing consumer of\n * `listIssuesPage` at risk; keeping them siblings shares the primitives below without sharing the branch space,\n * for the same reason `broaden.ts`, `sweeps.ts` and `issueTracker.ts` are separate files.\n *\n * Contract details worth knowing before calling:\n * - Ordering is `criteria.sort`, most-recently-updated-first by default, and validated like every other criterion\n * against `getSupportedFilters().issueSearch.sorts`. SOME order is always requested — a \"show the N most recent\"\n * policy at the provider's result ceiling is only correct under a guaranteed one, and the ceiling warning names\n * the key it selected the window under. A key the provider can't express refuses the read rather than serving a\n * differently-ordered result; do not change it mid-pagination (a cursor is bound to the order it was made under,\n * and threading it under a different key is refused with a warning + `fetchFailed` — drop the cursor and read\n * from the first page instead).\n * - Paging is cursor-only. `page` alone walks 1..N internally (O(N) requests); a page past the last one is an\n * empty page N, never page N−1 relabeled.\n * - At the provider's result ceiling the read SUCCEEDS and reports an omission carrying the total match count,\n * so a consumer can say how many were withheld. It never falls back to a per-repository recovery walk.\n */\nexport async function searchIssuesPage(\n\tctx: ProviderReadContext,\n\toptions: {\n\t\tproviderId: IntegrationIds;\n\t\t/** Repositories to search. Combines with `org`; both become scope constraints on the same query. */\n\t\trepos?: ProviderReposInput;\n\t\t/** Organization/account to search. Combines with `repos`. */\n\t\torg?: string;\n\t\t/**\n\t\t * What to narrow on, validated against `getSupportedFilters().issueSearch` before the read runs. A\n\t\t * criterion the provider can't express server-side refuses the whole read (warning + `fetchFailed`)\n\t\t * rather than serving a list that was never narrowed.\n\t\t */\n\t\tcriteria?: IssueSearchCriteria;\n\t\tpage?: number;\n\t\tcursor?: string;\n\t\t/** Per relationship, not per page; see {@link IntegrationManager.searchIssuesPage}. */\n\t\titemsPerPage?: number;\n\t\tforceSync?: boolean;\n\t\tconnectionId?: string;\n\t\t/**\n\t\t * Explicit self-managed host domain. Used only when the requested connection has no configured domain;\n\t\t * it must come from the trusted authentication configuration, not repository or remote data.\n\t\t */\n\t\tdomain?: string;\n\t},\n): Promise<ProviderPagedResult<IssueShape>> {\n\tconst page = Math.max(1, Math.trunc(options.page ?? 1));\n\t// Cursor-only, so a refusal can't claim the requested position — it reports page 1, per\n\t// ProviderPageInfo.currentPage.\n\tconst refused = (warning: ProviderWarning) => refusedPage<IssueShape>(1, [warning], true);\n\n\tif (isIssuesHostIntegrationId(options.providerId)) {\n\t\treturn refused(\n\t\t\tgitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, 'Filtered issue search'),\n\t\t);\n\t}\n\n\tconst integration = await ctx.getIntegrationForRead(options.providerId, options.connectionId, options.domain);\n\tif (integration == null) {\n\t\t// A supplied connection or domain that no longer resolves is a broken target, not an empty account —\n\t\t// surface a no-connection warning + fetchFailed rather than a silent empty page.\n\t\tconst early = ctx.earlyReturnConnectionWarnings(options.providerId, options.connectionId, options.domain);\n\t\treturn refusedPage(1, early.warnings, early.fetchFailed);\n\t}\n\tif (!isGitHostIntegration(integration)) {\n\t\treturn refused(\n\t\t\tgitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, 'Filtered issue search'),\n\t\t);\n\t}\n\n\tawait ctx.forceRefreshIfRequested(integration, options.forceSync, options.connectionId);\n\n\tconst domain = ctx.domainForRead(integration, options.providerId, options.connectionId, options.domain);\n\tconst warnOnMissingSession = warnOnMissingSessionForDomain(options.providerId, options.domain);\n\n\tif (!integration.supportsIssues) {\n\t\treturn refused(issuesUnsupportedWarning(options.providerId, domain, options.connectionId));\n\t}\n\n\tconst resolved = resolveIssueSearchCriteria(options.providerId, options.criteria);\n\tif (resolved.rejection != null) {\n\t\treturn refused(\n\t\t\tunsupportedIssueSearchCriteriaWarning(options.providerId, domain, options.connectionId, resolved.rejection),\n\t\t);\n\t}\n\n\t// AFTER the criteria check, which is what reports a provider with no filtered issue search at all: that is\n\t// the more fundamental refusal, and answering \"your scope name is malformed\" to a caller whose provider has\n\t// no such search names the wrong defect. Matches the pull-request twin, which probes existence first.\n\tconst scope = resolveIssueSearchScope(options.providerId, options.repos, options.org, options.criteria);\n\tswitch (scope.rejection?.reason) {\n\t\tcase 'unscoped':\n\t\t\treturn refused(\n\t\t\t\totherWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t'A filtered issue search must be scoped: pass `repos`, `org`, or a relationship to the current user (`authored`/`assigned`/`mentioned`). `any-assignee` and `unassigned` are not scopes — either one alone matches every such issue on the host.',\n\t\t\t\t),\n\t\t\t);\n\t\tcase 'repo-ids':\n\t\t\t// A search query names repositories by PATH, so repository ids can't be expressed as a scope. Refusing\n\t\t\t// is the only honest answer: dropping them would search the whole org (or the whole host) as if the\n\t\t\t// caller had asked for that.\n\t\t\treturn refused(\n\t\t\t\totherWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t'A filtered issue search cannot be scoped by repository id; pass repository descriptors (namespace + name) instead.',\n\t\t\t\t),\n\t\t\t);\n\t\t// A scope the query cannot spell, refused rather than sanitized — see `isUsableSearchScopeName`.\n\t\tcase 'unusable-scope':\n\t\t\treturn refused(\n\t\t\t\totherWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\tunusableSearchScopeMessage('issue search scopes', scope.rejection.scopes),\n\t\t\t\t),\n\t\t\t);\n\t}\n\n\tconst readPage = (cursor: string | undefined) =>\n\t\trunCaptured(\n\t\t\toptions.providerId,\n\t\t\tdomain,\n\t\t\toptions.connectionId,\n\t\t\t() =>\n\t\t\t\tintegration.searchIssuesPageResult(\n\t\t\t\t\t{\n\t\t\t\t\t\trepos: scope.repos,\n\t\t\t\t\t\torg: options.org,\n\t\t\t\t\t\tcriteria: options.criteria,\n\t\t\t\t\t\tcursor: cursor,\n\t\t\t\t\t\tpageSize: options.itemsPerPage,\n\t\t\t\t\t},\n\t\t\t\t\tundefined,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t),\n\t\t\t{ warnOnMissingSession: warnOnMissingSession },\n\t\t);\n\n\tconst first = await readPage(options.cursor);\n\tconst warnings = first.warning != null ? [first.warning] : [];\n\t// The largest total any page reported. Folded across the walk so a cap detected on page 1 is still reportable\n\t// after paging on to page N — the one thing this read accumulates that its sibling doesn't.\n\tlet totalCount = first.value?.totalCount;\n\tlet limitReached = first.value?.limitReached === true;\n\tconst drained = await drainFlatPagesToRequestedPage(first, {\n\t\trequestedPage: page,\n\t\tsuppliedCursor: options.cursor,\n\t\twarnings: warnings,\n\t\treadPage: readPage,\n\t\tfold: p => {\n\t\t\tif (p.totalCount != null) {\n\t\t\t\ttotalCount = Math.max(totalCount ?? 0, p.totalCount);\n\t\t\t}\n\t\t\tlimitReached ||= p.limitReached === true;\n\t\t},\n\t});\n\tconst { value, currentPage, requestedPageMissing } = drained;\n\tconst pageFetchFailed = drained.fetchFailed;\n\n\t// A provider that doesn't implement the search hook returns `undefined` with no error. Surface that as an\n\t// explicit unsupported warning + fetchFailed rather than a silent empty success, so a caller isn't left\n\t// unable to tell it apart from an account with no matching issues. `getSupportedFilters().issueSearch`\n\t// declares this ahead of the read, so a consumer that checks it never reaches here.\n\tif (value == null && warnings.length === 0) {\n\t\treturn refused(\n\t\t\tunsupportedIssueSearchCriteriaWarning(options.providerId, domain, options.connectionId, {\n\t\t\t\treason: 'unsupported-search',\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst items = requestedPageMissing ? [] : (value?.values ?? []);\n\t// Cursor-only: `hasMore` without a real cursor is a dead end, so report it as terminal-but-incomplete rather\n\t// than inviting the caller to page forever.\n\tconst continuation = resolveContinuation(\n\t\t{\n\t\t\thasMore: requestedPageMissing ? false : (value?.hasMore ?? false),\n\t\t\tcursor: requestedPageMissing ? undefined : usableCursor(value?.cursor),\n\t\t\ttruncated: drained.truncated,\n\t\t},\n\t\tundefined,\n\t);\n\tconst truncated = continuation.truncated;\n\t// Only reachable when nothing else already explained the incompleteness — and a failed page always warns\n\t// first, so a read that gets here SUCCEEDED. That is why the cause below is unconditionally `exhausted` and\n\t// `fetchFailed` is never set from here.\n\tif (truncated && warnings.length === 0) {\n\t\t// The result ceiling is the one truncation cause this read can EXPLAIN with a number, so it gets its own\n\t\t// warning carrying the total. Anything else truncated (an unusable continuation, a provider that stopped\n\t\t// advancing) falls back to the generic wording.\n\t\twarnings.push(\n\t\t\tissueSearchCapResultWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tdomain,\n\t\t\t\toptions.connectionId,\n\t\t\t\ttotalCount,\n\t\t\t\teffectiveIssueSort(options.criteria?.sort),\n\t\t\t\tlimitReached,\n\t\t\t) ??\n\t\t\t\ttruncationWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t'Issue search',\n\t\t\t\t\t// `exhausted`: this read exposes no budget the caller could raise, so nothing it could call\n\t\t\t\t\t// would return the withheld items.\n\t\t\t\t\t'exhausted',\n\t\t\t\t),\n\t\t);\n\t}\n\n\treturn {\n\t\titems: items,\n\t\twarnings: warnings,\n\t\tpage: {\n\t\t\t// Positional, per ProviderPageInfo.currentPage. A requested page past the terminal cursor is reported\n\t\t\t// as that empty page N; otherwise this read is cursor-only, so a `page` the caller didn't pair with a\n\t\t\t// cursor is never echoed.\n\t\t\tcurrentPage: requestedPageMissing\n\t\t\t\t? page\n\t\t\t\t: resolveCurrentPage({\n\t\t\t\t\t\tproviderPage: currentPage,\n\t\t\t\t\t\trequestedPage: page,\n\t\t\t\t\t\tsuppliedCursor: options.cursor,\n\t\t\t\t\t\tpageAdvanceable: false,\n\t\t\t\t\t}),\n\t\t\titemsPerPage: items.length,\n\t\t\ttruncated: truncated || undefined,\n\t\t},\n\t\thasMore: continuation.hasMore,\n\t\tcursor: continuation.cursor,\n\t\tfetchFailed: pageFetchFailed || undefined,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,eAAsB,iB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a;CAI/B,IAAI,aAAa,SAAS,WAAW,GAIpC,SAAS,KACR,4BACC,QAAQ,YACR,QACA,QAAQ,cACR,YACA,mBAAmB,QAAQ,UAAU,IAAI,GACzC,YACD,KACC,kBACC,QAAQ,YACR,QACA,QAAQ,cACR,gBAGA,WACD,CACF;CAGD,OAAO;EACC;EACG;EACV,MAAM;GAIL,aAAa,uBACV,OACA,mBAAmB;IACnB,cAAc;IACd,eAAe;IACf,gBAAgB,QAAQ;IACxB,iBAAiB;GAClB,CAAC;GACH,cAAc,MAAM;GACpB,WAAW,aAAa,KAAA;EACzB;EACA,SAAS,aAAa;EACtB,QAAQ,aAAa;EACrB,aAAa,mBAAmB,KAAA;CACjC;AACD"}
1
+ {"version":3,"file":"searchIssues.js","names":[],"sources":["../../../../../plus/integrations/src/reads/searchIssues.ts"],"sourcesContent":["import type { IssueSearchCriteria, IssueShape } from '@gitlens/git/models/issue.js';\nimport { effectiveIssueSort } from '@gitlens/git/utils/issue.utils.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { isGitHostIntegration } from '../models/publicIntegration.js';\nimport type { ProviderReposInput } from '../providers/models.js';\nimport type { ProviderPagedResult, ProviderWarning } from '../results.js';\nimport { isIssuesHostIntegrationId, warnOnMissingSessionForDomain } from '../utils/integration.utils.js';\nimport type { ProviderReadContext } from './context.js';\nimport { runCaptured } from './drains.js';\nimport { resolveIssueSearchCriteria, resolveIssueSearchScope } from './filters.js';\nimport {\n\tdrainFlatPagesToRequestedPage,\n\trefusedPage,\n\tresolveContinuation,\n\tresolveCurrentPage,\n\tusableCursor,\n} from './paging.js';\nimport {\n\tgitHostOnlySurfaceWarning,\n\tissueSearchCapResultWarning,\n\tissuesUnsupportedWarning,\n\totherWarning,\n\ttruncationWarning,\n\tunsupportedIssueSearchCriteriaWarning,\n\tunusableSearchScopeMessage,\n} from './warnings.js';\n\n/**\n * The FILTERED issue search: issues matching structured criteria over a repository/org scope, with no forced\n * relationship to the current user.\n *\n * A sibling of `listIssuesPage` rather than a mode of it, deliberately. That read is already two divergent\n * branches (a cursor-composite account-wide path and a page-draining repo-scoped one) around a documented\n * contract where `filters` REPLACES the provider's definition of \"my issues\". This search answers a different\n * question — its relationships include two that are not about the user at all — and routes around the SDK's\n * repo-scoped read entirely, whose over-limit recovery walk can spend up to 128 requests and still return an\n * incomplete set. Folding the two together would multiply that branch matrix and put every existing consumer of\n * `listIssuesPage` at risk; keeping them siblings shares the primitives below without sharing the branch space,\n * for the same reason `broaden.ts`, `sweeps.ts` and `issueTracker.ts` are separate files.\n *\n * Contract details worth knowing before calling:\n * - Ordering is `criteria.sort`, most-recently-updated-first by default, and validated like every other criterion\n * against `getSupportedFilters().issueSearch.sorts`. SOME order is always requested — a \"show the N most recent\"\n * policy at the provider's result ceiling is only correct under a guaranteed one, and the ceiling warning names\n * the key it selected the window under. A key the provider can't express refuses the read rather than serving a\n * differently-ordered result; do not change it mid-pagination (a cursor is bound to the order it was made under,\n * and threading it under a different key is refused with a warning + `fetchFailed` — drop the cursor and read\n * from the first page instead).\n * - Paging is cursor-only. `page` alone walks 1..N internally (O(N) requests); a page past the last one is an\n * empty page N, never page N−1 relabeled.\n * - At the provider's result ceiling the read SUCCEEDS and reports an omission carrying the total match count,\n * so a consumer can say how many were withheld. It never falls back to a per-repository recovery walk.\n */\nexport async function searchIssuesPage(\n\tctx: ProviderReadContext,\n\toptions: {\n\t\tproviderId: IntegrationIds;\n\t\t/** Repositories to search. Combines with `org`; both become scope constraints on the same query. */\n\t\trepos?: ProviderReposInput;\n\t\t/** Organization/account to search. Combines with `repos`. */\n\t\torg?: string;\n\t\t/**\n\t\t * What to narrow on, validated against `getSupportedFilters().issueSearch` before the read runs. A\n\t\t * criterion the provider can't express server-side refuses the whole read (warning + `fetchFailed`)\n\t\t * rather than serving a list that was never narrowed.\n\t\t */\n\t\tcriteria?: IssueSearchCriteria;\n\t\tpage?: number;\n\t\tcursor?: string;\n\t\t/** Per relationship, not per page; see {@link IntegrationManager.searchIssuesPage}. */\n\t\titemsPerPage?: number;\n\t\tforceSync?: boolean;\n\t\tconnectionId?: string;\n\t\t/**\n\t\t * Explicit self-managed host domain. Used only when the requested connection has no configured domain;\n\t\t * it must come from the trusted authentication configuration, not repository or remote data.\n\t\t */\n\t\tdomain?: string;\n\t},\n): Promise<ProviderPagedResult<IssueShape>> {\n\tconst page = Math.max(1, Math.trunc(options.page ?? 1));\n\t// Cursor-only, so a refusal can't claim the requested position — it reports page 1, per\n\t// ProviderPageInfo.currentPage.\n\tconst refused = (warning: ProviderWarning) => refusedPage<IssueShape>(1, [warning], true);\n\n\tif (isIssuesHostIntegrationId(options.providerId)) {\n\t\treturn refused(\n\t\t\tgitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, 'Filtered issue search'),\n\t\t);\n\t}\n\n\tconst integration = await ctx.getIntegrationForRead(options.providerId, options.connectionId, options.domain);\n\tif (integration == null) {\n\t\t// A supplied connection or domain that no longer resolves is a broken target, not an empty account —\n\t\t// surface a no-connection warning + fetchFailed rather than a silent empty page.\n\t\tconst early = ctx.earlyReturnConnectionWarnings(options.providerId, options.connectionId, options.domain);\n\t\treturn refusedPage(1, early.warnings, early.fetchFailed);\n\t}\n\tif (!isGitHostIntegration(integration)) {\n\t\treturn refused(\n\t\t\tgitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, 'Filtered issue search'),\n\t\t);\n\t}\n\n\tawait ctx.forceRefreshIfRequested(integration, options.forceSync, options.connectionId);\n\n\tconst domain = ctx.domainForRead(integration, options.providerId, options.connectionId, options.domain);\n\tconst warnOnMissingSession = warnOnMissingSessionForDomain(options.providerId, options.domain);\n\n\tif (!integration.supportsIssues) {\n\t\treturn refused(issuesUnsupportedWarning(options.providerId, domain, options.connectionId));\n\t}\n\n\tconst resolved = resolveIssueSearchCriteria(options.providerId, options.criteria);\n\tif (resolved.rejection != null) {\n\t\treturn refused(\n\t\t\tunsupportedIssueSearchCriteriaWarning(options.providerId, domain, options.connectionId, resolved.rejection),\n\t\t);\n\t}\n\n\t// AFTER the criteria check, which is what reports a provider with no filtered issue search at all: that is\n\t// the more fundamental refusal, and answering \"your scope name is malformed\" to a caller whose provider has\n\t// no such search names the wrong defect. Matches the pull-request twin, which probes existence first.\n\tconst scope = resolveIssueSearchScope(options.providerId, options.repos, options.org, options.criteria);\n\tswitch (scope.rejection?.reason) {\n\t\tcase 'unscoped':\n\t\t\treturn refused(\n\t\t\t\totherWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t'A filtered issue search must be scoped: pass `repos`, `org`, or a relationship to the current user (`authored`/`assigned`/`mentioned`). `any-assignee` and `unassigned` are not scopes — either one alone matches every such issue on the host.',\n\t\t\t\t),\n\t\t\t);\n\t\tcase 'repo-ids':\n\t\t\t// A search query names repositories by PATH, so repository ids can't be expressed as a scope. Refusing\n\t\t\t// is the only honest answer: dropping them would search the whole org (or the whole host) as if the\n\t\t\t// caller had asked for that.\n\t\t\treturn refused(\n\t\t\t\totherWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t'A filtered issue search cannot be scoped by repository id; pass repository descriptors (namespace + name) instead.',\n\t\t\t\t),\n\t\t\t);\n\t\t// A scope the query cannot spell, refused rather than sanitized — see `isUsableSearchScopeName`.\n\t\tcase 'unusable-scope':\n\t\t\treturn refused(\n\t\t\t\totherWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\tunusableSearchScopeMessage('issue search scopes', scope.rejection.scopes),\n\t\t\t\t),\n\t\t\t);\n\t}\n\n\tconst readPage = (cursor: string | undefined) =>\n\t\trunCaptured(\n\t\t\toptions.providerId,\n\t\t\tdomain,\n\t\t\toptions.connectionId,\n\t\t\t() =>\n\t\t\t\tintegration.searchIssuesPageResult(\n\t\t\t\t\t{\n\t\t\t\t\t\trepos: scope.repos,\n\t\t\t\t\t\torg: options.org,\n\t\t\t\t\t\tcriteria: options.criteria,\n\t\t\t\t\t\tcursor: cursor,\n\t\t\t\t\t\tpageSize: options.itemsPerPage,\n\t\t\t\t\t},\n\t\t\t\t\tundefined,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t),\n\t\t\t{ warnOnMissingSession: warnOnMissingSession },\n\t\t);\n\n\tconst first = await readPage(options.cursor);\n\tconst warnings = first.warning != null ? [first.warning] : [];\n\t// The largest total any page reported. Folded across the walk so a cap detected on page 1 is still reportable\n\t// after paging on to page N — the one thing this read accumulates that its sibling doesn't.\n\tlet totalCount = first.value?.totalCount;\n\tlet limitReached = first.value?.limitReached === true;\n\tconst drained = await drainFlatPagesToRequestedPage(first, {\n\t\trequestedPage: page,\n\t\tsuppliedCursor: options.cursor,\n\t\twarnings: warnings,\n\t\treadPage: readPage,\n\t\tfold: p => {\n\t\t\tif (p.totalCount != null) {\n\t\t\t\ttotalCount = Math.max(totalCount ?? 0, p.totalCount);\n\t\t\t}\n\t\t\tlimitReached ||= p.limitReached === true;\n\t\t},\n\t});\n\tconst { value, currentPage, requestedPageMissing } = drained;\n\tconst pageFetchFailed = drained.fetchFailed;\n\n\t// A provider that doesn't implement the search hook returns `undefined` with no error. Surface that as an\n\t// explicit unsupported warning + fetchFailed rather than a silent empty success, so a caller isn't left\n\t// unable to tell it apart from an account with no matching issues. `getSupportedFilters().issueSearch`\n\t// declares this ahead of the read, so a consumer that checks it never reaches here.\n\tif (value == null && warnings.length === 0) {\n\t\treturn refused(\n\t\t\tunsupportedIssueSearchCriteriaWarning(options.providerId, domain, options.connectionId, {\n\t\t\t\treason: 'unsupported-search',\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst items = requestedPageMissing ? [] : (value?.values ?? []);\n\t// Cursor-only: `hasMore` without a real cursor is a dead end, so report it as terminal-but-incomplete rather\n\t// than inviting the caller to page forever.\n\tconst continuation = resolveContinuation(\n\t\t{\n\t\t\thasMore: requestedPageMissing ? false : (value?.hasMore ?? false),\n\t\t\tcursor: requestedPageMissing ? undefined : usableCursor(value?.cursor),\n\t\t\ttruncated: drained.truncated,\n\t\t},\n\t\tundefined,\n\t);\n\tconst truncated = continuation.truncated;\n\t// Only reachable when nothing else already explained the incompleteness — and a failed page always warns\n\t// first, so a read that gets here SUCCEEDED. That is why the cause below is unconditionally `exhausted` and\n\t// `fetchFailed` is never set from here.\n\tif (truncated && warnings.length === 0) {\n\t\t// The result ceiling is the one truncation cause this read can EXPLAIN with a number, so it gets its own\n\t\t// warning carrying the total. Anything else truncated (an unusable continuation, a provider that stopped\n\t\t// advancing) falls back to the generic wording.\n\t\twarnings.push(\n\t\t\tissueSearchCapResultWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tdomain,\n\t\t\t\toptions.connectionId,\n\t\t\t\ttotalCount,\n\t\t\t\teffectiveIssueSort(options.criteria?.sort),\n\t\t\t\tlimitReached,\n\t\t\t) ??\n\t\t\t\ttruncationWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t'Issue search',\n\t\t\t\t\t// `exhausted`: this read exposes no budget the caller could raise, so nothing it could call\n\t\t\t\t\t// would return the withheld items.\n\t\t\t\t\t'exhausted',\n\t\t\t\t),\n\t\t);\n\t}\n\n\treturn {\n\t\titems: items,\n\t\twarnings: warnings,\n\t\tpage: {\n\t\t\t// Positional, per ProviderPageInfo.currentPage. A requested page past the terminal cursor is reported\n\t\t\t// as that empty page N; otherwise this read is cursor-only, so a `page` the caller didn't pair with a\n\t\t\t// cursor is never echoed.\n\t\t\tcurrentPage: requestedPageMissing\n\t\t\t\t? page\n\t\t\t\t: resolveCurrentPage({\n\t\t\t\t\t\tproviderPage: currentPage,\n\t\t\t\t\t\trequestedPage: page,\n\t\t\t\t\t\tsuppliedCursor: options.cursor,\n\t\t\t\t\t\tpageAdvanceable: false,\n\t\t\t\t\t}),\n\t\t\titemsPerPage: items.length,\n\t\t\tt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AG7D,MAAM,eAAe,oBACpB;EACC,SAAS,uBAAuB,QAAS,OAAO,WAAW;EAC3D,QAAQ,uBAAuB,KAAA,IAAY,aAAa,OAAO,MAAM;EACrE,WAAW,QAAQ;CACpB,GACA,KAAA,CACD;CACA,MAAM,YAAY,aAAa;CAI/B,IAAI,aAAa,SAAS,WAAW,GAIpC,SAAS,KACR,4BACC,QAAQ,YACR,QACA,QAAQ,cACR,YACA,mBAAmB,QAAQ,UAAU,IAAI,GACzC,YACD,KACC,kBACC,QAAQ,YACR,QACA,QAAQ,cACR,gBAGA,WACD,CACF;CAGD,OAAO;EACC;EACG;EACV,MAAM;GAIL,aAAa,uBACV,OACA,mBAAmB;IACnB,cAAc;IACd,eAAe;IACf,gBAAgB,QAAQ;IACxB,iBAAiB;GAClB,CAAC;GACH,cAAc,MAAM;GACpB,WAAW,aAAa,KAAA;EACzB;EACA,SAAS,aAAa;EACtB,QAAQ,aAAa;EACrB,aAAa,mBAAmB,KAAA;CACjC;AACD"}
@@ -1,7 +1,8 @@
1
1
  import { CancellationError } from "../../../utils/cancellation.js";
2
2
  import "../../../git/models/pullRequest.js";
3
3
  import { mergeAssessmentInto } from "../collectionMetadata.js";
4
- import { isGitHostIntegration, isIssuesHostIntegrationId, warnOnMissingSessionForDomain } from "../utils/integration.utils.js";
4
+ import { isIssuesHostIntegrationId, warnOnMissingSessionForDomain } from "../utils/integration.utils.js";
5
+ import { isGitHostIntegration } from "../models/publicIntegration.js";
5
6
  import { drainFlatPagesToRequestedPage, refusedPage, resolveContinuation, resolveCurrentPage, usableCursor } from "./paging.js";
6
7
  import { gitHostOnlySurfaceWarning, otherWarning, pullRequestSearchCapResultWarning, truncationWarning, unsupportedPullRequestSearchCriteriaWarning, unusableSearchScopeMessage } from "./warnings.js";
7
8
  import { runCaptured } from "./drains.js";
@@ -1 +1 @@
1
- {"version":3,"file":"searchPullRequests.js","names":[],"sources":["../../../../../plus/integrations/src/reads/searchPullRequests.ts"],"sourcesContent":["import type { PullRequestSearchCriteria, PullRequestShape } from '@gitlens/git/models/pullRequest.js';\nimport { defaultPullRequestSort } from '@gitlens/git/models/pullRequest.js';\nimport { CancellationError } from '@gitlens/utils/cancellation.js';\nimport { mergeAssessmentInto } from '../collectionMetadata.js';\nimport type { IntegrationIds } from '../constants.js';\nimport type { ProviderReposInput } from '../providers/models.js';\nimport type { ProviderPagedResult, ProviderWarning } from '../results.js';\nimport {\n\tisGitHostIntegration,\n\tisIssuesHostIntegrationId,\n\twarnOnMissingSessionForDomain,\n} from '../utils/integration.utils.js';\nimport type { ProviderReadContext } from './context.js';\nimport { runCaptured } from './drains.js';\nimport { resolvePullRequestSearchCriteria, resolvePullRequestSearchScope } from './filters.js';\nimport {\n\tdrainFlatPagesToRequestedPage,\n\trefusedPage,\n\tresolveContinuation,\n\tresolveCurrentPage,\n\tusableCursor,\n} from './paging.js';\nimport {\n\tgitHostOnlySurfaceWarning,\n\totherWarning,\n\tpullRequestSearchCapResultWarning,\n\ttruncationWarning,\n\tunsupportedPullRequestSearchCriteriaWarning,\n\tunusableSearchScopeMessage,\n} from './warnings.js';\n\n/**\n * Pull requests matching structured criteria over a repository/organization or current-user relationship scope.\n *\n * The read is deliberately separate from `listPullRequestsPage`: the list has provider-specific \"my PRs\"\n * semantics and no text channel, while this method promises a sanitized query, an ordering the caller chooses\n * (`criteria.sort`, defaulting to most-recently-updated-first) and that is applied to the merged page as a whole,\n * one upstream request per cursor-threaded page, and a quantified omission at the provider's result ceiling that\n * names the order the reachable window was selected under.\n */\nexport async function searchPullRequestsPage(\n\tctx: ProviderReadContext,\n\toptions: {\n\t\tproviderId: IntegrationIds;\n\t\trepos?: ProviderReposInput;\n\t\torg?: string;\n\t\tcriteria?: PullRequestSearchCriteria;\n\t\tpage?: number;\n\t\tcursor?: string;\n\t\t/** Per relationship × state facet, not per page; see {@link IntegrationManager.searchPullRequestsPage}. */\n\t\titemsPerPage?: number;\n\t\tforceSync?: boolean;\n\t\tconnectionId?: string;\n\t\tdomain?: string;\n\t\t/** See {@link IntegrationManager.searchPullRequestsPage}. */\n\t\tsummary?: boolean;\n\t\t/** See {@link IntegrationManager.searchPullRequestsPage}. */\n\t\tmergeQueue?: boolean;\n\t\t/** See {@link IntegrationManager.searchPullRequestsPage}. */\n\t\tcancellation?: AbortSignal;\n\t},\n): Promise<ProviderPagedResult<PullRequestShape>> {\n\tconst cancellation = options.cancellation;\n\tif (cancellation?.aborted) throw new CancellationError();\n\n\tconst page = Math.max(1, Math.trunc(options.page ?? 1));\n\tconst refused = (warning: ProviderWarning) => refusedPage<PullRequestShape>(1, [warning], true);\n\n\tif (isIssuesHostIntegrationId(options.providerId)) {\n\t\treturn refused(\n\t\t\tgitHostOnlySurfaceWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tundefined,\n\t\t\t\toptions.connectionId,\n\t\t\t\t'Filtered pull request search',\n\t\t\t),\n\t\t);\n\t}\n\n\tconst integration = await ctx.getIntegrationForRead(options.providerId, options.connectionId, options.domain);\n\t// Every refusal below resolves as a failed page, which a cancelled caller must never receive.\n\tif (cancellation?.aborted) throw new CancellationError();\n\tif (integration == null) {\n\t\tconst early = ctx.earlyReturnConnectionWarnings(options.providerId, options.connectionId, options.domain);\n\t\treturn refusedPage(1, early.warnings, early.fetchFailed);\n\t}\n\tif (!isGitHostIntegration(integration)) {\n\t\treturn refused(\n\t\t\tgitHostOnlySurfaceWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tundefined,\n\t\t\t\toptions.connectionId,\n\t\t\t\t'Filtered pull request search',\n\t\t\t),\n\t\t);\n\t}\n\n\tawait ctx.forceRefreshIfRequested(integration, options.forceSync, options.connectionId);\n\tif (cancellation?.aborted) throw new CancellationError();\n\n\tconst domain = ctx.domainForRead(integration, options.providerId, options.connectionId, options.domain);\n\tconst warnOnMissingSession = warnOnMissingSessionForDomain(options.providerId, options.domain);\n\n\tconst resolved = resolvePullRequestSearchCriteria(options.providerId, options.criteria);\n\tif (resolved.rejection != null) {\n\t\treturn refused(\n\t\t\tunsupportedPullRequestSearchCriteriaWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tdomain,\n\t\t\t\toptions.connectionId,\n\t\t\t\tresolved.rejection,\n\t\t\t),\n\t\t);\n\t}\n\n\tconst scope = resolvePullRequestSearchScope(options.providerId, options.repos, options.org, options.criteria);\n\tswitch (scope.rejection?.reason) {\n\t\tcase 'unscoped':\n\t\t\treturn refused(\n\t\t\t\totherWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t'A filtered pull request search must be scoped: pass `repos`, `org`, or at least one current-user relationship.',\n\t\t\t\t),\n\t\t\t);\n\t\tcase 'repo-ids':\n\t\t\treturn refused(\n\t\t\t\totherWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t'A filtered pull request search cannot be scoped by repository id; pass repository descriptors (namespace + name) instead.',\n\t\t\t\t),\n\t\t\t);\n\t\tcase 'unsupported-repository-scope':\n\t\tcase 'unsupported-organization-scope':\n\t\t\treturn refused(\n\t\t\t\tunsupportedPullRequestSearchCriteriaWarning(options.providerId, domain, options.connectionId, {\n\t\t\t\t\treason: 'unsupported-criteria',\n\t\t\t\t\tcriteria: [\n\t\t\t\t\t\tscope.rejection.reason === 'unsupported-repository-scope'\n\t\t\t\t\t\t\t? 'repositoryScope'\n\t\t\t\t\t\t\t: 'organizationScope',\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t);\n\t\t// A scope the query cannot spell, refused rather than sanitized — see `isUsableSearchScopeName`.\n\t\tcase 'unusable-scope':\n\t\t\treturn refused(\n\t\t\t\totherWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\tunusableSearchScopeMessage('pull request search scopes', scope.rejection.scopes),\n\t\t\t\t),\n\t\t\t);\n\t}\n\n\tconst readPage = async (cursor: string | undefined) => {\n\t\tconst read = await runCaptured(\n\t\t\toptions.providerId,\n\t\t\tdomain,\n\t\t\toptions.connectionId,\n\t\t\t() =>\n\t\t\t\tintegration.searchPullRequestsPageResult(\n\t\t\t\t\t{\n\t\t\t\t\t\trepos: scope.repos,\n\t\t\t\t\t\torg: options.org,\n\t\t\t\t\t\tcriteria: options.criteria,\n\t\t\t\t\t\tcursor: cursor,\n\t\t\t\t\t\tpageSize: options.itemsPerPage,\n\t\t\t\t\t\tsummary: options.summary,\n\t\t\t\t\t\tmergeQueue: options.mergeQueue,\n\t\t\t\t\t},\n\t\t\t\t\tcancellation,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t),\n\t\t\t{ warnOnMissingSession: warnOnMissingSession },\n\t\t);\n\t\t// The aborted request comes back as a failed read; a cancelled caller is owed the cancellation instead, and\n\t\t// a drain walking to a page number must stop here rather than read its next page.\n\t\tif (cancellation?.aborted) throw new CancellationError();\n\n\t\treturn read;\n\t};\n\n\tconst first = await readPage(options.cursor);\n\tconst warnings = first.warning != null ? [first.warning] : [];\n\tlet totalCount = first.value?.totalCount;\n\t// Facets whose rows are missing while their siblings answered. A page reports the walk's completeness so far, not\n\t// just its own requests: a failure dropped for good repeats on every later page, while one that recovered on a\n\t// retry drops out because its rows came back. So the latest page read is the one to assess, including when a later\n\t// page fails the walk outright — never union the pages, which would bring a recovered failure back.\n\tlet lastMetadata = first.value?.metadata;\n\tlet limitReached = first.value?.limitReached === true;\n\tconst drained = await drainFlatPagesToRequestedPage(first, {\n\t\trequestedPage: page,\n\t\tsuppliedCursor: options.cursor,\n\t\twarnings: warnings,\n\t\treadPage: readPage,\n\t\tfold: p => {\n\t\t\tif (p.totalCount != null) {\n\t\t\t\ttotalCount = Math.max(totalCount ?? 0, p.totalCount);\n\t\t\t}\n\t\t\tlastMetadata = p.metadata;\n\t\t\tlimitReached ||= p.limitReached === true;\n\t\t},\n\t});\n\tconst { value, currentPage, requestedPageMissing } = drained;\n\tconst assessment = mergeAssessmentInto(warnings, options.providerId, domain, options.connectionId, lastMetadata);\n\n\tif (value == null && warnings.length === 0) {\n\t\treturn refused(\n\t\t\tunsupportedPullRequestSearchCriteriaWarning(options.providerId, domain, options.connectionId, {\n\t\t\t\treason: 'unsupported-search',\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst items = requestedPageMissing ? [] : (value?.values ?? []);\n\tconst continuation = resolveContinuation(\n\t\t{\n\t\t\thasMore: requestedPageMissing ? false : (value?.hasMore ?? false),\n\t\t\tcursor: requestedPageMissing ? undefined : usableCursor(value?.cursor),\n\t\t\ttruncated: drained.truncated,\n\t\t},\n\t\tundefined,\n\t);\n\t// A facet that failed while its siblings answered leaves the result incomplete, as `listPullRequestsPage` reports\n\t// it; its warning is already in `warnings`, so it adds no generic one below.\n\tconst truncated = continuation.truncated || assessment.truncated;\n\tif (truncated && warnings.length === 0) {\n\t\twarnings.push(\n\t\t\tpullRequestSearchCapResultWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tdomain,\n\t\t\t\toptions.connectionId,\n\t\t\t\ttotalCount,\n\t\t\t\toptions.criteria?.sort ?? defaultPullRequestSort,\n\t\t\t\tlimitReached,\n\t\t\t) ??\n\t\t\t\ttruncationWarning(options.providerId, domain, options.connectionId, 'Pull request search', 'exhausted'),\n\t\t);\n\t}\n\n\treturn {\n\t\titems: items,\n\t\twarnings: warnings,\n\t\tpage: {\n\t\t\tcurrentPage: requestedPageMissing\n\t\t\t\t? page\n\t\t\t\t: resolveCurrentPage({\n\t\t\t\t\t\tproviderPage: currentPage,\n\t\t\t\t\t\trequestedPage: page,\n\t\t\t\t\t\tsuppliedCursor: options.cursor,\n\t\t\t\t\t\tpageAdvanceable: false,\n\t\t\t\t\t}),\n\t\t\titemsPerPage: items.length,\n\t\t\ttruncated: truncated || undefined,\n\t\t},\n\t\thasMore: continuation.hasMore,\n\t\tcursor: continuation.cursor,\n\t\tfetchFailed: drained.fetchFailed || assessment.fetchFailed || undefined,\n\t};\n}\n"],"mappings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EAAE,OAAO,aAAa,yBAAyB;CACrD,MAAM,aAAa,oBAAoB,UAAU,QAAQ,YAAY,QAAQ,QAAQ,cAAc,YAAY;CAE/G,IAAI,SAAS,QAAQ,SAAS,WAAW,GACxC,OAAO,QACN,4CAA4C,QAAQ,YAAY,QAAQ,QAAQ,cAAc,EAC7F,QAAQ,qBACT,CAAC,CACF;CAGD,MAAM,QAAQ,uBAAuB,CAAC,IAAK,OAAO,UAAU,CAAC;CAC7D,MAAM,eAAe,oBACpB;EACC,SAAS,uBAAuB,QAAS,OAAO,WAAW;EAC3D,QAAQ,uBAAuB,KAAA,IAAY,aAAa,OAAO,MAAM;EACrE,WAAW,QAAQ;CACpB,GACA,KAAA,CACD;CAGA,MAAM,YAAY,aAAa,aAAa,WAAW;CACvD,IAAI,aAAa,SAAS,WAAW,GACpC,SAAS,KACR,kCACC,QAAQ,YACR,QACA,QAAQ,cACR,YACA,QAAQ,UAAU,QAAA,gBAClB,YACD,KACC,kBAAkB,QAAQ,YAAY,QAAQ,QAAQ,cAAc,uBAAuB,WAAW,CACxG;CAGD,OAAO;EACC;EACG;EACV,MAAM;GACL,aAAa,uBACV,OACA,mBAAmB;IACnB,cAAc;IACd,eAAe;IACf,gBAAgB,QAAQ;IACxB,iBAAiB;GAClB,CAAC;GACH,cAAc,MAAM;GACpB,WAAW,aAAa,KAAA;EACzB;EACA,SAAS,aAAa;EACtB,QAAQ,aAAa;EACrB,aAAa,QAAQ,eAAe,WAAW,eAAe,KAAA;CAC/D;AACD"}
1
+ {"version":3,"file":"searchPullRequests.js","names":[],"sources":["../../../../../plus/integrations/src/reads/searchPullRequests.ts"],"sourcesContent":["import type { PullRequestSearchCriteria, PullRequestShape } from '@gitlens/git/models/pullRequest.js';\nimport { defaultPullRequestSort } from '@gitlens/git/models/pullRequest.js';\nimport { CancellationError } from '@gitlens/utils/cancellation.js';\nimport { mergeAssessmentInto } from '../collectionMetadata.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { isGitHostIntegration } from '../models/publicIntegration.js';\nimport type { ProviderReposInput } from '../providers/models.js';\nimport type { ProviderPagedResult, ProviderWarning } from '../results.js';\nimport { isIssuesHostIntegrationId, warnOnMissingSessionForDomain } from '../utils/integration.utils.js';\nimport type { ProviderReadContext } from './context.js';\nimport { runCaptured } from './drains.js';\nimport { resolvePullRequestSearchCriteria, resolvePullRequestSearchScope } from './filters.js';\nimport {\n\tdrainFlatPagesToRequestedPage,\n\trefusedPage,\n\tresolveContinuation,\n\tresolveCurrentPage,\n\tusableCursor,\n} from './paging.js';\nimport {\n\tgitHostOnlySurfaceWarning,\n\totherWarning,\n\tpullRequestSearchCapResultWarning,\n\ttruncationWarning,\n\tunsupportedPullRequestSearchCriteriaWarning,\n\tunusableSearchScopeMessage,\n} from './warnings.js';\n\n/**\n * Pull requests matching structured criteria over a repository/organization or current-user relationship scope.\n *\n * The read is deliberately separate from `listPullRequestsPage`: the list has provider-specific \"my PRs\"\n * semantics and no text channel, while this method promises a sanitized query, an ordering the caller chooses\n * (`criteria.sort`, defaulting to most-recently-updated-first) and that is applied to the merged page as a whole,\n * one upstream request per cursor-threaded page, and a quantified omission at the provider's result ceiling that\n * names the order the reachable window was selected under.\n */\nexport async function searchPullRequestsPage(\n\tctx: ProviderReadContext,\n\toptions: {\n\t\tproviderId: IntegrationIds;\n\t\trepos?: ProviderReposInput;\n\t\torg?: string;\n\t\tcriteria?: PullRequestSearchCriteria;\n\t\tpage?: number;\n\t\tcursor?: string;\n\t\t/** Per relationship × state facet, not per page; see {@link IntegrationManager.searchPullRequestsPage}. */\n\t\titemsPerPage?: number;\n\t\tforceSync?: boolean;\n\t\tconnectionId?: string;\n\t\tdomain?: string;\n\t\t/** See {@link IntegrationManager.searchPullRequestsPage}. */\n\t\tsummary?: boolean;\n\t\t/** See {@link IntegrationManager.searchPullRequestsPage}. */\n\t\tmergeQueue?: boolean;\n\t\t/** See {@link IntegrationManager.searchPullRequestsPage}. */\n\t\tcancellation?: AbortSignal;\n\t},\n): Promise<ProviderPagedResult<PullRequestShape>> {\n\tconst cancellation = options.cancellation;\n\tif (cancellation?.aborted) throw new CancellationError();\n\n\tconst page = Math.max(1, Math.trunc(options.page ?? 1));\n\tconst refused = (warning: ProviderWarning) => refusedPage<PullRequestShape>(1, [warning], true);\n\n\tif (isIssuesHostIntegrationId(options.providerId)) {\n\t\treturn refused(\n\t\t\tgitHostOnlySurfaceWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tundefined,\n\t\t\t\toptions.connectionId,\n\t\t\t\t'Filtered pull request search',\n\t\t\t),\n\t\t);\n\t}\n\n\tconst integration = await ctx.getIntegrationForRead(options.providerId, options.connectionId, options.domain);\n\t// Every refusal below resolves as a failed page, which a cancelled caller must never receive.\n\tif (cancellation?.aborted) throw new CancellationError();\n\tif (integration == null) {\n\t\tconst early = ctx.earlyReturnConnectionWarnings(options.providerId, options.connectionId, options.domain);\n\t\treturn refusedPage(1, early.warnings, early.fetchFailed);\n\t}\n\tif (!isGitHostIntegration(integration)) {\n\t\treturn refused(\n\t\t\tgitHostOnlySurfaceWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tundefined,\n\t\t\t\toptions.connectionId,\n\t\t\t\t'Filtered pull request search',\n\t\t\t),\n\t\t);\n\t}\n\n\tawait ctx.forceRefreshIfRequested(integration, options.forceSync, options.connectionId);\n\tif (cancellation?.aborted) throw new CancellationError();\n\n\tconst domain = ctx.domainForRead(integration, options.providerId, options.connectionId, options.domain);\n\tconst warnOnMissingSession = warnOnMissingSessionForDomain(options.providerId, options.domain);\n\n\tconst resolved = resolvePullRequestSearchCriteria(options.providerId, options.criteria);\n\tif (resolved.rejection != null) {\n\t\treturn refused(\n\t\t\tunsupportedPullRequestSearchCriteriaWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tdomain,\n\t\t\t\toptions.connectionId,\n\t\t\t\tresolved.rejection,\n\t\t\t),\n\t\t);\n\t}\n\n\tconst scope = resolvePullRequestSearchScope(options.providerId, options.repos, options.org, options.criteria);\n\tswitch (scope.rejection?.reason) {\n\t\tcase 'unscoped':\n\t\t\treturn refused(\n\t\t\t\totherWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t'A filtered pull request search must be scoped: pass `repos`, `org`, or at least one current-user relationship.',\n\t\t\t\t),\n\t\t\t);\n\t\tcase 'repo-ids':\n\t\t\treturn refused(\n\t\t\t\totherWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t'A filtered pull request search cannot be scoped by repository id; pass repository descriptors (namespace + name) instead.',\n\t\t\t\t),\n\t\t\t);\n\t\tcase 'unsupported-repository-scope':\n\t\tcase 'unsupported-organization-scope':\n\t\t\treturn refused(\n\t\t\t\tunsupportedPullRequestSearchCriteriaWarning(options.providerId, domain, options.connectionId, {\n\t\t\t\t\treason: 'unsupported-criteria',\n\t\t\t\t\tcriteria: [\n\t\t\t\t\t\tscope.rejection.reason === 'unsupported-repository-scope'\n\t\t\t\t\t\t\t? 'repositoryScope'\n\t\t\t\t\t\t\t: 'organizationScope',\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t);\n\t\t// A scope the query cannot spell, refused rather than sanitized — see `isUsableSearchScopeName`.\n\t\tcase 'unusable-scope':\n\t\t\treturn refused(\n\t\t\t\totherWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\tunusableSearchScopeMessage('pull request search scopes', scope.rejection.scopes),\n\t\t\t\t),\n\t\t\t);\n\t}\n\n\tconst readPage = async (cursor: string | undefined) => {\n\t\tconst read = await runCaptured(\n\t\t\toptions.providerId,\n\t\t\tdomain,\n\t\t\toptions.connectionId,\n\t\t\t() =>\n\t\t\t\tintegration.searchPullRequestsPageResult(\n\t\t\t\t\t{\n\t\t\t\t\t\trepos: scope.repos,\n\t\t\t\t\t\torg: options.org,\n\t\t\t\t\t\tcriteria: options.criteria,\n\t\t\t\t\t\tcursor: cursor,\n\t\t\t\t\t\tpageSize: options.itemsPerPage,\n\t\t\t\t\t\tsummary: options.summary,\n\t\t\t\t\t\tmergeQueue: options.mergeQueue,\n\t\t\t\t\t},\n\t\t\t\t\tcancellation,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t),\n\t\t\t{ warnOnMissingSession: warnOnMissingSession },\n\t\t);\n\t\t// The aborted request comes back as a failed read; a cancelled caller is owed the cancellation instead, and\n\t\t// a drain walking to a page number must stop here rather than read its next page.\n\t\tif (cancellation?.aborted) throw new CancellationError();\n\n\t\treturn read;\n\t};\n\n\tconst first = await readPage(options.cursor);\n\tconst warnings = first.warning != null ? [first.warning] : [];\n\tlet totalCount = first.value?.totalCount;\n\t// Facets whose rows are missing while their siblings answered. A page reports the walk's completeness so far, not\n\t// just its own requests: a failure dropped for good repeats on every later page, while one that recovered on a\n\t// retry drops out because its rows came back. So the latest page read is the one to assess, including when a later\n\t// page fails the walk outright — never union the pages, which would bring a recovered failure back.\n\tlet lastMetadata = first.value?.metadata;\n\tlet limitReached = first.value?.limitReached === true;\n\tconst drained = await drainFlatPagesToRequestedPage(first, {\n\t\trequestedPage: page,\n\t\tsuppliedCursor: options.cursor,\n\t\twarnings: warnings,\n\t\treadPage: readPage,\n\t\tfold: p => {\n\t\t\tif (p.totalCount != null) {\n\t\t\t\ttotalCount = Math.max(totalCount ?? 0, p.totalCount);\n\t\t\t}\n\t\t\tlastMetadata = p.metadata;\n\t\t\tlimitReached ||= p.limitReached === true;\n\t\t},\n\t});\n\tconst { value, currentPage, requestedPageMissing } = drained;\n\tconst assessment = mergeAssessmentInto(warnings, options.providerId, domain, options.connectionId, lastMetadata);\n\n\tif (value == null && warnings.length === 0) {\n\t\treturn refused(\n\t\t\tunsupportedPullRequestSearchCriteriaWarning(options.providerId, domain, options.connectionId, {\n\t\t\t\treason: 'unsupported-search',\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst items = requestedPageMissing ? [] : (value?.values ?? []);\n\tconst continuation = resolveContinuation(\n\t\t{\n\t\t\thasMore: requestedPageMissing ? false : (value?.hasMore ?? false),\n\t\t\tcursor: requestedPageMissing ? undefined : usableCursor(value?.cursor),\n\t\t\ttruncated: drained.truncated,\n\t\t},\n\t\tundefined,\n\t);\n\t// A facet that failed while its siblings answered leaves the result incomplete, as `listPullRequestsPage` reports\n\t// it; its warning is already in `warnings`, so it adds no generic one below.\n\tconst truncated = continuation.truncated || assessment.truncated;\n\tif (truncated && warnings.length === 0) {\n\t\twarnings.push(\n\t\t\tpullRequestSearchCapResultWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tdomain,\n\t\t\t\toptions.connectionId,\n\t\t\t\ttotalCount,\n\t\t\t\toptions.criteria?.sort ?? defaultPullRequestSort,\n\t\t\t\tlimitReached,\n\t\t\t) ??\n\t\t\t\ttruncationWarning(options.providerId, domain, options.connectionId, 'Pull request search', 'exhausted'),\n\t\t);\n\t}\n\n\treturn {\n\t\titems: items,\n\t\twarnings: warnings,\n\t\tpage: {\n\t\t\tcurrentPage: requestedPageMissing\n\t\t\t\t? page\n\t\t\t\t: resolveCurrentPage({\n\t\t\t\t\t\tproviderPage: currentPage,\n\t\t\t\t\t\trequestedPage: page,\n\t\t\t\t\t\tsuppliedCursor: options.cursor,\n\t\t\t\t\t\tpageAdvanceable: false,\n\t\t\t\t\t}),\n\t\t\titemsPerPage: items.length,\n\t\t\ttruncated: truncated || undefined,\n\t\t},\n\t\thasMore: continuation.hasMore,\n\t\tcursor: continuation.cursor,\n\t\tfetchFailed: drained.fetchFailed || assessment.fetchFailed || undefined,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,eAAsB,uBACrB,KACA,SAmBiD;CACjD,MAAM,eAAe,QAAQ;CAC7B,IAAI,cAAc,SAAS,MAAM,IAAI,kBAAkB;CAEvD,MAAM,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,QAAQ,QAAQ,CAA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EAC7F,QAAQ,qBACT,CAAC,CACF;CAGD,MAAM,QAAQ,uBAAuB,CAAC,IAAK,OAAO,UAAU,CAAC;CAC7D,MAAM,eAAe,oBACpB;EACC,SAAS,uBAAuB,QAAS,OAAO,WAAW;EAC3D,QAAQ,uBAAuB,KAAA,IAAY,aAAa,OAAO,MAAM;EACrE,WAAW,QAAQ;CACpB,GACA,KAAA,CACD;CAGA,MAAM,YAAY,aAAa,aAAa,WAAW;CACvD,IAAI,aAAa,SAAS,WAAW,GACpC,SAAS,KACR,kCACC,QAAQ,YACR,QACA,QAAQ,cACR,YACA,QAAQ,UAAU,QAAA,gBAClB,YACD,KACC,kBAAkB,QAAQ,YAAY,QAAQ,QAAQ,cAAc,uBAAuB,WAAW,CACxG;CAGD,OAAO;EACC;EACG;EACV,MAAM;GACL,aAAa,uBACV,OACA,mBAAmB;IACnB,cAAc;IACd,eAAe;IACf,gBAAgB,QAAQ;IACxB,iBAAiB;GAClB,CAAC;GACH,cAAc,MAAM;GACpB,WAAW,aAAa,KAAA;EACzB;EACA,SAAS,aAAa;EACtB,QAAQ,aAAa;EACrB,aAAa,QAAQ,eAAe,WAAW,eAAe,KAAA;CAC/D;AACD"}
@@ -1,7 +1,7 @@
1
1
  import { PullRequestShape } from "../../../git/models/pullRequest.js";
2
2
  import { ProviderSweepResult } from "../results.js";
3
- import { ProviderReadContext } from "./context.js";
4
3
  import { ClosedPullRequestSweepOptions, PullRequestSweepOptions } from "../manager.js";
4
+ import { ProviderReadContext } from "./context.js";
5
5
  //#region ../plus/integrations/src/reads/sweeps.d.ts
6
6
  export declare function sweepPullRequests(ctx: ProviderReadContext, options?: PullRequestSweepOptions): Promise<ProviderSweepResult<PullRequestShape>>;
7
7
  /**
@@ -1,8 +1,9 @@
1
1
  import { mapBounded } from "../../../utils/promise.js";
2
- import "../constants.js";
3
2
  import { appendDedupedWarning } from "../results.js";
3
+ import "../providers/utils/providerPaging.js";
4
+ import { isIssuesHostIntegrationId } from "../utils/integration.utils.js";
4
5
  import { toPullRequestRow } from "../providers/models.js";
5
- import { isGitHostIntegration, isIssuesHostIntegrationId } from "../utils/integration.utils.js";
6
+ import { isGitHostIntegration } from "../models/publicIntegration.js";
6
7
  import { gitHostOnlySurfaceWarning, noConnectionWarning, unsupportedAccountWidePullRequestFiltersWarning, unsupportedFiltersWarning } from "./warnings.js";
7
8
  import { drainPullRequests, getPullRequestViewers, resolvePullRequestSweepTargets } from "./drains.js";
8
9
  import { resolveAccountWidePullRequestFilters, resolvePullRequestFilters } from "./filters.js";