@gitkraken/core-gitlens 0.45.0 → 0.47.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.
- package/CHANGELOG.md +35 -1
- package/dist/git/models/remote.js +2 -2
- package/dist/git/models/remote.js.map +1 -1
- package/dist/git/remotes/matcher.js +25 -3
- package/dist/git/remotes/matcher.js.map +1 -1
- package/dist/git/utils/branchLanded.utils.d.ts +7 -0
- package/dist/git/utils/branchLanded.utils.js +10 -1
- package/dist/git/utils/branchLanded.utils.js.map +1 -1
- package/dist/git/utils/remote.utils.d.ts +1 -0
- package/dist/git/utils/remote.utils.js +14 -5
- package/dist/git/utils/remote.utils.js.map +1 -1
- package/dist/git-cli/parsers/logParser.js +227 -468
- package/dist/git-cli/parsers/logParser.js.map +1 -1
- package/dist/git-cli/parsers/refParser.js +4 -4
- package/dist/git-cli/parsers/refParser.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +5 -0
- package/dist/git-cli/providers/branches.js +25 -21
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/config.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/staging.js +1 -1
- package/dist/ipc/discovery.js +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
- package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.d.ts +31 -0
- package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js +166 -0
- package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js.map +1 -0
- package/dist/plus/git-github/api/github.d.ts +13 -5
- package/dist/plus/git-github/api/github.js +53 -13
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueWrites.d.ts +7 -1
- package/dist/plus/git-github/api/issueWrites.js +62 -32
- package/dist/plus/git-github/api/issueWrites.js.map +1 -1
- package/dist/plus/git-github/api/pullRequestWrites.d.ts +7 -3
- package/dist/plus/git-github/api/pullRequestWrites.js +120 -67
- package/dist/plus/git-github/api/pullRequestWrites.js.map +1 -1
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.d.ts +44 -0
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js +199 -0
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js.map +1 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +7 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.js +53 -7
- package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +2 -38
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +0 -199
- package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +4 -2
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js +12 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
- package/dist/plus/integrations/authentication/models.d.ts +0 -1
- package/dist/plus/integrations/authentication/models.js +1 -2
- package/dist/plus/integrations/authentication/models.js.map +1 -1
- package/dist/plus/integrations/constants.d.ts +0 -10
- package/dist/plus/integrations/constants.js +1 -95
- package/dist/plus/integrations/constants.js.map +1 -1
- package/dist/plus/integrations/context.d.ts +17 -17
- package/dist/plus/integrations/index.d.ts +44 -25
- package/dist/plus/integrations/index.js +41 -8
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +24 -24
- package/dist/plus/integrations/integrationService.js +125 -34
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/lite.js +1 -1
- package/dist/plus/integrations/lite.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +81 -21
- package/dist/plus/integrations/models/actionablePullRequest.d.ts +213 -0
- package/dist/plus/integrations/models/actionablePullRequest.js +25 -0
- package/dist/plus/integrations/models/actionablePullRequest.js.map +1 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +13 -46
- package/dist/plus/integrations/models/gitHostIntegration.js +22 -8
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +11 -175
- package/dist/plus/integrations/models/integration.js +22 -76
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issueTrackerWrites.d.ts +128 -0
- package/dist/plus/integrations/models/issueTrackerWrites.js +0 -0
- package/dist/plus/integrations/models/issuesIntegration.d.ts +9 -5
- package/dist/plus/integrations/models/issuesIntegration.js +5 -3
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
- package/dist/plus/integrations/models/publicIntegration.d.ts +257 -0
- package/dist/plus/integrations/models/publicIntegration.js +21 -0
- package/dist/plus/integrations/models/publicIntegration.js.map +1 -0
- package/dist/plus/integrations/providerFilters.d.ts +58 -0
- package/dist/plus/integrations/providerFilters.js.map +1 -1
- package/dist/plus/integrations/providers/actionablePullRequests.d.ts +19 -0
- package/dist/plus/integrations/providers/actionablePullRequests.js +32 -0
- package/dist/plus/integrations/providers/actionablePullRequests.js.map +1 -0
- package/dist/plus/integrations/providers/apiClients.d.ts +1 -2
- package/dist/plus/integrations/providers/apiClients.js.map +1 -1
- package/dist/plus/integrations/providers/asana.d.ts +3 -2
- package/dist/plus/integrations/providers/asana.js +2 -1
- package/dist/plus/integrations/providers/asana.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.d.ts +1 -1
- package/dist/plus/integrations/providers/azure/azure.js +1 -1
- package/dist/plus/integrations/providers/azure/azure.utils.d.ts +10 -3
- package/dist/plus/integrations/providers/azure/azure.utils.js +5 -1
- package/dist/plus/integrations/providers/azure/azure.utils.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts +1 -5
- package/dist/plus/integrations/providers/azure/models.js +1 -1
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +8 -5
- package/dist/plus/integrations/providers/azureDevOps.js +2 -1
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +5 -4
- package/dist/plus/integrations/providers/azureDevOpsServer.js +3 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +2 -2
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.d.ts +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.d.ts +5 -4
- package/dist/plus/integrations/providers/bitbucket-server.js +2 -1
- package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket.d.ts +4 -3
- package/dist/plus/integrations/providers/bitbucket.js +2 -1
- package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/github/github.d.ts +0 -1
- package/dist/plus/integrations/providers/github/github.js +1 -1
- package/dist/plus/integrations/providers/github/github.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +29 -11
- package/dist/plus/integrations/providers/github.js +195 -78
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +2 -2
- package/dist/plus/integrations/providers/gitlab/gitlab.js +1 -2
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts +14 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/models.d.ts +2 -10
- package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.d.ts +7 -5
- package/dist/plus/integrations/providers/gitlab.js +2 -1
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
- package/dist/plus/integrations/providers/jira-server.d.ts +4 -4
- package/dist/plus/integrations/providers/jira-server.js +3 -2
- package/dist/plus/integrations/providers/jira-server.js.map +1 -1
- package/dist/plus/integrations/providers/jira.d.ts +3 -3
- package/dist/plus/integrations/providers/jira.js +4 -3
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.d.ts +3 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueWriteErrors.d.ts +10 -0
- package/dist/plus/integrations/providers/jiraIssueWriteErrors.js +68 -0
- package/dist/plus/integrations/providers/jiraIssueWriteErrors.js.map +1 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.d.ts +40 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.js +397 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.js.map +1 -0
- package/dist/plus/integrations/providers/linear.d.ts +4 -3
- package/dist/plus/integrations/providers/linear.js +3 -2
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/providers/linearIssuesEtag.d.ts +1 -1
- package/dist/plus/integrations/providers/linearIssuesEtag.js +1 -1
- package/dist/plus/integrations/providers/linearIssuesEtag.js.map +1 -1
- package/dist/plus/integrations/providers/metadata.d.ts +136 -0
- package/dist/plus/integrations/providers/metadata.js +513 -0
- package/dist/plus/integrations/providers/metadata.js.map +1 -0
- package/dist/plus/integrations/providers/models.d.ts +10 -206
- package/dist/plus/integrations/providers/models.js +8 -539
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +7 -3
- package/dist/plus/integrations/providers/providersApi.js +23 -11
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/trello.d.ts +1 -1
- package/dist/plus/integrations/providers/trello.js +2 -1
- package/dist/plus/integrations/providers/trello.js.map +1 -1
- package/dist/plus/integrations/providers/utils/providerPaging.d.ts +2 -0
- package/dist/plus/integrations/providers/utils/providerPaging.js +3 -2
- package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
- package/dist/plus/integrations/providers/utils.d.ts +119 -10
- package/dist/plus/integrations/providers/utils.js +57 -3
- package/dist/plus/integrations/providers/utils.js.map +1 -1
- package/dist/plus/integrations/reads/autolinks.d.ts +1 -1
- package/dist/plus/integrations/reads/autolinks.js +1 -1
- package/dist/plus/integrations/reads/autolinks.js.map +1 -1
- package/dist/plus/integrations/reads/broaden.d.ts +1 -1
- package/dist/plus/integrations/reads/broaden.js +3 -2
- package/dist/plus/integrations/reads/broaden.js.map +1 -1
- package/dist/plus/integrations/reads/context.d.ts +1 -1
- package/dist/plus/integrations/reads/counts.d.ts +1 -88
- package/dist/plus/integrations/reads/counts.js +4 -2
- package/dist/plus/integrations/reads/counts.js.map +1 -1
- package/dist/plus/integrations/reads/currentAccount.d.ts +1 -18
- package/dist/plus/integrations/reads/currentAccount.js.map +1 -1
- package/dist/plus/integrations/reads/drains.d.ts +4 -3
- package/dist/plus/integrations/reads/drains.js +1 -1
- package/dist/plus/integrations/reads/drains.js.map +1 -1
- package/dist/plus/integrations/reads/etag.d.ts +174 -3
- package/dist/plus/integrations/reads/etag.js +69 -14
- package/dist/plus/integrations/reads/etag.js.map +1 -1
- package/dist/plus/integrations/reads/filters.d.ts +3 -61
- package/dist/plus/integrations/reads/filters.js +1 -1
- package/dist/plus/integrations/reads/filters.js.map +1 -1
- package/dist/plus/integrations/reads/hierarchy.d.ts +1 -1
- package/dist/plus/integrations/reads/hierarchy.js +4 -2
- package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
- package/dist/plus/integrations/reads/issueBatch.d.ts +2 -102
- package/dist/plus/integrations/reads/issueBatch.js +3 -4
- package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.d.ts +1 -1
- package/dist/plus/integrations/reads/issueTracker.js +4 -3
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
- package/dist/plus/integrations/reads/issues.d.ts +1 -1
- package/dist/plus/integrations/reads/issues.js +4 -2
- package/dist/plus/integrations/reads/issues.js.map +1 -1
- package/dist/plus/integrations/reads/paging.d.ts +1 -1
- package/dist/plus/integrations/reads/paging.js +1 -1
- package/dist/plus/integrations/reads/paging.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestActivity.d.ts +1 -24
- package/dist/plus/integrations/reads/pullRequestActivity.js +2 -1
- package/dist/plus/integrations/reads/pullRequestActivity.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBatch.d.ts +2 -56
- package/dist/plus/integrations/reads/pullRequestBatch.js +23 -3
- package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBranches.d.ts +1 -47
- package/dist/plus/integrations/reads/pullRequestBranches.js +2 -1
- package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestCheckLogs.d.ts +1 -15
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js +2 -1
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequests.js +4 -2
- package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestsForCommits.d.ts +1 -16
- package/dist/plus/integrations/reads/pullRequestsForCommits.js +2 -1
- package/dist/plus/integrations/reads/pullRequestsForCommits.js.map +1 -1
- package/dist/plus/integrations/reads/resolveRepository.js +10 -5
- package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
- package/dist/plus/integrations/reads/searchIssues.js +2 -1
- package/dist/plus/integrations/reads/searchIssues.js.map +1 -1
- package/dist/plus/integrations/reads/searchPullRequests.js +2 -1
- package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/sweeps.d.ts +1 -1
- package/dist/plus/integrations/reads/sweeps.js +3 -2
- package/dist/plus/integrations/reads/sweeps.js.map +1 -1
- package/dist/plus/integrations/reads/warnings.d.ts +1 -1
- package/dist/plus/integrations/reads/warnings.js +1 -1
- package/dist/plus/integrations/reads/warnings.js.map +1 -1
- package/dist/plus/integrations/results.d.ts +324 -2
- package/dist/plus/integrations/results.js.map +1 -1
- package/dist/plus/integrations/telemetry.d.ts +0 -10
- package/dist/plus/integrations/telemetry.js +0 -11
- package/dist/plus/integrations/utils/domain.utils.d.ts +1 -0
- package/dist/plus/integrations/utils/domain.utils.js +10 -2
- package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
- package/dist/plus/integrations/utils/integration.utils.d.ts +2 -6
- package/dist/plus/integrations/utils/integration.utils.js +8 -9
- package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
- package/dist/utils/env/node/exec.js +2 -2
- package/dist/utils/keys/chord.d.ts +13 -2
- package/dist/utils/keys/chord.js +76 -17
- package/dist/utils/keys/chord.js.map +1 -1
- package/dist/utils/keys/keybinding.d.ts +12 -0
- package/dist/utils/keys/keybinding.js +52 -2
- package/dist/utils/keys/keybinding.js.map +1 -1
- package/dist/utils/markdown.d.ts +21 -0
- package/dist/utils/markdown.js +33 -1
- package/dist/utils/markdown.js.map +1 -1
- package/docs/integrations.md +174 -19
- package/package.json +5 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +0 -1
- package/dist/plus/integrations/telemetry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucket.js","names":["Logger"],"sources":["../../../../../../plus/integrations/src/providers/bitbucket/bitbucket.ts"],"sourcesContent":["import { captureReadNodes, copyReadProvenance, createReadCapture } from '@gitkraken/provider-apis/read-provenance';\nimport * as l10n from '@vscode/l10n';\nimport { reportRequestFailure } from '@gitlens/git/errors.js';\nimport type { Account, CommitAuthor, UnidentifiedAuthor } from '@gitlens/git/models/author.js';\nimport type { DefaultBranch } from '@gitlens/git/models/defaultBranch.js';\nimport type { Issue } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequest, IssueOrPullRequestType } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { PullRequest, PullRequestProjection } from '@gitlens/git/models/pullRequest.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\nimport type { RepositoryMetadata } from '@gitlens/git/models/repositoryMetadata.js';\nimport { CancellationError, isCancellationError } from '@gitlens/utils/cancellation.js';\nimport { trace } from '@gitlens/utils/decorators/log.js';\nimport type { Disposable } from '@gitlens/utils/disposable.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport type { ScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { maybeStopWatch } from '@gitlens/utils/stopwatch.js';\nimport { equalsIgnoreCase } from '@gitlens/utils/string.js';\nimport type { TokenWithInfo } from '../../authentication/models.js';\nimport type { IntegrationServiceContext } from '../../context.js';\nimport {\n\tAuthenticationError,\n\tAuthenticationErrorReason,\n\tisRateLimitResponse,\n\tProviderFetchError,\n\tRequestClientError,\n\tRequestNotFoundError,\n\ttoRateLimitError,\n} from '../../errors.js';\nimport type { PullRequestEtagInclude } from '../../models/integration.js';\nimport { encodePathSegment } from '../../utils/domain.utils.js';\nimport type { ProviderApiConfig } from '../apiConfig.js';\nimport { baseProviderApiConfig } from '../apiConfig.js';\nimport type { BitbucketServerCommit, BitbucketServerPullRequest } from '../bitbucket-server/models.js';\nimport { normalizeBitbucketServerPullRequest } from '../bitbucket-server/models.js';\nimport { fromProviderPullRequest } from '../models.js';\nimport { CommitReadRefusedError, isCommitReadRefusal, isNotFoundResponse } from '../providerErrors.js';\nimport { selectBranchPullRequests } from '../utils/providerPaging.js';\nimport type {\n\tBitbucketCommit,\n\tBitbucketIssue,\n\tBitbucketPullRequest,\n\tBitbucketPullRequestEtagNode,\n\tBitbucketPullRequestState,\n\tBitbucketRepository,\n} from './models.js';\nimport {\n\tbitbucketEtagFieldsMaxIds,\n\tbitbucketIssueStateToState,\n\tfromBitbucketIssue,\n\tfromBitbucketPullRequest,\n\tparseRawBitbucketAuthor,\n} from './models.js';\n\n/** KEEP: reads the message `ProviderFetchError.fromResponse` folds the body into; the body is already consumed. */\nfunction isCommitLinksAppMissing(ex: unknown): boolean {\n\tconst original: unknown = ex instanceof Error && 'original' in ex ? ex.original : ex;\n\treturn original instanceof ProviderFetchError && original.message.includes('Invalid or unknown installation');\n}\n\nexport class BitbucketCommitNotFoundError extends CommitReadRefusedError {}\n\nexport class BitbucketCommitPullRequestsUnindexedError extends CommitReadRefusedError {}\n\nexport class BitbucketCommitLinksAppMissingError extends CommitReadRefusedError {\n\tconstructor(readonly commitUrl: string) {\n\t\tsuper(\n\t\t\t`Bitbucket lists a commit's pull requests only once the Bitbucket pull request commit links app is installed; choosing 'Go to pull request' on a commit (${commitUrl}) installs it.`,\n\t\t);\n\t}\n}\n\nfunction indexedRepositoryKey(token: TokenWithInfo, owner: string, repo: string): string {\n\treturn `${token.accessToken}|${`${owner}/${repo}`.toLowerCase()}`;\n}\n\nexport class BitbucketApi implements Disposable {\n\tprivate readonly _disposable: Disposable | undefined;\n\n\tconstructor(private readonly config: ProviderApiConfig) {\n\t\tthis._disposable = config.onConfigChanged?.(() => this.resetCaches());\n\t}\n\n\tdispose(): void {\n\t\tthis._disposable?.dispose();\n\t}\n\n\tprivate resetCaches(): void {\n\t\tthis._indexedRepositories.clear();\n\t}\n\n\tprivate readonly _indexedRepositories = new Set<string>();\n\n\tisRepositoryIndexed(token: TokenWithInfo, owner: string, repo: string): boolean {\n\t\treturn this._indexedRepositories.has(indexedRepositoryKey(token, owner, repo));\n\t}\n\n\tprivate readonly _commitLinksAppNoticeShownFor = new Set<string>();\n\n\t/**\n\t * Shows the notice that the pull request commit links app must be installed once per workspace for the life of\n\t * this client.\n\t */\n\tnotifyCommitLinksAppMissing(owner: string, commitWebUrl: string): void {\n\t\tconst workspace = owner.toLowerCase();\n\t\tif (this._commitLinksAppNoticeShownFor.has(workspace)) return;\n\n\t\tthis._commitLinksAppNoticeShownFor.add(workspace);\n\t\tthis.config.onBitbucketCommitLinksAppMissing?.(commitWebUrl);\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, branch, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbranch: branch,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getPullRequestForBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbranch: string,\n\t\tbaseUrl: string,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst response = await this.request<{\n\t\t\tvalues: BitbucketPullRequest[];\n\t\t\tpagelen: number;\n\t\t\tsize: number;\n\t\t\tpage: number;\n\t\t}>(\n\t\t\tprovider,\n\t\t\ttoken,\n\t\t\tbaseUrl,\n\t\t\t`repositories/${owner}/${repo}/pullrequests?q=source.branch.name=\"${branch}\"&fields=%2Bvalues.reviewers,%2Bvalues.participants`,\n\t\t\t{\n\t\t\t\tmethod: 'GET',\n\t\t\t},\n\t\t\tscope,\n\t\t);\n\n\t\tif (!response?.values?.length) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn fromBitbucketPullRequest(response.values[0], provider, { projection: 'point' });\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, branch, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbranch: branch,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getServerPullRequestForBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbranch: string,\n\t\tbaseUrl: string,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst response = await this.request<{\n\t\t\tvalues: BitbucketServerPullRequest[];\n\t\t\tpagelen: number;\n\t\t\tsize: number;\n\t\t\tpage: number;\n\t\t}>(\n\t\t\tprovider,\n\t\t\ttoken,\n\t\t\tbaseUrl,\n\t\t\t`projects/${owner}/repos/${repo}/pull-requests?at=refs/heads/${branch}&direction=OUTGOING&state=ALL`,\n\t\t\t{\n\t\t\t\tmethod: 'GET',\n\t\t\t},\n\t\t\tscope,\n\t\t);\n\n\t\tif (!response?.values?.length) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst providersPr = normalizeBitbucketServerPullRequest(response.values[0]);\n\t\tconst gitlensPr = fromProviderPullRequest(providersPr, provider, { projection: 'point' });\n\t\treturn gitlensPr;\n\t}\n\n\t@trace({\n\t\targs: (provider, token, userUuid, owner, repo, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\tuserUuid: userUuid,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tasync getUsersIssuesForRepo(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tuserUuid: string,\n\t\towner: string,\n\t\trepo: string,\n\t\tbaseUrl: string,\n\t): Promise<Issue[] | undefined> {\n\t\tconst scope = getScopedLogger();\n\t\tconst query = encodeURIComponent(`assignee.uuid=\"${userUuid}\" OR reporter.uuid=\"${userUuid}\"`);\n\n\t\tconst response = await this.request<{\n\t\t\tvalues: BitbucketIssue[];\n\t\t\tpagelen: number;\n\t\t\tsize: number;\n\t\t\tpage: number;\n\t\t}>(\n\t\t\tprovider,\n\t\t\ttoken,\n\t\t\tbaseUrl,\n\t\t\t`repositories/${owner}/${repo}/issues?q=${query}`,\n\t\t\t{\n\t\t\t\tmethod: 'GET',\n\t\t\t},\n\t\t\tscope,\n\t\t);\n\n\t\tif (!response?.values?.length) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn response.values.map(issue => fromBitbucketIssue(issue, provider, 'account'));\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, id, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tid: id,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tasync getIssue(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tid: string,\n\t\tbaseUrl: string,\n\t): Promise<Issue | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst response = await this.request<BitbucketIssue>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`repositories/${owner}/${repo}/issues/${id}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tif (response) {\n\t\t\t\treturn fromBitbucketIssue(response, provider, 'point');\n\t\t\t}\n\t\t\treturn undefined;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, id, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tid: id,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getIssueOrPullRequest(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tid: string,\n\t\tbaseUrl: string,\n\t\toptions?: {\n\t\t\ttype?: IssueOrPullRequestType;\n\t\t},\n\t): Promise<IssueOrPullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tif (options?.type === undefined || options?.type === 'pullrequest') {\n\t\t\ttry {\n\t\t\t\tconst pr = await this.getPullRequest(provider, token, owner, repo, id, baseUrl);\n\t\t\t\tif (pr != null) return pr;\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tif (options?.type === undefined || options?.type === 'issue') {\n\t\t\ttry {\n\t\t\t\tconst issueResponse = await this.request<BitbucketIssue>(\n\t\t\t\t\tprovider,\n\t\t\t\t\ttoken,\n\t\t\t\t\tbaseUrl,\n\t\t\t\t\t`repositories/${owner}/${repo}/issues/${id}`,\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t},\n\t\t\t\t\tscope,\n\t\t\t\t);\n\n\t\t\t\tif (issueResponse) {\n\t\t\t\t\tconst result: IssueOrPullRequest = {\n\t\t\t\t\t\tid: issueResponse.id.toString(),\n\t\t\t\t\t\ttype: 'issue',\n\t\t\t\t\t\tnodeId: issueResponse.id.toString(),\n\t\t\t\t\t\tprovider: provider,\n\t\t\t\t\t\tcreatedDate: new Date(issueResponse.created_on),\n\t\t\t\t\t\tupdatedDate: new Date(issueResponse.updated_on),\n\t\t\t\t\t\tstate: bitbucketIssueStateToState(issueResponse.state),\n\t\t\t\t\t\tclosed: issueResponse.state === 'closed',\n\t\t\t\t\t\ttitle: issueResponse.title,\n\t\t\t\t\t\turl: issueResponse.links.html.href,\n\t\t\t\t\t};\n\t\t\t\t\treturn copyReadProvenance(result, issueResponse);\n\t\t\t\t}\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, id, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tid: id,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getServerPullRequestById(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tid: string,\n\t\tbaseUrl: string,\n\t): Promise<IssueOrPullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\treturn await this.getServerPullRequest(provider, token, owner, repo, id, baseUrl);\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t/**\n\t * A Bitbucket Cloud pull request by id. Strict, unlike {@link getIssueOrPullRequest}: `undefined` means a 404,\n\t * and every other failure throws, so the answer can be cached as a proven absence.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, id, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tid: id,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getPullRequest(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tid: string,\n\t\tbaseUrl: string,\n\t\toptions?: {\n\t\t\tcurrentAccount?: { id: string; username?: string };\n\t\t\tdeferFailure?: boolean;\n\t\t\t/** The calling read, stamped on the row. */\n\t\t\tprojection?: PullRequestProjection;\n\t\t},\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst pr = await this.request<BitbucketPullRequest>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`repositories/${owner}/${repo}/pullrequests/${id}?fields=%2Bvalues.reviewers,%2Bvalues.participants`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t\tundefined,\n\t\t\t\toptions?.deferFailure,\n\t\t\t);\n\t\t\tif (pr == null) throw new Error(`Bitbucket returned no pull request for ${owner}/${repo}#${id}`);\n\n\t\t\treturn fromBitbucketPullRequest(pr, provider, {\n\t\t\t\tcurrentAccount: options?.currentAccount,\n\t\t\t\tprojection: options?.projection,\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\tif (isNotFoundResponse(ex)) return undefined;\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t/**\n\t * The change state of pull requests `ids` in `owner/repo` — the cheap check behind the batch read's etags — in ONE\n\t * request for up to {@link bitbucketEtagFieldsMaxIds} ids, selecting only what {@link getPullRequest}'s row reads\n\t * into its etag (plus the participants and reviewers for the `reviewDecision` include). One entry per input id, in\n\t * order.\n\t *\n\t * Strict like {@link getPullRequest}: `undefined` is a PROVEN ABSENCE, for an id missing from a complete page, or\n\t * for every id when the repository is a 404, as each id's own read would be. A page with more (`next`) and every\n\t * other failure throw. Every state is asked for, since the list answers only open pull requests by default.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, ids) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tids: ids.length,\n\t\t}),\n\t})\n\tpublic async getPullRequestsEtagFields(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tids: readonly number[],\n\t\tbaseUrl: string,\n\t\toptions: { etagIncludes: readonly PullRequestEtagInclude[]; deferFailure?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<(BitbucketPullRequestEtagNode | undefined)[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\tif (!ids.length) return [];\n\t\tif (ids.length > bitbucketEtagFieldsMaxIds) {\n\t\t\tthrow new Error(\n\t\t\t\t`Cannot read more than ${bitbucketEtagFieldsMaxIds} Bitbucket pull requests in one request`,\n\t\t\t);\n\t\t}\n\n\t\tconst fields = [\n\t\t\t'values.id',\n\t\t\t'values.state',\n\t\t\t'values.draft',\n\t\t\t'values.updated_on',\n\t\t\t'values.source.commit.hash',\n\t\t\t'next',\n\t\t];\n\t\tif (options.etagIncludes.includes('reviewDecision')) {\n\t\t\tfields.push(\n\t\t\t\t'values.participants.approved',\n\t\t\t\t'values.participants.state',\n\t\t\t\t'values.participants.participated_on',\n\t\t\t\t'values.reviewers.uuid',\n\t\t\t);\n\t\t}\n\n\t\tconst params = new URLSearchParams({\n\t\t\tq: `id IN (${ids.join(',')})`,\n\t\t\tfields: fields.join(','),\n\t\t\tpagelen: String(ids.length),\n\t\t});\n\t\tfor (const state of ['OPEN', 'MERGED', 'DECLINED', 'SUPERSEDED'] satisfies BitbucketPullRequestState[]) {\n\t\t\tparams.append('state', state);\n\t\t}\n\n\t\ttry {\n\t\t\tconst response = await this.request<{ values?: BitbucketPullRequestEtagNode[]; next?: string }>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`repositories/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/pullrequests?${params.toString()}`,\n\t\t\t\t{ method: 'GET' },\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t\tif (response?.values == null) {\n\t\t\t\tthrow new Error(`Bitbucket returned no pull requests for ${owner}/${repo}`);\n\t\t\t}\n\t\t\tif (response.next != null) throw new Error(`Bitbucket returned a partial page of ${owner}/${repo}`);\n\n\t\t\tconst byId = new Map(response.values.map(pr => [pr.id, pr]));\n\t\t\treturn ids.map(id => byId.get(id));\n\t\t} catch (ex) {\n\t\t\tif (isNotFoundResponse(ex)) return ids.map(() => undefined);\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t/**\n\t * A Bitbucket Data Center pull request by id. Strict, unlike {@link getServerPullRequestById}: `undefined` means\n\t * a 404, and every other failure throws, so the answer can be cached as a proven absence.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, id, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tid: id,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getServerPullRequest(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tid: string,\n\t\tbaseUrl: string,\n\t\toptions?: {\n\t\t\tcurrentAccount?: { id: string; username?: string };\n\t\t\tdeferFailure?: boolean;\n\t\t\t/** The calling read, stamped on the row. */\n\t\t\tprojection?: PullRequestProjection;\n\t\t},\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst pr = await this.request<BitbucketServerPullRequest>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`projects/${owner}/repos/${repo}/pull-requests/${id}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t\tundefined,\n\t\t\t\toptions?.deferFailure,\n\t\t\t);\n\t\t\tif (pr == null) throw new Error(`Bitbucket returned no pull request for ${owner}/${repo}#${id}`);\n\n\t\t\treturn fromProviderPullRequest(normalizeBitbucketServerPullRequest(pr), provider, {\n\t\t\t\tcurrentAccount: options?.currentAccount,\n\t\t\t\tprojection: options?.projection,\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\tif (isNotFoundResponse(ex)) return undefined;\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t/**\n\t * Every Bitbucket Cloud pull request into `owner/repo` whose source is `branch`, in any state, newest first, at\n\t * most `limit`: from the repository itself when `headOwner` is omitted, otherwise from a fork in the `headOwner`\n\t * workspace. Keyed on the source branch NAME, so a merged pull request whose branch was deleted still matches.\n\t *\n\t * Strict like {@link getPullRequest}: a 404 (a missing repository) is an empty list, and every other failure\n\t * throws.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, branch, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbranch: branch,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getPullRequestsForBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbranch: string,\n\t\tbaseUrl: string,\n\t\toptions: {\n\t\t\theadOwner?: string;\n\t\t\tlimit: number;\n\t\t\tcurrentAccount?: { id: string; username?: string };\n\t\t\tdeferFailure?: boolean;\n\t\t},\n\t): Promise<{ pullRequests: PullRequest[]; truncated: boolean }> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst escapedBranch = branch.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n\t\tconst params = new URLSearchParams({\n\t\t\t// Every state named: Bitbucket answers only OPEN pull requests unless asked for the others.\n\t\t\tq: `source.branch.name=\"${escapedBranch}\" AND (state=\"OPEN\" OR state=\"MERGED\" OR state=\"DECLINED\" OR state=\"SUPERSEDED\")`,\n\t\t\tsort: '-updated_on',\n\t\t\tpagelen: String(options.limit),\n\t\t\tfields: '+values.reviewers,+values.participants',\n\t\t});\n\n\t\ttry {\n\t\t\tconst response = await this.request<{ values: BitbucketPullRequest[]; next?: string }>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`repositories/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/pullrequests?${params.toString()}`,\n\t\t\t\t{ method: 'GET' },\n\t\t\t\tscope,\n\t\t\t\tundefined,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t\tif (response?.values == null) {\n\t\t\t\tthrow new Error(`Bitbucket returned no pull requests for ${owner}/${repo}:${branch}`);\n\t\t\t}\n\n\t\t\tconst headOwner = options.headOwner;\n\t\t\tconst { values, truncated } = selectBranchPullRequests(response.values, {\n\t\t\t\tmatchesHead: pr => {\n\t\t\t\t\tconst source = pr.source.repository;\n\t\t\t\t\tif (pr.source.branch.name !== branch || source == null) return false;\n\t\t\t\t\tif (headOwner == null) return source.uuid === pr.destination.repository.uuid;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\tsource.uuid !== pr.destination.repository.uuid &&\n\t\t\t\t\t\tequalsIgnoreCase(source.full_name.split('/')[0], headOwner)\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tupdatedAt: pr => Date.parse(pr.updated_on),\n\t\t\t\tmap: pr =>\n\t\t\t\t\tfromBitbucketPullRequest(pr, provider, {\n\t\t\t\t\t\tcurrentAccount: options.currentAccount,\n\t\t\t\t\t\tprojection: 'batch',\n\t\t\t\t\t}),\n\t\t\t\tlimit: options.limit,\n\t\t\t\tmore: response.next != null,\n\t\t\t});\n\t\t\treturn { pullRequests: values, truncated: truncated };\n\t\t} catch (ex) {\n\t\t\tif (isNotFoundResponse(ex)) return { pullRequests: [], truncated: false };\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t/**\n\t * Every Bitbucket Data Center pull request whose source is `branch` in `owner/repo` and whose target is that same\n\t * repository, in any state, newest first, at most `limit`. Asked of the repository the branch lives in\n\t * (`direction=OUTGOING`), which is why a fork's pull requests can't be found through the repository they target.\n\t *\n\t * Strict like {@link getServerPullRequest}: a 404 (a missing repository) is an empty list, and every other\n\t * failure throws.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, branch, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbranch: branch,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getServerPullRequestsForBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbranch: string,\n\t\tbaseUrl: string,\n\t\toptions: { limit: number; currentAccount?: { id: string; username?: string }; deferFailure?: boolean },\n\t): Promise<{ pullRequests: PullRequest[]; truncated: boolean }> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst ref = `refs/heads/${branch}`;\n\t\tconst params = new URLSearchParams({\n\t\t\tat: ref,\n\t\t\tdirection: 'OUTGOING',\n\t\t\tstate: 'ALL',\n\t\t\torder: 'NEWEST',\n\t\t\tlimit: String(options.limit),\n\t\t});\n\n\t\ttry {\n\t\t\tconst response = await this.request<{ values: BitbucketServerPullRequest[]; isLastPage?: boolean }>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`projects/${encodeURIComponent(owner)}/repos/${encodeURIComponent(repo)}/pull-requests?${params.toString()}`,\n\t\t\t\t{ method: 'GET' },\n\t\t\t\tscope,\n\t\t\t\tundefined,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t\tif (response?.values == null) {\n\t\t\t\tthrow new Error(`Bitbucket returned no pull requests for ${owner}/${repo}:${branch}`);\n\t\t\t}\n\n\t\t\tconst { values, truncated } = selectBranchPullRequests(response.values, {\n\t\t\t\t// `OUTGOING` also lists this branch's pull requests into other repositories, e.g. the upstream of a\n\t\t\t\t// repository that is itself a fork.\n\t\t\t\tmatchesHead: pr => pr.fromRef.id === ref && pr.fromRef.repository.id === pr.toRef.repository.id,\n\t\t\t\tupdatedAt: pr => pr.updatedDate,\n\t\t\t\tmap: pr =>\n\t\t\t\t\tfromProviderPullRequest(normalizeBitbucketServerPullRequest(pr), provider, {\n\t\t\t\t\t\tcurrentAccount: options.currentAccount,\n\t\t\t\t\t\tprojection: 'batch',\n\t\t\t\t\t}),\n\t\t\t\tlimit: options.limit,\n\t\t\t\tmore: response.isLastPage !== true,\n\t\t\t});\n\t\t\treturn { pullRequests: values, truncated: truncated };\n\t\t} catch (ex) {\n\t\t\tif (isNotFoundResponse(ex)) return { pullRequests: [], truncated: false };\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, workspace) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\tworkspace: workspace,\n\t\t}),\n\t})\n\tasync getRepositoriesForWorkspace(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tworkspace: string,\n\t\toptions: {\n\t\t\tbaseUrl: string;\n\t\t},\n\t): Promise<RepositoryMetadata[] | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tinterface BitbucketRepositoriesResponse {\n\t\t\t\tsize: number;\n\t\t\t\tpage: number;\n\t\t\t\tpagelen: number;\n\t\t\t\tnext?: string;\n\t\t\t\tprevious?: string;\n\t\t\t\tvalues: BitbucketRepository[];\n\t\t\t}\n\n\t\t\tconst response = await this.request<BitbucketRepositoriesResponse>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions.baseUrl,\n\t\t\t\t`repositories/${workspace}?role=contributor&fields=%2Bvalues.parent.workspace`, // field=+<field> must be encoded as field=%2B<field>\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tif (response) {\n\t\t\t\treturn response.values.map(repo => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tprovider: provider,\n\t\t\t\t\t\towner: repo.workspace.slug,\n\t\t\t\t\t\tname: repo.slug,\n\t\t\t\t\t\tisFork: Boolean(repo.parent),\n\t\t\t\t\t\tparent: repo.parent\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\towner: repo.parent.workspace.slug,\n\t\t\t\t\t\t\t\t\tname: repo.parent.slug,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn undefined;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t}),\n\t})\n\tasync getRepositoryMetadata(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\toptions: {\n\t\t\tbaseUrl: string;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<RepositoryMetadata | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst response = await this.getRepository(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\towner,\n\t\t\t\trepo,\n\t\t\t\toptions.baseUrl,\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t);\n\t\t\tif (response == null) return undefined;\n\n\t\t\tlet parent: RepositoryMetadata['parent'];\n\t\t\tif (response.parent != null) {\n\t\t\t\t// Derive the parent from `full_name` (\"owner/repo\") rather than `parent.workspace`, which is a\n\t\t\t\t// requested field expansion Bitbucket doesn't always honor (an unexpanded parent would otherwise\n\t\t\t\t// throw and null out the whole result).\n\t\t\t\t// `full_name` is \"owner/repo\"; only report a parent when both parts are present so a malformed\n\t\t\t\t// value doesn't produce a parent with an undefined owner/name while `isFork` stays true.\n\t\t\t\tconst [parentOwner, parentName] = response.parent.full_name.split('/');\n\t\t\t\tif (parentOwner && parentName) {\n\t\t\t\t\tparent = { owner: parentOwner, name: parentName };\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tprovider: provider,\n\t\t\t\towner: response.workspace.slug,\n\t\t\t\tname: response.slug,\n\t\t\t\tisFork: response.parent != null,\n\t\t\t\tparent: parent,\n\t\t\t} satisfies RepositoryMetadata;\n\t\t} catch (ex) {\n\t\t\t// Cancellations and 404s are expected outcomes for a probe; don't log them as errors.\n\t\t\tif (!isCancellationError(ex) && !(ex instanceof RequestNotFoundError)) {\n\t\t\t\tscope?.error(ex);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t}),\n\t})\n\tasync getDefaultBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\toptions: {\n\t\t\tbaseUrl: string;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<DefaultBranch | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst response = await this.getRepository(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\towner,\n\t\t\t\trepo,\n\t\t\t\toptions.baseUrl,\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t);\n\t\t\tconst name = response?.mainbranch?.name;\n\t\t\tif (name == null) return undefined;\n\n\t\t\treturn { provider: provider, name: name } satisfies DefaultBranch;\n\t\t} catch (ex) {\n\t\t\t// Cancellations and 404s are expected outcomes for a probe; don't log them as errors.\n\t\t\tif (!isCancellationError(ex) && !(ex instanceof RequestNotFoundError)) {\n\t\t\t\tscope?.error(ex);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate getRepository(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbaseUrl: string,\n\t\tscope: ScopedLogger | undefined,\n\t\tcancellation?: AbortSignal,\n\t): Promise<BitbucketRepository | undefined> {\n\t\treturn this.request<BitbucketRepository>(\n\t\t\tprovider,\n\t\t\ttoken,\n\t\t\tbaseUrl,\n\t\t\t`repositories/${owner}/${repo}`,\n\t\t\t{ method: 'GET' },\n\t\t\tscope,\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, rev, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\trev: rev,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tasync getServerPullRequestForCommit(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\trev: string,\n\t\tbaseUrl: string,\n\t\toptions?: {\n\t\t\tavatarSize?: number;\n\t\t\t/** For a batch read: the batch reports a failed request once rather than each request showing its own. */\n\t\t\tdeferFailure?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst response = await this.request<{ values: BitbucketServerPullRequest[] }>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`projects/${encodePathSegment(owner)}/repos/${encodePathSegment(repo)}/commits/${rev}/pull-requests`, //?fields=${fieldsParam}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t\toptions?.deferFailure,\n\t\t\t);\n\t\t\tif (response?.values == null) {\n\t\t\t\tthrow new Error(`Bitbucket returned no pull requests for ${owner}/${repo}@${rev}`);\n\t\t\t}\n\n\t\t\tconst prResponse = response.values.reduce<BitbucketServerPullRequest | undefined>(\n\t\t\t\t(acc, pr) => (!acc || pr.updatedDate > acc.updatedDate ? pr : acc),\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\tif (!prResponse) return undefined;\n\n\t\t\tconst providersPr = normalizeBitbucketServerPullRequest(prResponse);\n\t\t\tconst gitlensPr = fromProviderPullRequest(providersPr, provider, { projection: 'point' });\n\t\t\treturn gitlensPr;\n\t\t} catch (ex) {\n\t\t\tif (isNotFoundResponse(ex)) return undefined;\n\n\t\t\tif (!options?.deferFailure && isCommitReadRefusal(ex)) {\n\t\t\t\tthrow new CommitReadRefusedError(ex.message, ex);\n\t\t\t}\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, rev, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\trev: rev,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tasync getPullRequestForCommit(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\trev: string,\n\t\tbaseUrl: string,\n\t\toptions?: {\n\t\t\tavatarSize?: number;\n\t\t\t/** For a batch read: the batch reports a failed request once rather than each request showing its own. */\n\t\t\tdeferFailure?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst fields = [\n\t\t\t\t'+values.*',\n\t\t\t\t'+values.destination.repository',\n\t\t\t\t'+values.destination.branch.*',\n\t\t\t\t'+values.destination.commit.*',\n\t\t\t\t'+values.source.repository.*',\n\t\t\t\t'+values.source.branch.*',\n\t\t\t\t'+values.source.commit.*',\n\t\t\t];\n\t\t\tconst fieldsParam = encodeURIComponent(fields.join(','));\n\t\t\tconst response = await this.request<{ values?: BitbucketPullRequest[]; repo_indexed?: boolean }>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`repositories/${encodePathSegment(owner)}/${encodePathSegment(repo)}/commit/${rev}/pullrequests?fields=${fieldsParam}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t\toptions?.deferFailure,\n\t\t\t);\n\t\t\t// SEE: api.bitbucket.org/swagger.json getPullrequestsForCommit: 404 is a missing repository or links not yet indexed, 202 is still indexing.\n\t\t\t// SEE: observed 2026-11-22: an unknown commit and a missing repository both answer 404 \"Resource not found\"; an indexed repository answers 200 with repo_indexed true.\n\t\t\tif (response?.values == null || response.repo_indexed === false) {\n\t\t\t\tthrow new BitbucketCommitPullRequestsUnindexedError(\n\t\t\t\t\t`Bitbucket is still indexing the pull requests of ${owner}/${repo}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis._indexedRepositories.add(indexedRepositoryKey(token, owner, repo));\n\n\t\t\tconst pr = response.values.reduce<BitbucketPullRequest | undefined>(\n\t\t\t\t(acc, pr) => (!acc || pr.updated_on > acc.updated_on ? pr : acc),\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\tif (!pr) return undefined;\n\t\t\treturn fromBitbucketPullRequest(pr, provider, { projection: 'point' });\n\t\t} catch (ex) {\n\t\t\tif (isCommitLinksAppMissing(ex)) {\n\t\t\t\tconst commitWebUrl = `https://bitbucket.org/${owner}/${repo}/commits/${rev}`;\n\t\t\t\tif (!options?.deferFailure) {\n\t\t\t\t\t// TODO: In future get it on to home as an warning on the integration itself \"this integration has issues\"\n\t\t\t\t\t// even user suppresses the message it's still visible with some capacity. It's a broader thing to get other errors.\n\t\t\t\t\tthis.notifyCommitLinksAppMissing(owner, commitWebUrl);\n\t\t\t\t}\n\t\t\t\tthrow new BitbucketCommitLinksAppMissingError(commitWebUrl);\n\t\t\t}\n\n\t\t\tif (isNotFoundResponse(ex)) {\n\t\t\t\tif (!options?.deferFailure && this.isRepositoryIndexed(token, owner, repo)) return undefined;\n\n\t\t\t\tthrow new BitbucketCommitNotFoundError(\n\t\t\t\t\t`Bitbucket has no such commit in ${owner}/${repo}, or no such repository`,\n\t\t\t\t\tex,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!options?.deferFailure && isCommitReadRefusal(ex)) {\n\t\t\t\tthrow new CommitReadRefusedError(ex.message, ex);\n\t\t\t}\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, rev, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\trev: rev,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tasync getAccountForCommit(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\trev: string,\n\t\tbaseUrl: string,\n\t\t_options?: {\n\t\t\tavatarSize?: number;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<Account | UnidentifiedAuthor | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst commit = await this.request<BitbucketCommit>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`repositories/${owner}/${repo}/commit/${rev}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t);\n\t\t\tif (!commit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { name, email } = parseRawBitbucketAuthor(commit.author.raw);\n\t\t\tconst commitAuthor: CommitAuthor = {\n\t\t\t\tprovider: provider,\n\t\t\t\tid: commit.author.user?.account_id,\n\t\t\t\tusername: commit.author.user?.nickname,\n\t\t\t\tname: commit.author.user?.display_name || name,\n\t\t\t\temail: email,\n\t\t\t\tavatarUrl: commit.author.user?.links?.avatar?.href,\n\t\t\t};\n\t\t\tif (commitAuthor.id != null && commitAuthor.username != null) {\n\t\t\t\treturn {\n\t\t\t\t\t...commitAuthor,\n\t\t\t\t\tid: commitAuthor.id,\n\t\t\t\t} satisfies Account;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...commitAuthor,\n\t\t\t\tid: undefined,\n\t\t\t\tusername: undefined,\n\t\t\t} satisfies UnidentifiedAuthor;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, rev, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\trev: rev,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tasync getServerAccountForCommit(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\trev: string,\n\t\tbaseUrl: string,\n\t\t_options?: {\n\t\t\tavatarSize?: number;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<Account | UnidentifiedAuthor | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst commit = await this.request<BitbucketServerCommit>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`projects/${owner}/repos/${repo}/commits/${rev}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t);\n\t\t\tif (!commit?.author) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif (commit.author.id != null) {\n\t\t\t\treturn {\n\t\t\t\t\tprovider: provider,\n\t\t\t\t\tid: commit.author.id.toString(),\n\t\t\t\t\tusername: commit.author.name,\n\t\t\t\t\tname: commit.author.name,\n\t\t\t\t\temail: commit.author.emailAddress,\n\t\t\t\t\tavatarUrl: commit.author?.avatarUrl,\n\t\t\t\t} satisfies Account;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tprovider: provider,\n\t\t\t\tid: undefined,\n\t\t\t\tusername: undefined,\n\t\t\t\tname: commit.author.name,\n\t\t\t\temail: commit.author.emailAddress,\n\t\t\t\tavatarUrl: undefined,\n\t\t\t} satisfies UnidentifiedAuthor;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate async request<T>(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tbaseUrl: string,\n\t\troute: string,\n\t\toptions?: { method: RequestInit['method'] } & Record<string, unknown>,\n\t\tscope?: ScopedLogger | undefined,\n\t\tcancellation?: AbortSignal | undefined,\n\t\tdeferFailure?: boolean,\n\t): Promise<T | undefined> {\n\t\tconst { accessToken } = token;\n\t\tconst url = `${baseUrl}/${route}`;\n\n\t\tlet rsp: Response;\n\t\ttry {\n\t\t\tconst sw = maybeStopWatch(`[BITBUCKET] ${options?.method ?? 'GET'} ${url}`, { log: { onlyExit: true } });\n\n\t\t\ttry {\n\t\t\t\tif (cancellation?.aborted) throw new CancellationError();\n\n\t\t\t\tconst capture = createReadCapture();\n\t\t\t\trsp = await this.config.wrapForForcedInsecureSSL(provider.getIgnoreSSLErrors(), () =>\n\t\t\t\t\tthis.config.fetch(url, {\n\t\t\t\t\t\theaders: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json' },\n\t\t\t\t\t\tsignal: cancellation,\n\t\t\t\t\t\t...options,\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tif (rsp.ok) {\n\t\t\t\t\treturn captureReadNodes(await rsp.json(), capture) as T;\n\t\t\t\t}\n\n\t\t\t\t// Reads the body so the 403 branch below can tell a throttled request from a permission failure.\n\t\t\t\tthrow await ProviderFetchError.fromResponse('Bitbucket', rsp);\n\t\t\t} finally {\n\t\t\t\tsw?.stop();\n\t\t\t}\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof ProviderFetchError || ex.name === 'AbortError') {\n\t\t\t\tthis.handleRequestError(provider, token, ex, scope, deferFailure);\n\t\t\t} else if (Logger.isDebugging) {\n\t\t\t\tthis.config.onError?.(`Bitbucket request failed: ${ex.message}`);\n\t\t\t}\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\tprivate handleRequestError(\n\t\tprovider: Provider | undefined,\n\t\ttoken: TokenWithInfo,\n\t\tex: ProviderFetchError | (Error & { name: 'AbortError' }),\n\t\tscope: ScopedLogger | undefined,\n\t\tdeferFailure: boolean | undefined,\n\t): void {\n\t\tif (ex.name === 'AbortError' || !(ex instanceof ProviderFetchError)) throw new CancellationError(ex);\n\n\t\tconst { accessToken, ...tokenInfo } = token;\n\t\tswitch (ex.status) {\n\t\t\tcase 404: // Not found\n\t\t\tcase 410: // Gone\n\t\t\tcase 422: // Unprocessable Entity\n\t\t\t\tthrow new RequestNotFoundError(ex);\n\t\t\tcase 401: // Unauthorized\n\t\t\t\tthrow new AuthenticationError(tokenInfo, AuthenticationErrorReason.Unauthorized, ex);\n\t\t\tcase 429: // Too Many Requests\n\t\t\t\tthrow toRateLimitError(ex, accessToken);\n\t\t\tcase 403: // Forbidden\n\t\t\t\t// Bitbucket returns 403 for both a permission failure and a throttled request (\"API rate limit\n\t\t\t\t// exceeded\"), so the message is the discriminant. Reporting a throttle as `auth` would prompt the\n\t\t\t\t// user to re-authenticate a healthy connection instead of retrying (see `isRateLimitResponse`).\n\t\t\t\tif (isRateLimitResponse(ex)) throw toRateLimitError(ex, accessToken);\n\n\t\t\t\tthrow new AuthenticationError(tokenInfo, AuthenticationErrorReason.Forbidden, ex);\n\t\t\tcase 500: // Internal Server Error\n\t\t\t\tscope?.error(ex);\n\t\t\t\tif (ex.response != null) {\n\t\t\t\t\treportRequestFailure(\n\t\t\t\t\t\tprovider,\n\t\t\t\t\t\tex,\n\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\tthis.config.onRequestFailed?.(\n\t\t\t\t\t\t\t\tprovider == null || provider.id === 'bitbucket'\n\t\t\t\t\t\t\t\t\t? l10n.t(\n\t\t\t\t\t\t\t\t\t\t\t'{0} failed to respond and might be experiencing issues. Please visit the [Bitbucket status page](https://bitbucket.status.atlassian.com/) for more information.',\n\t\t\t\t\t\t\t\t\t\t\tprovider?.name ?? 'Bitbucket',\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t: l10n.t('{0} failed to respond and might be experiencing issues.', provider.name),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\tdeferFailure,\n\t\t\t\t\t\ttoken.connectionId,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\tcase 502: // Bad Gateway\n\t\t\t\tscope?.error(ex);\n\t\t\t\t// TODO: Learn the Bitbucket API docs and put it in order:\n\t\t\t\t// if (ex.message.includes('timeout')) {\n\t\t\t\t// \tprovider?.trackRequestException();\n\t\t\t\t// \tvoid showIntegrationRequestTimedOutWarningMessage(provider?.name ?? 'Bitbucket');\n\t\t\t\t// \treturn;\n\t\t\t\t// }\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (ex.status >= 400 && ex.status < 500) throw new RequestClientError(ex);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tscope?.error(ex);\n\t\tif (Logger.isDebugging) {\n\t\t\tthis.config.onError?.(\n\t\t\t\t`Bitbucket request failed: ${(ex.response as any)?.errors?.[0]?.message ?? ex.message}`,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/** Wires a {@link BitbucketApi} from the full runtime context, mapping `ctx` down to the narrow config. */\nexport function createBitbucketApi(ctx: IntegrationServiceContext): BitbucketApi {\n\tconst config: ProviderApiConfig = {\n\t\t...baseProviderApiConfig(ctx),\n\t\tonBitbucketCommitLinksAppMissing: revLink => ctx.hooks?.ui?.onBitbucketCommitLinksAppMissing?.(revLink),\n\t};\n\n\treturn new BitbucketApi(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuDA,SAAS,wBAAwB,IAAsB;CACtD,MAAM,WAAoB,cAAc,SAAS,cAAc,KAAK,GAAG,WAAW;CAClF,OAAO,oBAAoB,sBAAsB,SAAS,QAAQ,SAAS,iCAAiC;AAC7G;AAEA,IAAa,+BAAb,cAAkD,uBAAuB,CAAC;AAE1E,IAAa,4CAAb,cAA+D,uBAAuB,CAAC;AAEvF,IAAa,sCAAb,cAAyD,uBAAuB;CAC1D;CAArB,YAAY,WAA4B;EACvC,MACC,2JAA2J,UAAU,e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AAU;CAC1B;CACD;CACD;CACI;AACV,GACD,CAAC,CAAA,GAAA,aAAA,WAAA,2BAAA,IAAA;AAoFA,WAAA,CAAA,MAAM,EACN,OAAO,UAAU,OAAO,OAAO,MAAM,KAAK,aAAa;CACtD,UAAU,SAAS;CACnB,OAAO,UAAU,MAAM,UAAU;CAC1B;CACD;CACD;CACI;AACV,GACD,CAAC,CAAA,GAAA,aAAA,WAAA,uBAAA,IAAA;AAyDA,WAAA,CAAA,MAAM,EACN,OAAO,UAAU,OAAO,OAAO,MAAM,KAAK,aAAa;CACtD,UAAU,SAAS;CACnB,OAAO,UAAU,MAAM,UAAU;CAC1B;CACD;CACD;CACI;AACV,GACD,CAAC,CAAA,GAAA,aAAA,WAAA,6BAAA,IAAA;;AA6KF,SAAgB,mBAAmB,KAA8C;CAMhF,OAAO,IAAI,aAAa;EAJvB,GAAG,sBAAsB,GAAG;EAC5B,mCAAkC,YAAW,IAAI,OAAO,IAAI,mCAAmC,OAAO;CAG/E,CAAM;AAC/B"}
|
|
1
|
+
{"version":3,"file":"bitbucket.js","names":["Logger"],"sources":["../../../../../../plus/integrations/src/providers/bitbucket/bitbucket.ts"],"sourcesContent":["import { captureReadNodes, copyReadProvenance, createReadCapture } from '@gitkraken/provider-apis/read-provenance';\nimport * as l10n from '@vscode/l10n';\nimport { reportRequestFailure } from '@gitlens/git/errors.js';\nimport type { Account, CommitAuthor, UnidentifiedAuthor } from '@gitlens/git/models/author.js';\nimport type { DefaultBranch } from '@gitlens/git/models/defaultBranch.js';\nimport type { Issue } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequest, IssueOrPullRequestType } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { PullRequest, PullRequestProjection } from '@gitlens/git/models/pullRequest.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\nimport type { RepositoryMetadata } from '@gitlens/git/models/repositoryMetadata.js';\nimport { CancellationError, isCancellationError } from '@gitlens/utils/cancellation.js';\nimport { trace } from '@gitlens/utils/decorators/log.js';\nimport type { Disposable } from '@gitlens/utils/disposable.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport type { ScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { maybeStopWatch } from '@gitlens/utils/stopwatch.js';\nimport { equalsIgnoreCase } from '@gitlens/utils/string.js';\nimport type { TokenWithInfo } from '../../authentication/models.js';\nimport type { IntegrationServiceContext } from '../../context.js';\nimport {\n\tAuthenticationError,\n\tAuthenticationErrorReason,\n\tisRateLimitResponse,\n\tProviderFetchError,\n\tRequestClientError,\n\tRequestNotFoundError,\n\ttoRateLimitError,\n} from '../../errors.js';\nimport type { PullRequestEtagInclude } from '../../reads/etag.js';\nimport { encodePathSegment } from '../../utils/domain.utils.js';\nimport type { ProviderApiConfig } from '../apiConfig.js';\nimport { baseProviderApiConfig } from '../apiConfig.js';\nimport type { BitbucketServerCommit, BitbucketServerPullRequest } from '../bitbucket-server/models.js';\nimport { normalizeBitbucketServerPullRequest } from '../bitbucket-server/models.js';\nimport { fromProviderPullRequest } from '../models.js';\nimport { CommitReadRefusedError, isCommitReadRefusal, isNotFoundResponse } from '../providerErrors.js';\nimport { selectBranchPullRequests } from '../utils/providerPaging.js';\nimport type {\n\tBitbucketCommit,\n\tBitbucketIssue,\n\tBitbucketPullRequest,\n\tBitbucketPullRequestEtagNode,\n\tBitbucketPullRequestState,\n\tBitbucketRepository,\n} from './models.js';\nimport {\n\tbitbucketEtagFieldsMaxIds,\n\tbitbucketIssueStateToState,\n\tfromBitbucketIssue,\n\tfromBitbucketPullRequest,\n\tparseRawBitbucketAuthor,\n} from './models.js';\n\n/** KEEP: reads the message `ProviderFetchError.fromResponse` folds the body into; the body is already consumed. */\nfunction isCommitLinksAppMissing(ex: unknown): boolean {\n\tconst original: unknown = ex instanceof Error && 'original' in ex ? ex.original : ex;\n\treturn original instanceof ProviderFetchError && original.message.includes('Invalid or unknown installation');\n}\n\nexport class BitbucketCommitNotFoundError extends CommitReadRefusedError {}\n\nexport class BitbucketCommitPullRequestsUnindexedError extends CommitReadRefusedError {}\n\nexport class BitbucketCommitLinksAppMissingError extends CommitReadRefusedError {\n\tconstructor(readonly commitUrl: string) {\n\t\tsuper(\n\t\t\t`Bitbucket lists a commit's pull requests only once the Bitbucket pull request commit links app is installed; choosing 'Go to pull request' on a commit (${commitUrl}) installs it.`,\n\t\t);\n\t}\n}\n\nfunction indexedRepositoryKey(token: TokenWithInfo, owner: string, repo: string): string {\n\treturn `${token.accessToken}|${`${owner}/${repo}`.toLowerCase()}`;\n}\n\nexport class BitbucketApi implements Disposable {\n\tprivate readonly _disposable: Disposable | undefined;\n\n\tconstructor(private readonly config: ProviderApiConfig) {\n\t\tthis._disposable = config.onConfigChanged?.(() => this.resetCaches());\n\t}\n\n\tdispose(): void {\n\t\tthis._disposable?.dispose();\n\t}\n\n\tprivate resetCaches(): void {\n\t\tthis._indexedRepositories.clear();\n\t}\n\n\tprivate readonly _indexedRepositories = new Set<string>();\n\n\tisRepositoryIndexed(token: TokenWithInfo, owner: string, repo: string): boolean {\n\t\treturn this._indexedRepositories.has(indexedRepositoryKey(token, owner, repo));\n\t}\n\n\tprivate readonly _commitLinksAppNoticeShownFor = new Set<string>();\n\n\t/**\n\t * Shows the notice that the pull request commit links app must be installed once per workspace for the life of\n\t * this client.\n\t */\n\tnotifyCommitLinksAppMissing(owner: string, commitWebUrl: string): void {\n\t\tconst workspace = owner.toLowerCase();\n\t\tif (this._commitLinksAppNoticeShownFor.has(workspace)) return;\n\n\t\tthis._commitLinksAppNoticeShownFor.add(workspace);\n\t\tthis.config.onBitbucketCommitLinksAppMissing?.(commitWebUrl);\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, branch, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbranch: branch,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getPullRequestForBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbranch: string,\n\t\tbaseUrl: string,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst response = await this.request<{\n\t\t\tvalues: BitbucketPullRequest[];\n\t\t\tpagelen: number;\n\t\t\tsize: number;\n\t\t\tpage: number;\n\t\t}>(\n\t\t\tprovider,\n\t\t\ttoken,\n\t\t\tbaseUrl,\n\t\t\t`repositories/${owner}/${repo}/pullrequests?q=source.branch.name=\"${branch}\"&fields=%2Bvalues.reviewers,%2Bvalues.participants`,\n\t\t\t{\n\t\t\t\tmethod: 'GET',\n\t\t\t},\n\t\t\tscope,\n\t\t);\n\n\t\tif (!response?.values?.length) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn fromBitbucketPullRequest(response.values[0], provider, { projection: 'point' });\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, branch, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbranch: branch,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getServerPullRequestForBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbranch: string,\n\t\tbaseUrl: string,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst response = await this.request<{\n\t\t\tvalues: BitbucketServerPullRequest[];\n\t\t\tpagelen: number;\n\t\t\tsize: number;\n\t\t\tpage: number;\n\t\t}>(\n\t\t\tprovider,\n\t\t\ttoken,\n\t\t\tbaseUrl,\n\t\t\t`projects/${owner}/repos/${repo}/pull-requests?at=refs/heads/${branch}&direction=OUTGOING&state=ALL`,\n\t\t\t{\n\t\t\t\tmethod: 'GET',\n\t\t\t},\n\t\t\tscope,\n\t\t);\n\n\t\tif (!response?.values?.length) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst providersPr = normalizeBitbucketServerPullRequest(response.values[0]);\n\t\tconst gitlensPr = fromProviderPullRequest(providersPr, provider, { projection: 'point' });\n\t\treturn gitlensPr;\n\t}\n\n\t@trace({\n\t\targs: (provider, token, userUuid, owner, repo, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\tuserUuid: userUuid,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tasync getUsersIssuesForRepo(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tuserUuid: string,\n\t\towner: string,\n\t\trepo: string,\n\t\tbaseUrl: string,\n\t): Promise<Issue[] | undefined> {\n\t\tconst scope = getScopedLogger();\n\t\tconst query = encodeURIComponent(`assignee.uuid=\"${userUuid}\" OR reporter.uuid=\"${userUuid}\"`);\n\n\t\tconst response = await this.request<{\n\t\t\tvalues: BitbucketIssue[];\n\t\t\tpagelen: number;\n\t\t\tsize: number;\n\t\t\tpage: number;\n\t\t}>(\n\t\t\tprovider,\n\t\t\ttoken,\n\t\t\tbaseUrl,\n\t\t\t`repositories/${owner}/${repo}/issues?q=${query}`,\n\t\t\t{\n\t\t\t\tmethod: 'GET',\n\t\t\t},\n\t\t\tscope,\n\t\t);\n\n\t\tif (!response?.values?.length) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn response.values.map(issue => fromBitbucketIssue(issue, provider, 'account'));\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, id, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tid: id,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tasync getIssue(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tid: string,\n\t\tbaseUrl: string,\n\t): Promise<Issue | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst response = await this.request<BitbucketIssue>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`repositories/${owner}/${repo}/issues/${id}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tif (response) {\n\t\t\t\treturn fromBitbucketIssue(response, provider, 'point');\n\t\t\t}\n\t\t\treturn undefined;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, id, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tid: id,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getIssueOrPullRequest(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tid: string,\n\t\tbaseUrl: string,\n\t\toptions?: {\n\t\t\ttype?: IssueOrPullRequestType;\n\t\t},\n\t): Promise<IssueOrPullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\tif (options?.type === undefined || options?.type === 'pullrequest') {\n\t\t\ttry {\n\t\t\t\tconst pr = await this.getPullRequest(provider, token, owner, repo, id, baseUrl);\n\t\t\t\tif (pr != null) return pr;\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tif (options?.type === undefined || options?.type === 'issue') {\n\t\t\ttry {\n\t\t\t\tconst issueResponse = await this.request<BitbucketIssue>(\n\t\t\t\t\tprovider,\n\t\t\t\t\ttoken,\n\t\t\t\t\tbaseUrl,\n\t\t\t\t\t`repositories/${owner}/${repo}/issues/${id}`,\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t},\n\t\t\t\t\tscope,\n\t\t\t\t);\n\n\t\t\t\tif (issueResponse) {\n\t\t\t\t\tconst result: IssueOrPullRequest = {\n\t\t\t\t\t\tid: issueResponse.id.toString(),\n\t\t\t\t\t\ttype: 'issue',\n\t\t\t\t\t\tnodeId: issueResponse.id.toString(),\n\t\t\t\t\t\tprovider: provider,\n\t\t\t\t\t\tcreatedDate: new Date(issueResponse.created_on),\n\t\t\t\t\t\tupdatedDate: new Date(issueResponse.updated_on),\n\t\t\t\t\t\tstate: bitbucketIssueStateToState(issueResponse.state),\n\t\t\t\t\t\tclosed: issueResponse.state === 'closed',\n\t\t\t\t\t\ttitle: issueResponse.title,\n\t\t\t\t\t\turl: issueResponse.links.html.href,\n\t\t\t\t\t};\n\t\t\t\t\treturn copyReadProvenance(result, issueResponse);\n\t\t\t\t}\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, id, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tid: id,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getServerPullRequestById(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tid: string,\n\t\tbaseUrl: string,\n\t): Promise<IssueOrPullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\treturn await this.getServerPullRequest(provider, token, owner, repo, id, baseUrl);\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t/**\n\t * A Bitbucket Cloud pull request by id. Strict, unlike {@link getIssueOrPullRequest}: `undefined` means a 404,\n\t * and every other failure throws, so the answer can be cached as a proven absence.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, id, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tid: id,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getPullRequest(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tid: string,\n\t\tbaseUrl: string,\n\t\toptions?: {\n\t\t\tcurrentAccount?: { id: string; username?: string };\n\t\t\tdeferFailure?: boolean;\n\t\t\t/** The calling read, stamped on the row. */\n\t\t\tprojection?: PullRequestProjection;\n\t\t},\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst pr = await this.request<BitbucketPullRequest>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`repositories/${owner}/${repo}/pullrequests/${id}?fields=%2Bvalues.reviewers,%2Bvalues.participants`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t\tundefined,\n\t\t\t\toptions?.deferFailure,\n\t\t\t);\n\t\t\tif (pr == null) throw new Error(`Bitbucket returned no pull request for ${owner}/${repo}#${id}`);\n\n\t\t\treturn fromBitbucketPullRequest(pr, provider, {\n\t\t\t\tcurrentAccount: options?.currentAccount,\n\t\t\t\tprojection: options?.projection,\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\tif (isNotFoundResponse(ex)) return undefined;\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t/**\n\t * The change state of pull requests `ids` in `owner/repo` — the cheap check behind the batch read's etags — in ONE\n\t * request for up to {@link bitbucketEtagFieldsMaxIds} ids, selecting only what {@link getPullRequest}'s row reads\n\t * into its etag (plus the participants and reviewers for the `reviewDecision` include). One entry per input id, in\n\t * order.\n\t *\n\t * Strict like {@link getPullRequest}: `undefined` is a PROVEN ABSENCE, for an id missing from a complete page, or\n\t * for every id when the repository is a 404, as each id's own read would be. A page with more (`next`) and every\n\t * other failure throw. Every state is asked for, since the list answers only open pull requests by default.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, ids) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tids: ids.length,\n\t\t}),\n\t})\n\tpublic async getPullRequestsEtagFields(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tids: readonly number[],\n\t\tbaseUrl: string,\n\t\toptions: { etagIncludes: readonly PullRequestEtagInclude[]; deferFailure?: boolean },\n\t\tcancellation?: AbortSignal,\n\t): Promise<(BitbucketPullRequestEtagNode | undefined)[]> {\n\t\tconst scope = getScopedLogger();\n\n\t\tif (!ids.length) return [];\n\t\tif (ids.length > bitbucketEtagFieldsMaxIds) {\n\t\t\tthrow new Error(\n\t\t\t\t`Cannot read more than ${bitbucketEtagFieldsMaxIds} Bitbucket pull requests in one request`,\n\t\t\t);\n\t\t}\n\n\t\tconst fields = [\n\t\t\t'values.id',\n\t\t\t'values.state',\n\t\t\t'values.draft',\n\t\t\t'values.updated_on',\n\t\t\t'values.source.commit.hash',\n\t\t\t'next',\n\t\t];\n\t\tif (options.etagIncludes.includes('reviewDecision')) {\n\t\t\tfields.push(\n\t\t\t\t'values.participants.approved',\n\t\t\t\t'values.participants.state',\n\t\t\t\t'values.participants.participated_on',\n\t\t\t\t'values.reviewers.uuid',\n\t\t\t);\n\t\t}\n\n\t\tconst params = new URLSearchParams({\n\t\t\tq: `id IN (${ids.join(',')})`,\n\t\t\tfields: fields.join(','),\n\t\t\tpagelen: String(ids.length),\n\t\t});\n\t\tfor (const state of ['OPEN', 'MERGED', 'DECLINED', 'SUPERSEDED'] satisfies BitbucketPullRequestState[]) {\n\t\t\tparams.append('state', state);\n\t\t}\n\n\t\ttry {\n\t\t\tconst response = await this.request<{ values?: BitbucketPullRequestEtagNode[]; next?: string }>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`repositories/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/pullrequests?${params.toString()}`,\n\t\t\t\t{ method: 'GET' },\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t\tif (response?.values == null) {\n\t\t\t\tthrow new Error(`Bitbucket returned no pull requests for ${owner}/${repo}`);\n\t\t\t}\n\t\t\tif (response.next != null) throw new Error(`Bitbucket returned a partial page of ${owner}/${repo}`);\n\n\t\t\tconst byId = new Map(response.values.map(pr => [pr.id, pr]));\n\t\t\treturn ids.map(id => byId.get(id));\n\t\t} catch (ex) {\n\t\t\tif (isNotFoundResponse(ex)) return ids.map(() => undefined);\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t/**\n\t * A Bitbucket Data Center pull request by id. Strict, unlike {@link getServerPullRequestById}: `undefined` means\n\t * a 404, and every other failure throws, so the answer can be cached as a proven absence.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, id, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tid: id,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getServerPullRequest(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tid: string,\n\t\tbaseUrl: string,\n\t\toptions?: {\n\t\t\tcurrentAccount?: { id: string; username?: string };\n\t\t\tdeferFailure?: boolean;\n\t\t\t/** The calling read, stamped on the row. */\n\t\t\tprojection?: PullRequestProjection;\n\t\t},\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst pr = await this.request<BitbucketServerPullRequest>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`projects/${owner}/repos/${repo}/pull-requests/${id}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t\tundefined,\n\t\t\t\toptions?.deferFailure,\n\t\t\t);\n\t\t\tif (pr == null) throw new Error(`Bitbucket returned no pull request for ${owner}/${repo}#${id}`);\n\n\t\t\treturn fromProviderPullRequest(normalizeBitbucketServerPullRequest(pr), provider, {\n\t\t\t\tcurrentAccount: options?.currentAccount,\n\t\t\t\tprojection: options?.projection,\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\tif (isNotFoundResponse(ex)) return undefined;\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t/**\n\t * Every Bitbucket Cloud pull request into `owner/repo` whose source is `branch`, in any state, newest first, at\n\t * most `limit`: from the repository itself when `headOwner` is omitted, otherwise from a fork in the `headOwner`\n\t * workspace. Keyed on the source branch NAME, so a merged pull request whose branch was deleted still matches.\n\t *\n\t * Strict like {@link getPullRequest}: a 404 (a missing repository) is an empty list, and every other failure\n\t * throws.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, branch, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbranch: branch,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getPullRequestsForBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbranch: string,\n\t\tbaseUrl: string,\n\t\toptions: {\n\t\t\theadOwner?: string;\n\t\t\tlimit: number;\n\t\t\tcurrentAccount?: { id: string; username?: string };\n\t\t\tdeferFailure?: boolean;\n\t\t},\n\t): Promise<{ pullRequests: PullRequest[]; truncated: boolean }> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst escapedBranch = branch.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n\t\tconst params = new URLSearchParams({\n\t\t\t// Every state named: Bitbucket answers only OPEN pull requests unless asked for the others.\n\t\t\tq: `source.branch.name=\"${escapedBranch}\" AND (state=\"OPEN\" OR state=\"MERGED\" OR state=\"DECLINED\" OR state=\"SUPERSEDED\")`,\n\t\t\tsort: '-updated_on',\n\t\t\tpagelen: String(options.limit),\n\t\t\tfields: '+values.reviewers,+values.participants',\n\t\t});\n\n\t\ttry {\n\t\t\tconst response = await this.request<{ values: BitbucketPullRequest[]; next?: string }>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`repositories/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/pullrequests?${params.toString()}`,\n\t\t\t\t{ method: 'GET' },\n\t\t\t\tscope,\n\t\t\t\tundefined,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t\tif (response?.values == null) {\n\t\t\t\tthrow new Error(`Bitbucket returned no pull requests for ${owner}/${repo}:${branch}`);\n\t\t\t}\n\n\t\t\tconst headOwner = options.headOwner;\n\t\t\tconst { values, truncated } = selectBranchPullRequests(response.values, {\n\t\t\t\tmatchesHead: pr => {\n\t\t\t\t\tconst source = pr.source.repository;\n\t\t\t\t\tif (pr.source.branch.name !== branch || source == null) return false;\n\t\t\t\t\tif (headOwner == null) return source.uuid === pr.destination.repository.uuid;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\tsource.uuid !== pr.destination.repository.uuid &&\n\t\t\t\t\t\tequalsIgnoreCase(source.full_name.split('/')[0], headOwner)\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tupdatedAt: pr => Date.parse(pr.updated_on),\n\t\t\t\tmap: pr =>\n\t\t\t\t\tfromBitbucketPullRequest(pr, provider, {\n\t\t\t\t\t\tcurrentAccount: options.currentAccount,\n\t\t\t\t\t\tprojection: 'batch',\n\t\t\t\t\t}),\n\t\t\t\tlimit: options.limit,\n\t\t\t\tmore: response.next != null,\n\t\t\t});\n\t\t\treturn { pullRequests: values, truncated: truncated };\n\t\t} catch (ex) {\n\t\t\tif (isNotFoundResponse(ex)) return { pullRequests: [], truncated: false };\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t/**\n\t * Every Bitbucket Data Center pull request whose source is `branch` in `owner/repo` and whose target is that same\n\t * repository, in any state, newest first, at most `limit`. Asked of the repository the branch lives in\n\t * (`direction=OUTGOING`), which is why a fork's pull requests can't be found through the repository they target.\n\t *\n\t * Strict like {@link getServerPullRequest}: a 404 (a missing repository) is an empty list, and every other\n\t * failure throws.\n\t */\n\t@trace({\n\t\targs: (provider, token, owner, repo, branch, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\tbranch: branch,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tpublic async getServerPullRequestsForBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbranch: string,\n\t\tbaseUrl: string,\n\t\toptions: { limit: number; currentAccount?: { id: string; username?: string }; deferFailure?: boolean },\n\t): Promise<{ pullRequests: PullRequest[]; truncated: boolean }> {\n\t\tconst scope = getScopedLogger();\n\n\t\tconst ref = `refs/heads/${branch}`;\n\t\tconst params = new URLSearchParams({\n\t\t\tat: ref,\n\t\t\tdirection: 'OUTGOING',\n\t\t\tstate: 'ALL',\n\t\t\torder: 'NEWEST',\n\t\t\tlimit: String(options.limit),\n\t\t});\n\n\t\ttry {\n\t\t\tconst response = await this.request<{ values: BitbucketServerPullRequest[]; isLastPage?: boolean }>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`projects/${encodeURIComponent(owner)}/repos/${encodeURIComponent(repo)}/pull-requests?${params.toString()}`,\n\t\t\t\t{ method: 'GET' },\n\t\t\t\tscope,\n\t\t\t\tundefined,\n\t\t\t\toptions.deferFailure,\n\t\t\t);\n\t\t\tif (response?.values == null) {\n\t\t\t\tthrow new Error(`Bitbucket returned no pull requests for ${owner}/${repo}:${branch}`);\n\t\t\t}\n\n\t\t\tconst { values, truncated } = selectBranchPullRequests(response.values, {\n\t\t\t\t// `OUTGOING` also lists this branch's pull requests into other repositories, e.g. the upstream of a\n\t\t\t\t// repository that is itself a fork.\n\t\t\t\tmatchesHead: pr => pr.fromRef.id === ref && pr.fromRef.repository.id === pr.toRef.repository.id,\n\t\t\t\tupdatedAt: pr => pr.updatedDate,\n\t\t\t\tmap: pr =>\n\t\t\t\t\tfromProviderPullRequest(normalizeBitbucketServerPullRequest(pr), provider, {\n\t\t\t\t\t\tcurrentAccount: options.currentAccount,\n\t\t\t\t\t\tprojection: 'batch',\n\t\t\t\t\t}),\n\t\t\t\tlimit: options.limit,\n\t\t\t\tmore: response.isLastPage !== true,\n\t\t\t});\n\t\t\treturn { pullRequests: values, truncated: truncated };\n\t\t} catch (ex) {\n\t\t\tif (isNotFoundResponse(ex)) return { pullRequests: [], truncated: false };\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, workspace) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\tworkspace: workspace,\n\t\t}),\n\t})\n\tasync getRepositoriesForWorkspace(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tworkspace: string,\n\t\toptions: {\n\t\t\tbaseUrl: string;\n\t\t},\n\t): Promise<RepositoryMetadata[] | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tinterface BitbucketRepositoriesResponse {\n\t\t\t\tsize: number;\n\t\t\t\tpage: number;\n\t\t\t\tpagelen: number;\n\t\t\t\tnext?: string;\n\t\t\t\tprevious?: string;\n\t\t\t\tvalues: BitbucketRepository[];\n\t\t\t}\n\n\t\t\tconst response = await this.request<BitbucketRepositoriesResponse>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\toptions.baseUrl,\n\t\t\t\t`repositories/${workspace}?role=contributor&fields=%2Bvalues.parent.workspace`, // field=+<field> must be encoded as field=%2B<field>\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t);\n\n\t\t\tif (response) {\n\t\t\t\treturn response.values.map(repo => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tprovider: provider,\n\t\t\t\t\t\towner: repo.workspace.slug,\n\t\t\t\t\t\tname: repo.slug,\n\t\t\t\t\t\tisFork: Boolean(repo.parent),\n\t\t\t\t\t\tparent: repo.parent\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\towner: repo.parent.workspace.slug,\n\t\t\t\t\t\t\t\t\tname: repo.parent.slug,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn undefined;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t}),\n\t})\n\tasync getRepositoryMetadata(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\toptions: {\n\t\t\tbaseUrl: string;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<RepositoryMetadata | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst response = await this.getRepository(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\towner,\n\t\t\t\trepo,\n\t\t\t\toptions.baseUrl,\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t);\n\t\t\tif (response == null) return undefined;\n\n\t\t\tlet parent: RepositoryMetadata['parent'];\n\t\t\tif (response.parent != null) {\n\t\t\t\t// Derive the parent from `full_name` (\"owner/repo\") rather than `parent.workspace`, which is a\n\t\t\t\t// requested field expansion Bitbucket doesn't always honor (an unexpanded parent would otherwise\n\t\t\t\t// throw and null out the whole result).\n\t\t\t\t// `full_name` is \"owner/repo\"; only report a parent when both parts are present so a malformed\n\t\t\t\t// value doesn't produce a parent with an undefined owner/name while `isFork` stays true.\n\t\t\t\tconst [parentOwner, parentName] = response.parent.full_name.split('/');\n\t\t\t\tif (parentOwner && parentName) {\n\t\t\t\t\tparent = { owner: parentOwner, name: parentName };\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tprovider: provider,\n\t\t\t\towner: response.workspace.slug,\n\t\t\t\tname: response.slug,\n\t\t\t\tisFork: response.parent != null,\n\t\t\t\tparent: parent,\n\t\t\t} satisfies RepositoryMetadata;\n\t\t} catch (ex) {\n\t\t\t// Cancellations and 404s are expected outcomes for a probe; don't log them as errors.\n\t\t\tif (!isCancellationError(ex) && !(ex instanceof RequestNotFoundError)) {\n\t\t\t\tscope?.error(ex);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t}),\n\t})\n\tasync getDefaultBranch(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\toptions: {\n\t\t\tbaseUrl: string;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<DefaultBranch | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst response = await this.getRepository(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\towner,\n\t\t\t\trepo,\n\t\t\t\toptions.baseUrl,\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t);\n\t\t\tconst name = response?.mainbranch?.name;\n\t\t\tif (name == null) return undefined;\n\n\t\t\treturn { provider: provider, name: name } satisfies DefaultBranch;\n\t\t} catch (ex) {\n\t\t\t// Cancellations and 404s are expected outcomes for a probe; don't log them as errors.\n\t\t\tif (!isCancellationError(ex) && !(ex instanceof RequestNotFoundError)) {\n\t\t\t\tscope?.error(ex);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate getRepository(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\tbaseUrl: string,\n\t\tscope: ScopedLogger | undefined,\n\t\tcancellation?: AbortSignal,\n\t): Promise<BitbucketRepository | undefined> {\n\t\treturn this.request<BitbucketRepository>(\n\t\t\tprovider,\n\t\t\ttoken,\n\t\t\tbaseUrl,\n\t\t\t`repositories/${owner}/${repo}`,\n\t\t\t{ method: 'GET' },\n\t\t\tscope,\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, rev, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\trev: rev,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tasync getServerPullRequestForCommit(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\trev: string,\n\t\tbaseUrl: string,\n\t\toptions?: {\n\t\t\tavatarSize?: number;\n\t\t\t/** For a batch read: the batch reports a failed request once rather than each request showing its own. */\n\t\t\tdeferFailure?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst response = await this.request<{ values: BitbucketServerPullRequest[] }>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`projects/${encodePathSegment(owner)}/repos/${encodePathSegment(repo)}/commits/${rev}/pull-requests`, //?fields=${fieldsParam}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t\toptions?.deferFailure,\n\t\t\t);\n\t\t\tif (response?.values == null) {\n\t\t\t\tthrow new Error(`Bitbucket returned no pull requests for ${owner}/${repo}@${rev}`);\n\t\t\t}\n\n\t\t\tconst prResponse = response.values.reduce<BitbucketServerPullRequest | undefined>(\n\t\t\t\t(acc, pr) => (!acc || pr.updatedDate > acc.updatedDate ? pr : acc),\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\tif (!prResponse) return undefined;\n\n\t\t\tconst providersPr = normalizeBitbucketServerPullRequest(prResponse);\n\t\t\tconst gitlensPr = fromProviderPullRequest(providersPr, provider, { projection: 'point' });\n\t\t\treturn gitlensPr;\n\t\t} catch (ex) {\n\t\t\tif (isNotFoundResponse(ex)) return undefined;\n\n\t\t\tif (!options?.deferFailure && isCommitReadRefusal(ex)) {\n\t\t\t\tthrow new CommitReadRefusedError(ex.message, ex);\n\t\t\t}\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, rev, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\trev: rev,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tasync getPullRequestForCommit(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\trev: string,\n\t\tbaseUrl: string,\n\t\toptions?: {\n\t\t\tavatarSize?: number;\n\t\t\t/** For a batch read: the batch reports a failed request once rather than each request showing its own. */\n\t\t\tdeferFailure?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<PullRequest | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst fields = [\n\t\t\t\t'+values.*',\n\t\t\t\t'+values.destination.repository',\n\t\t\t\t'+values.destination.branch.*',\n\t\t\t\t'+values.destination.commit.*',\n\t\t\t\t'+values.source.repository.*',\n\t\t\t\t'+values.source.branch.*',\n\t\t\t\t'+values.source.commit.*',\n\t\t\t];\n\t\t\tconst fieldsParam = encodeURIComponent(fields.join(','));\n\t\t\tconst response = await this.request<{ values?: BitbucketPullRequest[]; repo_indexed?: boolean }>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`repositories/${encodePathSegment(owner)}/${encodePathSegment(repo)}/commit/${rev}/pullrequests?fields=${fieldsParam}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t\toptions?.deferFailure,\n\t\t\t);\n\t\t\t// SEE: api.bitbucket.org/swagger.json getPullrequestsForCommit: 404 is a missing repository or links not yet indexed, 202 is still indexing.\n\t\t\t// SEE: observed 2026-11-22: an unknown commit and a missing repository both answer 404 \"Resource not found\"; an indexed repository answers 200 with repo_indexed true.\n\t\t\tif (response?.values == null || response.repo_indexed === false) {\n\t\t\t\tthrow new BitbucketCommitPullRequestsUnindexedError(\n\t\t\t\t\t`Bitbucket is still indexing the pull requests of ${owner}/${repo}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis._indexedRepositories.add(indexedRepositoryKey(token, owner, repo));\n\n\t\t\tconst pr = response.values.reduce<BitbucketPullRequest | undefined>(\n\t\t\t\t(acc, pr) => (!acc || pr.updated_on > acc.updated_on ? pr : acc),\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\tif (!pr) return undefined;\n\t\t\treturn fromBitbucketPullRequest(pr, provider, { projection: 'point' });\n\t\t} catch (ex) {\n\t\t\tif (isCommitLinksAppMissing(ex)) {\n\t\t\t\tconst commitWebUrl = `https://bitbucket.org/${owner}/${repo}/commits/${rev}`;\n\t\t\t\tif (!options?.deferFailure) {\n\t\t\t\t\t// TODO: In future get it on to home as an warning on the integration itself \"this integration has issues\"\n\t\t\t\t\t// even user suppresses the message it's still visible with some capacity. It's a broader thing to get other errors.\n\t\t\t\t\tthis.notifyCommitLinksAppMissing(owner, commitWebUrl);\n\t\t\t\t}\n\t\t\t\tthrow new BitbucketCommitLinksAppMissingError(commitWebUrl);\n\t\t\t}\n\n\t\t\tif (isNotFoundResponse(ex)) {\n\t\t\t\tif (!options?.deferFailure && this.isRepositoryIndexed(token, owner, repo)) return undefined;\n\n\t\t\t\tthrow new BitbucketCommitNotFoundError(\n\t\t\t\t\t`Bitbucket has no such commit in ${owner}/${repo}, or no such repository`,\n\t\t\t\t\tex,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!options?.deferFailure && isCommitReadRefusal(ex)) {\n\t\t\t\tthrow new CommitReadRefusedError(ex.message, ex);\n\t\t\t}\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, rev, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\trev: rev,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tasync getAccountForCommit(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\trev: string,\n\t\tbaseUrl: string,\n\t\t_options?: {\n\t\t\tavatarSize?: number;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<Account | UnidentifiedAuthor | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst commit = await this.request<BitbucketCommit>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`repositories/${owner}/${repo}/commit/${rev}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t);\n\t\t\tif (!commit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { name, email } = parseRawBitbucketAuthor(commit.author.raw);\n\t\t\tconst commitAuthor: CommitAuthor = {\n\t\t\t\tprovider: provider,\n\t\t\t\tid: commit.author.user?.account_id,\n\t\t\t\tusername: commit.author.user?.nickname,\n\t\t\t\tname: commit.author.user?.display_name || name,\n\t\t\t\temail: email,\n\t\t\t\tavatarUrl: commit.author.user?.links?.avatar?.href,\n\t\t\t};\n\t\t\tif (commitAuthor.id != null && commitAuthor.username != null) {\n\t\t\t\treturn {\n\t\t\t\t\t...commitAuthor,\n\t\t\t\t\tid: commitAuthor.id,\n\t\t\t\t} satisfies Account;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...commitAuthor,\n\t\t\t\tid: undefined,\n\t\t\t\tusername: undefined,\n\t\t\t} satisfies UnidentifiedAuthor;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t@trace({\n\t\targs: (provider, token, owner, repo, rev, baseUrl) => ({\n\t\t\tprovider: provider.name,\n\t\t\ttoken: `<token:${token.microHash}>`,\n\t\t\towner: owner,\n\t\t\trepo: repo,\n\t\t\trev: rev,\n\t\t\tbaseUrl: baseUrl,\n\t\t}),\n\t})\n\tasync getServerAccountForCommit(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\towner: string,\n\t\trepo: string,\n\t\trev: string,\n\t\tbaseUrl: string,\n\t\t_options?: {\n\t\t\tavatarSize?: number;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<Account | UnidentifiedAuthor | undefined> {\n\t\tconst scope = getScopedLogger();\n\n\t\ttry {\n\t\t\tconst commit = await this.request<BitbucketServerCommit>(\n\t\t\t\tprovider,\n\t\t\t\ttoken,\n\t\t\t\tbaseUrl,\n\t\t\t\t`projects/${owner}/repos/${repo}/commits/${rev}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t},\n\t\t\t\tscope,\n\t\t\t\tcancellation,\n\t\t\t);\n\t\t\tif (!commit?.author) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif (commit.author.id != null) {\n\t\t\t\treturn {\n\t\t\t\t\tprovider: provider,\n\t\t\t\t\tid: commit.author.id.toString(),\n\t\t\t\t\tusername: commit.author.name,\n\t\t\t\t\tname: commit.author.name,\n\t\t\t\t\temail: commit.author.emailAddress,\n\t\t\t\t\tavatarUrl: commit.author?.avatarUrl,\n\t\t\t\t} satisfies Account;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tprovider: provider,\n\t\t\t\tid: undefined,\n\t\t\t\tusername: undefined,\n\t\t\t\tname: commit.author.name,\n\t\t\t\temail: commit.author.emailAddress,\n\t\t\t\tavatarUrl: undefined,\n\t\t\t} satisfies UnidentifiedAuthor;\n\t\t} catch (ex) {\n\t\t\tscope?.error(ex);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate async request<T>(\n\t\tprovider: Provider,\n\t\ttoken: TokenWithInfo,\n\t\tbaseUrl: string,\n\t\troute: string,\n\t\toptions?: { method: RequestInit['method'] } & Record<string, unknown>,\n\t\tscope?: ScopedLogger | undefined,\n\t\tcancellation?: AbortSignal | undefined,\n\t\tdeferFailure?: boolean,\n\t): Promise<T | undefined> {\n\t\tconst { accessToken } = token;\n\t\tconst url = `${baseUrl}/${route}`;\n\n\t\tlet rsp: Response;\n\t\ttry {\n\t\t\tconst sw = maybeStopWatch(`[BITBUCKET] ${options?.method ?? 'GET'} ${url}`, { log: { onlyExit: true } });\n\n\t\t\ttry {\n\t\t\t\tif (cancellation?.aborted) throw new CancellationError();\n\n\t\t\t\tconst capture = createReadCapture();\n\t\t\t\trsp = await this.config.wrapForForcedInsecureSSL(provider.getIgnoreSSLErrors(), () =>\n\t\t\t\t\tthis.config.fetch(url, {\n\t\t\t\t\t\theaders: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json' },\n\t\t\t\t\t\tsignal: cancellation,\n\t\t\t\t\t\t...options,\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tif (rsp.ok) {\n\t\t\t\t\treturn captureReadNodes(await rsp.json(), capture) as T;\n\t\t\t\t}\n\n\t\t\t\t// Reads the body so the 403 branch below can tell a throttled request from a permission failure.\n\t\t\t\tthrow await ProviderFetchError.fromResponse('Bitbucket', rsp);\n\t\t\t} finally {\n\t\t\t\tsw?.stop();\n\t\t\t}\n\t\t} catch (ex) {\n\t\t\tif (ex instanceof ProviderFetchError || ex.name === 'AbortError') {\n\t\t\t\tthis.handleRequestError(provider, token, ex, scope, deferFailure);\n\t\t\t} else if (Logger.isDebugging) {\n\t\t\t\tthis.config.onError?.(`Bitbucket request failed: ${ex.message}`);\n\t\t\t}\n\n\t\t\tthrow ex;\n\t\t}\n\t}\n\n\tprivate handleRequestError(\n\t\tprovider: Provider | undefined,\n\t\ttoken: TokenWithInfo,\n\t\tex: ProviderFetchError | (Error & { name: 'AbortError' }),\n\t\tscope: ScopedLogger | undefined,\n\t\tdeferFailure: boolean | undefined,\n\t): void {\n\t\tif (ex.name === 'AbortError' || !(ex instanceof ProviderFetchError)) throw new CancellationError(ex);\n\n\t\tconst { accessToken, ...tokenInfo } = token;\n\t\tswitch (ex.status) {\n\t\t\tcase 404: // Not found\n\t\t\tcase 410: // Gone\n\t\t\tcase 422: // Unprocessable Entity\n\t\t\t\tthrow new RequestNotFoundError(ex);\n\t\t\tcase 401: // Unauthorized\n\t\t\t\tthrow new AuthenticationError(tokenInfo, AuthenticationErrorReason.Unauthorized, ex);\n\t\t\tcase 429: // Too Many Requests\n\t\t\t\tthrow toRateLimitError(ex, accessToken);\n\t\t\tcase 403: // Forbidden\n\t\t\t\t// Bitbucket returns 403 for both a permission failure and a throttled request (\"API rate limit\n\t\t\t\t// exceeded\"), so the message is the discriminant. Reporting a throttle as `auth` would prompt the\n\t\t\t\t// user to re-authenticate a healthy connection instead of retrying (see `isRateLimitResponse`).\n\t\t\t\tif (isRateLimitResponse(ex)) throw toRateLimitError(ex, accessToken);\n\n\t\t\t\tthrow new AuthenticationError(tokenInfo, AuthenticationErrorReason.Forbidden, ex);\n\t\t\tcase 500: // Internal Server Error\n\t\t\t\tscope?.error(ex);\n\t\t\t\tif (ex.response != null) {\n\t\t\t\t\treportRequestFailure(\n\t\t\t\t\t\tprovider,\n\t\t\t\t\t\tex,\n\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\tthis.config.onRequestFailed?.(\n\t\t\t\t\t\t\t\tprovider == null || provider.id === 'bitbucket'\n\t\t\t\t\t\t\t\t\t? l10n.t(\n\t\t\t\t\t\t\t\t\t\t\t'{0} failed to respond and might be experiencing issues. Please visit the [Bitbucket status page](https://bitbucket.status.atlassian.com/) for more information.',\n\t\t\t\t\t\t\t\t\t\t\tprovider?.name ?? 'Bitbucket',\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t: l10n.t('{0} failed to respond and might be experiencing issues.', provider.name),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\tdeferFailure,\n\t\t\t\t\t\ttoken.connectionId,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\tcase 502: // Bad Gateway\n\t\t\t\tscope?.error(ex);\n\t\t\t\t// TODO: Learn the Bitbucket API docs and put it in order:\n\t\t\t\t// if (ex.message.includes('timeout')) {\n\t\t\t\t// \tprovider?.trackRequestException();\n\t\t\t\t// \tvoid showIntegrationRequestTimedOutWarningMessage(provider?.name ?? 'Bitbucket');\n\t\t\t\t// \treturn;\n\t\t\t\t// }\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (ex.status >= 400 && ex.status < 500) throw new RequestClientError(ex);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tscope?.error(ex);\n\t\tif (Logger.isDebugging) {\n\t\t\tthis.config.onError?.(\n\t\t\t\t`Bitbucket request failed: ${(ex.response as any)?.errors?.[0]?.message ?? ex.message}`,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/** Wires a {@link BitbucketApi} from the full runtime context, mapping `ctx` down to the narrow config. */\nexport function createBitbucketApi(ctx: IntegrationServiceContext): BitbucketApi {\n\tconst config: ProviderApiConfig = {\n\t\t...baseProviderApiConfig(ctx),\n\t\tonBitbucketCommitLinksAppMissing: revLink => ctx.hooks?.ui?.onBitbucketCommitLinksAppMissing?.(revLink),\n\t};\n\n\treturn new BitbucketApi(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuDA,SAAS,wBAAwB,IAAsB;CACtD,MAAM,WAAoB,cAAc,SAAS,cAAc,KAAK,GAAG,WAAW;CAClF,OAAO,oBAAoB,sBAAsB,SAAS,QAAQ,SAAS,iCAAiC;AAC7G;AAEA,IAAa,+BAAb,cAAkD,uBAAuB,CAAC;AAE1E,IAAa,4CAAb,cAA+D,uBAAuB,CAAC;AAEvF,IAAa,sCAAb,cAAyD,uBAAuB;CAC1D;CAArB,YAAY,WAA4B;EACvC,MACC,2JAA2J,UAAU,eACtK;EAHoB,KAAA,YAAA;CAIrB;AACD;AAEA,SAAS,qBAAqB,OAAsB,OAAe,MAAsB;CACxF,OAAO,GAAG,MAAM,YAAY,GAAG,GAAG,MAAM,GAAG,OAAO,YAAY;AAC/D;AAEA,IAAa,eAAb,MAAgD;CAGlB;CAF7B;CAEA,YAAY,QAA4C;EAA3B,KAAA,SAAA;EAC5B,KAAK,cAAc,OAAO,wBAAwB,KAAK,YAAY,CAAC;CACrE;CAEA,UAAgB;EACf,KAAK,aAAa,QAAQ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,OAAO,MAAM,KAAK,aAAa;CACtD,UAAU,SAAS;CACnB,OAAO,UAAU,MAAM,UAAU;CAC1B;CACD;CACD;CACI;AACV,GACD,CAAC,CAAA,GAAA,aAAA,WAAA,6BAAA,IAAA;;AA6KF,SAAgB,mBAAmB,KAA8C;CAMhF,OAAO,IAAI,aAAa;EAJvB,GAAG,sBAAsB,GAAG;EAC5B,mCAAkC,YAAW,IAAI,OAAO,IAAI,mCAAmC,OAAO;CAG/E,CAAM;AAC/B"}
|
|
@@ -3,7 +3,7 @@ import { Provider } from "../../../../git/models/remoteProvider.js";
|
|
|
3
3
|
import { IssueOrPullRequestState } from "../../../../git/models/issueOrPullRequest.js";
|
|
4
4
|
import { Issue, IssueProjection } from "../../../../git/models/issue.js";
|
|
5
5
|
import { PullRequest, PullRequestMember, PullRequestProjection, PullRequestReviewDecision, PullRequestReviewer } from "../../../../git/models/pullRequest.js";
|
|
6
|
-
import { PullRequestEtagFields, PullRequestEtagInclude } from "../../
|
|
6
|
+
import { PullRequestEtagFields, PullRequestEtagInclude } from "../../reads/etag.js";
|
|
7
7
|
//#region ../plus/integrations/src/providers/bitbucket/models.d.ts
|
|
8
8
|
export interface BitbucketRepositoryDescriptor extends ResourceDescriptor {
|
|
9
9
|
owner: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","names":[],"sources":["../../../../../../plus/integrations/src/providers/bitbucket/models.ts"],"sourcesContent":["import { copyReadProvenance } from '@gitkraken/provider-apis/read-provenance';\nimport type { IssueProjection, IssueRepository } from '@gitlens/git/models/issue.js';\nimport { Issue } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequestState } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { PullRequestMember, PullRequestProjection, PullRequestReviewer } from '@gitlens/git/models/pullRequest.js';\nimport { PullRequest, PullRequestReviewDecision, PullRequestReviewState } from '@gitlens/git/models/pullRequest.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport type { PullRequestEtagFields, PullRequestEtagInclude } from '../../models/integration.js';\n\nexport interface BitbucketRepositoryDescriptor extends ResourceDescriptor {\n\towner: string;\n\tname: string;\n}\n\nexport interface BitbucketWorkspaceDescriptor extends ResourceDescriptor {\n\tid: string;\n\tname: string;\n\tslug: string;\n}\n\nexport type BitbucketPullRequestState = 'OPEN' | 'DECLINED' | 'MERGED' | 'SUPERSEDED';\n\ninterface BitbucketLink {\n\thref: string;\n\tname?: string;\n}\n\n// Bitbucket's `account` schema: a person (`user`) or an app/bot (`app_user`, e.g. a review bot on a PR).\n// An `app_user` has no `links.html` and no `nickname`, and the schema requires none of the links.\ninterface BitbucketUser {\n\ttype: 'user' | 'app_user';\n\tuuid: string;\n\tdisplay_name: string;\n\taccount_id?: string;\n\tnickname?: string;\n\tlinks?: {\n\t\tself?: BitbucketLink;\n\t\tavatar?: BitbucketLink;\n\t\thtml?: BitbucketLink;\n\t};\n}\n\ninterface BitbucketWorkspace {\n\ttype: 'workspace';\n\tuuid: string;\n\tname: string;\n\tslug: string;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tavatar: BitbucketLink;\n\t};\n}\n\ninterface BitbucketProject {\n\ttype: 'project';\n\tkey: string;\n\tuuid: string;\n\tname: string;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tavatar: BitbucketLink;\n\t};\n}\n\ninterface BitbucketPullRequestParticipant {\n\ttype: 'participant';\n\tuser: BitbucketUser;\n\trole: 'PARTICIPANT' | 'REVIEWER';\n\tapproved: boolean;\n\tstate: null | 'approved' | 'changes_requested';\n\tparticipated_on: null | string;\n}\n\nexport interface BitbucketRepository {\n\ttype: 'repository';\n\tuuid: string;\n\tfull_name: string;\n\tname: string;\n\tslug: string;\n\tdescription?: string;\n\tis_private: boolean;\n\tparent: null | BitbucketRepository;\n\tscm: 'git';\n\towner: BitbucketUser;\n\tworkspace: BitbucketWorkspace;\n\tproject: BitbucketProject;\n\tcreated_on: string;\n\tupdated_on: string;\n\tsize: number;\n\tlanguage: string;\n\thas_issues: boolean;\n\thas_wiki: boolean;\n\tfork_policy: 'allow_forks' | 'no_public_forks' | 'no_forks';\n\twebsite: string;\n\tmainbranch?: BitbucketBranch;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tavatar: BitbucketLink;\n\t};\n}\n\ninterface BitbucketCommitAuthor {\n\ttype: 'author';\n\traw: string;\n\tuser: BitbucketUser;\n}\n\ntype BitbucketMergeStrategy =\n\t| 'merge_commit'\n\t| 'squash'\n\t| 'fast_forward'\n\t| 'squash_fast_forward'\n\t| 'rebase_fast_forward'\n\t| 'rebase_merge';\n\ninterface BitbucketBranch {\n\tname: string;\n\tmerge_strategies?: BitbucketMergeStrategy[];\n\tdefault_merge_strategy?: BitbucketMergeStrategy;\n}\n\n// It parses a raw author sitring like \"Sergei Shmakov GK <sergei.shmakov@gitkraken.com>\" to name and email\nconst parseRawBitbucketAuthorRegex = /^(.*) <(.*)>$/;\nexport function parseRawBitbucketAuthor(raw: string): { name: string; email: string } {\n\tconst match = raw.match(parseRawBitbucketAuthorRegex);\n\tif (match) {\n\t\treturn { name: match[1], email: match[2] };\n\t}\n\treturn { name: raw, email: '' };\n}\n\nexport interface BitbucketCommit extends BitbucketBriefCommit {\n\tauthor: BitbucketCommitAuthor;\n\tdate: string;\n\tlinks: {\n\t\tapprove: BitbucketLink;\n\t\tcomments: BitbucketLink;\n\t\tdiff: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tself: BitbucketLink;\n\t\tstatuses: BitbucketLink;\n\t};\n\tmessage: string;\n\tparents: BitbucketBriefCommit[];\n\tparticipants: BitbucketPullRequestParticipant[];\n\trendered: {\n\t\tmessage: string;\n\t};\n\trepository: BitbucketRepository;\n\tsummary: {\n\t\ttype: 'rendered';\n\t\traw: string;\n\t\tmarkup: string;\n\t\thtml: string;\n\t};\n}\n\ninterface BitbucketBriefCommit {\n\ttype: 'commit';\n\thash: string;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t};\n}\n\nexport type BitbucketIssueState =\n\t| 'submitted'\n\t| 'new'\n\t| 'open'\n\t| 'resolved'\n\t| 'on hold'\n\t| 'invalid'\n\t| 'duplicate'\n\t| 'wontfix'\n\t| 'closed';\n\nexport interface BitbucketPullRequest {\n\ttype: 'pullrequest';\n\tid: number;\n\ttitle: string;\n\tdescription: string;\n\tstate: BitbucketPullRequestState;\n\tdraft?: boolean;\n\tmerge_commit: null | BitbucketBriefCommit;\n\tcomment_count: number;\n\ttask_count: number;\n\tclose_source_branch: boolean;\n\tclosed_by: BitbucketUser | null;\n\tauthor: BitbucketUser;\n\treason: string;\n\tcreated_on: string;\n\tupdated_on: string;\n\tdestination: {\n\t\tbranch: BitbucketBranch;\n\t\tcommit: BitbucketBriefCommit;\n\t\trepository: BitbucketRepository;\n\t};\n\tsource: {\n\t\tbranch: BitbucketBranch;\n\t\tcommit: BitbucketBriefCommit;\n\t\trepository: BitbucketRepository;\n\t};\n\tsummary: {\n\t\ttype: 'rendered';\n\t\traw: string;\n\t\tmarkup: string;\n\t\thtml: string;\n\t};\n\treviewers?: BitbucketUser[];\n\tparticipants?: BitbucketPullRequestParticipant[];\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tcommits: BitbucketLink;\n\t\tapprove: BitbucketLink;\n\t\t'request-changes': BitbucketLink;\n\t\tdiff: BitbucketLink;\n\t\tdiffstat: BitbucketLink;\n\t\tcomments: BitbucketLink;\n\t\tactivity: BitbucketLink;\n\t\tmerge: BitbucketLink;\n\t\tdecline: BitbucketLink;\n\t\tstatuses: BitbucketLink;\n\t};\n}\n\nexport interface BitbucketIssue {\n\ttype: string;\n\tid: number;\n\ttitle: string;\n\treporter: BitbucketUser;\n\tassignee?: BitbucketUser;\n\tstate: BitbucketIssueState;\n\tcreated_on: string;\n\tupdated_on: string;\n\trepository: BitbucketRepository;\n\tvotes?: number;\n\tcontent: {\n\t\traw: string;\n\t\tmarkup: string;\n\t\thtml: string;\n\t};\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tcomments: BitbucketLink;\n\t\tattachments: BitbucketLink;\n\t\twatch: BitbucketLink;\n\t\tvote: BitbucketLink;\n\t};\n}\n\nexport function bitbucketPullRequestStateToState(state: BitbucketPullRequestState): IssueOrPullRequestState {\n\tswitch (state) {\n\t\tcase 'DECLINED':\n\t\tcase 'SUPERSEDED':\n\t\t\treturn 'closed';\n\t\tcase 'MERGED':\n\t\t\treturn 'merged';\n\t\tcase 'OPEN':\n\t\tdefault:\n\t\t\treturn 'opened';\n\t}\n}\n\nexport function bitbucketIssueStateToState(state: BitbucketIssueState): IssueOrPullRequestState {\n\tswitch (state) {\n\t\tcase 'resolved':\n\t\tcase 'invalid':\n\t\tcase 'duplicate':\n\t\tcase 'wontfix':\n\t\tcase 'closed':\n\t\t\treturn 'closed';\n\t\tcase 'submitted':\n\t\tcase 'new':\n\t\tcase 'open':\n\t\tcase 'on hold':\n\t\tdefault:\n\t\t\treturn 'opened';\n\t}\n}\n\nexport function isClosedBitbucketPullRequestState(state: BitbucketPullRequestState): boolean {\n\treturn bitbucketPullRequestStateToState(state) !== 'opened';\n}\n\nexport function isClosedBitbucketIssueState(state: BitbucketIssueState): boolean {\n\treturn bitbucketIssueStateToState(state) !== 'opened';\n}\n\nexport function fromBitbucketUser(user: BitbucketUser): PullRequestMember {\n\treturn {\n\t\tavatarUrl: user.links?.avatar?.href,\n\t\tname: user.display_name,\n\t\tusername: user.nickname,\n\t\turl: user.links?.html?.href,\n\t\tid: user.uuid,\n\t};\n}\n\nexport function fromBitbucketParticipantToReviewer(\n\tprt: BitbucketPullRequestParticipant,\n\tclosedBy: BitbucketUser | null,\n\tprState: BitbucketPullRequestState,\n): PullRequestReviewer {\n\treturn {\n\t\treviewer: fromBitbucketUser(prt.user),\n\t\tstate: prt.approved\n\t\t\t? PullRequestReviewState.Approved\n\t\t\t: prt.state === 'changes_requested'\n\t\t\t\t? PullRequestReviewState.ChangesRequested\n\t\t\t\t: prt.participated_on != null\n\t\t\t\t\t? PullRequestReviewState.Commented\n\t\t\t\t\t: prt.user.uuid === closedBy?.uuid && prState === 'DECLINED'\n\t\t\t\t\t\t? PullRequestReviewState.Dismissed\n\t\t\t\t\t\t: PullRequestReviewState.ReviewRequested,\n\t};\n}\n\n/**\n * The review decision a Bitbucket Cloud row carries, derived from its participants and reviewers. Reads only the\n * participants' `participated_on`, `approved` and `state` and whether there are reviewers, which is what the cheap etag\n * read selects for it.\n */\nexport function getBitbucketReviewDecision(pr: {\n\tparticipants?: readonly Pick<BitbucketPullRequestParticipant, 'approved' | 'state' | 'participated_on'>[];\n\treviewers?: readonly unknown[];\n}): PullRequestReviewDecision | undefined {\n\tif (!pr.participants?.length && pr.reviewers?.length) {\n\t\treturn PullRequestReviewDecision.ReviewRequired;\n\t}\n\tif (!pr.participants) {\n\t\treturn undefined;\n\t}\n\n\tlet hasReviews = false;\n\tlet hasChangeRequests = false;\n\tlet hasApprovals = false;\n\tfor (const prt of pr.participants) {\n\t\tif (prt.participated_on != null) {\n\t\t\thasReviews = true;\n\t\t}\n\t\tif (prt.approved) {\n\t\t\thasApprovals = true;\n\t\t}\n\t\tif (prt.state === 'changes_requested') {\n\t\t\thasChangeRequests = true;\n\t\t}\n\t}\n\tif (hasChangeRequests) return PullRequestReviewDecision.ChangesRequested;\n\tif (hasApprovals) return PullRequestReviewDecision.Approved;\n\tif (hasReviews) return undefined; // not approved, not rejected, but reviewed\n\treturn PullRequestReviewDecision.ReviewRequired; // nobody has reviewed yet.\n}\n\nfunction fromBitbucketRepository(repo: BitbucketRepository): IssueRepository {\n\treturn {\n\t\towner: repo.full_name.split('/')[0],\n\t\trepo: repo.name,\n\t\tid: repo.uuid,\n\t};\n}\n\nexport function fromBitbucketIssue(issue: BitbucketIssue, provider: Provider, projection?: IssueProjection): Issue {\n\tconst result = new Issue(\n\t\tprovider,\n\t\tissue.id.toString(),\n\t\tissue.id.toString(),\n\t\tissue.title,\n\t\tissue.links.html.href,\n\t\tnew Date(issue.created_on),\n\t\tnew Date(issue.updated_on),\n\t\tisClosedBitbucketIssueState(issue.state),\n\t\tbitbucketIssueStateToState(issue.state),\n\t\tfromBitbucketUser(issue.reporter),\n\t\tissue.assignee ? [fromBitbucketUser(issue.assignee)] : [],\n\t\tfromBitbucketRepository(issue.repository),\n\t\tundefined, // closedDate\n\t\tundefined, // labels\n\t\tundefined, // commentsCount\n\t\tissue.votes, // thumbsUpCount\n\t\tissue.content.html, // body\n\t\t!issue.repository?.project\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tid: issue.repository.project.uuid,\n\t\t\t\t\tname: issue.repository.project.name,\n\t\t\t\t\tresourceId: issue.repository.project.uuid,\n\t\t\t\t\tresourceName: issue.repository.project.name,\n\t\t\t\t},\n\t\tundefined, // number\n\t\tundefined, // issueType\n\t\tundefined, // providerState\n\t\tundefined, // bodyFormat\n\t\tundefined, // iterations\n\t\tprojection,\n\t);\n\treturn copyReadProvenance(result, issue);\n}\n\nexport function fromBitbucketPullRequest(\n\tpr: BitbucketPullRequest,\n\tprovider: Provider,\n\toptions?: { currentAccount?: { id: string; username?: string }; projection?: PullRequestProjection },\n): PullRequest {\n\tconst author = fromBitbucketUser(pr.author);\n\tconst result = new PullRequest(\n\t\tprovider,\n\t\tauthor,\n\t\tpr.id.toString(),\n\t\tpr.id.toString(),\n\t\tpr.title,\n\t\tpr.links.html.href,\n\t\tfromBitbucketRepository(pr.destination.repository),\n\t\tbitbucketPullRequestStateToState(pr.state),\n\t\tnew Date(pr.created_on),\n\t\tnew Date(pr.updated_on),\n\t\tpr.closed_by ? new Date(pr.updated_on) : undefined,\n\t\tpr.state === 'MERGED' ? new Date(pr.updated_on) : undefined,\n\t\tundefined, // mergeableState: not read\n\t\tundefined, // viewerCanUpdate\n\t\t{\n\t\t\tbase: {\n\t\t\t\tbranch: pr.destination.branch.name,\n\t\t\t\tsha: pr.destination.commit.hash,\n\t\t\t\trepo: pr.destination.repository.name,\n\t\t\t\towner: pr.destination.repository.full_name.split('/')[0],\n\t\t\t\texists: true,\n\t\t\t\turl: pr.destination.repository.links.html.href,\n\t\t\t},\n\t\t\thead: {\n\t\t\t\tbranch: pr.source.branch.name,\n\t\t\t\tsha: pr.source.commit.hash,\n\t\t\t\trepo: pr.source.repository.name,\n\t\t\t\towner: pr.source.repository.full_name.split('/')[0],\n\t\t\t\texists: true,\n\t\t\t\turl: pr.source.repository.links.html.href,\n\t\t\t},\n\t\t\tisCrossRepository: pr.source.repository.uuid !== pr.destination.repository.uuid,\n\t\t},\n\t\tpr.draft,\n\t\tundefined, // additions\n\t\tundefined, // deletions\n\t\tundefined, // commentsCount\n\t\tundefined, // thumbsCount\n\t\tgetBitbucketReviewDecision(pr),\n\t\tpr.participants // reviewRequests:PullRequestReviewer[]\n\t\t\t?.filter(prt => prt.role === 'REVIEWER')\n\t\t\t.map(prt => fromBitbucketParticipantToReviewer(prt, pr.closed_by, pr.state))\n\t\t\t.filter(rv => rv.state === PullRequestReviewState.ReviewRequested),\n\t\tpr.participants // latestReviews:PullRequestReviewer[]\n\t\t\t?.filter(prt => prt.participated_on != null)\n\t\t\t.map(prt => fromBitbucketParticipantToReviewer(prt, pr.closed_by, pr.state)),\n\t\tundefined, // assignees:PullRequestMember[] -- it looks like there is no such thing as assignees on Bitbucket\n\t\tundefined, // PullRequestStatusCheckRollupState\n\t\tundefined, // IssueProject\n\t\tundefined, // version\n\t\tundefined, // commitCount\n\t\tundefined, // stack\n\t\tundefined, // filesChanged\n\t\tpr.description ?? undefined,\n\t\tpr.id,\n\t\toptions?.currentAccount != null ? author.id === options.currentAccount.id : undefined,\n\t\toptions?.projection,\n\t\toptions?.currentAccount,\n\t);\n\treturn copyReadProvenance(result, pr);\n}\n\n/** The most pull request ids one etag read asks for: Bitbucket Cloud's largest page of pull requests. */\nexport const bitbucketEtagFieldsMaxIds = 50;\n\n/**\n * A pull request as the cheap etag read selects it (`BitbucketApi.getPullRequestsEtagFields`): only the fields\n * {@link fromBitbucketPullRequest} maps into a full row's etag inputs. `participants` and `reviewers` are selected\n * only for the `reviewDecision` include.\n */\nexport interface BitbucketPullRequestEtagNode {\n\tid: number;\n\tstate: BitbucketPullRequestState;\n\tupdated_on: string;\n\tdraft?: boolean;\n\tsource: { commit: { hash: string } };\n\tparticipants?: Pick<BitbucketPullRequestParticipant, 'approved' | 'state' | 'participated_on'>[];\n\treviewers?: unknown[];\n}\n\n/**\n * A cheap etag read's pull request in the vocabulary {@link fromBitbucketPullRequest}'s row ends in, so both reads\n * compute the same etag. That row reads neither a mergeability nor a check rollup, so neither does this.\n */\nexport function toBitbucketPullRequestEtagFields(\n\tnode: BitbucketPullRequestEtagNode,\n\tetagIncludes: readonly PullRequestEtagInclude[],\n): PullRequestEtagFields {\n\tconst fields: PullRequestEtagFields = {\n\t\tstate: bitbucketPullRequestStateToState(node.state),\n\t\tisDraft: node.draft,\n\t\tupdatedDate: new Date(node.updated_on),\n\t\theadSha: node.source.commit.hash,\n\t};\n\n\tif (etagIncludes.includes('reviewDecision')) {\n\t\t// The full read always has both lists, and the decision tells a missing list from an empty one, so a row\n\t\t// without them can't be compared: it rejects, and the full read answers instead.\n\t\tif (node.participants == null || node.reviewers == null) {\n\t\t\tthrow new Error(`Bitbucket returned pull request ${node.id} without its participants or reviewers`);\n\t\t}\n\n\t\tfields.reviewDecision = getBitbucketReviewDecision(node);\n\t}\n\n\treturn fields;\n}\n"],"mappings":";;;;AA8HA,MAAM,+BAA+B;AACrC,SAAgB,wBAAwB,KAA8C;CACrF,MAAM,QAAQ,IAAI,MAAM,4BAA4B;CACpD,IAAI,OACH,OAAO;EAAE,MAAM,MAAM;EAAI,OAAO,MAAM;CAAG;CAE1C,OAAO;EAAE,MAAM;EAAK,OAAO;CAAG;AAC/B;AA4HA,SAAgB,iCA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EACrC,OAAO,iCAAiC,KAAK,KAAK;EAClD,SAAS,KAAK;EACd,aAAa,IAAI,KAAK,KAAK,UAAU;EACrC,SAAS,KAAK,OAAO,OAAO;CAC7B;CAEA,IAAI,aAAa,SAAS,gBAAgB,GAAG;EAG5C,IAAI,KAAK,gBAAgB,QAAQ,KAAK,aAAa,MAClD,MAAM,IAAI,MAAM,mCAAmC,KAAK,GAAG,uCAAuC;EAGnG,OAAO,iBAAiB,2BAA2B,IAAI;CACxD;CAEA,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"models.js","names":[],"sources":["../../../../../../plus/integrations/src/providers/bitbucket/models.ts"],"sourcesContent":["import { copyReadProvenance } from '@gitkraken/provider-apis/read-provenance';\nimport type { IssueProjection, IssueRepository } from '@gitlens/git/models/issue.js';\nimport { Issue } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequestState } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { PullRequestMember, PullRequestProjection, PullRequestReviewer } from '@gitlens/git/models/pullRequest.js';\nimport { PullRequest, PullRequestReviewDecision, PullRequestReviewState } from '@gitlens/git/models/pullRequest.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport type { PullRequestEtagFields, PullRequestEtagInclude } from '../../reads/etag.js';\n\nexport interface BitbucketRepositoryDescriptor extends ResourceDescriptor {\n\towner: string;\n\tname: string;\n}\n\nexport interface BitbucketWorkspaceDescriptor extends ResourceDescriptor {\n\tid: string;\n\tname: string;\n\tslug: string;\n}\n\nexport type BitbucketPullRequestState = 'OPEN' | 'DECLINED' | 'MERGED' | 'SUPERSEDED';\n\ninterface BitbucketLink {\n\thref: string;\n\tname?: string;\n}\n\n// Bitbucket's `account` schema: a person (`user`) or an app/bot (`app_user`, e.g. a review bot on a PR).\n// An `app_user` has no `links.html` and no `nickname`, and the schema requires none of the links.\ninterface BitbucketUser {\n\ttype: 'user' | 'app_user';\n\tuuid: string;\n\tdisplay_name: string;\n\taccount_id?: string;\n\tnickname?: string;\n\tlinks?: {\n\t\tself?: BitbucketLink;\n\t\tavatar?: BitbucketLink;\n\t\thtml?: BitbucketLink;\n\t};\n}\n\ninterface BitbucketWorkspace {\n\ttype: 'workspace';\n\tuuid: string;\n\tname: string;\n\tslug: string;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tavatar: BitbucketLink;\n\t};\n}\n\ninterface BitbucketProject {\n\ttype: 'project';\n\tkey: string;\n\tuuid: string;\n\tname: string;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tavatar: BitbucketLink;\n\t};\n}\n\ninterface BitbucketPullRequestParticipant {\n\ttype: 'participant';\n\tuser: BitbucketUser;\n\trole: 'PARTICIPANT' | 'REVIEWER';\n\tapproved: boolean;\n\tstate: null | 'approved' | 'changes_requested';\n\tparticipated_on: null | string;\n}\n\nexport interface BitbucketRepository {\n\ttype: 'repository';\n\tuuid: string;\n\tfull_name: string;\n\tname: string;\n\tslug: string;\n\tdescription?: string;\n\tis_private: boolean;\n\tparent: null | BitbucketRepository;\n\tscm: 'git';\n\towner: BitbucketUser;\n\tworkspace: BitbucketWorkspace;\n\tproject: BitbucketProject;\n\tcreated_on: string;\n\tupdated_on: string;\n\tsize: number;\n\tlanguage: string;\n\thas_issues: boolean;\n\thas_wiki: boolean;\n\tfork_policy: 'allow_forks' | 'no_public_forks' | 'no_forks';\n\twebsite: string;\n\tmainbranch?: BitbucketBranch;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tavatar: BitbucketLink;\n\t};\n}\n\ninterface BitbucketCommitAuthor {\n\ttype: 'author';\n\traw: string;\n\tuser: BitbucketUser;\n}\n\ntype BitbucketMergeStrategy =\n\t| 'merge_commit'\n\t| 'squash'\n\t| 'fast_forward'\n\t| 'squash_fast_forward'\n\t| 'rebase_fast_forward'\n\t| 'rebase_merge';\n\ninterface BitbucketBranch {\n\tname: string;\n\tmerge_strategies?: BitbucketMergeStrategy[];\n\tdefault_merge_strategy?: BitbucketMergeStrategy;\n}\n\n// It parses a raw author sitring like \"Sergei Shmakov GK <sergei.shmakov@gitkraken.com>\" to name and email\nconst parseRawBitbucketAuthorRegex = /^(.*) <(.*)>$/;\nexport function parseRawBitbucketAuthor(raw: string): { name: string; email: string } {\n\tconst match = raw.match(parseRawBitbucketAuthorRegex);\n\tif (match) {\n\t\treturn { name: match[1], email: match[2] };\n\t}\n\treturn { name: raw, email: '' };\n}\n\nexport interface BitbucketCommit extends BitbucketBriefCommit {\n\tauthor: BitbucketCommitAuthor;\n\tdate: string;\n\tlinks: {\n\t\tapprove: BitbucketLink;\n\t\tcomments: BitbucketLink;\n\t\tdiff: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tself: BitbucketLink;\n\t\tstatuses: BitbucketLink;\n\t};\n\tmessage: string;\n\tparents: BitbucketBriefCommit[];\n\tparticipants: BitbucketPullRequestParticipant[];\n\trendered: {\n\t\tmessage: string;\n\t};\n\trepository: BitbucketRepository;\n\tsummary: {\n\t\ttype: 'rendered';\n\t\traw: string;\n\t\tmarkup: string;\n\t\thtml: string;\n\t};\n}\n\ninterface BitbucketBriefCommit {\n\ttype: 'commit';\n\thash: string;\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t};\n}\n\nexport type BitbucketIssueState =\n\t| 'submitted'\n\t| 'new'\n\t| 'open'\n\t| 'resolved'\n\t| 'on hold'\n\t| 'invalid'\n\t| 'duplicate'\n\t| 'wontfix'\n\t| 'closed';\n\nexport interface BitbucketPullRequest {\n\ttype: 'pullrequest';\n\tid: number;\n\ttitle: string;\n\tdescription: string;\n\tstate: BitbucketPullRequestState;\n\tdraft?: boolean;\n\tmerge_commit: null | BitbucketBriefCommit;\n\tcomment_count: number;\n\ttask_count: number;\n\tclose_source_branch: boolean;\n\tclosed_by: BitbucketUser | null;\n\tauthor: BitbucketUser;\n\treason: string;\n\tcreated_on: string;\n\tupdated_on: string;\n\tdestination: {\n\t\tbranch: BitbucketBranch;\n\t\tcommit: BitbucketBriefCommit;\n\t\trepository: BitbucketRepository;\n\t};\n\tsource: {\n\t\tbranch: BitbucketBranch;\n\t\tcommit: BitbucketBriefCommit;\n\t\trepository: BitbucketRepository;\n\t};\n\tsummary: {\n\t\ttype: 'rendered';\n\t\traw: string;\n\t\tmarkup: string;\n\t\thtml: string;\n\t};\n\treviewers?: BitbucketUser[];\n\tparticipants?: BitbucketPullRequestParticipant[];\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tcommits: BitbucketLink;\n\t\tapprove: BitbucketLink;\n\t\t'request-changes': BitbucketLink;\n\t\tdiff: BitbucketLink;\n\t\tdiffstat: BitbucketLink;\n\t\tcomments: BitbucketLink;\n\t\tactivity: BitbucketLink;\n\t\tmerge: BitbucketLink;\n\t\tdecline: BitbucketLink;\n\t\tstatuses: BitbucketLink;\n\t};\n}\n\nexport interface BitbucketIssue {\n\ttype: string;\n\tid: number;\n\ttitle: string;\n\treporter: BitbucketUser;\n\tassignee?: BitbucketUser;\n\tstate: BitbucketIssueState;\n\tcreated_on: string;\n\tupdated_on: string;\n\trepository: BitbucketRepository;\n\tvotes?: number;\n\tcontent: {\n\t\traw: string;\n\t\tmarkup: string;\n\t\thtml: string;\n\t};\n\tlinks: {\n\t\tself: BitbucketLink;\n\t\thtml: BitbucketLink;\n\t\tcomments: BitbucketLink;\n\t\tattachments: BitbucketLink;\n\t\twatch: BitbucketLink;\n\t\tvote: BitbucketLink;\n\t};\n}\n\nexport function bitbucketPullRequestStateToState(state: BitbucketPullRequestState): IssueOrPullRequestState {\n\tswitch (state) {\n\t\tcase 'DECLINED':\n\t\tcase 'SUPERSEDED':\n\t\t\treturn 'closed';\n\t\tcase 'MERGED':\n\t\t\treturn 'merged';\n\t\tcase 'OPEN':\n\t\tdefault:\n\t\t\treturn 'opened';\n\t}\n}\n\nexport function bitbucketIssueStateToState(state: BitbucketIssueState): IssueOrPullRequestState {\n\tswitch (state) {\n\t\tcase 'resolved':\n\t\tcase 'invalid':\n\t\tcase 'duplicate':\n\t\tcase 'wontfix':\n\t\tcase 'closed':\n\t\t\treturn 'closed';\n\t\tcase 'submitted':\n\t\tcase 'new':\n\t\tcase 'open':\n\t\tcase 'on hold':\n\t\tdefault:\n\t\t\treturn 'opened';\n\t}\n}\n\nexport function isClosedBitbucketPullRequestState(state: BitbucketPullRequestState): boolean {\n\treturn bitbucketPullRequestStateToState(state) !== 'opened';\n}\n\nexport function isClosedBitbucketIssueState(state: BitbucketIssueState): boolean {\n\treturn bitbucketIssueStateToState(state) !== 'opened';\n}\n\nexport function fromBitbucketUser(user: BitbucketUser): PullRequestMember {\n\treturn {\n\t\tavatarUrl: user.links?.avatar?.href,\n\t\tname: user.display_name,\n\t\tusername: user.nickname,\n\t\turl: user.links?.html?.href,\n\t\tid: user.uuid,\n\t};\n}\n\nexport function fromBitbucketParticipantToReviewer(\n\tprt: BitbucketPullRequestParticipant,\n\tclosedBy: BitbucketUser | null,\n\tprState: BitbucketPullRequestState,\n): PullRequestReviewer {\n\treturn {\n\t\treviewer: fromBitbucketUser(prt.user),\n\t\tstate: prt.approved\n\t\t\t? PullRequestReviewState.Approved\n\t\t\t: prt.state === 'changes_requested'\n\t\t\t\t? PullRequestReviewState.ChangesRequested\n\t\t\t\t: prt.participated_on != null\n\t\t\t\t\t? PullRequestReviewState.Commented\n\t\t\t\t\t: prt.user.uuid === closedBy?.uuid && prState === 'DECLINED'\n\t\t\t\t\t\t? PullRequestReviewState.Dismissed\n\t\t\t\t\t\t: PullRequestReviewState.ReviewRequested,\n\t};\n}\n\n/**\n * The review decision a Bitbucket Cloud row carries, derived from its participants and reviewers. Reads only the\n * participants' `participated_on`, `approved` and `state` and whether there are reviewers, which is what the cheap etag\n * read selects for it.\n */\nexport function getBitbucketReviewDecision(pr: {\n\tparticipants?: readonly Pick<BitbucketPullRequestParticipant, 'approved' | 'state' | 'participated_on'>[];\n\treviewers?: readonly unknown[];\n}): PullRequestReviewDecision | undefined {\n\tif (!pr.participants?.length && pr.reviewers?.length) {\n\t\treturn PullRequestReviewDecision.ReviewRequired;\n\t}\n\tif (!pr.participants) {\n\t\treturn undefined;\n\t}\n\n\tlet hasReviews = false;\n\tlet hasChangeRequests = false;\n\tlet hasApprovals = false;\n\tfor (const prt of pr.participants) {\n\t\tif (prt.participated_on != null) {\n\t\t\thasReviews = true;\n\t\t}\n\t\tif (prt.approved) {\n\t\t\thasApprovals = true;\n\t\t}\n\t\tif (prt.state === 'changes_requested') {\n\t\t\thasChangeRequests = true;\n\t\t}\n\t}\n\tif (hasChangeRequests) return PullRequestReviewDecision.ChangesRequested;\n\tif (hasApprovals) return PullRequestReviewDecision.Approved;\n\tif (hasReviews) return undefined; // not approved, not rejected, but reviewed\n\treturn PullRequestReviewDecision.ReviewRequired; // nobody has reviewed yet.\n}\n\nfunction fromBitbucketRepository(repo: BitbucketRepository): IssueRepository {\n\treturn {\n\t\towner: repo.full_name.split('/')[0],\n\t\trepo: repo.name,\n\t\tid: repo.uuid,\n\t};\n}\n\nexport function fromBitbucketIssue(issue: BitbucketIssue, provider: Provider, projection?: IssueProjection): Issue {\n\tconst result = new Issue(\n\t\tprovider,\n\t\tissue.id.toString(),\n\t\tissue.id.toString(),\n\t\tissue.title,\n\t\tissue.links.html.href,\n\t\tnew Date(issue.created_on),\n\t\tnew Date(issue.updated_on),\n\t\tisClosedBitbucketIssueState(issue.state),\n\t\tbitbucketIssueStateToState(issue.state),\n\t\tfromBitbucketUser(issue.reporter),\n\t\tissue.assignee ? [fromBitbucketUser(issue.assignee)] : [],\n\t\tfromBitbucketRepository(issue.repository),\n\t\tundefined, // closedDate\n\t\tundefined, // labels\n\t\tundefined, // commentsCount\n\t\tissue.votes, // thumbsUpCount\n\t\tissue.content.html, // body\n\t\t!issue.repository?.project\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tid: issue.repository.project.uuid,\n\t\t\t\t\tname: issue.repository.project.name,\n\t\t\t\t\tresourceId: issue.repository.project.uuid,\n\t\t\t\t\tresourceName: issue.repository.project.name,\n\t\t\t\t},\n\t\tundefined, // number\n\t\tundefined, // issueType\n\t\tundefined, // providerState\n\t\tundefined, // bodyFormat\n\t\tundefined, // iterations\n\t\tprojection,\n\t);\n\treturn copyReadProvenance(result, issue);\n}\n\nexport function fromBitbucketPullRequest(\n\tpr: BitbucketPullRequest,\n\tprovider: Provider,\n\toptions?: { currentAccount?: { id: string; username?: string }; projection?: PullRequestProjection },\n): PullRequest {\n\tconst author = fromBitbucketUser(pr.author);\n\tconst result = new PullRequest(\n\t\tprovider,\n\t\tauthor,\n\t\tpr.id.toString(),\n\t\tpr.id.toString(),\n\t\tpr.title,\n\t\tpr.links.html.href,\n\t\tfromBitbucketRepository(pr.destination.repository),\n\t\tbitbucketPullRequestStateToState(pr.state),\n\t\tnew Date(pr.created_on),\n\t\tnew Date(pr.updated_on),\n\t\tpr.closed_by ? new Date(pr.updated_on) : undefined,\n\t\tpr.state === 'MERGED' ? new Date(pr.updated_on) : undefined,\n\t\tundefined, // mergeableState: not read\n\t\tundefined, // viewerCanUpdate\n\t\t{\n\t\t\tbase: {\n\t\t\t\tbranch: pr.destination.branch.name,\n\t\t\t\tsha: pr.destination.commit.hash,\n\t\t\t\trepo: pr.destination.repository.name,\n\t\t\t\towner: pr.destination.repository.full_name.split('/')[0],\n\t\t\t\texists: true,\n\t\t\t\turl: pr.destination.repository.links.html.href,\n\t\t\t},\n\t\t\thead: {\n\t\t\t\tbranch: pr.source.branch.name,\n\t\t\t\tsha: pr.source.commit.hash,\n\t\t\t\trepo: pr.source.repository.name,\n\t\t\t\towner: pr.source.repository.full_name.split('/')[0],\n\t\t\t\texists: true,\n\t\t\t\turl: pr.source.repository.links.html.href,\n\t\t\t},\n\t\t\tisCrossRepository: pr.source.repository.uuid !== pr.destination.repository.uuid,\n\t\t},\n\t\tpr.draft,\n\t\tundefined, // additions\n\t\tundefined, // deletions\n\t\tundefined, // commentsCount\n\t\tundefined, // thumbsCount\n\t\tgetBitbucketReviewDecision(pr),\n\t\tpr.participants // reviewRequests:PullRequestReviewer[]\n\t\t\t?.filter(prt => prt.role === 'REVIEWER')\n\t\t\t.map(prt => fromBitbucketParticipantToReviewer(prt, pr.closed_by, pr.state))\n\t\t\t.filter(rv => rv.state === PullRequestReviewState.ReviewRequested),\n\t\tpr.participants // latestReviews:PullRequestReviewer[]\n\t\t\t?.filter(prt => prt.participated_on != null)\n\t\t\t.map(prt => fromBitbucketParticipantToReviewer(prt, pr.closed_by, pr.state)),\n\t\tundefined, // assignees:PullRequestMember[] -- it looks like there is no such thing as assignees on Bitbucket\n\t\tundefined, // PullRequestStatusCheckRollupState\n\t\tundefined, // IssueProject\n\t\tundefined, // version\n\t\tundefined, // commitCount\n\t\tundefined, // stack\n\t\tundefined, // filesChanged\n\t\tpr.description ?? undefined,\n\t\tpr.id,\n\t\toptions?.currentAccount != null ? author.id === options.currentAccount.id : undefined,\n\t\toptions?.projection,\n\t\toptions?.currentAccount,\n\t);\n\treturn copyReadProvenance(result, pr);\n}\n\n/** The most pull request ids one etag read asks for: Bitbucket Cloud's largest page of pull requests. */\nexport const bitbucketEtagFieldsMaxIds = 50;\n\n/**\n * A pull request as the cheap etag read selects it (`BitbucketApi.getPullRequestsEtagFields`): only the fields\n * {@link fromBitbucketPullRequest} maps into a full row's etag inputs. `participants` and `reviewers` are selected\n * only for the `reviewDecision` include.\n */\nexport interface BitbucketPullRequestEtagNode {\n\tid: number;\n\tstate: BitbucketPullRequestState;\n\tupdated_on: string;\n\tdraft?: boolean;\n\tsource: { commit: { hash: string } };\n\tparticipants?: Pick<BitbucketPullRequestParticipant, 'approved' | 'state' | 'participated_on'>[];\n\treviewers?: unknown[];\n}\n\n/**\n * A cheap etag read's pull request in the vocabulary {@link fromBitbucketPullRequest}'s row ends in, so both reads\n * compute the same etag. That row reads neither a mergeability nor a check rollup, so neither does this.\n */\nexport function toBitbucketPullRequestEtagFields(\n\tnode: BitbucketPullRequestEtagNode,\n\tetagIncludes: readonly PullRequestEtagInclude[],\n): PullRequestEtagFields {\n\tconst fields: PullRequestEtagFields = {\n\t\tstate: bitbucketPullRequestStateToState(node.state),\n\t\tisDraft: node.draft,\n\t\tupdatedDate: new Date(node.updated_on),\n\t\theadSha: node.source.commit.hash,\n\t};\n\n\tif (etagIncludes.includes('reviewDecision')) {\n\t\t// The full read always has both lists, and the decision tells a missing list from an empty one, so a row\n\t\t// without them can't be compared: it rejects, and the full read answers instead.\n\t\tif (node.participants == null || node.reviewers == null) {\n\t\t\tthrow new Error(`Bitbucket returned pull request ${node.id} without its participants or reviewers`);\n\t\t}\n\n\t\tfields.reviewDecision = getBitbucketReviewDecision(node);\n\t}\n\n\treturn fields;\n}\n"],"mappings":";;;;AA8HA,MAAM,+BAA+B;AACrC,SAAgB,wBAAwB,KAA8C;CACrF,MAAM,QAAQ,IAAI,MAAM,4BAA4B;CACpD,IAAI,OACH,OAAO;EAAE,MAAM,MAAM;EAAI,OAAO,MAAM;CAAG;CAE1C,OAAO;EAAE,MAAM;EAAK,OAAO;CAAG;AAC/B;AA4HA,SAAgB,iCAAiC,OAA2D;CAC3G,QAAQ,OAAR;EACC,KAAK;EACL,KAAK,cACJ,OAAO;EACR,KAAK,UACJ,OAAO;EAER,SACC,OAAO;CACT;AACD;AAEA,SAAgB,2BAA2B,OAAqD;CAC/F,QAAQ,OAAR;EACC,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,UACJ,OAAO;EAKR,SACC,OAAO;CACT;AACD;AAEA,SAAgB,kCAAkC,OAA2C;CAC5F,OAAO,iCAAiC,KAAK,MAAM;AACpD;AAEA,SAAgB,4BAA4B,OAAqC;CAChF,OAAO,2BAA2B,KAAK,MAAM;AAC9C;AAEA,SAAgB,kBAAkB,MAAwC;CACzE,OAAO;EACN,WAAW,KAAK,OAAO,QAAQ;EAC/B,MAAM,KAAK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AAK;EACtC;EACA,mBAAmB,GAAG,OAAO,WAAW,SAAS,GAAG,YAAY,WAAW;CAC5E,GACA,GAAG,OACH,KAAA,GACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,2BAA2B,EAAE,GAC7B,GAAG,cACA,QAAO,QAAO,IAAI,SAAS,UAAU,CAAC,CACvC,KAAI,QAAO,mCAAmC,KAAK,GAAG,WAAW,GAAG,KAAK,CAAC,CAAC,CAC3E,QAAO,OAAM,GAAG,UAAA,kBAAgD,GAClE,GAAG,cACA,QAAO,QAAO,IAAI,mBAAmB,IAAI,CAAC,CAC3C,KAAI,QAAO,mCAAmC,KAAK,GAAG,WAAW,GAAG,KAAK,CAAC,GAC5E,KAAA,GACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,GAAG,eAAe,KAAA,GAClB,GAAG,IACH,SAAS,kBAAkB,OAAO,OAAO,OAAO,QAAQ,eAAe,KAAK,KAAA,GAC5E,SAAS,YACT,SAAS,cACV;CACA,OAAO,mBAAmB,QAAQ,EAAE;AACrC;;AAGA,MAAa,4BAA4B;;;;;AAqBzC,SAAgB,iCACf,MACA,cACwB;CACxB,MAAM,SAAgC;EACrC,OAAO,iCAAiC,KAAK,KAAK;EAClD,SAAS,KAAK;EACd,aAAa,IAAI,KAAK,KAAK,UAAU;EACrC,SAAS,KAAK,OAAO,OAAO;CAC7B;CAEA,IAAI,aAAa,SAAS,gBAAgB,GAAG;EAG5C,IAAI,KAAK,gBAAgB,QAAQ,KAAK,aAAa,MAClD,MAAM,IAAI,MAAM,mCAAmC,KAAK,GAAG,uCAAuC;EAGnG,OAAO,iBAAiB,2BAA2B,IAAI;CACxD;CAEA,OAAO;AACR"}
|
|
@@ -9,17 +9,18 @@ import { RepositoryMetadata } from "../../../git/models/repositoryMetadata.js";
|
|
|
9
9
|
import { PullRequestUrlIdentity } from "../../../git/utils/pullRequest.utils.js";
|
|
10
10
|
import { AuthenticationSessionLike, ProviderAuthenticationSession } from "../authentication/models.js";
|
|
11
11
|
import { GitSelfManagedHostIntegrationId } from "../constants.js";
|
|
12
|
+
import { IntegrationAuthenticationProviderDescriptor } from "../authentication/integrationAuthenticationProvider.js";
|
|
12
13
|
import { ProviderOrganization } from "../results.js";
|
|
14
|
+
import { SearchMyPullRequestsOptions, SearchPullRequestsOptions } from "../models/publicIntegration.js";
|
|
15
|
+
import { IntegrationServiceContext } from "../context.js";
|
|
13
16
|
import { ProviderPullRequestCount, ProviderPullRequestSearchPage } from "../models/pullRequestReads.js";
|
|
14
|
-
import { ProviderHierarchyResult, ProviderPullRequest, ProviderRepoInput, ProviderRepository } from "./models.js";
|
|
15
17
|
import { ProvidersApi } from "./providersApi.js";
|
|
16
|
-
import { GitHostIntegration, SearchMyPullRequestsOptions, SearchPullRequestsOptions } from "../models/gitHostIntegration.js";
|
|
17
18
|
import "../models/integration.js";
|
|
19
|
+
import { ProviderHierarchyResult, ProviderPullRequest, ProviderRepoInput, ProviderRepository } from "./models.js";
|
|
20
|
+
import { GitHostIntegration } from "../models/gitHostIntegration.js";
|
|
18
21
|
import { BitbucketRepositoryDescriptor } from "./bitbucket/models.js";
|
|
19
22
|
import { IntegrationConnectionChangeEvent } from "../integrationService.js";
|
|
20
23
|
import { IntegrationAuthenticationService } from "../authentication/integrationAuthenticationService.js";
|
|
21
|
-
import { IntegrationAuthenticationProviderDescriptor } from "../authentication/integrationAuthenticationProvider.js";
|
|
22
|
-
import { IntegrationServiceContext } from "../context.js";
|
|
23
24
|
//#region ../plus/integrations/src/providers/bitbucket-server.d.ts
|
|
24
25
|
export declare class BitbucketServerIntegration extends GitHostIntegration<GitSelfManagedHostIntegrationId.BitbucketServer, BitbucketRepositoryDescriptor> {
|
|
25
26
|
private readonly _domain;
|
|
@@ -6,8 +6,9 @@ import "../../../git/models/pullRequest.js";
|
|
|
6
6
|
import { IntegrationReadUnavailableError, getAuthenticatedUser } from "../errors.js";
|
|
7
7
|
import "../constants.js";
|
|
8
8
|
import { collectProviderPagedResult, flatSettledOrThrow, parsePageCursor, toPageCursor } from "./utils/providerPaging.js";
|
|
9
|
-
import {
|
|
9
|
+
import { providersMetadata } from "./metadata.js";
|
|
10
10
|
import { toTokenWithInfo } from "../authentication/models.js";
|
|
11
|
+
import { ProviderPullRequestReviewState, fromProviderPullRequest, providerPullRequestMatchesSearch, toProviderPullRequestStates } from "./models.js";
|
|
11
12
|
import { GitHostIntegration } from "../models/gitHostIntegration.js";
|
|
12
13
|
import { getBitbucketServerPullRequestIdentityFromMaybeUrl } from "./bitbucket/bitbucket.utils.js";
|
|
13
14
|
//#region ../plus/integrations/src/providers/bitbucket-server.ts
|