@gitkraken/core-gitlens 0.9.8 → 0.9.9

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 (30) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/dist/plus/integrations/collectionMetadata.d.ts +7 -0
  3. package/dist/plus/integrations/collectionMetadata.js +11 -1
  4. package/dist/plus/integrations/collectionMetadata.js.map +1 -1
  5. package/dist/plus/integrations/models/issueReads.d.ts +5 -0
  6. package/dist/plus/integrations/models/issuesIntegration.d.ts +37 -1
  7. package/dist/plus/integrations/models/issuesIntegration.js +118 -2
  8. package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
  9. package/dist/plus/integrations/providers/issueSorts.d.ts +0 -1
  10. package/dist/plus/integrations/providers/jira-server.d.ts +8 -1
  11. package/dist/plus/integrations/providers/jira-server.js +90 -138
  12. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  13. package/dist/plus/integrations/providers/jira.d.ts +11 -1
  14. package/dist/plus/integrations/providers/jira.js +88 -122
  15. package/dist/plus/integrations/providers/jira.js.map +1 -1
  16. package/dist/plus/integrations/providers/linear.d.ts +22 -1
  17. package/dist/plus/integrations/providers/linear.js +84 -35
  18. package/dist/plus/integrations/providers/linear.js.map +1 -1
  19. package/dist/plus/integrations/providers/models.d.ts +5 -9
  20. package/dist/plus/integrations/providers/models.js.map +1 -1
  21. package/dist/plus/integrations/providers/providersApi.d.ts +24 -3
  22. package/dist/plus/integrations/providers/providersApi.js +56 -4
  23. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  24. package/dist/plus/integrations/providers/utils/jiraIssueDrains.d.ts +86 -0
  25. package/dist/plus/integrations/providers/utils/jiraIssueDrains.js +139 -0
  26. package/dist/plus/integrations/providers/utils/jiraIssueDrains.js.map +1 -0
  27. package/dist/plus/integrations/reads/drains.d.ts +0 -1
  28. package/dist/plus/integrations/reads/issueTracker.js +20 -9
  29. package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
  30. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"providersApi.js","names":[],"sources":["../../../../../plus/integrations/src/providers/providersApi.ts"],"sourcesContent":["import ProviderApis from '@gitkraken/provider-apis';\nimport type {\n\tCollectionMetadata,\n\tGitIssueState,\n\tGitPullRequestState,\n\tGraphQLError,\n\tGraphQLErrors,\n\tTrelloBoard,\n\tTrelloList,\n} from '@gitkraken/provider-apis';\nimport type { PullRequest, PullRequestMergeMethod } from '@gitlens/git/models/pullRequest.js';\nimport { base64 } from '@gitlens/utils/base64.js';\nimport type { PagedResult } from '@gitlens/utils/paging.js';\nimport type { IntegrationAuthenticationService } from '../authentication/integrationAuthenticationService.js';\nimport type { TokenOptInfo, TokenWithInfo } from '../authentication/models.js';\nimport { toTokenWithInfo } from '../authentication/models.js';\nimport { isIncompleteCollection } from '../collectionMetadata.js';\nimport type { IntegrationIds } from '../constants.js';\nimport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n} from '../constants.js';\nimport { RequestNotFoundError, toError } from '../errors.js';\nimport type { ProviderPullRequestCount, ProviderPullRequestSearchPage } from '../models/pullRequestReads.js';\nimport type { AzurePullRequest, AzureWorkItemResponse } from './azure/models.js';\nimport {\n\tazureWorkItemEtagFieldNames,\n\tencodeAzurePathSegment,\n\tfromAzureWorkItemToProviderIssue,\n} from './azure/models.js';\nimport { requestBitbucketServerProjects, requestBitbucketServerRepositories } from './bitbucket-server/discovery.js';\nimport {\n\tcountBitbucketServerPullRequests,\n\tsearchBitbucketServerPullRequestsPage,\n} from './bitbucket-server/pullRequestSearch.js';\nimport type { JiraIssueEtagResponse } from './jiraIssueByKey.js';\nimport { requestJiraIssueByKey, requestJiraIssuesEtagFields } from './jiraIssueByKey.js';\nimport type { LinearIssueEtagNode } from './linearIssuesEtag.js';\nimport { requestLinearIssuesEtagFields } from './linearIssuesEtag.js';\nimport type {\n\tGetIssueFn,\n\tGetIssuesForReposFn,\n\tGetIssuesOptions,\n\tGetPullRequestsForReposFn,\n\tGetPullRequestsForUserFn,\n\tGetPullRequestsForUserOptions,\n\tGetPullRequestsOptions,\n\tGetReposOptions,\n\tIssueFilter,\n\tIssueSorting,\n\tPageInfo,\n\tPagingInput,\n\tPagingMode,\n\tProviderAccount,\n\tProviderApiCollectionResult,\n\tProviderApiPagedResult,\n\tProviderAzureProject,\n\tProviderAzureResource,\n\tProviderBitbucketResource,\n\tProviderGitHubOrganization,\n\tProviderGitLabGroup,\n\tProviderHierarchyResult,\n\tProviderInfo,\n\tProviderIssue,\n\tProviderJiraProject,\n\tProviderJiraResource,\n\tProviderJiraServerProject,\n\tProviderLinearOrganization,\n\tProviderLinearTeam,\n\tProviderOrganization,\n\tProviderPullRequest,\n\tProviderRepoInput,\n\tProviderReposInput,\n\tProviderRepository,\n\tProviderRequestFunction,\n\tProviderRequestOptions,\n\tProviderRequestResponse,\n\tProviders,\n\tPullRequestFilter,\n} from './models.js';\nimport { isRepoIdsInput, providersMetadata } from './models.js';\nimport {\n\tgetProviderResponseBodyMessage,\n\tisAzureProviderId,\n\tisProviderIssueNotFoundError,\n\tthrowProviderError,\n\tUnexpectedHtmlResponseError,\n} from './providerErrors.js';\nimport {\n\tcollectProviderPagedResult,\n\tmergeCollectionMetadata,\n\tparsePageCursor,\n\ttoPageCursor,\n} from './utils/providerPaging.js';\n\n// `@gitkraken/provider-apis` is published as CommonJS with its factory on the `default` export.\n// How that surfaces depends on the consuming bundler's CJS->ESM interop: esbuild yields the\n// callable factory directly, while webpack and Node surface the module namespace (with the\n// factory under `.default`). Normalize to the callable factory so every consumer resolves it.\ntype ProviderApisFactory = typeof ProviderApis;\nconst createProviderApis: ProviderApisFactory =\n\t(ProviderApis as ProviderApisFactory & { default?: ProviderApisFactory }).default ?? ProviderApis;\n\n// Both GitHub and GitLab `getRepo` throw a missing-repo error whose message is exactly\n// `Repository <x> not found`. Anchoring to that shape (rather than a loose `not found` substring) keeps\n// the message fallbacks from misclassifying unrelated GraphQL/transport failures as a confident negative.\nconst repoNotFoundMessage = /^Repository .+ not found$/i;\n// Duck-typed rather than `ex instanceof GraphQLErrors`, because importing the class as a value makes this\n// module unloadable from plain Node ESM consumers: `@gitkraken/provider-apis` is CommonJS and declares its\n// exports through getters, which Node's `cjs-module-lexer` cannot see, so the only named exports it can\n// synthesize are `default` and `module.exports`. Bundled hosts (webpack/esbuild) bind the named export\n// fine, but the published package keeps third-party deps external, so the named import survives into\n// consumers and breaks linking there. The SDK's constructor always assigns `graphQLErrors` (defaulting to\n// `[]`) and it is the only SDK error carrying that field, so the shape check is unambiguous.\nfunction isGraphQLErrors(ex: unknown): ex is GraphQLErrors {\n\treturn ex instanceof Error && Array.isArray((ex as Partial<GraphQLErrors>).graphQLErrors);\n}\n\n// `handleProviderError` classifies not-found by HTTP status (404/410/422), which only works for the\n// REST `getRepo` clients (Bitbucket, Bitbucket Server, Azure DevOps). GitHub and GitLab `getRepo` are\n// GraphQL: a missing repo comes back as HTTP 200 with a null node, and the SDK throws an unclassified\n// error with no `response.status`, so it would otherwise fall through to the generic error bucket. This\n// detects the SDK's not-found shapes so `getRepo` can rethrow them as `RequestNotFoundError`, keeping the\n// facade's by-type mapping intact.\nfunction isGraphQLRepoNotFoundError(ex: unknown): boolean {\n\t// GitHub throws `GraphQLErrors`. The SDK reports the null repository node with the same\n\t// `Repository <x> not found` message regardless of the underlying cause, so a `FORBIDDEN` or\n\t// `RATE_LIMITED` GraphQL error would also surface with that message. Trust the structured error type\n\t// when entries are present (only `NOT_FOUND` is a real not-found), and fall back to the repo-specific\n\t// message only when there are no entries to disambiguate (a bare null node).\n\tif (isGraphQLErrors(ex)) {\n\t\tconst errors = ex.graphQLErrors;\n\t\t// Scope NOT_FOUND to the `repository` field: `getRepo`'s query only selects that node today, but\n\t\t// were it to grow other selections that can emit NOT_FOUND, an unscoped check would misclassify\n\t\t// them. Tolerate a missing `path` so we degrade to the current behavior if the SDK stops populating\n\t\t// it, rather than silently regressing to `error`.\n\t\tif (errors?.length) {\n\t\t\treturn errors.some(\n\t\t\t\t(e: GraphQLError) => e.type === 'NOT_FOUND' && (e.path == null || e.path.includes('repository')),\n\t\t\t);\n\t\t}\n\t\treturn repoNotFoundMessage.test(ex.message);\n\t}\n\n\t// GitLab's `getRepo` throws a plain Error; match its not-found message specifically so unrelated\n\t// bare Errors (network/parse failures) still reach the generic error bucket.\n\treturn ex instanceof Error && repoNotFoundMessage.test(ex.message);\n}\n\n// provider-apis' GitLab `getIssue` throws a plain Error with exactly this message for a null issue (and\n// `repoNotFoundMessage`'s for a null project). Its GraphQL helper ignores `errors`, so a reply carrying only errors\n// throws the same messages; neither proves a miss on its own.\nconst gitLabIssueNotFoundMessage = /^Issue .+ not found$/i;\n\n// The `typeKey`s Azure DevOps itself uses for \"this pull request/repository/project does not exist\". A 404 can\n// also come from a wrong path (e.g. an Azure DevOps Server virtual directory or collection misconfigured), which\n// answers with an HTML error page instead of this shape, so the body must be checked, not just the status.\nconst azurePullRequestNotFoundTypeKeys = new Set([\n\t'GitPullRequestNotFoundException',\n\t'GitRepositoryNotFoundException',\n\t'ProjectDoesNotExistWithNameException',\n]);\n\n// The same for a work item. Azure answers a missing work item with TF401232, \"Work item N does not exist, or you\n// do not have permissions to read it\" — one type for both, so absent here means \"not visible to this connection\",\n// as it does for every other batch read.\nconst azureWorkItemNotFoundTypeKeys = new Set([\n\t'WorkItemUnauthorizedAccessException',\n\t'ProjectDoesNotExistWithNameException',\n]);\n\nfunction isAzureNotFoundResponse(ex: unknown, typeKeys: ReadonlySet<string>): boolean {\n\tconst response = (ex as { response?: { status?: unknown; body?: unknown } } | undefined)?.response;\n\tif (response?.status !== 404 || response.body == null || typeof response.body !== 'object') return false;\n\n\tconst typeKey = (response.body as { typeKey?: unknown }).typeKey;\n\treturn typeof typeKey === 'string' && typeKeys.has(typeKey);\n}\n\n/** The credential provider-apis sends Azure DevOps: a PAT as Basic (encoded here, as it does), anything else as a bearer. */\nfunction azureAuthorization(token: string, isPAT: boolean | undefined): string {\n\treturn isPAT ? `Basic ${base64(`:${token}`)}` : `Bearer ${token}`;\n}\n\nconst azureDevOpsBaseUrl = 'https://dev.azure.com';\n/** The most group descriptors one identity batch read resolves. */\nconst azureIdentityBatchSize = 100;\n/** Azure DevOps Services serves the identity APIs from its own host, below the organization like the main one. */\nconst azureDevOpsIdentityBaseUrl = 'https://vssps.dev.azure.com';\nconst trelloBaseUrl = 'https://api.trello.com';\n\n/**\n * Jira computes an issue's available transitions per issue, from the workflow and the reader's permissions, so a\n * list read at a page size of 100 pays for 100 of those in both server work and response payload. Nothing in this\n * package reads `statusTransitions` off a list — only the singular `getIssue` path exposes them, and it always\n * expands them — so every list read opts out. Revisit the day a list row offers a status change straight off it.\n */\nconst jiraListIncludeTransitions = false;\n\ntype TrelloMemberResponse = {\n\tid: string;\n\tusername?: string | null;\n\tfullName?: string | null;\n\tavatarHash?: string | null;\n\tavatarUrl?: string | null;\n};\n\ntype TrelloCardResponse = {\n\tid: string;\n\tidShort: number;\n\tname: string;\n\turl: string;\n\tdateLastActivity: string;\n\tidList?: string | null;\n\tbadges?: {\n\t\tcomments?: number | null;\n\t\tvotes?: number | null;\n\t};\n\tmembers?: TrelloMemberResponse[];\n\tlabels?: Array<{ color: string | null; id: string; name: string }>;\n};\n\nfunction getTrelloAuthHeaders(appKey: string, token: string): Record<string, string> {\n\treturn {\n\t\tAuthorization: `OAuth oauth_consumer_key=\"${appKey}\", oauth_token=\"${token}\"`,\n\t};\n}\n\nfunction getTrelloMemberAvatarUrl(member: TrelloMemberResponse): string | null {\n\tif (member.avatarUrl != null) return member.avatarUrl;\n\tif (member.avatarHash == null) return null;\n\n\treturn `https://trello-members.s3.amazonaws.com/${member.id}/${member.avatarHash}/50.png`;\n}\n\nfunction fromTrelloCard(\n\tcard: TrelloCardResponse,\n\ttrelloBoardListsById: Record<string, { name: string }>,\n): ProviderIssue {\n\tconst createdDate = new Date(1000 * parseInt(card.id.substring(0, 8), 16));\n\tconst list = card.idList != null ? trelloBoardListsById[card.idList] : undefined;\n\n\treturn {\n\t\tid: card.id,\n\t\tcommentCount: card.badges?.comments ?? null,\n\t\tnumber: String(card.idShort),\n\t\ttitle: card.name,\n\t\turl: card.url,\n\t\tclosedDate: null,\n\t\tcreatedDate: new Date(createdDate.toISOString()),\n\t\tauthor: null,\n\t\tupdatedDate: new Date(card.dateLastActivity),\n\t\tassignees: (card.members ?? []).map(member => ({\n\t\t\tid: member.id,\n\t\t\tusername: member.username ?? null,\n\t\t\tname: member.fullName ?? null,\n\t\t\temail: null,\n\t\t\tavatarUrl: getTrelloMemberAvatarUrl(member),\n\t\t\turl: null,\n\t\t})),\n\t\tdescription: null,\n\t\tstate: list != null ? { id: card.idList!, name: list.name, color: null } : null,\n\t\ttype: null,\n\t\trepository: null,\n\t\tupvoteCount: card.badges?.votes ?? null,\n\t\tlabels: (card.labels ?? []).map(label => ({\n\t\t\tcolor: label.color,\n\t\t\tdescription: null,\n\t\t\tid: label.id,\n\t\t\tname: label.name,\n\t\t})),\n\t};\n}\n\nexport class ProvidersApi {\n\tprivate readonly providers: Providers;\n\tprivate readonly request: ProviderRequestFunction;\n\n\tconstructor(private readonly authenticationService: IntegrationAuthenticationService) {\n\t\tconst http = authenticationService.ctx.http;\n\t\tconst userAgent = http.userAgent;\n\t\tconst customFetch: ProviderRequestFunction = async <T>({\n\t\t\turl,\n\t\t\t...options\n\t\t}: ProviderRequestOptions): Promise<ProviderRequestResponse<T>> => {\n\t\t\tconst response = await http.fetch(url, {\n\t\t\t\t...options,\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': userAgent,\n\t\t\t\t\t...options.headers,\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn parseFetchResponseForApi<T>(response);\n\t\t};\n\t\tthis.request = customFetch;\n\t\tconst providerApis = createProviderApis({ request: customFetch });\n\t\tthis.providers = {\n\t\t\t[GitCloudHostIntegrationId.GitHub]: {\n\t\t\t\t...providersMetadata[GitCloudHostIntegrationId.GitHub],\n\t\t\t\tprovider: providerApis.github,\n\t\t\t\tgetRepoFn: providerApis.github.getRepo.bind(providerApis.github),\n\t\t\t\tgetCurrentUserFn: providerApis.github.getCurrentUser.bind(providerApis.github),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.github.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.github,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForUserFn: providerApis.github.getPullRequestsAssociatedWithUser.bind(\n\t\t\t\t\tproviderApis.github,\n\t\t\t\t) as GetPullRequestsForUserFn,\n\t\t\t\tgetIssuesForReposFn: providerApis.github.getIssuesForRepos.bind(\n\t\t\t\t\tproviderApis.github,\n\t\t\t\t) as GetIssuesForReposFn,\n\t\t\t\tgetOrgsForCurrentUserFn: providerApis.github.getOrgsForCurrentUser.bind(providerApis.github),\n\t\t\t\tgetReposForOrgFn: providerApis.github.getReposForOrg.bind(providerApis.github),\n\t\t\t\tgetReposForCurrentUserFn: providerApis.github.getReposForCurrentUser.bind(providerApis.github),\n\t\t\t},\n\t\t\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise]: {\n\t\t\t\t...providersMetadata[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise],\n\t\t\t\tprovider: providerApis.github,\n\t\t\t\tgetRepoFn: providerApis.github.getRepo.bind(providerApis.github),\n\t\t\t\tgetCurrentUserFn: providerApis.github.getCurrentUser.bind(providerApis.github),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.github.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.github,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForUserFn: providerApis.github.getPullRequestsAssociatedWithUser.bind(\n\t\t\t\t\tproviderApis.github,\n\t\t\t\t) as GetPullRequestsForUserFn,\n\t\t\t\tgetIssuesForReposFn: providerApis.github.getIssuesForRepos.bind(\n\t\t\t\t\tproviderApis.github,\n\t\t\t\t) as GetIssuesForReposFn,\n\t\t\t\tgetOrgsForCurrentUserFn: providerApis.github.getOrgsForCurrentUser.bind(providerApis.github),\n\t\t\t\tgetReposForOrgFn: providerApis.github.getReposForOrg.bind(providerApis.github),\n\t\t\t\tgetReposForCurrentUserFn: providerApis.github.getReposForCurrentUser.bind(providerApis.github),\n\t\t\t},\n\t\t\t[GitCloudHostIntegrationId.GitLab]: {\n\t\t\t\t...providersMetadata[GitCloudHostIntegrationId.GitLab],\n\t\t\t\tprovider: providerApis.gitlab,\n\t\t\t\tgetRepoFn: providerApis.gitlab.getRepo.bind(providerApis.gitlab),\n\t\t\t\tgetCurrentUserFn: providerApis.gitlab.getCurrentUser.bind(providerApis.gitlab),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.gitlab.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForRepoFn: providerApis.gitlab.getPullRequestsForRepo.bind(providerApis.gitlab),\n\t\t\t\tgetPullRequestForRepoFn: providerApis.gitlab.getPullRequestForRepo.bind(providerApis.gitlab),\n\t\t\t\tgetPullRequestsForUserFn: providerApis.gitlab.getPullRequestsAssociatedWithUser.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t) as GetPullRequestsForUserFn,\n\t\t\t\tgetGitLabPullRequestsForUserAssociationFn: providerApis.gitlab.getPullRequestsForUser.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t),\n\t\t\t\tgetIssueFn: providerApis.gitlab.getIssue.bind(providerApis.gitlab) as GetIssueFn,\n\t\t\t\tgetIssuesForReposFn: providerApis.gitlab.getIssuesForRepos.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t) as GetIssuesForReposFn,\n\t\t\t\tgetIssuesForRepoFn: providerApis.gitlab.getIssuesForRepo.bind(providerApis.gitlab),\n\t\t\t\tgetIssuesForCurrentUserFn: providerApis.gitlab.getIssuesForCurrentUser.bind(providerApis.gitlab),\n\t\t\t\tmergePullRequestFn: providerApis.gitlab.mergePullRequest.bind(providerApis.gitlab),\n\t\t\t\tgetGroupsForCurrentUserFn: providerApis.gitlab.getGroupsForCurrentUser.bind(providerApis.gitlab),\n\t\t\t\tgetReposForCurrentUserFn: providerApis.gitlab.getReposForCurrentUser.bind(providerApis.gitlab),\n\t\t\t},\n\t\t\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted]: {\n\t\t\t\t...providersMetadata[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted],\n\t\t\t\tprovider: providerApis.gitlab,\n\t\t\t\tgetRepoFn: providerApis.gitlab.getRepo.bind(providerApis.gitlab),\n\t\t\t\tgetCurrentUserFn: providerApis.gitlab.getCurrentUser.bind(providerApis.gitlab),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.gitlab.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForRepoFn: providerApis.gitlab.getPullRequestsForRepo.bind(providerApis.gitlab),\n\t\t\t\tgetPullRequestForRepoFn: providerApis.gitlab.getPullRequestForRepo.bind(providerApis.gitlab),\n\t\t\t\tgetPullRequestsForUserFn: providerApis.gitlab.getPullRequestsAssociatedWithUser.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t) as GetPullRequestsForUserFn,\n\t\t\t\tgetGitLabPullRequestsForUserAssociationFn: providerApis.gitlab.getPullRequestsForUser.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t),\n\t\t\t\tgetIssueFn: providerApis.gitlab.getIssue.bind(providerApis.gitlab) as GetIssueFn,\n\t\t\t\tgetIssuesForReposFn: providerApis.gitlab.getIssuesForRepos.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t) as GetIssuesForReposFn,\n\t\t\t\tgetIssuesForRepoFn: providerApis.gitlab.getIssuesForRepo.bind(providerApis.gitlab),\n\t\t\t\tgetIssuesForCurrentUserFn: providerApis.gitlab.getIssuesForCurrentUser.bind(providerApis.gitlab),\n\t\t\t\tmergePullRequestFn: providerApis.gitlab.mergePullRequest.bind(providerApis.gitlab),\n\t\t\t\tgetGroupsForCurrentUserFn: providerApis.gitlab.getGroupsForCurrentUser.bind(providerApis.gitlab),\n\t\t\t\tgetReposForCurrentUserFn: providerApis.gitlab.getReposForCurrentUser.bind(providerApis.gitlab),\n\t\t\t},\n\t\t\t[GitCloudHostIntegrationId.Bitbucket]: {\n\t\t\t\t...providersMetadata[GitCloudHostIntegrationId.Bitbucket],\n\t\t\t\tprovider: providerApis.bitbucket,\n\t\t\t\tgetRepoFn: providerApis.bitbucket.getRepo.bind(providerApis.bitbucket),\n\t\t\t\tgetCurrentUserFn: providerApis.bitbucket.getCurrentUser.bind(providerApis.bitbucket),\n\t\t\t\tgetBitbucketResourcesForCurrentUserFn: providerApis.bitbucket.getWorkspacesForCurrentUser.bind(\n\t\t\t\t\tproviderApis.bitbucket,\n\t\t\t\t),\n\t\t\t\tgetBitbucketPullRequestsAuthoredByUserForWorkspaceFn:\n\t\t\t\t\tproviderApis.bitbucket.getPullRequestsForUserAndWorkspace.bind(providerApis.bitbucket),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.bitbucket.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.bitbucket,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForRepoFn: providerApis.bitbucket.getPullRequestsForRepo.bind(providerApis.bitbucket),\n\t\t\t\tmergePullRequestFn: providerApis.bitbucket.mergePullRequest.bind(providerApis.bitbucket),\n\t\t\t\tgetReposForWorkspaceFn: providerApis.bitbucket.getReposForWorkspace.bind(providerApis.bitbucket),\n\t\t\t},\n\t\t\t[GitSelfManagedHostIntegrationId.BitbucketServer]: {\n\t\t\t\t...providersMetadata[GitSelfManagedHostIntegrationId.BitbucketServer],\n\t\t\t\tprovider: providerApis.bitbucketServer,\n\t\t\t\tgetRepoFn: providerApis.bitbucketServer.getRepo.bind(providerApis.bitbucketServer),\n\t\t\t\tgetCurrentUserFn: providerApis.bitbucketServer.getCurrentUser.bind(providerApis.bitbucketServer),\n\t\t\t\tgetBitbucketServerPullRequestsForCurrentUserFn:\n\t\t\t\t\tproviderApis.bitbucketServer.getPullRequestsForCurrentUser.bind(providerApis.bitbucketServer),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.bitbucketServer.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.bitbucketServer,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForRepoFn: providerApis.bitbucketServer.getPullRequestsForRepo.bind(\n\t\t\t\t\tproviderApis.bitbucketServer,\n\t\t\t\t),\n\t\t\t\tmergePullRequestFn: providerApis.bitbucketServer.mergePullRequest.bind(providerApis.bitbucketServer),\n\t\t\t},\n\t\t\t[GitCloudHostIntegrationId.AzureDevOps]: {\n\t\t\t\t...providersMetadata[GitCloudHostIntegrationId.AzureDevOps],\n\t\t\t\tprovider: providerApis.azureDevOps,\n\t\t\t\tgetRepoOfProjectFn: providerApis.azureDevOps.getRepo.bind(providerApis.azureDevOps),\n\t\t\t\tgetCurrentUserFn: providerApis.azureDevOps.getCurrentUser.bind(providerApis.azureDevOps),\n\t\t\t\tgetCurrentUserForInstanceFn: providerApis.azureDevOps.getCurrentUserForInstance.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetAzureResourcesForUserFn: providerApis.azureDevOps.getOrgsForUser.bind(providerApis.azureDevOps),\n\t\t\t\tgetAzureProjectsForResourceFn: providerApis.azureDevOps.getAzureProjects.bind(providerApis.azureDevOps),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.azureDevOps.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForRepoFn: providerApis.azureDevOps.getPullRequestsForRepo.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetPullRequestForRepoFn: providerApis.azureDevOps.getPullRequestForRepo.bind(providerApis.azureDevOps),\n\t\t\t\tgetPullRequestsForAzureProjectsFn: providerApis.azureDevOps.getPullRequestsForProjects.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetPullRequestsForAzureProjectFn: providerApis.azureDevOps.getPullRequestsForProject.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetIssuesForAzureProjectFn: providerApis.azureDevOps.getIssuesForAzureProject.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetReposForAzureProjectFn: providerApis.azureDevOps.getReposForAzureProject.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tmergePullRequestFn: providerApis.azureDevOps.mergePullRequest.bind(providerApis.azureDevOps),\n\t\t\t},\n\t\t\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer]: {\n\t\t\t\t...providersMetadata[GitSelfManagedHostIntegrationId.AzureDevOpsServer],\n\t\t\t\tprovider: providerApis.azureDevOps,\n\t\t\t\tgetRepoOfProjectFn: providerApis.azureDevOps.getRepo.bind(providerApis.azureDevOps),\n\t\t\t\tgetCurrentUserFn: providerApis.azureDevOps.getCurrentUser.bind(providerApis.azureDevOps),\n\t\t\t\tgetCurrentUserForInstanceFn: providerApis.azureDevOps.getCurrentUserForInstance.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetAzureResourcesForUserFn: providerApis.azureDevOps.getCollectionsForUser.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetAzureProjectsForResourceFn: providerApis.azureDevOps.getAzureProjects.bind(providerApis.azureDevOps),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.azureDevOps.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForRepoFn: providerApis.azureDevOps.getPullRequestsForRepo.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetPullRequestForRepoFn: providerApis.azureDevOps.getPullRequestForRepo.bind(providerApis.azureDevOps),\n\t\t\t\tgetPullRequestsForAzureProjectsFn: providerApis.azureDevOps.getPullRequestsForProjects.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetPullRequestsForAzureProjectFn: providerApis.azureDevOps.getPullRequestsForProject.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetIssuesForAzureProjectFn: providerApis.azureDevOps.getIssuesForAzureProject.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetReposForAzureProjectFn: providerApis.azureDevOps.getReposForAzureProject.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tmergePullRequestFn: providerApis.azureDevOps.mergePullRequest.bind(providerApis.azureDevOps),\n\t\t\t},\n\t\t\t[IssuesCloudHostIntegrationId.Jira]: {\n\t\t\t\t...providersMetadata[IssuesCloudHostIntegrationId.Jira],\n\t\t\t\tprovider: providerApis.jira,\n\t\t\t\tgetCurrentUserForResourceFn: providerApis.jira.getCurrentUserForResource.bind(providerApis.jira),\n\t\t\t\tgetJiraResourcesForCurrentUserFn: providerApis.jira.getJiraResourcesForCurrentUser.bind(\n\t\t\t\t\tproviderApis.jira,\n\t\t\t\t),\n\t\t\t\tgetJiraProjectsForResourcesFn: providerApis.jira.getJiraProjectsForResources.bind(providerApis.jira),\n\t\t\t\tgetJiraProjectsForResourceFn: providerApis.jira.getJiraProjectsForResource.bind(providerApis.jira),\n\t\t\t\tgetIssueFn: providerApis.jira.getIssue.bind(providerApis.jira) as GetIssueFn,\n\t\t\t\tgetIssuesForProjectFn: providerApis.jira.getIssuesForProject.bind(providerApis.jira),\n\t\t\t\tgetIssuesForResourceForCurrentUserFn: providerApis.jira.getIssuesForResourceForCurrentUser.bind(\n\t\t\t\t\tproviderApis.jira,\n\t\t\t\t),\n\t\t\t},\n\t\t\t[IssuesSelfManagedHostIntegrationId.JiraServer]: {\n\t\t\t\t...providersMetadata[IssuesSelfManagedHostIntegrationId.JiraServer],\n\t\t\t\tprovider: providerApis.jiraServer,\n\t\t\t\tgetJiraServerCurrentUserFn: providerApis.jiraServer.getCurrentUser.bind(providerApis.jiraServer),\n\t\t\t\tgetJiraServerProjectsFn: providerApis.jiraServer.getJiraProjects.bind(providerApis.jiraServer),\n\t\t\t\tgetJiraServerIssuesForProjectFn: providerApis.jiraServer.getIssuesForProject.bind(\n\t\t\t\t\tproviderApis.jiraServer,\n\t\t\t\t),\n\t\t\t\tgetJiraServerIssueFn: providerApis.jiraServer.getIssue.bind(providerApis.jiraServer),\n\t\t\t\tgetJiraServerIssuesForCurrentUserFn: providerApis.jiraServer.getIssuesForResourceForCurrentUser.bind(\n\t\t\t\t\tproviderApis.jiraServer,\n\t\t\t\t),\n\t\t\t},\n\t\t\t[IssuesCloudHostIntegrationId.Linear]: {\n\t\t\t\t...providersMetadata[IssuesCloudHostIntegrationId.Linear],\n\t\t\t\tprovider: providerApis.linear,\n\t\t\t\tgetIssueFn: providerApis.linear.getIssue.bind(providerApis.linear),\n\t\t\t\tgetIssuesForCurrentUserFn: providerApis.linear.getIssuesForCurrentUser.bind(providerApis.linear),\n\t\t\t\tgetLinearOrganizationFn: providerApis.linear.getLinearOrganization.bind(providerApis.linear),\n\t\t\t\tgetLinearTeamsForCurrentUserFn: providerApis.linear.getTeamsForCurrentUser.bind(providerApis.linear),\n\t\t\t\tgetLinearIssuesFn: providerApis.linear.getIssues.bind(providerApis.linear),\n\t\t\t\tgetLinearCurrentUserFn: providerApis.linear.getCurrentUser.bind(providerApis.linear),\n\t\t\t},\n\t\t\t[IssuesCloudHostIntegrationId.Trello]: {\n\t\t\t\t...providersMetadata[IssuesCloudHostIntegrationId.Trello],\n\t\t\t\tprovider: providerApis.trello,\n\t\t\t\tgetTrelloCurrentUserFn: providerApis.trello.getCurrentUser.bind(providerApis.trello),\n\t\t\t\tgetTrelloBoardsForCurrentUserFn: providerApis.trello.getBoardsForCurrentUser.bind(providerApis.trello),\n\t\t\t\tgetTrelloListsForBoardFn: providerApis.trello.getListsForTrelloBoard.bind(providerApis.trello),\n\t\t\t\tgetTrelloAccountForIdFn: providerApis.trello.getAccountForId.bind(providerApis.trello),\n\t\t\t\tgetTrelloIssuesForBoardFn: providerApis.trello.getIssuesForBoard.bind(providerApis.trello),\n\t\t\t\tgetTrelloLabelsForBoardFn: providerApis.trello.getLabelsForBoard.bind(providerApis.trello),\n\t\t\t},\n\t\t};\n\t}\n\n\tgetScopesForProvider(providerId: IntegrationIds): string[] | undefined {\n\t\treturn this.providers[providerId]?.scopes;\n\t}\n\n\tgetProviderDomain(providerId: IntegrationIds): string | undefined {\n\t\treturn this.providers[providerId]?.domain;\n\t}\n\n\tgetProviderPullRequestsPagingMode(providerId: IntegrationIds): PagingMode | undefined {\n\t\treturn this.providers[providerId]?.pullRequestsPagingMode;\n\t}\n\n\tgetProviderIssuesPagingMode(providerId: IntegrationIds): PagingMode | undefined {\n\t\treturn this.providers[providerId]?.issuesPagingMode;\n\t}\n\n\tproviderSupportsPullRequestFilters(providerId: IntegrationIds, filters: PullRequestFilter[]): boolean {\n\t\treturn (\n\t\t\tthis.providers[providerId]?.supportedPullRequestFilters != null &&\n\t\t\tfilters.every(filter => this.providers[providerId]?.supportedPullRequestFilters?.includes(filter))\n\t\t);\n\t}\n\n\tproviderSupportsIssueFilters(providerId: IntegrationIds, filters: IssueFilter[]): boolean {\n\t\treturn (\n\t\t\tthis.providers[providerId]?.supportedIssueFilters != null &&\n\t\t\tfilters.every(filter => this.providers[providerId]?.supportedIssueFilters?.includes(filter))\n\t\t);\n\t}\n\n\t/** See {@link isRepoIdsInput}, which owns the rule; kept as a method because callers reach it through the api. */\n\tisRepoIdsInput(input: unknown): input is (string | number)[] {\n\t\treturn isRepoIdsInput(input);\n\t}\n\n\tprivate async getProviderToken<T extends IntegrationIds>(\n\t\tprovider: ProviderInfo & { id: T },\n\t\toptions?: { createSessionIfNeeded?: boolean; connectionId?: string },\n\t): Promise<TokenWithInfo<T> | undefined> {\n\t\t// When a specific connection is requested, resolve that connection's cloud session (mirroring\n\t\t// `Integration.resolveReadSession`); otherwise keep the plain descriptor so the primary is resolved.\n\t\t// An empty string is not a real target, so it must also fall through to the primary path.\n\t\tconst providerDescriptor = options?.connectionId\n\t\t\t? { domain: provider.domain, scopes: provider.scopes, connectionId: options.connectionId, cloud: true }\n\t\t\t: { domain: provider.domain, scopes: provider.scopes };\n\t\ttry {\n\t\t\tconst authProvider = await this.authenticationService.get(provider.id);\n\t\t\tconst session = await authProvider.getSession(providerDescriptor, {\n\t\t\t\tcreateIfNeeded: options?.createSessionIfNeeded,\n\t\t\t});\n\t\t\tif (session == null) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn toTokenWithInfo(provider.id, session);\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate async ensureProviderToken<T extends IntegrationIds>(\n\t\ttokenOptInfo: TokenOptInfo<T>,\n\t): Promise<{ provider: ProviderInfo; tokenWithInfo: TokenWithInfo<T> }> {\n\t\tconst providerId = tokenOptInfo.providerId;\n\t\tconst provider = this.providers[providerId];\n\t\tif (provider == null) {\n\t\t\tthrow new Error(`Provider with id ${providerId} not registered`);\n\t\t}\n\n\t\tif (providerId !== provider.id) {\n\t\t\tthrow new Error(`Provider id mismatch: expected ${providerId} but got ${provider.id}`);\n\t\t}\n\n\t\tconst connectionId = 'connectionId' in tokenOptInfo ? tokenOptInfo.connectionId : undefined;\n\t\tconst tokenWithInfo = tokenOptInfo?.accessToken\n\t\t\t? tokenOptInfo\n\t\t\t: await this.getProviderToken<T>(provider as ProviderInfo & { id: T }, {\n\t\t\t\t\tconnectionId: connectionId,\n\t\t\t\t});\n\t\tif (tokenWithInfo == null) {\n\t\t\tthrow new Error(`Not connected to provider ${providerId}`);\n\t\t}\n\n\t\treturn { provider: provider, tokenWithInfo: tokenWithInfo };\n\t}\n\n\tprivate async ensureProviderTokenAndFunction<T extends IntegrationIds>(\n\t\ttokenOptInfo: TokenOptInfo<T>,\n\t\tproviderFn: keyof ProviderInfo,\n\t): Promise<{ provider: ProviderInfo; tokenWithInfo: TokenWithInfo<T> }> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\t\tconst providerId = tokenOptInfo.providerId;\n\n\t\tif (provider[providerFn] == null) {\n\t\t\tthrow new Error(`Provider with id ${providerId} does not support function: ${providerFn}`);\n\t\t}\n\n\t\treturn { provider: provider, tokenWithInfo: tokenWithInfo };\n\t}\n\n\tprivate handleProviderError<T>(tokenWithInfo: TokenWithInfo, error: any): T {\n\t\tconst providerId = tokenWithInfo.providerId;\n\t\tconst provider = this.providers[providerId];\n\t\tif (provider == null) {\n\t\t\tthrow new Error(`Provider with id ${providerId} not registered`);\n\t\t}\n\n\t\treturn throwProviderError(tokenWithInfo, error);\n\t}\n\n\tasync getPagedResult<T>(\n\t\targs: any,\n\t\tproviderFn:\n\t\t\t| ((\n\t\t\t\t\tinput: any,\n\t\t\t\t\toptions?: { token?: string; isPAT?: boolean; baseUrl?: string },\n\t\t\t ) => Promise<{ data: NonNullable<T>[]; pageInfo?: PageInfo; metadata?: CollectionMetadata }>)\n\t\t\t| undefined,\n\t\ttokenWithInfo: TokenWithInfo,\n\t\tcursor: string = '{}',\n\t\tisPAT: boolean = false,\n\t\tbaseUrl?: string,\n\t): Promise<ProviderApiPagedResult<T>> {\n\t\tlet cursorInfo;\n\t\ttry {\n\t\t\tcursorInfo = JSON.parse(cursor);\n\t\t} catch {\n\t\t\tcursorInfo = {};\n\t\t}\n\t\tconst cursorValue = cursorInfo.value;\n\t\tconst cursorType = cursorInfo.type;\n\t\t// An explicit numbered `page` request wins over a page-typed cursor; otherwise follow the cursor. A\n\t\t// live cursor-typed cursor still takes precedence so an in-flight continuation is never clobbered.\n\t\tconst requestedPage: number | undefined = typeof args?.page === 'number' ? args.page : undefined;\n\t\tconst requestedPageSize: number | undefined = typeof args?.pageSize === 'number' ? args.pageSize : undefined;\n\t\tlet cursorOrPage = {};\n\t\tif (requestedPage != null && cursorType !== 'cursor') {\n\t\t\tcursorOrPage = { page: requestedPage };\n\t\t} else if (cursorType === 'page') {\n\t\t\tcursorOrPage = { page: cursorValue };\n\t\t} else if (cursorType === 'cursor') {\n\t\t\tcursorOrPage = { cursor: cursorValue };\n\t\t}\n\n\t\t// Strip the caller's paging keys so `getPagedResult` fully controls them; otherwise `args.page` could\n\t\t// survive alongside a resolved `cursor` (or the raw serialized wrapper `args.cursor` could leak in when\n\t\t// following a page), letting the provider clobber the continuation we intended.\n\t\tconst { page: _page, pageSize: _pageSize, cursor: _cursor, ...restArgs } = args ?? {};\n\t\tconst input = {\n\t\t\t...restArgs,\n\t\t\t...cursorOrPage,\n\t\t\t// `pageSize` is honored by numbered providers; GitHub reads `maxPageSize`. Set both so whichever\n\t\t\t// the resolved provider understands takes effect; the other is ignored.\n\t\t\t...(requestedPageSize != null ? { pageSize: requestedPageSize, maxPageSize: requestedPageSize } : {}),\n\t\t};\n\n\t\ttry {\n\t\t\tconst result = await providerFn?.(input, {\n\t\t\t\ttoken: tokenWithInfo.accessToken,\n\t\t\t\tisPAT: isPAT,\n\t\t\t\tbaseUrl: baseUrl,\n\t\t\t});\n\t\t\tif (result == null) {\n\t\t\t\tconst continuationWasRequested =\n\t\t\t\t\t(cursor != null && cursor !== '{}') || (requestedPage != null && requestedPage > 1);\n\t\t\t\treturn continuationWasRequested\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tvalues: [],\n\t\t\t\t\t\t\tpaging: { cursor: '{}', more: false, truncated: true },\n\t\t\t\t\t\t\tmetadata: { completeness: 'partial' },\n\t\t\t\t\t\t}\n\t\t\t\t\t: { values: [] };\n\t\t\t}\n\n\t\t\tconst pageInfo = result.pageInfo;\n\t\t\tconst hasMore = pageInfo?.hasNextPage ?? false;\n\n\t\t\tlet nextCursor = '{}';\n\t\t\tif (pageInfo?.endCursor != null) {\n\t\t\t\tnextCursor = JSON.stringify({ value: pageInfo.endCursor, type: 'cursor' });\n\t\t\t} else if (pageInfo?.nextPage != null) {\n\t\t\t\tnextCursor = JSON.stringify({ value: pageInfo.nextPage, type: 'page' });\n\t\t\t}\n\t\t\tconst continuationBroken = hasMore && (nextCursor === '{}' || nextCursor === cursor);\n\t\t\tconst normalizedMetadata = mergeCollectionMetadata(\n\t\t\t\tresult.metadata,\n\t\t\t\tcontinuationBroken ? { completeness: 'partial' } : undefined,\n\t\t\t);\n\n\t\t\t// SDK collection completeness is independent from provider-native pagination: a result can expose a\n\t\t\t// real next page (`more`) and still have a failed sibling scope (`partial`/`unknown`). Surface the\n\t\t\t// latter as `truncated` so consumers treat the page as incomplete. Absent metadata (old providers,\n\t\t\t// test doubles) leaves `truncated` unset for backward compatibility. Shares the incompleteness\n\t\t\t// predicate with the facade assessment so one metadata object can't be truncated there and whole here.\n\t\t\tconst truncated = isIncompleteCollection(normalizedMetadata) ? true : undefined;\n\n\t\t\treturn {\n\t\t\t\tvalues: result.data,\n\t\t\t\tpaging: {\n\t\t\t\t\tcursor: nextCursor,\n\t\t\t\t\tmore: hasMore && !continuationBroken,\n\t\t\t\t\ttruncated: truncated,\n\t\t\t\t\t// Numbered-page metadata; left undefined by cursor-based providers (which don't report a\n\t\t\t\t\t// currentPage), so we never echo the requested page for a provider that ignored it.\n\t\t\t\t\tpage: pageInfo?.currentPage ?? undefined,\n\t\t\t\t\tpageSize: requestedPageSize,\n\t\t\t\t\tnextPage: pageInfo?.nextPage ?? undefined,\n\t\t\t\t\ttotalPages: pageInfo?.totalPages ?? undefined,\n\t\t\t\t\ttotalCount: pageInfo?.totalCount ?? undefined,\n\t\t\t\t},\n\t\t\t\tmetadata: normalizedMetadata,\n\t\t\t};\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderApiPagedResult<T>>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getRepo(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\towner: string,\n\t\tname: string,\n\t\tproject?: string,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderRepository | undefined> {\n\t\tconst providerId = tokenOptInfo.providerId;\n\t\tconst isAzureDevOps =\n\t\t\tproviderId === GitCloudHostIntegrationId.AzureDevOps ||\n\t\t\tproviderId === GitSelfManagedHostIntegrationId.AzureDevOpsServer;\n\t\tif (isAzureDevOps) {\n\t\t\tif (project == null) return undefined;\n\n\t\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\t\ttokenOptInfo,\n\t\t\t\t'getRepoOfProjectFn',\n\t\t\t);\n\t\t\tconst token = tokenWithInfo.accessToken;\n\n\t\t\ttry {\n\t\t\t\tconst result = await provider['getRepoOfProjectFn']?.(\n\t\t\t\t\t{ namespace: owner, name: name, project: project },\n\t\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t\t);\n\t\t\t\treturn result?.data;\n\t\t\t} catch (e) {\n\t\t\t\tif (isGraphQLRepoNotFoundError(e)) throw new RequestNotFoundError(toError(e));\n\t\t\t\treturn this.handleProviderError<ProviderRepository>(tokenWithInfo, e);\n\t\t\t}\n\t\t} else {\n\t\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, 'getRepoFn');\n\t\t\tconst token = tokenWithInfo.accessToken;\n\n\t\t\ttry {\n\t\t\t\tconst result = await provider['getRepoFn']?.(\n\t\t\t\t\t{ namespace: owner, name: name, project: project },\n\t\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t\t);\n\t\t\t\treturn result?.data;\n\t\t\t} catch (e) {\n\t\t\t\tif (isGraphQLRepoNotFoundError(e)) throw new RequestNotFoundError(toError(e));\n\t\t\t\treturn this.handleProviderError<ProviderRepository>(tokenWithInfo, e);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * One pull request by repository and number, in any state. `undefined` when the provider reports it absent:\n\t * a `null` from GitLab (which alone is NOT proof — see the GitLab batch hook), or, from Azure DevOps, a 404\n\t * whose body names the pull request, repository or project as not found (see\n\t * {@link azurePullRequestNotFoundTypeKeys}). Any other Azure error, including a 410 or a 404 that isn't that\n\t * shape (e.g. a wrong path answering with an HTML page), goes through `handleProviderError` and fails instead.\n\t */\n\tasync getPullRequestForRepo(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\trepo: ProviderRepoInput,\n\t\tnumber: number,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string; includeRemoteInfo?: boolean },\n\t): Promise<ProviderPullRequest | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getPullRequestForRepoFn',\n\t\t);\n\t\tconst providerId = tokenWithInfo.providerId;\n\n\t\ttry {\n\t\t\tconst result = await provider.getPullRequestForRepoFn?.(\n\t\t\t\t{ repo: repo, number: number, includeRemoteInfo: options?.includeRemoteInfo },\n\t\t\t\t{ token: tokenWithInfo.accessToken, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t);\n\t\t\treturn result?.data ?? undefined;\n\t\t} catch (e) {\n\t\t\t// Azure DevOps throws on a missing pull request instead of answering `{ data: null }`.\n\t\t\tif (isAzureProviderId(providerId) && isAzureNotFoundResponse(e, azurePullRequestNotFoundTypeKeys)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn this.handleProviderError<ProviderPullRequest | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * Azure DevOps pull requests into a repository whose source is `refs/heads/{branch}`, in every status, as Azure\n\t * returns them, at most `top`. provider-apis' pull request list has no source-branch filter, so this asks Azure\n\t * directly, with the credential provider-apis would send.\n\t *\n\t * `undefined` only when Azure itself says the repository or project doesn't exist, by the same rule as\n\t * {@link getPullRequestForRepo}; every other failure, including a 404 that isn't that shape, throws.\n\t */\n\tasync getAzurePullRequestsForBranch(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\trepo: { namespace: string; project: string; name: string },\n\t\tbranch: string,\n\t\ttop: number,\n\t\toptions: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<AzurePullRequest[] | undefined> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\tconst baseUrl = (options.baseUrl ?? azureDevOpsBaseUrl).replace(/\\/$/, '');\n\t\tconst params = new URLSearchParams({\n\t\t\t'searchCriteria.sourceRefName': `refs/heads/${branch}`,\n\t\t\t'searchCriteria.status': 'all',\n\t\t\t$top: String(top),\n\t\t});\n\t\tconst url = `${baseUrl}/${encodeAzurePathSegment(repo.namespace)}/${encodeAzurePathSegment(repo.project)}/_apis/git/repositories/${encodeAzurePathSegment(repo.name)}/pullrequests?${params.toString()}`;\n\n\t\ttry {\n\t\t\tconst result = await this.request<{ value?: AzurePullRequest[] }>({\n\t\t\t\turl: url,\n\t\t\t\theaders: { Authorization: azureAuthorization(token, options.isPAT) },\n\t\t\t});\n\t\t\tconst pullRequests = result.body?.value;\n\t\t\tif (pullRequests == null) throw new Error('Azure DevOps returned no pull requests');\n\n\t\t\treturn pullRequests;\n\t\t} catch (e) {\n\t\t\tif (isAzureNotFoundResponse(e, azurePullRequestNotFoundTypeKeys)) return undefined;\n\n\t\t\treturn this.handleProviderError<AzurePullRequest[] | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * The ids of every group `userId` is a member of in one Azure DevOps organization (Azure DevOps Server: one\n\t * collection), directly or through other groups: its teams and security groups, in every project and at the\n\t * organization level. A group is an identity like a person, so these are the ids a pull request lists a group under\n\t * as a reviewer. provider-apis has no identity read, so this asks Azure directly, with the credential provider-apis\n\t * would send.\n\t *\n\t * Two requests, however many groups: the user's expanded membership, which names its groups only by descriptor,\n\t * then one batch read resolving those descriptors to ids. Azure DevOps Services serves identities from its\n\t * `vssps` host; Azure DevOps Server from the collection itself.\n\t */\n\tasync getAzureGroupIdsForUser(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\tnamespace: string,\n\t\tuserId: string,\n\t\toptions: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<string[]> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\tconst base =\n\t\t\toptions.baseUrl != null\n\t\t\t\t? `${options.baseUrl.replace(/\\/$/, '')}/${encodeAzurePathSegment(namespace)}`\n\t\t\t\t: `${azureDevOpsIdentityBaseUrl}/${encodeAzurePathSegment(namespace)}`;\n\t\tconst headers = {\n\t\t\tAuthorization: azureAuthorization(token, options.isPAT),\n\t\t\t'Content-Type': 'application/json',\n\t\t};\n\n\t\tlet memberOf: unknown;\n\t\ttry {\n\t\t\tconst params = new URLSearchParams({\n\t\t\t\tidentityIds: userId,\n\t\t\t\tqueryMembership: 'Expanded',\n\t\t\t\t'api-version': '5.0',\n\t\t\t});\n\t\t\tconst user = await this.request<{ value?: { memberOf?: unknown }[] }>({\n\t\t\t\turl: `${base}/_apis/identities?${params.toString()}`,\n\t\t\t\theaders: headers,\n\t\t\t});\n\t\t\tmemberOf = user.body?.value?.[0]?.memberOf;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<string[]>(tokenWithInfo, e);\n\t\t}\n\n\t\t// Checked before the batch read, so a malformed answer fails instead of reading as no groups.\n\t\tif (!Array.isArray(memberOf) || memberOf.some(d => typeof d !== 'string')) {\n\t\t\tthrow new Error('Azure DevOps returned no group membership for the current user');\n\t\t}\n\t\tif (memberOf.length === 0) return [];\n\n\t\t// Resolved one batch at a time, so a member of very many groups never sends Azure more than a batch at once.\n\t\tconst chunks: string[][] = [];\n\t\tfor (let i = 0; i < memberOf.length; i += azureIdentityBatchSize) {\n\t\t\tchunks.push(memberOf.slice(i, i + azureIdentityBatchSize));\n\t\t}\n\t\tconst batches: unknown[] = [];\n\t\ttry {\n\t\t\tfor (const descriptors of chunks) {\n\t\t\t\tconst batch = await this.request<{ value?: unknown }>({\n\t\t\t\t\turl: `${base}/_apis/identitybatch?api-version=5.0-preview.1`,\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\theaders: headers,\n\t\t\t\t\tbody: JSON.stringify({ descriptors: descriptors, queryMembership: 'None' }),\n\t\t\t\t});\n\t\t\t\tbatches.push(batch.body?.value);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<string[]>(tokenWithInfo, e);\n\t\t}\n\n\t\t// A group left unresolved could never be matched to a reviewer, and dropping it would narrow the read silently.\n\t\tif (batches.some((batch, i) => !Array.isArray(batch) || batch.length !== chunks[i].length)) {\n\t\t\tthrow new Error('Azure DevOps did not resolve every group of the current user');\n\t\t}\n\n\t\tconst groups = (batches as ({ id?: unknown } | null)[][]).flat();\n\t\t// A descriptor Azure no longer resolves (a deleted group) answers `null`: it can't be anyone's reviewer.\n\t\treturn groups.flatMap((g: { id?: unknown } | null) => {\n\t\t\tif (g == null) return [];\n\t\t\tif (typeof g.id !== 'string') throw new Error('Azure DevOps returned a group without its id');\n\n\t\t\treturn [g.id];\n\t\t});\n\t}\n\n\t/**\n\t * One issue by repository and number through provider-apis' GitLab `getIssue`, in the shape its list reads\n\t * return. Strict, unlike {@link getIssue}: `undefined` only when provider-apis reports the project or issue\n\t * missing, which alone is NOT proof (see the GitLab batch hook), and never for an HTTP status — a 404 there\n\t * means a wrong endpoint, so it fails instead of reading as absent.\n\t */\n\tasync getIssueForRepo(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\trepo: { namespace: string; name: string },\n\t\tnumber: number,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderIssue | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, 'getIssueFn');\n\n\t\ttry {\n\t\t\tconst result = await provider.getIssueFn?.(\n\t\t\t\t{ namespace: repo.namespace, name: repo.name, number: String(number) },\n\t\t\t\t{ token: tokenWithInfo.accessToken, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t);\n\t\t\tif (result?.data == null) throw new Error(`No data returned for issue ${number}`);\n\n\t\t\treturn result.data;\n\t\t} catch (e) {\n\t\t\tif (\n\t\t\t\te instanceof Error &&\n\t\t\t\t(repoNotFoundMessage.test(e.message) || gitLabIssueNotFoundMessage.test(e.message))\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn this.handleProviderError<ProviderIssue | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * One Azure DevOps work item by id, converted as provider-apis converts its list rows (see\n\t * {@link fromAzureWorkItemToProviderIssue}). provider-apis has no single work item read, so this asks Azure\n\t * directly, with the credential provider-apis would send, and expands links as its list read does: the HTML\n\t * link is the issue's `url`.\n\t *\n\t * `undefined` only when Azure itself says the work item or the project doesn't exist (see\n\t * {@link azureWorkItemNotFoundTypeKeys}). Every other failure throws, including a 410, a 404 that isn't that\n\t * shape, an empty response, a work item the SDK's conversion would skip, and one in another project.\n\t */\n\tasync getAzureWorkItem(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\tscope: { namespace: string; project: string },\n\t\tid: number,\n\t\toptions: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderIssue | undefined> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\tconst baseUrl = (options.baseUrl ?? azureDevOpsBaseUrl).replace(/\\/$/, '');\n\t\tconst params = new URLSearchParams({ $expand: 'Links', 'api-version': '6.0' });\n\t\tconst url = `${baseUrl}/${encodeAzurePathSegment(scope.namespace)}/${encodeAzurePathSegment(scope.project)}/_apis/wit/workitems/${id}?${params.toString()}`;\n\n\t\tlet workItem: AzureWorkItemResponse | null | undefined;\n\t\ttry {\n\t\t\tconst result = await this.request<AzureWorkItemResponse | null>({\n\t\t\t\turl: url,\n\t\t\t\theaders: { Authorization: azureAuthorization(token, options.isPAT) },\n\t\t\t});\n\t\t\tworkItem = result.body;\n\t\t} catch (e) {\n\t\t\tif (isAzureNotFoundResponse(e, azureWorkItemNotFoundTypeKeys)) return undefined;\n\n\t\t\treturn this.handleProviderError<ProviderIssue | undefined>(tokenWithInfo, e);\n\t\t}\n\n\t\tconst issue =\n\t\t\tworkItem != null ? fromAzureWorkItemToProviderIssue(workItem, scope.namespace, scope.project) : undefined;\n\t\tif (issue == null) throw new Error(`Azure DevOps returned no readable work item ${id}`);\n\n\t\t// The route's project is not trusted to scope the read: work item ids are unique across the organization, and\n\t\t// one from another project must not answer for this coordinate. Azure compares project names\n\t\t// case-insensitively.\n\t\tconst project = workItem?.fields?.['System.TeamProject'];\n\t\tif (typeof project === 'string' && project.toLowerCase() !== scope.project.toLowerCase()) {\n\t\t\tthrow new Error(`Azure DevOps work item ${id} is in project '${project}', not '${scope.project}'`);\n\t\t}\n\n\t\treturn issue;\n\t}\n\n\t/**\n\t * The cheap check behind the batch issue read's etags: `ids` (at most `azureWorkItemsEtagFieldsMaxIds`) in ONE\n\t * request, where {@link getAzureWorkItem} reads one work item per request, selecting only\n\t * `azureWorkItemEtagFieldNames`. Asked with `errorPolicy=omit`, without which one missing id fails the whole\n\t * request; Azure then leaves out every id it can't return, for whatever reason, so a caller matches the work items\n\t * to its ids by `id`, never by position, and reads an omission as unknown rather than absent. Every failure throws,\n\t * classified as {@link getAzureWorkItem} classifies it.\n\t */\n\tasync getAzureWorkItemsEtagFields(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\tscope: { namespace: string; project: string },\n\t\tids: readonly number[],\n\t\toptions: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<AzureWorkItemResponse[]> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\tconst baseUrl = (options.baseUrl ?? azureDevOpsBaseUrl).replace(/\\/$/, '');\n\t\t// Commas left unencoded, as Azure documents these lists. The same `api-version` as `getAzureWorkItem`, so a\n\t\t// server that serves the full read also serves this check.\n\t\tconst query = `ids=${ids.join(',')}&fields=${azureWorkItemEtagFieldNames.join(',')}&errorPolicy=omit&api-version=6.0`;\n\t\tconst url = `${baseUrl}/${encodeAzurePathSegment(scope.namespace)}/${encodeAzurePathSegment(scope.project)}/_apis/wit/workitems?${query}`;\n\n\t\ttry {\n\t\t\tconst result = await this.request<{ value?: (AzureWorkItemResponse | null)[] } | null>({\n\t\t\t\turl: url,\n\t\t\t\theaders: { Authorization: options.isPAT ? `Basic ${base64(`:${token}`)}` : `Bearer ${token}` },\n\t\t\t});\n\t\t\tconst workItems = result.body?.value;\n\t\t\tif (!Array.isArray(workItems)) throw new Error('Azure DevOps returned no work items');\n\n\t\t\t// Documented to answer an omitted id with `null` in its place; it has been seen to drop it instead.\n\t\t\treturn workItems.filter(w => w != null);\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<AzureWorkItemResponse[]>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * The cheap check behind the batch pull request read's etags: one pull request as Azure DevOps returns it, by the\n\t * same request {@link getPullRequestForRepo} has provider-apis send, but without the repository read it adds for\n\t * clone URLs. `undefined` only by the same not-found rule as {@link getPullRequestForRepo}; every other failure\n\t * throws.\n\t */\n\tasync getAzurePullRequest(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\trepo: { namespace: string; project: string; name: string },\n\t\tid: number,\n\t\toptions: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<AzurePullRequest | undefined> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\tconst baseUrl = (options.baseUrl ?? azureDevOpsBaseUrl).replace(/\\/$/, '');\n\t\tconst url = `${baseUrl}/${encodeAzurePathSegment(repo.namespace)}/${encodeAzurePathSegment(repo.project)}/_apis/git/repositories/${encodeAzurePathSegment(repo.name)}/pullrequests/${id}?api-version=7.1`;\n\n\t\ttry {\n\t\t\tconst result = await this.request<AzurePullRequest | null>({\n\t\t\t\turl: url,\n\t\t\t\theaders: { Authorization: options.isPAT ? `Basic ${base64(`:${token}`)}` : `Bearer ${token}` },\n\t\t\t});\n\t\t\tif (result.body == null) throw new Error(`Azure DevOps returned no pull request ${id}`);\n\n\t\t\treturn result.body;\n\t\t} catch (e) {\n\t\t\tif (isAzureNotFoundResponse(e, azurePullRequestNotFoundTypeKeys)) return undefined;\n\n\t\t\treturn this.handleProviderError<AzurePullRequest | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getCurrentUser(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderAccount | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, 'getCurrentUserFn');\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\treturn (\n\t\t\t\tawait provider.getCurrentUserFn?.(\n\t\t\t\t\t{},\n\t\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t\t)\n\t\t\t)?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderAccount>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getCurrentUserForInstance(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\tnamespace: string,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderAccount | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getCurrentUserForInstanceFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\treturn (\n\t\t\tawait provider.getCurrentUserForInstanceFn?.(\n\t\t\t\t{ namespace: namespace },\n\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t)\n\t\t)?.data;\n\t}\n\n\tasync getCurrentUserForResource(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tresourceId: string,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderAccount | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getCurrentUserForResourceFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\treturn (\n\t\t\t\tawait provider.getCurrentUserForResourceFn?.(\n\t\t\t\t\t{ resourceId: resourceId },\n\t\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t\t)\n\t\t\t)?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderAccount>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getJiraResourcesForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Jira>,\n\t): Promise<ProviderJiraResource[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraResourcesForCurrentUserFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\treturn (await provider.getJiraResourcesForCurrentUserFn?.({ token: token }))?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderJiraResource[] | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getLinearOrganization(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Linear>,\n\t): Promise<ProviderLinearOrganization | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getLinearOrganizationFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst x = await provider.getLinearOrganizationFn?.({ token: token });\n\t\t\tconst y = x?.data;\n\t\t\treturn y;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderLinearOrganization | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getLinearTeamsForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Linear>,\n\t): Promise<ProviderLinearTeam[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getLinearTeamsForCurrentUserFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\treturn (await provider.getLinearTeamsForCurrentUserFn?.({ token: token }))?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderLinearTeam[] | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * Reads issues scoped to Linear teams/projects/labels (Linear's issue-list filter). One page per call —\n\t * follow `paging.cursor`. Linear's `getIssues` has no author/assignee filter, so per-user scoping is\n\t * applied client-side by the caller.\n\t */\n\tasync getLinearIssues(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Linear>,\n\t\tinput: {\n\t\t\tteams?: string[];\n\t\t\tprojects?: string[];\n\t\t\tlabels?: string[];\n\t\t\t/** Omitted reads open issues (workflow state type other than `completed`/`canceled`). */\n\t\t\tstates?: GitIssueState[];\n\t\t},\n\t\toptions?: PagingInput & {\n\t\t\t/** See {@link GetIssuesOptions.sort}. Linear expresses `created`/`updated`, descending only. */\n\t\t\tsort?: IssueSorting;\n\t\t},\n\t): Promise<ProviderApiPagedResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getLinearIssuesFn',\n\t\t);\n\t\treturn this.getPagedResult<ProviderIssue>(\n\t\t\t{ ...input, ...options },\n\t\t\tprovider.getLinearIssuesFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor ?? undefined,\n\t\t);\n\t}\n\n\t/**\n\t * The change state of up to `linearIssuesEtagMaxNumbers` issues of one Linear team, by number, in one GraphQL\n\t * request. Its failures are classified as {@link getIssue}'s are, so a throttled or refused check reads the same.\n\t */\n\tasync getLinearIssuesEtagFields(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Linear>,\n\t\tteamKey: string,\n\t\tnumbers: readonly number[],\n\t): Promise<LinearIssueEtagNode[]> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\n\t\ttry {\n\t\t\treturn await requestLinearIssuesEtagFields(this.request, tokenWithInfo.accessToken, teamKey, numbers);\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<LinearIssueEtagNode[]>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/** Resolves Linear's current user (viewer). The viewer query returns only id/name/email/displayName. */\n\tasync getLinearCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Linear>,\n\t): Promise<{ id: string; name?: string | null; email?: string | null; displayName?: string | null } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getLinearCurrentUserFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\treturn (await provider.getLinearCurrentUserFn?.({ token: token }))?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getAzureResourcesForUser(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer\n\t\t>,\n\t\tuserId: string,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderAzureResource[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getAzureResourcesForUserFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\treturn (\n\t\t\t\tawait provider.getAzureResourcesForUserFn?.(\n\t\t\t\t\t{ userId: userId },\n\t\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t\t)\n\t\t\t)?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderAzureResource[] | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getBitbucketResourcesForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<GitCloudHostIntegrationId.Bitbucket>,\n\t): Promise<ProviderApiPagedResult<ProviderBitbucketResource> | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getBitbucketResourcesForCurrentUserFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\t// Drain every workspace page (numbered): the SDK returns 50 per page, and a user in more than one page\n\t\t// of workspaces would otherwise silently lose the rest (with them, their orgs/PRs). A scoped drain keeps\n\t\t// a successful prefix plus structured failure metadata when a later page fails.\n\t\tconst result = await collectProviderPagedResult(\n\t\t\tasync cursor => {\n\t\t\t\ttry {\n\t\t\t\t\tconst page = parsePageCursor(cursor);\n\t\t\t\t\tconst response = await provider.getBitbucketResourcesForCurrentUserFn?.(\n\t\t\t\t\t\t{ page: page },\n\t\t\t\t\t\t{ token: token },\n\t\t\t\t\t);\n\t\t\t\t\tif (response == null) return undefined;\n\n\t\t\t\t\tconst hasMore = response.pageInfo?.hasNextPage === true;\n\t\t\t\t\tconst nextPage = response.pageInfo?.nextPage;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tvalues: response.data,\n\t\t\t\t\t\tpaging: {\n\t\t\t\t\t\t\tmore: hasMore,\n\t\t\t\t\t\t\tcursor: hasMore && nextPage != null ? toPageCursor(nextPage) : '{}',\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t} catch (ex) {\n\t\t\t\t\treturn this.handleProviderError<ProviderApiPagedResult<ProviderBitbucketResource>>(\n\t\t\t\t\t\ttokenWithInfo,\n\t\t\t\t\t\tex,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\t20,\n\t\t\t{ providerId: tokenWithInfo.providerId },\n\t\t);\n\t\treturn {\n\t\t\tvalues: result.values,\n\t\t\tpaging: { cursor: '{}', more: false, ...(result.truncated ? { truncated: true } : {}) },\n\t\t\t...(result.metadata != null ? { metadata: result.metadata } : {}),\n\t\t};\n\t}\n\n\tasync getBitbucketPullRequestsAuthoredByUserForWorkspace(\n\t\ttokenOptInfo: TokenWithInfo<GitCloudHostIntegrationId.Bitbucket>,\n\t\tuserId: string,\n\t\tworkspaceSlug: string,\n\t\toptions?: { states?: GitPullRequestState[]; page?: number },\n\t): Promise<{ data: ProviderPullRequest[]; hasMore: boolean; nextPage: number | null } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getBitbucketPullRequestsAuthoredByUserForWorkspaceFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getBitbucketPullRequestsAuthoredByUserForWorkspaceFn?.(\n\t\t\t\t{ userId: userId, workspaceSlug: workspaceSlug, states: options?.states, page: options?.page },\n\t\t\t\t{ token: token },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\t\t\treturn { data: result.data, hasMore: result.pageInfo.hasNextPage, nextPage: result.pageInfo.nextPage };\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getBitbucketServerPullRequestsForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<GitSelfManagedHostIntegrationId.BitbucketServer>,\n\t\tbaseUrl: string,\n\t\toptions?: { states?: GitPullRequestState[]; page?: number },\n\t): Promise<{ data: ProviderPullRequest[]; hasMore: boolean; nextPage: number | null } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getBitbucketServerPullRequestsForCurrentUserFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\t\ttry {\n\t\t\tconst result = await provider.getBitbucketServerPullRequestsForCurrentUserFn?.(\n\t\t\t\t{ states: options?.states, page: options?.page },\n\t\t\t\t{ token: token, baseUrl: baseUrl },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\t\t\treturn { data: result.data, hasMore: result.pageInfo.hasNextPage, nextPage: result.pageInfo.nextPage };\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getJiraProjectsForResources(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Jira>,\n\t\tresourceIds: string[],\n\t): Promise<ProviderApiCollectionResult<ProviderJiraProject>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraProjectsForResourcesFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getJiraProjectsForResourcesFn?.(\n\t\t\t\t{ resourceIds: resourceIds },\n\t\t\t\t{ token: token },\n\t\t\t);\n\t\t\t// Preserve the SDK's per-resource completeness/failures instead of collapsing to a bare array, so the\n\t\t\t// Jira integration can cache only proven-successful resources and warn on the failed ones.\n\t\t\treturn { values: result?.data ?? [], metadata: result?.metadata };\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderApiCollectionResult<ProviderJiraProject>>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getJiraProjectsForResource(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Jira>,\n\t\tresourceId: string,\n\t\toptions?: { cursor?: string },\n\t): Promise<ProviderApiPagedResult<ProviderJiraProject>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraProjectsForResourceFn',\n\t\t);\n\n\t\treturn this.getPagedResult(\n\t\t\t{ resourceId: resourceId },\n\t\t\tprovider.getJiraProjectsForResourceFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t);\n\t}\n\n\tasync getAzureProjectsForResource(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer\n\t\t>,\n\t\tnamespace: string,\n\t\toptions?: { cursor?: string; isPAT?: boolean; baseUrl?: string },\n\t): Promise<PagedResult<ProviderAzureProject>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getAzureProjectsForResourceFn',\n\t\t);\n\t\ttry {\n\t\t\treturn await this.getPagedResult<ProviderAzureProject>(\n\t\t\t\t{ namespace: namespace, ...options },\n\t\t\t\tprovider.getAzureProjectsForResourceFn,\n\t\t\t\ttokenWithInfo,\n\t\t\t\toptions?.cursor,\n\t\t\t\toptions?.isPAT,\n\t\t\t\toptions?.baseUrl,\n\t\t\t);\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<PagedResult<ProviderAzureProject>>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getReposForAzureProject(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer\n\t\t>,\n\t\tnamespace: string,\n\t\tproject: string,\n\t\toptions?: GetReposOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<PagedResult<ProviderRepository>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getReposForAzureProjectFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderRepository>(\n\t\t\t{ namespace: namespace, project: project, ...options },\n\t\t\tprovider.getReposForAzureProjectFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getGitHubOrgsForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.GitHub | GitSelfManagedHostIntegrationId.CloudGitHubEnterprise\n\t\t>,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderHierarchyResult<ProviderGitHubOrganization>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getOrgsForCurrentUserFn',\n\t\t);\n\n\t\t// Drain all pages so a user in many orgs doesn't lose everything past the first page, while\n\t\t// surfacing `truncated` when the defensive backstop stops before the listing is exhausted.\n\t\tconst result = await collectProviderPagedResult(\n\t\t\tcursor =>\n\t\t\t\tthis.getPagedResult<ProviderGitHubOrganization>(\n\t\t\t\t\t{},\n\t\t\t\t\tprovider.getOrgsForCurrentUserFn,\n\t\t\t\t\ttokenWithInfo,\n\t\t\t\t\tcursor,\n\t\t\t\t\toptions?.isPAT,\n\t\t\t\t\toptions?.baseUrl,\n\t\t\t\t),\n\t\t\t20,\n\t\t\t{ providerId: tokenWithInfo.providerId },\n\t\t);\n\t\t// This method drains internally and takes no cursor, so a backstop cursor isn't resumable by\n\t\t// callers — keep only the truncation signal rather than exposing a misleading `paging`.\n\t\treturn {\n\t\t\tvalues: result.values,\n\t\t\t...(result.truncated ? { truncated: true } : {}),\n\t\t\t...(result.metadata != null ? { metadata: result.metadata } : {}),\n\t\t};\n\t}\n\n\tasync getReposForOrg(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.GitHub | GitSelfManagedHostIntegrationId.CloudGitHubEnterprise\n\t\t>,\n\t\torgName: string,\n\t\toptions?: GetReposOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<PagedResult<ProviderRepository>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, 'getReposForOrgFn');\n\n\t\treturn this.getPagedResult<ProviderRepository>(\n\t\t\t{ orgName: orgName },\n\t\t\tprovider.getReposForOrgFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getReposForBitbucketWorkspace(\n\t\ttokenOptInfo: TokenWithInfo<GitCloudHostIntegrationId.Bitbucket>,\n\t\tworkspace: string,\n\t\toptions?: GetReposOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<PagedResult<ProviderRepository>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getReposForWorkspaceFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderRepository>(\n\t\t\t{ workspace: workspace },\n\t\t\tprovider.getReposForWorkspaceFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getBitbucketServerProjects(\n\t\ttokenWithInfo: TokenWithInfo<GitSelfManagedHostIntegrationId.BitbucketServer>,\n\t\tbaseUrl: string,\n\t\tconnectionId: string,\n\t): Promise<ProviderHierarchyResult<ProviderOrganization>> {\n\t\tconst { paging: _paging, ...result } = await collectProviderPagedResult(\n\t\t\tcursor => requestBitbucketServerProjects(this.request, tokenWithInfo, baseUrl, connectionId, cursor),\n\t\t\t20,\n\t\t\t{ providerId: tokenWithInfo.providerId },\n\t\t);\n\t\treturn result;\n\t}\n\n\tgetBitbucketServerRepositories(\n\t\ttokenWithInfo: TokenWithInfo<GitSelfManagedHostIntegrationId.BitbucketServer>,\n\t\tbaseUrl: string,\n\t\tconnectionId: string,\n\t\toptions?: { project?: string; cursor?: string },\n\t): Promise<ProviderApiPagedResult<ProviderRepository>> {\n\t\treturn requestBitbucketServerRepositories(this.request, tokenWithInfo, baseUrl, connectionId, options);\n\t}\n\n\tsearchBitbucketServerPullRequestsPage(\n\t\ttokenWithInfo: TokenWithInfo<GitSelfManagedHostIntegrationId.BitbucketServer>,\n\t\toptions: Parameters<typeof searchBitbucketServerPullRequestsPage>[2],\n\t\tcancellation?: AbortSignal,\n\t): Promise<ProviderPullRequestSearchPage> {\n\t\treturn searchBitbucketServerPullRequestsPage(this.request, tokenWithInfo, options, cancellation);\n\t}\n\n\tcountBitbucketServerPullRequests(\n\t\ttokenWithInfo: TokenWithInfo<GitSelfManagedHostIntegrationId.BitbucketServer>,\n\t\toptions: Parameters<typeof countBitbucketServerPullRequests>[2],\n\t\tcancellation?: AbortSignal,\n\t): Promise<ProviderPullRequestCount> {\n\t\treturn countBitbucketServerPullRequests(this.request, tokenWithInfo, options, cancellation);\n\t}\n\n\tasync getReposForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\t| GitCloudHostIntegrationId.GitHub\n\t\t\t| GitSelfManagedHostIntegrationId.CloudGitHubEnterprise\n\t\t\t| GitCloudHostIntegrationId.GitLab\n\t\t\t| GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted\n\t\t>,\n\t\toptions?: GetReposOptions & {\n\t\t\t/** GitHub `/user/repos` affiliation filter; ignored by GitLab's membership read. */\n\t\t\taffiliations?: ('owner' | 'collaborator' | 'organization_member')[];\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t},\n\t): Promise<PagedResult<ProviderRepository>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getReposForCurrentUserFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderRepository>(\n\t\t\toptions?.affiliations != null ? { affiliations: options.affiliations } : {},\n\t\t\tprovider.getReposForCurrentUserFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getGitlabGroupsForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.GitLab | GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted\n\t\t>,\n\t\toptions?: { topLevelOnly?: boolean; isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderHierarchyResult<ProviderGitLabGroup>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getGroupsForCurrentUserFn',\n\t\t);\n\n\t\t// Drain all pages so a user in many groups doesn't lose everything past the first page, while\n\t\t// surfacing `truncated` when the defensive backstop stops before the listing is exhausted.\n\t\tconst result = await collectProviderPagedResult(\n\t\t\tcursor =>\n\t\t\t\tthis.getPagedResult<ProviderGitLabGroup>(\n\t\t\t\t\t{ topLevelOnly: options?.topLevelOnly },\n\t\t\t\t\tprovider.getGroupsForCurrentUserFn,\n\t\t\t\t\ttokenWithInfo,\n\t\t\t\t\tcursor,\n\t\t\t\t\toptions?.isPAT,\n\t\t\t\t\toptions?.baseUrl,\n\t\t\t\t),\n\t\t\t20,\n\t\t\t{ providerId: tokenWithInfo.providerId },\n\t\t);\n\t\t// This method drains internally and takes no cursor, so a backstop cursor isn't resumable by\n\t\t// callers — keep only the truncation signal rather than exposing a misleading `paging`.\n\t\treturn {\n\t\t\tvalues: result.values,\n\t\t\t...(result.truncated ? { truncated: true } : {}),\n\t\t\t...(result.metadata != null ? { metadata: result.metadata } : {}),\n\t\t};\n\t}\n\n\tasync getPullRequestsForRepos(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\treposOrIds: ProviderReposInput,\n\t\toptions?: GetPullRequestsOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getPullRequestsForReposFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderPullRequest>(\n\t\t\t{\n\t\t\t\t...(this.isRepoIdsInput(reposOrIds) ? { repoIds: reposOrIds } : { repos: reposOrIds }),\n\t\t\t\t...options,\n\t\t\t},\n\t\t\tprovider.getPullRequestsForReposFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getPullRequestsForRepo(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\trepo: ProviderRepoInput,\n\t\toptions?: GetPullRequestsOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getPullRequestsForRepoFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderPullRequest>(\n\t\t\t{ repo: repo, ...options },\n\t\t\tprovider.getPullRequestsForRepoFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getPullRequestsForUser(\n\t\ttokenWithInfo: TokenWithInfo<GitCloudHostIntegrationId.Bitbucket>,\n\t\tuserId: string,\n\t\toptions?: { isPAT?: boolean } & GetPullRequestsForUserOptions,\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest>>;\n\tasync getPullRequestsForUser(\n\t\ttokenWithInfo: TokenWithInfo<Exclude<IntegrationIds, GitCloudHostIntegrationId.Bitbucket>>,\n\t\tusername: string,\n\t\toptions?: { isPAT?: boolean } & GetPullRequestsForUserOptions,\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest>>;\n\tasync getPullRequestsForUser(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tusernameOrId: string,\n\t\toptions?: { isPAT?: boolean } & GetPullRequestsForUserOptions,\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getPullRequestsForUserFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderPullRequest>(\n\t\t\t{\n\t\t\t\t...(tokenWithInfo.providerId === GitCloudHostIntegrationId.Bitbucket\n\t\t\t\t\t? { userId: usernameOrId }\n\t\t\t\t\t: { username: usernameOrId }),\n\t\t\t\t...options,\n\t\t\t},\n\t\t\tprovider.getPullRequestsForUserFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getGitLabPullRequestsForUserAssociation(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.GitLab | GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted\n\t\t>,\n\t\tusername: string,\n\t\tassociation: 'assigned' | 'authored' | 'reviewRequested',\n\t\toptions?: {\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t\tstates?: GitPullRequestState[];\n\t\t\tcursor?: string;\n\t\t\tpageSize?: number;\n\t\t},\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getGitLabPullRequestsForUserAssociationFn',\n\t\t);\n\n\t\treturn this.getPagedResult(\n\t\t\t{\n\t\t\t\tusername: username,\n\t\t\t\tassociation: association,\n\t\t\t\tstates: options?.states,\n\t\t\t\tpageSize: options?.pageSize,\n\t\t\t},\n\t\t\tprovider.getGitLabPullRequestsForUserAssociationFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getPullRequestsForAzureProjects(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer\n\t\t>,\n\t\tprojects: { namespace: string; project: string }[],\n\t\toptions?: {\n\t\t\tauthorLogin?: string;\n\t\t\tassigneeLogins?: string[];\n\t\t\treviewerId?: string;\n\t\t\tstates?: GitPullRequestState[];\n\t\t\trepo?: ProviderRepoInput;\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t},\n\t): Promise<ProviderApiCollectionResult<ProviderPullRequest>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getPullRequestsForAzureProjectsFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getPullRequestsForAzureProjectsFn?.(\n\t\t\t\t{\n\t\t\t\t\tprojects: projects,\n\t\t\t\t\tauthorLogin: options?.authorLogin,\n\t\t\t\t\tassigneeLogins: options?.assigneeLogins,\n\t\t\t\t\treviewerId: options?.reviewerId,\n\t\t\t\t\tstates: options?.states,\n\t\t\t\t\trepo: options?.repo,\n\t\t\t\t},\n\t\t\t\t// Azure only supports a Basic credential for this call, so it is sent as one regardless of the\n\t\t\t\t// incoming `options?.isPAT`. The secret goes over raw — provider-apis encodes it itself.\n\t\t\t\t{ token: token, isPAT: true, baseUrl: options?.baseUrl },\n\t\t\t);\n\t\t\t// The SDK's multi-project aggregate preserves successful projects and reports failed/incomplete ones\n\t\t\t// through `metadata` (it has no `pageInfo`); keep it so the account-wide drain can warn on the failed\n\t\t\t// projects and set `fetchFailed` instead of publishing a partial Azure read as complete.\n\t\t\treturn { values: result?.data ?? [], metadata: result?.metadata };\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderApiCollectionResult<ProviderPullRequest>>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * Single Azure project PR read, paginated by number. Unlike {@link getPullRequestsForAzureProjects} (which\n\t * aggregates across projects and exposes no paging), this returns one page plus whether more remain, so a\n\t * caller can drain a project fully.\n\t */\n\tasync getPullRequestsForAzureProject(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer\n\t\t>,\n\t\tproject: { namespace: string; project: string },\n\t\toptions?: {\n\t\t\tauthorLogin?: string;\n\t\t\tassigneeLogins?: string[];\n\t\t\treviewerId?: string;\n\t\t\tstates?: GitPullRequestState[];\n\t\t\trepo?: ProviderRepoInput;\n\t\t\tpage?: number;\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t},\n\t): Promise<{ data: ProviderPullRequest[]; hasMore: boolean; nextPage: number | null } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getPullRequestsForAzureProjectFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getPullRequestsForAzureProjectFn?.(\n\t\t\t\t{\n\t\t\t\t\tnamespace: project.namespace,\n\t\t\t\t\tproject: project.project,\n\t\t\t\t\tauthorLogin: options?.authorLogin,\n\t\t\t\t\tassigneeLogins: options?.assigneeLogins,\n\t\t\t\t\treviewerId: options?.reviewerId,\n\t\t\t\t\tstates: options?.states,\n\t\t\t\t\trepo: options?.repo,\n\t\t\t\t\tpage: options?.page,\n\t\t\t\t},\n\t\t\t\t// Azure only supports a Basic credential for this call, so it is sent as one regardless of the\n\t\t\t\t// incoming `options?.isPAT`. The secret goes over raw — provider-apis encodes it itself.\n\t\t\t\t{ token: token, isPAT: true, baseUrl: options?.baseUrl },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\t\t\treturn { data: result.data, hasMore: result.pageInfo.hasNextPage, nextPage: result.pageInfo.nextPage };\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync mergePullRequest(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tpr: PullRequest,\n\t\toptions?: {\n\t\t\tmergeMethod?: PullRequestMergeMethod;\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t},\n\t): Promise<boolean> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'mergePullRequestFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\t\tconst headRef = pr.refs?.head;\n\t\tif (headRef == null) return false;\n\n\t\tif (provider.id === GitCloudHostIntegrationId.AzureDevOps && pr.project == null) {\n\t\t\treturn false;\n\t\t}\n\n\t\ttry {\n\t\t\tawait provider.mergePullRequestFn?.(\n\t\t\t\t{\n\t\t\t\t\tpullRequest: {\n\t\t\t\t\t\theadRef: { oid: headRef.sha },\n\t\t\t\t\t\tid: pr.id,\n\t\t\t\t\t\tnumber: Number.parseInt(pr.id, 10),\n\t\t\t\t\t\trepository: {\n\t\t\t\t\t\t\tid: pr.repository.repo,\n\t\t\t\t\t\t\tname: pr.repository.repo,\n\t\t\t\t\t\t\tproject: pr.project?.name ?? '',\n\t\t\t\t\t\t\towner: {\n\t\t\t\t\t\t\t\tlogin: pr.repository.owner,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tversion: pr.version,\n\t\t\t\t\t},\n\t\t\t\t\t...options,\n\t\t\t\t},\n\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t);\n\t\t\treturn true;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<boolean>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getIssuesForRepos(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\treposOrIds: ProviderReposInput,\n\t\toptions?: GetIssuesOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderApiPagedResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForReposFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderIssue>(\n\t\t\t{\n\t\t\t\t...(this.isRepoIdsInput(reposOrIds) ? { repoIds: reposOrIds } : { repos: reposOrIds }),\n\t\t\t\t...options,\n\t\t\t},\n\t\t\tprovider.getIssuesForReposFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getIssuesForRepo(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\trepo: ProviderRepoInput,\n\t\toptions?: GetIssuesOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<PagedResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForRepoFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderIssue>(\n\t\t\t{ repo: repo, ...options },\n\t\t\tprovider.getIssuesForRepoFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getIssuesForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\toptions?: PagingInput & {\n\t\t\t// Forwarded to the provider fn (GitLab's account-wide REST read); Linear ignores them.\n\t\t\tscope?: 'assigned_to_me' | 'all';\n\t\t\tassigneeUsername?: string;\n\t\t\t/**\n\t\t\t * Narrows to issues authored by this user. Honored as of `@gitkraken/provider-apis` 0.54.0\n\t\t\t * (`author_username`); it composes with `assigneeUsername` as AND, so a caller wanting the UNION of the\n\t\t\t * two relationships must read each separately (see GitLab's account-wide issue read).\n\t\t\t */\n\t\t\tauthorUsername?: string;\n\t\t\tpageSize?: number;\n\t\t\t/** Linear only; GitLab's REST read ignores it. Omitted reads open issues. */\n\t\t\tstates?: GitIssueState[];\n\t\t\t/** See {@link GetIssuesOptions.sort}. Forwarded to the provider fn; ordering is translated in the SDK. */\n\t\t\tsort?: IssueSorting;\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t},\n\t): Promise<PagedResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForCurrentUserFn',\n\t\t);\n\t\treturn this.getPagedResult<ProviderIssue>(\n\t\t\t{\n\t\t\t\tscope: options?.scope,\n\t\t\t\tassigneeUsername: options?.assigneeUsername,\n\t\t\t\tauthorUsername: options?.authorUsername,\n\t\t\t\tpage: options?.page,\n\t\t\t\tpageSize: options?.pageSize,\n\t\t\t\tstates: options?.states,\n\t\t\t\tsort: options?.sort,\n\t\t\t},\n\t\t\tprovider.getIssuesForCurrentUserFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor ?? undefined,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getIssuesForAzureProject(\n\t\ttokenOptInfo: TokenOptInfo<\n\t\t\tGitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer\n\t\t>,\n\t\tnamespace: string,\n\t\tproject: string,\n\t\toptions?: GetIssuesOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<PagedResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForAzureProjectFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderIssue>(\n\t\t\t{ namespace: namespace, project: project, ...options },\n\t\t\tprovider.getIssuesForAzureProjectFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getIssuesForProject(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tproject: string,\n\t\tresourceId: string,\n\t\toptions?: GetIssuesOptions,\n\t): Promise<ProviderIssue[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForProjectFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getIssuesForProjectFn?.(\n\t\t\t\t{\n\t\t\t\t\tprojectKey: project,\n\t\t\t\t\tresourceId: resourceId,\n\t\t\t\t\t...options,\n\t\t\t\t\tincludeTransitions: jiraListIncludeTransitions,\n\t\t\t\t},\n\t\t\t\t{ token: token },\n\t\t\t);\n\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderIssue[] | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * Single page of {@link getIssuesForProject} that preserves the SDK's `pageInfo` so a caller can drain\n\t * every page (the plain {@link getIssuesForProject} discards it, silently capping at the first page).\n\t * `nextCursor` is the raw provider cursor (Jira offset / nextPageToken) fed back verbatim as `options.cursor`.\n\t */\n\tasync getIssuesForProjectPaged(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tproject: string,\n\t\tresourceId: string,\n\t\toptions?: GetIssuesOptions,\n\t): Promise<{ data: ProviderIssue[]; hasMore: boolean; nextCursor: string | undefined } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForProjectFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getIssuesForProjectFn?.(\n\t\t\t\t{\n\t\t\t\t\tprojectKey: project,\n\t\t\t\t\tresourceId: resourceId,\n\t\t\t\t\t...options,\n\t\t\t\t\tincludeTransitions: jiraListIncludeTransitions,\n\t\t\t\t},\n\t\t\t\t{ token: token },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\t\t\treturn {\n\t\t\t\tdata: result.data,\n\t\t\t\thasMore: result.pageInfo?.hasNextPage ?? false,\n\t\t\t\tnextCursor: result.pageInfo?.endCursor ?? undefined,\n\t\t\t};\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t// Jira Server reads. Every one of them is addressed by `baseUrl` — the connection's own host — rather than\n\t// by a resource id: a self-hosted instance IS the resource, and routing by anything else would send one\n\t// host's token to another. `baseUrl` is therefore required, not optional, on all of them.\n\tasync getJiraServerCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>,\n\t\tbaseUrl: string,\n\t): Promise<ProviderAccount | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraServerCurrentUserFn',\n\t\t);\n\n\t\ttry {\n\t\t\tconst result = await provider.getJiraServerCurrentUserFn?.({\n\t\t\t\ttoken: tokenWithInfo.accessToken,\n\t\t\t\tbaseUrl: baseUrl,\n\t\t\t});\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderAccount | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * Jira Server's project list, which is a single unpaged `/rest/api/2/project` read rather than Cloud's\n\t * paged `project/search`, so there is no cursor to thread and the result is always the complete set.\n\t */\n\tasync getJiraServerProjects(\n\t\ttokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>,\n\t\tbaseUrl: string,\n\t): Promise<ProviderJiraServerProject[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraServerProjectsFn',\n\t\t);\n\n\t\ttry {\n\t\t\tconst result = await provider.getJiraServerProjectsFn?.({\n\t\t\t\ttoken: tokenWithInfo.accessToken,\n\t\t\t\tbaseUrl: baseUrl,\n\t\t\t});\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderJiraServerProject[] | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * One page of a Jira Server project's issues, preserving the SDK's `pageInfo` so the integration can drain\n\t * every page — the same contract as {@link getIssuesForProjectPaged} on Cloud.\n\t */\n\tasync getJiraServerIssuesForProjectPaged(\n\t\ttokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>,\n\t\tbaseUrl: string,\n\t\tprojectKey: string,\n\t\toptions?: GetIssuesOptions,\n\t): Promise<{ data: ProviderIssue[]; hasMore: boolean; nextCursor: string | undefined } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraServerIssuesForProjectFn',\n\t\t);\n\n\t\ttry {\n\t\t\tconst result = await provider.getJiraServerIssuesForProjectFn?.(\n\t\t\t\t{ projectKey: projectKey, ...options, includeTransitions: jiraListIncludeTransitions },\n\t\t\t\t{ token: tokenWithInfo.accessToken, baseUrl: baseUrl },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\n\t\t\treturn {\n\t\t\t\tdata: result.data,\n\t\t\t\thasMore: result.pageInfo?.hasNextPage ?? false,\n\t\t\t\tnextCursor: result.pageInfo?.endCursor ?? undefined,\n\t\t\t};\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getJiraServerIssue(\n\t\ttokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>,\n\t\tbaseUrl: string,\n\t\tnumber: string,\n\t): Promise<ProviderIssue | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraServerIssueFn',\n\t\t);\n\n\t\ttry {\n\t\t\tconst result = await provider.getJiraServerIssueFn?.(\n\t\t\t\t{ number: number },\n\t\t\t\t{ token: tokenWithInfo.accessToken, baseUrl: baseUrl },\n\t\t\t);\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\t// A key that names no issue is a lookup MISS, not a failure: both callers\n\t\t\t// (`getProviderLinkedIssueOrPullRequest`, `getProviderIssue`) read an autolink or a stored\n\t\t\t// reference that may simply be gone, and translating it would surface a `RequestNotFoundError`\n\t\t\t// where Jira Cloud's `getJiraIssueByKey` and the generic `getIssue` both return undefined.\n\t\t\tif (isProviderIssueNotFoundError(tokenWithInfo.providerId, e)) return undefined;\n\n\t\t\treturn this.handleProviderError<ProviderIssue | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/** The account-wide read: every issue related to the current user on this instance, no project needed. */\n\tasync getJiraServerIssuesForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>,\n\t\tbaseUrl: string,\n\t\toptions?: { cursor?: string; states?: GitIssueState[]; sort?: IssueSorting },\n\t): Promise<{ data: ProviderIssue[]; hasMore: boolean; nextCursor: string | undefined } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraServerIssuesForCurrentUserFn',\n\t\t);\n\n\t\ttry {\n\t\t\tconst result = await provider.getJiraServerIssuesForCurrentUserFn?.(\n\t\t\t\t{\n\t\t\t\t\tcursor: options?.cursor,\n\t\t\t\t\tstates: options?.states,\n\t\t\t\t\tsort: options?.sort,\n\t\t\t\t\tincludeTransitions: jiraListIncludeTransitions,\n\t\t\t\t},\n\t\t\t\t{ token: tokenWithInfo.accessToken, baseUrl: baseUrl },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\n\t\t\treturn {\n\t\t\t\tdata: result.data,\n\t\t\t\thasMore: result.pageInfo?.hasNextPage ?? false,\n\t\t\t\tnextCursor: result.pageInfo?.endCursor ?? undefined,\n\t\t\t};\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getTrelloCard(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Trello>,\n\t\tappKey: string,\n\t\tcardId: string,\n\t\toptions?: { trelloBoardListsById?: Record<string, { name: string }> },\n\t): Promise<ProviderIssue | undefined> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\n\t\ttry {\n\t\t\tconst result = await this.request<TrelloCardResponse>({\n\t\t\t\turl: `${trelloBaseUrl}/1/cards/${encodeURIComponent(cardId)}?members=true`,\n\t\t\t\theaders: getTrelloAuthHeaders(appKey, tokenWithInfo.accessToken),\n\t\t\t});\n\n\t\t\treturn fromTrelloCard(result.body, options?.trelloBoardListsById ?? {});\n\t\t} catch (e) {\n\t\t\ttry {\n\t\t\t\treturn this.handleProviderError<ProviderIssue | undefined>(tokenWithInfo, e);\n\t\t\t} catch (ex) {\n\t\t\t\tif (RequestNotFoundError.is(ex)) return undefined;\n\t\t\t\tthrow ex;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Trello reads. The Trello client is keyed by an `appKey` (the Trello app key from the cloud token exchange)\n\t// paired with the OAuth token, so each wrapper threads `appKey` through alongside `tokenWithInfo`.\n\tasync getTrelloCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tappKey: string,\n\t): Promise<\n\t\t{ id: string; name: string; email: string; username: string; url: string; avatarUrl: string | null } | undefined\n\t> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getTrelloCurrentUserFn',\n\t\t);\n\t\ttry {\n\t\t\tconst result = await provider.getTrelloCurrentUserFn?.(\n\t\t\t\t{ appKey: appKey },\n\t\t\t\t{ token: tokenWithInfo.accessToken },\n\t\t\t);\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getTrelloBoardsForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tappKey: string,\n\t): Promise<TrelloBoard[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getTrelloBoardsForCurrentUserFn',\n\t\t);\n\t\ttry {\n\t\t\tconst result = await provider.getTrelloBoardsForCurrentUserFn?.(\n\t\t\t\t{ appKey: appKey },\n\t\t\t\t{ token: tokenWithInfo.accessToken },\n\t\t\t);\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getTrelloListsForBoard(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tappKey: string,\n\t\tboardId: string,\n\t): Promise<TrelloList[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getTrelloListsForBoardFn',\n\t\t);\n\t\ttry {\n\t\t\tconst result = await provider.getTrelloListsForBoardFn?.(\n\t\t\t\t{ appKey: appKey, boardId: boardId },\n\t\t\t\t{ token: tokenWithInfo.accessToken },\n\t\t\t);\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getTrelloIssuesForBoard(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tappKey: string,\n\t\tboardId: string,\n\t\toptions?: {\n\t\t\tassigneeLogins?: string[];\n\t\t\ttrelloBoardListsById?: Record<string, { name: string }>;\n\t\t\t/** See {@link GetIssuesOptions.sort}. Trello expresses only `updated`, in either direction. */\n\t\t\tsort?: IssueSorting;\n\t\t},\n\t): Promise<ProviderApiCollectionResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getTrelloIssuesForBoardFn',\n\t\t);\n\t\ttry {\n\t\t\tconst result = await provider.getTrelloIssuesForBoardFn?.(\n\t\t\t\t{ appKey: appKey, boardId: boardId, ...options },\n\t\t\t\t{ token: tokenWithInfo.accessToken },\n\t\t\t);\n\t\t\t// Trello's search caps results and reports the cap through `metadata.completeness` (never a cursor).\n\t\t\t// Preserve it so the integration can signal a terminal truncation rather than a fake next page.\n\t\t\treturn { values: result?.data ?? [], metadata: result?.metadata };\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderApiCollectionResult<ProviderIssue>>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getIssuesForResourceForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tresourceId: string,\n\t\toptions?: {\n\t\t\tcursor?: string;\n\t\t\t/**\n\t\t\t * See {@link GetIssuesOptions.sort}. Forwarded for the same reason as every sibling issue read, even\n\t\t\t * though nothing reaches this one with a sort today: `IssuesIntegration.searchProviderMyIssues` is the\n\t\t\t * only caller and takes no options. A wrapper that accepted the SDK's input and silently dropped one\n\t\t\t * field of it would give whoever adds that option no ordering and no error.\n\t\t\t */\n\t\t\tsort?: IssueSorting;\n\t\t\t/** Omitted reads open issues (`statusCategory != Done`). */\n\t\t\tstates?: GitIssueState[];\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t},\n\t): Promise<PagedResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForResourceForCurrentUserFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderIssue>(\n\t\t\t{\n\t\t\t\tresourceId: resourceId,\n\t\t\t\tstates: options?.states,\n\t\t\t\tsort: options?.sort,\n\t\t\t\tincludeTransitions: jiraListIncludeTransitions,\n\t\t\t},\n\t\t\tprovider.getIssuesForResourceForCurrentUserFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getJiraIssueByKey(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Jira>,\n\t\tresourceId: string,\n\t\tresourceUrl: string,\n\t\tkey: string,\n\t): Promise<ProviderIssue | undefined> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\n\t\ttry {\n\t\t\treturn await requestJiraIssueByKey(this.request, tokenWithInfo.accessToken, resourceId, resourceUrl, key);\n\t\t} catch (e) {\n\t\t\tconst status = (e as { response?: { status?: unknown } }).response?.status;\n\t\t\tif (status === 404) return undefined;\n\n\t\t\treturn this.handleProviderError<ProviderIssue | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * The change state of up to `jiraBulkFetchMaxKeys` issues of one Jira Cloud site, in one bulk fetch. Unlike\n\t * {@link getJiraIssueByKey}, a 404 is a failure: it names a wrong site or endpoint, never an absent issue.\n\t */\n\tasync getJiraIssuesEtagFields(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Jira>,\n\t\tresourceId: string,\n\t\tkeys: readonly string[],\n\t): Promise<{ issues: JiraIssueEtagResponse[]; errorCount: number }> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\n\t\ttry {\n\t\t\treturn await requestJiraIssuesEtagFields(this.request, tokenWithInfo.accessToken, resourceId, keys);\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<{ issues: JiraIssueEtagResponse[]; errorCount: number }>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getIssue(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tinput: { resourceId: string; number: string } | { namespace: string; name: string; number: string },\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderIssue | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, 'getIssueFn');\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getIssueFn?.(input, {\n\t\t\t\ttoken: token,\n\t\t\t\tisPAT: options?.isPAT,\n\t\t\t\tbaseUrl: options?.baseUrl,\n\t\t\t});\n\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\tif (isProviderIssueNotFoundError(tokenWithInfo.providerId, e)) return undefined;\n\n\t\t\treturn this.handleProviderError<ProviderIssue | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n}\n\n// This is copied over from the shared provider library because the current version is not respecting the \"forceIsFetch: true\"\n// option in the config and our custom fetch function isn't being wrapped by the necessary fetch wrapper. Remove this once the library\n// properly wraps our custom fetch and use `forceIsFetch: true` in the config.\nexport async function parseFetchResponseForApi<T>(response: Response): Promise<ProviderRequestResponse<T>> {\n\t// Media types are case-insensitive (RFC 9110 §8.3.1) and `fetch` hands the header back exactly as the server\n\t// wrote it, so match on a lowercased copy rather than the raw value.\n\tconst contentType = (response.headers.get('content-type') || '').toLowerCase();\n\tlet body;\n\tlet servedHtml = false;\n\n\t// parse the response body\n\tif (contentType.startsWith('application/json')) {\n\t\tconst text = await response.text();\n\t\t// A sign-in page a server mislabels as JSON is the same page under another header, and `<` can never open\n\t\t// valid JSON — so recognize it rather than letting JSON.parse throw a SyntaxError carrying no status.\n\t\tif (text.trimStart().startsWith('<')) {\n\t\t\tservedHtml = true;\n\t\t\tbody = text;\n\t\t} else {\n\t\t\tbody = text.trim().length > 0 ? JSON.parse(text) : null;\n\t\t}\n\t} else if (contentType.startsWith('text/') || contentType === '') {\n\t\tbody = await response.text();\n\t\t// An empty body is never a sign-in page, and a write answering `204` can carry a stale `text/html` from\n\t\t// whatever its endpoint usually returns — so require actual markup, not just the header.\n\t\tservedHtml = contentType.startsWith('text/html') && body.trim().length > 0;\n\t} else if (contentType.startsWith('application/vnd.github.raw+json')) {\n\t\tbody = await response.arrayBuffer();\n\t} else {\n\t\tthrow new Error(`Unsupported content-type: ${contentType}`);\n\t}\n\n\tconst result = {\n\t\tbody: body,\n\t\theaders: Object.fromEntries(response.headers.entries()),\n\t\tstatus: response.status,\n\t\tstatusText: response.statusText,\n\t};\n\n\t// A 2xx carrying a page rather than data is a rejected credential wearing a success status (GKDEV-3617); a\n\t// non-2xx keeps its own status error below, which is the better diagnostic.\n\tif (response.ok && servedHtml) {\n\t\tthrow new UnexpectedHtmlResponseError(response.status, contentType, result);\n\t}\n\n\t// throw an error if the response is not ok\n\tif (!response.ok) {\n\t\tconst status = `(${response.status})${response.statusText ? ` ${response.statusText}` : ''}.`;\n\t\tconst detail = getProviderResponseBodyMessage(body);\n\t\tconst error = new Error(detail != null ? `${status} ${detail}` : status);\n\t\tObject.assign(error, { response: result });\n\t\tthrow error;\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsGA,MAAM,qBACJ,aAAyE,WAAW;AAKtF,MAAM,sBAAsB;AAQ5B,SAAS,gBAAgB,IAAkC;CAC1D,OAAO,cAAc,SAAS,MAAM,QAAS,GAA8B,aAAa;AACzF;AAQA,SAAS,2BAA2B,IAAsB;CAMzD,IAAI,gBAAgB,EAAE,GAAG;EACxB,MAAM,SAAS,GAAG;EAKlB,IAAI,QAAQ,QACX,OAAO,OAAO,MACZ,MAAoB,EAAE,SAAS,gBAAgB,EAAE,QAAQ,QAAQ,EAAE,KAAK,SAAS,YAAY,EAC/F;EAED,OAAO,oBAAoB,K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C,MAAM,IAAI,MAAM,6BAA6B,aAAa;CAG3D,MAAM,SAAS;EACR;EACN,SAAS,OAAO,YAAY,SAAS,QAAQ,QAAQ,CAAC;EACtD,QAAQ,SAAS;EACjB,YAAY,SAAS;CACtB;CAIA,IAAI,SAAS,MAAM,YAClB,MAAM,IAAI,4BAA4B,SAAS,QAAQ,aAAa,MAAM;CAI3E,IAAI,CAAC,SAAS,IAAI;EACjB,MAAM,SAAS,IAAI,SAAS,OAAO,GAAG,SAAS,aAAa,IAAI,SAAS,eAAe,GAAG;EAC3F,MAAM,SAAS,+BAA+B,IAAI;EAClD,MAAM,QAAQ,IAAI,MAAM,UAAU,OAAO,GAAG,OAAO,GAAG,WAAW,MAAM;EACvE,OAAO,OAAO,OAAO,EAAE,UAAU,OAAO,CAAC;EACzC,MAAM;CACP;CAEA,OAAO;AACR"}
