@gitkraken/core-gitlens 0.54.0 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/dist/git/cache.js +3 -0
  3. package/dist/git/cache.js.map +1 -1
  4. package/dist/git/models/pullRequest.d.ts +14 -0
  5. package/dist/git/models/pullRequest.js.map +1 -1
  6. package/dist/git/utils/pullRequest.utils.d.ts +3 -1
  7. package/dist/git/utils/pullRequest.utils.js +9 -1
  8. package/dist/git/utils/pullRequest.utils.js.map +1 -1
  9. package/dist/git-cli/providers/pausedOperations.d.ts +2 -0
  10. package/dist/git-cli/providers/pausedOperations.js +104 -40
  11. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  12. package/dist/plus/git-github/api/github.d.ts +2 -0
  13. package/dist/plus/git-github/api/github.js +16 -6
  14. package/dist/plus/git-github/api/github.js.map +1 -1
  15. package/dist/plus/git-github/api/pullRequestSearchQuery.d.ts +1 -0
  16. package/dist/plus/git-github/api/pullRequestSearchQuery.js +29 -5
  17. package/dist/plus/git-github/api/pullRequestSearchQuery.js.map +1 -1
  18. package/dist/plus/integrations/fieldPresence.d.ts +3 -0
  19. package/dist/plus/integrations/fieldPresence.js +7 -1
  20. package/dist/plus/integrations/fieldPresence.js.map +1 -1
  21. package/dist/plus/integrations/index.d.ts +3 -2
  22. package/dist/plus/integrations/index.js.map +1 -1
  23. package/dist/plus/integrations/integrationService.d.ts +11 -2
  24. package/dist/plus/integrations/integrationService.js +75 -3
  25. package/dist/plus/integrations/integrationService.js.map +1 -1
  26. package/dist/plus/integrations/manager.d.ts +17 -2
  27. package/dist/plus/integrations/models/bitbucketPullRequestWrites.d.ts +217 -0
  28. package/dist/plus/integrations/models/bitbucketPullRequestWrites.js +0 -0
  29. package/dist/plus/integrations/models/integration.d.ts +2 -1
  30. package/dist/plus/integrations/models/integration.js +6 -0
  31. package/dist/plus/integrations/models/integration.js.map +1 -1
  32. package/dist/plus/integrations/models/publicIntegration.d.ts +1 -0
  33. package/dist/plus/integrations/models/pullRequestReads.d.ts +2 -0
  34. package/dist/plus/integrations/providers/azure/writeIdentity.d.ts +0 -3
  35. package/dist/plus/integrations/providers/azure/writeIdentity.js +4 -12
  36. package/dist/plus/integrations/providers/azure/writeIdentity.js.map +1 -1
  37. package/dist/plus/integrations/providers/azureDevOps.d.ts +0 -2
  38. package/dist/plus/integrations/providers/azureDevOps.js +1 -7
  39. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  40. package/dist/plus/integrations/providers/azurePullRequestWrites.js +24 -26
  41. package/dist/plus/integrations/providers/azurePullRequestWrites.js.map +1 -1
  42. package/dist/plus/integrations/providers/azureWorkItemWriteErrors.js +4 -3
  43. package/dist/plus/integrations/providers/azureWorkItemWriteErrors.js.map +1 -1
  44. package/dist/plus/integrations/providers/azureWorkItemWrites.js +22 -21
  45. package/dist/plus/integrations/providers/azureWorkItemWrites.js.map +1 -1
  46. package/dist/plus/integrations/providers/bitbucket.d.ts +4 -0
  47. package/dist/plus/integrations/providers/bitbucket.js +8 -0
  48. package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
  49. package/dist/plus/integrations/providers/bitbucketPullRequestWriteErrors.d.ts +13 -0
  50. package/dist/plus/integrations/providers/bitbucketPullRequestWriteErrors.js +88 -0
  51. package/dist/plus/integrations/providers/bitbucketPullRequestWriteErrors.js.map +1 -0
  52. package/dist/plus/integrations/providers/bitbucketPullRequestWriteLedger.d.ts +14 -0
  53. package/dist/plus/integrations/providers/bitbucketPullRequestWriteLedger.js +36 -0
  54. package/dist/plus/integrations/providers/bitbucketPullRequestWriteLedger.js.map +1 -0
  55. package/dist/plus/integrations/providers/bitbucketPullRequestWrites.d.ts +47 -0
  56. package/dist/plus/integrations/providers/bitbucketPullRequestWrites.js +795 -0
  57. package/dist/plus/integrations/providers/bitbucketPullRequestWrites.js.map +1 -0
  58. package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
  59. package/dist/plus/integrations/providers/metadata.js +6 -3
  60. package/dist/plus/integrations/providers/metadata.js.map +1 -1
  61. package/dist/plus/integrations/providers/providersApi.d.ts +4 -0
  62. package/dist/plus/integrations/providers/providersApi.js +5 -0
  63. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  64. package/dist/plus/integrations/providers/utils/writeInputs.d.ts +7 -0
  65. package/dist/plus/integrations/providers/utils/writeInputs.js +17 -0
  66. package/dist/plus/integrations/providers/utils/writeInputs.js.map +1 -0
  67. package/dist/plus/integrations/reads/drains.d.ts +1 -0
  68. package/dist/plus/integrations/reads/filters.js +13 -1
  69. package/dist/plus/integrations/reads/filters.js.map +1 -1
  70. package/dist/plus/integrations/reads/pullRequestBatch.js +3 -3
  71. package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
  72. package/dist/plus/integrations/reads/searchPullRequests.d.ts +3 -3
  73. package/dist/plus/integrations/reads/searchPullRequests.js +4 -3
  74. package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
  75. package/dist/plus/integrations/reads/sweeps.js +20 -6
  76. package/dist/plus/integrations/reads/sweeps.js.map +1 -1
  77. package/dist/plus/integrations/reads/warnings.d.ts +1 -0
  78. package/dist/plus/integrations/reads/warnings.js +7 -2
  79. package/dist/plus/integrations/reads/warnings.js.map +1 -1
  80. package/dist/plus/integrations/results.d.ts +7 -0
  81. package/dist/plus/integrations/results.js.map +1 -1
  82. package/docs/integrations.md +188 -1
  83. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bitbucketPullRequestWrites.js","names":[],"sources":["../../../../../plus/integrations/src/providers/bitbucketPullRequestWrites.ts"],"sourcesContent":["import { uuid } from '@gitlens/utils/crypto.js';\nimport { getResponseHeader } from '../errors.js';\nimport type {\n\tBitbucketPullRequestCreateCapabilityOptions,\n\tBitbucketPullRequestCreateCapabilityResult,\n\tBitbucketPullRequestMergeCapability,\n\tBitbucketPullRequestMergeStatusOptions,\n\tBitbucketPullRequestMergeStatusResult,\n\tBitbucketPullRequestMergeStrategy,\n\tBitbucketPullRequestRepository,\n\tBitbucketPullRequestWriteFailure,\n\tBitbucketPullRequestWriteOptions,\n\tBitbucketPullRequestWriteReleaseOptions,\n\tBitbucketPullRequestWriteReleaseResult,\n\tBitbucketPullRequestWriteResult,\n\tBitbucketPullRequestWriteTargetResult,\n\tBitbucketUnsettledPullRequestWrite,\n\tBitbucketWrittenPullRequest,\n} from '../models/bitbucketPullRequestWrites.js';\nimport {\n\tBitbucketPullRequestWriteError,\n\tgetBitbucketMergeRefusal,\n\ttoBitbucketPullRequestWriteFailure,\n} from './bitbucketPullRequestWriteErrors.js';\nimport type { BitbucketPullRequestWriteLedger } from './bitbucketPullRequestWriteLedger.js';\nimport type { ProviderRequestFunction } from './models.js';\nimport { isCommitSha, isPositiveInt32, isWriteIdentifier, sameIdentifier } from './utils/writeInputs.js';\n\nconst apiUrl = 'https://api.bitbucket.org/2.0';\nconst webUrl = 'https://bitbucket.org';\nconst mergeStrategies: BitbucketPullRequestMergeStrategy[] = [\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];\n// SEE: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/#api-repositories-workspace-repo-slug-pullrequests-pull-request-id-merge-post\nconst queueStrategies: BitbucketPullRequestMergeStrategy[] = ['merge_commit', 'squash', 'rebase_merge'];\nconst uuidPattern = /^\\{[\\da-f]{8}-(?:[\\da-f]{4}-){3}[\\da-f]{12}\\}$/i;\nconst slugPattern = /^[\\w.-]+$/;\nconst mergeTaskIdPattern = /^(?!\\.{1,2}$)[\\w.:-]{1,256}$/;\n\ntype FailureReason = BitbucketPullRequestWriteFailure['reason'];\ntype MergeOptions = Extract<BitbucketPullRequestWriteOptions, { action: 'merge' }>;\ntype CreateOptions = Extract<BitbucketPullRequestWriteOptions, { action: 'create' }>;\ntype SendContext = {\n\tcreatedNotBefore?: number;\n\tonReceipt?: (pullRequest: BitbucketWrittenPullRequest) => void;\n};\ntype WriteStatus = Extract<BitbucketPullRequestWriteResult, { ok: true }>['status'];\ntype PendingResult = Extract<BitbucketPullRequestWriteResult, { status: 'pending' }>;\ntype SettledResult = Exclude<BitbucketPullRequestWriteResult, PendingResult>;\ntype SentResult = SettledResult | Omit<PendingResult, 'unsettled'>;\n\ntype RawRepository = {\n\tuuid?: unknown;\n\tslug?: unknown;\n\tfull_name?: unknown;\n\tworkspace?: { uuid?: unknown; slug?: unknown };\n\tmainbranch?: { name?: unknown } | null;\n};\n\ntype RawEndpoint = {\n\tbranch?: { name?: unknown };\n\tcommit?: { hash?: unknown } | null;\n\trepository?: { uuid?: unknown } | null;\n};\n\ntype RawPullRequest = {\n\tid?: unknown;\n\ttitle?: unknown;\n\tdescription?: unknown;\n\tstate?: unknown;\n\tdraft?: unknown;\n\tqueued?: unknown;\n\tauthor?: { uuid?: unknown } | null;\n\tcreated_on?: unknown;\n\tupdated_on?: unknown;\n\tsource?: RawEndpoint;\n\tdestination?: RawEndpoint;\n};\n\ntype RawBranch = {\n\tname?: unknown;\n\ttarget?: { hash?: unknown };\n\tmerge_strategies?: unknown;\n\tdefault_merge_strategy?: unknown;\n};\n\ntype RawMergeTask = {\n\ttask_status?: unknown;\n\tmerge_result?: RawPullRequest;\n\tqueued_pullrequest?: { type?: unknown; pullrequest?: RawPullRequest | null } | null;\n};\n\ntype RawMergeabilityCheck = { type?: unknown; blocking?: unknown; required?: unknown };\n\ntype PullRequestRead = { pullRequest: BitbucketWrittenPullRequest; sourceHash: string | undefined };\n\ntype TargetBranch = { sha: string; strategies: BitbucketPullRequestMergeStrategy[]; defaultStrategy?: string };\n\nfunction isBitbucketUuid(value: unknown): value is string {\n\treturn typeof value === 'string' && uuidPattern.test(value);\n}\n\nfunction isSlugOrUuid(value: unknown): value is string {\n\treturn isBitbucketUuid(value) || (typeof value === 'string' && slugPattern.test(value) && !/^\\.\\.?$/.test(value));\n}\n\nfunction isBranchName(name: unknown): name is string {\n\treturn (\n\t\ttypeof name === 'string' &&\n\t\tname.length > 0 &&\n\t\t!name.startsWith('refs/') &&\n\t\t!name.startsWith('-') &&\n\t\t![...name].some(character => character <= ' ' || '~^:?*[\\\\\"\\x7f'.includes(character)) &&\n\t\t!name.includes('..') &&\n\t\t!name.includes('@{') &&\n\t\tname !== '@' &&\n\t\t!name.endsWith('.') &&\n\t\tname.split('/').every(part => part.length > 0 && !part.startsWith('.') && !part.endsWith('.lock'))\n\t);\n}\n\nfunction isTitle(title: unknown): title is string {\n\treturn typeof title === 'string' && title.trim().length > 0;\n}\n\nfunction seg(value: string): string {\n\treturn encodeURIComponent(value);\n}\n\nfunction isAttemptPullRequest(\n\tpullRequest: BitbucketWrittenPullRequest,\n\tsourceBranch: string,\n\ttargetBranch: string | undefined,\n): boolean {\n\treturn (\n\t\t!pullRequest.isCrossRepository &&\n\t\tpullRequest.sourceBranch === sourceBranch &&\n\t\t(targetBranch === undefined || pullRequest.targetBranch === targetBranch)\n\t);\n}\n\nfunction getCreateKey(repositoryId: string, sourceBranch: string): string {\n\treturn `create\\n${repositoryId.toLowerCase()}\\n${sourceBranch}`;\n}\n\nfunction getMergeKey(repositoryId: string, number: number): string {\n\treturn `merge\\n${repositoryId.toLowerCase()}\\n${number}`;\n}\n\nfunction isBitbucketMergeTaskId(value: unknown): value is string {\n\treturn typeof value === 'string' && mergeTaskIdPattern.test(value);\n}\n\nexport function isBitbucketPullRequestMergeStatusRead(options: BitbucketPullRequestMergeStatusOptions): boolean {\n\treturn (\n\t\t(options.providerId === undefined || options.providerId === 'bitbucket') &&\n\t\tisWriteIdentifier(options.connectionId) &&\n\t\tisBitbucketUuid(options.workspaceId) &&\n\t\tisBitbucketUuid(options.repositoryId) &&\n\t\tisBitbucketUuid(options.expectedAccountId) &&\n\t\tisPositiveInt32(options.number) &&\n\t\tisBitbucketMergeTaskId(options.mergeTaskId) &&\n\t\tisBranchName(options.expectedSourceBranch) &&\n\t\tisBranchName(options.expectedTargetBranch) &&\n\t\toptions.expectedSourceBranch !== options.expectedTargetBranch &&\n\t\tisCommitSha(options.expectedSourceSha)\n\t);\n}\n\nexport function isBitbucketPullRequestScope(options: BitbucketPullRequestCreateCapabilityOptions): boolean {\n\treturn (\n\t\t(options.providerId === undefined || options.providerId === 'bitbucket') &&\n\t\tisWriteIdentifier(options.connectionId) &&\n\t\tisSlugOrUuid(options.workspace) &&\n\t\tisSlugOrUuid(options.repository) &&\n\t\t(options.expectedAccountId === undefined || isBitbucketUuid(options.expectedAccountId))\n\t);\n}\n\nexport function isBitbucketPullRequestWrite(options: BitbucketPullRequestWriteOptions): boolean {\n\tif (\n\t\t(options.providerId !== undefined && options.providerId !== 'bitbucket') ||\n\t\t!isWriteIdentifier(options.connectionId) ||\n\t\t!isBitbucketUuid(options.workspaceId) ||\n\t\t!isBitbucketUuid(options.repositoryId) ||\n\t\t!isBitbucketUuid(options.expectedAccountId)\n\t) {\n\t\treturn false;\n\t}\n\n\tif (options.action === 'create') {\n\t\treturn (\n\t\t\tisBranchName(options.sourceBranch) &&\n\t\t\tisBranchName(options.targetBranch) &&\n\t\t\toptions.sourceBranch !== options.targetBranch &&\n\t\t\tisTitle(options.title) &&\n\t\t\t(options.description === undefined || typeof options.description === 'string')\n\t\t);\n\t}\n\n\tif (!isPositiveInt32(options.number)) return false;\n\n\tswitch (options.action) {\n\t\tcase 'edit':\n\t\t\treturn (\n\t\t\t\t(options.title !== undefined || options.description !== undefined) &&\n\t\t\t\t(options.title === undefined || isTitle(options.title)) &&\n\t\t\t\t(options.description === undefined || typeof options.description === 'string')\n\t\t\t);\n\t\tcase 'decline':\n\t\t\treturn true;\n\t\tcase 'merge':\n\t\t\treturn (\n\t\t\t\tmergeStrategies.includes(options.strategy) &&\n\t\t\t\tisBranchName(options.expectedSourceBranch) &&\n\t\t\t\tisBranchName(options.expectedTargetBranch) &&\n\t\t\t\toptions.expectedSourceBranch !== options.expectedTargetBranch &&\n\t\t\t\tisCommitSha(options.expectedSourceSha) &&\n\t\t\t\tisCommitSha(options.expectedTargetSha)\n\t\t\t);\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nexport function isBitbucketPullRequestWriteRelease(options: BitbucketPullRequestWriteReleaseOptions): boolean {\n\treturn (\n\t\t(options.providerId === undefined || options.providerId === 'bitbucket') &&\n\t\tisWriteIdentifier(options.connectionId) &&\n\t\tisBitbucketUuid(options.workspaceId) &&\n\t\tisBitbucketUuid(options.repositoryId) &&\n\t\tisBitbucketUuid(options.expectedAccountId) &&\n\t\tisWriteIdentifier(options.attemptId) &&\n\t\t(options.action === 'create'\n\t\t\t? isBranchName(options.sourceBranch)\n\t\t\t: options.action === 'merge' &&\n\t\t\t\tisPositiveInt32(options.number) &&\n\t\t\t\t(options.mergeTaskId === undefined || isBitbucketMergeTaskId(options.mergeTaskId)))\n\t);\n}\n\nfunction toStrategies(value: unknown): BitbucketPullRequestMergeStrategy[] {\n\treturn Array.isArray(value) ? mergeStrategies.filter(strategy => value.includes(strategy)) : [];\n}\n\nfunction getBlockingCheckFailure(checks: RawMergeabilityCheck[]): FailureReason | undefined {\n\tconst blocking = new Set(checks.filter(check => check.blocking === true).map(check => check.type));\n\tif (blocking.size === 0) return undefined;\n\tif (blocking.has('pullrequest_state_check')) return 'conflict';\n\tif (blocking.has('current_user_permission_check')) return 'forbidden';\n\tif (blocking.has('git_mergeability_check')) return 'conflict';\n\n\treturn 'policy-blocked';\n}\n\nfunction getMergeStateFailure(pullRequest: BitbucketWrittenPullRequest): FailureReason | undefined {\n\tif (pullRequest.state !== 'open' || pullRequest.queued) return 'conflict';\n\tif (pullRequest.isCrossRepository) return 'unsupported';\n\tif (pullRequest.draft) return 'policy-blocked';\n\n\treturn undefined;\n}\n\nfunction getMergeRefFailure(options: MergeOptions, read: PullRequestRead): FailureReason | undefined {\n\tconst { pullRequest, sourceHash } = read;\n\tif (pullRequest.sourceBranch !== options.expectedSourceBranch) return 'source-changed';\n\tif (pullRequest.targetBranch !== options.expectedTargetBranch) return 'target-changed';\n\tif (sourceHash == null || !options.expectedSourceSha.toLowerCase().startsWith(sourceHash)) return 'source-changed';\n\n\treturn undefined;\n}\n\nexport class BitbucketPullRequestWriter {\n\tstatic async connect(\n\t\trequest: ProviderRequestFunction,\n\t\taccessToken: string,\n\t\toptions: BitbucketPullRequestCreateCapabilityOptions,\n\t\tisSessionCurrent: () => Promise<boolean>,\n\t\tledger: BitbucketPullRequestWriteLedger,\n\t): Promise<BitbucketPullRequestWriter> {\n\t\tconst headers = { Authorization: `Bearer ${accessToken}` };\n\t\tconst { body: user } = await request<{ uuid?: unknown }>({\n\t\t\turl: `${apiUrl}/user`,\n\t\t\theaders: headers,\n\t\t\tredirect: 'error',\n\t\t});\n\t\tconst accountId = user?.uuid;\n\t\tif (\n\t\t\t!isBitbucketUuid(accountId) ||\n\t\t\t(options.expectedAccountId !== undefined && !sameIdentifier(accountId, options.expectedAccountId))\n\t\t) {\n\t\t\tthrow new BitbucketPullRequestWriteError('no-connection');\n\t\t}\n\n\t\tconst { body: repo } = await request<RawRepository>({\n\t\t\turl: `${apiUrl}/repositories/${seg(options.workspace)}/${seg(options.repository)}`,\n\t\t\theaders: headers,\n\t\t\tredirect: 'error',\n\t\t});\n\t\tconst workspace = repo?.workspace;\n\t\tif (\n\t\t\t!isBitbucketUuid(repo?.uuid) ||\n\t\t\t!isBitbucketUuid(workspace?.uuid) ||\n\t\t\t!isSlugOrUuid(repo.slug) ||\n\t\t\t!isSlugOrUuid(workspace.slug) ||\n\t\t\ttypeof repo.full_name !== 'string' ||\n\t\t\t!sameIdentifier(isBitbucketUuid(options.workspace) ? workspace.uuid : workspace.slug, options.workspace) ||\n\t\t\t!sameIdentifier(isBitbucketUuid(options.repository) ? repo.uuid : repo.slug, options.repository)\n\t\t) {\n\t\t\tthrow new BitbucketPullRequestWriteError('not-found');\n\t\t}\n\n\t\tconst mainBranch = repo.mainbranch?.name;\n\t\treturn new BitbucketPullRequestWriter(\n\t\t\trequest,\n\t\t\theaders,\n\t\t\taccountId,\n\t\t\t{\n\t\t\t\tworkspaceId: workspace.uuid,\n\t\t\t\tworkspaceSlug: workspace.slug,\n\t\t\t\trepositoryId: repo.uuid,\n\t\t\t\trepositorySlug: repo.slug,\n\t\t\t\tfullName: repo.full_name,\n\t\t\t},\n\t\t\tisBranchName(mainBranch) ? mainBranch : undefined,\n\t\t\tisSessionCurrent,\n\t\t\tledger,\n\t\t);\n\t}\n\n\tprivate readonly repoUrl: string;\n\n\tprivate constructor(\n\t\tprivate readonly request: ProviderRequestFunction,\n\t\tprivate readonly headers: { Authorization: string },\n\t\tprivate readonly accountId: string,\n\t\tprivate readonly repository: BitbucketPullRequestRepository,\n\t\tprivate readonly defaultBranch: string | undefined,\n\t\tprivate readonly isSessionCurrent: () => Promise<boolean>,\n\t\tprivate readonly ledger: BitbucketPullRequestWriteLedger,\n\t) {\n\t\tthis.repoUrl = `${apiUrl}/repositories/${seg(repository.workspaceId)}/${seg(repository.repositoryId)}`;\n\t}\n\n\tgetCreateCapability(): BitbucketPullRequestCreateCapabilityResult {\n\t\treturn {\n\t\t\tok: true,\n\t\t\taccountId: this.accountId,\n\t\t\trepository: this.repository,\n\t\t\t...(this.defaultBranch !== undefined && { defaultBranch: this.defaultBranch }),\n\t\t};\n\t}\n\n\tasync resolveTarget(number: number): Promise<BitbucketPullRequestWriteTargetResult> {\n\t\tif (!isPositiveInt32(number)) return { ok: false, reason: 'invalid-input' };\n\n\t\tconst read = await this.readPullRequest(number);\n\t\tconst open = read.pullRequest.state === 'open';\n\t\tconst key = getMergeKey(this.repository.repositoryId, number);\n\t\tif (!open) {\n\t\t\tthis.ledger.settle(key);\n\t\t}\n\n\t\tconst target = await this.getMergeTarget(read);\n\t\tconst { pullRequest } = target;\n\t\tconst unsettled = open ? this.ledger.get(key) : undefined;\n\t\tlet merge: BitbucketPullRequestMergeCapability = target.merge;\n\t\tif (unsettled != null) {\n\t\t\tmerge =\n\t\t\t\tmerge.kind === 'available'\n\t\t\t\t\t? { kind: 'unavailable', reason: 'outcome-unknown', unsettled: unsettled }\n\t\t\t\t\t: { ...merge, unsettled: unsettled };\n\t\t}\n\t\treturn {\n\t\t\tok: true,\n\t\t\taccountId: this.accountId,\n\t\t\tpullRequest: pullRequest,\n\t\t\tcapabilities: { edit: open, decline: open, reopen: false, merge: merge },\n\t\t};\n\t}\n\n\tasync write(options: BitbucketPullRequestWriteOptions): Promise<BitbucketPullRequestWriteResult> {\n\t\tif (options.action === 'create') {\n\t\t\tconst key = getCreateKey(this.repository.repositoryId, options.sourceBranch);\n\t\t\treturn this.ledger.run(key, () => this.create(options, key));\n\t\t}\n\t\tif (options.action === 'merge') {\n\t\t\tconst key = getMergeKey(this.repository.repositoryId, options.number);\n\t\t\treturn this.ledger.run(key, () => this.merge(options, key));\n\t\t}\n\n\t\tconst current = await this.readPullRequest(options.number);\n\t\tswitch (options.action) {\n\t\t\tcase 'edit':\n\t\t\t\tif (current.pullRequest.state !== 'open') return { ok: false, reason: 'conflict' };\n\n\t\t\t\treturn this.send(options, 'PUT', this.pullRequestUrl(options.number), {\n\t\t\t\t\ttitle: options.title,\n\t\t\t\t\tdescription: options.description,\n\t\t\t\t});\n\t\t\tcase 'decline':\n\t\t\t\tif (current.pullRequest.state !== 'open') return { ok: false, reason: 'conflict' };\n\n\t\t\t\treturn this.send(options, 'POST', `${this.pullRequestUrl(options.number)}/decline`);\n\t\t}\n\t}\n\n\tprivate async create(options: CreateOptions, key: string): Promise<BitbucketPullRequestWriteResult> {\n\t\tconst [source, target] = await Promise.all([\n\t\t\tthis.readBranch(options.sourceBranch),\n\t\t\tthis.readBranch(options.targetBranch),\n\t\t]);\n\t\tif (source == null || target == null) return { ok: false, reason: 'not-found' };\n\n\t\tconst preflight = await this.readCreateEvidence(key, options.sourceBranch);\n\t\tif (preflight.open.length) return { ok: false, reason: 'conflict' };\n\t\tif (preflight.unsettled != null) {\n\t\t\treturn { ok: false, reason: 'outcome-unknown', unsettled: preflight.unsettled };\n\t\t}\n\n\t\tconst { serverTime } = preflight;\n\t\tconst dispatchedAt = Date.now();\n\t\tlet pullRequestNumber: number | undefined;\n\t\tconst result = await this.send(\n\t\t\toptions,\n\t\t\t'POST',\n\t\t\t`${this.repoUrl}/pullrequests`,\n\t\t\t{\n\t\t\t\ttitle: options.title,\n\t\t\t\tdescription: options.description,\n\t\t\t\tsource: { branch: { name: options.sourceBranch } },\n\t\t\t\tdestination: { branch: { name: options.targetBranch } },\n\t\t\t},\n\t\t\t{\n\t\t\t\tcreatedNotBefore: serverTime,\n\t\t\t\tonReceipt: pullRequest => {\n\t\t\t\t\tif (!pullRequest.isCrossRepository && pullRequest.sourceBranch === options.sourceBranch) {\n\t\t\t\t\t\tpullRequestNumber = pullRequest.number;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t\treturn this.recordUnsettled(key, result, {\n\t\t\tattemptId: uuid(),\n\t\t\taccountId: this.accountId,\n\t\t\tdispatchedAt: dispatchedAt,\n\t\t\taction: 'create',\n\t\t\tsourceBranch: options.sourceBranch,\n\t\t\ttargetBranch: options.targetBranch,\n\t\t\t...(pullRequestNumber !== undefined && { pullRequestNumber: pullRequestNumber }),\n\t\t});\n\t}\n\n\tprivate async readCreateEvidence(\n\t\tkey: string,\n\t\tbranch: string,\n\t): Promise<{\n\t\topen: number[];\n\t\tserverTime: number | undefined;\n\t\tlanded?: number;\n\t\tclosed?: BitbucketWrittenPullRequest;\n\t\tunsettled?: BitbucketUnsettledPullRequestWrite;\n\t}> {\n\t\tconst entry = this.ledger.get(key);\n\t\tconst receipt = entry?.action === 'create' ? entry.pullRequestNumber : undefined;\n\t\t// KEEP: Bitbucket updates an open pull request from the same source branch instead of creating one.\n\t\tconst open: number[] = [];\n\t\tconst serverTime = await this.scanPullRequests(this.getOpenPullRequestsFromQuery(branch), pr => {\n\t\t\tif (!sameIdentifier(pr?.source?.repository?.uuid, this.repository.repositoryId)) return false;\n\n\t\t\topen.push(isPositiveInt32(pr.id) ? pr.id : Number.NaN);\n\t\t\treturn receipt !== undefined ? pr.id === receipt : open.length > 1;\n\t\t});\n\t\tconst landed = receipt !== undefined && open.includes(receipt) ? receipt : undefined;\n\t\tconst closed = !open.length && receipt !== undefined ? await this.readClosed(receipt) : undefined;\n\t\tif (entry == null || landed !== undefined || closed != null) {\n\t\t\tthis.ledger.settle(key);\n\t\t\treturn { open: open, serverTime: serverTime, landed: landed, closed: closed };\n\t\t}\n\n\t\treturn { open: open, serverTime: serverTime, unsettled: entry };\n\t}\n\n\t// KEEP: another account may lack pull request read access, so it learns nothing about the attempt.\n\tprivate refuseRelease(\n\t\treason: 'conflict' | 'invalid-input',\n\t\theld: BitbucketUnsettledPullRequestWrite,\n\t): BitbucketPullRequestWriteReleaseResult {\n\t\treturn sameIdentifier(held.accountId, this.accountId)\n\t\t\t? { ok: false, reason: reason, unsettled: held }\n\t\t\t: { ok: false, reason: reason };\n\t}\n\n\tprivate async readShownPullRequest(\n\t\tnumber: number | undefined,\n\t\tsourceBranch: string,\n\t\ttargetBranch: string | undefined,\n\t): Promise<BitbucketWrittenPullRequest | undefined> {\n\t\tif (number === undefined) return undefined;\n\n\t\t// KEEP: the decision is made; a failed read of the pull request to show only leaves it out.\n\t\tconst pullRequest = await this.readPullRequest(number).then(\n\t\t\tread => read.pullRequest,\n\t\t\t() => undefined,\n\t\t);\n\t\treturn pullRequest?.state === 'open' && isAttemptPullRequest(pullRequest, sourceBranch, targetBranch)\n\t\t\t? pullRequest\n\t\t\t: undefined;\n\t}\n\n\tprivate async readClosed(number: number): Promise<BitbucketWrittenPullRequest | undefined> {\n\t\tconst pullRequest = await this.readPullRequest(number).then(\n\t\t\tread => read.pullRequest,\n\t\t\t(ex: unknown) => {\n\t\t\t\tif (toBitbucketPullRequestWriteFailure(ex).reason === 'not-found') return undefined;\n\n\t\t\t\tthrow ex;\n\t\t\t},\n\t\t);\n\t\treturn pullRequest != null && pullRequest.state !== 'open' ? pullRequest : undefined;\n\t}\n\n\tprivate recordUnsettled(\n\t\tkey: string,\n\t\tresult: SentResult,\n\t\twrite: BitbucketUnsettledPullRequestWrite,\n\t): BitbucketPullRequestWriteResult {\n\t\tif (result.ok ? result.status !== 'pending' : result.reason !== 'outcome-unknown') {\n\t\t\treturn result as SettledResult;\n\t\t}\n\n\t\tthis.ledger.record(key, write);\n\t\tconst unsettled = this.ledger.get(key)!;\n\t\treturn result.ok ? { ...result, status: 'pending', unsettled: unsettled } : { ...result, unsettled: unsettled };\n\t}\n\n\tprivate async merge(options: MergeOptions, key: string): Promise<BitbucketPullRequestWriteResult> {\n\t\tconst current = await this.readPullRequest(options.number);\n\t\tconst held = this.ledger.get(key);\n\t\tif (held != null) {\n\t\t\tif (current.pullRequest.state === 'open') return { ok: false, reason: 'outcome-unknown', unsettled: held };\n\n\t\t\tthis.ledger.settle(key);\n\t\t}\n\n\t\tconst failure = getMergeStateFailure(current.pullRequest) ?? getMergeRefFailure(options, current);\n\t\tif (failure != null) return { ok: false, reason: failure };\n\n\t\tconst checks = await this.readMergeabilityChecks(options.number);\n\t\tconst [latest, source, target] = await Promise.all([\n\t\t\tthis.readPullRequest(options.number),\n\t\t\tthis.readBranch(options.expectedSourceBranch),\n\t\t\tthis.readBranch(options.expectedTargetBranch),\n\t\t]);\n\t\tconst latestFailure = getMergeStateFailure(latest.pullRequest) ?? getMergeRefFailure(options, latest);\n\t\tif (latestFailure != null) return { ok: false, reason: latestFailure };\n\t\tif (!sameIdentifier(source?.sha, options.expectedSourceSha)) return { ok: false, reason: 'source-changed' };\n\t\tif (target == null || !sameIdentifier(target.sha, options.expectedTargetSha)) {\n\t\t\treturn { ok: false, reason: 'target-changed' };\n\t\t}\n\t\tif (!getAllowedStrategies(target, checks).includes(options.strategy)) {\n\t\t\treturn { ok: false, reason: 'policy-blocked' };\n\t\t}\n\n\t\tconst blocked = getBlockingCheckFailure(checks);\n\t\tif (blocked != null) return { ok: false, reason: blocked };\n\n\t\tconst dispatchedAt = Date.now();\n\t\tconst result = await this.send(\n\t\t\toptions,\n\t\t\t'POST',\n\t\t\t`${this.pullRequestUrl(options.number)}/merge?async=false`,\n\t\t\t{ type: 'pullrequest', merge_strategy: options.strategy },\n\t\t\t{ pending: latest.pullRequest },\n\t\t);\n\t\tconst mergeTaskId = result.ok && result.status === 'pending' ? result.mergeTaskId : undefined;\n\t\treturn this.recordUnsettled(key, result, {\n\t\t\tattemptId: uuid(),\n\t\t\taccountId: this.accountId,\n\t\t\tdispatchedAt: dispatchedAt,\n\t\t\taction: 'merge',\n\t\t\tnumber: options.number,\n\t\t\t...(mergeTaskId !== undefined && { mergeTaskId: mergeTaskId }),\n\t\t});\n\t}\n\n\trelease(options: BitbucketPullRequestWriteReleaseOptions): Promise<BitbucketPullRequestWriteReleaseResult> {\n\t\tif (options.action === 'create') {\n\t\t\tconst key = getCreateKey(this.repository.repositoryId, options.sourceBranch);\n\t\t\treturn this.ledger.run(key, async () => {\n\t\t\t\tconst held = this.ledger.get(key);\n\t\t\t\t// KEEP: an ok release must mean Core holds no attempt here, or a host could drop its own durable barrier.\n\t\t\t\tif (held != null && held.attemptId !== options.attemptId) {\n\t\t\t\t\treturn this.refuseRelease('conflict', held);\n\t\t\t\t}\n\n\t\t\t\tconst matches = held != null;\n\t\t\t\tconst target = held?.action === 'create' ? held.targetBranch : undefined;\n\t\t\t\tconst evidence = await this.readCreateEvidence(key, options.sourceBranch);\n\t\t\t\tconst only =\n\t\t\t\t\tevidence.open.length === 1 && isPositiveInt32(evidence.open[0]) ? evidence.open[0] : undefined;\n\t\t\t\tconst shown = evidence.landed ?? only;\n\t\t\t\t// KEEP: only the receipt's own PR is evidence; another open PR keeps the attempt, as it can still land once that PR closes.\n\t\t\t\tif (evidence.open.length && evidence.landed === undefined) {\n\t\t\t\t\tconst pullRequest = await this.readShownPullRequest(shown, options.sourceBranch, target);\n\t\t\t\t\treturn { ok: false, reason: 'conflict', pullRequest: pullRequest };\n\t\t\t\t}\n\n\t\t\t\tconst settled = matches && evidence.unsettled == null;\n\t\t\t\tconst released = settled || this.ledger.release(key, options.attemptId);\n\t\t\t\tif (evidence.landed !== undefined) {\n\t\t\t\t\tconst pullRequest = await this.readShownPullRequest(shown, options.sourceBranch, target);\n\t\t\t\t\treturn { ok: true, released: released, observed: 'pull-request-open', pullRequest: pullRequest };\n\t\t\t\t}\n\t\t\t\tif (evidence.closed != null && matches) {\n\t\t\t\t\tconst pullRequest = isAttemptPullRequest(evidence.closed, options.sourceBranch, target)\n\t\t\t\t\t\t? evidence.closed\n\t\t\t\t\t\t: undefined;\n\t\t\t\t\treturn { ok: true, released: released, observed: 'pull-request-closed', pullRequest: pullRequest };\n\t\t\t\t}\n\n\t\t\t\treturn { ok: true, released: released, observed: 'no-open-pull-request' };\n\t\t\t});\n\t\t}\n\n\t\tconst key = getMergeKey(this.repository.repositoryId, options.number);\n\t\treturn this.ledger.run(key, async () => {\n\t\t\tconst held = this.ledger.get(key);\n\t\t\t// KEEP: the held write's own task id is authoritative; the host's only stands in when Core holds none.\n\t\t\tconst heldTaskId = held?.action === 'merge' ? held.mergeTaskId : undefined;\n\t\t\tif (\n\t\t\t\theld != null &&\n\t\t\t\theldTaskId != null &&\n\t\t\t\toptions.mergeTaskId != null &&\n\t\t\t\toptions.mergeTaskId !== heldTaskId\n\t\t\t) {\n\t\t\t\treturn this.refuseRelease('invalid-input', held);\n\t\t\t}\n\t\t\tif (held != null && held.attemptId !== options.attemptId) {\n\t\t\t\treturn this.refuseRelease('conflict', held);\n\t\t\t}\n\n\t\t\tconst matches = held != null;\n\n\t\t\tconst { pullRequest } = await this.readPullRequest(options.number);\n\t\t\tif (pullRequest.state !== 'open') {\n\t\t\t\tthis.ledger.settle(key);\n\t\t\t\treturn { ok: true, released: matches, observed: 'pull-request-closed', pullRequest: pullRequest };\n\t\t\t}\n\t\t\tif (pullRequest.queued) return { ok: false, reason: 'conflict' };\n\n\t\t\tconst mergeTaskId = heldTaskId ?? options.mergeTaskId;\n\t\t\tif (mergeTaskId != null) {\n\t\t\t\tconst task = await this.readMergeTaskForRelease(options.number, mergeTaskId);\n\t\t\t\tif (task !== 'expired') return { ok: false, reason: task };\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\treleased: this.ledger.release(key, options.attemptId),\n\t\t\t\tobserved: 'pull-request-open',\n\t\t\t\tpullRequest: pullRequest,\n\t\t\t};\n\t\t});\n\t}\n\n\t// KEEP: Bitbucket answers a bare PENDING for an unknown or expired task too, so only that one may release.\n\tprivate async readMergeTaskForRelease(\n\t\tnumber: number,\n\t\tmergeTaskId: string,\n\t): Promise<'expired' | 'conflict' | 'outcome-unknown'> {\n\t\tconst key = getMergeKey(this.repository.repositoryId, number);\n\t\tlet task: RawMergeTask | undefined;\n\t\ttry {\n\t\t\t({ body: task } = await this.request<RawMergeTask>({\n\t\t\t\turl: `${this.pullRequestUrl(number)}/merge/task-status/${seg(mergeTaskId)}`,\n\t\t\t\theaders: this.headers,\n\t\t\t\tredirect: 'error',\n\t\t\t}));\n\t\t} catch (ex) {\n\t\t\tconst refusal = getBitbucketMergeRefusal(ex);\n\t\t\tif (refusal == null) throw ex;\n\t\t\tif (refusal === 'invalid-input') throw new BitbucketPullRequestWriteError(refusal);\n\t\t\tif (refusal !== 'conflict' && refusal !== 'policy-blocked') return 'outcome-unknown';\n\n\t\t\tthis.ledger.settleMergeTask(key, mergeTaskId);\n\t\t\treturn 'conflict';\n\t\t}\n\n\t\tif (task == null || typeof task !== 'object') return 'outcome-unknown';\n\t\tif (task.task_status === 'SUCCESS') {\n\t\t\tthis.ledger.settleMergeTask(key, mergeTaskId);\n\t\t\treturn 'conflict';\n\t\t}\n\t\tif (task.task_status !== 'PENDING') return 'outcome-unknown';\n\t\tif (task.queued_pullrequest == null) return 'expired';\n\n\t\treturn this.isQueuedPullRequest(task.queued_pullrequest, number) ? 'conflict' : 'outcome-unknown';\n\t}\n\n\tasync readMergeStatus(\n\t\toptions: BitbucketPullRequestMergeStatusOptions,\n\t): Promise<BitbucketPullRequestMergeStatusResult> {\n\t\tconst key = getMergeKey(this.repository.repositoryId, options.number);\n\t\tlet task: RawMergeTask | undefined;\n\t\tlet refusal: FailureReason | undefined;\n\t\ttry {\n\t\t\t({ body: task } = await this.request<RawMergeTask>({\n\t\t\t\turl: `${this.pullRequestUrl(options.number)}/merge/task-status/${seg(options.mergeTaskId)}`,\n\t\t\t\theaders: this.headers,\n\t\t\t\tredirect: 'error',\n\t\t\t}));\n\t\t} catch (ex) {\n\t\t\trefusal = getBitbucketMergeRefusal(ex);\n\t\t\tif (refusal == null) throw ex;\n\t\t}\n\t\tif (refusal === 'invalid-input') return { ok: false, reason: refusal };\n\n\t\tif (refusal === 'conflict' || refusal === 'policy-blocked') {\n\t\t\tthis.ledger.settleMergeTask(key, options.mergeTaskId);\n\t\t\tconst snapshot = await this.readPullRequest(options.number).catch(() => undefined);\n\t\t\tif (snapshot != null && snapshot.pullRequest.state !== 'open') {\n\t\t\t\tthis.ledger.settle(key);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tstatus: 'failed',\n\t\t\t\treason: refusal,\n\t\t\t\t...(snapshot != null && { pullRequest: snapshot.pullRequest }),\n\t\t\t};\n\t\t}\n\t\tif (refusal != null) return { ok: false, reason: refusal };\n\n\t\tif (task?.task_status === 'SUCCESS') {\n\t\t\tconst merged = this.getApprovedMergeResult(task.merge_result, options);\n\t\t\tif (merged != null) {\n\t\t\t\tthis.ledger.settleMergeTask(key, options.mergeTaskId);\n\t\t\t\treturn { ok: true, status: 'merged', pullRequest: merged };\n\t\t\t}\n\t\t}\n\n\t\tconst { pullRequest } = await this.readPullRequest(options.number);\n\t\tif (pullRequest.state !== 'open') {\n\t\t\tthis.ledger.settle(key);\n\t\t}\n\n\t\t// SEE: unknown or expired task ids answer PENDING; only the task's own queued_pullrequest proves this one.\n\t\t// https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/#api-repositories-workspace-repo-slug-pullrequests-pull-request-id-merge-task-status-task-id-get\n\t\treturn task?.task_status === 'PENDING' && this.isQueuedPullRequest(task.queued_pullrequest, options.number)\n\t\t\t? { ok: true, status: 'pending', pullRequest: pullRequest }\n\t\t\t: { ok: false, reason: 'outcome-unknown' };\n\t}\n\n\tprivate getApprovedMergeResult(\n\t\traw: RawPullRequest | undefined,\n\t\toptions: BitbucketPullRequestMergeStatusOptions,\n\t): BitbucketWrittenPullRequest | undefined {\n\t\tif (raw == null) return undefined;\n\n\t\tlet read: PullRequestRead;\n\t\ttry {\n\t\t\tread = this.toPullRequestRead(raw, options.number);\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst { pullRequest } = read;\n\t\treturn pullRequest.state === 'merged' &&\n\t\t\tpullRequest.sourceBranch === options.expectedSourceBranch &&\n\t\t\tpullRequest.targetBranch === options.expectedTargetBranch &&\n\t\t\tisApprovedSource(options.expectedSourceSha, read)\n\t\t\t? pullRequest\n\t\t\t: undefined;\n\t}\n\n\tprivate isQueuedPullRequest(queued: RawMergeTask['queued_pullrequest'], number: number): boolean {\n\t\tconst pullRequest = queued?.pullrequest;\n\t\tconst repositoryId = pullRequest?.destination?.repository?.uuid;\n\t\treturn (\n\t\t\tqueued?.type === 'queued_pullrequest' &&\n\t\t\tpullRequest?.id === number &&\n\t\t\t(repositoryId == null || sameIdentifier(repositoryId, this.repository.repositoryId))\n\t\t);\n\t}\n\n\tprivate async getMergeTarget(\n\t\tread: PullRequestRead,\n\t): Promise<{ merge: BitbucketPullRequestMergeCapability; pullRequest: BitbucketWrittenPullRequest }> {\n\t\tconst { pullRequest } = read;\n\t\tconst stateFailure = getMergeStateFailure(pullRequest);\n\t\tif (stateFailure != null) {\n\t\t\treturn { merge: { kind: 'unavailable', reason: stateFailure }, pullRequest: pullRequest };\n\t\t}\n\n\t\ttry {\n\t\t\tconst [source, target] = await Promise.all([\n\t\t\t\tthis.readBranch(pullRequest.sourceBranch),\n\t\t\t\tthis.readBranch(pullRequest.targetBranch),\n\t\t\t]);\n\t\t\tconst snapshot = {\n\t\t\t\t...pullRequest,\n\t\t\t\t...(source != null && { sourceSha: source.sha }),\n\t\t\t\t...(target != null && { targetSha: target.sha }),\n\t\t\t};\n\t\t\tif (source == null || read.sourceHash == null || !source.sha.toLowerCase().startsWith(read.sourceHash)) {\n\t\t\t\treturn { merge: { kind: 'unavailable', reason: 'source-changed' }, pullRequest: snapshot };\n\t\t\t}\n\t\t\tif (target == null) {\n\t\t\t\treturn { merge: { kind: 'unavailable', reason: 'target-changed' }, pullRequest: snapshot };\n\t\t\t}\n\n\t\t\tconst checks = await this.readMergeabilityChecks(pullRequest.number);\n\t\t\tconst strategies = getAllowedStrategies(target, checks);\n\t\t\tconst blocked = strategies.length ? getBlockingCheckFailure(checks) : 'policy-blocked';\n\t\t\tif (blocked != null) return { merge: { kind: 'unavailable', reason: blocked }, pullRequest: snapshot };\n\n\t\t\tconst defaultStrategy = strategies.find(strategy => strategy === target.defaultStrategy);\n\t\t\treturn {\n\t\t\t\tmerge: {\n\t\t\t\t\tkind: 'available',\n\t\t\t\t\tstrategies: strategies,\n\t\t\t\t\t...(defaultStrategy !== undefined && { defaultStrategy: defaultStrategy }),\n\t\t\t\t},\n\t\t\t\tpullRequest: snapshot,\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\treturn {\n\t\t\t\tmerge: { kind: 'unavailable', reason: toBitbucketPullRequestWriteFailure(ex).reason },\n\t\t\t\tpullRequest: pullRequest,\n\t\t\t};\n\t\t}\n\t}\n\n\tprivate pullRequestUrl(number: number): string {\n\t\treturn `${this.repoUrl}/pullrequests/${number}`;\n\t}\n\n\tprivate async readPullRequest(number: number): Promise<PullRequestRead> {\n\t\tconst { body: raw } = await this.request<RawPullRequest>({\n\t\t\turl: this.pullRequestUrl(number),\n\t\t\theaders: this.headers,\n\t\t\tredirect: 'error',\n\t\t});\n\t\treturn this.toPullRequestRead(raw, number);\n\t}\n\n\tprivate toPullRequestRead(raw: RawPullRequest, number?: number): PullRequestRead {\n\t\tif (!sameIdentifier(raw?.destination?.repository?.uuid, this.repository.repositoryId)) {\n\t\t\tthrow new BitbucketPullRequestWriteError('not-found');\n\t\t}\n\n\t\tconst { id, title, description, source, destination } = raw;\n\t\tconst state = typeof raw.state === 'string' ? raw.state.toLowerCase() : undefined;\n\t\tconst sourceBranch = source?.branch?.name;\n\t\tconst targetBranch = destination?.branch?.name;\n\t\tconst sourceHash = source?.commit?.hash;\n\t\tif (\n\t\t\t!isPositiveInt32(id) ||\n\t\t\t(number !== undefined && id !== number) ||\n\t\t\ttypeof title !== 'string' ||\n\t\t\t(description != null && typeof description !== 'string') ||\n\t\t\t(state !== 'open' && state !== 'merged' && state !== 'declined' && state !== 'superseded') ||\n\t\t\ttypeof sourceBranch !== 'string' ||\n\t\t\tsourceBranch.length === 0 ||\n\t\t\ttypeof targetBranch !== 'string' ||\n\t\t\ttargetBranch.length === 0\n\t\t) {\n\t\t\tthrow new BitbucketPullRequestWriteError('unknown');\n\t\t}\n\n\t\tconst sourceRepository = source?.repository?.uuid;\n\t\treturn {\n\t\t\tsourceHash:\n\t\t\t\ttypeof sourceHash === 'string' && /^[\\da-f]{7,40}$/i.test(sourceHash)\n\t\t\t\t\t? sourceHash.toLowerCase()\n\t\t\t\t\t: undefined,\n\t\t\tpullRequest: {\n\t\t\t\trepository: this.repository,\n\t\t\t\tnumber: id,\n\t\t\t\turl: `${webUrl}/${seg(this.repository.workspaceSlug)}/${seg(this.repository.repositorySlug)}/pull-requests/${id}`,\n\t\t\t\ttitle: title,\n\t\t\t\tdescription: description ?? '',\n\t\t\t\tstate: state,\n\t\t\t\tdraft: raw.draft === true,\n\t\t\t\tqueued: raw.queued === true,\n\t\t\t\tisCrossRepository: !sameIdentifier(sourceRepository, this.repository.repositoryId),\n\t\t\t\tsourceBranch: sourceBranch,\n\t\t\t\ttargetBranch: targetBranch,\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate async readBranch(name: string): Promise<TargetBranch | undefined> {\n\t\tlet branch: RawBranch;\n\t\ttry {\n\t\t\t({ body: branch } = await this.request<RawBranch>({\n\t\t\t\turl: `${this.repoUrl}/refs/branches/${seg(name)}`,\n\t\t\t\theaders: this.headers,\n\t\t\t\tredirect: 'error',\n\t\t\t}));\n\t\t} catch (ex) {\n\t\t\tif (toBitbucketPullRequestWriteFailure(ex).reason === 'not-found') return undefined;\n\n\t\t\tthrow ex;\n\t\t}\n\n\t\tconst sha = branch?.target?.hash;\n\t\tif (branch?.name !== name || !isCommitSha(sha)) throw new BitbucketPullRequestWriteError('unknown');\n\n\t\treturn {\n\t\t\tsha: sha,\n\t\t\tstrategies: toStrategies(branch.merge_strategies),\n\t\t\tdefaultStrategy:\n\t\t\t\ttypeof branch.default_merge_strategy === 'string' ? branch.default_merge_strategy : undefined,\n\t\t};\n\t}\n\n\tprivate async readMergeabilityChecks(number: number): Promise<RawMergeabilityCheck[]> {\n\t\tconst { body } = await this.request<{ values?: unknown }>({\n\t\t\turl: `${this.pullRequestUrl(number)}/mergeability/checks`,\n\t\t\theaders: this.headers,\n\t\t\tredirect: 'error',\n\t\t});\n\t\tconst values = body?.values;\n\t\tif (!Array.isArray(values) || values.some(check => check == null || typeof check !== 'object')) {\n\t\t\tthrow new BitbucketPullRequestWriteError('unknown');\n\t\t}\n\n\t\treturn values as RawMergeabilityCheck[];\n\t}\n\n\tprivate getOpenPullRequestsFromQuery(branch: string): URLSearchParams {\n\t\t// SEE: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/#api-repositories-workspace-repo-slug-pullrequests-get\n\t\treturn new URLSearchParams({\n\t\t\tq: `source.branch.name=\"${branch}\"`,\n\t\t\tstate: 'OPEN',\n\t\t\tfields: 'next,values.id,values.source.repository.uuid',\n\t\t\tpagelen: '50',\n\t\t});\n\t}\n\n\tprivate async scanPullRequests(\n\t\tquery: URLSearchParams,\n\t\tvisit: (pr: RawPullRequest) => boolean,\n\t): Promise<number | undefined> {\n\t\tlet url = `${this.repoUrl}/pullrequests?${query.toString()}`;\n\t\tconst seen = new Set<string>();\n\t\tlet serverTime: number | undefined;\n\t\twhile (true) {\n\t\t\tseen.add(url);\n\t\t\tconst response = await this.request<{ values?: unknown; next?: unknown }>({\n\t\t\t\turl: url,\n\t\t\t\theaders: this.headers,\n\t\t\t\tredirect: 'error',\n\t\t\t});\n\t\t\tserverTime ??= getServerTime(response.headers);\n\t\t\tconst { values, next } = response.body ?? {};\n\t\t\tif (!Array.isArray(values)) throw new BitbucketPullRequestWriteError('unknown');\n\t\t\tif ((values as RawPullRequest[]).some(pr => visit(pr))) return serverTime;\n\t\t\tif (next == null) return serverTime;\n\t\t\tif (typeof next !== 'string' || !next.startsWith(`${apiUrl}/`) || seen.has(next)) {\n\t\t\t\tthrow new BitbucketPullRequestWriteError('unknown');\n\t\t\t}\n\n\t\t\turl = next;\n\t\t}\n\t}\n\n\tprivate getMergeTaskId(number: number, headers: Record<string, unknown>): string | undefined {\n\t\tconst location = getResponseHeader(headers, 'location');\n\t\tif (typeof location !== 'string' || !URL.canParse(location, apiUrl)) return undefined;\n\n\t\tconst url = new URL(location, apiUrl);\n\t\tconst match = /^\\/2\\.0\\/repositories\\/([^/]+)\\/([^/]+)\\/pullrequests\\/(\\d+)\\/merge\\/task-status\\/([^/]+)$/.exec(\n\t\t\turl.pathname,\n\t\t);\n\t\tif (url.origin !== new URL(apiUrl).origin || url.search !== '' || match == null) return undefined;\n\n\t\tconst [, workspace, repository, id, taskId] = match.map(part => safeDecode(part));\n\t\tconst { workspaceId, workspaceSlug, repositoryId, repositorySlug } = this.repository;\n\t\treturn Number(id) === number &&\n\t\t\t(sameIdentifier(workspace, workspaceId) || sameIdentifier(workspace, workspaceSlug)) &&\n\t\t\t(sameIdentifier(repository, repositoryId) || sameIdentifier(repository, repositorySlug)) &&\n\t\t\tisBitbucketMergeTaskId(taskId)\n\t\t\t? taskId\n\t\t\t: undefined;\n\t}\n\n\tprivate send(\n\t\toptions: BitbucketPullRequestWriteOptions,\n\t\tmethod: 'POST' | 'PUT',\n\t\turl: string,\n\t\tbody?: object,\n\t\tcontext?: SendContext & { pending?: undefined },\n\t): Promise<SettledResult>;\n\tprivate send(\n\t\toptions: BitbucketPullRequestWriteOptions,\n\t\tmethod: 'POST' | 'PUT',\n\t\turl: string,\n\t\tbody: object,\n\t\tcontext: SendContext & { pending: BitbucketWrittenPullRequest },\n\t): Promise<SentResult>;\n\tprivate async send(\n\t\toptions: BitbucketPullRequestWriteOptions,\n\t\tmethod: 'POST' | 'PUT',\n\t\turl: string,\n\t\tbody?: object,\n\t\tcontext?: SendContext & { pending?: BitbucketWrittenPullRequest },\n\t): Promise<SentResult> {\n\t\tconst pending = context?.pending;\n\t\tif (!(await this.isSessionCurrent())) return { ok: false, reason: 'no-connection' };\n\n\t\tlet response: { status: number; body: RawPullRequest; headers: Record<string, unknown> };\n\t\ttry {\n\t\t\tresponse = await this.request<RawPullRequest>({\n\t\t\t\turl: url,\n\t\t\t\tmethod: method,\n\t\t\t\theaders: body == null ? this.headers : { ...this.headers, 'Content-Type': 'application/json' },\n\t\t\t\tbody: body == null ? undefined : JSON.stringify(body),\n\t\t\t\tredirect: 'error',\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\treturn toBitbucketPullRequestWriteFailure(ex, { action: options.action });\n\t\t}\n\n\t\tif (options.action === 'merge' && response.status === 202 && pending != null) {\n\t\t\tconst mergeTaskId = this.getMergeTaskId(options.number, response.headers);\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tstatus: 'pending',\n\t\t\t\tpullRequest: pending,\n\t\t\t\t...(mergeTaskId !== undefined && { mergeTaskId: mergeTaskId }),\n\t\t\t};\n\t\t}\n\n\t\tlet read: PullRequestRead;\n\t\ttry {\n\t\t\tread = this.toPullRequestRead(response.body, options.action === 'create' ? undefined : options.number);\n\t\t} catch {\n\t\t\treturn { ok: false, reason: 'outcome-unknown' };\n\t\t}\n\t\tcontext?.onReceipt?.(read.pullRequest);\n\n\t\tconst status = getReceiptStatus(options, response, read, this.accountId, context?.createdNotBefore);\n\t\treturn status === undefined\n\t\t\t? { ok: false, reason: 'outcome-unknown' }\n\t\t\t: { ok: true, status: status, pullRequest: read.pullRequest };\n\t}\n}\n\nfunction getAllowedStrategies(\n\ttarget: TargetBranch,\n\tchecks: RawMergeabilityCheck[],\n): BitbucketPullRequestMergeStrategy[] {\n\tconst queued = checks.some(check => check.type === 'merge_queue_check' && check.required === true);\n\treturn queued ? target.strategies.filter(strategy => queueStrategies.includes(strategy)) : target.strategies;\n}\n\nfunction safeDecode(value: string): string | undefined {\n\ttry {\n\t\treturn decodeURIComponent(value);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction isApprovedSource(expectedSourceSha: string, read: PullRequestRead): boolean {\n\treturn read.sourceHash != null && expectedSourceSha.toLowerCase().startsWith(read.sourceHash);\n}\n\nfunction sameText(actual: string, expected: string): boolean {\n\treturn actual.replaceAll('\\r\\n', '\\n').trim() === expected.replaceAll('\\r\\n', '\\n').trim();\n}\n\nfunction getServerTime(headers: Record<string, unknown> | undefined): number | undefined {\n\tconst date = getResponseHeader(headers, 'date');\n\tif (typeof date !== 'string') return undefined;\n\n\tconst time = Date.parse(date);\n\treturn Number.isNaN(time) ? undefined : Math.floor(time / 1000) * 1000;\n}\n\nfunction isCreatedSince(raw: RawPullRequest, accountId: string, notBefore: number | undefined): boolean {\n\tif (notBefore == null || !sameIdentifier(raw.author?.uuid, accountId)) return false;\n\tif (typeof raw.created_on !== 'string') return false;\n\n\tconst createdOn = Date.parse(raw.created_on);\n\treturn !Number.isNaN(createdOn) && createdOn >= notBefore;\n}\n\nfunction getReceiptStatus(\n\toptions: BitbucketPullRequestWriteOptions,\n\tresponse: { status: number; body: RawPullRequest },\n\tread: PullRequestRead,\n\taccountId: string,\n\tcreatedNotBefore: number | undefined,\n): WriteStatus | undefined {\n\tconst { pullRequest } = read;\n\tswitch (options.action) {\n\t\tcase 'create':\n\t\t\t// KEEP: Bitbucket upserts; an open PR from the branch made in the preflight's second or after it can still pass here.\n\t\t\treturn response.status === 201 &&\n\t\t\t\tisCreatedSince(response.body, accountId, createdNotBefore) &&\n\t\t\t\tpullRequest.state === 'open' &&\n\t\t\t\t!pullRequest.isCrossRepository &&\n\t\t\t\tpullRequest.sourceBranch === options.sourceBranch &&\n\t\t\t\tpullRequest.targetBranch === options.targetBranch &&\n\t\t\t\tsameText(pullRequest.title, options.title) &&\n\t\t\t\t(options.description === undefined || sameText(pullRequest.description, options.description))\n\t\t\t\t? 'created'\n\t\t\t\t: undefined;\n\t\tcase 'edit':\n\t\t\treturn pullRequest.state === 'open' &&\n\t\t\t\t(options.title === undefined || sameText(pullRequest.title, options.title)) &&\n\t\t\t\t(options.description === undefined || sameText(pullRequest.description, options.description))\n\t\t\t\t? 'updated'\n\t\t\t\t: undefined;\n\t\tcase 'decline':\n\t\t\treturn pullRequest.state === 'declined' ? 'declined' : undefined;\n\t\tcase 'merge':\n\t\t\tif (\n\t\t\t\tpullRequest.sourceBranch !== options.expectedSourceBranch ||\n\t\t\t\tpullRequest.targetBranch !== options.expectedTargetBranch\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif (pullRequest.state === 'merged') {\n\t\t\t\t// KEEP: Bitbucket has no compare-and-swap, so a source pushed after the last read may be what merged.\n\t\t\t\treturn isApprovedSource(options.expectedSourceSha, read) ? 'merged' : undefined;\n\t\t\t}\n\n\t\t\treturn pullRequest.state === 'open' && pullRequest.queued ? 'pending' : undefined;\n\t}\n}\n"],"mappings":";;;;;AA4BA,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,kBAAuD;CAC5D;CACA;CACA;CACA;CACA;CACA;AACD;AAEA,MAAM,kBAAuD;CAAC;CAAgB;CAAU;AAAc;AACtG,MAAM,cAAc;AACpB,MAAM,cAAc;AACpB,MAAM,qBAAqB;AA6D3B,SAAS,gBAAgB,OAAiC;CACzD,OAAO,OAAO,UAAU,YAAY,YAAY,KAAK,KAAK;AAC3D;AAEA,SAAS,aAAa,OAA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A,KAAa,SAAS,YAAY,OAAO,QAAQ,KAAK,OACxE,QAAQ,gBAAgB,KAAA,KAAa,SAAS,YAAY,aAAa,QAAQ,WAAW,KACzF,YACA,KAAA;EACJ,KAAK,WACJ,OAAO,YAAY,UAAU,aAAa,aAAa,KAAA;EACxD,KAAK;GACJ,IACC,YAAY,iBAAiB,QAAQ,wBACrC,YAAY,iBAAiB,QAAQ,sBAErC;GAED,IAAI,YAAY,UAAU,UAEzB,OAAO,iBAAiB,QAAQ,mBAAmB,IAAI,IAAI,WAAW,KAAA;GAGvE,OAAO,YAAY,UAAU,UAAU,YAAY,SAAS,YAAY,KAAA;CAC1E;AACD"}
@@ -1,4 +1,5 @@
1
1
  import { IssueSorting } from "../../../git/models/issue.js";
2
+ import "../providerFilters.js";
2
3
  //#region ../plus/integrations/src/providers/issueSorts.d.ts
3
4
  /** GitHub and GHE: one `search` channel serves all three issue reads, so all three order the same way. */
4
5
  export declare const githubIssueSorts: IssueSorting[];
@@ -64,7 +64,8 @@ const githubPullRequestSearchCapabilities = {
64
64
  "updated:asc",
65
65
  "created:desc",
66
66
  "created:asc"
67
- ]
67
+ ],
68
+ changedSince: true
68
69
  };
69
70
  /**
70
71
  * Bitbucket Data Center's filtered pull-request search (`bitbucket-server/pullRequestSearch.ts`), declared from what
@@ -96,7 +97,8 @@ const bitbucketServerPullRequestSearchCapabilities = {
96
97
  draft: true,
97
98
  repositoryScope: true,
98
99
  organizationScope: false,
99
- sorts: ["updated:desc", "updated:asc"]
100
+ sorts: ["updated:desc", "updated:asc"],
101
+ changedSince: false
100
102
  };
101
103
  /**
102
104
  * Azure DevOps Server's filtered pull-request search. Azure's pull request query narrows only by creator, reviewer,
@@ -128,7 +130,8 @@ const azureServerPullRequestSearchCapabilities = {
128
130
  draft: true,
129
131
  repositoryScope: true,
130
132
  organizationScope: true,
131
- sorts: azurePullRequestSearchSorts
133
+ sorts: azurePullRequestSearchSorts,
134
+ changedSince: false
132
135
  };
133
136
  /**
134
137
  * Azure DevOps Server's filtered work-item search: one WIQL query per collection, every criterion a clause of it.
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.js","names":[],"sources":["../../../../../plus/integrations/src/providers/metadata.ts"],"sourcesContent":["import { githubSearchResultLimit } from '@gitlens/git-github/api/config.js';\nimport type { ProviderReference } from '@gitlens/git/models/remoteProvider.js';\nimport { equalsIgnoreCase } from '@gitlens/utils/string.js';\nimport type { IntegrationIds } from '../constants.js';\nimport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n} from '../constants.js';\nimport type { IntegrationType } from '../models/publicIntegration.js';\nimport type {\n\tIssueSearchCapabilities,\n\tIssueSorting,\n\tPullRequestSearchCapabilities,\n\tPullRequestSorting,\n} from '../providerFilters.js';\nimport { IssueFilter, PullRequestFilter } from '../providerFilters.js';\nimport {\n\tazurePullRequestSearchSorts,\n\tazureWorkItemSearchRelationships,\n\tazureWorkItemSearchResultLimit,\n\tazureWorkItemSearchSorts,\n} from './azure/search.js';\nimport {\n\tasanaIssueSorts,\n\tazureAccountWideIssueSorts,\n\tazureIssueSorts,\n\tgithubAccountWideIssueSorts,\n\tgithubIssueSorts,\n\tgitlabAccountWideIssueSorts,\n\tgitlabIssueSorts,\n\tjiraIssueSorts,\n\tlinearIssueSorts,\n\ttrelloIssueSorts,\n} from './issueSorts.js';\n\n// Provider metadata (names, domains, icons, scopes, capabilities) and the domain checks built on it. Kept apart from\n// `models.ts`, which holds the `@gitkraken/provider-apis` mappings, so the public facade can re-export this without\n// its declarations reaching the SDK.\n\nexport enum PagingMode {\n\tProject = 'project',\n\tRepo = 'repo',\n\tRepos = 'repos',\n}\n\nexport interface ProviderMetadata {\n\tdomain: string;\n\tid: IntegrationIds;\n\tname: string;\n\ttype: IntegrationType;\n\t/** Key for the `gl-provider-<iconKey>` glicon. Cloud self-managed variants reuse the base\n\t * `'github-enterprise'`/`'gitlab-self-hosted'` icon (no enum member exists for those anymore). */\n\ticonKey: string;\n\tissuesPagingMode?: PagingMode;\n\tpullRequestsPagingMode?: PagingMode;\n\tscopes: string[];\n\tsupportedPullRequestFilters?: PullRequestFilter[];\n\t/**\n\t * Relationship filters the ACCOUNT-WIDE pull-request read can express as an exact OR union.\n\t * This is independent from `supportedPullRequestFilters`, which describes repo-scoped reads.\n\t */\n\tsupportedAccountWidePullRequestFilters?: PullRequestFilter[];\n\t/**\n\t * What the filtered pull-request search can express server-side. Absent means the provider has\n\t * no such search and the facade refuses it rather than returning an unfiltered page.\n\t */\n\tsupportedPullRequestSearch?: PullRequestSearchCapabilities;\n\t/**\n\t * Maximum results the provider will serve for one pull-request search facet. Matches beyond it are unreachable\n\t * and are reported as a succeeded omission carrying this limit plus the provider's pre-ceiling facet count.\n\t */\n\tpullRequestSearchResultLimit?: number;\n\t/** Filters the REPO-scoped issue read can express. */\n\tsupportedIssueFilters?: IssueFilter[];\n\t/**\n\t * Filters the ACCOUNT-WIDE issue read can express, which is NOT the same set as\n\t * {@link ProviderMetadata.supportedIssueFilters}: the two reads are different provider queries.\n\t *\n\t * Unfiltered, each provider's account-wide read is that provider's own definition of \"my issues\" — GitHub/GHE\n\t * union authored + assigned + mentioned, Azure drains assigned + authored, and GitLab reads assigned-to-me.\n\t * A consumer replacing a narrower tool (`gk`'s `assignee:@me`) must select the `Assignee` filter wherever the\n\t * provider's default is wider.\n\t *\n\t * A filter listed here narrows that read server-side. Absent/empty means the read can't be narrowed at all,\n\t * so the facade refuses a filtered request rather than serving the unnarrowed union as if it had been\n\t * filtered. GitLab lists `Assignee` and `Author` because the SDK's account-wide input exposes both username\n\t * axes; it omits `Mention` because that REST read has no first-class mention filter.\n\t */\n\tsupportedAccountWideIssueFilters?: IssueFilter[];\n\t/**\n\t * Sort keys the REPO-scoped issue read can express server-side — and, for an issue tracker (Jira/Linear/Trello),\n\t * its project-scoped read, which is the only issue surface a tracker has.\n\t *\n\t * Absent/empty means the read can't be ordered at all, so a request carrying `sort` is refused rather than\n\t * served in whatever order the provider felt like. Present, it is a promise: every key here reaches the\n\t * provider query.\n\t *\n\t * A key listed here is expressible on ONE provider query, which is what this read is when it is given ONE\n\t * scope. Given several (GitLab across repositories, Azure across projects, a tracker across projects) it merges\n\t * their results here and can only honor a key a normalized issue carries, so it additionally refuses\n\t * `priority`/`dueDate`/`resolved` — see `getIssueComparator`. That depends on the caller's scope count rather\n\t * than on the provider, which is why it is a runtime refusal and not a fourth table: encoding it here would\n\t * under-report the single-scope read, which really does support those keys.\n\t */\n\tsupportedIssueSorts?: IssueSorting[];\n\t/**\n\t * Sort keys the ACCOUNT-WIDE issue read can express server-side, which is NOT the same set as\n\t * {@link ProviderMetadata.supportedIssueSorts} — for GitLab the two reads are different APIs (GraphQL vs REST)\n\t * with genuinely different vocabularies, not one narrowed twice.\n\t *\n\t * Absent means the account-wide read can't be ordered (or doesn't exist). An issue tracker leaves this empty\n\t * and reports under `supportedIssueSorts`, so reading a tracker's capability from here under-reports it.\n\t *\n\t * Unlike {@link ProviderMetadata.supportedIssueSorts} this needs no companion runtime refusal, because every\n\t * provider's account-wide read is a union of several queries with no scope count for a caller to reduce: it\n\t * ALWAYS merges. So the keys a merge can't order by are simply absent here — the table states what the read can\n\t * honor, which is what makes intersecting against it sufficient.\n\t */\n\tsupportedAccountWideIssueSorts?: IssueSorting[];\n\t/**\n\t * Whether issue list reads (including Azure project/repository and account-wide reads) can be asked for a `state` other than open, and honor it server-side.\n\t *\n\t * A tracker read is open-only unless asked otherwise, so absent does not mean the read returns every state: it\n\t * means only `'open'` is expressible, and `'closed'`/`'all'` are refused rather than served as the open list.\n\t * Server-side, because each read drains to a page backstop: dropping states afterwards would let a project full\n\t * of done work spend that budget before reaching the open issues.\n\t */\n\tsupportsIssueStates?: boolean;\n\t/**\n\t * What the provider's FILTERED issue search (`searchIssuesPage`, and the `countIssues` probe over the same\n\t * criteria) can express server-side. A third, wider surface than either filter set above: it is not bound to\n\t * the user at all, so it takes relationships those reads have no way to name (`any-assignee`, `unassigned`),\n\t * plus free text and issue attributes.\n\t *\n\t * Absent means the provider has NO filtered issue search and the read is refused. Present, it is a promise:\n\t * every field declared here reaches the provider query, so a consumer that intersects against it never has a\n\t * read refused, and a criterion is never silently ignored.\n\t */\n\tsupportedIssueSearch?: IssueSearchCapabilities;\n\t/**\n\t * The maximum number of results the provider's filtered issue search will serve for ONE query, however it is\n\t * paged. Matches past it are UNREACHABLE, not merely unfetched, which is why a read that hits this reports an\n\t * omission with `recovery: 'none'` and the total match count rather than offering a \"load more\".\n\t *\n\t * Absent means the provider declares no ceiling, in which case a truncated read falls back to generic wording\n\t * instead of quoting a limit that was never published.\n\t */\n\tissueSearchResultLimit?: number;\n\t/**\n\t * Whether the filtered searches reach the provider with scope names verbatim — as encoded URL segments, or\n\t * matched against the names discovery reported — rather than inside a query string the provider sanitizes.\n\t *\n\t * Relaxes the scope-name rule (`isUsableSearchScopeName`) for that provider to refuse only blank names and\n\t * control characters: a space or a quote can't split or alter a scope that is never parsed as a query, and\n\t * refusing them would refuse real names. Absent for a query-string search (GitHub's), where both do.\n\t */\n\texactSearchScopeNames?: boolean;\n}\n\nexport type ProvidersMetadata = { [Id in IntegrationIds]: ProviderMetadata & { id: Id } };\n\n/**\n * GitHub and GitHub Enterprise express every criterion as a search qualifier on the same GraphQL `search` field,\n * so the two share one declaration — a GHE instance running the same search syntax has the same capability, and\n * two copies of this table would be free to drift.\n *\n * Every entry is a claim the implementation must keep: `searchIssuesPage` emits a qualifier for each of these,\n * and a test asserts that (see the `issueSearch` capability tests) so the table can't quietly outrun the code.\n */\nconst githubIssueSearchCapabilities: IssueSearchCapabilities = {\n\t// `author:@me` / `assignee:@me` / `mentions:@me` / `assignee:*` / `no:assignee`, each its own aliased search.\n\trelationships: ['authored', 'assigned', 'mentioned', 'any-assignee', 'unassigned'],\n\ttext: true,\n\tlabels: true,\n\tmilestone: true,\n\tupdatedAfter: true,\n\tcreatedAfter: true,\n\t// `-linked:pr`.\n\twithoutLinkedPullRequest: true,\n\t// `is:open` / `is:closed`, or neither for all states.\n\tstates: true,\n\t// `sort:created-desc`, `sort:updated`, `sort:comments-asc`, … — see `githubIssueSorts`.\n\tsorts: githubIssueSorts,\n};\n\n/**\n * The ordering vocabulary of GitHub's filtered PR search: `created` and `updated`, both directions.\n *\n * Hand-declared rather than derived from `@gitkraken/provider-apis` (which has no PR-sort surface), and narrower\n * than the issue set on purpose: the merged relationship × state facets can only be re-ordered by a field a\n * `PullRequestShape` carries (see `getPullRequestComparator`), and GitHub PRs have no priority and no relevance\n * that orders stably under the result ceiling. A parity test pins this to `gitHubPullRequestSortQualifiers`' keys\n * so the capability can't outrun the emitter.\n */\nconst githubPullRequestSorts: PullRequestSorting[] = ['updated:desc', 'updated:asc', 'created:desc', 'created:asc'];\n\n/** GitHub and GHE use the same filtered pull-request search syntax and result ceiling. */\nconst githubPullRequestSearchCapabilities: PullRequestSearchCapabilities = {\n\trelationships: [\n\t\tPullRequestFilter.Author,\n\t\tPullRequestFilter.Assignee,\n\t\tPullRequestFilter.ReviewRequested,\n\t\tPullRequestFilter.Reviewed,\n\t\tPullRequestFilter.Mention,\n\t],\n\tstates: ['open', 'closed', 'merged', 'all'],\n\ttext: true,\n\tupdatedAfter: true,\n\tcreatedAfter: true,\n\tincludeArchived: true,\n\tdraft: true,\n\trepositoryScope: true,\n\torganizationScope: true,\n\t// `sort:updated`, `sort:updated-asc`, `sort:created-desc`, `sort:created-asc` — see `githubPullRequestSorts`.\n\tsorts: githubPullRequestSorts,\n};\n\n/**\n * Bitbucket Data Center's filtered pull-request search (`bitbucket-server/pullRequestSearch.ts`), declared from what\n * its REST API can express rather than from what a PR shape carries:\n * - relationships: `role=AUTHOR`, and a reviewer's `UNAPPROVED` status for a pending review versus `APPROVED` or\n * `NEEDS_WORK` for one already given. A Bitbucket pull request has no assignee, and nothing filters by mention.\n * - text is `filterText` (title or description), draft is `draft`, and archived repositories are excluded unless\n * asked for — all re-checked on each row, since the dashboard read has neither filter.\n * - no date filters and no `created` ordering: `order` is only `NEWEST`/`OLDEST` by last update, and filtering a\n * date on the rows read would page through everything before it.\n * - no organization scope: there is no project-wide pull-request list, only per repository and the dashboard.\n */\nconst bitbucketServerPullRequestSearchCapabilities: PullRequestSearchCapabilities = {\n\trelationships: [PullRequestFilter.Author, PullRequestFilter.ReviewRequested, PullRequestFilter.Reviewed],\n\tstates: ['open', 'closed', 'merged', 'all'],\n\ttext: true,\n\tupdatedAfter: false,\n\tcreatedAfter: false,\n\tincludeArchived: true,\n\tdraft: true,\n\trepositoryScope: true,\n\torganizationScope: false,\n\tsorts: ['updated:desc', 'updated:asc'],\n};\n\n/**\n * Azure DevOps Server's filtered pull-request search. Azure's pull request query narrows only by creator, reviewer,\n * status and repository, so the provider drains each facet and applies text, draft and dates to the complete facet\n * before merging — so a criterion never narrows a page after its count, and the only sort keys are the two a merged\n * page can be re-ordered by. What text and `updatedAfter` match is bounded by the list endpoint: see\n * `toAzurePullRequestSearchFilter`.\n *\n * `Assignee` and `ReviewRequested` both read by reviewer: Azure has no assignee distinct from its reviewers.\n * `Reviewed` and `Mention` are absent because the pull request query has no axis for either, and `includeArchived`\n * because Azure has no archived repositories to exclude.\n */\nconst azureServerPullRequestSearchCapabilities: PullRequestSearchCapabilities = {\n\trelationships: [PullRequestFilter.Author, PullRequestFilter.Assignee, PullRequestFilter.ReviewRequested],\n\tstates: ['open', 'closed', 'merged', 'all'],\n\ttext: true,\n\tupdatedAfter: true,\n\tcreatedAfter: true,\n\tincludeArchived: false,\n\tdraft: true,\n\trepositoryScope: true,\n\torganizationScope: true,\n\tsorts: azurePullRequestSearchSorts,\n};\n\n/**\n * Azure DevOps Server's filtered work-item search: one WIQL query per collection, every criterion a clause of it.\n * `mentioned` is absent because `@RecentMentions` only reaches back 30 days; `milestone` and\n * `withoutLinkedPullRequest` because WIQL has no flat-query clause for either. See `azure/search.ts`.\n */\nconst azureServerIssueSearchCapabilities: IssueSearchCapabilities = {\n\trelationships: azureWorkItemSearchRelationships,\n\ttext: true,\n\tlabels: true,\n\tmilestone: false,\n\tupdatedAfter: true,\n\tcreatedAfter: true,\n\twithoutLinkedPullRequest: false,\n\tstates: true,\n\tsorts: azureWorkItemSearchSorts,\n};\n\nexport const providersMetadata: ProvidersMetadata = {\n\t[GitCloudHostIntegrationId.GitHub]: {\n\t\tdomain: 'github.com',\n\t\tid: GitCloudHostIntegrationId.GitHub,\n\t\tname: 'GitHub',\n\t\ttype: 'git',\n\t\ticonKey: GitCloudHostIntegrationId.GitHub,\n\t\tissuesPagingMode: PagingMode.Repos,\n\t\tpullRequestsPagingMode: PagingMode.Repos,\n\t\t// Use 'username' property on account for PR filters\n\t\tsupportedPullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t\tPullRequestFilter.Mention,\n\t\t],\n\t\tsupportedAccountWidePullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t\tPullRequestFilter.Reviewed,\n\t\t\tPullRequestFilter.Mention,\n\t\t],\n\t\tsupportedPullRequestSearch: githubPullRequestSearchCapabilities,\n\t\tpullRequestSearchResultLimit: githubSearchResultLimit,\n\t\t// Use 'username' property on account for issue filters\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// The account-wide read is three independent searches (`author:@me`, `assignee:@me`, `mentions:@me`) behind\n\t\t// one composite cursor, so any subset of them is expressible.\n\t\tsupportedAccountWideIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// One `search` field serves all three issue reads (repo-scoped, account-wide, filtered search), so the same\n\t\t// qualifiers are expressible on each — the account-wide one narrowed to what its three-alias merge can order.\n\t\tsupportedIssueSorts: githubIssueSorts,\n\t\tsupportedAccountWideIssueSorts: githubAccountWideIssueSorts,\n\t\tsupportedIssueSearch: githubIssueSearchCapabilities,\n\t\tissueSearchResultLimit: githubSearchResultLimit,\n\t\tscopes: ['repo', 'read:user', 'user:email'],\n\t},\n\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise]: {\n\t\tdomain: '',\n\t\tid: GitSelfManagedHostIntegrationId.CloudGitHubEnterprise,\n\t\tname: 'GitHub Enterprise',\n\t\ttype: 'git',\n\t\ticonKey: 'github-enterprise',\n\t\tissuesPagingMode: PagingMode.Repos,\n\t\tpullRequestsPagingMode: PagingMode.Repos,\n\t\t// Use 'username' property on account for PR filters\n\t\tsupportedPullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t\tPullRequestFilter.Mention,\n\t\t],\n\t\tsupportedAccountWidePullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t\tPullRequestFilter.Reviewed,\n\t\t\tPullRequestFilter.Mention,\n\t\t],\n\t\tsupportedPullRequestSearch: githubPullRequestSearchCapabilities,\n\t\tpullRequestSearchResultLimit: githubSearchResultLimit,\n\t\t// Use 'username' property on account for issue filters\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// The account-wide read is three independent searches (`author:@me`, `assignee:@me`, `mentions:@me`) behind\n\t\t// one composite cursor, so any subset of them is expressible.\n\t\tsupportedAccountWideIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// One `search` field serves all three issue reads (repo-scoped, account-wide, filtered search), so the same\n\t\t// qualifiers are expressible on each — the account-wide one narrowed to what its three-alias merge can order.\n\t\tsupportedIssueSorts: githubIssueSorts,\n\t\tsupportedAccountWideIssueSorts: githubAccountWideIssueSorts,\n\t\tsupportedIssueSearch: githubIssueSearchCapabilities,\n\t\tissueSearchResultLimit: githubSearchResultLimit,\n\t\tscopes: ['repo', 'read:user', 'user:email'],\n\t},\n\t[GitCloudHostIntegrationId.GitLab]: {\n\t\tdomain: 'gitlab.com',\n\t\tid: GitCloudHostIntegrationId.GitLab,\n\t\tname: 'GitLab',\n\t\ttype: 'git',\n\t\ticonKey: GitCloudHostIntegrationId.GitLab,\n\t\tissuesPagingMode: PagingMode.Repo,\n\t\tpullRequestsPagingMode: PagingMode.Repo,\n\t\t// Use 'username' property on account for PR filters\n\t\tsupportedPullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\tsupportedAccountWidePullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\t// Use 'username' property on account for issue filters\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee],\n\t\t// The account-wide read drains one `scope=assigned_to_me` pass and one `scope=all` + `authorUsername` pass,\n\t\t// unioned, so either axis is expressible on its own. Mention is absent because GitLab's REST issue read has\n\t\t// no first-class mention filter to narrow with.\n\t\tsupportedAccountWideIssueFilters: [IssueFilter.Assignee, IssueFilter.Author],\n\t\t// Two different surfaces, not one narrowed twice: the repository-scoped read is GraphQL and the\n\t\t// account-wide one is REST, and REST has neither `title` nor `closed_at`.\n\t\tsupportedIssueSorts: gitlabIssueSorts,\n\t\tsupportedAccountWideIssueSorts: gitlabAccountWideIssueSorts,\n\t\tscopes: ['api', 'read_user', 'read_repository'],\n\t},\n\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted]: {\n\t\tdomain: '',\n\t\tid: GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted,\n\t\tname: 'GitLab Self-Hosted',\n\t\ttype: 'git',\n\t\ticonKey: 'gitlab-self-hosted',\n\t\tissuesPagingMode: PagingMode.Repo,\n\t\tpullRequestsPagingMode: PagingMode.Repo,\n\t\t// Use 'username' property on account for PR filters\n\t\tsupportedPullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\tsupportedAccountWidePullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\t// Use 'username' property on account for issue filters\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee],\n\t\t// The account-wide read drains one `scope=assigned_to_me` pass and one `scope=all` + `authorUsername` pass,\n\t\t// unioned, so either axis is expressible on its own. Mention is absent because GitLab's REST issue read has\n\t\t// no first-class mention filter to narrow with.\n\t\tsupportedAccountWideIssueFilters: [IssueFilter.Assignee, IssueFilter.Author],\n\t\t// Two different surfaces, not one narrowed twice: the repository-scoped read is GraphQL and the\n\t\t// account-wide one is REST, and REST has neither `title` nor `closed_at`.\n\t\tsupportedIssueSorts: gitlabIssueSorts,\n\t\tsupportedAccountWideIssueSorts: gitlabAccountWideIssueSorts,\n\t\tscopes: ['api', 'read_user', 'read_repository'],\n\t},\n\t[GitCloudHostIntegrationId.Bitbucket]: {\n\t\tdomain: 'bitbucket.org',\n\t\tid: GitCloudHostIntegrationId.Bitbucket,\n\t\tname: 'Bitbucket',\n\t\ttype: 'git',\n\t\ticonKey: GitCloudHostIntegrationId.Bitbucket,\n\t\tpullRequestsPagingMode: PagingMode.Repo,\n\t\t// Use 'id' property on account for PR filters (reviewer filter keyed by account id / reviewerId)\n\t\tsupportedPullRequestFilters: [PullRequestFilter.Author, PullRequestFilter.ReviewRequested],\n\t\tsupportedAccountWidePullRequestFilters: [PullRequestFilter.Author, PullRequestFilter.ReviewRequested],\n\t\tscopes: ['account:read', 'repository:read', 'pullrequest:read', 'issue:read'],\n\t},\n\t[GitSelfManagedHostIntegrationId.BitbucketServer]: {\n\t\tdomain: '',\n\t\tid: GitSelfManagedHostIntegrationId.BitbucketServer,\n\t\tname: 'Bitbucket Data Center',\n\t\ttype: 'git',\n\t\ticonKey: GitSelfManagedHostIntegrationId.BitbucketServer,\n\t\tpullRequestsPagingMode: PagingMode.Repo,\n\t\tsupportedPullRequestFilters: [PullRequestFilter.Author, PullRequestFilter.ReviewRequested],\n\t\tsupportedAccountWidePullRequestFilters: [PullRequestFilter.Author, PullRequestFilter.ReviewRequested],\n\t\tsupportedPullRequestSearch: bitbucketServerPullRequestSearchCapabilities,\n\t\t// No `pullRequestSearchResultLimit`: nothing caps how far a search pages.\n\t\tscopes: ['Project (Read)', 'Repository (Write)'],\n\t},\n\t[GitCloudHostIntegrationId.AzureDevOps]: {\n\t\tsupportsIssueStates: true,\n\t\tdomain: 'dev.azure.com',\n\t\tid: GitCloudHostIntegrationId.AzureDevOps,\n\t\tname: 'Azure DevOps',\n\t\ttype: 'git',\n\t\ticonKey: GitCloudHostIntegrationId.AzureDevOps,\n\t\tissuesPagingMode: PagingMode.Project,\n\t\tpullRequestsPagingMode: PagingMode.Repo,\n\t\t// Use 'id' property on account for PR filters (reviewer filter keyed by account id / reviewerId)\n\t\tsupportedPullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\tsupportedAccountWidePullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\t// Use 'name' property on account for issue filters\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// The account-wide read drains one (project × assignee) and one (project × author) query per project, so\n\t\t// either axis is expressible on its own. There is no mention query to narrow to.\n\t\tsupportedAccountWideIssueFilters: [IssueFilter.Author, IssueFilter.Assignee],\n\t\t// Both reads emit the same WIQL, but the account-wide one drains every (project x relationship) query and\n\t\t// merges the results, so it can only honor keys a normalized issue carries — `resolved` and `priority` are\n\t\t// dropped from that surface for the same reason they are dropped from GitLab's.\n\t\tsupportedIssueSorts: azureIssueSorts,\n\t\tsupportedAccountWideIssueSorts: azureAccountWideIssueSorts,\n\t\tscopes: ['vso.code', 'vso.identity', 'vso.project', 'vso.profile', 'vso.work'],\n\t},\n\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer]: {\n\t\tsupportsIssueStates: true,\n\t\tdomain: '',\n\t\tid: GitSelfManagedHostIntegrationId.AzureDevOpsServer,\n\t\tname: 'Azure DevOps Server',\n\t\ttype: 'git',\n\t\ticonKey: GitCloudHostIntegrationId.AzureDevOps,\n\t\tissuesPagingMode: PagingMode.Project,\n\t\tpullRequestsPagingMode: PagingMode.Repo,\n\t\t// Use 'id' property on account for PR filters (reviewer filter keyed by account id / reviewerId)\n\t\tsupportedPullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\tsupportedAccountWidePullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\t// Use 'name' property on account for issue filters\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// The account-wide read drains one (project × assignee) and one (project × author) query per project, so\n\t\t// either axis is expressible on its own. There is no mention query to narrow to.\n\t\tsupportedAccountWideIssueFilters: [IssueFilter.Author, IssueFilter.Assignee],\n\t\t// Both reads emit the same WIQL, but the account-wide one drains every (project x relationship) query and\n\t\t// merges the results, so it can only honor keys a normalized issue carries — `resolved` and `priority` are\n\t\t// dropped from that surface for the same reason they are dropped from GitLab's.\n\t\tsupportedIssueSorts: azureIssueSorts,\n\t\tsupportedAccountWideIssueSorts: azureAccountWideIssueSorts,\n\t\tsupportedPullRequestSearch: azureServerPullRequestSearchCapabilities,\n\t\tsupportedIssueSearch: azureServerIssueSearchCapabilities,\n\t\tissueSearchResultLimit: azureWorkItemSearchResultLimit,\n\t\texactSearchScopeNames: true,\n\t\tscopes: ['vso.code', 'vso.identity', 'vso.project', 'vso.profile', 'vso.work'],\n\t},\n\t[IssuesCloudHostIntegrationId.Jira]: {\n\t\tdomain: 'atlassian.net',\n\t\tid: IssuesCloudHostIntegrationId.Jira,\n\t\tname: 'Jira',\n\t\ttype: 'issues',\n\t\ticonKey: IssuesCloudHostIntegrationId.Jira,\n\t\tscopes: [\n\t\t\t'read:status:jira',\n\t\t\t'read:application-role:jira',\n\t\t\t'read:attachment:jira',\n\t\t\t'write:attachment:jira',\n\t\t\t'read:comment:jira',\n\t\t\t'read:project-category:jira',\n\t\t\t'read:project:jira',\n\t\t\t'read:issue.vote:jira',\n\t\t\t'read:field-configuration:jira',\n\t\t\t'write:issue:jira',\n\t\t\t'read:issue-security-level:jira',\n\t\t\t'write:issue.property:jira',\n\t\t\t'read:issue.changelog:jira',\n\t\t\t'read:avatar:jira',\n\t\t\t'read:issue-meta:jira',\n\t\t\t'read:permission:jira',\n\t\t\t'offline_access',\n\t\t\t'read:issue:jira',\n\t\t\t'read:me',\n\t\t\t'read:audit-log:jira',\n\t\t\t'read:project.component:jira',\n\t\t\t'read:group:jira',\n\t\t\t'read:project-role:jira',\n\t\t\t'write:comment:jira',\n\t\t\t'read:label:jira',\n\t\t\t'write:comment.property:jira',\n\t\t\t'read:issue-details:jira',\n\t\t\t'read:issue-type-hierarchy:jira',\n\t\t\t'read:issue.transition:jira',\n\t\t\t'read:user:jira',\n\t\t\t'read:field:jira',\n\t\t\t'read:issue-type:jira',\n\t\t\t'read:project.property:jira',\n\t\t\t'read:comment.property:jira',\n\t\t\t'read:project-version:jira',\n\t\t],\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// A tracker's issues live under resource -> project, so it has no account-wide surface to declare: its\n\t\t// capability is reported under `issues`, which is what `listIssueTrackerIssuesPage` validates against.\n\t\tsupportedIssueSorts: jiraIssueSorts,\n\t\t// `statusCategory` clauses in the same JQL, shared with Server through `jiraHelpers`.\n\t\tsupportsIssueStates: true,\n\t},\n\t[IssuesSelfManagedHostIntegrationId.JiraServer]: {\n\t\t// Self-hosted: there is no canonical domain, so every read is addressed by the connection's own host\n\t\t// (see `JiraServerIntegration.apiBaseUrl`), exactly as the self-managed git hosts do.\n\t\tdomain: '',\n\t\tid: IssuesSelfManagedHostIntegrationId.JiraServer,\n\t\tname: 'Jira Data Center',\n\t\ttype: 'issues',\n\t\t// Reuses Jira's glicon: it is the same product, and the id only selects an icon.\n\t\ticonKey: IssuesCloudHostIntegrationId.Jira,\n\t\t// Jira Cloud's entries are Atlassian OAuth scope strings, which a self-hosted instance doesn't issue:\n\t\t// its token is a PAT the backend stores as-is, so there is no scope set to request.\n\t\tscopes: [],\n\t\t// The same JQL clauses Cloud narrows with — `jiraHelpers` builds one query for both.\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// One JQL `ORDER BY` builder serves Cloud and Server, so they share a surface (see `issueSorts.ts`).\n\t\tsupportedIssueSorts: jiraIssueSorts,\n\t\tsupportsIssueStates: true,\n\t},\n\t[IssuesCloudHostIntegrationId.Linear]: {\n\t\tdomain: 'linear.app',\n\t\tid: IssuesCloudHostIntegrationId.Linear,\n\t\tname: 'Linear',\n\t\ttype: 'issues',\n\t\ticonKey: IssuesCloudHostIntegrationId.Linear,\n\t\tscopes: [],\n\t\t// The user-scoped tracker read scopes Linear's \"my issues\" by the viewer's id: assigned issues, plus the\n\t\t// GitHub-synced issues the viewer created unless `Assignee` is asked for by name. Author/mention aren't supported.\n\t\tsupportedIssueFilters: [IssueFilter.Assignee],\n\t\t// Both directions, and one table for both reads: they are the same root `issues` query taking the same\n\t\t// `sort` argument, so there is no account-wide narrowing to declare.\n\t\tsupportedIssueSorts: linearIssueSorts,\n\t\t// A workflow-state type clause on both reads (`completed`/`canceled`/`duplicate` are closed), the same types\n\t\t// the SDK normalizes to a terminal category (`DONE`, or `CANCELED` for the last two).\n\t\tsupportsIssueStates: true,\n\t},\n\t[IssuesCloudHostIntegrationId.Trello]: {\n\t\tdomain: 'trello.com',\n\t\tid: IssuesCloudHostIntegrationId.Trello,\n\t\tname: 'Trello',\n\t\ttype: 'issues',\n\t\ticonKey: IssuesCloudHostIntegrationId.Trello,\n\t\tscopes: [],\n\t\t// Trello cards are filtered by the assignee (member) only; author/mention have no Trello equivalent.\n\t\tsupportedIssueFilters: [IssueFilter.Assignee],\n\t\t// `sort:edited` / `sort:-edited`. Trello's other search sorts (`created`, `due`) have no card-order effect.\n\t\tsupportedIssueSorts: trelloIssueSorts,\n\t\t// No `supportsIssueStates`: a card has no state beyond being archived, and the board read always sends\n\t\t// `-is:archived`, so `'closed'`/`'all'` are refused rather than answered with the open cards.\n\t},\n\t[IssuesCloudHostIntegrationId.Asana]: {\n\t\tdomain: 'app.asana.com',\n\t\tid: IssuesCloudHostIntegrationId.Asana,\n\t\tname: 'Asana',\n\t\ttype: 'issues',\n\t\ticonKey: IssuesCloudHostIntegrationId.Asana,\n\t\tscopes: [],\n\t\t// A task has a single assignee and no author/mention query; the project read is narrowed to the viewer by\n\t\t// assignee id after the drain, since Asana's task list can't scope a project to an assignee.\n\t\tsupportedIssueFilters: [IssueFilter.Assignee],\n\t\t// Empty: Asana's task list has no ordering parameter, so a read carrying `sort` is refused rather than served in\n\t\t// whatever order Asana returns.\n\t\tsupportedIssueSorts: asanaIssueSorts,\n\t\t// Completion is the only state Asana has: open reads incomplete tasks, closed the completed ones.\n\t\tsupportsIssueStates: true,\n\t},\n};\n\nexport function isGitHubDotCom(domain: string | null | undefined): boolean {\n\treturn equalsIgnoreCase(domain, 'github.com');\n}\n\nexport function isGitLabDotCom(domain: string | null | undefined): boolean {\n\treturn equalsIgnoreCase(domain, 'gitlab.com');\n}\n\n// Anchor the `visualstudio.com` alternative on a label boundary (`^` or `.`) rather than `\\b`: `\\b` treats a\n// hyphen as a word boundary, so `\\bvisualstudio\\.com$` matched attacker-controlled hosts like\n// `evil-visualstudio.com` and classified them as Azure cloud, changing their auth/URL handling.\nconst azureCloudDomainRegex = /^dev\\.azure\\.com$|(?:^|\\.)visualstudio\\.com$/i;\nexport function isAzureCloudDomain(domain: string | undefined): boolean {\n\treturn domain != null && azureCloudDomainRegex.test(domain);\n}\n\nconst bitbucketCloudDomainRegex = /^bitbucket\\.org$/i;\nexport function isBitbucketCloudDomain(domain: string | undefined): boolean {\n\treturn domain != null && bitbucketCloudDomainRegex.test(domain);\n}\n\nexport function supportsCodeSuggest(provider: ProviderReference): boolean {\n\treturn isGitHubDotCom(provider.domain);\n}\n"],"mappings":";;;;;;;;AAyCA,IAAY,aAAL,yBAAA,YAAA;CACN,WAAA,aAAA;CACA,WAAA,UAAA;CACA,WAAA,WAAA;;AACD,EAAA,CAAA,CAAA;;;;;;;;;AA8HA,MAAM,gCAAyD;CAE9D,eAAe;EAAC;EAAY;EAAY;EAAa;EAAgB;CAAY;CACjF,MAAM;CACN,QAAQ;CACR,WAAW;CACX,cAAc;CACd,cAAc;CAEd,0BAA0B;CAE1B,QAAQ;CAER,OAAO;AACR;;AAcA,MAAM,sCAAqE;CAC1E,eAAe;;;;;;CAMf;CACA,QAAQ;EAAC;EAAQ;EAAU;EAAU;CAAK;CAC1C,MAAM;CACN,cAAc;CACd,cAAc;CACd,iBAAiB;CACjB,OAAO;CACP,iBAAiB;CACjB,mBAAmB;CAEnB,OAAO;EApB8C;EAAgB;EAAe;EAAgB;CAoBxE;AAC7B;;;;;;;;;;;;AAaA,MAAM,+CAA8E;CACnF,eAAe;;;;CAAwF;CACvG,QAAQ;EAAC;EAAQ;EAAU;EAAU;CAAK;CAC1C,MAAM;CACN,cAAc;CACd,cAAc;CACd,iBAAiB;CACjB,OAAO;CACP,iBAAiB;CACjB,mBAAmB;CACnB,OAAO,CAAC,gBAAgB,aAAa;AACtC;;;;;;;;;;;;AAaA,MAAM,2CAA0E;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AAKA,MAAM,wBAAwB;AAC9B,SAAgB,mBAAmB,QAAqC;CACvE,OAAO,UAAU,QAAQ,sBAAsB,KAAK,MAAM;AAC3D;AAEA,MAAM,4BAA4B;AAClC,SAAgB,uBAAuB,QAAqC;CAC3E,OAAO,UAAU,QAAQ,0BAA0B,KAAK,MAAM;AAC/D;AAEA,SAAgB,oBAAoB,UAAsC;CACzE,OAAO,eAAe,SAAS,MAAM;AACtC"}
1
+ {"version":3,"file":"metadata.js","names":[],"sources":["../../../../../plus/integrations/src/providers/metadata.ts"],"sourcesContent":["import { githubSearchResultLimit } from '@gitlens/git-github/api/config.js';\nimport type { ProviderReference } from '@gitlens/git/models/remoteProvider.js';\nimport { equalsIgnoreCase } from '@gitlens/utils/string.js';\nimport type { IntegrationIds } from '../constants.js';\nimport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n} from '../constants.js';\nimport type { IntegrationType } from '../models/publicIntegration.js';\nimport type {\n\tIssueSearchCapabilities,\n\tIssueSorting,\n\tPullRequestSearchCapabilities,\n\tPullRequestSorting,\n} from '../providerFilters.js';\nimport { IssueFilter, PullRequestFilter } from '../providerFilters.js';\nimport {\n\tazurePullRequestSearchSorts,\n\tazureWorkItemSearchRelationships,\n\tazureWorkItemSearchResultLimit,\n\tazureWorkItemSearchSorts,\n} from './azure/search.js';\nimport {\n\tasanaIssueSorts,\n\tazureAccountWideIssueSorts,\n\tazureIssueSorts,\n\tgithubAccountWideIssueSorts,\n\tgithubIssueSorts,\n\tgitlabAccountWideIssueSorts,\n\tgitlabIssueSorts,\n\tjiraIssueSorts,\n\tlinearIssueSorts,\n\ttrelloIssueSorts,\n} from './issueSorts.js';\n\n// Provider metadata (names, domains, icons, scopes, capabilities) and the domain checks built on it. Kept apart from\n// `models.ts`, which holds the `@gitkraken/provider-apis` mappings, so the public facade can re-export this without\n// its declarations reaching the SDK.\n\nexport enum PagingMode {\n\tProject = 'project',\n\tRepo = 'repo',\n\tRepos = 'repos',\n}\n\nexport interface ProviderMetadata {\n\tdomain: string;\n\tid: IntegrationIds;\n\tname: string;\n\ttype: IntegrationType;\n\t/** Key for the `gl-provider-<iconKey>` glicon. Cloud self-managed variants reuse the base\n\t * `'github-enterprise'`/`'gitlab-self-hosted'` icon (no enum member exists for those anymore). */\n\ticonKey: string;\n\tissuesPagingMode?: PagingMode;\n\tpullRequestsPagingMode?: PagingMode;\n\tscopes: string[];\n\tsupportedPullRequestFilters?: PullRequestFilter[];\n\t/**\n\t * Relationship filters the ACCOUNT-WIDE pull-request read can express as an exact OR union.\n\t * This is independent from `supportedPullRequestFilters`, which describes repo-scoped reads.\n\t */\n\tsupportedAccountWidePullRequestFilters?: PullRequestFilter[];\n\t/**\n\t * What the filtered pull-request search can express server-side. Absent means the provider has\n\t * no such search and the facade refuses it rather than returning an unfiltered page.\n\t */\n\tsupportedPullRequestSearch?: PullRequestSearchCapabilities;\n\t/**\n\t * Maximum results the provider will serve for one pull-request search facet. Matches beyond it are unreachable\n\t * and are reported as a succeeded omission carrying this limit plus the provider's pre-ceiling facet count.\n\t */\n\tpullRequestSearchResultLimit?: number;\n\t/** Filters the REPO-scoped issue read can express. */\n\tsupportedIssueFilters?: IssueFilter[];\n\t/**\n\t * Filters the ACCOUNT-WIDE issue read can express, which is NOT the same set as\n\t * {@link ProviderMetadata.supportedIssueFilters}: the two reads are different provider queries.\n\t *\n\t * Unfiltered, each provider's account-wide read is that provider's own definition of \"my issues\" — GitHub/GHE\n\t * union authored + assigned + mentioned, Azure drains assigned + authored, and GitLab reads assigned-to-me.\n\t * A consumer replacing a narrower tool (`gk`'s `assignee:@me`) must select the `Assignee` filter wherever the\n\t * provider's default is wider.\n\t *\n\t * A filter listed here narrows that read server-side. Absent/empty means the read can't be narrowed at all,\n\t * so the facade refuses a filtered request rather than serving the unnarrowed union as if it had been\n\t * filtered. GitLab lists `Assignee` and `Author` because the SDK's account-wide input exposes both username\n\t * axes; it omits `Mention` because that REST read has no first-class mention filter.\n\t */\n\tsupportedAccountWideIssueFilters?: IssueFilter[];\n\t/**\n\t * Sort keys the REPO-scoped issue read can express server-side — and, for an issue tracker (Jira/Linear/Trello),\n\t * its project-scoped read, which is the only issue surface a tracker has.\n\t *\n\t * Absent/empty means the read can't be ordered at all, so a request carrying `sort` is refused rather than\n\t * served in whatever order the provider felt like. Present, it is a promise: every key here reaches the\n\t * provider query.\n\t *\n\t * A key listed here is expressible on ONE provider query, which is what this read is when it is given ONE\n\t * scope. Given several (GitLab across repositories, Azure across projects, a tracker across projects) it merges\n\t * their results here and can only honor a key a normalized issue carries, so it additionally refuses\n\t * `priority`/`dueDate`/`resolved` — see `getIssueComparator`. That depends on the caller's scope count rather\n\t * than on the provider, which is why it is a runtime refusal and not a fourth table: encoding it here would\n\t * under-report the single-scope read, which really does support those keys.\n\t */\n\tsupportedIssueSorts?: IssueSorting[];\n\t/**\n\t * Sort keys the ACCOUNT-WIDE issue read can express server-side, which is NOT the same set as\n\t * {@link ProviderMetadata.supportedIssueSorts} — for GitLab the two reads are different APIs (GraphQL vs REST)\n\t * with genuinely different vocabularies, not one narrowed twice.\n\t *\n\t * Absent means the account-wide read can't be ordered (or doesn't exist). An issue tracker leaves this empty\n\t * and reports under `supportedIssueSorts`, so reading a tracker's capability from here under-reports it.\n\t *\n\t * Unlike {@link ProviderMetadata.supportedIssueSorts} this needs no companion runtime refusal, because every\n\t * provider's account-wide read is a union of several queries with no scope count for a caller to reduce: it\n\t * ALWAYS merges. So the keys a merge can't order by are simply absent here — the table states what the read can\n\t * honor, which is what makes intersecting against it sufficient.\n\t */\n\tsupportedAccountWideIssueSorts?: IssueSorting[];\n\t/**\n\t * Whether issue list reads (including Azure project/repository and account-wide reads) can be asked for a `state` other than open, and honor it server-side.\n\t *\n\t * A tracker read is open-only unless asked otherwise, so absent does not mean the read returns every state: it\n\t * means only `'open'` is expressible, and `'closed'`/`'all'` are refused rather than served as the open list.\n\t * Server-side, because each read drains to a page backstop: dropping states afterwards would let a project full\n\t * of done work spend that budget before reaching the open issues.\n\t */\n\tsupportsIssueStates?: boolean;\n\t/**\n\t * What the provider's FILTERED issue search (`searchIssuesPage`, and the `countIssues` probe over the same\n\t * criteria) can express server-side. A third, wider surface than either filter set above: it is not bound to\n\t * the user at all, so it takes relationships those reads have no way to name (`any-assignee`, `unassigned`),\n\t * plus free text and issue attributes.\n\t *\n\t * Absent means the provider has NO filtered issue search and the read is refused. Present, it is a promise:\n\t * every field declared here reaches the provider query, so a consumer that intersects against it never has a\n\t * read refused, and a criterion is never silently ignored.\n\t */\n\tsupportedIssueSearch?: IssueSearchCapabilities;\n\t/**\n\t * The maximum number of results the provider's filtered issue search will serve for ONE query, however it is\n\t * paged. Matches past it are UNREACHABLE, not merely unfetched, which is why a read that hits this reports an\n\t * omission with `recovery: 'none'` and the total match count rather than offering a \"load more\".\n\t *\n\t * Absent means the provider declares no ceiling, in which case a truncated read falls back to generic wording\n\t * instead of quoting a limit that was never published.\n\t */\n\tissueSearchResultLimit?: number;\n\t/**\n\t * Whether the filtered searches reach the provider with scope names verbatim — as encoded URL segments, or\n\t * matched against the names discovery reported — rather than inside a query string the provider sanitizes.\n\t *\n\t * Relaxes the scope-name rule (`isUsableSearchScopeName`) for that provider to refuse only blank names and\n\t * control characters: a space or a quote can't split or alter a scope that is never parsed as a query, and\n\t * refusing them would refuse real names. Absent for a query-string search (GitHub's), where both do.\n\t */\n\texactSearchScopeNames?: boolean;\n}\n\nexport type ProvidersMetadata = { [Id in IntegrationIds]: ProviderMetadata & { id: Id } };\n\n/**\n * GitHub and GitHub Enterprise express every criterion as a search qualifier on the same GraphQL `search` field,\n * so the two share one declaration — a GHE instance running the same search syntax has the same capability, and\n * two copies of this table would be free to drift.\n *\n * Every entry is a claim the implementation must keep: `searchIssuesPage` emits a qualifier for each of these,\n * and a test asserts that (see the `issueSearch` capability tests) so the table can't quietly outrun the code.\n */\nconst githubIssueSearchCapabilities: IssueSearchCapabilities = {\n\t// `author:@me` / `assignee:@me` / `mentions:@me` / `assignee:*` / `no:assignee`, each its own aliased search.\n\trelationships: ['authored', 'assigned', 'mentioned', 'any-assignee', 'unassigned'],\n\ttext: true,\n\tlabels: true,\n\tmilestone: true,\n\tupdatedAfter: true,\n\tcreatedAfter: true,\n\t// `-linked:pr`.\n\twithoutLinkedPullRequest: true,\n\t// `is:open` / `is:closed`, or neither for all states.\n\tstates: true,\n\t// `sort:created-desc`, `sort:updated`, `sort:comments-asc`, … — see `githubIssueSorts`.\n\tsorts: githubIssueSorts,\n};\n\n/**\n * The ordering vocabulary of GitHub's filtered PR search: `created` and `updated`, both directions.\n *\n * Hand-declared rather than derived from `@gitkraken/provider-apis` (which has no PR-sort surface), and narrower\n * than the issue set on purpose: the merged relationship × state facets can only be re-ordered by a field a\n * `PullRequestShape` carries (see `getPullRequestComparator`), and GitHub PRs have no priority and no relevance\n * that orders stably under the result ceiling. A parity test pins this to `gitHubPullRequestSortQualifiers`' keys\n * so the capability can't outrun the emitter.\n */\nconst githubPullRequestSorts: PullRequestSorting[] = ['updated:desc', 'updated:asc', 'created:desc', 'created:asc'];\n\n/** GitHub and GHE use the same filtered pull-request search syntax and result ceiling. */\nconst githubPullRequestSearchCapabilities: PullRequestSearchCapabilities = {\n\trelationships: [\n\t\tPullRequestFilter.Author,\n\t\tPullRequestFilter.Assignee,\n\t\tPullRequestFilter.ReviewRequested,\n\t\tPullRequestFilter.Reviewed,\n\t\tPullRequestFilter.Mention,\n\t],\n\tstates: ['open', 'closed', 'merged', 'all'],\n\ttext: true,\n\tupdatedAfter: true,\n\tcreatedAfter: true,\n\tincludeArchived: true,\n\tdraft: true,\n\trepositoryScope: true,\n\torganizationScope: true,\n\t// `sort:updated`, `sort:updated-asc`, `sort:created-desc`, `sort:created-asc` — see `githubPullRequestSorts`.\n\tsorts: githubPullRequestSorts,\n\tchangedSince: true,\n};\n\n/**\n * Bitbucket Data Center's filtered pull-request search (`bitbucket-server/pullRequestSearch.ts`), declared from what\n * its REST API can express rather than from what a PR shape carries:\n * - relationships: `role=AUTHOR`, and a reviewer's `UNAPPROVED` status for a pending review versus `APPROVED` or\n * `NEEDS_WORK` for one already given. A Bitbucket pull request has no assignee, and nothing filters by mention.\n * - text is `filterText` (title or description), draft is `draft`, and archived repositories are excluded unless\n * asked for — all re-checked on each row, since the dashboard read has neither filter.\n * - no date filters and no `created` ordering: `order` is only `NEWEST`/`OLDEST` by last update, and filtering a\n * date on the rows read would page through everything before it.\n * - no organization scope: there is no project-wide pull-request list, only per repository and the dashboard.\n */\nconst bitbucketServerPullRequestSearchCapabilities: PullRequestSearchCapabilities = {\n\trelationships: [PullRequestFilter.Author, PullRequestFilter.ReviewRequested, PullRequestFilter.Reviewed],\n\tstates: ['open', 'closed', 'merged', 'all'],\n\ttext: true,\n\tupdatedAfter: false,\n\tcreatedAfter: false,\n\tincludeArchived: true,\n\tdraft: true,\n\trepositoryScope: true,\n\torganizationScope: false,\n\tsorts: ['updated:desc', 'updated:asc'],\n\tchangedSince: false,\n};\n\n/**\n * Azure DevOps Server's filtered pull-request search. Azure's pull request query narrows only by creator, reviewer,\n * status and repository, so the provider drains each facet and applies text, draft and dates to the complete facet\n * before merging — so a criterion never narrows a page after its count, and the only sort keys are the two a merged\n * page can be re-ordered by. What text and `updatedAfter` match is bounded by the list endpoint: see\n * `toAzurePullRequestSearchFilter`.\n *\n * `Assignee` and `ReviewRequested` both read by reviewer: Azure has no assignee distinct from its reviewers.\n * `Reviewed` and `Mention` are absent because the pull request query has no axis for either, and `includeArchived`\n * because Azure has no archived repositories to exclude.\n */\nconst azureServerPullRequestSearchCapabilities: PullRequestSearchCapabilities = {\n\trelationships: [PullRequestFilter.Author, PullRequestFilter.Assignee, PullRequestFilter.ReviewRequested],\n\tstates: ['open', 'closed', 'merged', 'all'],\n\ttext: true,\n\tupdatedAfter: true,\n\tcreatedAfter: true,\n\tincludeArchived: false,\n\tdraft: true,\n\trepositoryScope: true,\n\torganizationScope: true,\n\tsorts: azurePullRequestSearchSorts,\n\tchangedSince: false,\n};\n\n/**\n * Azure DevOps Server's filtered work-item search: one WIQL query per collection, every criterion a clause of it.\n * `mentioned` is absent because `@RecentMentions` only reaches back 30 days; `milestone` and\n * `withoutLinkedPullRequest` because WIQL has no flat-query clause for either. See `azure/search.ts`.\n */\nconst azureServerIssueSearchCapabilities: IssueSearchCapabilities = {\n\trelationships: azureWorkItemSearchRelationships,\n\ttext: true,\n\tlabels: true,\n\tmilestone: false,\n\tupdatedAfter: true,\n\tcreatedAfter: true,\n\twithoutLinkedPullRequest: false,\n\tstates: true,\n\tsorts: azureWorkItemSearchSorts,\n};\n\nexport const providersMetadata: ProvidersMetadata = {\n\t[GitCloudHostIntegrationId.GitHub]: {\n\t\tdomain: 'github.com',\n\t\tid: GitCloudHostIntegrationId.GitHub,\n\t\tname: 'GitHub',\n\t\ttype: 'git',\n\t\ticonKey: GitCloudHostIntegrationId.GitHub,\n\t\tissuesPagingMode: PagingMode.Repos,\n\t\tpullRequestsPagingMode: PagingMode.Repos,\n\t\t// Use 'username' property on account for PR filters\n\t\tsupportedPullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t\tPullRequestFilter.Mention,\n\t\t],\n\t\tsupportedAccountWidePullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t\tPullRequestFilter.Reviewed,\n\t\t\tPullRequestFilter.Mention,\n\t\t],\n\t\tsupportedPullRequestSearch: githubPullRequestSearchCapabilities,\n\t\tpullRequestSearchResultLimit: githubSearchResultLimit,\n\t\t// Use 'username' property on account for issue filters\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// The account-wide read is three independent searches (`author:@me`, `assignee:@me`, `mentions:@me`) behind\n\t\t// one composite cursor, so any subset of them is expressible.\n\t\tsupportedAccountWideIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// One `search` field serves all three issue reads (repo-scoped, account-wide, filtered search), so the same\n\t\t// qualifiers are expressible on each — the account-wide one narrowed to what its three-alias merge can order.\n\t\tsupportedIssueSorts: githubIssueSorts,\n\t\tsupportedAccountWideIssueSorts: githubAccountWideIssueSorts,\n\t\tsupportedIssueSearch: githubIssueSearchCapabilities,\n\t\tissueSearchResultLimit: githubSearchResultLimit,\n\t\tscopes: ['repo', 'read:user', 'user:email'],\n\t},\n\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise]: {\n\t\tdomain: '',\n\t\tid: GitSelfManagedHostIntegrationId.CloudGitHubEnterprise,\n\t\tname: 'GitHub Enterprise',\n\t\ttype: 'git',\n\t\ticonKey: 'github-enterprise',\n\t\tissuesPagingMode: PagingMode.Repos,\n\t\tpullRequestsPagingMode: PagingMode.Repos,\n\t\t// Use 'username' property on account for PR filters\n\t\tsupportedPullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t\tPullRequestFilter.Mention,\n\t\t],\n\t\tsupportedAccountWidePullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t\tPullRequestFilter.Reviewed,\n\t\t\tPullRequestFilter.Mention,\n\t\t],\n\t\tsupportedPullRequestSearch: githubPullRequestSearchCapabilities,\n\t\tpullRequestSearchResultLimit: githubSearchResultLimit,\n\t\t// Use 'username' property on account for issue filters\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// The account-wide read is three independent searches (`author:@me`, `assignee:@me`, `mentions:@me`) behind\n\t\t// one composite cursor, so any subset of them is expressible.\n\t\tsupportedAccountWideIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// One `search` field serves all three issue reads (repo-scoped, account-wide, filtered search), so the same\n\t\t// qualifiers are expressible on each — the account-wide one narrowed to what its three-alias merge can order.\n\t\tsupportedIssueSorts: githubIssueSorts,\n\t\tsupportedAccountWideIssueSorts: githubAccountWideIssueSorts,\n\t\tsupportedIssueSearch: githubIssueSearchCapabilities,\n\t\tissueSearchResultLimit: githubSearchResultLimit,\n\t\tscopes: ['repo', 'read:user', 'user:email'],\n\t},\n\t[GitCloudHostIntegrationId.GitLab]: {\n\t\tdomain: 'gitlab.com',\n\t\tid: GitCloudHostIntegrationId.GitLab,\n\t\tname: 'GitLab',\n\t\ttype: 'git',\n\t\ticonKey: GitCloudHostIntegrationId.GitLab,\n\t\tissuesPagingMode: PagingMode.Repo,\n\t\tpullRequestsPagingMode: PagingMode.Repo,\n\t\t// Use 'username' property on account for PR filters\n\t\tsupportedPullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\tsupportedAccountWidePullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\t// Use 'username' property on account for issue filters\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee],\n\t\t// The account-wide read drains one `scope=assigned_to_me` pass and one `scope=all` + `authorUsername` pass,\n\t\t// unioned, so either axis is expressible on its own. Mention is absent because GitLab's REST issue read has\n\t\t// no first-class mention filter to narrow with.\n\t\tsupportedAccountWideIssueFilters: [IssueFilter.Assignee, IssueFilter.Author],\n\t\t// Two different surfaces, not one narrowed twice: the repository-scoped read is GraphQL and the\n\t\t// account-wide one is REST, and REST has neither `title` nor `closed_at`.\n\t\tsupportedIssueSorts: gitlabIssueSorts,\n\t\tsupportedAccountWideIssueSorts: gitlabAccountWideIssueSorts,\n\t\tscopes: ['api', 'read_user', 'read_repository'],\n\t},\n\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted]: {\n\t\tdomain: '',\n\t\tid: GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted,\n\t\tname: 'GitLab Self-Hosted',\n\t\ttype: 'git',\n\t\ticonKey: 'gitlab-self-hosted',\n\t\tissuesPagingMode: PagingMode.Repo,\n\t\tpullRequestsPagingMode: PagingMode.Repo,\n\t\t// Use 'username' property on account for PR filters\n\t\tsupportedPullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\tsupportedAccountWidePullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\t// Use 'username' property on account for issue filters\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee],\n\t\t// The account-wide read drains one `scope=assigned_to_me` pass and one `scope=all` + `authorUsername` pass,\n\t\t// unioned, so either axis is expressible on its own. Mention is absent because GitLab's REST issue read has\n\t\t// no first-class mention filter to narrow with.\n\t\tsupportedAccountWideIssueFilters: [IssueFilter.Assignee, IssueFilter.Author],\n\t\t// Two different surfaces, not one narrowed twice: the repository-scoped read is GraphQL and the\n\t\t// account-wide one is REST, and REST has neither `title` nor `closed_at`.\n\t\tsupportedIssueSorts: gitlabIssueSorts,\n\t\tsupportedAccountWideIssueSorts: gitlabAccountWideIssueSorts,\n\t\tscopes: ['api', 'read_user', 'read_repository'],\n\t},\n\t[GitCloudHostIntegrationId.Bitbucket]: {\n\t\tdomain: 'bitbucket.org',\n\t\tid: GitCloudHostIntegrationId.Bitbucket,\n\t\tname: 'Bitbucket',\n\t\ttype: 'git',\n\t\ticonKey: GitCloudHostIntegrationId.Bitbucket,\n\t\tpullRequestsPagingMode: PagingMode.Repo,\n\t\t// Use 'id' property on account for PR filters (reviewer filter keyed by account id / reviewerId)\n\t\tsupportedPullRequestFilters: [PullRequestFilter.Author, PullRequestFilter.ReviewRequested],\n\t\tsupportedAccountWidePullRequestFilters: [PullRequestFilter.Author, PullRequestFilter.ReviewRequested],\n\t\tscopes: ['account:read', 'repository:read', 'pullrequest:read', 'issue:read'],\n\t},\n\t[GitSelfManagedHostIntegrationId.BitbucketServer]: {\n\t\tdomain: '',\n\t\tid: GitSelfManagedHostIntegrationId.BitbucketServer,\n\t\tname: 'Bitbucket Data Center',\n\t\ttype: 'git',\n\t\ticonKey: GitSelfManagedHostIntegrationId.BitbucketServer,\n\t\tpullRequestsPagingMode: PagingMode.Repo,\n\t\tsupportedPullRequestFilters: [PullRequestFilter.Author, PullRequestFilter.ReviewRequested],\n\t\tsupportedAccountWidePullRequestFilters: [PullRequestFilter.Author, PullRequestFilter.ReviewRequested],\n\t\tsupportedPullRequestSearch: bitbucketServerPullRequestSearchCapabilities,\n\t\t// No `pullRequestSearchResultLimit`: nothing caps how far a search pages.\n\t\tscopes: ['Project (Read)', 'Repository (Write)'],\n\t},\n\t[GitCloudHostIntegrationId.AzureDevOps]: {\n\t\tsupportsIssueStates: true,\n\t\tdomain: 'dev.azure.com',\n\t\tid: GitCloudHostIntegrationId.AzureDevOps,\n\t\tname: 'Azure DevOps',\n\t\ttype: 'git',\n\t\ticonKey: GitCloudHostIntegrationId.AzureDevOps,\n\t\tissuesPagingMode: PagingMode.Project,\n\t\tpullRequestsPagingMode: PagingMode.Repo,\n\t\t// Use 'id' property on account for PR filters (reviewer filter keyed by account id / reviewerId)\n\t\tsupportedPullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\tsupportedAccountWidePullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\t// Use 'name' property on account for issue filters\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// The account-wide read drains one (project × assignee) and one (project × author) query per project, so\n\t\t// either axis is expressible on its own. There is no mention query to narrow to.\n\t\tsupportedAccountWideIssueFilters: [IssueFilter.Author, IssueFilter.Assignee],\n\t\t// Both reads emit the same WIQL, but the account-wide one drains every (project x relationship) query and\n\t\t// merges the results, so it can only honor keys a normalized issue carries — `resolved` and `priority` are\n\t\t// dropped from that surface for the same reason they are dropped from GitLab's.\n\t\tsupportedIssueSorts: azureIssueSorts,\n\t\tsupportedAccountWideIssueSorts: azureAccountWideIssueSorts,\n\t\tscopes: ['vso.code', 'vso.identity', 'vso.project', 'vso.profile', 'vso.work'],\n\t},\n\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer]: {\n\t\tsupportsIssueStates: true,\n\t\tdomain: '',\n\t\tid: GitSelfManagedHostIntegrationId.AzureDevOpsServer,\n\t\tname: 'Azure DevOps Server',\n\t\ttype: 'git',\n\t\ticonKey: GitCloudHostIntegrationId.AzureDevOps,\n\t\tissuesPagingMode: PagingMode.Project,\n\t\tpullRequestsPagingMode: PagingMode.Repo,\n\t\t// Use 'id' property on account for PR filters (reviewer filter keyed by account id / reviewerId)\n\t\tsupportedPullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\tsupportedAccountWidePullRequestFilters: [\n\t\t\tPullRequestFilter.Author,\n\t\t\tPullRequestFilter.Assignee,\n\t\t\tPullRequestFilter.ReviewRequested,\n\t\t],\n\t\t// Use 'name' property on account for issue filters\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// The account-wide read drains one (project × assignee) and one (project × author) query per project, so\n\t\t// either axis is expressible on its own. There is no mention query to narrow to.\n\t\tsupportedAccountWideIssueFilters: [IssueFilter.Author, IssueFilter.Assignee],\n\t\t// Both reads emit the same WIQL, but the account-wide one drains every (project x relationship) query and\n\t\t// merges the results, so it can only honor keys a normalized issue carries — `resolved` and `priority` are\n\t\t// dropped from that surface for the same reason they are dropped from GitLab's.\n\t\tsupportedIssueSorts: azureIssueSorts,\n\t\tsupportedAccountWideIssueSorts: azureAccountWideIssueSorts,\n\t\tsupportedPullRequestSearch: azureServerPullRequestSearchCapabilities,\n\t\tsupportedIssueSearch: azureServerIssueSearchCapabilities,\n\t\tissueSearchResultLimit: azureWorkItemSearchResultLimit,\n\t\texactSearchScopeNames: true,\n\t\tscopes: ['vso.code', 'vso.identity', 'vso.project', 'vso.profile', 'vso.work'],\n\t},\n\t[IssuesCloudHostIntegrationId.Jira]: {\n\t\tdomain: 'atlassian.net',\n\t\tid: IssuesCloudHostIntegrationId.Jira,\n\t\tname: 'Jira',\n\t\ttype: 'issues',\n\t\ticonKey: IssuesCloudHostIntegrationId.Jira,\n\t\tscopes: [\n\t\t\t'read:status:jira',\n\t\t\t'read:application-role:jira',\n\t\t\t'read:attachment:jira',\n\t\t\t'write:attachment:jira',\n\t\t\t'read:comment:jira',\n\t\t\t'read:project-category:jira',\n\t\t\t'read:project:jira',\n\t\t\t'read:issue.vote:jira',\n\t\t\t'read:field-configuration:jira',\n\t\t\t'write:issue:jira',\n\t\t\t'read:issue-security-level:jira',\n\t\t\t'write:issue.property:jira',\n\t\t\t'read:issue.changelog:jira',\n\t\t\t'read:avatar:jira',\n\t\t\t'read:issue-meta:jira',\n\t\t\t'read:permission:jira',\n\t\t\t'offline_access',\n\t\t\t'read:issue:jira',\n\t\t\t'read:me',\n\t\t\t'read:audit-log:jira',\n\t\t\t'read:project.component:jira',\n\t\t\t'read:group:jira',\n\t\t\t'read:project-role:jira',\n\t\t\t'write:comment:jira',\n\t\t\t'read:label:jira',\n\t\t\t'write:comment.property:jira',\n\t\t\t'read:issue-details:jira',\n\t\t\t'read:issue-type-hierarchy:jira',\n\t\t\t'read:issue.transition:jira',\n\t\t\t'read:user:jira',\n\t\t\t'read:field:jira',\n\t\t\t'read:issue-type:jira',\n\t\t\t'read:project.property:jira',\n\t\t\t'read:comment.property:jira',\n\t\t\t'read:project-version:jira',\n\t\t],\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// A tracker's issues live under resource -> project, so it has no account-wide surface to declare: its\n\t\t// capability is reported under `issues`, which is what `listIssueTrackerIssuesPage` validates against.\n\t\tsupportedIssueSorts: jiraIssueSorts,\n\t\t// `statusCategory` clauses in the same JQL, shared with Server through `jiraHelpers`.\n\t\tsupportsIssueStates: true,\n\t},\n\t[IssuesSelfManagedHostIntegrationId.JiraServer]: {\n\t\t// Self-hosted: there is no canonical domain, so every read is addressed by the connection's own host\n\t\t// (see `JiraServerIntegration.apiBaseUrl`), exactly as the self-managed git hosts do.\n\t\tdomain: '',\n\t\tid: IssuesSelfManagedHostIntegrationId.JiraServer,\n\t\tname: 'Jira Data Center',\n\t\ttype: 'issues',\n\t\t// Reuses Jira's glicon: it is the same product, and the id only selects an icon.\n\t\ticonKey: IssuesCloudHostIntegrationId.Jira,\n\t\t// Jira Cloud's entries are Atlassian OAuth scope strings, which a self-hosted instance doesn't issue:\n\t\t// its token is a PAT the backend stores as-is, so there is no scope set to request.\n\t\tscopes: [],\n\t\t// The same JQL clauses Cloud narrows with — `jiraHelpers` builds one query for both.\n\t\tsupportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],\n\t\t// One JQL `ORDER BY` builder serves Cloud and Server, so they share a surface (see `issueSorts.ts`).\n\t\tsupportedIssueSorts: jiraIssueSorts,\n\t\tsupportsIssueStates: true,\n\t},\n\t[IssuesCloudHostIntegrationId.Linear]: {\n\t\tdomain: 'linear.app',\n\t\tid: IssuesCloudHostIntegrationId.Linear,\n\t\tname: 'Linear',\n\t\ttype: 'issues',\n\t\ticonKey: IssuesCloudHostIntegrationId.Linear,\n\t\tscopes: [],\n\t\t// The user-scoped tracker read scopes Linear's \"my issues\" by the viewer's id: assigned issues, plus the\n\t\t// GitHub-synced issues the viewer created unless `Assignee` is asked for by name. Author/mention aren't supported.\n\t\tsupportedIssueFilters: [IssueFilter.Assignee],\n\t\t// Both directions, and one table for both reads: they are the same root `issues` query taking the same\n\t\t// `sort` argument, so there is no account-wide narrowing to declare.\n\t\tsupportedIssueSorts: linearIssueSorts,\n\t\t// A workflow-state type clause on both reads (`completed`/`canceled`/`duplicate` are closed), the same types\n\t\t// the SDK normalizes to a terminal category (`DONE`, or `CANCELED` for the last two).\n\t\tsupportsIssueStates: true,\n\t},\n\t[IssuesCloudHostIntegrationId.Trello]: {\n\t\tdomain: 'trello.com',\n\t\tid: IssuesCloudHostIntegrationId.Trello,\n\t\tname: 'Trello',\n\t\ttype: 'issues',\n\t\ticonKey: IssuesCloudHostIntegrationId.Trello,\n\t\tscopes: [],\n\t\t// Trello cards are filtered by the assignee (member) only; author/mention have no Trello equivalent.\n\t\tsupportedIssueFilters: [IssueFilter.Assignee],\n\t\t// `sort:edited` / `sort:-edited`. Trello's other search sorts (`created`, `due`) have no card-order effect.\n\t\tsupportedIssueSorts: trelloIssueSorts,\n\t\t// No `supportsIssueStates`: a card has no state beyond being archived, and the board read always sends\n\t\t// `-is:archived`, so `'closed'`/`'all'` are refused rather than answered with the open cards.\n\t},\n\t[IssuesCloudHostIntegrationId.Asana]: {\n\t\tdomain: 'app.asana.com',\n\t\tid: IssuesCloudHostIntegrationId.Asana,\n\t\tname: 'Asana',\n\t\ttype: 'issues',\n\t\ticonKey: IssuesCloudHostIntegrationId.Asana,\n\t\tscopes: [],\n\t\t// A task has a single assignee and no author/mention query; the project read is narrowed to the viewer by\n\t\t// assignee id after the drain, since Asana's task list can't scope a project to an assignee.\n\t\tsupportedIssueFilters: [IssueFilter.Assignee],\n\t\t// Empty: Asana's task list has no ordering parameter, so a read carrying `sort` is refused rather than served in\n\t\t// whatever order Asana returns.\n\t\tsupportedIssueSorts: asanaIssueSorts,\n\t\t// Completion is the only state Asana has: open reads incomplete tasks, closed the completed ones.\n\t\tsupportsIssueStates: true,\n\t},\n};\n\nexport function isGitHubDotCom(domain: string | null | undefined): boolean {\n\treturn equalsIgnoreCase(domain, 'github.com');\n}\n\nexport function isGitLabDotCom(domain: string | null | undefined): boolean {\n\treturn equalsIgnoreCase(domain, 'gitlab.com');\n}\n\n// Anchor the `visualstudio.com` alternative on a label boundary (`^` or `.`) rather than `\\b`: `\\b` treats a\n// hyphen as a word boundary, so `\\bvisualstudio\\.com$` matched attacker-controlled hosts like\n// `evil-visualstudio.com` and classified them as Azure cloud, changing their auth/URL handling.\nconst azureCloudDomainRegex = /^dev\\.azure\\.com$|(?:^|\\.)visualstudio\\.com$/i;\nexport function isAzureCloudDomain(domain: string | undefined): boolean {\n\treturn domain != null && azureCloudDomainRegex.test(domain);\n}\n\nconst bitbucketCloudDomainRegex = /^bitbucket\\.org$/i;\nexport function isBitbucketCloudDomain(domain: string | undefined): boolean {\n\treturn domain != null && bitbucketCloudDomainRegex.test(domain);\n}\n\nexport function supportsCodeSuggest(provider: ProviderReference): boolean {\n\treturn isGitHubDotCom(provider.domain);\n}\n"],"mappings":";;;;;;;;AAyCA,IAAY,aAAL,yBAAA,YAAA;CACN,WAAA,aAAA;CACA,WAAA,UAAA;CACA,WAAA,WAAA;;AACD,EAAA,CAAA,CAAA;;;;;;;;;AA8HA,MAAM,gCAAyD;CAE9D,eAAe;EAAC;EAAY;EAAY;EAAa;EAAgB;CAAY;CACjF,MAAM;CACN,QAAQ;CACR,WAAW;CACX,cAAc;CACd,cAAc;CAEd,0BAA0B;CAE1B,QAAQ;CAER,OAAO;AACR;;AAcA,MAAM,sCAAqE;CAC1E,eAAe;;;;;;CAMf;CACA,QAAQ;EAAC;EAAQ;EAAU;EAAU;CAAK;CAC1C,MAAM;CACN,cAAc;CACd,cAAc;CACd,iBAAiB;CACjB,OAAO;CACP,iBAAiB;CACjB,mBAAmB;CAEnB,OAAO;EApB8C;EAAgB;EAAe;EAAgB;CAoBxE;CAC5B,c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EACsC,UAAA;EACrC,QAAQ;EACR,IAAA;EACA,MAAM;EACN,MAAM;EACN,SAAA;EACA,QAAQ,CAAC;EAGT,uBAAuB,CAAA,UAAqB;EAG5C,qBAAqB;EAErB,qBAAqB;CACtB;AACD;AAEA,SAAgB,eAAe,QAA4C;CAC1E,OAAO,iBAAiB,QAAQ,YAAY;AAC7C;AAEA,SAAgB,eAAe,QAA4C;CAC1E,OAAO,iBAAiB,QAAQ,YAAY;AAC7C;AAKA,MAAM,wBAAwB;AAC9B,SAAgB,mBAAmB,QAAqC;CACvE,OAAO,UAAU,QAAQ,sBAAsB,KAAK,MAAM;AAC3D;AAEA,MAAM,4BAA4B;AAClC,SAAgB,uBAAuB,QAAqC;CAC3E,OAAO,UAAU,QAAQ,0BAA0B,KAAK,MAAM;AAC/D;AAEA,SAAgB,oBAAoB,UAAsC;CACzE,OAAO,eAAe,SAAS,MAAM;AACtC"}
@@ -7,6 +7,7 @@ import { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, Integration
7
7
  import { IssueTrackerWriteConnection } from "../models/issueTrackerWrites.js";
8
8
  import { AzureServerWorkItemWriteScope, AzureServicesWorkItemWriteScope } from "../models/workItemWrites.js";
9
9
  import { AzurePullRequestCreateCapabilityOptions, AzureServerPullRequestWriteScope } from "../models/azurePullRequestWrites.js";
10
+ import { BitbucketPullRequestCreateCapabilityOptions } from "../models/bitbucketPullRequestWrites.js";
10
11
  import { IssueFilter } from "../providerFilters.js";
11
12
  import { ProviderOrganization } from "../results.js";
12
13
  import { ProviderPullRequestCount, ProviderPullRequestSearchPage } from "../models/pullRequestReads.js";
@@ -16,6 +17,8 @@ import { AzureWorkItemDescriptionsCache } from "./azure/workItemDescriptions.js"
16
17
  import { AzurePullRequestWriter } from "./azurePullRequestWrites.js";
17
18
  import { AzureWorkItemWriter } from "./azureWorkItemWrites.js";
18
19
  import { countBitbucketServerPullRequests, searchBitbucketServerPullRequestsPage } from "./bitbucket-server/pullRequestSearch.js";
20
+ import { BitbucketPullRequestWriteLedger } from "./bitbucketPullRequestWriteLedger.js";
21
+ import { BitbucketPullRequestWriter } from "./bitbucketPullRequestWrites.js";
19
22
  import { JiraIssueEtagResponse } from "./jiraIssueByKey.js";
20
23
  import { JiraIssueWriter } from "./jiraIssueWrites.js";
21
24
  import { LinearIssueEtagNode } from "./linearIssuesEtag.js";
@@ -184,6 +187,7 @@ export declare class ProvidersApi implements Disposable {
184
187
  isPAT?: boolean;
185
188
  baseUrl?: string;
186
189
  }): Promise<ProviderAccount | undefined>;
190
+ getBitbucketPullRequestWriter(options: BitbucketPullRequestCreateCapabilityOptions, session: ProviderAuthenticationSession, isSessionCurrent: TrackedSession, ledger: BitbucketPullRequestWriteLedger): Promise<BitbucketPullRequestWriter>;
187
191
  getAzurePullRequestWriter(options: AzurePullRequestCreateCapabilityOptions, session: ProviderAuthenticationSession, isSessionCurrent: () => Promise<boolean>): Promise<AzurePullRequestWriter>;
188
192
  getAzureServerPullRequestWriter(options: AzureServerPullRequestWriteScope, connection: AzureServerWriteConnection): Promise<AzurePullRequestWriter>;
189
193
  getAzureWorkItemWriter(options: AzureServicesWorkItemWriteScope, session: ProviderAuthenticationSession, isSessionCurrent: () => Promise<boolean>): Promise<AzureWorkItemWriter>;
@@ -16,6 +16,8 @@ import { AzureWorkItemStatesCache, getAzureWorkItemTypeStatesUrl, getAzureWorkIt
16
16
  import { AzurePullRequestWriteError } from "./azurePullRequestWriteErrors.js";
17
17
  import { WorkItemWriteNotDispatchedError } from "./azureWorkItemWriteErrors.js";
18
18
  import { AzurePullRequestWriter } from "./azurePullRequestWrites.js";
19
+ import { BitbucketPullRequestWriteError } from "./bitbucketPullRequestWriteErrors.js";
20
+ import { BitbucketPullRequestWriter } from "./bitbucketPullRequestWrites.js";
19
21
  import { requestJiraIssueByKey, requestJiraIssuesEtagFields } from "./jiraIssueByKey.js";
20
22
  import { JiraIssueWriter } from "./jiraIssueWrites.js";
21
23
  import { createProviderApiRequest } from "./providerApiClient.js";
@@ -799,6 +801,9 @@ var ProvidersApi = class {
799
801
  return this.handleProviderError(tokenWithInfo, e);
800
802
  }
801
803
  }
804
+ getBitbucketPullRequestWriter(options, session, isSessionCurrent, ledger) {
805
+ return BitbucketPullRequestWriter.connect((o) => o.method != null && o.method !== "GET" && isSessionCurrent.isRetired() ? Promise.reject(new BitbucketPullRequestWriteError("no-connection")) : this.request(o), session.accessToken, options, isSessionCurrent, ledger);
806
+ }
802
807
  getAzurePullRequestWriter(options, session, isSessionCurrent) {
803
808
  return AzurePullRequestWriter.connect(this.request, {
804
809
  accessToken: session.accessToken,