1
+ {"version":3,"file":"providersApi.js","names":[],"sources":["../../../../../plus/integrations/src/providers/providersApi.ts"],"sourcesContent":["import ProviderApis from '@gitkraken/provider-apis';\nimport type {\n\tCollectionMetadata,\n\tGitIssueState,\n\tGitPullRequestState,\n\tGraphQLError,\n\tGraphQLErrors,\n\tTrelloBoard,\n\tTrelloList,\n} from '@gitkraken/provider-apis';\nimport type { PullRequest, PullRequestMergeMethod } from '@gitlens/git/models/pullRequest.js';\nimport { base64 } from '@gitlens/utils/base64.js';\nimport type { PagedResult } from '@gitlens/utils/paging.js';\nimport type { IntegrationAuthenticationService } from '../authentication/integrationAuthenticationService.js';\nimport type { TokenOptInfo, TokenWithInfo } from '../authentication/models.js';\nimport { toTokenWithInfo } from '../authentication/models.js';\nimport { isIncompleteCollection } from '../collectionMetadata.js';\nimport type { IntegrationIds } from '../constants.js';\nimport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n} from '../constants.js';\nimport { RequestNotFoundError, toError } from '../errors.js';\nimport type { ProviderPullRequestCount, ProviderPullRequestSearchPage } from '../models/pullRequestReads.js';\nimport type { AzurePullRequest, AzureWorkItemResponse } from './azure/models.js';\nimport {\n\tazureWorkItemEtagFieldNames,\n\tencodeAzurePathSegment,\n\tfromAzureWorkItemToProviderIssue,\n} from './azure/models.js';\nimport { requestBitbucketServerProjects, requestBitbucketServerRepositories } from './bitbucket-server/discovery.js';\nimport {\n\tcountBitbucketServerPullRequests,\n\tsearchBitbucketServerPullRequestsPage,\n} from './bitbucket-server/pullRequestSearch.js';\nimport type { JiraIssueEtagResponse } from './jiraIssueByKey.js';\nimport { requestJiraIssueByKey, requestJiraIssuesEtagFields } from './jiraIssueByKey.js';\nimport type { LinearIssueEtagNode } from './linearIssuesEtag.js';\nimport { requestLinearIssuesEtagFields } from './linearIssuesEtag.js';\nimport type {\n\tGetIssueFn,\n\tGetIssuesForReposFn,\n\tGetIssuesOptions,\n\tGetPullRequestsForReposFn,\n\tGetPullRequestsForUserFn,\n\tGetPullRequestsForUserOptions,\n\tGetPullRequestsOptions,\n\tGetReposOptions,\n\tIssueFilter,\n\tIssueSorting,\n\tPageInfo,\n\tPagingInput,\n\tPagingMode,\n\tProviderAccount,\n\tProviderApiCollectionResult,\n\tProviderApiPagedResult,\n\tProviderAzureProject,\n\tProviderAzureResource,\n\tProviderBitbucketResource,\n\tProviderGitHubOrganization,\n\tProviderGitLabGroup,\n\tProviderHierarchyResult,\n\tProviderInfo,\n\tProviderIssue,\n\tProviderJiraProject,\n\tProviderJiraResource,\n\tProviderJiraServerProject,\n\tProviderLinearOrganization,\n\tProviderLinearTeam,\n\tProviderOrganization,\n\tProviderPullRequest,\n\tProviderRepoInput,\n\tProviderReposInput,\n\tProviderRepository,\n\tProviderRequestFunction,\n\tProviderRequestOptions,\n\tProviderRequestResponse,\n\tProviders,\n\tPullRequestFilter,\n} from './models.js';\nimport { isRepoIdsInput, providersMetadata } from './models.js';\nimport {\n\tgetProviderResponseBodyMessage,\n\tisAzureProviderId,\n\tisProviderIssueNotFoundError,\n\tthrowProviderError,\n\tUnexpectedHtmlResponseError,\n} from './providerErrors.js';\nimport {\n\tcollectProviderPagedResult,\n\tmergeCollectionMetadata,\n\tparsePageCursor,\n\ttoPageCursor,\n} from './utils/providerPaging.js';\n\n// `@gitkraken/provider-apis` is published as CommonJS with its factory on the `default` export.\n// How that surfaces depends on the consuming bundler's CJS->ESM interop: esbuild yields the\n// callable factory directly, while webpack and Node surface the module namespace (with the\n// factory under `.default`). Normalize to the callable factory so every consumer resolves it.\ntype ProviderApisFactory = typeof ProviderApis;\nconst createProviderApis: ProviderApisFactory =\n\t(ProviderApis as ProviderApisFactory & { default?: ProviderApisFactory }).default ?? ProviderApis;\n\n// Both GitHub and GitLab `getRepo` throw a missing-repo error whose message is exactly\n// `Repository <x> not found`. Anchoring to that shape (rather than a loose `not found` substring) keeps\n// the message fallbacks from misclassifying unrelated GraphQL/transport failures as a confident negative.\nconst repoNotFoundMessage = /^Repository .+ not found$/i;\n// Duck-typed rather than `ex instanceof GraphQLErrors`, because importing the class as a value makes this\n// module unloadable from plain Node ESM consumers: `@gitkraken/provider-apis` is CommonJS and declares its\n// exports through getters, which Node's `cjs-module-lexer` cannot see, so the only named exports it can\n// synthesize are `default` and `module.exports`. Bundled hosts (webpack/esbuild) bind the named export\n// fine, but the published package keeps third-party deps external, so the named import survives into\n// consumers and breaks linking there. The SDK's constructor always assigns `graphQLErrors` (defaulting to\n// `[]`) and it is the only SDK error carrying that field, so the shape check is unambiguous.\nfunction isGraphQLErrors(ex: unknown): ex is GraphQLErrors {\n\treturn ex instanceof Error && Array.isArray((ex as Partial<GraphQLErrors>).graphQLErrors);\n}\n\n// `handleProviderError` classifies not-found by HTTP status (404/410/422), which only works for the\n// REST `getRepo` clients (Bitbucket, Bitbucket Server, Azure DevOps). GitHub and GitLab `getRepo` are\n// GraphQL: a missing repo comes back as HTTP 200 with a null node, and the SDK throws an unclassified\n// error with no `response.status`, so it would otherwise fall through to the generic error bucket. This\n// detects the SDK's not-found shapes so `getRepo` can rethrow them as `RequestNotFoundError`, keeping the\n// facade's by-type mapping intact.\nfunction isGraphQLRepoNotFoundError(ex: unknown): boolean {\n\t// GitHub throws `GraphQLErrors`. The SDK reports the null repository node with the same\n\t// `Repository <x> not found` message regardless of the underlying cause, so a `FORBIDDEN` or\n\t// `RATE_LIMITED` GraphQL error would also surface with that message. Trust the structured error type\n\t// when entries are present (only `NOT_FOUND` is a real not-found), and fall back to the repo-specific\n\t// message only when there are no entries to disambiguate (a bare null node).\n\tif (isGraphQLErrors(ex)) {\n\t\tconst errors = ex.graphQLErrors;\n\t\t// Scope NOT_FOUND to the `repository` field: `getRepo`'s query only selects that node today, but\n\t\t// were it to grow other selections that can emit NOT_FOUND, an unscoped check would misclassify\n\t\t// them. Tolerate a missing `path` so we degrade to the current behavior if the SDK stops populating\n\t\t// it, rather than silently regressing to `error`.\n\t\tif (errors?.length) {\n\t\t\treturn errors.some(\n\t\t\t\t(e: GraphQLError) => e.type === 'NOT_FOUND' && (e.path == null || e.path.includes('repository')),\n\t\t\t);\n\t\t}\n\t\treturn repoNotFoundMessage.test(ex.message);\n\t}\n\n\t// GitLab's `getRepo` throws a plain Error; match its not-found message specifically so unrelated\n\t// bare Errors (network/parse failures) still reach the generic error bucket.\n\treturn ex instanceof Error && repoNotFoundMessage.test(ex.message);\n}\n\n// provider-apis' GitLab `getIssue` throws a plain Error with exactly this message for a null issue (and\n// `repoNotFoundMessage`'s for a null project). Its GraphQL helper ignores `errors`, so a reply carrying only errors\n// throws the same messages; neither proves a miss on its own.\nconst gitLabIssueNotFoundMessage = /^Issue .+ not found$/i;\n\n// The `typeKey`s Azure DevOps itself uses for \"this pull request/repository/project does not exist\". A 404 can\n// also come from a wrong path (e.g. an Azure DevOps Server virtual directory or collection misconfigured), which\n// answers with an HTML error page instead of this shape, so the body must be checked, not just the status.\nconst azurePullRequestNotFoundTypeKeys = new Set([\n\t'GitPullRequestNotFoundException',\n\t'GitRepositoryNotFoundException',\n\t'ProjectDoesNotExistWithNameException',\n]);\n\n// The same for a work item. Azure answers a missing work item with TF401232, \"Work item N does not exist, or you\n// do not have permissions to read it\" — one type for both, so absent here means \"not visible to this connection\",\n// as it does for every other batch read.\nconst azureWorkItemNotFoundTypeKeys = new Set([\n\t'WorkItemUnauthorizedAccessException',\n\t'ProjectDoesNotExistWithNameException',\n]);\n\nfunction isAzureNotFoundResponse(ex: unknown, typeKeys: ReadonlySet<string>): boolean {\n\tconst response = (ex as { response?: { status?: unknown; body?: unknown } } | undefined)?.response;\n\tif (response?.status !== 404 || response.body == null || typeof response.body !== 'object') return false;\n\n\tconst typeKey = (response.body as { typeKey?: unknown }).typeKey;\n\treturn typeof typeKey === 'string' && typeKeys.has(typeKey);\n}\n\n/** The credential provider-apis sends Azure DevOps: a PAT as Basic (encoded here, as it does), anything else as a bearer. */\nfunction azureAuthorization(token: string, isPAT: boolean | undefined): string {\n\treturn isPAT ? `Basic ${base64(`:${token}`)}` : `Bearer ${token}`;\n}\n\nconst azureDevOpsBaseUrl = 'https://dev.azure.com';\n/** The most group descriptors one identity batch read resolves. */\nconst azureIdentityBatchSize = 100;\n/** Azure DevOps Services serves the identity APIs from its own host, below the organization like the main one. */\nconst azureDevOpsIdentityBaseUrl = 'https://vssps.dev.azure.com';\nconst trelloBaseUrl = 'https://api.trello.com';\n\n/**\n * Jira computes an issue's available transitions per issue, from the workflow and the reader's permissions, so a\n * list read at a page size of 100 pays for 100 of those in both server work and response payload. Nothing in this\n * package reads `statusTransitions` off a list — only the singular `getIssue` path exposes them, and it always\n * expands them — so every list read opts out. Revisit the day a list row offers a status change straight off it.\n */\nconst jiraListIncludeTransitions = false;\n\ntype TrelloMemberResponse = {\n\tid: string;\n\tusername?: string | null;\n\tfullName?: string | null;\n\tavatarHash?: string | null;\n\tavatarUrl?: string | null;\n};\n\ntype TrelloCardResponse = {\n\tid: string;\n\tidShort: number;\n\tname: string;\n\turl: string;\n\tdateLastActivity: string;\n\tidList?: string | null;\n\tbadges?: {\n\t\tcomments?: number | null;\n\t\tvotes?: number | null;\n\t};\n\tmembers?: TrelloMemberResponse[];\n\tlabels?: Array<{ color: string | null; id: string; name: string }>;\n};\n\nfunction getTrelloAuthHeaders(appKey: string, token: string): Record<string, string> {\n\treturn {\n\t\tAuthorization: `OAuth oauth_consumer_key=\"${appKey}\", oauth_token=\"${token}\"`,\n\t};\n}\n\nfunction getTrelloMemberAvatarUrl(member: TrelloMemberResponse): string | null {\n\tif (member.avatarUrl != null) return member.avatarUrl;\n\tif (member.avatarHash == null) return null;\n\n\treturn `https://trello-members.s3.amazonaws.com/${member.id}/${member.avatarHash}/50.png`;\n}\n\nfunction fromTrelloCard(\n\tcard: TrelloCardResponse,\n\ttrelloBoardListsById: Record<string, { name: string }>,\n): ProviderIssue {\n\tconst createdDate = new Date(1000 * parseInt(card.id.substring(0, 8), 16));\n\tconst list = card.idList != null ? trelloBoardListsById[card.idList] : undefined;\n\n\treturn {\n\t\tid: card.id,\n\t\tcommentCount: card.badges?.comments ?? null,\n\t\tnumber: String(card.idShort),\n\t\ttitle: card.name,\n\t\turl: card.url,\n\t\tclosedDate: null,\n\t\tcreatedDate: new Date(createdDate.toISOString()),\n\t\tauthor: null,\n\t\tupdatedDate: new Date(card.dateLastActivity),\n\t\tassignees: (card.members ?? []).map(member => ({\n\t\t\tid: member.id,\n\t\t\tusername: member.username ?? null,\n\t\t\tname: member.fullName ?? null,\n\t\t\temail: null,\n\t\t\tavatarUrl: getTrelloMemberAvatarUrl(member),\n\t\t\turl: null,\n\t\t})),\n\t\tdescription: null,\n\t\tstate: list != null ? { id: card.idList!, name: list.name, color: null } : null,\n\t\ttype: null,\n\t\trepository: null,\n\t\tupvoteCount: card.badges?.votes ?? null,\n\t\tlabels: (card.labels ?? []).map(label => ({\n\t\t\tcolor: label.color,\n\t\t\tdescription: null,\n\t\t\tid: label.id,\n\t\t\tname: label.name,\n\t\t})),\n\t};\n}\n\nexport class ProvidersApi {\n\tprivate readonly providers: Providers;\n\tprivate readonly request: ProviderRequestFunction;\n\n\tconstructor(private readonly authenticationService: IntegrationAuthenticationService) {\n\t\tconst http = authenticationService.ctx.http;\n\t\tconst userAgent = http.userAgent;\n\t\tconst customFetch: ProviderRequestFunction = async <T>({\n\t\t\turl,\n\t\t\t...options\n\t\t}: ProviderRequestOptions): Promise<ProviderRequestResponse<T>> => {\n\t\t\tconst response = await http.fetch(url, {\n\t\t\t\t...options,\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': userAgent,\n\t\t\t\t\t...options.headers,\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn parseFetchResponseForApi<T>(response);\n\t\t};\n\t\tthis.request = customFetch;\n\t\tconst providerApis = createProviderApis({ request: customFetch });\n\t\tthis.providers = {\n\t\t\t[GitCloudHostIntegrationId.GitHub]: {\n\t\t\t\t...providersMetadata[GitCloudHostIntegrationId.GitHub],\n\t\t\t\tprovider: providerApis.github,\n\t\t\t\tgetRepoFn: providerApis.github.getRepo.bind(providerApis.github),\n\t\t\t\tgetCurrentUserFn: providerApis.github.getCurrentUser.bind(providerApis.github),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.github.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.github,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForUserFn: providerApis.github.getPullRequestsAssociatedWithUser.bind(\n\t\t\t\t\tproviderApis.github,\n\t\t\t\t) as GetPullRequestsForUserFn,\n\t\t\t\tgetIssuesForReposFn: providerApis.github.getIssuesForRepos.bind(\n\t\t\t\t\tproviderApis.github,\n\t\t\t\t) as GetIssuesForReposFn,\n\t\t\t\tgetOrgsForCurrentUserFn: providerApis.github.getOrgsForCurrentUser.bind(providerApis.github),\n\t\t\t\tgetReposForOrgFn: providerApis.github.getReposForOrg.bind(providerApis.github),\n\t\t\t\tgetReposForCurrentUserFn: providerApis.github.getReposForCurrentUser.bind(providerApis.github),\n\t\t\t},\n\t\t\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise]: {\n\t\t\t\t...providersMetadata[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise],\n\t\t\t\tprovider: providerApis.github,\n\t\t\t\tgetRepoFn: providerApis.github.getRepo.bind(providerApis.github),\n\t\t\t\tgetCurrentUserFn: providerApis.github.getCurrentUser.bind(providerApis.github),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.github.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.github,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForUserFn: providerApis.github.getPullRequestsAssociatedWithUser.bind(\n\t\t\t\t\tproviderApis.github,\n\t\t\t\t) as GetPullRequestsForUserFn,\n\t\t\t\tgetIssuesForReposFn: providerApis.github.getIssuesForRepos.bind(\n\t\t\t\t\tproviderApis.github,\n\t\t\t\t) as GetIssuesForReposFn,\n\t\t\t\tgetOrgsForCurrentUserFn: providerApis.github.getOrgsForCurrentUser.bind(providerApis.github),\n\t\t\t\tgetReposForOrgFn: providerApis.github.getReposForOrg.bind(providerApis.github),\n\t\t\t\tgetReposForCurrentUserFn: providerApis.github.getReposForCurrentUser.bind(providerApis.github),\n\t\t\t},\n\t\t\t[GitCloudHostIntegrationId.GitLab]: {\n\t\t\t\t...providersMetadata[GitCloudHostIntegrationId.GitLab],\n\t\t\t\tprovider: providerApis.gitlab,\n\t\t\t\tgetRepoFn: providerApis.gitlab.getRepo.bind(providerApis.gitlab),\n\t\t\t\tgetCurrentUserFn: providerApis.gitlab.getCurrentUser.bind(providerApis.gitlab),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.gitlab.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForRepoFn: providerApis.gitlab.getPullRequestsForRepo.bind(providerApis.gitlab),\n\t\t\t\tgetPullRequestForRepoFn: providerApis.gitlab.getPullRequestForRepo.bind(providerApis.gitlab),\n\t\t\t\tgetPullRequestsForUserFn: providerApis.gitlab.getPullRequestsAssociatedWithUser.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t) as GetPullRequestsForUserFn,\n\t\t\t\tgetGitLabPullRequestsForUserAssociationFn: providerApis.gitlab.getPullRequestsForUser.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t),\n\t\t\t\tgetIssueFn: providerApis.gitlab.getIssue.bind(providerApis.gitlab) as GetIssueFn,\n\t\t\t\tgetIssuesForReposFn: providerApis.gitlab.getIssuesForRepos.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t) as GetIssuesForReposFn,\n\t\t\t\tgetIssuesForRepoFn: providerApis.gitlab.getIssuesForRepo.bind(providerApis.gitlab),\n\t\t\t\tgetIssuesForCurrentUserFn: providerApis.gitlab.getIssuesForCurrentUser.bind(providerApis.gitlab),\n\t\t\t\tmergePullRequestFn: providerApis.gitlab.mergePullRequest.bind(providerApis.gitlab),\n\t\t\t\tgetGroupsForCurrentUserFn: providerApis.gitlab.getGroupsForCurrentUser.bind(providerApis.gitlab),\n\t\t\t\tgetReposForCurrentUserFn: providerApis.gitlab.getReposForCurrentUser.bind(providerApis.gitlab),\n\t\t\t},\n\t\t\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted]: {\n\t\t\t\t...providersMetadata[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted],\n\t\t\t\tprovider: providerApis.gitlab,\n\t\t\t\tgetRepoFn: providerApis.gitlab.getRepo.bind(providerApis.gitlab),\n\t\t\t\tgetCurrentUserFn: providerApis.gitlab.getCurrentUser.bind(providerApis.gitlab),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.gitlab.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForRepoFn: providerApis.gitlab.getPullRequestsForRepo.bind(providerApis.gitlab),\n\t\t\t\tgetPullRequestForRepoFn: providerApis.gitlab.getPullRequestForRepo.bind(providerApis.gitlab),\n\t\t\t\tgetPullRequestsForUserFn: providerApis.gitlab.getPullRequestsAssociatedWithUser.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t) as GetPullRequestsForUserFn,\n\t\t\t\tgetGitLabPullRequestsForUserAssociationFn: providerApis.gitlab.getPullRequestsForUser.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t),\n\t\t\t\tgetIssueFn: providerApis.gitlab.getIssue.bind(providerApis.gitlab) as GetIssueFn,\n\t\t\t\tgetIssuesForReposFn: providerApis.gitlab.getIssuesForRepos.bind(\n\t\t\t\t\tproviderApis.gitlab,\n\t\t\t\t) as GetIssuesForReposFn,\n\t\t\t\tgetIssuesForRepoFn: providerApis.gitlab.getIssuesForRepo.bind(providerApis.gitlab),\n\t\t\t\tgetIssuesForCurrentUserFn: providerApis.gitlab.getIssuesForCurrentUser.bind(providerApis.gitlab),\n\t\t\t\tmergePullRequestFn: providerApis.gitlab.mergePullRequest.bind(providerApis.gitlab),\n\t\t\t\tgetGroupsForCurrentUserFn: providerApis.gitlab.getGroupsForCurrentUser.bind(providerApis.gitlab),\n\t\t\t\tgetReposForCurrentUserFn: providerApis.gitlab.getReposForCurrentUser.bind(providerApis.gitlab),\n\t\t\t},\n\t\t\t[GitCloudHostIntegrationId.Bitbucket]: {\n\t\t\t\t...providersMetadata[GitCloudHostIntegrationId.Bitbucket],\n\t\t\t\tprovider: providerApis.bitbucket,\n\t\t\t\tgetRepoFn: providerApis.bitbucket.getRepo.bind(providerApis.bitbucket),\n\t\t\t\tgetCurrentUserFn: providerApis.bitbucket.getCurrentUser.bind(providerApis.bitbucket),\n\t\t\t\tgetBitbucketResourcesForCurrentUserFn: providerApis.bitbucket.getWorkspacesForCurrentUser.bind(\n\t\t\t\t\tproviderApis.bitbucket,\n\t\t\t\t),\n\t\t\t\tgetBitbucketPullRequestsAuthoredByUserForWorkspaceFn:\n\t\t\t\t\tproviderApis.bitbucket.getPullRequestsForUserAndWorkspace.bind(providerApis.bitbucket),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.bitbucket.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.bitbucket,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForRepoFn: providerApis.bitbucket.getPullRequestsForRepo.bind(providerApis.bitbucket),\n\t\t\t\tmergePullRequestFn: providerApis.bitbucket.mergePullRequest.bind(providerApis.bitbucket),\n\t\t\t\tgetReposForWorkspaceFn: providerApis.bitbucket.getReposForWorkspace.bind(providerApis.bitbucket),\n\t\t\t},\n\t\t\t[GitSelfManagedHostIntegrationId.BitbucketServer]: {\n\t\t\t\t...providersMetadata[GitSelfManagedHostIntegrationId.BitbucketServer],\n\t\t\t\tprovider: providerApis.bitbucketServer,\n\t\t\t\tgetRepoFn: providerApis.bitbucketServer.getRepo.bind(providerApis.bitbucketServer),\n\t\t\t\tgetCurrentUserFn: providerApis.bitbucketServer.getCurrentUser.bind(providerApis.bitbucketServer),\n\t\t\t\tgetBitbucketServerPullRequestsForCurrentUserFn:\n\t\t\t\t\tproviderApis.bitbucketServer.getPullRequestsForCurrentUser.bind(providerApis.bitbucketServer),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.bitbucketServer.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.bitbucketServer,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForRepoFn: providerApis.bitbucketServer.getPullRequestsForRepo.bind(\n\t\t\t\t\tproviderApis.bitbucketServer,\n\t\t\t\t),\n\t\t\t\tmergePullRequestFn: providerApis.bitbucketServer.mergePullRequest.bind(providerApis.bitbucketServer),\n\t\t\t},\n\t\t\t[GitCloudHostIntegrationId.AzureDevOps]: {\n\t\t\t\t...providersMetadata[GitCloudHostIntegrationId.AzureDevOps],\n\t\t\t\tprovider: providerApis.azureDevOps,\n\t\t\t\tgetRepoOfProjectFn: providerApis.azureDevOps.getRepo.bind(providerApis.azureDevOps),\n\t\t\t\tgetCurrentUserFn: providerApis.azureDevOps.getCurrentUser.bind(providerApis.azureDevOps),\n\t\t\t\tgetCurrentUserForInstanceFn: providerApis.azureDevOps.getCurrentUserForInstance.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetAzureResourcesForUserFn: providerApis.azureDevOps.getOrgsForUser.bind(providerApis.azureDevOps),\n\t\t\t\tgetAzureProjectsForResourceFn: providerApis.azureDevOps.getAzureProjects.bind(providerApis.azureDevOps),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.azureDevOps.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForRepoFn: providerApis.azureDevOps.getPullRequestsForRepo.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetPullRequestForRepoFn: providerApis.azureDevOps.getPullRequestForRepo.bind(providerApis.azureDevOps),\n\t\t\t\tgetPullRequestsForAzureProjectsFn: providerApis.azureDevOps.getPullRequestsForProjects.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetPullRequestsForAzureProjectFn: providerApis.azureDevOps.getPullRequestsForProject.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetIssuesForAzureProjectFn: providerApis.azureDevOps.getIssuesForAzureProject.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetReposForAzureProjectFn: providerApis.azureDevOps.getReposForAzureProject.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tmergePullRequestFn: providerApis.azureDevOps.mergePullRequest.bind(providerApis.azureDevOps),\n\t\t\t},\n\t\t\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer]: {\n\t\t\t\t...providersMetadata[GitSelfManagedHostIntegrationId.AzureDevOpsServer],\n\t\t\t\tprovider: providerApis.azureDevOps,\n\t\t\t\tgetRepoOfProjectFn: providerApis.azureDevOps.getRepo.bind(providerApis.azureDevOps),\n\t\t\t\tgetCurrentUserFn: providerApis.azureDevOps.getCurrentUser.bind(providerApis.azureDevOps),\n\t\t\t\tgetCurrentUserForInstanceFn: providerApis.azureDevOps.getCurrentUserForInstance.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetAzureResourcesForUserFn: providerApis.azureDevOps.getCollectionsForUser.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetAzureProjectsForResourceFn: providerApis.azureDevOps.getAzureProjects.bind(providerApis.azureDevOps),\n\t\t\t\tgetPullRequestsForReposFn: providerApis.azureDevOps.getPullRequestsForRepos.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t) as GetPullRequestsForReposFn,\n\t\t\t\tgetPullRequestsForRepoFn: providerApis.azureDevOps.getPullRequestsForRepo.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetPullRequestForRepoFn: providerApis.azureDevOps.getPullRequestForRepo.bind(providerApis.azureDevOps),\n\t\t\t\tgetPullRequestsForAzureProjectsFn: providerApis.azureDevOps.getPullRequestsForProjects.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetPullRequestsForAzureProjectFn: providerApis.azureDevOps.getPullRequestsForProject.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetIssuesForAzureProjectFn: providerApis.azureDevOps.getIssuesForAzureProject.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tgetReposForAzureProjectFn: providerApis.azureDevOps.getReposForAzureProject.bind(\n\t\t\t\t\tproviderApis.azureDevOps,\n\t\t\t\t),\n\t\t\t\tmergePullRequestFn: providerApis.azureDevOps.mergePullRequest.bind(providerApis.azureDevOps),\n\t\t\t},\n\t\t\t[IssuesCloudHostIntegrationId.Jira]: {\n\t\t\t\t...providersMetadata[IssuesCloudHostIntegrationId.Jira],\n\t\t\t\tprovider: providerApis.jira,\n\t\t\t\tgetCurrentUserForResourceFn: providerApis.jira.getCurrentUserForResource.bind(providerApis.jira),\n\t\t\t\tgetJiraResourcesForCurrentUserFn: providerApis.jira.getJiraResourcesForCurrentUser.bind(\n\t\t\t\t\tproviderApis.jira,\n\t\t\t\t),\n\t\t\t\tgetJiraProjectsForResourcesFn: providerApis.jira.getJiraProjectsForResources.bind(providerApis.jira),\n\t\t\t\tgetJiraProjectsForResourceFn: providerApis.jira.getJiraProjectsForResource.bind(providerApis.jira),\n\t\t\t\tgetIssueFn: providerApis.jira.getIssue.bind(providerApis.jira) as GetIssueFn,\n\t\t\t\tgetIssuesForProjectFn: providerApis.jira.getIssuesForProject.bind(providerApis.jira),\n\t\t\t\tgetIssuesForProjectsFn: providerApis.jira.getIssuesForProjects.bind(providerApis.jira),\n\t\t\t\tgetIssuesForResourceForCurrentUserFn: providerApis.jira.getIssuesForResourceForCurrentUser.bind(\n\t\t\t\t\tproviderApis.jira,\n\t\t\t\t),\n\t\t\t},\n\t\t\t[IssuesSelfManagedHostIntegrationId.JiraServer]: {\n\t\t\t\t...providersMetadata[IssuesSelfManagedHostIntegrationId.JiraServer],\n\t\t\t\tprovider: providerApis.jiraServer,\n\t\t\t\tgetJiraServerCurrentUserFn: providerApis.jiraServer.getCurrentUser.bind(providerApis.jiraServer),\n\t\t\t\tgetJiraServerProjectsFn: providerApis.jiraServer.getJiraProjects.bind(providerApis.jiraServer),\n\t\t\t\tgetJiraServerIssuesForProjectFn: providerApis.jiraServer.getIssuesForProject.bind(\n\t\t\t\t\tproviderApis.jiraServer,\n\t\t\t\t),\n\t\t\t\tgetJiraServerIssuesForProjectsFn: providerApis.jiraServer.getIssuesForProjects.bind(\n\t\t\t\t\tproviderApis.jiraServer,\n\t\t\t\t),\n\t\t\t\tgetJiraServerIssueFn: providerApis.jiraServer.getIssue.bind(providerApis.jiraServer),\n\t\t\t\tgetJiraServerIssuesForCurrentUserFn: providerApis.jiraServer.getIssuesForResourceForCurrentUser.bind(\n\t\t\t\t\tproviderApis.jiraServer,\n\t\t\t\t),\n\t\t\t},\n\t\t\t[IssuesCloudHostIntegrationId.Linear]: {\n\t\t\t\t...providersMetadata[IssuesCloudHostIntegrationId.Linear],\n\t\t\t\tprovider: providerApis.linear,\n\t\t\t\tgetIssueFn: providerApis.linear.getIssue.bind(providerApis.linear),\n\t\t\t\tgetIssuesForCurrentUserFn: providerApis.linear.getIssuesForCurrentUser.bind(providerApis.linear),\n\t\t\t\tgetLinearOrganizationFn: providerApis.linear.getLinearOrganization.bind(providerApis.linear),\n\t\t\t\tgetLinearTeamsForCurrentUserFn: providerApis.linear.getTeamsForCurrentUser.bind(providerApis.linear),\n\t\t\t\tgetLinearIssuesFn: providerApis.linear.getIssues.bind(providerApis.linear),\n\t\t\t\tgetLinearCurrentUserFn: providerApis.linear.getCurrentUser.bind(providerApis.linear),\n\t\t\t},\n\t\t\t[IssuesCloudHostIntegrationId.Trello]: {\n\t\t\t\t...providersMetadata[IssuesCloudHostIntegrationId.Trello],\n\t\t\t\tprovider: providerApis.trello,\n\t\t\t\tgetTrelloCurrentUserFn: providerApis.trello.getCurrentUser.bind(providerApis.trello),\n\t\t\t\tgetTrelloBoardsForCurrentUserFn: providerApis.trello.getBoardsForCurrentUser.bind(providerApis.trello),\n\t\t\t\tgetTrelloListsForBoardFn: providerApis.trello.getListsForTrelloBoard.bind(providerApis.trello),\n\t\t\t\tgetTrelloAccountForIdFn: providerApis.trello.getAccountForId.bind(providerApis.trello),\n\t\t\t\tgetTrelloIssuesForBoardFn: providerApis.trello.getIssuesForBoard.bind(providerApis.trello),\n\t\t\t\tgetTrelloLabelsForBoardFn: providerApis.trello.getLabelsForBoard.bind(providerApis.trello),\n\t\t\t},\n\t\t};\n\t}\n\n\tgetScopesForProvider(providerId: IntegrationIds): string[] | undefined {\n\t\treturn this.providers[providerId]?.scopes;\n\t}\n\n\tgetProviderDomain(providerId: IntegrationIds): string | undefined {\n\t\treturn this.providers[providerId]?.domain;\n\t}\n\n\tgetProviderPullRequestsPagingMode(providerId: IntegrationIds): PagingMode | undefined {\n\t\treturn this.providers[providerId]?.pullRequestsPagingMode;\n\t}\n\n\tgetProviderIssuesPagingMode(providerId: IntegrationIds): PagingMode | undefined {\n\t\treturn this.providers[providerId]?.issuesPagingMode;\n\t}\n\n\tproviderSupportsPullRequestFilters(providerId: IntegrationIds, filters: PullRequestFilter[]): boolean {\n\t\treturn (\n\t\t\tthis.providers[providerId]?.supportedPullRequestFilters != null &&\n\t\t\tfilters.every(filter => this.providers[providerId]?.supportedPullRequestFilters?.includes(filter))\n\t\t);\n\t}\n\n\tproviderSupportsIssueFilters(providerId: IntegrationIds, filters: IssueFilter[]): boolean {\n\t\treturn (\n\t\t\tthis.providers[providerId]?.supportedIssueFilters != null &&\n\t\t\tfilters.every(filter => this.providers[providerId]?.supportedIssueFilters?.includes(filter))\n\t\t);\n\t}\n\n\t/** See {@link isRepoIdsInput}, which owns the rule; kept as a method because callers reach it through the api. */\n\tisRepoIdsInput(input: unknown): input is (string | number)[] {\n\t\treturn isRepoIdsInput(input);\n\t}\n\n\tprivate async getProviderToken<T extends IntegrationIds>(\n\t\tprovider: ProviderInfo & { id: T },\n\t\toptions?: { createSessionIfNeeded?: boolean; connectionId?: string },\n\t): Promise<TokenWithInfo<T> | undefined> {\n\t\t// When a specific connection is requested, resolve that connection's cloud session (mirroring\n\t\t// `Integration.resolveReadSession`); otherwise keep the plain descriptor so the primary is resolved.\n\t\t// An empty string is not a real target, so it must also fall through to the primary path.\n\t\tconst providerDescriptor = options?.connectionId\n\t\t\t? { domain: provider.domain, scopes: provider.scopes, connectionId: options.connectionId, cloud: true }\n\t\t\t: { domain: provider.domain, scopes: provider.scopes };\n\t\ttry {\n\t\t\tconst authProvider = await this.authenticationService.get(provider.id);\n\t\t\tconst session = await authProvider.getSession(providerDescriptor, {\n\t\t\t\tcreateIfNeeded: options?.createSessionIfNeeded,\n\t\t\t});\n\t\t\tif (session == null) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn toTokenWithInfo(provider.id, session);\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate async ensureProviderToken<T extends IntegrationIds>(\n\t\ttokenOptInfo: TokenOptInfo<T>,\n\t): Promise<{ provider: ProviderInfo; tokenWithInfo: TokenWithInfo<T> }> {\n\t\tconst providerId = tokenOptInfo.providerId;\n\t\tconst provider = this.providers[providerId];\n\t\tif (provider == null) {\n\t\t\tthrow new Error(`Provider with id ${providerId} not registered`);\n\t\t}\n\n\t\tif (providerId !== provider.id) {\n\t\t\tthrow new Error(`Provider id mismatch: expected ${providerId} but got ${provider.id}`);\n\t\t}\n\n\t\tconst connectionId = 'connectionId' in tokenOptInfo ? tokenOptInfo.connectionId : undefined;\n\t\tconst tokenWithInfo = tokenOptInfo?.accessToken\n\t\t\t? tokenOptInfo\n\t\t\t: await this.getProviderToken<T>(provider as ProviderInfo & { id: T }, {\n\t\t\t\t\tconnectionId: connectionId,\n\t\t\t\t});\n\t\tif (tokenWithInfo == null) {\n\t\t\tthrow new Error(`Not connected to provider ${providerId}`);\n\t\t}\n\n\t\treturn { provider: provider, tokenWithInfo: tokenWithInfo };\n\t}\n\n\tprivate async ensureProviderTokenAndFunction<T extends IntegrationIds>(\n\t\ttokenOptInfo: TokenOptInfo<T>,\n\t\tproviderFn: keyof ProviderInfo,\n\t): Promise<{ provider: ProviderInfo; tokenWithInfo: TokenWithInfo<T> }> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\t\tconst providerId = tokenOptInfo.providerId;\n\n\t\tif (provider[providerFn] == null) {\n\t\t\tthrow new Error(`Provider with id ${providerId} does not support function: ${providerFn}`);\n\t\t}\n\n\t\treturn { provider: provider, tokenWithInfo: tokenWithInfo };\n\t}\n\n\tprivate handleProviderError<T>(tokenWithInfo: TokenWithInfo, error: any): T {\n\t\tconst providerId = tokenWithInfo.providerId;\n\t\tconst provider = this.providers[providerId];\n\t\tif (provider == null) {\n\t\t\tthrow new Error(`Provider with id ${providerId} not registered`);\n\t\t}\n\n\t\treturn throwProviderError(tokenWithInfo, error);\n\t}\n\n\tasync getPagedResult<T>(\n\t\targs: any,\n\t\tproviderFn:\n\t\t\t| ((\n\t\t\t\t\tinput: any,\n\t\t\t\t\toptions?: { token?: string; isPAT?: boolean; baseUrl?: string },\n\t\t\t ) => Promise<{ data: NonNullable<T>[]; pageInfo?: PageInfo; metadata?: CollectionMetadata }>)\n\t\t\t| undefined,\n\t\ttokenWithInfo: TokenWithInfo,\n\t\tcursor: string = '{}',\n\t\tisPAT: boolean = false,\n\t\tbaseUrl?: string,\n\t): Promise<ProviderApiPagedResult<T>> {\n\t\tlet cursorInfo;\n\t\ttry {\n\t\t\tcursorInfo = JSON.parse(cursor);\n\t\t} catch {\n\t\t\tcursorInfo = {};\n\t\t}\n\t\tconst cursorValue = cursorInfo.value;\n\t\tconst cursorType = cursorInfo.type;\n\t\t// An explicit numbered `page` request wins over a page-typed cursor; otherwise follow the cursor. A\n\t\t// live cursor-typed cursor still takes precedence so an in-flight continuation is never clobbered.\n\t\tconst requestedPage: number | undefined = typeof args?.page === 'number' ? args.page : undefined;\n\t\tconst requestedPageSize: number | undefined = typeof args?.pageSize === 'number' ? args.pageSize : undefined;\n\t\tlet cursorOrPage = {};\n\t\tif (requestedPage != null && cursorType !== 'cursor') {\n\t\t\tcursorOrPage = { page: requestedPage };\n\t\t} else if (cursorType === 'page') {\n\t\t\tcursorOrPage = { page: cursorValue };\n\t\t} else if (cursorType === 'cursor') {\n\t\t\tcursorOrPage = { cursor: cursorValue };\n\t\t}\n\n\t\t// Strip the caller's paging keys so `getPagedResult` fully controls them; otherwise `args.page` could\n\t\t// survive alongside a resolved `cursor` (or the raw serialized wrapper `args.cursor` could leak in when\n\t\t// following a page), letting the provider clobber the continuation we intended.\n\t\tconst { page: _page, pageSize: _pageSize, cursor: _cursor, ...restArgs } = args ?? {};\n\t\tconst input = {\n\t\t\t...restArgs,\n\t\t\t...cursorOrPage,\n\t\t\t// `pageSize` is honored by numbered providers; GitHub reads `maxPageSize`. Set both so whichever\n\t\t\t// the resolved provider understands takes effect; the other is ignored.\n\t\t\t...(requestedPageSize != null ? { pageSize: requestedPageSize, maxPageSize: requestedPageSize } : {}),\n\t\t};\n\n\t\ttry {\n\t\t\tconst result = await providerFn?.(input, {\n\t\t\t\ttoken: tokenWithInfo.accessToken,\n\t\t\t\tisPAT: isPAT,\n\t\t\t\tbaseUrl: baseUrl,\n\t\t\t});\n\t\t\tif (result == null) {\n\t\t\t\tconst continuationWasRequested =\n\t\t\t\t\t(cursor != null && cursor !== '{}') || (requestedPage != null && requestedPage > 1);\n\t\t\t\treturn continuationWasRequested\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tvalues: [],\n\t\t\t\t\t\t\tpaging: { cursor: '{}', more: false, truncated: true },\n\t\t\t\t\t\t\tmetadata: { completeness: 'partial' },\n\t\t\t\t\t\t}\n\t\t\t\t\t: { values: [] };\n\t\t\t}\n\n\t\t\tconst pageInfo = result.pageInfo;\n\t\t\tconst hasMore = pageInfo?.hasNextPage ?? false;\n\n\t\t\tlet nextCursor = '{}';\n\t\t\tif (pageInfo?.endCursor != null) {\n\t\t\t\tnextCursor = JSON.stringify({ value: pageInfo.endCursor, type: 'cursor' });\n\t\t\t} else if (pageInfo?.nextPage != null) {\n\t\t\t\tnextCursor = JSON.stringify({ value: pageInfo.nextPage, type: 'page' });\n\t\t\t}\n\t\t\tconst continuationBroken = hasMore && (nextCursor === '{}' || nextCursor === cursor);\n\t\t\tconst normalizedMetadata = mergeCollectionMetadata(\n\t\t\t\tresult.metadata,\n\t\t\t\tcontinuationBroken ? { completeness: 'partial' } : undefined,\n\t\t\t);\n\n\t\t\t// SDK collection completeness is independent from provider-native pagination: a result can expose a\n\t\t\t// real next page (`more`) and still have a failed sibling scope (`partial`/`unknown`). Surface the\n\t\t\t// latter as `truncated` so consumers treat the page as incomplete. Absent metadata (old providers,\n\t\t\t// test doubles) leaves `truncated` unset for backward compatibility. Shares the incompleteness\n\t\t\t// predicate with the facade assessment so one metadata object can't be truncated there and whole here.\n\t\t\tconst truncated = isIncompleteCollection(normalizedMetadata) ? true : undefined;\n\n\t\t\treturn {\n\t\t\t\tvalues: result.data,\n\t\t\t\tpaging: {\n\t\t\t\t\tcursor: nextCursor,\n\t\t\t\t\tmore: hasMore && !continuationBroken,\n\t\t\t\t\ttruncated: truncated,\n\t\t\t\t\t// Numbered-page metadata; left undefined by cursor-based providers (which don't report a\n\t\t\t\t\t// currentPage), so we never echo the requested page for a provider that ignored it.\n\t\t\t\t\tpage: pageInfo?.currentPage ?? undefined,\n\t\t\t\t\tpageSize: requestedPageSize,\n\t\t\t\t\tnextPage: pageInfo?.nextPage ?? undefined,\n\t\t\t\t\ttotalPages: pageInfo?.totalPages ?? undefined,\n\t\t\t\t\ttotalCount: pageInfo?.totalCount ?? undefined,\n\t\t\t\t},\n\t\t\t\tmetadata: normalizedMetadata,\n\t\t\t};\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderApiPagedResult<T>>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getRepo(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\towner: string,\n\t\tname: string,\n\t\tproject?: string,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderRepository | undefined> {\n\t\tconst providerId = tokenOptInfo.providerId;\n\t\tconst isAzureDevOps =\n\t\t\tproviderId === GitCloudHostIntegrationId.AzureDevOps ||\n\t\t\tproviderId === GitSelfManagedHostIntegrationId.AzureDevOpsServer;\n\t\tif (isAzureDevOps) {\n\t\t\tif (project == null) return undefined;\n\n\t\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\t\ttokenOptInfo,\n\t\t\t\t'getRepoOfProjectFn',\n\t\t\t);\n\t\t\tconst token = tokenWithInfo.accessToken;\n\n\t\t\ttry {\n\t\t\t\tconst result = await provider['getRepoOfProjectFn']?.(\n\t\t\t\t\t{ namespace: owner, name: name, project: project },\n\t\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t\t);\n\t\t\t\treturn result?.data;\n\t\t\t} catch (e) {\n\t\t\t\tif (isGraphQLRepoNotFoundError(e)) throw new RequestNotFoundError(toError(e));\n\t\t\t\treturn this.handleProviderError<ProviderRepository>(tokenWithInfo, e);\n\t\t\t}\n\t\t} else {\n\t\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, 'getRepoFn');\n\t\t\tconst token = tokenWithInfo.accessToken;\n\n\t\t\ttry {\n\t\t\t\tconst result = await provider['getRepoFn']?.(\n\t\t\t\t\t{ namespace: owner, name: name, project: project },\n\t\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t\t);\n\t\t\t\treturn result?.data;\n\t\t\t} catch (e) {\n\t\t\t\tif (isGraphQLRepoNotFoundError(e)) throw new RequestNotFoundError(toError(e));\n\t\t\t\treturn this.handleProviderError<ProviderRepository>(tokenWithInfo, e);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * One pull request by repository and number, in any state. `undefined` when the provider reports it absent:\n\t * a `null` from GitLab (which alone is NOT proof — see the GitLab batch hook), or, from Azure DevOps, a 404\n\t * whose body names the pull request, repository or project as not found (see\n\t * {@link azurePullRequestNotFoundTypeKeys}). Any other Azure error, including a 410 or a 404 that isn't that\n\t * shape (e.g. a wrong path answering with an HTML page), goes through `handleProviderError` and fails instead.\n\t */\n\tasync getPullRequestForRepo(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\trepo: ProviderRepoInput,\n\t\tnumber: number,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string; includeRemoteInfo?: boolean },\n\t): Promise<ProviderPullRequest | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getPullRequestForRepoFn',\n\t\t);\n\t\tconst providerId = tokenWithInfo.providerId;\n\n\t\ttry {\n\t\t\tconst result = await provider.getPullRequestForRepoFn?.(\n\t\t\t\t{ repo: repo, number: number, includeRemoteInfo: options?.includeRemoteInfo },\n\t\t\t\t{ token: tokenWithInfo.accessToken, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t);\n\t\t\treturn result?.data ?? undefined;\n\t\t} catch (e) {\n\t\t\t// Azure DevOps throws on a missing pull request instead of answering `{ data: null }`.\n\t\t\tif (isAzureProviderId(providerId) && isAzureNotFoundResponse(e, azurePullRequestNotFoundTypeKeys)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn this.handleProviderError<ProviderPullRequest | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * Azure DevOps pull requests into a repository whose source is `refs/heads/{branch}`, in every status, as Azure\n\t * returns them, at most `top`. provider-apis' pull request list has no source-branch filter, so this asks Azure\n\t * directly, with the credential provider-apis would send.\n\t *\n\t * `undefined` only when Azure itself says the repository or project doesn't exist, by the same rule as\n\t * {@link getPullRequestForRepo}; every other failure, including a 404 that isn't that shape, throws.\n\t */\n\tasync getAzurePullRequestsForBranch(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\trepo: { namespace: string; project: string; name: string },\n\t\tbranch: string,\n\t\ttop: number,\n\t\toptions: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<AzurePullRequest[] | undefined> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\tconst baseUrl = (options.baseUrl ?? azureDevOpsBaseUrl).replace(/\\/$/, '');\n\t\tconst params = new URLSearchParams({\n\t\t\t'searchCriteria.sourceRefName': `refs/heads/${branch}`,\n\t\t\t'searchCriteria.status': 'all',\n\t\t\t$top: String(top),\n\t\t});\n\t\tconst url = `${baseUrl}/${encodeAzurePathSegment(repo.namespace)}/${encodeAzurePathSegment(repo.project)}/_apis/git/repositories/${encodeAzurePathSegment(repo.name)}/pullrequests?${params.toString()}`;\n\n\t\ttry {\n\t\t\tconst result = await this.request<{ value?: AzurePullRequest[] }>({\n\t\t\t\turl: url,\n\t\t\t\theaders: { Authorization: azureAuthorization(token, options.isPAT) },\n\t\t\t});\n\t\t\tconst pullRequests = result.body?.value;\n\t\t\tif (pullRequests == null) throw new Error('Azure DevOps returned no pull requests');\n\n\t\t\treturn pullRequests;\n\t\t} catch (e) {\n\t\t\tif (isAzureNotFoundResponse(e, azurePullRequestNotFoundTypeKeys)) return undefined;\n\n\t\t\treturn this.handleProviderError<AzurePullRequest[] | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * The ids of every group `userId` is a member of in one Azure DevOps organization (Azure DevOps Server: one\n\t * collection), directly or through other groups: its teams and security groups, in every project and at the\n\t * organization level. A group is an identity like a person, so these are the ids a pull request lists a group under\n\t * as a reviewer. provider-apis has no identity read, so this asks Azure directly, with the credential provider-apis\n\t * would send.\n\t *\n\t * Two requests, however many groups: the user's expanded membership, which names its groups only by descriptor,\n\t * then one batch read resolving those descriptors to ids. Azure DevOps Services serves identities from its\n\t * `vssps` host; Azure DevOps Server from the collection itself.\n\t */\n\tasync getAzureGroupIdsForUser(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\tnamespace: string,\n\t\tuserId: string,\n\t\toptions: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<string[]> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\tconst base =\n\t\t\toptions.baseUrl != null\n\t\t\t\t? `${options.baseUrl.replace(/\\/$/, '')}/${encodeAzurePathSegment(namespace)}`\n\t\t\t\t: `${azureDevOpsIdentityBaseUrl}/${encodeAzurePathSegment(namespace)}`;\n\t\tconst headers = {\n\t\t\tAuthorization: azureAuthorization(token, options.isPAT),\n\t\t\t'Content-Type': 'application/json',\n\t\t};\n\n\t\tlet memberOf: unknown;\n\t\ttry {\n\t\t\tconst params = new URLSearchParams({\n\t\t\t\tidentityIds: userId,\n\t\t\t\tqueryMembership: 'Expanded',\n\t\t\t\t'api-version': '5.0',\n\t\t\t});\n\t\t\tconst user = await this.request<{ value?: { memberOf?: unknown }[] }>({\n\t\t\t\turl: `${base}/_apis/identities?${params.toString()}`,\n\t\t\t\theaders: headers,\n\t\t\t});\n\t\t\tmemberOf = user.body?.value?.[0]?.memberOf;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<string[]>(tokenWithInfo, e);\n\t\t}\n\n\t\t// Checked before the batch read, so a malformed answer fails instead of reading as no groups.\n\t\tif (!Array.isArray(memberOf) || memberOf.some(d => typeof d !== 'string')) {\n\t\t\tthrow new Error('Azure DevOps returned no group membership for the current user');\n\t\t}\n\t\tif (memberOf.length === 0) return [];\n\n\t\t// Resolved one batch at a time, so a member of very many groups never sends Azure more than a batch at once.\n\t\tconst chunks: string[][] = [];\n\t\tfor (let i = 0; i < memberOf.length; i += azureIdentityBatchSize) {\n\t\t\tchunks.push(memberOf.slice(i, i + azureIdentityBatchSize));\n\t\t}\n\t\tconst batches: unknown[] = [];\n\t\ttry {\n\t\t\tfor (const descriptors of chunks) {\n\t\t\t\tconst batch = await this.request<{ value?: unknown }>({\n\t\t\t\t\turl: `${base}/_apis/identitybatch?api-version=5.0-preview.1`,\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\theaders: headers,\n\t\t\t\t\tbody: JSON.stringify({ descriptors: descriptors, queryMembership: 'None' }),\n\t\t\t\t});\n\t\t\t\tbatches.push(batch.body?.value);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<string[]>(tokenWithInfo, e);\n\t\t}\n\n\t\t// A group left unresolved could never be matched to a reviewer, and dropping it would narrow the read silently.\n\t\tif (batches.some((batch, i) => !Array.isArray(batch) || batch.length !== chunks[i].length)) {\n\t\t\tthrow new Error('Azure DevOps did not resolve every group of the current user');\n\t\t}\n\n\t\tconst groups = (batches as ({ id?: unknown } | null)[][]).flat();\n\t\t// A descriptor Azure no longer resolves (a deleted group) answers `null`: it can't be anyone's reviewer.\n\t\treturn groups.flatMap((g: { id?: unknown } | null) => {\n\t\t\tif (g == null) return [];\n\t\t\tif (typeof g.id !== 'string') throw new Error('Azure DevOps returned a group without its id');\n\n\t\t\treturn [g.id];\n\t\t});\n\t}\n\n\t/**\n\t * One issue by repository and number through provider-apis' GitLab `getIssue`, in the shape its list reads\n\t * return. Strict, unlike {@link getIssue}: `undefined` only when provider-apis reports the project or issue\n\t * missing, which alone is NOT proof (see the GitLab batch hook), and never for an HTTP status — a 404 there\n\t * means a wrong endpoint, so it fails instead of reading as absent.\n\t */\n\tasync getIssueForRepo(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\trepo: { namespace: string; name: string },\n\t\tnumber: number,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderIssue | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, 'getIssueFn');\n\n\t\ttry {\n\t\t\tconst result = await provider.getIssueFn?.(\n\t\t\t\t{ namespace: repo.namespace, name: repo.name, number: String(number) },\n\t\t\t\t{ token: tokenWithInfo.accessToken, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t);\n\t\t\tif (result?.data == null) throw new Error(`No data returned for issue ${number}`);\n\n\t\t\treturn result.data;\n\t\t} catch (e) {\n\t\t\tif (\n\t\t\t\te instanceof Error &&\n\t\t\t\t(repoNotFoundMessage.test(e.message) || gitLabIssueNotFoundMessage.test(e.message))\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn this.handleProviderError<ProviderIssue | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * One Azure DevOps work item by id, converted as provider-apis converts its list rows (see\n\t * {@link fromAzureWorkItemToProviderIssue}). provider-apis has no single work item read, so this asks Azure\n\t * directly, with the credential provider-apis would send, and expands links as its list read does: the HTML\n\t * link is the issue's `url`.\n\t *\n\t * `undefined` only when Azure itself says the work item or the project doesn't exist (see\n\t * {@link azureWorkItemNotFoundTypeKeys}). Every other failure throws, including a 410, a 404 that isn't that\n\t * shape, an empty response, a work item the SDK's conversion would skip, and one in another project.\n\t */\n\tasync getAzureWorkItem(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\tscope: { namespace: string; project: string },\n\t\tid: number,\n\t\toptions: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderIssue | undefined> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\tconst baseUrl = (options.baseUrl ?? azureDevOpsBaseUrl).replace(/\\/$/, '');\n\t\tconst params = new URLSearchParams({ $expand: 'Links', 'api-version': '6.0' });\n\t\tconst url = `${baseUrl}/${encodeAzurePathSegment(scope.namespace)}/${encodeAzurePathSegment(scope.project)}/_apis/wit/workitems/${id}?${params.toString()}`;\n\n\t\tlet workItem: AzureWorkItemResponse | null | undefined;\n\t\ttry {\n\t\t\tconst result = await this.request<AzureWorkItemResponse | null>({\n\t\t\t\turl: url,\n\t\t\t\theaders: { Authorization: azureAuthorization(token, options.isPAT) },\n\t\t\t});\n\t\t\tworkItem = result.body;\n\t\t} catch (e) {\n\t\t\tif (isAzureNotFoundResponse(e, azureWorkItemNotFoundTypeKeys)) return undefined;\n\n\t\t\treturn this.handleProviderError<ProviderIssue | undefined>(tokenWithInfo, e);\n\t\t}\n\n\t\tconst issue =\n\t\t\tworkItem != null ? fromAzureWorkItemToProviderIssue(workItem, scope.namespace, scope.project) : undefined;\n\t\tif (issue == null) throw new Error(`Azure DevOps returned no readable work item ${id}`);\n\n\t\t// The route's project is not trusted to scope the read: work item ids are unique across the organization, and\n\t\t// one from another project must not answer for this coordinate. Azure compares project names\n\t\t// case-insensitively.\n\t\tconst project = workItem?.fields?.['System.TeamProject'];\n\t\tif (typeof project === 'string' && project.toLowerCase() !== scope.project.toLowerCase()) {\n\t\t\tthrow new Error(`Azure DevOps work item ${id} is in project '${project}', not '${scope.project}'`);\n\t\t}\n\n\t\treturn issue;\n\t}\n\n\t/**\n\t * The cheap check behind the batch issue read's etags: `ids` (at most `azureWorkItemsEtagFieldsMaxIds`) in ONE\n\t * request, where {@link getAzureWorkItem} reads one work item per request, selecting only\n\t * `azureWorkItemEtagFieldNames`. Asked with `errorPolicy=omit`, without which one missing id fails the whole\n\t * request; Azure then leaves out every id it can't return, for whatever reason, so a caller matches the work items\n\t * to its ids by `id`, never by position, and reads an omission as unknown rather than absent. Every failure throws,\n\t * classified as {@link getAzureWorkItem} classifies it.\n\t */\n\tasync getAzureWorkItemsEtagFields(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\tscope: { namespace: string; project: string },\n\t\tids: readonly number[],\n\t\toptions: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<AzureWorkItemResponse[]> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\tconst baseUrl = (options.baseUrl ?? azureDevOpsBaseUrl).replace(/\\/$/, '');\n\t\t// Commas left unencoded, as Azure documents these lists. The same `api-version` as `getAzureWorkItem`, so a\n\t\t// server that serves the full read also serves this check.\n\t\tconst query = `ids=${ids.join(',')}&fields=${azureWorkItemEtagFieldNames.join(',')}&errorPolicy=omit&api-version=6.0`;\n\t\tconst url = `${baseUrl}/${encodeAzurePathSegment(scope.namespace)}/${encodeAzurePathSegment(scope.project)}/_apis/wit/workitems?${query}`;\n\n\t\ttry {\n\t\t\tconst result = await this.request<{ value?: (AzureWorkItemResponse | null)[] } | null>({\n\t\t\t\turl: url,\n\t\t\t\theaders: { Authorization: options.isPAT ? `Basic ${base64(`:${token}`)}` : `Bearer ${token}` },\n\t\t\t});\n\t\t\tconst workItems = result.body?.value;\n\t\t\tif (!Array.isArray(workItems)) throw new Error('Azure DevOps returned no work items');\n\n\t\t\t// Documented to answer an omitted id with `null` in its place; it has been seen to drop it instead.\n\t\t\treturn workItems.filter(w => w != null);\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<AzureWorkItemResponse[]>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * The cheap check behind the batch pull request read's etags: one pull request as Azure DevOps returns it, by the\n\t * same request {@link getPullRequestForRepo} has provider-apis send, but without the repository read it adds for\n\t * clone URLs. `undefined` only by the same not-found rule as {@link getPullRequestForRepo}; every other failure\n\t * throws.\n\t */\n\tasync getAzurePullRequest(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\trepo: { namespace: string; project: string; name: string },\n\t\tid: number,\n\t\toptions: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<AzurePullRequest | undefined> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\tconst baseUrl = (options.baseUrl ?? azureDevOpsBaseUrl).replace(/\\/$/, '');\n\t\tconst url = `${baseUrl}/${encodeAzurePathSegment(repo.namespace)}/${encodeAzurePathSegment(repo.project)}/_apis/git/repositories/${encodeAzurePathSegment(repo.name)}/pullrequests/${id}?api-version=6.0`;\n\n\t\ttry {\n\t\t\tconst result = await this.request<AzurePullRequest | null>({\n\t\t\t\turl: url,\n\t\t\t\theaders: { Authorization: options.isPAT ? `Basic ${base64(`:${token}`)}` : `Bearer ${token}` },\n\t\t\t});\n\t\t\tif (result.body == null) throw new Error(`Azure DevOps returned no pull request ${id}`);\n\n\t\t\treturn result.body;\n\t\t} catch (e) {\n\t\t\tif (isAzureNotFoundResponse(e, azurePullRequestNotFoundTypeKeys)) return undefined;\n\n\t\t\treturn this.handleProviderError<AzurePullRequest | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getCurrentUser(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderAccount | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, 'getCurrentUserFn');\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\treturn (\n\t\t\t\tawait provider.getCurrentUserFn?.(\n\t\t\t\t\t{},\n\t\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t\t)\n\t\t\t)?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderAccount>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getCurrentUserForInstance(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\tnamespace: string,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderAccount | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getCurrentUserForInstanceFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\treturn (\n\t\t\tawait provider.getCurrentUserForInstanceFn?.(\n\t\t\t\t{ namespace: namespace },\n\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t)\n\t\t)?.data;\n\t}\n\n\tasync getCurrentUserForResource(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tresourceId: string,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderAccount | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getCurrentUserForResourceFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\treturn (\n\t\t\t\tawait provider.getCurrentUserForResourceFn?.(\n\t\t\t\t\t{ resourceId: resourceId },\n\t\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t\t)\n\t\t\t)?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderAccount>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getJiraResourcesForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Jira>,\n\t): Promise<ProviderJiraResource[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraResourcesForCurrentUserFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\treturn (await provider.getJiraResourcesForCurrentUserFn?.({ token: token }))?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderJiraResource[] | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getLinearOrganization(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Linear>,\n\t): Promise<ProviderLinearOrganization | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getLinearOrganizationFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst x = await provider.getLinearOrganizationFn?.({ token: token });\n\t\t\tconst y = x?.data;\n\t\t\treturn y;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderLinearOrganization | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getLinearTeamsForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Linear>,\n\t): Promise<ProviderLinearTeam[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getLinearTeamsForCurrentUserFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\treturn (await provider.getLinearTeamsForCurrentUserFn?.({ token: token }))?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderLinearTeam[] | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * Reads issues scoped to Linear teams/projects/labels/assignees (Linear's issue-list filter). One page per\n\t * call — follow `paging.cursor`. `assignees` takes Linear user ids (the viewer's `id`), not names.\n\t */\n\tasync getLinearIssues(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Linear>,\n\t\tinput: {\n\t\t\tteams?: string[];\n\t\t\tprojects?: string[];\n\t\t\tlabels?: string[];\n\t\t\t/** Linear user ids (the viewer's `id`), not names. */\n\t\t\tassignees?: string[];\n\t\t\t/** Omitted reads open issues (workflow state type other than `completed`/`canceled`). */\n\t\t\tstates?: GitIssueState[];\n\t\t},\n\t\toptions?: PagingInput & {\n\t\t\t/** See {@link GetIssuesOptions.sort}. Linear expresses `created`/`updated`, descending only. */\n\t\t\tsort?: IssueSorting;\n\t\t},\n\t): Promise<ProviderApiPagedResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getLinearIssuesFn',\n\t\t);\n\t\treturn this.getPagedResult<ProviderIssue>(\n\t\t\t{ ...input, ...options },\n\t\t\tprovider.getLinearIssuesFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor ?? undefined,\n\t\t);\n\t}\n\n\t/**\n\t * The change state of up to `linearIssuesEtagMaxNumbers` issues of one Linear team, by number, in one GraphQL\n\t * request. Its failures are classified as {@link getIssue}'s are, so a throttled or refused check reads the same.\n\t */\n\tasync getLinearIssuesEtagFields(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Linear>,\n\t\tteamKey: string,\n\t\tnumbers: readonly number[],\n\t): Promise<LinearIssueEtagNode[]> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\n\t\ttry {\n\t\t\treturn await requestLinearIssuesEtagFields(this.request, tokenWithInfo.accessToken, teamKey, numbers);\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<LinearIssueEtagNode[]>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/** Resolves Linear's current user (viewer). The viewer query returns only id/name/email/displayName. */\n\tasync getLinearCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Linear>,\n\t): Promise<{ id: string; name?: string | null; email?: string | null; displayName?: string | null } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getLinearCurrentUserFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\treturn (await provider.getLinearCurrentUserFn?.({ token: token }))?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getAzureResourcesForUser(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer\n\t\t>,\n\t\tuserId: string,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderAzureResource[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getAzureResourcesForUserFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\treturn (\n\t\t\t\tawait provider.getAzureResourcesForUserFn?.(\n\t\t\t\t\t{ userId: userId },\n\t\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t\t)\n\t\t\t)?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderAzureResource[] | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getBitbucketResourcesForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<GitCloudHostIntegrationId.Bitbucket>,\n\t): Promise<ProviderApiPagedResult<ProviderBitbucketResource> | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getBitbucketResourcesForCurrentUserFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\t// Drain every workspace page (numbered): the SDK returns 50 per page, and a user in more than one page\n\t\t// of workspaces would otherwise silently lose the rest (with them, their orgs/PRs). A scoped drain keeps\n\t\t// a successful prefix plus structured failure metadata when a later page fails.\n\t\tconst result = await collectProviderPagedResult(\n\t\t\tasync cursor => {\n\t\t\t\ttry {\n\t\t\t\t\tconst page = parsePageCursor(cursor);\n\t\t\t\t\tconst response = await provider.getBitbucketResourcesForCurrentUserFn?.(\n\t\t\t\t\t\t{ page: page },\n\t\t\t\t\t\t{ token: token },\n\t\t\t\t\t);\n\t\t\t\t\tif (response == null) return undefined;\n\n\t\t\t\t\tconst hasMore = response.pageInfo?.hasNextPage === true;\n\t\t\t\t\tconst nextPage = response.pageInfo?.nextPage;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tvalues: response.data,\n\t\t\t\t\t\tpaging: {\n\t\t\t\t\t\t\tmore: hasMore,\n\t\t\t\t\t\t\tcursor: hasMore && nextPage != null ? toPageCursor(nextPage) : '{}',\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t} catch (ex) {\n\t\t\t\t\treturn this.handleProviderError<ProviderApiPagedResult<ProviderBitbucketResource>>(\n\t\t\t\t\t\ttokenWithInfo,\n\t\t\t\t\t\tex,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\t20,\n\t\t\t{ providerId: tokenWithInfo.providerId },\n\t\t);\n\t\treturn {\n\t\t\tvalues: result.values,\n\t\t\tpaging: { cursor: '{}', more: false, ...(result.truncated ? { truncated: true } : {}) },\n\t\t\t...(result.metadata != null ? { metadata: result.metadata } : {}),\n\t\t};\n\t}\n\n\tasync getBitbucketPullRequestsAuthoredByUserForWorkspace(\n\t\ttokenOptInfo: TokenWithInfo<GitCloudHostIntegrationId.Bitbucket>,\n\t\tuserId: string,\n\t\tworkspaceSlug: string,\n\t\toptions?: { states?: GitPullRequestState[]; page?: number },\n\t): Promise<{ data: ProviderPullRequest[]; hasMore: boolean; nextPage: number | null } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getBitbucketPullRequestsAuthoredByUserForWorkspaceFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getBitbucketPullRequestsAuthoredByUserForWorkspaceFn?.(\n\t\t\t\t{ userId: userId, workspaceSlug: workspaceSlug, states: options?.states, page: options?.page },\n\t\t\t\t{ token: token },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\t\t\treturn { data: result.data, hasMore: result.pageInfo.hasNextPage, nextPage: result.pageInfo.nextPage };\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getBitbucketServerPullRequestsForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<GitSelfManagedHostIntegrationId.BitbucketServer>,\n\t\tbaseUrl: string,\n\t\toptions?: { states?: GitPullRequestState[]; page?: number },\n\t): Promise<{ data: ProviderPullRequest[]; hasMore: boolean; nextPage: number | null } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getBitbucketServerPullRequestsForCurrentUserFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\t\ttry {\n\t\t\tconst result = await provider.getBitbucketServerPullRequestsForCurrentUserFn?.(\n\t\t\t\t{ states: options?.states, page: options?.page },\n\t\t\t\t{ token: token, baseUrl: baseUrl },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\t\t\treturn { data: result.data, hasMore: result.pageInfo.hasNextPage, nextPage: result.pageInfo.nextPage };\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getJiraProjectsForResources(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Jira>,\n\t\tresourceIds: string[],\n\t): Promise<ProviderApiCollectionResult<ProviderJiraProject>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraProjectsForResourcesFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getJiraProjectsForResourcesFn?.(\n\t\t\t\t{ resourceIds: resourceIds },\n\t\t\t\t{ token: token },\n\t\t\t);\n\t\t\t// Preserve the SDK's per-resource completeness/failures instead of collapsing to a bare array, so the\n\t\t\t// Jira integration can cache only proven-successful resources and warn on the failed ones.\n\t\t\treturn { values: result?.data ?? [], metadata: result?.metadata };\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderApiCollectionResult<ProviderJiraProject>>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getJiraProjectsForResource(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Jira>,\n\t\tresourceId: string,\n\t\toptions?: { cursor?: string },\n\t): Promise<ProviderApiPagedResult<ProviderJiraProject>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraProjectsForResourceFn',\n\t\t);\n\n\t\treturn this.getPagedResult(\n\t\t\t{ resourceId: resourceId },\n\t\t\tprovider.getJiraProjectsForResourceFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t);\n\t}\n\n\tasync getAzureProjectsForResource(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer\n\t\t>,\n\t\tnamespace: string,\n\t\toptions?: { cursor?: string; isPAT?: boolean; baseUrl?: string },\n\t): Promise<PagedResult<ProviderAzureProject>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getAzureProjectsForResourceFn',\n\t\t);\n\t\ttry {\n\t\t\treturn await this.getPagedResult<ProviderAzureProject>(\n\t\t\t\t{ namespace: namespace, ...options },\n\t\t\t\tprovider.getAzureProjectsForResourceFn,\n\t\t\t\ttokenWithInfo,\n\t\t\t\toptions?.cursor,\n\t\t\t\toptions?.isPAT,\n\t\t\t\toptions?.baseUrl,\n\t\t\t);\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<PagedResult<ProviderAzureProject>>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getReposForAzureProject(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer\n\t\t>,\n\t\tnamespace: string,\n\t\tproject: string,\n\t\toptions?: GetReposOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<PagedResult<ProviderRepository>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getReposForAzureProjectFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderRepository>(\n\t\t\t{ namespace: namespace, project: project, ...options },\n\t\t\tprovider.getReposForAzureProjectFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getGitHubOrgsForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.GitHub | GitSelfManagedHostIntegrationId.CloudGitHubEnterprise\n\t\t>,\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderHierarchyResult<ProviderGitHubOrganization>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getOrgsForCurrentUserFn',\n\t\t);\n\n\t\t// Drain all pages so a user in many orgs doesn't lose everything past the first page, while\n\t\t// surfacing `truncated` when the defensive backstop stops before the listing is exhausted.\n\t\tconst result = await collectProviderPagedResult(\n\t\t\tcursor =>\n\t\t\t\tthis.getPagedResult<ProviderGitHubOrganization>(\n\t\t\t\t\t{},\n\t\t\t\t\tprovider.getOrgsForCurrentUserFn,\n\t\t\t\t\ttokenWithInfo,\n\t\t\t\t\tcursor,\n\t\t\t\t\toptions?.isPAT,\n\t\t\t\t\toptions?.baseUrl,\n\t\t\t\t),\n\t\t\t20,\n\t\t\t{ providerId: tokenWithInfo.providerId },\n\t\t);\n\t\t// This method drains internally and takes no cursor, so a backstop cursor isn't resumable by\n\t\t// callers — keep only the truncation signal rather than exposing a misleading `paging`.\n\t\treturn {\n\t\t\tvalues: result.values,\n\t\t\t...(result.truncated ? { truncated: true } : {}),\n\t\t\t...(result.metadata != null ? { metadata: result.metadata } : {}),\n\t\t};\n\t}\n\n\tasync getReposForOrg(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.GitHub | GitSelfManagedHostIntegrationId.CloudGitHubEnterprise\n\t\t>,\n\t\torgName: string,\n\t\toptions?: GetReposOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<PagedResult<ProviderRepository>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, 'getReposForOrgFn');\n\n\t\treturn this.getPagedResult<ProviderRepository>(\n\t\t\t{ orgName: orgName },\n\t\t\tprovider.getReposForOrgFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getReposForBitbucketWorkspace(\n\t\ttokenOptInfo: TokenWithInfo<GitCloudHostIntegrationId.Bitbucket>,\n\t\tworkspace: string,\n\t\toptions?: GetReposOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<PagedResult<ProviderRepository>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getReposForWorkspaceFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderRepository>(\n\t\t\t{ workspace: workspace },\n\t\t\tprovider.getReposForWorkspaceFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getBitbucketServerProjects(\n\t\ttokenWithInfo: TokenWithInfo<GitSelfManagedHostIntegrationId.BitbucketServer>,\n\t\tbaseUrl: string,\n\t\tconnectionId: string,\n\t): Promise<ProviderHierarchyResult<ProviderOrganization>> {\n\t\tconst { paging: _paging, ...result } = await collectProviderPagedResult(\n\t\t\tcursor => requestBitbucketServerProjects(this.request, tokenWithInfo, baseUrl, connectionId, cursor),\n\t\t\t20,\n\t\t\t{ providerId: tokenWithInfo.providerId },\n\t\t);\n\t\treturn result;\n\t}\n\n\tgetBitbucketServerRepositories(\n\t\ttokenWithInfo: TokenWithInfo<GitSelfManagedHostIntegrationId.BitbucketServer>,\n\t\tbaseUrl: string,\n\t\tconnectionId: string,\n\t\toptions?: { project?: string; cursor?: string },\n\t): Promise<ProviderApiPagedResult<ProviderRepository>> {\n\t\treturn requestBitbucketServerRepositories(this.request, tokenWithInfo, baseUrl, connectionId, options);\n\t}\n\n\tsearchBitbucketServerPullRequestsPage(\n\t\ttokenWithInfo: TokenWithInfo<GitSelfManagedHostIntegrationId.BitbucketServer>,\n\t\toptions: Parameters<typeof searchBitbucketServerPullRequestsPage>[2],\n\t\tcancellation?: AbortSignal,\n\t): Promise<ProviderPullRequestSearchPage> {\n\t\treturn searchBitbucketServerPullRequestsPage(this.request, tokenWithInfo, options, cancellation);\n\t}\n\n\tcountBitbucketServerPullRequests(\n\t\ttokenWithInfo: TokenWithInfo<GitSelfManagedHostIntegrationId.BitbucketServer>,\n\t\toptions: Parameters<typeof countBitbucketServerPullRequests>[2],\n\t\tcancellation?: AbortSignal,\n\t): Promise<ProviderPullRequestCount> {\n\t\treturn countBitbucketServerPullRequests(this.request, tokenWithInfo, options, cancellation);\n\t}\n\n\tasync getReposForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\t| GitCloudHostIntegrationId.GitHub\n\t\t\t| GitSelfManagedHostIntegrationId.CloudGitHubEnterprise\n\t\t\t| GitCloudHostIntegrationId.GitLab\n\t\t\t| GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted\n\t\t>,\n\t\toptions?: GetReposOptions & {\n\t\t\t/** GitHub `/user/repos` affiliation filter; ignored by GitLab's membership read. */\n\t\t\taffiliations?: ('owner' | 'collaborator' | 'organization_member')[];\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t},\n\t): Promise<PagedResult<ProviderRepository>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getReposForCurrentUserFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderRepository>(\n\t\t\toptions?.affiliations != null ? { affiliations: options.affiliations } : {},\n\t\t\tprovider.getReposForCurrentUserFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getGitlabGroupsForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.GitLab | GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted\n\t\t>,\n\t\toptions?: { topLevelOnly?: boolean; isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderHierarchyResult<ProviderGitLabGroup>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getGroupsForCurrentUserFn',\n\t\t);\n\n\t\t// Drain all pages so a user in many groups doesn't lose everything past the first page, while\n\t\t// surfacing `truncated` when the defensive backstop stops before the listing is exhausted.\n\t\tconst result = await collectProviderPagedResult(\n\t\t\tcursor =>\n\t\t\t\tthis.getPagedResult<ProviderGitLabGroup>(\n\t\t\t\t\t{ topLevelOnly: options?.topLevelOnly },\n\t\t\t\t\tprovider.getGroupsForCurrentUserFn,\n\t\t\t\t\ttokenWithInfo,\n\t\t\t\t\tcursor,\n\t\t\t\t\toptions?.isPAT,\n\t\t\t\t\toptions?.baseUrl,\n\t\t\t\t),\n\t\t\t20,\n\t\t\t{ providerId: tokenWithInfo.providerId },\n\t\t);\n\t\t// This method drains internally and takes no cursor, so a backstop cursor isn't resumable by\n\t\t// callers — keep only the truncation signal rather than exposing a misleading `paging`.\n\t\treturn {\n\t\t\tvalues: result.values,\n\t\t\t...(result.truncated ? { truncated: true } : {}),\n\t\t\t...(result.metadata != null ? { metadata: result.metadata } : {}),\n\t\t};\n\t}\n\n\tasync getPullRequestsForRepos(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\treposOrIds: ProviderReposInput,\n\t\toptions?: GetPullRequestsOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getPullRequestsForReposFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderPullRequest>(\n\t\t\t{\n\t\t\t\t...(this.isRepoIdsInput(reposOrIds) ? { repoIds: reposOrIds } : { repos: reposOrIds }),\n\t\t\t\t...options,\n\t\t\t},\n\t\t\tprovider.getPullRequestsForReposFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getPullRequestsForRepo(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\trepo: ProviderRepoInput,\n\t\toptions?: GetPullRequestsOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getPullRequestsForRepoFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderPullRequest>(\n\t\t\t{ repo: repo, ...options },\n\t\t\tprovider.getPullRequestsForRepoFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getPullRequestsForUser(\n\t\ttokenWithInfo: TokenWithInfo<GitCloudHostIntegrationId.Bitbucket>,\n\t\tuserId: string,\n\t\toptions?: { isPAT?: boolean } & GetPullRequestsForUserOptions,\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest>>;\n\tasync getPullRequestsForUser(\n\t\ttokenWithInfo: TokenWithInfo<Exclude<IntegrationIds, GitCloudHostIntegrationId.Bitbucket>>,\n\t\tusername: string,\n\t\toptions?: { isPAT?: boolean } & GetPullRequestsForUserOptions,\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest>>;\n\tasync getPullRequestsForUser(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tusernameOrId: string,\n\t\toptions?: { isPAT?: boolean } & GetPullRequestsForUserOptions,\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getPullRequestsForUserFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderPullRequest>(\n\t\t\t{\n\t\t\t\t...(tokenWithInfo.providerId === GitCloudHostIntegrationId.Bitbucket\n\t\t\t\t\t? { userId: usernameOrId }\n\t\t\t\t\t: { username: usernameOrId }),\n\t\t\t\t...options,\n\t\t\t},\n\t\t\tprovider.getPullRequestsForUserFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getGitLabPullRequestsForUserAssociation(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.GitLab | GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted\n\t\t>,\n\t\tusername: string,\n\t\tassociation: 'assigned' | 'authored' | 'reviewRequested',\n\t\toptions?: {\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t\tstates?: GitPullRequestState[];\n\t\t\tcursor?: string;\n\t\t\tpageSize?: number;\n\t\t},\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getGitLabPullRequestsForUserAssociationFn',\n\t\t);\n\n\t\treturn this.getPagedResult(\n\t\t\t{\n\t\t\t\tusername: username,\n\t\t\t\tassociation: association,\n\t\t\t\tstates: options?.states,\n\t\t\t\tpageSize: options?.pageSize,\n\t\t\t},\n\t\t\tprovider.getGitLabPullRequestsForUserAssociationFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getPullRequestsForAzureProjects(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer\n\t\t>,\n\t\tprojects: { namespace: string; project: string }[],\n\t\toptions?: {\n\t\t\tauthorLogin?: string;\n\t\t\tassigneeLogins?: string[];\n\t\t\treviewerId?: string;\n\t\t\tstates?: GitPullRequestState[];\n\t\t\trepo?: ProviderRepoInput;\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t},\n\t): Promise<ProviderApiCollectionResult<ProviderPullRequest>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getPullRequestsForAzureProjectsFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getPullRequestsForAzureProjectsFn?.(\n\t\t\t\t{\n\t\t\t\t\tprojects: projects,\n\t\t\t\t\tauthorLogin: options?.authorLogin,\n\t\t\t\t\tassigneeLogins: options?.assigneeLogins,\n\t\t\t\t\treviewerId: options?.reviewerId,\n\t\t\t\t\tstates: options?.states,\n\t\t\t\t\trepo: options?.repo,\n\t\t\t\t},\n\t\t\t\t// Azure only supports a Basic credential for this call, so it is sent as one regardless of the\n\t\t\t\t// incoming `options?.isPAT`. The secret goes over raw — provider-apis encodes it itself.\n\t\t\t\t{ token: token, isPAT: true, baseUrl: options?.baseUrl },\n\t\t\t);\n\t\t\t// The SDK's multi-project aggregate preserves successful projects and reports failed/incomplete ones\n\t\t\t// through `metadata` (it has no `pageInfo`); keep it so the account-wide drain can warn on the failed\n\t\t\t// projects and set `fetchFailed` instead of publishing a partial Azure read as complete.\n\t\t\treturn { values: result?.data ?? [], metadata: result?.metadata };\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderApiCollectionResult<ProviderPullRequest>>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * Single Azure project PR read, paginated by number. Unlike {@link getPullRequestsForAzureProjects} (which\n\t * aggregates across projects and exposes no paging), this returns one page plus whether more remain, so a\n\t * caller can drain a project fully.\n\t */\n\tasync getPullRequestsForAzureProject(\n\t\ttokenOptInfo: TokenWithInfo<\n\t\t\tGitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer\n\t\t>,\n\t\tproject: { namespace: string; project: string },\n\t\toptions?: {\n\t\t\tauthorLogin?: string;\n\t\t\tassigneeLogins?: string[];\n\t\t\treviewerId?: string;\n\t\t\tstates?: GitPullRequestState[];\n\t\t\trepo?: ProviderRepoInput;\n\t\t\tpage?: number;\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t},\n\t): Promise<{ data: ProviderPullRequest[]; hasMore: boolean; nextPage: number | null } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getPullRequestsForAzureProjectFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getPullRequestsForAzureProjectFn?.(\n\t\t\t\t{\n\t\t\t\t\tnamespace: project.namespace,\n\t\t\t\t\tproject: project.project,\n\t\t\t\t\tauthorLogin: options?.authorLogin,\n\t\t\t\t\tassigneeLogins: options?.assigneeLogins,\n\t\t\t\t\treviewerId: options?.reviewerId,\n\t\t\t\t\tstates: options?.states,\n\t\t\t\t\trepo: options?.repo,\n\t\t\t\t\tpage: options?.page,\n\t\t\t\t},\n\t\t\t\t// Azure only supports a Basic credential for this call, so it is sent as one regardless of the\n\t\t\t\t// incoming `options?.isPAT`. The secret goes over raw — provider-apis encodes it itself.\n\t\t\t\t{ token: token, isPAT: true, baseUrl: options?.baseUrl },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\t\t\treturn { data: result.data, hasMore: result.pageInfo.hasNextPage, nextPage: result.pageInfo.nextPage };\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync mergePullRequest(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tpr: PullRequest,\n\t\toptions?: {\n\t\t\tmergeMethod?: PullRequestMergeMethod;\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t},\n\t): Promise<boolean> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'mergePullRequestFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\t\tconst headRef = pr.refs?.head;\n\t\tif (headRef == null) return false;\n\n\t\tif (provider.id === GitCloudHostIntegrationId.AzureDevOps && pr.project == null) {\n\t\t\treturn false;\n\t\t}\n\n\t\ttry {\n\t\t\tawait provider.mergePullRequestFn?.(\n\t\t\t\t{\n\t\t\t\t\tpullRequest: {\n\t\t\t\t\t\theadRef: { oid: headRef.sha },\n\t\t\t\t\t\tid: pr.id,\n\t\t\t\t\t\tnumber: Number.parseInt(pr.id, 10),\n\t\t\t\t\t\trepository: {\n\t\t\t\t\t\t\tid: pr.repository.repo,\n\t\t\t\t\t\t\tname: pr.repository.repo,\n\t\t\t\t\t\t\tproject: pr.project?.name ?? '',\n\t\t\t\t\t\t\towner: {\n\t\t\t\t\t\t\t\tlogin: pr.repository.owner,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tversion: pr.version,\n\t\t\t\t\t},\n\t\t\t\t\t...options,\n\t\t\t\t},\n\t\t\t\t{ token: token, isPAT: options?.isPAT, baseUrl: options?.baseUrl },\n\t\t\t);\n\t\t\treturn true;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<boolean>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getIssuesForRepos(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\treposOrIds: ProviderReposInput,\n\t\toptions?: GetIssuesOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderApiPagedResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForReposFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderIssue>(\n\t\t\t{\n\t\t\t\t...(this.isRepoIdsInput(reposOrIds) ? { repoIds: reposOrIds } : { repos: reposOrIds }),\n\t\t\t\t...options,\n\t\t\t},\n\t\t\tprovider.getIssuesForReposFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getIssuesForRepo(\n\t\ttokenOptInfo: TokenOptInfo,\n\t\trepo: ProviderRepoInput,\n\t\toptions?: GetIssuesOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<PagedResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForRepoFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderIssue>(\n\t\t\t{ repo: repo, ...options },\n\t\t\tprovider.getIssuesForRepoFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getIssuesForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\toptions?: PagingInput & {\n\t\t\t// Forwarded to the provider fn (GitLab's account-wide REST read); Linear ignores them.\n\t\t\tscope?: 'assigned_to_me' | 'all';\n\t\t\tassigneeUsername?: string;\n\t\t\t/**\n\t\t\t * Narrows to issues authored by this user. Honored as of `@gitkraken/provider-apis` 0.54.0\n\t\t\t * (`author_username`); it composes with `assigneeUsername` as AND, so a caller wanting the UNION of the\n\t\t\t * two relationships must read each separately (see GitLab's account-wide issue read).\n\t\t\t */\n\t\t\tauthorUsername?: string;\n\t\t\tpageSize?: number;\n\t\t\t/** Linear only; GitLab's REST read ignores it. Omitted reads open issues. */\n\t\t\tstates?: GitIssueState[];\n\t\t\t/** See {@link GetIssuesOptions.sort}. Forwarded to the provider fn; ordering is translated in the SDK. */\n\t\t\tsort?: IssueSorting;\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t},\n\t): Promise<PagedResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForCurrentUserFn',\n\t\t);\n\t\treturn this.getPagedResult<ProviderIssue>(\n\t\t\t{\n\t\t\t\tscope: options?.scope,\n\t\t\t\tassigneeUsername: options?.assigneeUsername,\n\t\t\t\tauthorUsername: options?.authorUsername,\n\t\t\t\tpage: options?.page,\n\t\t\t\tpageSize: options?.pageSize,\n\t\t\t\tstates: options?.states,\n\t\t\t\tsort: options?.sort,\n\t\t\t},\n\t\t\tprovider.getIssuesForCurrentUserFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor ?? undefined,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getIssuesForAzureProject(\n\t\ttokenOptInfo: TokenOptInfo<\n\t\t\tGitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer\n\t\t>,\n\t\tnamespace: string,\n\t\tproject: string,\n\t\toptions?: GetIssuesOptions & { isPAT?: boolean; baseUrl?: string },\n\t): Promise<PagedResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForAzureProjectFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderIssue>(\n\t\t\t{ namespace: namespace, project: project, ...options },\n\t\t\tprovider.getIssuesForAzureProjectFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getIssuesForProject(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tproject: string,\n\t\tresourceId: string,\n\t\toptions?: GetIssuesOptions,\n\t): Promise<ProviderIssue[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForProjectFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getIssuesForProjectFn?.(\n\t\t\t\t{\n\t\t\t\t\tprojectKey: project,\n\t\t\t\t\tresourceId: resourceId,\n\t\t\t\t\t...options,\n\t\t\t\t\tincludeTransitions: jiraListIncludeTransitions,\n\t\t\t\t},\n\t\t\t\t{ token: token },\n\t\t\t);\n\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderIssue[] | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * Single page of {@link getIssuesForProject} that preserves the SDK's `pageInfo` so a caller can drain\n\t * every page (the plain {@link getIssuesForProject} discards it, silently capping at the first page).\n\t * `nextCursor` is the raw provider cursor (Jira offset / nextPageToken) fed back verbatim as `options.cursor`.\n\t */\n\tasync getIssuesForProjectPaged(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tproject: string,\n\t\tresourceId: string,\n\t\toptions?: GetIssuesOptions,\n\t): Promise<{ data: ProviderIssue[]; hasMore: boolean; nextCursor: string | undefined } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForProjectFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getIssuesForProjectFn?.(\n\t\t\t\t{\n\t\t\t\t\tprojectKey: project,\n\t\t\t\t\tresourceId: resourceId,\n\t\t\t\t\t...options,\n\t\t\t\t\tincludeTransitions: jiraListIncludeTransitions,\n\t\t\t\t},\n\t\t\t\t{ token: token },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\t\t\treturn {\n\t\t\t\tdata: result.data,\n\t\t\t\thasMore: result.pageInfo?.hasNextPage ?? false,\n\t\t\t\tnextCursor: result.pageInfo?.endCursor ?? undefined,\n\t\t\t};\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t// Jira Server reads. Every one of them is addressed by `baseUrl` — the connection's own host — rather than\n\t// by a resource id: a self-hosted instance IS the resource, and routing by anything else would send one\n\t// host's token to another. `baseUrl` is therefore required, not optional, on all of them.\n\tasync getJiraServerCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>,\n\t\tbaseUrl: string,\n\t): Promise<ProviderAccount | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraServerCurrentUserFn',\n\t\t);\n\n\t\ttry {\n\t\t\tconst result = await provider.getJiraServerCurrentUserFn?.({\n\t\t\t\ttoken: tokenWithInfo.accessToken,\n\t\t\t\tbaseUrl: baseUrl,\n\t\t\t});\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderAccount | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * Jira Server's project list, which is a single unpaged `/rest/api/2/project` read rather than Cloud's\n\t * paged `project/search`, so there is no cursor to thread and the result is always the complete set.\n\t */\n\tasync getJiraServerProjects(\n\t\ttokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>,\n\t\tbaseUrl: string,\n\t): Promise<ProviderJiraServerProject[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraServerProjectsFn',\n\t\t);\n\n\t\ttry {\n\t\t\tconst result = await provider.getJiraServerProjectsFn?.({\n\t\t\t\ttoken: tokenWithInfo.accessToken,\n\t\t\t\tbaseUrl: baseUrl,\n\t\t\t});\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderJiraServerProject[] | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * One page of a Jira Server project's issues, preserving the SDK's `pageInfo` so the integration can drain\n\t * every page — the same contract as {@link getIssuesForProjectPaged} on Cloud.\n\t */\n\tasync getJiraServerIssuesForProjectPaged(\n\t\ttokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>,\n\t\tbaseUrl: string,\n\t\tprojectKey: string,\n\t\toptions?: GetIssuesOptions,\n\t): Promise<{ data: ProviderIssue[]; hasMore: boolean; nextCursor: string | undefined } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraServerIssuesForProjectFn',\n\t\t);\n\n\t\ttry {\n\t\t\tconst result = await provider.getJiraServerIssuesForProjectFn?.(\n\t\t\t\t{ projectKey: projectKey, ...options, includeTransitions: jiraListIncludeTransitions },\n\t\t\t\t{ token: tokenWithInfo.accessToken, baseUrl: baseUrl },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\n\t\t\treturn {\n\t\t\t\tdata: result.data,\n\t\t\t\thasMore: result.pageInfo?.hasNextPage ?? false,\n\t\t\t\tnextCursor: result.pageInfo?.endCursor ?? undefined,\n\t\t\t};\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * Single page of one issue search across several projects of a Jira Server instance — the contract of\n\t * {@link getIssuesForProjectsPaged} on Cloud: the page and its cursor are global to the project set, and at\n\t * most `JIRA_MAX_PROJECT_KEYS_PER_REQUEST` keys are accepted per call.\n\t */\n\tasync getJiraServerIssuesForProjectsPaged(\n\t\ttokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>,\n\t\tbaseUrl: string,\n\t\tprojectKeys: string[],\n\t\toptions?: GetIssuesOptions,\n\t): Promise<{ data: ProviderIssue[]; hasMore: boolean; nextCursor: string | undefined } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraServerIssuesForProjectsFn',\n\t\t);\n\n\t\ttry {\n\t\t\tconst result = await provider.getJiraServerIssuesForProjectsFn?.(\n\t\t\t\t{ projectKeys: projectKeys, ...options, includeTransitions: jiraListIncludeTransitions },\n\t\t\t\t{ token: tokenWithInfo.accessToken, baseUrl: baseUrl },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\n\t\t\treturn {\n\t\t\t\tdata: result.data,\n\t\t\t\thasMore: result.pageInfo?.hasNextPage ?? false,\n\t\t\t\tnextCursor: result.pageInfo?.endCursor ?? undefined,\n\t\t\t};\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getJiraServerIssue(\n\t\ttokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>,\n\t\tbaseUrl: string,\n\t\tnumber: string,\n\t): Promise<ProviderIssue | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraServerIssueFn',\n\t\t);\n\n\t\ttry {\n\t\t\tconst result = await provider.getJiraServerIssueFn?.(\n\t\t\t\t{ number: number },\n\t\t\t\t{ token: tokenWithInfo.accessToken, baseUrl: baseUrl },\n\t\t\t);\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\t// A key that names no issue is a lookup MISS, not a failure: both callers\n\t\t\t// (`getProviderLinkedIssueOrPullRequest`, `getProviderIssue`) read an autolink or a stored\n\t\t\t// reference that may simply be gone, and translating it would surface a `RequestNotFoundError`\n\t\t\t// where Jira Cloud's `getJiraIssueByKey` and the generic `getIssue` both return undefined.\n\t\t\tif (isProviderIssueNotFoundError(tokenWithInfo.providerId, e)) return undefined;\n\n\t\t\treturn this.handleProviderError<ProviderIssue | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/** The account-wide read: every issue related to the current user on this instance, no project needed. */\n\tasync getJiraServerIssuesForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>,\n\t\tbaseUrl: string,\n\t\toptions?: { cursor?: string; states?: GitIssueState[]; sort?: IssueSorting },\n\t): Promise<{ data: ProviderIssue[]; hasMore: boolean; nextCursor: string | undefined } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getJiraServerIssuesForCurrentUserFn',\n\t\t);\n\n\t\ttry {\n\t\t\tconst result = await provider.getJiraServerIssuesForCurrentUserFn?.(\n\t\t\t\t{\n\t\t\t\t\tcursor: options?.cursor,\n\t\t\t\t\tstates: options?.states,\n\t\t\t\t\tsort: options?.sort,\n\t\t\t\t\tincludeTransitions: jiraListIncludeTransitions,\n\t\t\t\t},\n\t\t\t\t{ token: tokenWithInfo.accessToken, baseUrl: baseUrl },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\n\t\t\treturn {\n\t\t\t\tdata: result.data,\n\t\t\t\thasMore: result.pageInfo?.hasNextPage ?? false,\n\t\t\t\tnextCursor: result.pageInfo?.endCursor ?? undefined,\n\t\t\t};\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * Single page of one issue search across several projects of the same Jira site. The page, its cursor and\n\t * `hasMore` are global to the whole project set, not per project; at most `JIRA_MAX_PROJECT_KEYS_PER_REQUEST`\n\t * keys are accepted per call (the SDK throws past it), so the caller chunks.\n\t */\n\tasync getIssuesForProjectsPaged(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tprojectKeys: string[],\n\t\tresourceId: string,\n\t\toptions?: GetIssuesOptions,\n\t): Promise<{ data: ProviderIssue[]; hasMore: boolean; nextCursor: string | undefined } | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForProjectsFn',\n\t\t);\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getIssuesForProjectsFn?.(\n\t\t\t\t{\n\t\t\t\t\tprojectKeys: projectKeys,\n\t\t\t\t\tresourceId: resourceId,\n\t\t\t\t\t...options,\n\t\t\t\t\tincludeTransitions: jiraListIncludeTransitions,\n\t\t\t\t},\n\t\t\t\t{ token: token },\n\t\t\t);\n\t\t\tif (result == null) return undefined;\n\t\t\treturn {\n\t\t\t\tdata: result.data,\n\t\t\t\thasMore: result.pageInfo?.hasNextPage ?? false,\n\t\t\t\tnextCursor: result.pageInfo?.endCursor ?? undefined,\n\t\t\t};\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getTrelloCard(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Trello>,\n\t\tappKey: string,\n\t\tcardId: string,\n\t\toptions?: { trelloBoardListsById?: Record<string, { name: string }> },\n\t): Promise<ProviderIssue | undefined> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\n\t\ttry {\n\t\t\tconst result = await this.request<TrelloCardResponse>({\n\t\t\t\turl: `${trelloBaseUrl}/1/cards/${encodeURIComponent(cardId)}?members=true`,\n\t\t\t\theaders: getTrelloAuthHeaders(appKey, tokenWithInfo.accessToken),\n\t\t\t});\n\n\t\t\treturn fromTrelloCard(result.body, options?.trelloBoardListsById ?? {});\n\t\t} catch (e) {\n\t\t\ttry {\n\t\t\t\treturn this.handleProviderError<ProviderIssue | undefined>(tokenWithInfo, e);\n\t\t\t} catch (ex) {\n\t\t\t\tif (RequestNotFoundError.is(ex)) return undefined;\n\t\t\t\tthrow ex;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Trello reads. The Trello client is keyed by an `appKey` (the Trello app key from the cloud token exchange)\n\t// paired with the OAuth token, so each wrapper threads `appKey` through alongside `tokenWithInfo`.\n\tasync getTrelloCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tappKey: string,\n\t): Promise<\n\t\t{ id: string; name: string; email: string; username: string; url: string; avatarUrl: string | null } | undefined\n\t> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getTrelloCurrentUserFn',\n\t\t);\n\t\ttry {\n\t\t\tconst result = await provider.getTrelloCurrentUserFn?.(\n\t\t\t\t{ appKey: appKey },\n\t\t\t\t{ token: tokenWithInfo.accessToken },\n\t\t\t);\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getTrelloBoardsForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tappKey: string,\n\t): Promise<TrelloBoard[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getTrelloBoardsForCurrentUserFn',\n\t\t);\n\t\ttry {\n\t\t\tconst result = await provider.getTrelloBoardsForCurrentUserFn?.(\n\t\t\t\t{ appKey: appKey },\n\t\t\t\t{ token: tokenWithInfo.accessToken },\n\t\t\t);\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getTrelloListsForBoard(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tappKey: string,\n\t\tboardId: string,\n\t): Promise<TrelloList[] | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getTrelloListsForBoardFn',\n\t\t);\n\t\ttry {\n\t\t\tconst result = await provider.getTrelloListsForBoardFn?.(\n\t\t\t\t{ appKey: appKey, boardId: boardId },\n\t\t\t\t{ token: tokenWithInfo.accessToken },\n\t\t\t);\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getTrelloIssuesForBoard(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tappKey: string,\n\t\tboardId: string,\n\t\toptions?: {\n\t\t\tassigneeLogins?: string[];\n\t\t\ttrelloBoardListsById?: Record<string, { name: string }>;\n\t\t\t/** See {@link GetIssuesOptions.sort}. Trello expresses only `updated`, in either direction. */\n\t\t\tsort?: IssueSorting;\n\t\t},\n\t): Promise<ProviderApiCollectionResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getTrelloIssuesForBoardFn',\n\t\t);\n\t\ttry {\n\t\t\tconst result = await provider.getTrelloIssuesForBoardFn?.(\n\t\t\t\t{ appKey: appKey, boardId: boardId, ...options },\n\t\t\t\t{ token: tokenWithInfo.accessToken },\n\t\t\t);\n\t\t\t// Trello's search caps results and reports the cap through `metadata.completeness` (never a cursor).\n\t\t\t// Preserve it so the integration can signal a terminal truncation rather than a fake next page.\n\t\t\treturn { values: result?.data ?? [], metadata: result?.metadata };\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<ProviderApiCollectionResult<ProviderIssue>>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getIssuesForResourceForCurrentUser(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tresourceId: string,\n\t\toptions?: {\n\t\t\tcursor?: string;\n\t\t\t/**\n\t\t\t * See {@link GetIssuesOptions.sort}. Forwarded for the same reason as every sibling issue read, even\n\t\t\t * though nothing reaches this one with a sort today: `IssuesIntegration.searchProviderMyIssues` is the\n\t\t\t * only caller and takes no options. A wrapper that accepted the SDK's input and silently dropped one\n\t\t\t * field of it would give whoever adds that option no ordering and no error.\n\t\t\t */\n\t\t\tsort?: IssueSorting;\n\t\t\t/** Omitted reads open issues (`statusCategory != Done`). */\n\t\t\tstates?: GitIssueState[];\n\t\t\tisPAT?: boolean;\n\t\t\tbaseUrl?: string;\n\t\t},\n\t): Promise<PagedResult<ProviderIssue>> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(\n\t\t\ttokenOptInfo,\n\t\t\t'getIssuesForResourceForCurrentUserFn',\n\t\t);\n\n\t\treturn this.getPagedResult<ProviderIssue>(\n\t\t\t{\n\t\t\t\tresourceId: resourceId,\n\t\t\t\tstates: options?.states,\n\t\t\t\tsort: options?.sort,\n\t\t\t\tincludeTransitions: jiraListIncludeTransitions,\n\t\t\t},\n\t\t\tprovider.getIssuesForResourceForCurrentUserFn,\n\t\t\ttokenWithInfo,\n\t\t\toptions?.cursor,\n\t\t\toptions?.isPAT,\n\t\t\toptions?.baseUrl,\n\t\t);\n\t}\n\n\tasync getJiraIssueByKey(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Jira>,\n\t\tresourceId: string,\n\t\tresourceUrl: string,\n\t\tkey: string,\n\t): Promise<ProviderIssue | undefined> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\n\t\ttry {\n\t\t\treturn await requestJiraIssueByKey(this.request, tokenWithInfo.accessToken, resourceId, resourceUrl, key);\n\t\t} catch (e) {\n\t\t\tconst status = (e as { response?: { status?: unknown } }).response?.status;\n\t\t\tif (status === 404) return undefined;\n\n\t\t\treturn this.handleProviderError<ProviderIssue | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\t/**\n\t * The change state of up to `jiraBulkFetchMaxKeys` issues of one Jira Cloud site, in one bulk fetch. Unlike\n\t * {@link getJiraIssueByKey}, a 404 is a failure: it names a wrong site or endpoint, never an absent issue.\n\t */\n\tasync getJiraIssuesEtagFields(\n\t\ttokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Jira>,\n\t\tresourceId: string,\n\t\tkeys: readonly string[],\n\t): Promise<{ issues: JiraIssueEtagResponse[]; errorCount: number }> {\n\t\tconst { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);\n\n\t\ttry {\n\t\t\treturn await requestJiraIssuesEtagFields(this.request, tokenWithInfo.accessToken, resourceId, keys);\n\t\t} catch (e) {\n\t\t\treturn this.handleProviderError<{ issues: JiraIssueEtagResponse[]; errorCount: number }>(tokenWithInfo, e);\n\t\t}\n\t}\n\n\tasync getIssue(\n\t\ttokenOptInfo: TokenWithInfo,\n\t\tinput: { resourceId: string; number: string } | { namespace: string; name: string; number: string },\n\t\toptions?: { isPAT?: boolean; baseUrl?: string },\n\t): Promise<ProviderIssue | undefined> {\n\t\tconst { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, 'getIssueFn');\n\t\tconst token = tokenWithInfo.accessToken;\n\n\t\ttry {\n\t\t\tconst result = await provider.getIssueFn?.(input, {\n\t\t\t\ttoken: token,\n\t\t\t\tisPAT: options?.isPAT,\n\t\t\t\tbaseUrl: options?.baseUrl,\n\t\t\t});\n\n\t\t\treturn result?.data;\n\t\t} catch (e) {\n\t\t\tif (isProviderIssueNotFoundError(tokenWithInfo.providerId, e)) return undefined;\n\n\t\t\treturn this.handleProviderError<ProviderIssue | undefined>(tokenWithInfo, e);\n\t\t}\n\t}\n}\n\n// This is copied over from the shared provider library because the current version is not respecting the \"forceIsFetch: true\"\n// option in the config and our custom fetch function isn't being wrapped by the necessary fetch wrapper. Remove this once the library\n// properly wraps our custom fetch and use `forceIsFetch: true` in the config.\nexport async function parseFetchResponseForApi<T>(response: Response): Promise<ProviderRequestResponse<T>> {\n\t// Media types are case-insensitive (RFC 9110 §8.3.1) and `fetch` hands the header back exactly as the server\n\t// wrote it, so match on a lowercased copy rather than the raw value.\n\tconst contentType = (response.headers.get('content-type') || '').toLowerCase();\n\tlet body;\n\tlet servedHtml = false;\n\n\t// parse the response body\n\tif (contentType.startsWith('application/json')) {\n\t\tconst text = await response.text();\n\t\t// A sign-in page a server mislabels as JSON is the same page under another header, and `<` can never open\n\t\t// valid JSON — so recognize it rather than letting JSON.parse throw a SyntaxError carrying no status.\n\t\tif (text.trimStart().startsWith('<')) {\n\t\t\tservedHtml = true;\n\t\t\tbody = text;\n\t\t} else {\n\t\t\tbody = text.trim().length > 0 ? JSON.parse(text) : null;\n\t\t}\n\t} else if (contentType.startsWith('text/') || contentType === '') {\n\t\tbody = await response.text();\n\t\t// An empty body is never a sign-in page, and a write answering `204` can carry a stale `text/html` from\n\t\t// whatever its endpoint usually returns — so require actual markup, not just the header.\n\t\tservedHtml = contentType.startsWith('text/html') && body.trim().length > 0;\n\t} else if (contentType.startsWith('application/vnd.github.raw+json')) {\n\t\tbody = await response.arrayBuffer();\n\t} else {\n\t\tthrow new Error(`Unsupported content-type: ${contentType}`);\n\t}\n\n\tconst result = {\n\t\tbody: body,\n\t\theaders: Object.fromEntries(response.headers.entries()),\n\t\tstatus: response.status,\n\t\tstatusText: response.statusText,\n\t};\n\n\t// A 2xx carrying a page rather than data is a rejected credential wearing a success status (GKDEV-3617); a\n\t// non-2xx keeps its own status error below, which is the better diagnostic.\n\tif (response.ok && servedHtml) {\n\t\tthrow new UnexpectedHtmlResponseError(response.status, contentType, result);\n\t}\n\n\t// throw an error if the response is not ok\n\tif (!response.ok) {\n\t\tconst status = `(${response.status})${response.statusText ? ` ${response.statusText}` : ''}.`;\n\t\tconst detail = getProviderResponseBodyMessage(body);\n\t\tconst error = new Error(detail != null ? `${status} ${detail}` : status);\n\t\tObject.assign(error, { response: result });\n\t\tthrow error;\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsGA,MAAM,qBACJ,aAAyE,WAAW;AAKtF,MAAM,sBAAsB;AAQ5B,SAAS,gBAAgB,IAAkC;CAC1D,OAAO,cAAc,SAAS,MAAM,QAAS,GAA8B,aAAa;AACzF;AAQA,SAAS,2BAA2B,IAAsB;CAMzD,IAAI,gBAAgB,EAAE,GAAG;EACxB,MAAM,SAAS,GAAG;EAKlB,IAAI,QAAQ,QACX,OAAO,OAAO,MACZ,MAAoB,EAAE,SAAS,gBAAgB,EAAE,QAAQ,QAAQ,EAAE,KAAK,SAAS,YAAY,EAC/F;EAED,OA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