@gitkraken/core-gitlens 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -1
- package/dist/git/models/remote.js +2 -2
- package/dist/git/models/remote.js.map +1 -1
- package/dist/git/remotes/matcher.js +25 -3
- package/dist/git/remotes/matcher.js.map +1 -1
- package/dist/git/utils/branchLanded.utils.d.ts +7 -0
- package/dist/git/utils/branchLanded.utils.js +10 -1
- package/dist/git/utils/branchLanded.utils.js.map +1 -1
- package/dist/git/utils/remote.utils.d.ts +1 -0
- package/dist/git/utils/remote.utils.js +14 -5
- package/dist/git/utils/remote.utils.js.map +1 -1
- package/dist/git-cli/parsers/logParser.js +227 -468
- package/dist/git-cli/parsers/logParser.js.map +1 -1
- package/dist/git-cli/parsers/refParser.js +4 -4
- package/dist/git-cli/parsers/refParser.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +5 -0
- package/dist/git-cli/providers/branches.js +25 -21
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/config.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/staging.js +1 -1
- package/dist/ipc/discovery.js +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
- package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.d.ts +31 -0
- package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js +166 -0
- package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js.map +1 -0
- package/dist/plus/git-github/api/github.d.ts +13 -5
- package/dist/plus/git-github/api/github.js +53 -13
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueWrites.d.ts +7 -1
- package/dist/plus/git-github/api/issueWrites.js +62 -32
- package/dist/plus/git-github/api/issueWrites.js.map +1 -1
- package/dist/plus/git-github/api/pullRequestWrites.d.ts +7 -3
- package/dist/plus/git-github/api/pullRequestWrites.js +120 -67
- package/dist/plus/git-github/api/pullRequestWrites.js.map +1 -1
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.d.ts +44 -0
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js +199 -0
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js.map +1 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +7 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.js +53 -7
- package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +2 -38
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +0 -199
- package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +4 -2
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js +12 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
- package/dist/plus/integrations/authentication/models.d.ts +0 -1
- package/dist/plus/integrations/authentication/models.js +1 -2
- package/dist/plus/integrations/authentication/models.js.map +1 -1
- package/dist/plus/integrations/constants.d.ts +0 -10
- package/dist/plus/integrations/constants.js +1 -95
- package/dist/plus/integrations/constants.js.map +1 -1
- package/dist/plus/integrations/context.d.ts +17 -17
- package/dist/plus/integrations/index.d.ts +44 -25
- package/dist/plus/integrations/index.js +41 -8
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +24 -24
- package/dist/plus/integrations/integrationService.js +125 -34
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/lite.js +1 -1
- package/dist/plus/integrations/lite.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +81 -21
- package/dist/plus/integrations/models/actionablePullRequest.d.ts +213 -0
- package/dist/plus/integrations/models/actionablePullRequest.js +25 -0
- package/dist/plus/integrations/models/actionablePullRequest.js.map +1 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +13 -46
- package/dist/plus/integrations/models/gitHostIntegration.js +22 -8
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +11 -175
- package/dist/plus/integrations/models/integration.js +22 -76
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issueTrackerWrites.d.ts +128 -0
- package/dist/plus/integrations/models/issueTrackerWrites.js +0 -0
- package/dist/plus/integrations/models/issuesIntegration.d.ts +9 -5
- package/dist/plus/integrations/models/issuesIntegration.js +5 -3
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
- package/dist/plus/integrations/models/publicIntegration.d.ts +257 -0
- package/dist/plus/integrations/models/publicIntegration.js +21 -0
- package/dist/plus/integrations/models/publicIntegration.js.map +1 -0
- package/dist/plus/integrations/providerFilters.d.ts +58 -0
- package/dist/plus/integrations/providerFilters.js.map +1 -1
- package/dist/plus/integrations/providers/actionablePullRequests.d.ts +19 -0
- package/dist/plus/integrations/providers/actionablePullRequests.js +32 -0
- package/dist/plus/integrations/providers/actionablePullRequests.js.map +1 -0
- package/dist/plus/integrations/providers/apiClients.d.ts +1 -2
- package/dist/plus/integrations/providers/apiClients.js.map +1 -1
- package/dist/plus/integrations/providers/asana.d.ts +3 -2
- package/dist/plus/integrations/providers/asana.js +2 -1
- package/dist/plus/integrations/providers/asana.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.d.ts +1 -1
- package/dist/plus/integrations/providers/azure/azure.js +1 -1
- package/dist/plus/integrations/providers/azure/azure.utils.d.ts +10 -3
- package/dist/plus/integrations/providers/azure/azure.utils.js +5 -1
- package/dist/plus/integrations/providers/azure/azure.utils.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts +1 -5
- package/dist/plus/integrations/providers/azure/models.js +1 -1
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +8 -5
- package/dist/plus/integrations/providers/azureDevOps.js +2 -1
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +5 -4
- package/dist/plus/integrations/providers/azureDevOpsServer.js +3 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +2 -2
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.d.ts +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.d.ts +5 -4
- package/dist/plus/integrations/providers/bitbucket-server.js +2 -1
- package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket.d.ts +4 -3
- package/dist/plus/integrations/providers/bitbucket.js +2 -1
- package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/github/github.d.ts +0 -1
- package/dist/plus/integrations/providers/github/github.js +1 -1
- package/dist/plus/integrations/providers/github/github.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +29 -11
- package/dist/plus/integrations/providers/github.js +195 -78
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +2 -2
- package/dist/plus/integrations/providers/gitlab/gitlab.js +1 -2
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts +14 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/models.d.ts +2 -10
- package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.d.ts +7 -5
- package/dist/plus/integrations/providers/gitlab.js +2 -1
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
- package/dist/plus/integrations/providers/jira-server.d.ts +4 -4
- package/dist/plus/integrations/providers/jira-server.js +3 -2
- package/dist/plus/integrations/providers/jira-server.js.map +1 -1
- package/dist/plus/integrations/providers/jira.d.ts +3 -3
- package/dist/plus/integrations/providers/jira.js +4 -3
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.d.ts +3 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueWriteErrors.d.ts +10 -0
- package/dist/plus/integrations/providers/jiraIssueWriteErrors.js +68 -0
- package/dist/plus/integrations/providers/jiraIssueWriteErrors.js.map +1 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.d.ts +40 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.js +397 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.js.map +1 -0
- package/dist/plus/integrations/providers/linear.d.ts +4 -3
- package/dist/plus/integrations/providers/linear.js +3 -2
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/providers/linearIssuesEtag.d.ts +1 -1
- package/dist/plus/integrations/providers/linearIssuesEtag.js +1 -1
- package/dist/plus/integrations/providers/linearIssuesEtag.js.map +1 -1
- package/dist/plus/integrations/providers/metadata.d.ts +136 -0
- package/dist/plus/integrations/providers/metadata.js +513 -0
- package/dist/plus/integrations/providers/metadata.js.map +1 -0
- package/dist/plus/integrations/providers/models.d.ts +10 -206
- package/dist/plus/integrations/providers/models.js +8 -539
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +7 -3
- package/dist/plus/integrations/providers/providersApi.js +23 -11
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/trello.d.ts +1 -1
- package/dist/plus/integrations/providers/trello.js +2 -1
- package/dist/plus/integrations/providers/trello.js.map +1 -1
- package/dist/plus/integrations/providers/utils/providerPaging.d.ts +2 -0
- package/dist/plus/integrations/providers/utils/providerPaging.js +3 -2
- package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
- package/dist/plus/integrations/providers/utils.d.ts +119 -10
- package/dist/plus/integrations/providers/utils.js +57 -3
- package/dist/plus/integrations/providers/utils.js.map +1 -1
- package/dist/plus/integrations/reads/autolinks.d.ts +1 -1
- package/dist/plus/integrations/reads/autolinks.js +1 -1
- package/dist/plus/integrations/reads/autolinks.js.map +1 -1
- package/dist/plus/integrations/reads/broaden.d.ts +1 -1
- package/dist/plus/integrations/reads/broaden.js +3 -2
- package/dist/plus/integrations/reads/broaden.js.map +1 -1
- package/dist/plus/integrations/reads/context.d.ts +1 -1
- package/dist/plus/integrations/reads/counts.d.ts +1 -88
- package/dist/plus/integrations/reads/counts.js +4 -2
- package/dist/plus/integrations/reads/counts.js.map +1 -1
- package/dist/plus/integrations/reads/currentAccount.d.ts +1 -18
- package/dist/plus/integrations/reads/currentAccount.js.map +1 -1
- package/dist/plus/integrations/reads/drains.d.ts +4 -3
- package/dist/plus/integrations/reads/drains.js +1 -1
- package/dist/plus/integrations/reads/drains.js.map +1 -1
- package/dist/plus/integrations/reads/etag.d.ts +174 -3
- package/dist/plus/integrations/reads/etag.js +69 -14
- package/dist/plus/integrations/reads/etag.js.map +1 -1
- package/dist/plus/integrations/reads/filters.d.ts +3 -61
- package/dist/plus/integrations/reads/filters.js +1 -1
- package/dist/plus/integrations/reads/filters.js.map +1 -1
- package/dist/plus/integrations/reads/hierarchy.d.ts +1 -1
- package/dist/plus/integrations/reads/hierarchy.js +4 -2
- package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
- package/dist/plus/integrations/reads/issueBatch.d.ts +2 -102
- package/dist/plus/integrations/reads/issueBatch.js +3 -4
- package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.d.ts +1 -1
- package/dist/plus/integrations/reads/issueTracker.js +4 -3
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
- package/dist/plus/integrations/reads/issues.d.ts +1 -1
- package/dist/plus/integrations/reads/issues.js +4 -2
- package/dist/plus/integrations/reads/issues.js.map +1 -1
- package/dist/plus/integrations/reads/paging.d.ts +1 -1
- package/dist/plus/integrations/reads/paging.js +1 -1
- package/dist/plus/integrations/reads/paging.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestActivity.d.ts +1 -24
- package/dist/plus/integrations/reads/pullRequestActivity.js +2 -1
- package/dist/plus/integrations/reads/pullRequestActivity.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBatch.d.ts +2 -56
- package/dist/plus/integrations/reads/pullRequestBatch.js +23 -3
- package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBranches.d.ts +1 -47
- package/dist/plus/integrations/reads/pullRequestBranches.js +2 -1
- package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestCheckLogs.d.ts +1 -15
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js +2 -1
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequests.js +4 -2
- package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestsForCommits.d.ts +1 -16
- package/dist/plus/integrations/reads/pullRequestsForCommits.js +2 -1
- package/dist/plus/integrations/reads/pullRequestsForCommits.js.map +1 -1
- package/dist/plus/integrations/reads/resolveRepository.js +10 -5
- package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
- package/dist/plus/integrations/reads/searchIssues.js +2 -1
- package/dist/plus/integrations/reads/searchIssues.js.map +1 -1
- package/dist/plus/integrations/reads/searchPullRequests.js +2 -1
- package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/sweeps.d.ts +1 -1
- package/dist/plus/integrations/reads/sweeps.js +3 -2
- package/dist/plus/integrations/reads/sweeps.js.map +1 -1
- package/dist/plus/integrations/reads/warnings.d.ts +1 -1
- package/dist/plus/integrations/reads/warnings.js +1 -1
- package/dist/plus/integrations/reads/warnings.js.map +1 -1
- package/dist/plus/integrations/results.d.ts +324 -2
- package/dist/plus/integrations/results.js.map +1 -1
- package/dist/plus/integrations/telemetry.d.ts +0 -10
- package/dist/plus/integrations/telemetry.js +0 -11
- package/dist/plus/integrations/utils/domain.utils.d.ts +1 -0
- package/dist/plus/integrations/utils/domain.utils.js +10 -2
- package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
- package/dist/plus/integrations/utils/integration.utils.d.ts +2 -6
- package/dist/plus/integrations/utils/integration.utils.js +8 -9
- package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
- package/dist/utils/env/node/exec.js +2 -2
- package/dist/utils/keys/chord.d.ts +13 -2
- package/dist/utils/keys/chord.js +76 -17
- package/dist/utils/keys/chord.js.map +1 -1
- package/dist/utils/keys/keybinding.d.ts +12 -0
- package/dist/utils/keys/keybinding.js +52 -2
- package/dist/utils/keys/keybinding.js.map +1 -1
- package/dist/utils/markdown.d.ts +21 -0
- package/dist/utils/markdown.js +33 -1
- package/dist/utils/markdown.js.map +1 -1
- package/docs/integrations.md +174 -19
- package/package.json +5 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +0 -1
- package/dist/plus/integrations/telemetry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asana.js","names":[],"sources":["../../../../../plus/integrations/src/providers/asana.ts"],"sourcesContent":["import type { CollectionMetadata, CollectionScopeFailure, IssueProjectMembership } from '@gitkraken/provider-apis';\nimport type { Account } from '@gitlens/git/models/author.js';\nimport type { Issue, IssueProject, IssueShape } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequest, IssueOrPullRequestType } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { IssueResourceDescriptor, ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport { isIssueResourceDescriptor } from '@gitlens/git/utils/resourceDescriptor.utils.js';\nimport { isCancellationError } from '@gitlens/utils/cancellation.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport { PromiseCache } from '@gitlens/utils/promiseCache.js';\nimport type { IntegrationAuthenticationProviderDescriptor } from '../authentication/integrationAuthenticationProvider.js';\nimport type { ProviderAuthenticationSession } from '../authentication/models.js';\nimport { toTokenWithInfo } from '../authentication/models.js';\nimport { throwIfCallerContractError, toCollectionScopeFailure } from '../collectionMetadata.js';\nimport { IntegrationReadUnavailableError, toError } from '../errors.js';\nimport type {\n\tAccountWideIssuesResult,\n\tIssuesForProjectOptions,\n\tProjectIssuesDrain,\n\tProjectIssuesRequest,\n\tSearchMyIssuesOptions,\n} from '../models/issueReads.js';\nimport { groupProjectIssuesSearches, IssuesIntegration } from '../models/issuesIntegration.js';\nimport type { ProviderApiCollectionResult, ProviderIssue } from './models.js';\nimport {\n\tfromProviderIssue,\n\tprovidersMetadata,\n\ttoIssueProviderState,\n\ttoIssueShape,\n\ttoProviderIssueStates,\n} from './models.js';\nimport { collectProviderPagedResult, mergeCollectionMetadata } from './utils/providerPaging.js';\n\nconst metadata = providersMetadata.asana;\ntype AsanaIntegrationId = typeof metadata.id;\nconst authProvider = Object.freeze({ id: metadata.id, scopes: metadata.scopes });\n/** Long enough to span one tracker read, short enough that a profile change shows on the next. */\nconst recentAccountTTL = 60 * 1000;\n/** The workspace and project discovery backstop: provider-apis pages them 100 at a time, so 2,000 of each. */\nconst maxDiscoveryPages = 20;\n/** The task drain's backstop, per project or per workspace: 1,000 tasks at the SDK's 100-per-page. */\nconst maxTaskPages = 10;\n\n/** An Asana project, naming the workspace it belongs to so its tasks can be encoded and its account resolved. */\nexport interface AsanaProjectDescriptor extends IssueResourceDescriptor {\n\tresourceId: string;\n\tresourceName: string;\n}\n\nexport class AsanaIntegration extends IssuesIntegration<AsanaIntegrationId> {\n\treadonly authProvider: IntegrationAuthenticationProviderDescriptor = authProvider;\n\n\toverride get id(): AsanaIntegrationId {\n\t\treturn metadata.id;\n\t}\n\tprotected override get key(): 'asana' {\n\t\treturn 'asana';\n\t}\n\toverride get name(): string {\n\t\treturn metadata.name;\n\t}\n\toverride get domain(): string {\n\t\treturn metadata.domain;\n\t}\n\n\t/**\n\t * Always asks Asana: the host's current-account cache decides when this runs. An Asana user is the same in every\n\t * workspace, so the answer is lent briefly to the per-workspace lookup a tracker read makes right after it.\n\t */\n\tprotected override async getProviderCurrentAccount(\n\t\tsession: ProviderAuthenticationSession,\n\t): Promise<Account | undefined> {\n\t\tconst account = await this.fetchAccount(session);\n\t\tif (account != null) {\n\t\t\tthis._recentAccounts.set(session.accessToken, Promise.resolve(account));\n\t\t}\n\t\treturn account;\n\t}\n\n\tprotected override getProviderUncachedAccountForResource(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resource: ResourceDescriptor,\n\t): Promise<Account | undefined> {\n\t\treturn this.fetchAccount(session);\n\t}\n\n\tprotected override getProviderAccountForResource(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resource: ResourceDescriptor,\n\t): Promise<Account | undefined> {\n\t\treturn this._recentAccounts.getOrCreate(session.accessToken, () => this.fetchAccount(session), {\n\t\t\tevictWhen: account => account == null,\n\t\t});\n\t}\n\n\tprotected override clearDiscoveryCaches(): void {\n\t\tthis._recentAccounts.clear();\n\t}\n\n\tprivate readonly _recentAccounts = new PromiseCache<string, Account | undefined>({\n\t\tcapacity: 10,\n\t\tcreateTTL: recentAccountTTL,\n\t});\n\n\tprivate async fetchAccount(session: ProviderAuthenticationSession): Promise<Account | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst user = await api.getAsanaCurrentUser(toTokenWithInfo(this.id, session));\n\t\tif (user == null) return undefined;\n\n\t\treturn {\n\t\t\tprovider: this,\n\t\t\tid: user.id,\n\t\t\tname: user.name ?? undefined,\n\t\t\t// Asana has no usernames; the SDK reports the display name as the handle.\n\t\t\tusername: user.username ?? undefined,\n\t\t\temail: user.email ?? undefined,\n\t\t\tavatarUrl: user.avatarUrl ?? undefined,\n\t\t};\n\t}\n\n\tprotected override async getProviderResourcesForUser(\n\t\tsession: ProviderAuthenticationSession,\n\t): Promise<IssueResourceDescriptor[] | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst tokenWithInfo = toTokenWithInfo(this.id, session);\n\t\tconst workspaces = await collectProviderPagedResult(\n\t\t\tcursor => api.getAsanaWorkspacesForCurrentUser(tokenWithInfo, { cursor: cursor }),\n\t\t\tmaxDiscoveryPages,\n\t\t);\n\t\t// Resource discovery has no completeness to report, so a user past the backstop is logged rather than refused:\n\t\t// the workspaces read still hold their projects.\n\t\tif (workspaces.truncated) {\n\t\t\tLogger.warn(`Asana workspace discovery stopped after ${workspaces.values.length} workspaces`);\n\t\t}\n\t\treturn workspaces.values.map(w => ({ key: w.id, id: w.id, name: w.name }));\n\t}\n\n\tprotected override async getProviderProjectsForResources(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources: ResourceDescriptor[],\n\t): Promise<AsanaProjectDescriptor[] | undefined> {\n\t\treturn (await this.getProviderProjectsForResourcesWithMetadata(session, resources)).values;\n\t}\n\n\t/**\n\t * Each workspace's unarchived projects, drained per workspace. A workspace whose drain failed or ran out of pages\n\t * keeps what it read and is recorded in the metadata, so one large or unreadable workspace doesn't hide the rest.\n\t */\n\tprotected override async getProviderProjectsForResourcesWithMetadata(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources: ResourceDescriptor[],\n\t): Promise<ProviderApiCollectionResult<AsanaProjectDescriptor>> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst tokenWithInfo = toTokenWithInfo(this.id, session);\n\n\t\tconst values: AsanaProjectDescriptor[] = [];\n\t\tlet collectionMetadata: CollectionMetadata | undefined;\n\t\tfor (const workspace of resources.filter(isIssueResourceDescriptor)) {\n\t\t\tconst scope: CollectionScopeFailure['scope'] = { providerId: this.id, resourceId: workspace.id };\n\t\t\tconst projects = await collectProviderPagedResult(\n\t\t\t\tcursor => api.getAsanaProjectsForWorkspace(tokenWithInfo, workspace.id, { cursor: cursor }),\n\t\t\t\tmaxDiscoveryPages,\n\t\t\t\tscope,\n\t\t\t);\n\t\t\tvalues.push(\n\t\t\t\t...projects.values.map(p => ({\n\t\t\t\t\tkey: p.id,\n\t\t\t\t\tid: p.id,\n\t\t\t\t\tname: p.name,\n\t\t\t\t\tresourceId: workspace.id,\n\t\t\t\t\tresourceName: workspace.name,\n\t\t\t\t})),\n\t\t\t);\n\t\t\tcollectionMetadata = mergeCollectionMetadata(\n\t\t\t\tcollectionMetadata,\n\t\t\t\tprojects.truncated && !projects.metadata?.failures?.length\n\t\t\t\t\t? mergeCollectionMetadata(projects.metadata, {\n\t\t\t\t\t\t\tcompleteness: 'partial',\n\t\t\t\t\t\t\tomissions: [{ kind: 'pagination-incomplete', scope: scope }],\n\t\t\t\t\t\t})\n\t\t\t\t\t: projects.metadata,\n\t\t\t);\n\t\t}\n\n\t\treturn collectionMetadata != null ? { values: values, metadata: collectionMetadata } : { values: values };\n\t}\n\n\tprotected override async getProviderIssuesForProject(\n\t\tsession: ProviderAuthenticationSession,\n\t\tproject: ResourceDescriptor,\n\t\toptions?: IssuesForProjectOptions,\n\t): Promise<IssueShape[] | undefined> {\n\t\treturn (await this.getProviderIssuesForProjectWithTruncation(session, project, options))?.values;\n\t}\n\n\t/**\n\t * A project's tasks, narrowed to the viewer's by assignee after the drain: Asana's task list takes a project or\n\t * an assignee, never both. So a user-scoped read of a busy project spends its page budget on other people's\n\t * tasks, and a truncated one can't be recovered by a narrower scope.\n\t */\n\tprotected override async getProviderIssuesForProjectWithTruncation(\n\t\tsession: ProviderAuthenticationSession,\n\t\tproject: ResourceDescriptor,\n\t\toptions?: IssuesForProjectOptions,\n\t): Promise<ProjectIssuesDrain | undefined> {\n\t\tif (!isAsanaProjectDescriptor(project)) return undefined;\n\n\t\tlet viewerId: string | undefined;\n\t\tif (options?.user != null) {\n\t\t\tviewerId = options.userId ?? (await this.getProviderAccountForResource(session, project))?.id;\n\t\t\t// Without the viewer the read can't be scoped to \"my issues\": the unfiltered project would leak everyone\n\t\t\t// else's tasks, and an empty list would read as \"nothing assigned to me\".\n\t\t\tif (viewerId == null) {\n\t\t\t\tthrow new IntegrationReadUnavailableError(\n\t\t\t\t\tmetadata.name,\n\t\t\t\t\t'could not resolve the current user to scope issues to',\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst drain = await this.drainTasks(session, { projectId: project.id }, options, {\n\t\t\tproviderId: this.id,\n\t\t\tresourceId: project.resourceId,\n\t\t\tprojectId: project.id,\n\t\t});\n\n\t\tconst issueProject = toIssueProject(project);\n\t\tconst values = drain.values.flatMap(issue => {\n\t\t\tif (viewerId != null && !issue.assignees.some(a => a.id === viewerId)) return [];\n\n\t\t\tconst shape = toIssueShape(issue, this, { projection: 'project' });\n\t\t\treturn shape == null ? [] : [{ ...shape, project: issueProject } satisfies IssueShape];\n\t\t});\n\n\t\treturn drain.truncated\n\t\t\t? { values: values, truncated: true, recovery: 'none', metadata: drain.metadata }\n\t\t\t: { values: values, truncated: false, metadata: drain.metadata };\n\t}\n\n\t/**\n\t * Searches every project of one workspace together when the read is scoped to the viewer: Asana's \"my tasks\" read\n\t * takes the workspace and the assignee, so one drain answers all of them, where reading project by project would\n\t * drain every task of every project only to keep the viewer's.\n\t */\n\tprotected override getProjectIssuesSearches(\n\t\trequests: readonly ProjectIssuesRequest<ResourceDescriptor>[],\n\t): number[][] | undefined {\n\t\treturn groupProjectIssuesSearches(requests, ({ project, options }) =>\n\t\t\toptions.user != null && isAsanaProjectDescriptor(project)\n\t\t\t\t? [\n\t\t\t\t\t\tproject.resourceId,\n\t\t\t\t\t\toptions.user,\n\t\t\t\t\t\toptions.userId ?? '',\n\t\t\t\t\t\toptions.sort ?? '',\n\t\t\t\t\t\toptions.state ?? '',\n\t\t\t\t\t\toptions.filters?.join(',') ?? '',\n\t\t\t\t\t].join('\\0')\n\t\t\t\t: undefined,\n\t\t);\n\t}\n\n\t/**\n\t * The viewer's tasks in one workspace, split into the requested projects. A task outside them (in another project,\n\t * or in none, only in the user's My Tasks) belongs to no project of this read and is left out.\n\t *\n\t * A task can be in several projects (a sprint board and each customer's own board, say), and an unscoped task read\n\t * reports only the first one Asana lists as its `project`. So it is filed under every requested project among its\n\t * memberships (`projectMemberships`), with its section in that project as its state, as the per-project fallback\n\t * would list it.\n\t */\n\tprotected override async searchProviderProjectIssues(\n\t\tsession: ProviderAuthenticationSession,\n\t\trequests: readonly ProjectIssuesRequest<ResourceDescriptor>[],\n\t): Promise<IssueShape[][] | undefined> {\n\t\tconst projects = requests.map(request => request.project).filter(isAsanaProjectDescriptor);\n\t\tif (projects.length !== requests.length) return undefined;\n\n\t\t// Every request of a search shares the workspace and every option read here (see `getProjectIssuesSearches`).\n\t\tconst { options } = requests[0];\n\t\tconst drain = await this.drainTasks(\n\t\t\tsession,\n\t\t\t{ workspaceId: projects[0].resourceId },\n\t\t\toptions,\n\t\t\t// Never published: an incomplete search is read again project by project, which records its own failures.\n\t\t\t{ providerId: this.id, resourceId: projects[0].resourceId },\n\t\t);\n\t\t// An incomplete search says nothing about which of its projects it covered, so only the per-project reads can\n\t\t// report each one's completeness.\n\t\tif (drain.truncated || (drain.metadata != null && drain.metadata.completeness !== 'complete')) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst indexById = new Map(projects.map((project, index) => [project.id, index]));\n\t\tconst split = projects.map((): IssueShape[] => []);\n\t\tfor (const task of drain.values) {\n\t\t\tconst shape = toIssueShape(task, this, { projection: 'project' });\n\t\t\tif (shape == null) continue;\n\n\t\t\t// Only the section differs between a task's projects: whether it is closed is the task's own.\n\t\t\tfor (const { index, state } of toRequestedProjectPlacements(task, indexById)) {\n\t\t\t\tsplit[index].push({\n\t\t\t\t\t...shape,\n\t\t\t\t\tproject: toIssueProject(projects[index]),\n\t\t\t\t\tproviderState: toIssueProviderState(state),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn split;\n\t}\n\n\tprotected override async searchProviderMyIssues(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources?: ResourceDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<IssueShape[] | undefined> {\n\t\treturn (await this.searchProviderMyIssuesWithTruncation(session, resources, cancellation))?.values;\n\t}\n\n\t/**\n\t * The tasks assigned to the viewer, one drain per workspace (Asana requires the workspace alongside the\n\t * assignee). Reads every workspace the user belongs to unless `resources` names some. A workspace that can't be\n\t * read is recorded in the metadata and the others are still returned; only when none could be read does the read\n\t * throw. Cancellation stops between workspaces and is not reported as truncation: the caller asked for the read to\n\t * stop.\n\t */\n\tprotected override async searchProviderMyIssuesWithTruncation(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources?: ResourceDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t\toptions?: SearchMyIssuesOptions,\n\t): Promise<AccountWideIssuesResult | undefined> {\n\t\tconst workspaces = (resources ?? (await this.getProviderResourcesForUser(session)) ?? []).filter(\n\t\t\tisIssueResourceDescriptor,\n\t\t);\n\n\t\tconst values: IssueShape[] = [];\n\t\tlet truncated = false;\n\t\tlet collectionMetadata: CollectionMetadata | undefined;\n\t\tlet firstError: Error | undefined;\n\t\tlet workspacesRead = 0;\n\t\tfor (const workspace of workspaces) {\n\t\t\tif (cancellation?.aborted) break;\n\n\t\t\tconst scope: CollectionScopeFailure['scope'] = { providerId: this.id, resourceId: workspace.id };\n\t\t\tlet drain: Awaited<ReturnType<AsanaIntegration['drainTasks']>>;\n\t\t\ttry {\n\t\t\t\tdrain = await this.drainTasks(session, { workspaceId: workspace.id }, options, scope);\n\t\t\t} catch (ex) {\n\t\t\t\tif (isCancellationError(ex)) throw ex;\n\n\t\t\t\tthrowIfCallerContractError(ex);\n\n\t\t\t\tfirstError ??= toError(ex);\n\t\t\t\ttruncated = true;\n\t\t\t\tcollectionMetadata = mergeCollectionMetadata(collectionMetadata, {\n\t\t\t\t\tcompleteness: 'partial',\n\t\t\t\t\tfailures: [toCollectionScopeFailure(scope, ex)],\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tworkspacesRead++;\n\t\t\ttruncated ||= drain.truncated;\n\t\t\tcollectionMetadata = mergeCollectionMetadata(collectionMetadata, drain.metadata);\n\t\t\tfor (const issue of drain.values) {\n\t\t\t\tconst shape = toIssueShape(issue, this, { projection: 'account' });\n\t\t\t\tif (shape != null) {\n\t\t\t\t\tvalues.push({ ...shape, project: toAsanaIssueProject(issue, workspace) });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Every workspace failed: an empty \"my issues\" would read as \"nothing assigned to me\".\n\t\tif (workspacesRead === 0 && firstError != null) throw firstError;\n\n\t\treturn { values: values, truncated: truncated, metadata: collectionMetadata };\n\t}\n\n\t/**\n\t * Follows a task read's cursor up to {@link maxTaskPages}. `truncated` is set when the backstop stopped it with\n\t * pages left, or when a page after the first failed (recorded under `scope`, keeping the prefix). A failure on the\n\t * first page throws, so the caller sees an error rather than an empty success.\n\t */\n\tprivate async drainTasks(\n\t\tsession: ProviderAuthenticationSession,\n\t\tread: { projectId: string } | { workspaceId: string },\n\t\toptions: Pick<IssuesForProjectOptions, 'state' | 'sort'> | undefined,\n\t\tscope: CollectionScopeFailure['scope'],\n\t): Promise<{ values: ProviderIssue[]; truncated: boolean; metadata?: CollectionMetadata }> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst tokenWithInfo = toTokenWithInfo(this.id, session);\n\t\tconst states = toProviderIssueStates(options?.state);\n\t\tlet pagesRead = 0;\n\t\tlet firstPageError: Error | undefined;\n\t\tconst drain = await collectProviderPagedResult(\n\t\t\tasync cursor => {\n\t\t\t\tconst pageOptions = { cursor: cursor, states: states, sort: options?.sort };\n\t\t\t\ttry {\n\t\t\t\t\tconst page = await ('projectId' in read\n\t\t\t\t\t\t? api.getAsanaIssuesForProject(tokenWithInfo, read.projectId, pageOptions)\n\t\t\t\t\t\t: api.getAsanaIssuesForCurrentUser(tokenWithInfo, read.workspaceId, pageOptions));\n\t\t\t\t\tpagesRead++;\n\t\t\t\t\treturn page;\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tif (pagesRead === 0) {\n\t\t\t\t\t\tfirstPageError = toError(ex);\n\t\t\t\t\t}\n\t\t\t\t\tthrow ex;\n\t\t\t\t}\n\t\t\t},\n\t\t\tmaxTaskPages,\n\t\t\tscope,\n\t\t);\n\t\tif (firstPageError != null) throw firstPageError;\n\n\t\treturn { values: drain.values, truncated: drain.truncated === true, metadata: drain.metadata };\n\t}\n\n\tprotected override getProviderLinkedIssueOrPullRequest(\n\t\t_session: ProviderAuthenticationSession,\n\t\t_resource: ResourceDescriptor,\n\t\t_id: { id: string; key: string },\n\t\t_type: undefined | IssueOrPullRequestType,\n\t): Promise<IssueOrPullRequest | undefined> {\n\t\t// Asana task references are gids in a permalink URL, never a short key a commit message would carry.\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\t/** `resource` is the task's workspace; `id` is the task gid, which is also what an Asana issue reports as its id. */\n\tprotected override async getProviderIssue(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresource: ResourceDescriptor,\n\t\tid: string,\n\t): Promise<Issue | undefined> {\n\t\tif (!isIssueResourceDescriptor(resource)) return undefined;\n\n\t\tconst api = await this.getProvidersApi();\n\t\tconst issue = await api.getAsanaIssue(toTokenWithInfo(this.id, session), id);\n\t\treturn issue != null\n\t\t\t? fromProviderIssue(issue, this, { projection: 'point', project: toAsanaIssueProject(issue, resource) })\n\t\t\t: undefined;\n\t}\n}\n\nfunction isAsanaProjectDescriptor(project: ResourceDescriptor): project is AsanaProjectDescriptor {\n\treturn isIssueResourceDescriptor(project) && typeof project.resourceId === 'string';\n}\n\n/**\n * Each requested project a task is in, by its index in the read, with the task's state as that project would list it:\n * its section there, since the unscoped read reports the first membership's.\n */\nfunction toRequestedProjectPlacements(\n\tissue: ProviderIssue,\n\tindexById: ReadonlyMap<string, number>,\n): { index: number; state: ProviderIssue['state'] }[] {\n\tconst memberships = issue.projectMemberships;\n\tif (memberships == null) {\n\t\tconst index = issue.project?.id != null ? indexById.get(issue.project.id) : undefined;\n\t\treturn index != null ? [{ index: index, state: issue.state }] : [];\n\t}\n\n\tconst placements: { index: number; state: ProviderIssue['state'] }[] = [];\n\tfor (const membership of memberships) {\n\t\tconst index = indexById.get(membership.project.id);\n\t\tif (index == null || placements.some(p => p.index === index)) continue;\n\n\t\tplacements.push({ index: index, state: getProjectMembershipState(issue, membership) });\n\t}\n\treturn placements;\n}\n\n/**\n * Mirrors provider-apis' state for a task read scoped to the membership's project; the parity test in `asana.test.ts`\n * runs both through provider-apis' own normalization to keep them agreeing.\n */\nfunction getProjectMembershipState(issue: ProviderIssue, membership: IssueProjectMembership): ProviderIssue['state'] {\n\tif (issue.project?.id === membership.project.id) return issue.state;\n\n\tconst completed = issue.closedDate != null;\n\tif (membership.section != null) {\n\t\treturn {\n\t\t\tid: membership.section.id,\n\t\t\tname: membership.section.name,\n\t\t\tcolor: null,\n\t\t\t...(completed ? { category: 'DONE' as const } : {}),\n\t\t};\n\t}\n\treturn completed ? { name: 'Completed', color: null, category: 'DONE' } : null;\n}\n\nfunction toIssueProject(project: AsanaProjectDescriptor): IssueProject {\n\treturn { id: project.id, name: project.name, resourceId: project.resourceId, resourceName: project.resourceName };\n}\n\n/**\n * The project an issue read outside a project reports. An Asana issue entity identifier is keyed by the task's\n * workspace, which the SDK reports beside the project rather than in it, so this always names the workspace as the\n * resource. A task in no project (only in someone's My Tasks) reports the workspace as its project too, so its\n * branch associations stay round-trippable.\n */\nfunction toAsanaIssueProject(issue: ProviderIssue, workspace: IssueResourceDescriptor): IssueProject {\n\tconst resourceId = issue.workspaceId ?? workspace.id;\n\tconst resourceName = resourceId === workspace.id ? workspace.name : '';\n\treturn issue.project?.id != null\n\t\t? { id: issue.project.id, name: issue.project.name, resourceId: resourceId, resourceName: resourceName }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W,MAAK,MAAK,EAAE,UAAU,KAAK,GAAG;EAE9D,WAAW,KAAK;GAAS;GAAO,OAAO,0BAA0B,OAAO,UAAU;EAAE,CAAC;CACtF;CACA,OAAO;AACR;;;;;AAMA,SAAS,0BAA0B,OAAsB,YAA4D;CACpH,IAAI,MAAM,SAAS,OAAO,WAAW,QAAQ,IAAI,OAAO,MAAM;CAE9D,MAAM,YAAY,MAAM,cAAc;CACtC,IAAI,WAAW,WAAW,MACzB,OAAO;EACN,IAAI,WAAW,QAAQ;EACvB,MAAM,WAAW,QAAQ;EACzB,OAAO;EACP,GAAI,YAAY,EAAE,UAAU,OAAgB,IAAI,CAAC;CAClD;CAED,OAAO,YAAY;EAAE,MAAM;EAAa,OAAO;EAAM,UAAU;CAAO,IAAI;AAC3E;AAEA,SAAS,eAAe,SAA+C;CACtE,OAAO;EAAE,IAAI,QAAQ;EAAI,MAAM,QAAQ;EAAM,YAAY,QAAQ;EAAY,cAAc,QAAQ;CAAa;AACjH;;;;;;;AAQA,SAAS,oBAAoB,OAAsB,WAAkD;CACpG,MAAM,aAAa,MAAM,eAAe,UAAU;CAClD,MAAM,eAAe,eAAe,UAAU,KAAK,UAAU,OAAO;CACpE,OAAO,MAAM,SAAS,MAAM,OACzB;EAAE,IAAI,MAAM,QAAQ;EAAI,MAAM,MAAM,QAAQ;EAAkB;EAA0B;CAAa,IACrG;EAAE,IAAI;EAAY,MAAM;EAA0B;EAA0B;CAAa;AAC7F"}
|
|
1
|
+
{"version":3,"file":"asana.js","names":[],"sources":["../../../../../plus/integrations/src/providers/asana.ts"],"sourcesContent":["import type { CollectionMetadata, CollectionScopeFailure, IssueProjectMembership } from '@gitkraken/provider-apis';\nimport type { Account } from '@gitlens/git/models/author.js';\nimport type { Issue, IssueProject, IssueShape } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequest, IssueOrPullRequestType } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { IssueResourceDescriptor, ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport { isIssueResourceDescriptor } from '@gitlens/git/utils/resourceDescriptor.utils.js';\nimport { isCancellationError } from '@gitlens/utils/cancellation.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport { PromiseCache } from '@gitlens/utils/promiseCache.js';\nimport type { IntegrationAuthenticationProviderDescriptor } from '../authentication/integrationAuthenticationProvider.js';\nimport type { ProviderAuthenticationSession } from '../authentication/models.js';\nimport { toTokenWithInfo } from '../authentication/models.js';\nimport { throwIfCallerContractError, toCollectionScopeFailure } from '../collectionMetadata.js';\nimport { IntegrationReadUnavailableError, toError } from '../errors.js';\nimport type {\n\tAccountWideIssuesResult,\n\tIssuesForProjectOptions,\n\tProjectIssuesDrain,\n\tProjectIssuesRequest,\n\tSearchMyIssuesOptions,\n} from '../models/issueReads.js';\nimport { groupProjectIssuesSearches, IssuesIntegration } from '../models/issuesIntegration.js';\nimport { providersMetadata } from './metadata.js';\nimport type { ProviderApiCollectionResult, ProviderIssue } from './models.js';\nimport { fromProviderIssue, toIssueProviderState, toIssueShape, toProviderIssueStates } from './models.js';\nimport { collectProviderPagedResult, mergeCollectionMetadata } from './utils/providerPaging.js';\n\nconst metadata = providersMetadata.asana;\ntype AsanaIntegrationId = typeof metadata.id;\nconst authProvider = Object.freeze({ id: metadata.id, scopes: metadata.scopes });\n/** Long enough to span one tracker read, short enough that a profile change shows on the next. */\nconst recentAccountTTL = 60 * 1000;\n/** The workspace and project discovery backstop: provider-apis pages them 100 at a time, so 2,000 of each. */\nconst maxDiscoveryPages = 20;\n/** The task drain's backstop, per project or per workspace: 1,000 tasks at the SDK's 100-per-page. */\nconst maxTaskPages = 10;\n\n/** An Asana project, naming the workspace it belongs to so its tasks can be encoded and its account resolved. */\nexport interface AsanaProjectDescriptor extends IssueResourceDescriptor {\n\tresourceId: string;\n\tresourceName: string;\n}\n\nexport class AsanaIntegration extends IssuesIntegration<AsanaIntegrationId> {\n\treadonly authProvider: IntegrationAuthenticationProviderDescriptor = authProvider;\n\n\toverride get id(): AsanaIntegrationId {\n\t\treturn metadata.id;\n\t}\n\tprotected override get key(): 'asana' {\n\t\treturn 'asana';\n\t}\n\toverride get name(): string {\n\t\treturn metadata.name;\n\t}\n\toverride get domain(): string {\n\t\treturn metadata.domain;\n\t}\n\n\t/**\n\t * Always asks Asana: the host's current-account cache decides when this runs. An Asana user is the same in every\n\t * workspace, so the answer is lent briefly to the per-workspace lookup a tracker read makes right after it.\n\t */\n\tprotected override async getProviderCurrentAccount(\n\t\tsession: ProviderAuthenticationSession,\n\t): Promise<Account | undefined> {\n\t\tconst account = await this.fetchAccount(session);\n\t\tif (account != null) {\n\t\t\tthis._recentAccounts.set(session.accessToken, Promise.resolve(account));\n\t\t}\n\t\treturn account;\n\t}\n\n\tprotected override getProviderUncachedAccountForResource(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resource: ResourceDescriptor,\n\t): Promise<Account | undefined> {\n\t\treturn this.fetchAccount(session);\n\t}\n\n\tprotected override getProviderAccountForResource(\n\t\tsession: ProviderAuthenticationSession,\n\t\t_resource: ResourceDescriptor,\n\t): Promise<Account | undefined> {\n\t\treturn this._recentAccounts.getOrCreate(session.accessToken, () => this.fetchAccount(session), {\n\t\t\tevictWhen: account => account == null,\n\t\t});\n\t}\n\n\tprotected override clearDiscoveryCaches(): void {\n\t\tthis._recentAccounts.clear();\n\t}\n\n\tprivate readonly _recentAccounts = new PromiseCache<string, Account | undefined>({\n\t\tcapacity: 10,\n\t\tcreateTTL: recentAccountTTL,\n\t});\n\n\tprivate async fetchAccount(session: ProviderAuthenticationSession): Promise<Account | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst user = await api.getAsanaCurrentUser(toTokenWithInfo(this.id, session));\n\t\tif (user == null) return undefined;\n\n\t\treturn {\n\t\t\tprovider: this,\n\t\t\tid: user.id,\n\t\t\tname: user.name ?? undefined,\n\t\t\t// Asana has no usernames; the SDK reports the display name as the handle.\n\t\t\tusername: user.username ?? undefined,\n\t\t\temail: user.email ?? undefined,\n\t\t\tavatarUrl: user.avatarUrl ?? undefined,\n\t\t};\n\t}\n\n\tprotected override async getProviderResourcesForUser(\n\t\tsession: ProviderAuthenticationSession,\n\t): Promise<IssueResourceDescriptor[] | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst tokenWithInfo = toTokenWithInfo(this.id, session);\n\t\tconst workspaces = await collectProviderPagedResult(\n\t\t\tcursor => api.getAsanaWorkspacesForCurrentUser(tokenWithInfo, { cursor: cursor }),\n\t\t\tmaxDiscoveryPages,\n\t\t);\n\t\t// Resource discovery has no completeness to report, so a user past the backstop is logged rather than refused:\n\t\t// the workspaces read still hold their projects.\n\t\tif (workspaces.truncated) {\n\t\t\tLogger.warn(`Asana workspace discovery stopped after ${workspaces.values.length} workspaces`);\n\t\t}\n\t\treturn workspaces.values.map(w => ({ key: w.id, id: w.id, name: w.name }));\n\t}\n\n\tprotected override async getProviderProjectsForResources(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources: ResourceDescriptor[],\n\t): Promise<AsanaProjectDescriptor[] | undefined> {\n\t\treturn (await this.getProviderProjectsForResourcesWithMetadata(session, resources)).values;\n\t}\n\n\t/**\n\t * Each workspace's unarchived projects, drained per workspace. A workspace whose drain failed or ran out of pages\n\t * keeps what it read and is recorded in the metadata, so one large or unreadable workspace doesn't hide the rest.\n\t */\n\tprotected override async getProviderProjectsForResourcesWithMetadata(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources: ResourceDescriptor[],\n\t): Promise<ProviderApiCollectionResult<AsanaProjectDescriptor>> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst tokenWithInfo = toTokenWithInfo(this.id, session);\n\n\t\tconst values: AsanaProjectDescriptor[] = [];\n\t\tlet collectionMetadata: CollectionMetadata | undefined;\n\t\tfor (const workspace of resources.filter(isIssueResourceDescriptor)) {\n\t\t\tconst scope: CollectionScopeFailure['scope'] = { providerId: this.id, resourceId: workspace.id };\n\t\t\tconst projects = await collectProviderPagedResult(\n\t\t\t\tcursor => api.getAsanaProjectsForWorkspace(tokenWithInfo, workspace.id, { cursor: cursor }),\n\t\t\t\tmaxDiscoveryPages,\n\t\t\t\tscope,\n\t\t\t);\n\t\t\tvalues.push(\n\t\t\t\t...projects.values.map(p => ({\n\t\t\t\t\tkey: p.id,\n\t\t\t\t\tid: p.id,\n\t\t\t\t\tname: p.name,\n\t\t\t\t\tresourceId: workspace.id,\n\t\t\t\t\tresourceName: workspace.name,\n\t\t\t\t})),\n\t\t\t);\n\t\t\tcollectionMetadata = mergeCollectionMetadata(\n\t\t\t\tcollectionMetadata,\n\t\t\t\tprojects.truncated && !projects.metadata?.failures?.length\n\t\t\t\t\t? mergeCollectionMetadata(projects.metadata, {\n\t\t\t\t\t\t\tcompleteness: 'partial',\n\t\t\t\t\t\t\tomissions: [{ kind: 'pagination-incomplete', scope: scope }],\n\t\t\t\t\t\t})\n\t\t\t\t\t: projects.metadata,\n\t\t\t);\n\t\t}\n\n\t\treturn collectionMetadata != null ? { values: values, metadata: collectionMetadata } : { values: values };\n\t}\n\n\tprotected override async getProviderIssuesForProject(\n\t\tsession: ProviderAuthenticationSession,\n\t\tproject: ResourceDescriptor,\n\t\toptions?: IssuesForProjectOptions,\n\t): Promise<IssueShape[] | undefined> {\n\t\treturn (await this.getProviderIssuesForProjectWithTruncation(session, project, options))?.values;\n\t}\n\n\t/**\n\t * A project's tasks, narrowed to the viewer's by assignee after the drain: Asana's task list takes a project or\n\t * an assignee, never both. So a user-scoped read of a busy project spends its page budget on other people's\n\t * tasks, and a truncated one can't be recovered by a narrower scope.\n\t */\n\tprotected override async getProviderIssuesForProjectWithTruncation(\n\t\tsession: ProviderAuthenticationSession,\n\t\tproject: ResourceDescriptor,\n\t\toptions?: IssuesForProjectOptions,\n\t): Promise<ProjectIssuesDrain | undefined> {\n\t\tif (!isAsanaProjectDescriptor(project)) return undefined;\n\n\t\tlet viewerId: string | undefined;\n\t\tif (options?.user != null) {\n\t\t\tviewerId = options.userId ?? (await this.getProviderAccountForResource(session, project))?.id;\n\t\t\t// Without the viewer the read can't be scoped to \"my issues\": the unfiltered project would leak everyone\n\t\t\t// else's tasks, and an empty list would read as \"nothing assigned to me\".\n\t\t\tif (viewerId == null) {\n\t\t\t\tthrow new IntegrationReadUnavailableError(\n\t\t\t\t\tmetadata.name,\n\t\t\t\t\t'could not resolve the current user to scope issues to',\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst drain = await this.drainTasks(session, { projectId: project.id }, options, {\n\t\t\tproviderId: this.id,\n\t\t\tresourceId: project.resourceId,\n\t\t\tprojectId: project.id,\n\t\t});\n\n\t\tconst issueProject = toIssueProject(project);\n\t\tconst values = drain.values.flatMap(issue => {\n\t\t\tif (viewerId != null && !issue.assignees.some(a => a.id === viewerId)) return [];\n\n\t\t\tconst shape = toIssueShape(issue, this, { projection: 'project' });\n\t\t\treturn shape == null ? [] : [{ ...shape, project: issueProject } satisfies IssueShape];\n\t\t});\n\n\t\treturn drain.truncated\n\t\t\t? { values: values, truncated: true, recovery: 'none', metadata: drain.metadata }\n\t\t\t: { values: values, truncated: false, metadata: drain.metadata };\n\t}\n\n\t/**\n\t * Searches every project of one workspace together when the read is scoped to the viewer: Asana's \"my tasks\" read\n\t * takes the workspace and the assignee, so one drain answers all of them, where reading project by project would\n\t * drain every task of every project only to keep the viewer's.\n\t */\n\tprotected override getProjectIssuesSearches(\n\t\trequests: readonly ProjectIssuesRequest<ResourceDescriptor>[],\n\t): number[][] | undefined {\n\t\treturn groupProjectIssuesSearches(requests, ({ project, options }) =>\n\t\t\toptions.user != null && isAsanaProjectDescriptor(project)\n\t\t\t\t? [\n\t\t\t\t\t\tproject.resourceId,\n\t\t\t\t\t\toptions.user,\n\t\t\t\t\t\toptions.userId ?? '',\n\t\t\t\t\t\toptions.sort ?? '',\n\t\t\t\t\t\toptions.state ?? '',\n\t\t\t\t\t\toptions.filters?.join(',') ?? '',\n\t\t\t\t\t].join('\\0')\n\t\t\t\t: undefined,\n\t\t);\n\t}\n\n\t/**\n\t * The viewer's tasks in one workspace, split into the requested projects. A task outside them (in another project,\n\t * or in none, only in the user's My Tasks) belongs to no project of this read and is left out.\n\t *\n\t * A task can be in several projects (a sprint board and each customer's own board, say), and an unscoped task read\n\t * reports only the first one Asana lists as its `project`. So it is filed under every requested project among its\n\t * memberships (`projectMemberships`), with its section in that project as its state, as the per-project fallback\n\t * would list it.\n\t */\n\tprotected override async searchProviderProjectIssues(\n\t\tsession: ProviderAuthenticationSession,\n\t\trequests: readonly ProjectIssuesRequest<ResourceDescriptor>[],\n\t): Promise<IssueShape[][] | undefined> {\n\t\tconst projects = requests.map(request => request.project).filter(isAsanaProjectDescriptor);\n\t\tif (projects.length !== requests.length) return undefined;\n\n\t\t// Every request of a search shares the workspace and every option read here (see `getProjectIssuesSearches`).\n\t\tconst { options } = requests[0];\n\t\tconst drain = await this.drainTasks(\n\t\t\tsession,\n\t\t\t{ workspaceId: projects[0].resourceId },\n\t\t\toptions,\n\t\t\t// Never published: an incomplete search is read again project by project, which records its own failures.\n\t\t\t{ providerId: this.id, resourceId: projects[0].resourceId },\n\t\t);\n\t\t// An incomplete search says nothing about which of its projects it covered, so only the per-project reads can\n\t\t// report each one's completeness.\n\t\tif (drain.truncated || (drain.metadata != null && drain.metadata.completeness !== 'complete')) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst indexById = new Map(projects.map((project, index) => [project.id, index]));\n\t\tconst split = projects.map((): IssueShape[] => []);\n\t\tfor (const task of drain.values) {\n\t\t\tconst shape = toIssueShape(task, this, { projection: 'project' });\n\t\t\tif (shape == null) continue;\n\n\t\t\t// Only the section differs between a task's projects: whether it is closed is the task's own.\n\t\t\tfor (const { index, state } of toRequestedProjectPlacements(task, indexById)) {\n\t\t\t\tsplit[index].push({\n\t\t\t\t\t...shape,\n\t\t\t\t\tproject: toIssueProject(projects[index]),\n\t\t\t\t\tproviderState: toIssueProviderState(state),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn split;\n\t}\n\n\tprotected override async searchProviderMyIssues(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources?: ResourceDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<IssueShape[] | undefined> {\n\t\treturn (await this.searchProviderMyIssuesWithTruncation(session, resources, cancellation))?.values;\n\t}\n\n\t/**\n\t * The tasks assigned to the viewer, one drain per workspace (Asana requires the workspace alongside the\n\t * assignee). Reads every workspace the user belongs to unless `resources` names some. A workspace that can't be\n\t * read is recorded in the metadata and the others are still returned; only when none could be read does the read\n\t * throw. Cancellation stops between workspaces and is not reported as truncation: the caller asked for the read to\n\t * stop.\n\t */\n\tprotected override async searchProviderMyIssuesWithTruncation(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources?: ResourceDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t\toptions?: SearchMyIssuesOptions,\n\t): Promise<AccountWideIssuesResult | undefined> {\n\t\tconst workspaces = (resources ?? (await this.getProviderResourcesForUser(session)) ?? []).filter(\n\t\t\tisIssueResourceDescriptor,\n\t\t);\n\n\t\tconst values: IssueShape[] = [];\n\t\tlet truncated = false;\n\t\tlet collectionMetadata: CollectionMetadata | undefined;\n\t\tlet firstError: Error | undefined;\n\t\tlet workspacesRead = 0;\n\t\tfor (const workspace of workspaces) {\n\t\t\tif (cancellation?.aborted) break;\n\n\t\t\tconst scope: CollectionScopeFailure['scope'] = { providerId: this.id, resourceId: workspace.id };\n\t\t\tlet drain: Awaited<ReturnType<AsanaIntegration['drainTasks']>>;\n\t\t\ttry {\n\t\t\t\tdrain = await this.drainTasks(session, { workspaceId: workspace.id }, options, scope);\n\t\t\t} catch (ex) {\n\t\t\t\tif (isCancellationError(ex)) throw ex;\n\n\t\t\t\tthrowIfCallerContractError(ex);\n\n\t\t\t\tfirstError ??= toError(ex);\n\t\t\t\ttruncated = true;\n\t\t\t\tcollectionMetadata = mergeCollectionMetadata(collectionMetadata, {\n\t\t\t\t\tcompleteness: 'partial',\n\t\t\t\t\tfailures: [toCollectionScopeFailure(scope, ex)],\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tworkspacesRead++;\n\t\t\ttruncated ||= drain.truncated;\n\t\t\tcollectionMetadata = mergeCollectionMetadata(collectionMetadata, drain.metadata);\n\t\t\tfor (const issue of drain.values) {\n\t\t\t\tconst shape = toIssueShape(issue, this, { projection: 'account' });\n\t\t\t\tif (shape != null) {\n\t\t\t\t\tvalues.push({ ...shape, project: toAsanaIssueProject(issue, workspace) });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Every workspace failed: an empty \"my issues\" would read as \"nothing assigned to me\".\n\t\tif (workspacesRead === 0 && firstError != null) throw firstError;\n\n\t\treturn { values: values, truncated: truncated, metadata: collectionMetadata };\n\t}\n\n\t/**\n\t * Follows a task read's cursor up to {@link maxTaskPages}. `truncated` is set when the backstop stopped it with\n\t * pages left, or when a page after the first failed (recorded under `scope`, keeping the prefix). A failure on the\n\t * first page throws, so the caller sees an error rather than an empty success.\n\t */\n\tprivate async drainTasks(\n\t\tsession: ProviderAuthenticationSession,\n\t\tread: { projectId: string } | { workspaceId: string },\n\t\toptions: Pick<IssuesForProjectOptions, 'state' | 'sort'> | undefined,\n\t\tscope: CollectionScopeFailure['scope'],\n\t): Promise<{ values: ProviderIssue[]; truncated: boolean; metadata?: CollectionMetadata }> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst tokenWithInfo = toTokenWithInfo(this.id, session);\n\t\tconst states = toProviderIssueStates(options?.state);\n\t\tlet pagesRead = 0;\n\t\tlet firstPageError: Error | undefined;\n\t\tconst drain = await collectProviderPagedResult(\n\t\t\tasync cursor => {\n\t\t\t\tconst pageOptions = { cursor: cursor, states: states, sort: options?.sort };\n\t\t\t\ttry {\n\t\t\t\t\tconst page = await ('projectId' in read\n\t\t\t\t\t\t? api.getAsanaIssuesForProject(tokenWithInfo, read.projectId, pageOptions)\n\t\t\t\t\t\t: api.getAsanaIssuesForCurrentUser(tokenWithInfo, read.workspaceId, pageOptions));\n\t\t\t\t\tpagesRead++;\n\t\t\t\t\treturn page;\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tif (pagesRead === 0) {\n\t\t\t\t\t\tfirstPageError = toError(ex);\n\t\t\t\t\t}\n\t\t\t\t\tthrow ex;\n\t\t\t\t}\n\t\t\t},\n\t\t\tmaxTaskPages,\n\t\t\tscope,\n\t\t);\n\t\tif (firstPageError != null) throw firstPageError;\n\n\t\treturn { values: drain.values, truncated: drain.truncated === true, metadata: drain.metadata };\n\t}\n\n\tprotected override getProviderLinkedIssueOrPullRequest(\n\t\t_session: ProviderAuthenticationSession,\n\t\t_resource: ResourceDescriptor,\n\t\t_id: { id: string; key: string },\n\t\t_type: undefined | IssueOrPullRequestType,\n\t): Promise<IssueOrPullRequest | undefined> {\n\t\t// Asana task references are gids in a permalink URL, never a short key a commit message would carry.\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\t/** `resource` is the task's workspace; `id` is the task gid, which is also what an Asana issue reports as its id. */\n\tprotected override async getProviderIssue(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresource: ResourceDescriptor,\n\t\tid: string,\n\t): Promise<Issue | undefined> {\n\t\tif (!isIssueResourceDescriptor(resource)) return undefined;\n\n\t\tconst api = await this.getProvidersApi();\n\t\tconst issue = await api.getAsanaIssue(toTokenWithInfo(this.id, session), id);\n\t\treturn issue != null\n\t\t\t? fromProviderIssue(issue, this, { projection: 'point', project: toAsanaIssueProject(issue, resource) })\n\t\t\t: undefined;\n\t}\n}\n\nfunction isAsanaProjectDescriptor(project: ResourceDescriptor): project is AsanaProjectDescriptor {\n\treturn isIssueResourceDescriptor(project) && typeof project.resourceId === 'string';\n}\n\n/**\n * Each requested project a task is in, by its index in the read, with the task's state as that project would list it:\n * its section there, since the unscoped read reports the first membership's.\n */\nfunction toRequestedProjectPlacements(\n\tissue: ProviderIssue,\n\tindexById: ReadonlyMap<string, number>,\n): { index: number; state: ProviderIssue['state'] }[] {\n\tconst memberships = issue.projectMemberships;\n\tif (memberships == null) {\n\t\tconst index = issue.project?.id != null ? indexById.get(issue.project.id) : undefined;\n\t\treturn index != null ? [{ index: index, state: issue.state }] : [];\n\t}\n\n\tconst placements: { index: number; state: ProviderIssue['state'] }[] = [];\n\tfor (const membership of memberships) {\n\t\tconst index = indexById.get(membership.project.id);\n\t\tif (index == null || placements.some(p => p.index === index)) continue;\n\n\t\tplacements.push({ index: index, state: getProjectMembershipState(issue, membership) });\n\t}\n\treturn placements;\n}\n\n/**\n * Mirrors provider-apis' state for a task read scoped to the membership's project; the parity test in `asana.test.ts`\n * runs both through provider-apis' own normalization to keep them agreeing.\n */\nfunction getProjectMembershipState(issue: ProviderIssue, membership: IssueProjectMembership): ProviderIssue['state'] {\n\tif (issue.project?.id === membership.project.id) return issue.state;\n\n\tconst completed = issue.closedDate != null;\n\tif (membership.section != null) {\n\t\treturn {\n\t\t\tid: membership.section.id,\n\t\t\tname: membership.section.name,\n\t\t\tcolor: null,\n\t\t\t...(completed ? { category: 'DONE' as const } : {}),\n\t\t};\n\t}\n\treturn completed ? { name: 'Completed', color: null, category: 'DONE' } : null;\n}\n\nfunction toIssueProject(project: AsanaProjectDescriptor): IssueProject {\n\treturn { id: project.id, name: project.name, resourceId: project.resourceId, resourceName: project.resourceName };\n}\n\n/**\n * The project an issue read outside a project reports. An Asana issue entity identifier is keyed by the task's\n * workspace, which the SDK reports beside the project rather than in it, so this always names the workspace as the\n * resource. A task in no project (only in someone's My Tasks) reports the workspace as its project too, so its\n * branch associations stay round-trippable.\n */\nfunction toAsanaIssueProject(issue: ProviderIssue, workspace: IssueResourceDescriptor): IssueProject {\n\tconst resourceId = issue.workspaceId ?? workspace.id;\n\tconst resourceName = resourceId === workspace.id ? workspace.name : '';\n\treturn issue.project?.id != null\n\t\t? { id: issue.project.id, name: issue.project.name, resourceId: resourceId, resourceName: resourceName }\n\t\t: { id: resourceId, name: resourceName, resourceId: resourceId, resourceName: resourceName };\n}\n"],"mappings":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GAAO,OAAO,0BAA0B,OAAO,UAAU;EAAE,CAAC;CACtF;CACA,OAAO;AACR;;;;;AAMA,SAAS,0BAA0B,OAAsB,YAA4D;CACpH,IAAI,MAAM,SAAS,OAAO,WAAW,QAAQ,IAAI,OAAO,MAAM;CAE9D,MAAM,YAAY,MAAM,cAAc;CACtC,IAAI,WAAW,WAAW,MACzB,OAAO;EACN,IAAI,WAAW,QAAQ;EACvB,MAAM,WAAW,QAAQ;EACzB,OAAO;EACP,GAAI,YAAY,EAAE,UAAU,OAAgB,IAAI,CAAC;CAClD;CAED,OAAO,YAAY;EAAE,MAAM;EAAa,OAAO;EAAM,UAAU;CAAO,IAAI;AAC3E;AAEA,SAAS,eAAe,SAA+C;CACtE,OAAO;EAAE,IAAI,QAAQ;EAAI,MAAM,QAAQ;EAAM,YAAY,QAAQ;EAAY,cAAc,QAAQ;CAAa;AACjH;;;;;;;AAQA,SAAS,oBAAoB,OAAsB,WAAkD;CACpG,MAAM,aAAa,MAAM,eAAe,UAAU;CAClD,MAAM,eAAe,eAAe,UAAU,KAAK,UAAU,OAAO;CACpE,OAAO,MAAM,SAAS,MAAM,OACzB;EAAE,IAAI,MAAM,QAAQ;EAAI,MAAM,MAAM,QAAQ;EAAkB;EAA0B;CAAa,IACrG;EAAE,IAAI;EAAY,MAAM;EAA0B;EAA0B;CAAa;AAC7F"}
|
|
@@ -7,12 +7,12 @@ import { UnidentifiedAuthor } from "../../../../git/models/author.js";
|
|
|
7
7
|
import { DefaultBranch } from "../../../../git/models/defaultBranch.js";
|
|
8
8
|
import { RepositoryMetadata } from "../../../../git/models/repositoryMetadata.js";
|
|
9
9
|
import { TokenWithInfo } from "../../authentication/models.js";
|
|
10
|
+
import { IntegrationServiceContext } from "../../context.js";
|
|
10
11
|
import { AzureProjectDescriptor, AzureWorkItemStateCategory } from "./models.js";
|
|
11
12
|
import { AzureWorkItemStatesCache } from "./workItemStateCategories.js";
|
|
12
13
|
import { AzureWorkItemDescriptionsCache } from "./workItemDescriptions.js";
|
|
13
14
|
import { ProviderIssueSearchPage } from "../../models/issueReads.js";
|
|
14
15
|
import { ProviderApiConfig } from "../apiConfig.js";
|
|
15
|
-
import { IntegrationServiceContext } from "../../context.js";
|
|
16
16
|
//#region ../plus/integrations/src/providers/azure/azure.d.ts
|
|
17
17
|
type WorkItemSearchOptions = {
|
|
18
18
|
baseUrl: string;
|
|
@@ -7,9 +7,9 @@ import { trace } from "../../../../utils/decorators/log.js";
|
|
|
7
7
|
import { PromiseCache } from "../../../../utils/promiseCache.js";
|
|
8
8
|
import __decorate from "../../../../_virtual/@oxc-project+runtime/helpers/esm/decorate.js";
|
|
9
9
|
import { AuthenticationError, RequestClientError, RequestNotFoundError, RequestRateLimitError, getDeferredRequestFailure, reportRequestFailure } from "../../../../git/errors.js";
|
|
10
|
+
import { sha256, uuid } from "../../../../utils/crypto.js";
|
|
10
11
|
import { maybeStopWatch } from "../../../../utils/stopwatch.js";
|
|
11
12
|
import { base64 } from "../../../../utils/base64.js";
|
|
12
|
-
import { sha256, uuid } from "../../../../utils/crypto.js";
|
|
13
13
|
import { effectiveIssueSort } from "../../../../git/utils/issue.utils.js";
|
|
14
14
|
import { ProviderFetchError, isRateLimitResponse, toRateLimitError } from "../../errors.js";
|
|
15
15
|
import { CommitReadRefusedError, isCommitReadRefusal, isNotFoundResponse, throwProviderError } from "../providerErrors.js";
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { PullRequestUrlIdentity } from "../../../../git/utils/pullRequest.utils.js";
|
|
2
2
|
import { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId } from "../../constants.js";
|
|
3
|
-
import { AzureRepositoryDescriptor } from "./models.js";
|
|
4
3
|
//#region ../plus/integrations/src/providers/azure/azure.utils.d.ts
|
|
5
4
|
export type AzureDevOpsIntegrationIds = GitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer;
|
|
6
|
-
/**
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The project and repository an Azure repository descriptor names, its `{project}/_git/{repo}` name parsed. Takes the
|
|
7
|
+
* descriptor structurally rather than as `AzureRepositoryDescriptor`, so the facade can export it without its
|
|
8
|
+
* declaration reaching the provider models.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getAzureRepositoryIdentity(repo: {
|
|
11
|
+
owner: string;
|
|
12
|
+
name: string;
|
|
13
|
+
project?: string;
|
|
14
|
+
}): {
|
|
8
15
|
resourceName: string;
|
|
9
16
|
projectName?: string;
|
|
10
17
|
repositoryName: string;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { isVsts, parseAzureHttpsUrl } from "../../../../git/remotes/azure-devops.js";
|
|
2
2
|
import { decodePathSegment } from "../../utils/domain.utils.js";
|
|
3
3
|
//#region ../plus/integrations/src/providers/azure/azure.utils.ts
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* The project and repository an Azure repository descriptor names, its `{project}/_git/{repo}` name parsed. Takes the
|
|
6
|
+
* descriptor structurally rather than as `AzureRepositoryDescriptor`, so the facade can export it without its
|
|
7
|
+
* declaration reaching the provider models.
|
|
8
|
+
*/
|
|
5
9
|
function getAzureRepositoryIdentity(repo) {
|
|
6
10
|
const match = /^([^/]+)\/_git\/([^/]+)$/i.exec(repo.name);
|
|
7
11
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"azure.utils.js","names":[],"sources":["../../../../../../plus/integrations/src/providers/azure/azure.utils.ts"],"sourcesContent":["import { isVsts, parseAzureHttpsUrl } from '@gitlens/git/remotes/azure-devops.js';\nimport type { PullRequestUrlIdentity } from '@gitlens/git/utils/pullRequest.utils.js';\nimport type { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId } from '../../constants.js';\nimport { decodePathSegment } from '../../utils/domain.utils.js';\
|
|
1
|
+
{"version":3,"file":"azure.utils.js","names":[],"sources":["../../../../../../plus/integrations/src/providers/azure/azure.utils.ts"],"sourcesContent":["import { isVsts, parseAzureHttpsUrl } from '@gitlens/git/remotes/azure-devops.js';\nimport type { PullRequestUrlIdentity } from '@gitlens/git/utils/pullRequest.utils.js';\nimport type { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId } from '../../constants.js';\nimport { decodePathSegment } from '../../utils/domain.utils.js';\n\nexport type AzureDevOpsIntegrationIds =\n\t| GitCloudHostIntegrationId.AzureDevOps\n\t| GitSelfManagedHostIntegrationId.AzureDevOpsServer;\n\n/**\n * The project and repository an Azure repository descriptor names, its `{project}/_git/{repo}` name parsed. Takes the\n * descriptor structurally rather than as `AzureRepositoryDescriptor`, so the facade can export it without its\n * declaration reaching the provider models.\n */\nexport function getAzureRepositoryIdentity(repo: { owner: string; name: string; project?: string }): {\n\tresourceName: string;\n\tprojectName?: string;\n\trepositoryName: string;\n} {\n\tconst match = /^([^/]+)\\/_git\\/([^/]+)$/i.exec(repo.name);\n\treturn {\n\t\tresourceName: repo.owner,\n\t\tprojectName: repo.project ?? match?.[1],\n\t\trepositoryName: match?.[2] ?? repo.name,\n\t};\n}\n\n/**\n * Decodes one segment of an address path as a virtual directory names it: an encoded `/` stays encoded, so the segment\n * stays one segment of the `/`-joined directory.\n */\nexport function decodeAzurePathSegment(segment: string): string {\n\treturn decodePathSegment(segment.replace(/%2F/gi, '%252F'));\n}\n\nexport function getAzurePullRequestIdentityFromMaybeUrl(\n\tsearch: string,\n): (PullRequestUrlIdentity & { provider: undefined }) | undefined;\nexport function getAzurePullRequestIdentityFromMaybeUrl(\n\tsearch: string,\n\tid: AzureDevOpsIntegrationIds,\n): (PullRequestUrlIdentity & { provider: AzureDevOpsIntegrationIds }) | undefined;\n/**\n * Parses a pasted Azure DevOps pull request URL (`…/_git/{repo}/pullrequest/{id}`) into `{org}/{project}`:\n * - dev.azure.com and `{org}.visualstudio.com`, read by the remote's own parser (`parseAzureHttpsUrl`)\n * - `{collection}/{project}/_git/…` on Server, where a leading virtual directory such as `tfs/` is dropped: the\n * identity has no field for it, so the read relies on the connection's configured URL including it\n * - `{collection}/_git/…` on Server, where the project is named after the repo\n */\nexport function getAzurePullRequestIdentityFromMaybeUrl(\n\tsearch: string,\n\tid?: AzureDevOpsIntegrationIds,\n): (PullRequestUrlIdentity & { provider: AzureDevOpsIntegrationIds | undefined }) | undefined {\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(search);\n\t} catch {\n\t\treturn undefined;\n\t}\n\n\tconst rawSegments = url.pathname.split('/').filter(Boolean);\n\tconst segments = rawSegments.map(decodePathSegment);\n\tconst gitIndex = segments.findIndex(s => s.toLowerCase() === '_git');\n\tif (gitIndex < 0) return undefined;\n\n\tconst repo = segments[gitIndex + 1];\n\tconst prNumber = segments[gitIndex + 3];\n\tif (repo == null || segments[gitIndex + 2] !== 'pullrequest' || prNumber == null) return undefined;\n\n\tlet org: string;\n\tlet project: string;\n\tif (isVsts(url.hostname) || url.hostname.toLowerCase() === 'dev.azure.com') {\n\t\t// A cloud repository URL reads exactly as its remote does (org from the host or the path, the legacy\n\t\t// `DefaultCollection` segment, a project named after its repo), so hand the remote's parser the URL cut after\n\t\t// the repository\n\t\tconst repoUrl = new URL(url.href);\n\t\trepoUrl.pathname = rawSegments.slice(0, gitIndex + 2).join('/');\n\t\ttry {\n\t\t\t[org, project] = parseAzureHttpsUrl(repoUrl);\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t} else {\n\t\tif (gitIndex < 1) return undefined;\n\n\t\torg = gitIndex === 1 ? segments[0] : segments[gitIndex - 2];\n\t\tproject = gitIndex === 1 ? repo : segments[gitIndex - 1];\n\t}\n\n\treturn { ownerAndRepo: `${org}/${project}`, prNumber: prNumber, provider: id };\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,2BAA2B,MAIzC;CACD,MAAM,QAAQ,4BAA4B,KAAK,KAAK,IAAI;CACxD,OAAO;EACN,cAAc,KAAK;EACnB,aAAa,KAAK,WAAW,QAAQ;EACrC,gBAAgB,QAAQ,MAAM,KAAK;CACpC;AACD;;;;;AAMA,SAAgB,uBAAuB,SAAyB;CAC/D,OAAO,kBAAkB,QAAQ,QAAQ,SAAS,OAAO,CAAC;AAC3D;;;;;;;;AAgBA,SAAgB,wCACf,QACA,IAC6F;CAC7F,IAAI;CACJ,IAAI;EACH,MAAM,IAAI,IAAI,MAAM;CACrB,QAAQ;EACP;CACD;CAEA,MAAM,cAAc,IAAI,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO;CAC1D,MAAM,WAAW,YAAY,IAAI,iBAAiB;CAClD,MAAM,WAAW,SAAS,WAAU,MAAK,EAAE,YAAY,MAAM,MAAM;CACnE,IAAI,WAAW,GAAG,OAAO,KAAA;CAEzB,MAAM,OAAO,SAAS,WAAW;CACjC,MAAM,WAAW,SAAS,WAAW;CACrC,IAAI,QAAQ,QAAQ,SAAS,WAAW,OAAO,iBAAiB,YAAY,MAAM,OAAO,KAAA;CAEzF,IAAI;CACJ,IAAI;CACJ,IAAI,OAAO,IAAI,QAAQ,KAAK,IAAI,SAAS,YAAY,MAAM,iBAAiB;EAI3E,MAAM,UAAU,IAAI,IAAI,IAAI,IAAI;EAChC,QAAQ,WAAW,YAAY,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,GAAG;EAC9D,IAAI;GACH,CAAC,KAAK,WAAW,mBAAmB,OAAO;EAC5C,QAAQ;GACP;EACD;CACD,OAAO;EACN,IAAI,WAAW,GAAG,OAAO,KAAA;EAEzB,MAAM,aAAa,IAAI,SAAS,KAAK,SAAS,WAAW;EACzD,UAAU,aAAa,IAAI,OAAO,SAAS,WAAW;CACvD;CAEA,OAAO;EAAE,cAAc,GAAG,IAAI,GAAG;EAAqB;EAAU,UAAU;CAAG;AAC9E"}
|
|
@@ -3,8 +3,8 @@ import { Provider } from "../../../../git/models/remoteProvider.js";
|
|
|
3
3
|
import { IssueOrPullRequestState } from "../../../../git/models/issueOrPullRequest.js";
|
|
4
4
|
import { Issue as Issue$1, IssueProjection, IssueProviderState } from "../../../../git/models/issue.js";
|
|
5
5
|
import { PullRequest, PullRequestMember, PullRequestMergeableState, PullRequestProjection, PullRequestReviewDecision, PullRequestReviewState, PullRequestReviewer } from "../../../../git/models/pullRequest.js";
|
|
6
|
+
import { IssueEtagFields, PullRequestEtagFields, PullRequestEtagInclude } from "../../reads/etag.js";
|
|
6
7
|
import { ProviderIssue } from "../models.js";
|
|
7
|
-
import { IssueEtagFields, PullRequestEtagFields, PullRequestEtagInclude } from "../../models/integration.js";
|
|
8
8
|
import { AzureWorkItemHtmlField } from "@gitkraken/provider-apis";
|
|
9
9
|
//#region ../plus/integrations/src/providers/azure/models.d.ts
|
|
10
10
|
export declare const vstsHostnameSuffix = ".visualstudio.com";
|
|
@@ -34,10 +34,6 @@ export interface AzureRemoteRepositoryDescriptor extends ResourceDescriptor {
|
|
|
34
34
|
cloneUrlHttps?: string;
|
|
35
35
|
cloneUrlSsh?: string;
|
|
36
36
|
}
|
|
37
|
-
export interface AzureProjectInputDescriptor extends ResourceDescriptor {
|
|
38
|
-
owner: string;
|
|
39
|
-
name: string;
|
|
40
|
-
}
|
|
41
37
|
export type AzureWorkItemStateCategory = 'Proposed' | 'InProgress' | 'Resolved' | 'Completed' | 'Removed';
|
|
42
38
|
/**
|
|
43
39
|
* The workflow category of an Azure DevOps state category, as a work item type's states endpoint reports it:
|
|
@@ -4,7 +4,7 @@ import { PullRequest } from "../../../../git/models/pullRequest.js";
|
|
|
4
4
|
import { isTerminalIssueStateCategory } from "../../../../git/utils/issue.utils.js";
|
|
5
5
|
import { decideProviderReviewDecision, fromPullRequestReviewDecision, toCompletedReviews, toReviewRequests } from "../pullRequestReviews.js";
|
|
6
6
|
import { GitPullRequestMergeableState as GitPullRequestMergeableState$1, GitPullRequestReviewState as GitPullRequestReviewState$1, GitPullRequestState as GitPullRequestState$1, fromProviderPullRequestMergeableState, fromProviderPullRequestState, toIssueBodyField, toIssueViewer } from "../models.js";
|
|
7
|
-
import { pullRequestRevision } from "../../
|
|
7
|
+
import { pullRequestRevision } from "../../reads/etag.js";
|
|
8
8
|
import { copyReadProvenance } from "@gitkraken/provider-apis/read-provenance";
|
|
9
9
|
import { getAzureWorkItemDescription } from "@gitkraken/provider-apis";
|
|
10
10
|
//#region ../plus/integrations/src/providers/azure/models.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","names":["Issue","GitPullRequestState","GitPullRequestMergeableState","GitPullRequestReviewState"],"sources":["../../../../../../plus/integrations/src/providers/azure/models.ts"],"sourcesContent":["import type { AzureWorkItemHtmlField } from '@gitkraken/provider-apis';\nimport { getAzureWorkItemDescription } from '@gitkraken/provider-apis';\nimport { copyReadProvenance } from '@gitkraken/provider-apis/read-provenance';\nimport type { IssueIteration, IssueMember, IssueProjection, IssueProviderState } from '@gitlens/git/models/issue.js';\nimport { Issue } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequestState } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { PullRequestMember, PullRequestProjection, PullRequestReviewer } from '@gitlens/git/models/pullRequest.js';\nimport {\n\tPullRequest,\n\tPullRequestMergeableState,\n\tPullRequestReviewDecision,\n\tPullRequestReviewState,\n} from '@gitlens/git/models/pullRequest.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport { isTerminalIssueStateCategory } from '@gitlens/git/utils/issue.utils.js';\nimport { trimTrailingSlashes } from '@gitlens/utils/path.js';\nimport type { IssueEtagFields, PullRequestEtagFields, PullRequestEtagInclude } from '../../models/integration.js';\nimport {\n\tazureWorkItemDescriptionRule,\n\tazureWorkItemViewerRule,\n\tpullRequestRevision,\n} from '../../models/integration.js';\nimport type { ProviderAccount, ProviderIssue } from '../models.js';\nimport {\n\tfromProviderPullRequestMergeableState,\n\tfromProviderPullRequestState,\n\tGitPullRequestMergeableState,\n\tGitPullRequestReviewState,\n\tGitPullRequestState,\n\ttoIssueBodyField,\n\ttoIssueViewer,\n} from '../models.js';\nimport type { ProviderPullRequestReview } from '../pullRequestReviews.js';\nimport {\n\tdecideProviderReviewDecision,\n\tfromPullRequestReviewDecision,\n\ttoCompletedReviews,\n\ttoReviewRequests,\n} from '../pullRequestReviews.js';\n\nexport const vstsHostnameSuffix = '.visualstudio.com';\n\nexport interface AzureRepositoryDescriptor extends ResourceDescriptor {\n\towner: string;\n\tname: string;\n\tproject?: string;\n\tvirtualDirectory?: string;\n}\n\nexport interface AzureOrganizationDescriptor extends ResourceDescriptor {\n\tid: string;\n\tname: string;\n}\n\nexport interface AzureProjectDescriptor extends ResourceDescriptor {\n\tid: string;\n\tname: string;\n\tresourceId: string;\n\tresourceName: string;\n}\n\nexport interface AzureRemoteRepositoryDescriptor extends ResourceDescriptor {\n\tid: string;\n\tnodeId?: string;\n\tresourceName: string;\n\tname: string;\n\tprojectName?: string;\n\turl?: string;\n\tcloneUrlHttps?: string;\n\tcloneUrlSsh?: string;\n}\n\nexport interface AzureProjectInputDescriptor extends ResourceDescriptor {\n\towner: string;\n\tname: string;\n}\n\nexport type AzureWorkItemStateCategory = 'Proposed' | 'InProgress' | 'Resolved' | 'Completed' | 'Removed';\n\n/**\n * The workflow category of an Azure DevOps state category, as a work item type's states endpoint reports it:\n * `Removed` is abandoned work, so `CANCELED`, kept apart from the `DONE` of `Completed` and `Resolved`.\n * `undefined` for a category Azure doesn't document, which then neither opens nor closes the work item.\n */\nexport function azureIssueStateCategory(\n\tcategory: AzureWorkItemStateCategory | undefined,\n): IssueProviderState['category'] {\n\tswitch (category) {\n\t\tcase 'Removed':\n\t\t\treturn 'CANCELED';\n\t\tcase 'Completed':\n\t\tcase 'Resolved':\n\t\t\treturn 'DONE';\n\t\tcase 'InProgress':\n\t\t\treturn 'IN_PROGRESS';\n\t\tcase 'Proposed':\n\t\t\treturn 'TO_DO';\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\nexport function isClosedAzureWorkItemStateCategory(category: AzureWorkItemStateCategory | undefined): boolean {\n\treturn isTerminalIssueStateCategory(azureIssueStateCategory(category));\n}\n\nexport function azureWorkItemsStateCategoryToState(\n\tcategory: AzureWorkItemStateCategory | undefined,\n\tclosedDate?: Date,\n): IssueOrPullRequestState | undefined {\n\tif (azureIssueStateCategory(category) != null) {\n\t\treturn isClosedAzureWorkItemStateCategory(category) ? 'closed' : 'opened';\n\t}\n\n\treturn closedDate != null ? 'closed' : undefined;\n}\n\nexport interface AzureLink {\n\thref: string;\n}\n\nexport interface AzureUser {\n\tdisplayName: string;\n\turl: string;\n\t_links: {\n\t\tavatar: AzureLink;\n\t};\n\tid: string;\n\tuniqueName: string;\n\timageUrl: string;\n\tdescriptor?: string;\n}\n\nexport interface AzureUserWithVote extends AzureUser {\n\tisFlagged?: boolean;\n\thasDeclined?: boolean;\n\tisReapprove?: boolean;\n\tisRequired?: boolean;\n\tvote?: AzurePullRequestVote;\n}\n\nexport type AzurePullRequestVote =\n\t| 10 // approved\n\t| 5 // approved with suggestions\n\t| 0 // no vote\n\t| -5 // waiting for author\n\t| -10; // rejected\n\nexport interface AzureWorkItemCommentVersionRef {\n\tcommentId: number;\n\tcreatedInRevision: number;\n\tisDeleted: boolean;\n\ttext: string;\n\turl: string;\n\tversion: number;\n}\n\nexport interface AzureWorkItemRelation {\n\tattributes: {\n\t\t[key: string]: string;\n\t};\n\trelation: string;\n\turl: string;\n}\n\nexport interface WorkItem {\n\t_links: {\n\t\tfields: AzureLink;\n\t\thtml: AzureLink;\n\t\tself: AzureLink;\n\t\tworkItemComments: AzureLink;\n\t\tworkItemRevisions: AzureLink;\n\t\tworkItemType: AzureLink;\n\t\tworkItemUpdates: AzureLink;\n\t};\n\tfields: {\n\t\t//'System.AreaPath': string;\n\t\t'System.TeamProject': string;\n\t\t'System.IterationPath'?: string;\n\t\t'System.WorkItemType': string;\n\t\t'System.State': string;\n\t\t// 'System.Reason': string;\n\t\t'System.AssignedTo': AzureUser | string;\n\t\t'System.CreatedDate': string;\n\t\t'System.CreatedBy': AzureUser | string;\n\t\t'System.ChangedDate': string;\n\t\t'System.ChangedBy': AzureUser;\n\t\t'System.CommentCount': number;\n\t\t'System.Description': string;\n\t\t'System.Title': string;\n\t\t'Microsoft.VSTS.Common.ClosedDate': string;\n\t\t// 'Microsoft.VSTS.Common.StateChangeDate': string;\n\t\t// 'Microsoft.VSTS.Common.Priority': number;\n\t\t// 'Microsoft.VSTS.Common.Severity': string;\n\t\t// 'Microsoft.VSTS.Common.ValueArea': string;\n\t};\n\tid: number;\n\trev: number;\n\turl: string;\n\tcommentVersionRef?: AzureWorkItemCommentVersionRef;\n\trelations?: AzureWorkItemRelation[];\n}\n\nexport interface AzureWorkItemState {\n\tname: string;\n\tcolor: string;\n\tcategory: AzureWorkItemStateCategory;\n}\n\nexport type AzurePullRequestStatus = 'abandoned' | 'active' | 'completed' | 'notSet';\nexport function azurePullRequestStatusToState(status: AzurePullRequestStatus): IssueOrPullRequestState {\n\tswitch (status) {\n\t\tcase 'abandoned':\n\t\t\treturn 'closed';\n\t\tcase 'completed':\n\t\t\treturn 'merged';\n\t\tcase 'active':\n\t\tcase 'notSet':\n\t\tdefault:\n\t\t\treturn 'opened';\n\t}\n}\nexport function isClosedAzurePullRequestStatus(status: AzurePullRequestStatus): boolean {\n\treturn azurePullRequestStatusToState(status) !== 'opened';\n}\n\nexport type AzureProjectState = 'createPending' | 'deleted' | 'deleting' | 'new' | 'unchanged' | 'wellFormed';\nexport type AzureProjectVisibility = 'private' | 'public';\n\nexport interface AzureProject {\n\tid: string;\n\tname: string;\n\turl: string;\n\tstate: AzureProjectState;\n\trevision: number;\n\tvisibility: AzureProjectVisibility;\n\tlastUpdateTime: string;\n}\n\nexport interface AzureRepositoryReference {\n\tid: string;\n\tname: string;\n\turl: string;\n\tremoteUrl?: string;\n}\n\nexport interface AzureRepository extends AzureRepositoryReference {\n\tproject: AzureProject;\n\tsize: number;\n\tremoteUrl: string;\n\tsshUrl: string;\n\twebUrl: string;\n\tisDisabled: boolean;\n\tisInMaintenance: boolean;\n}\n\nexport interface AzurePullRequestRepository extends AzureRepositoryReference {\n\tproject: Pick<AzureProject, 'id' | 'name'>;\n}\n\n/** The URL fields of a repository response — all the fork lookup reads, and all an older `api-version` promises. */\nexport type AzureRepositoryUrls = Partial<Pick<AzureRepository, 'webUrl' | 'remoteUrl'>>;\n\n/** The `GET .../_apis/git/repositories/{repositoryId or name}` response, adding fork/default-branch fields to {@link AzureRepository}. */\nexport interface AzureRepositoryWithMetadata extends AzureRepository {\n\t/** Fully-qualified ref, e.g. `refs/heads/main`. */\n\tdefaultBranch?: string;\n\tisFork?: boolean;\n\tparentRepository?: {\n\t\tid: string;\n\t\tname?: string;\n\t\tproject?: { id: string; name: string };\n\t};\n}\n\nexport interface AzureGitUser {\n\tdate?: string;\n\temail?: string;\n\timageUrl?: string;\n\tname: string;\n}\n\nexport interface AzureGitCommitRef {\n\tcommitId: string;\n\turl: string;\n}\n\nexport interface AzureGitCommit {\n\t_links: {\n\t\tchanges: AzureLink;\n\t\trepository: AzureLink;\n\t\tself: AzureLink;\n\t\tweb: AzureLink;\n\t};\n\tauthor: AzureGitUser;\n\tcomment: string;\n\tcommentTruncated?: boolean;\n\tcommitId: string;\n\tcommitTooManyChanges?: boolean;\n\tcommitter: AzureGitUser;\n\tparents: string[];\n\tpush: {\n\t\tdate: string;\n\t\tpushedBy: AzureUser;\n\t\tpushId: number;\n\t};\n\tremoteUrl: string;\n\tstatuses?: AzureGitStatus[];\n\ttreeId: string;\n\turl: string;\n\tworkItems?: AzureResourceRef[];\n}\n\nexport interface AzureResourceRef {\n\tid: string;\n\turl: string;\n}\n\nexport interface AzurePullRequestCompletionOptions {\n\tautoCompleteIgnoreConflicts: number[];\n\tbypassPolicy: boolean;\n\tbypassReason: string;\n\tdeleteSourceBranch: boolean;\n\tmergeCommitMessage: string;\n\tmergeStrategy: 'noFastForward' | 'rebase' | 'rebaseMerge' | 'squash';\n\tsquashMerge: boolean;\n\ttransitionWorkItems: boolean;\n\ttriggeredByAutoComplete: boolean;\n}\n\nexport interface AzureGitStatus {\n\tcontext: {\n\t\tname: string;\n\t\tgenre: string;\n\t};\n\tcreatedBy: AzureUser;\n\tcreateDate: string;\n\tdescription: string;\n\tstate: 'error' | 'failed' | 'notApplicable' | 'notSet' | 'pending' | 'succeeded';\n\ttargetUrl: string;\n\tupdateDate: string;\n}\n\nexport interface AzureGitForkRef {\n\tcreator: AzureUser;\n\tisLocked: boolean;\n\tisLockedBy: AzureUser;\n\tname: string;\n\tobjectId: string;\n\tpeeledObjectId: string;\n\trepository: AzureRepositoryReference;\n\tstatuses: AzureGitStatus[];\n\turl: string;\n}\n\nexport interface AzureWebApiTagDefinition {\n\tactive: boolean;\n\tid: string;\n\tname: string;\n\turl: string;\n}\n\nexport interface AzureGitPullRequestMergeOptions {\n\tconflictAuthorshipCommits: boolean;\n\tdetectRenameFalsePositives: boolean;\n\tdisableRenames: boolean;\n}\n\nexport type AzurePullRequestAsyncStatus =\n\t| 'conflicts'\n\t| 'failure'\n\t| 'notSet'\n\t| 'queued'\n\t| 'rejectedByPolicy'\n\t| 'succeeded';\n\nexport interface AzurePullRequest {\n\trepository: AzurePullRequestRepository;\n\tpullRequestId: number;\n\tcodeReviewId: number;\n\tstatus: AzurePullRequestStatus;\n\tcreatedBy: AzureUser;\n\tcreationDate: string;\n\tclosedDate?: string;\n\tclosedBy?: AzureUser; // Can be missed even if closedDate is presented.\n\ttitle: string;\n\tdescription: string;\n\tforkSource?: AzureGitForkRef;\n\tsourceRefName: string;\n\ttargetRefName: string;\n\tisDraft: boolean;\n\tmergeId: string;\n\tmergeStatus?: AzurePullRequestAsyncStatus;\n\tlastMergeCommit?: AzureGitCommitRef;\n\tlastMergeSourceCommit: AzureGitCommitRef;\n\tlastMergeTargetCommit: AzureGitCommitRef;\n\treviewers: AzureUserWithVote[];\n\turl: string;\n\tsupportsIterations: boolean;\n}\n\nexport interface AzurePullRequestWithLinks extends AzurePullRequest {\n\t_links: {\n\t\tself: AzureLink;\n\t\trepository: AzureLink;\n\t\tworkItems: AzureLink;\n\t\tsourceBranch: AzureLink;\n\t\ttargetBranch: AzureLink;\n\t\tstatuses: AzureLink;\n\t\tsourceCommit: AzureLink;\n\t\ttargetCommit: AzureLink;\n\t\tcreatedBy: AzureLink;\n\t\titerations: AzureLink;\n\t};\n\tartifactId: string;\n\tautoCompleteSetBy?: AzureUser;\n\tcommits?: AzureGitCommitRef[];\n\tcompletionOptions?: AzurePullRequestCompletionOptions;\n\tcompletionQueueTime?: string;\n\thasMultipleMergeBases?: boolean;\n\tlabels?: AzureWebApiTagDefinition[];\n\tmergeFailureMessage?: string;\n\tmergeFailureType?: 'caseSensitive' | 'none' | 'objectTooLarge' | 'unknown';\n\tmergeOptions?: AzureGitPullRequestMergeOptions;\n\tremoteUrl?: string;\n\tworkItemRefs?: AzureResourceRef[];\n}\n\nexport function getAzureDevOpsOwner(url: URL): string {\n\treturn url.pathname.split('/')[1];\n}\nexport function isVsts(domain: string): boolean {\n\treturn domain.toLowerCase().endsWith(vstsHostnameSuffix);\n}\n\n/**\n * Encodes one route segment of an Azure DevOps request (#5878): `encodeURIComponent` leaves a dot segment as is, and\n * the URL would resolve it away, re-scoping the request instead of failing it.\n */\nexport function encodeAzurePathSegment(value: string): string {\n\tif (value === '.' || value === '..') throw new Error(`Invalid Azure path segment '${value}'.`);\n\n\treturn encodeURIComponent(value);\n}\n\n/**\n * `baseUrl` and `owner` are the authoritative prefix used for the API request. The payload URL cannot supply that\n * prefix safely because it may address the repository by id or name an untrusted host.\n */\nfunction getAzureRepositoryWebUrl(baseUrl: string, owner: string, projectName: string, repoName: string): string {\n\tconst repoPath = `${encodeURIComponent(owner)}/${encodeURIComponent(projectName)}/_git/${encodeURIComponent(repoName)}`;\n\treturn `${trimTrailingSlashes(baseUrl)}/${repoPath}`;\n}\n\nexport function getAzurePullRequestWebUrl(pr: AzurePullRequest, baseUrl: string, owner: string): string {\n\tconst repoUrl = getAzureRepositoryWebUrl(baseUrl, owner, pr.repository.project.name, pr.repository.name);\n\treturn `${repoUrl}/pullrequest/${pr.pullRequestId}`;\n}\n\n/**\n * Whether `url` and `expected` are the two cloud spellings of one organization: a cloud organization answers on both\n * `dev.azure.com/{owner}` and the legacy `{owner}.visualstudio.com`, so those name the same host. Anything else is\n * somewhere we didn't ask.\n */\nfunction isSameAzureCloudOrganization(url: URL, expected: URL, expectedOwner: string): boolean {\n\tif (url.protocol !== expected.protocol) return false;\n\n\tconst owner = expectedOwner.toLowerCase();\n\tif (expected.hostname !== 'dev.azure.com' && !isVsts(expected.hostname)) return false;\n\n\tif (url.hostname === 'dev.azure.com') return getAzureDevOpsOwner(url).toLowerCase() === owner;\n\n\treturn url.hostname === `${owner}${vstsHostnameSuffix}`;\n}\n\n/**\n * Whether `url` sits under the collection the integration is configured to talk to — `{expectedUrl}/{expectedOwner}`.\n * A matching origin says nothing on its own: Azure organizations and self-hosted collections are path segments.\n */\nfunction isUnderAzureCollection(url: URL, expected: URL, expectedOwner: string): boolean {\n\tconst base = trimTrailingSlashes(expected.pathname);\n\tconst prefix = `${base}/${encodeURIComponent(expectedOwner)}/`.toLowerCase();\n\treturn `${url.pathname}/`.toLowerCase().startsWith(prefix);\n}\n\n/**\n * Restricts a provider-supplied repository URL to the integration's collection and removes credentials, query, and\n * fragment before a consumer can use it as a git remote. Takes the value as the payloads carry it — every one of\n * these URLs is optional — so a caller never has to spell the absent case itself.\n */\nexport function sanitizeAzureRepositoryUrl(\n\tvalue: string | undefined,\n\texpectedUrl: string,\n\texpectedOwner: string,\n): string | undefined {\n\tif (value == null) return undefined;\n\n\tlet expected: URL;\n\tlet url: URL;\n\ttry {\n\t\texpected = new URL(expectedUrl);\n\t\turl = new URL(value);\n\t} catch {\n\t\treturn undefined;\n\t}\n\n\tif (expected.protocol !== 'https:' && expected.protocol !== 'http:') return undefined;\n\tif (!expectedOwner) return undefined;\n\n\tif (url.origin === expected.origin) {\n\t\tif (!isUnderAzureCollection(url, expected, expectedOwner)) return undefined;\n\t} else if (!isSameAzureCloudOrganization(url, expected, expectedOwner)) {\n\t\treturn undefined;\n\t}\n\n\turl.username = '';\n\turl.password = '';\n\turl.search = '';\n\turl.hash = '';\n\treturn url.toString();\n}\n\n/**\n * The clone URL the payload carries for a repository, restricted to the integration's collection and then\n * cross-checked against the repository that payload names.\n *\n * The collection check alone is not enough for a URL that is READ rather than built. Every other repository URL the\n * model reports is built from the authoritative prefix, so the payload cannot move it; this one cannot be built,\n * because Azure spells a repository for git the same way it spells it for the web only by convention. A URL under\n * the right collection may still name a DIFFERENT repository in it, which would leave `cloneHttps` describing one\n * repository while `url` describes another.\n *\n * Azure ends a clone URL with `_git/{repo}` on every host style — including the short `{owner}/_git/{repo}` form it\n * uses when a repository carries its project's name, and the legacy `{owner}.visualstudio.com` spelling that has no\n * organization segment at all — so the repository name is the one part comparable across all of them. A same-named\n * repository in another project of the same organization is the single substitution this cannot catch.\n */\nfunction getAzureRepositoryCloneUrl(\n\trepository: AzureRepositoryReference,\n\tbaseUrl: string,\n\towner: string,\n): string | undefined {\n\tconst sanitized = sanitizeAzureRepositoryUrl(repository.remoteUrl, baseUrl, owner);\n\tif (sanitized == null) return undefined;\n\n\t// Safe to parse: `sanitizeAzureRepositoryUrl` returns what it already parsed.\n\tconst segments = new URL(sanitized).pathname.split('/').filter(s => s.length > 0);\n\tconst name = segments.pop();\n\tif (name == null || segments.pop() !== '_git') return undefined;\n\n\tlet decoded: string;\n\ttry {\n\t\tdecoded = decodeURIComponent(name);\n\t} catch {\n\t\treturn undefined;\n\t}\n\n\t// Azure resolves project and repository names case-insensitively, so comparing them any other way would refuse a\n\t// URL the provider considers the same one.\n\treturn decoded.toLowerCase() === repository.name.toLowerCase() ? sanitized : undefined;\n}\n\nexport function fromAzurePullRequestMergeStatusToMergeableState(\n\tmergeStatus: AzurePullRequestAsyncStatus,\n): PullRequestMergeableState {\n\tswitch (mergeStatus) {\n\t\tcase 'conflicts':\n\t\t\treturn PullRequestMergeableState.Conflicting;\n\t\tcase 'failure':\n\t\t\treturn PullRequestMergeableState.FailingChecks;\n\t\tcase 'rejectedByPolicy':\n\t\t\treturn PullRequestMergeableState.BlockedByPolicy;\n\t\tcase 'succeeded':\n\t\t\treturn PullRequestMergeableState.Mergeable;\n\t\tcase 'notSet':\n\t\tcase 'queued':\n\t\tdefault:\n\t\t\treturn PullRequestMergeableState.Unknown;\n\t}\n}\n\nexport function fromAzurePullRequestVoteToReviewState(vote: AzurePullRequestVote): PullRequestReviewState {\n\tswitch (vote) {\n\t\tcase 10:\n\t\tcase 5:\n\t\t\treturn PullRequestReviewState.Approved;\n\t\tcase 0:\n\t\t\treturn PullRequestReviewState.ReviewRequested;\n\t\tcase -5:\n\t\tcase -10:\n\t\t\treturn PullRequestReviewState.ChangesRequested;\n\t\tdefault:\n\t\t\treturn PullRequestReviewState.ReviewRequested;\n\t}\n}\n\nexport function fromAzureUserWithVoteToReviewer(reviewer: AzureUserWithVote): PullRequestReviewer {\n\treturn {\n\t\tisCodeOwner: undefined,\n\t\treviewer: {\n\t\t\tavatarUrl: reviewer.imageUrl,\n\t\t\tid: reviewer.id,\n\t\t\tname: reviewer.displayName,\n\t\t\tusername: reviewer.uniqueName,\n\t\t\turl: reviewer.url,\n\t\t},\n\t\tstate: fromAzurePullRequestVoteToReviewState(reviewer.vote ?? 0),\n\t};\n}\n\nexport function getAzurePullRequestReviewDecision(\n\tvotes: AzurePullRequestVote[],\n): PullRequestReviewDecision | undefined {\n\tconst reviewStates = votes.map(vote => fromAzurePullRequestVoteToReviewState(vote));\n\tif (reviewStates.includes(PullRequestReviewState.ChangesRequested)) {\n\t\treturn PullRequestReviewDecision.ChangesRequested;\n\t}\n\n\tif (reviewStates.includes(PullRequestReviewState.ReviewRequested)) {\n\t\treturn PullRequestReviewDecision.ReviewRequired;\n\t}\n\n\tif (reviewStates.includes(PullRequestReviewState.Approved)) {\n\t\treturn PullRequestReviewDecision.Approved;\n\t}\n\n\treturn undefined;\n}\n\nexport function fromAzureReviewerToPullRequestMember(reviewer: AzureUser): PullRequestMember {\n\treturn {\n\t\tavatarUrl: reviewer.imageUrl,\n\t\tid: reviewer.id,\n\t\tname: reviewer.displayName,\n\t\tusername: reviewer.uniqueName,\n\t\turl: reviewer.url,\n\t};\n}\n\nexport function normalizeAzureBranchName(branchName: string): string {\n\treturn branchName.startsWith('refs/heads/') ? branchName.replace('refs/heads/', '') : branchName;\n}\n\nfunction fromAzureUserToMember(user: AzureUser, type: 'issue'): IssueMember;\nfunction fromAzureUserToMember(user: AzureUser, type: 'pullRequest'): PullRequestMember;\nfunction fromAzureUserToMember(user: AzureUser, _type: 'issue' | 'pullRequest'): PullRequestMember | IssueMember {\n\treturn {\n\t\tavatarUrl: user.imageUrl,\n\t\tid: user.id,\n\t\tname: user.displayName,\n\t\tusername: user.uniqueName,\n\t\turl: user.url,\n\t};\n}\n\n/**\n * The URLs of a cross-repository pull request's fork, resolved by a lookup because the pull request payload embeds\n * only an abbreviated reference to it: `url` is the URL the head ref reports — the fork's web URL, or its clone URL\n * when the response carries no web URL — and `cloneHttps` its HTTPS clone URL.\n *\n * A fork that resolves neither is reported as no fork at all rather than as an object with nothing in it, so `url`\n * is always present here; `cloneHttps` alone is best-effort, and is absent when the response omits it or its URL\n * sits outside the integration's collection.\n */\nexport interface AzureForkRepositoryUrls {\n\turl: string;\n\tcloneHttps: string | undefined;\n}\n\n/**\n * `baseUrl` and `owner` are the prefix the pull request was read through; every URL the model reports is built from\n * them. The required `forkRepositoryUrls` argument makes each call site resolve the best-effort fork URLs explicitly.\n */\nexport function fromAzurePullRequest(\n\tpr: AzurePullRequest,\n\tprovider: Provider,\n\towner: string,\n\tbaseUrl: string,\n\tforkRepositoryUrls: AzureForkRepositoryUrls | undefined,\n\tprojection?: PullRequestProjection,\n): PullRequest {\n\tconst baseRepositoryUrl = getAzureRepositoryWebUrl(baseUrl, owner, pr.repository.project.name, pr.repository.name);\n\tconst baseCloneHttps = getAzureRepositoryCloneUrl(pr.repository, baseUrl, owner);\n\n\tconst forkRepository = pr.forkSource?.repository;\n\tconst headRepositoryUrl = forkRepository == null ? baseRepositoryUrl : forkRepositoryUrls?.url;\n\tconst headCloneHttps = forkRepository == null ? baseCloneHttps : forkRepositoryUrls?.cloneHttps;\n\n\tconst result = new PullRequest(\n\t\tprovider,\n\t\tfromAzureUserToMember(pr.createdBy, 'pullRequest'),\n\t\tpr.pullRequestId.toString(),\n\t\tpr.pullRequestId.toString(),\n\t\tpr.title,\n\t\tgetAzurePullRequestWebUrl(pr, baseUrl, owner),\n\t\t{\n\t\t\towner: owner,\n\t\t\trepo: pr.repository.name,\n\t\t\tid: pr.repository.id,\n\t\t},\n\t\tazurePullRequestStatusToState(pr.status),\n\t\tnew Date(pr.creationDate),\n\t\tnew Date(pr.closedDate || pr.creationDate),\n\t\tpr.closedDate ? new Date(pr.closedDate) : undefined,\n\t\tpr.closedDate && pr.status === 'completed' ? new Date(pr.closedDate) : undefined,\n\t\t// The read selects the merge status, so an absent one is Azure's own \"not set\", as provider-apis maps it.\n\t\tfromAzurePullRequestMergeStatusToMergeableState(pr.mergeStatus ?? 'notSet'),\n\t\tundefined,\n\t\t{\n\t\t\tbase: {\n\t\t\t\tbranch: pr.targetRefName ? normalizeAzureBranchName(pr.targetRefName) : '',\n\t\t\t\tsha: pr.lastMergeTargetCommit?.commitId ?? '',\n\t\t\t\trepo: pr.repository.name,\n\t\t\t\towner: owner,\n\t\t\t\texists: pr.targetRefName != null,\n\t\t\t\turl: baseRepositoryUrl,\n\t\t\t\tcloneHttps: baseCloneHttps,\n\t\t\t},\n\t\t\thead: {\n\t\t\t\tbranch: pr.sourceRefName ? normalizeAzureBranchName(pr.sourceRefName) : '',\n\t\t\t\tsha: pr.lastMergeSourceCommit?.commitId ?? '',\n\t\t\t\trepo: forkRepository?.name ?? pr.repository.name,\n\t\t\t\towner: owner,\n\t\t\t\texists: pr.sourceRefName != null,\n\t\t\t\turl: headRepositoryUrl,\n\t\t\t\tcloneHttps: headCloneHttps,\n\t\t\t},\n\t\t\tisCrossRepository: pr.forkSource != null,\n\t\t},\n\t\tpr.isDraft,\n\t\tundefined,\n\t\tundefined,\n\t\tundefined,\n\t\tundefined,\n\t\tgetAzurePullRequestReviewDecision(pr.reviewers?.filter(r => r.isRequired).map(r => r.vote ?? 0) ?? []),\n\t\tpr.reviewers.filter(r => r.vote == null || r.vote === 0).map(r => fromAzureUserWithVoteToReviewer(r)),\n\t\tpr.reviewers.filter(r => r.vote != null && r.vote !== 0).map(r => fromAzureUserWithVoteToReviewer(r)),\n\t\tpr.reviewers.map(r => fromAzureReviewerToPullRequestMember(r)),\n\t\tundefined,\n\t\t{\n\t\t\tid: pr.repository?.project?.id,\n\t\t\tname: pr.repository.project.name,\n\t\t\tresourceId: '', // TODO: This is a workaround until we can get the org id here.\n\t\t\tresourceName: owner,\n\t\t},\n\t\tundefined, // version\n\t\tundefined, // commitCount\n\t\tundefined, // stack\n\t\tundefined, // filesChanged\n\t\tundefined, // body\n\t\tundefined, // number\n\t\tundefined, // authoredByMe\n\t\tprojection,\n\t);\n\treturn copyReadProvenance(result, pr);\n}\n\nfunction fromAzureWorkItemUserToMember(user: AzureUser | string | undefined): IssueMember | undefined {\n\tif (user == null || (typeof user === 'string' && !user.trim())) return undefined;\n\n\treturn typeof user === 'string' ? { id: user, name: user, username: user } : fromAzureUserToMember(user, 'issue');\n}\n\nexport function fromAzureWorkItem(\n\tworkItem: WorkItem,\n\tprovider: Provider,\n\tproject: AzureProjectDescriptor,\n\tstateCategory?: AzureWorkItemStateCategory,\n\tprojection?: IssueProjection,\n\thtmlFields?: readonly AzureWorkItemHtmlField[],\n\t/** As `toIssueShape` takes it: `null` where the read couldn't resolve it. */\n\tviewer?: { id: string } | null,\n): Issue {\n\tconst state = workItem.fields['System.State'];\n\tconst description = getAzureWorkItemDescription(workItem.fields, htmlFields);\n\tconst closedDate = parseAzureWorkItemDate(workItem.fields['Microsoft.VSTS.Common.ClosedDate']) ?? undefined;\n\tconst normalizedState = azureWorkItemsStateCategoryToState(stateCategory, closedDate);\n\tconst author = fromAzureWorkItemUserToMember(workItem.fields['System.CreatedBy']);\n\tconst assignee = fromAzureWorkItemUserToMember(workItem.fields['System.AssignedTo']);\n\tconst assignees = assignee != null ? [assignee] : [];\n\tconst viewerFields = toIssueViewer({ author: author, assignees: assignees }, viewer);\n\tconst result = new Issue(\n\t\tprovider,\n\t\tworkItem.id.toString(),\n\t\tworkItem.id.toString(),\n\t\tworkItem.fields['System.Title'],\n\t\tworkItem._links.html.href,\n\t\tnew Date(workItem.fields['System.CreatedDate']),\n\t\tnew Date(workItem.fields['System.ChangedDate']),\n\t\tnormalizedState === 'closed',\n\t\tnormalizedState,\n\t\tauthor,\n\t\tassignees,\n\t\tundefined,\n\t\tclosedDate,\n\t\tundefined,\n\t\tworkItem.fields['System.CommentCount'],\n\t\tundefined,\n\t\tdescription?.value,\n\t\tproject,\n\t\tundefined,\n\t\tworkItem.fields['System.WorkItemType'],\n\t\ttypeof state === 'string' && state\n\t\t\t? { name: state, category: azureIssueStateCategory(stateCategory) }\n\t\t\t: undefined,\n\t\tundefined,\n\t\ttoWorkItemIterations(workItem.fields['System.IterationPath']),\n\t\tprojection,\n\t\tdescription != null ? toIssueBodyField(description.field) : undefined,\n\t\tviewerFields?.viewer,\n\t\tviewerFields?.viewerUnresolved,\n\t);\n\treturn copyReadProvenance(result, workItem);\n}\n\n/**\n * Azure reports the iteration as a backslash-delimited path rooted at the project. The project root is its default\n * for a work item with no sprint, so only a nested path names one; the path is the identity because Azure supplies\n * no iteration id here.\n *\n * Mirrors `normalizeIteration` in provider-apis so the same work item yields the same identity whether it is read\n * here or through the SDK. That contract keeps the path **verbatim** — it is what the iteration is matched back by,\n * so it is deliberately not trimmed — and trims only the display name.\n */\nfunction toWorkItemIterations(path: string | undefined): IssueIteration[] | undefined {\n\tif (!path) return undefined;\n\n\tconst segments = path.split('\\\\');\n\tif (segments.length < 2) return undefined;\n\n\tconst name = segments.at(-1)?.trim();\n\treturn name ? [{ id: path, name: name }] : undefined;\n}\n\n/**\n * A work item as `GET …/_apis/wit/workitems/{id}?$expand=Links` returns it. Loosely typed because\n * {@link fromAzureWorkItemToProviderIssue} checks every field it reads, as provider-apis does.\n */\nexport interface AzureWorkItemResponse {\n\tid?: unknown;\n\tfields?: Record<string, unknown>;\n\t_links?: { html?: { href?: unknown } };\n}\n\n/**\n * A cheap read's work item with the workflow category its state classifies to (see\n * {@link toAzureWorkItemEtagFields}). Beside the work item rather than on it, so the wire type stays what Azure sends.\n */\nexport interface AzureWorkItemEtagRead {\n\treadonly workItem: AzureWorkItemResponse;\n\treadonly category: IssueProviderState['category'];\n}\n\n/**\n * Converts a work item as provider-apis' `getIssuesForAzureProject` converts each row it reads, so a work item read\n * by id reaches `toIssueShape` identical to the list read's row for it. provider-apis exports neither that converter\n * nor a single work item read, so this mirrors it field for field; the batch issue tests compare the two, so a\n * provider-apis change that this misses fails there.\n *\n * `undefined` for a work item the SDK would skip: no positive integer id, no title, or no valid created date.\n * `state.name` is the raw `System.State`, as on every list read here, which passes the SDK no state-name map. Like\n * the SDK's row, the state carries no workflow category: `ProvidersApi` classifies both reads' rows the same way\n * afterwards, from the work item type's states.\n */\nexport function fromAzureWorkItemToProviderIssue(\n\tworkItem: AzureWorkItemResponse,\n\tnamespace: string,\n\tproject: string,\n\thtmlFields?: readonly AzureWorkItemHtmlField[],\n): ProviderIssue | undefined {\n\tconst fields = workItem.fields;\n\tconst id = workItem.id;\n\tconst title = fields?.['System.Title'];\n\tconst createdDate = parseAzureWorkItemDate(fields?.['System.CreatedDate']);\n\tif (\n\t\tfields == null ||\n\t\ttypeof id !== 'number' ||\n\t\t!Number.isSafeInteger(id) ||\n\t\tid <= 0 ||\n\t\ttypeof title !== 'string' ||\n\t\t!title.trim() ||\n\t\tcreatedDate == null\n\t) {\n\t\treturn undefined;\n\t}\n\n\tconst assignee = fromAzureWorkItemIdentity(fields['System.AssignedTo']);\n\tconst commentCount = fields['System.CommentCount'];\n\tconst url = workItem._links?.html?.href;\n\tconst tags = fields['System.Tags'];\n\tconst state = fields['System.State'];\n\tconst type = fields['System.WorkItemType'];\n\tconst result: ProviderIssue = {\n\t\tid: id.toString(),\n\t\tnumber: id.toString(),\n\t\ttitle: title,\n\t\tcommentCount: typeof commentCount === 'number' && Number.isFinite(commentCount) ? commentCount : null,\n\t\tauthor: fromAzureWorkItemIdentity(fields['System.CreatedBy']),\n\t\tclosedDate: parseAzureWorkItemDate(fields['Microsoft.VSTS.Common.ClosedDate']),\n\t\tcreatedDate: createdDate,\n\t\tupdatedDate: parseAzureWorkItemDate(fields['System.ChangedDate']),\n\t\turl: typeof url === 'string' ? url : null,\n\t\tassignees: assignee != null ? [assignee] : [],\n\t\t...toAzureWorkItemDescriptionFields(fields, htmlFields),\n\t\tstate: typeof state === 'string' && state ? { name: state, color: null } : null,\n\t\ttype: typeof type === 'string' ? type : null,\n\t\titeration: toAzureWorkItemIteration(fields['System.IterationPath']),\n\t\trepository: null,\n\t\tproject: { namespace: namespace, name: project, resourceId: null, key: null, id: null },\n\t\t// provider-apis fills 0, but work items have no reactions.\n\t\tupvoteCount: null,\n\t\tlabels: (typeof tags === 'string' ? tags.split(';') : []).map(tag => ({\n\t\t\tcolor: null,\n\t\t\tdescription: null,\n\t\t\tid: null,\n\t\t\tname: tag.trim(),\n\t\t})),\n\t};\n\treturn copyReadProvenance(result, workItem);\n}\n\nexport function toAzureWorkItemDescriptionFields(\n\tfields: Readonly<Record<string, unknown>> | null | undefined,\n\thtmlFields?: readonly AzureWorkItemHtmlField[],\n): Pick<ProviderIssue, 'description' | 'descriptionField'> {\n\tconst description = getAzureWorkItemDescription(fields, htmlFields);\n\treturn {\n\t\tdescription: description?.value ?? null,\n\t\t...(description != null ? { descriptionField: description.field } : {}),\n\t};\n}\n\n/** An identity field, as provider-apis maps it: `name` from `uniqueName`, `username` from `displayName`. */\nfunction fromAzureWorkItemIdentity(value: unknown): ProviderAccount | null {\n\tif (typeof value === 'string') {\n\t\tif (!value.trim()) return null;\n\n\t\treturn { id: value, name: value, username: value, email: null, avatarUrl: null, url: null };\n\t}\n\n\tconst identity = value as\n\t\t| { id?: unknown; uniqueName?: unknown; displayName?: unknown; _links?: { avatar?: { href?: unknown } } }\n\t\t| null\n\t\t| undefined;\n\tif (typeof identity?.id !== 'string' || !identity.id.trim()) return null;\n\n\tconst avatarUrl = identity._links?.avatar?.href;\n\treturn {\n\t\tavatarUrl: typeof avatarUrl === 'string' ? avatarUrl : null,\n\t\temail: null,\n\t\tid: identity.id,\n\t\tname: typeof identity.uniqueName === 'string' ? identity.uniqueName : null,\n\t\tusername: typeof identity.displayName === 'string' ? identity.displayName : null,\n\t\turl: null,\n\t};\n}\n\n/** Only a UTC ISO timestamp naming a real calendar date and time, as provider-apis accepts; anything else is `null`. */\nexport function parseAzureWorkItemDate(value: unknown): Date | null {\n\tif (typeof value !== 'string') return null;\n\n\tconst match = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.\\d{1,7})?Z$/.exec(value);\n\tif (match == null) return null;\n\n\tconst [year, month, day, hour, minute, second] = match.slice(1).map(Number);\n\tconst isLeapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n\tconst daysInMonth = [31, isLeapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\tif (month < 1 || month > 12 || day < 1 || day > daysInMonth[month - 1] || hour > 23 || minute > 59 || second > 59) {\n\t\treturn null;\n\t}\n\n\tconst date = new Date(value);\n\treturn Number.isNaN(date.getTime()) ? null : date;\n}\n\n/** The SDK's `iteration`, by the same path rule as {@link toWorkItemIterations}. */\nfunction toAzureWorkItemIteration(path: unknown): ProviderIssue['iteration'] {\n\tconst [iteration] = toWorkItemIterations(typeof path === 'string' ? path : undefined) ?? [];\n\treturn iteration != null ? { path: iteration.id, name: iteration.name } : undefined;\n}\n\n/**\n * The most ids one cheap work item read asks for: the most Azure DevOps' work item list (`GET …/_apis/wit/workitems`)\n * takes.\n */\nexport const azureWorkItemsEtagFieldsMaxIds = 200;\n\n/**\n * The fields the cheap work item read selects: only the ones a full row's etag reads, and the project the full read\n * checks the work item against. The state and type let the cheap read resolve the same workflow category as the full\n * read, from the same work item type states.\n */\nexport const azureWorkItemEtagFieldNames: readonly string[] = [\n\t'System.TeamProject',\n\t'System.State',\n\t'System.WorkItemType',\n\t'System.ChangedDate',\n\t'Microsoft.VSTS.Common.ClosedDate',\n];\n\n/**\n * A cheap read's work item, as the fields its full batch row's etag reads: `toIssueShape` closes the row the full\n * read builds (see {@link fromAzureWorkItemToProviderIssue}) from its known workflow category, falling back to a\n * closed date only when the category is unavailable. A historical date must not close a reopened work item.\n * Throws where the full read fails the work item: on one in another project than `project` (compared as Azure\n * compares names), and on a missing or unparseable change date, so the target falls through to the full read.\n */\nexport function toAzureWorkItemEtagFields(\n\tworkItem: AzureWorkItemResponse,\n\tproject: string,\n\tcategory: IssueProviderState['category'],\n): IssueEtagFields {\n\tconst fields = workItem.fields;\n\tconst teamProject = fields?.['System.TeamProject'];\n\tif (typeof teamProject !== 'string' || !teamProject.trim()) {\n\t\tthrow new Error(`Azure DevOps work item ${String(workItem.id)} has no project`);\n\t}\n\n\tif (teamProject.toLowerCase() !== project.toLowerCase()) {\n\t\tthrow new Error(\n\t\t\t`Azure DevOps work item ${String(workItem.id)} is in project '${teamProject}', not '${project}'`,\n\t\t);\n\t}\n\n\tconst updatedDate = parseAzureWorkItemDate(fields?.['System.ChangedDate']);\n\tif (updatedDate == null) {\n\t\tthrow new Error(`Azure DevOps returned work item ${String(workItem.id)} without a change date`);\n\t}\n\n\tconst state =\n\t\tcategory != null\n\t\t\t? isTerminalIssueStateCategory(category)\n\t\t\t\t? 'closed'\n\t\t\t\t: 'opened'\n\t\t\t: parseAzureWorkItemDate(fields?.['Microsoft.VSTS.Common.ClosedDate']) != null\n\t\t\t\t? 'closed'\n\t\t\t\t: undefined;\n\treturn {\n\t\tstate: state,\n\t\tupdatedDate: updatedDate,\n\t\tdescriptionRule: azureWorkItemDescriptionRule,\n\t\tviewerRule: azureWorkItemViewerRule,\n\t};\n}\n\ntype ProviderPullRequestState = Parameters<typeof fromProviderPullRequestState>[0];\ntype ProviderMergeableState = keyof typeof fromProviderPullRequestMergeableState;\ntype ProviderReviewState = keyof typeof fromPullRequestReviewDecision;\n\n// The tables below mirror provider-apis' (0.61.0) Azure DevOps pull request mapping behind `getPullRequestForRepo` (`Xe`\n// and its helpers in the bundle), which it doesn't export. A full batch row takes these values on through\n// `fromProviderPullRequest`, so the cheap check composes the same steps to compute the same etag.\n\n/** provider-apis' pull request `status` map (`bi`). It has no `notSet`, which therefore maps to `undefined`. */\nconst azurePullRequestProviderStates: Partial<Record<string, ProviderPullRequestState>> = {\n\tactive: GitPullRequestState.Open,\n\tcompleted: GitPullRequestState.Merged,\n\tabandoned: GitPullRequestState.Closed,\n};\n\n/** provider-apis' `mergeStatus` map (`Ti`); any other status, or none, is unknown. */\nconst azureMergeStatusProviderStates: Partial<Record<string, ProviderMergeableState>> = {\n\tconflicts: GitPullRequestMergeableState.Conflicts,\n\tfailure: GitPullRequestMergeableState.FailingChecks,\n\trejectedByPolicy: GitPullRequestMergeableState.Blocked,\n\tsucceeded: GitPullRequestMergeableState.Mergeable,\n};\n\n/** provider-apis' reviewer `vote` map (`Di`); any other vote reads as review requested. */\nconst azureVoteProviderReviewStates: Partial<Record<number, ProviderReviewState>> = {\n\t10: GitPullRequestReviewState.Approved,\n\t5: GitPullRequestReviewState.Approved,\n\t0: GitPullRequestReviewState.ReviewRequested,\n\t[-5]: GitPullRequestReviewState.ChangesRequested,\n\t[-10]: GitPullRequestReviewState.ChangesRequested,\n};\n\n/** provider-apis' reviewer mapping (`ve`), with the state its vote maps to: every reviewer, required or optional. */\nfunction toAzureProviderReview(reviewer: AzureUserWithVote): ProviderPullRequestReview {\n\treturn {\n\t\treviewer: {\n\t\t\tid: reviewer.id,\n\t\t\tname: reviewer.displayName ?? null,\n\t\t\tusername: (reviewer.uniqueName || reviewer.displayName) ?? null,\n\t\t\temail: null,\n\t\t\tavatarUrl: reviewer.imageUrl ?? null,\n\t\t\turl: null,\n\t\t},\n\t\tstate: toAzureProviderReviewState(reviewer),\n\t};\n}\n\nfunction toAzureProviderReviewState(reviewer: AzureUserWithVote): ProviderReviewState {\n\treturn azureVoteProviderReviewStates[reviewer.vote ?? 0] ?? GitPullRequestReviewState.ReviewRequested;\n}\n\n/**\n * A cheap read's pull request (the same `GET …/pullrequests/{id}` provider-apis sends), as the fields its full batch\n * row's etag reads: provider-apis' mapping (see the tables above), then `fromProviderPullRequest`'s. Azure DevOps\n * reports no update time, so provider-apis' `updatedDate` is the close time, else the creation time, which is why\n * the fields Azure changes without one are fingerprinted into the `revision`, from the values the full row ends up\n * with: provider-apis' title, description (`?? null`, which the row reads `?? undefined`) and target branch, and its\n * reviews, split into requests and completed reviews by `fromProviderPullRequest`'s own helpers.\n *\n * Throws where provider-apis' mapping throws, on a field it reads without a guard, so a pull request the full read\n * fails on falls through to it rather than matching an etag. A full row never carries a check rollup (provider-apis\n * maps none for Azure DevOps), so the `checks` include always reads `undefined`, as there.\n */\nexport function toAzurePullRequestEtagFields(\n\tpr: AzurePullRequest,\n\tetagIncludes: readonly PullRequestEtagInclude[],\n): PullRequestEtagFields {\n\tif (\n\t\tpr.pullRequestId == null ||\n\t\tpr.createdBy == null ||\n\t\tpr.repository?.project == null ||\n\t\tpr.lastMergeSourceCommit == null ||\n\t\tpr.lastMergeTargetCommit == null ||\n\t\t!Array.isArray(pr.reviewers) ||\n\t\tpr.reviewers.some(r => r == null) ||\n\t\ttypeof pr.url !== 'string' ||\n\t\ttypeof pr.sourceRefName !== 'string' ||\n\t\ttypeof pr.targetRefName !== 'string'\n\t) {\n\t\tthrow new Error(`Azure DevOps returned pull request ${String(pr.pullRequestId)} without a field it maps`);\n\t}\n\n\tconst reviews = pr.reviewers.map(toAzureProviderReview);\n\tconst fields: PullRequestEtagFields = {\n\t\t// `notSet` passes `undefined` here, as its full row does.\n\t\tstate: fromProviderPullRequestState(azurePullRequestProviderStates[pr.status] as ProviderPullRequestState),\n\t\tisDraft: pr.isDraft,\n\t\tupdatedDate: new Date(pr.closedDate || pr.creationDate),\n\t\theadSha: pr.lastMergeSourceCommit.commitId ?? '',\n\t\trevision: pullRequestRevision({\n\t\t\ttitle: pr.title,\n\t\t\tbody: pr.description ?? undefined,\n\t\t\trefs: { base: { branch: normalizeAzureBranchName(pr.targetRefName) } },\n\t\t\treviewRequests: toReviewRequests(reviews),\n\t\t\tlatestReviews: toCompletedReviews(reviews),\n\t\t}),\n\t};\n\n\tif (etagIncludes.includes('mergeable')) {\n\t\tconst mergeable =\n\t\t\t(pr.mergeStatus != null ? azureMergeStatusProviderStates[pr.mergeStatus] : undefined) ??\n\t\t\tGitPullRequestMergeableState.Unknown;\n\t\tfields.mergeableState = fromProviderPullRequestMergeableState[mergeable];\n\t}\n\n\tif (etagIncludes.includes('reviewDecision')) {\n\t\t// Only the required reviewers decide.\n\t\tconst decision = decideProviderReviewDecision(\n\t\t\tpr.reviewers.filter(r => r.isRequired).map(toAzureProviderReviewState),\n\t\t);\n\t\tfields.reviewDecision = decision ? fromPullRequestReviewDecision[decision] : undefined;\n\t}\n\n\treturn fields;\n}\n"],"mappings":";;;;;;;;;;AAyCA,MAAa,qBAAqB;;;;;;AA4ClC,SAAgB,wBACf,UACiC;CACjC,QAAQ,UAAR;EACC,KAAK,WACJ,OAAO;EACR,KAAK;EACL,KAAK,YACJ,OAAO;EACR,KAAK,cACJ,OAAO;EACR,KAAK,YACJ,OAAO;EACR,SACC;CACF;AACD;AAEA,SAAgB,mCAAmC,UAA2D;CAC7G,OAAO,6BAA6B,wBAAwB,QAAQ,CAAC;AACtE;AAEA,SAAgB,mCACf,UACA,YACsC;CACtC,IAAI,wBAAwB,QAAQ,KAAK,MACxC,OAAO,mCAAmC,QAAQ,IAAI,WAAW;CAGlE,OAAO,cAAc,OAAO,WAAW,KAAA;AACxC;AA+FA,SAAgB,8BAA8B,QAAyD;CACtG,QAAQ,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equestState","GitPullRequestMergeableState","GitPullRequestReviewState"],"sources":["../../../../../../plus/integrations/src/providers/azure/models.ts"],"sourcesContent":["import type { AzureWorkItemHtmlField } from '@gitkraken/provider-apis';\nimport { getAzureWorkItemDescription } from '@gitkraken/provider-apis';\nimport { copyReadProvenance } from '@gitkraken/provider-apis/read-provenance';\nimport type { IssueIteration, IssueMember, IssueProjection, IssueProviderState } from '@gitlens/git/models/issue.js';\nimport { Issue } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequestState } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { PullRequestMember, PullRequestProjection, PullRequestReviewer } from '@gitlens/git/models/pullRequest.js';\nimport {\n\tPullRequest,\n\tPullRequestMergeableState,\n\tPullRequestReviewDecision,\n\tPullRequestReviewState,\n} from '@gitlens/git/models/pullRequest.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport { isTerminalIssueStateCategory } from '@gitlens/git/utils/issue.utils.js';\nimport { trimTrailingSlashes } from '@gitlens/utils/path.js';\nimport type { IssueEtagFields, PullRequestEtagFields, PullRequestEtagInclude } from '../../reads/etag.js';\nimport { azureWorkItemDescriptionRule, azureWorkItemViewerRule, pullRequestRevision } from '../../reads/etag.js';\nimport type { ProviderAccount, ProviderIssue } from '../models.js';\nimport {\n\tfromProviderPullRequestMergeableState,\n\tfromProviderPullRequestState,\n\tGitPullRequestMergeableState,\n\tGitPullRequestReviewState,\n\tGitPullRequestState,\n\ttoIssueBodyField,\n\ttoIssueViewer,\n} from '../models.js';\nimport type { ProviderPullRequestReview } from '../pullRequestReviews.js';\nimport {\n\tdecideProviderReviewDecision,\n\tfromPullRequestReviewDecision,\n\ttoCompletedReviews,\n\ttoReviewRequests,\n} from '../pullRequestReviews.js';\n\nexport const vstsHostnameSuffix = '.visualstudio.com';\n\nexport interface AzureRepositoryDescriptor extends ResourceDescriptor {\n\towner: string;\n\tname: string;\n\tproject?: string;\n\tvirtualDirectory?: string;\n}\n\nexport interface AzureOrganizationDescriptor extends ResourceDescriptor {\n\tid: string;\n\tname: string;\n}\n\nexport interface AzureProjectDescriptor extends ResourceDescriptor {\n\tid: string;\n\tname: string;\n\tresourceId: string;\n\tresourceName: string;\n}\n\nexport interface AzureRemoteRepositoryDescriptor extends ResourceDescriptor {\n\tid: string;\n\tnodeId?: string;\n\tresourceName: string;\n\tname: string;\n\tprojectName?: string;\n\turl?: string;\n\tcloneUrlHttps?: string;\n\tcloneUrlSsh?: string;\n}\n\nexport type AzureWorkItemStateCategory = 'Proposed' | 'InProgress' | 'Resolved' | 'Completed' | 'Removed';\n\n/**\n * The workflow category of an Azure DevOps state category, as a work item type's states endpoint reports it:\n * `Removed` is abandoned work, so `CANCELED`, kept apart from the `DONE` of `Completed` and `Resolved`.\n * `undefined` for a category Azure doesn't document, which then neither opens nor closes the work item.\n */\nexport function azureIssueStateCategory(\n\tcategory: AzureWorkItemStateCategory | undefined,\n): IssueProviderState['category'] {\n\tswitch (category) {\n\t\tcase 'Removed':\n\t\t\treturn 'CANCELED';\n\t\tcase 'Completed':\n\t\tcase 'Resolved':\n\t\t\treturn 'DONE';\n\t\tcase 'InProgress':\n\t\t\treturn 'IN_PROGRESS';\n\t\tcase 'Proposed':\n\t\t\treturn 'TO_DO';\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\nexport function isClosedAzureWorkItemStateCategory(category: AzureWorkItemStateCategory | undefined): boolean {\n\treturn isTerminalIssueStateCategory(azureIssueStateCategory(category));\n}\n\nexport function azureWorkItemsStateCategoryToState(\n\tcategory: AzureWorkItemStateCategory | undefined,\n\tclosedDate?: Date,\n): IssueOrPullRequestState | undefined {\n\tif (azureIssueStateCategory(category) != null) {\n\t\treturn isClosedAzureWorkItemStateCategory(category) ? 'closed' : 'opened';\n\t}\n\n\treturn closedDate != null ? 'closed' : undefined;\n}\n\nexport interface AzureLink {\n\thref: string;\n}\n\nexport interface AzureUser {\n\tdisplayName: string;\n\turl: string;\n\t_links: {\n\t\tavatar: AzureLink;\n\t};\n\tid: string;\n\tuniqueName: string;\n\timageUrl: string;\n\tdescriptor?: string;\n}\n\nexport interface AzureUserWithVote extends AzureUser {\n\tisFlagged?: boolean;\n\thasDeclined?: boolean;\n\tisReapprove?: boolean;\n\tisRequired?: boolean;\n\tvote?: AzurePullRequestVote;\n}\n\nexport type AzurePullRequestVote =\n\t| 10 // approved\n\t| 5 // approved with suggestions\n\t| 0 // no vote\n\t| -5 // waiting for author\n\t| -10; // rejected\n\nexport interface AzureWorkItemCommentVersionRef {\n\tcommentId: number;\n\tcreatedInRevision: number;\n\tisDeleted: boolean;\n\ttext: string;\n\turl: string;\n\tversion: number;\n}\n\nexport interface AzureWorkItemRelation {\n\tattributes: {\n\t\t[key: string]: string;\n\t};\n\trelation: string;\n\turl: string;\n}\n\nexport interface WorkItem {\n\t_links: {\n\t\tfields: AzureLink;\n\t\thtml: AzureLink;\n\t\tself: AzureLink;\n\t\tworkItemComments: AzureLink;\n\t\tworkItemRevisions: AzureLink;\n\t\tworkItemType: AzureLink;\n\t\tworkItemUpdates: AzureLink;\n\t};\n\tfields: {\n\t\t//'System.AreaPath': string;\n\t\t'System.TeamProject': string;\n\t\t'System.IterationPath'?: string;\n\t\t'System.WorkItemType': string;\n\t\t'System.State': string;\n\t\t// 'System.Reason': string;\n\t\t'System.AssignedTo': AzureUser | string;\n\t\t'System.CreatedDate': string;\n\t\t'System.CreatedBy': AzureUser | string;\n\t\t'System.ChangedDate': string;\n\t\t'System.ChangedBy': AzureUser;\n\t\t'System.CommentCount': number;\n\t\t'System.Description': string;\n\t\t'System.Title': string;\n\t\t'Microsoft.VSTS.Common.ClosedDate': string;\n\t\t// 'Microsoft.VSTS.Common.StateChangeDate': string;\n\t\t// 'Microsoft.VSTS.Common.Priority': number;\n\t\t// 'Microsoft.VSTS.Common.Severity': string;\n\t\t// 'Microsoft.VSTS.Common.ValueArea': string;\n\t};\n\tid: number;\n\trev: number;\n\turl: string;\n\tcommentVersionRef?: AzureWorkItemCommentVersionRef;\n\trelations?: AzureWorkItemRelation[];\n}\n\nexport interface AzureWorkItemState {\n\tname: string;\n\tcolor: string;\n\tcategory: AzureWorkItemStateCategory;\n}\n\nexport type AzurePullRequestStatus = 'abandoned' | 'active' | 'completed' | 'notSet';\nexport function azurePullRequestStatusToState(status: AzurePullRequestStatus): IssueOrPullRequestState {\n\tswitch (status) {\n\t\tcase 'abandoned':\n\t\t\treturn 'closed';\n\t\tcase 'completed':\n\t\t\treturn 'merged';\n\t\tcase 'active':\n\t\tcase 'notSet':\n\t\tdefault:\n\t\t\treturn 'opened';\n\t}\n}\nexport function isClosedAzurePullRequestStatus(status: AzurePullRequestStatus): boolean {\n\treturn azurePullRequestStatusToState(status) !== 'opened';\n}\n\nexport type AzureProjectState = 'createPending' | 'deleted' | 'deleting' | 'new' | 'unchanged' | 'wellFormed';\nexport type AzureProjectVisibility = 'private' | 'public';\n\nexport interface AzureProject {\n\tid: string;\n\tname: string;\n\turl: string;\n\tstate: AzureProjectState;\n\trevision: number;\n\tvisibility: AzureProjectVisibility;\n\tlastUpdateTime: string;\n}\n\nexport interface AzureRepositoryReference {\n\tid: string;\n\tname: string;\n\turl: string;\n\tremoteUrl?: string;\n}\n\nexport interface AzureRepository extends AzureRepositoryReference {\n\tproject: AzureProject;\n\tsize: number;\n\tremoteUrl: string;\n\tsshUrl: string;\n\twebUrl: string;\n\tisDisabled: boolean;\n\tisInMaintenance: boolean;\n}\n\nexport interface AzurePullRequestRepository extends AzureRepositoryReference {\n\tproject: Pick<AzureProject, 'id' | 'name'>;\n}\n\n/** The URL fields of a repository response — all the fork lookup reads, and all an older `api-version` promises. */\nexport type AzureRepositoryUrls = Partial<Pick<AzureRepository, 'webUrl' | 'remoteUrl'>>;\n\n/** The `GET .../_apis/git/repositories/{repositoryId or name}` response, adding fork/default-branch fields to {@link AzureRepository}. */\nexport interface AzureRepositoryWithMetadata extends AzureRepository {\n\t/** Fully-qualified ref, e.g. `refs/heads/main`. */\n\tdefaultBranch?: string;\n\tisFork?: boolean;\n\tparentRepository?: {\n\t\tid: string;\n\t\tname?: string;\n\t\tproject?: { id: string; name: string };\n\t};\n}\n\nexport interface AzureGitUser {\n\tdate?: string;\n\temail?: string;\n\timageUrl?: string;\n\tname: string;\n}\n\nexport interface AzureGitCommitRef {\n\tcommitId: string;\n\turl: string;\n}\n\nexport interface AzureGitCommit {\n\t_links: {\n\t\tchanges: AzureLink;\n\t\trepository: AzureLink;\n\t\tself: AzureLink;\n\t\tweb: AzureLink;\n\t};\n\tauthor: AzureGitUser;\n\tcomment: string;\n\tcommentTruncated?: boolean;\n\tcommitId: string;\n\tcommitTooManyChanges?: boolean;\n\tcommitter: AzureGitUser;\n\tparents: string[];\n\tpush: {\n\t\tdate: string;\n\t\tpushedBy: AzureUser;\n\t\tpushId: number;\n\t};\n\tremoteUrl: string;\n\tstatuses?: AzureGitStatus[];\n\ttreeId: string;\n\turl: string;\n\tworkItems?: AzureResourceRef[];\n}\n\nexport interface AzureResourceRef {\n\tid: string;\n\turl: string;\n}\n\nexport interface AzurePullRequestCompletionOptions {\n\tautoCompleteIgnoreConflicts: number[];\n\tbypassPolicy: boolean;\n\tbypassReason: string;\n\tdeleteSourceBranch: boolean;\n\tmergeCommitMessage: string;\n\tmergeStrategy: 'noFastForward' | 'rebase' | 'rebaseMerge' | 'squash';\n\tsquashMerge: boolean;\n\ttransitionWorkItems: boolean;\n\ttriggeredByAutoComplete: boolean;\n}\n\nexport interface AzureGitStatus {\n\tcontext: {\n\t\tname: string;\n\t\tgenre: string;\n\t};\n\tcreatedBy: AzureUser;\n\tcreateDate: string;\n\tdescription: string;\n\tstate: 'error' | 'failed' | 'notApplicable' | 'notSet' | 'pending' | 'succeeded';\n\ttargetUrl: string;\n\tupdateDate: string;\n}\n\nexport interface AzureGitForkRef {\n\tcreator: AzureUser;\n\tisLocked: boolean;\n\tisLockedBy: AzureUser;\n\tname: string;\n\tobjectId: string;\n\tpeeledObjectId: string;\n\trepository: AzureRepositoryReference;\n\tstatuses: AzureGitStatus[];\n\turl: string;\n}\n\nexport interface AzureWebApiTagDefinition {\n\tactive: boolean;\n\tid: string;\n\tname: string;\n\turl: string;\n}\n\nexport interface AzureGitPullRequestMergeOptions {\n\tconflictAuthorshipCommits: boolean;\n\tdetectRenameFalsePositives: boolean;\n\tdisableRenames: boolean;\n}\n\nexport type AzurePullRequestAsyncStatus =\n\t| 'conflicts'\n\t| 'failure'\n\t| 'notSet'\n\t| 'queued'\n\t| 'rejectedByPolicy'\n\t| 'succeeded';\n\nexport interface AzurePullRequest {\n\trepository: AzurePullRequestRepository;\n\tpullRequestId: number;\n\tcodeReviewId: number;\n\tstatus: AzurePullRequestStatus;\n\tcreatedBy: AzureUser;\n\tcreationDate: string;\n\tclosedDate?: string;\n\tclosedBy?: AzureUser; // Can be missed even if closedDate is presented.\n\ttitle: string;\n\tdescription: string;\n\tforkSource?: AzureGitForkRef;\n\tsourceRefName: string;\n\ttargetRefName: string;\n\tisDraft: boolean;\n\tmergeId: string;\n\tmergeStatus?: AzurePullRequestAsyncStatus;\n\tlastMergeCommit?: AzureGitCommitRef;\n\tlastMergeSourceCommit: AzureGitCommitRef;\n\tlastMergeTargetCommit: AzureGitCommitRef;\n\treviewers: AzureUserWithVote[];\n\turl: string;\n\tsupportsIterations: boolean;\n}\n\nexport interface AzurePullRequestWithLinks extends AzurePullRequest {\n\t_links: {\n\t\tself: AzureLink;\n\t\trepository: AzureLink;\n\t\tworkItems: AzureLink;\n\t\tsourceBranch: AzureLink;\n\t\ttargetBranch: AzureLink;\n\t\tstatuses: AzureLink;\n\t\tsourceCommit: AzureLink;\n\t\ttargetCommit: AzureLink;\n\t\tcreatedBy: AzureLink;\n\t\titerations: AzureLink;\n\t};\n\tartifactId: string;\n\tautoCompleteSetBy?: AzureUser;\n\tcommits?: AzureGitCommitRef[];\n\tcompletionOptions?: AzurePullRequestCompletionOptions;\n\tcompletionQueueTime?: string;\n\thasMultipleMergeBases?: boolean;\n\tlabels?: AzureWebApiTagDefinition[];\n\tmergeFailureMessage?: string;\n\tmergeFailureType?: 'caseSensitive' | 'none' | 'objectTooLarge' | 'unknown';\n\tmergeOptions?: AzureGitPullRequestMergeOptions;\n\tremoteUrl?: string;\n\tworkItemRefs?: AzureResourceRef[];\n}\n\nexport function getAzureDevOpsOwner(url: URL): string {\n\treturn url.pathname.split('/')[1];\n}\nexport function isVsts(domain: string): boolean {\n\treturn domain.toLowerCase().endsWith(vstsHostnameSuffix);\n}\n\n/**\n * Encodes one route segment of an Azure DevOps request (#5878): `encodeURIComponent` leaves a dot segment as is, and\n * the URL would resolve it away, re-scoping the request instead of failing it.\n */\nexport function encodeAzurePathSegment(value: string): string {\n\tif (value === '.' || value === '..') throw new Error(`Invalid Azure path segment '${value}'.`);\n\n\treturn encodeURIComponent(value);\n}\n\n/**\n * `baseUrl` and `owner` are the authoritative prefix used for the API request. The payload URL cannot supply that\n * prefix safely because it may address the repository by id or name an untrusted host.\n */\nfunction getAzureRepositoryWebUrl(baseUrl: string, owner: string, projectName: string, repoName: string): string {\n\tconst repoPath = `${encodeURIComponent(owner)}/${encodeURIComponent(projectName)}/_git/${encodeURIComponent(repoName)}`;\n\treturn `${trimTrailingSlashes(baseUrl)}/${repoPath}`;\n}\n\nexport function getAzurePullRequestWebUrl(pr: AzurePullRequest, baseUrl: string, owner: string): string {\n\tconst repoUrl = getAzureRepositoryWebUrl(baseUrl, owner, pr.repository.project.name, pr.repository.name);\n\treturn `${repoUrl}/pullrequest/${pr.pullRequestId}`;\n}\n\n/**\n * Whether `url` and `expected` are the two cloud spellings of one organization: a cloud organization answers on both\n * `dev.azure.com/{owner}` and the legacy `{owner}.visualstudio.com`, so those name the same host. Anything else is\n * somewhere we didn't ask.\n */\nfunction isSameAzureCloudOrganization(url: URL, expected: URL, expectedOwner: string): boolean {\n\tif (url.protocol !== expected.protocol) return false;\n\n\tconst owner = expectedOwner.toLowerCase();\n\tif (expected.hostname !== 'dev.azure.com' && !isVsts(expected.hostname)) return false;\n\n\tif (url.hostname === 'dev.azure.com') return getAzureDevOpsOwner(url).toLowerCase() === owner;\n\n\treturn url.hostname === `${owner}${vstsHostnameSuffix}`;\n}\n\n/**\n * Whether `url` sits under the collection the integration is configured to talk to — `{expectedUrl}/{expectedOwner}`.\n * A matching origin says nothing on its own: Azure organizations and self-hosted collections are path segments.\n */\nfunction isUnderAzureCollection(url: URL, expected: URL, expectedOwner: string): boolean {\n\tconst base = trimTrailingSlashes(expected.pathname);\n\tconst prefix = `${base}/${encodeURIComponent(expectedOwner)}/`.toLowerCase();\n\treturn `${url.pathname}/`.toLowerCase().startsWith(prefix);\n}\n\n/**\n * Restricts a provider-supplied repository URL to the integration's collection and removes credentials, query, and\n * fragment before a consumer can use it as a git remote. Takes the value as the payloads carry it — every one of\n * these URLs is optional — so a caller never has to spell the absent case itself.\n */\nexport function sanitizeAzureRepositoryUrl(\n\tvalue: string | undefined,\n\texpectedUrl: string,\n\texpectedOwner: string,\n): string | undefined {\n\tif (value == null) return undefined;\n\n\tlet expected: URL;\n\tlet url: URL;\n\ttry {\n\t\texpected = new URL(expectedUrl);\n\t\turl = new URL(value);\n\t} catch {\n\t\treturn undefined;\n\t}\n\n\tif (expected.protocol !== 'https:' && expected.protocol !== 'http:') return undefined;\n\tif (!expectedOwner) return undefined;\n\n\tif (url.origin === expected.origin) {\n\t\tif (!isUnderAzureCollection(url, expected, expectedOwner)) return undefined;\n\t} else if (!isSameAzureCloudOrganization(url, expected, expectedOwner)) {\n\t\treturn undefined;\n\t}\n\n\turl.username = '';\n\turl.password = '';\n\turl.search = '';\n\turl.hash = '';\n\treturn url.toString();\n}\n\n/**\n * The clone URL the payload carries for a repository, restricted to the integration's collection and then\n * cross-checked against the repository that payload names.\n *\n * The collection check alone is not enough for a URL that is READ rather than built. Every other repository URL the\n * model reports is built from the authoritative prefix, so the payload cannot move it; this one cannot be built,\n * because Azure spells a repository for git the same way it spells it for the web only by convention. A URL under\n * the right collection may still name a DIFFERENT repository in it, which would leave `cloneHttps` describing one\n * repository while `url` describes another.\n *\n * Azure ends a clone URL with `_git/{repo}` on every host style — including the short `{owner}/_git/{repo}` form it\n * uses when a repository carries its project's name, and the legacy `{owner}.visualstudio.com` spelling that has no\n * organization segment at all — so the repository name is the one part comparable across all of them. A same-named\n * repository in another project of the same organization is the single substitution this cannot catch.\n */\nfunction getAzureRepositoryCloneUrl(\n\trepository: AzureRepositoryReference,\n\tbaseUrl: string,\n\towner: string,\n): string | undefined {\n\tconst sanitized = sanitizeAzureRepositoryUrl(repository.remoteUrl, baseUrl, owner);\n\tif (sanitized == null) return undefined;\n\n\t// Safe to parse: `sanitizeAzureRepositoryUrl` returns what it already parsed.\n\tconst segments = new URL(sanitized).pathname.split('/').filter(s => s.length > 0);\n\tconst name = segments.pop();\n\tif (name == null || segments.pop() !== '_git') return undefined;\n\n\tlet decoded: string;\n\ttry {\n\t\tdecoded = decodeURIComponent(name);\n\t} catch {\n\t\treturn undefined;\n\t}\n\n\t// Azure resolves project and repository names case-insensitively, so comparing them any other way would refuse a\n\t// URL the provider considers the same one.\n\treturn decoded.toLowerCase() === repository.name.toLowerCase() ? sanitized : undefined;\n}\n\nexport function fromAzurePullRequestMergeStatusToMergeableState(\n\tmergeStatus: AzurePullRequestAsyncStatus,\n): PullRequestMergeableState {\n\tswitch (mergeStatus) {\n\t\tcase 'conflicts':\n\t\t\treturn PullRequestMergeableState.Conflicting;\n\t\tcase 'failure':\n\t\t\treturn PullRequestMergeableState.FailingChecks;\n\t\tcase 'rejectedByPolicy':\n\t\t\treturn PullRequestMergeableState.BlockedByPolicy;\n\t\tcase 'succeeded':\n\t\t\treturn PullRequestMergeableState.Mergeable;\n\t\tcase 'notSet':\n\t\tcase 'queued':\n\t\tdefault:\n\t\t\treturn PullRequestMergeableState.Unknown;\n\t}\n}\n\nexport function fromAzurePullRequestVoteToReviewState(vote: AzurePullRequestVote): PullRequestReviewState {\n\tswitch (vote) {\n\t\tcase 10:\n\t\tcase 5:\n\t\t\treturn PullRequestReviewState.Approved;\n\t\tcase 0:\n\t\t\treturn PullRequestReviewState.ReviewRequested;\n\t\tcase -5:\n\t\tcase -10:\n\t\t\treturn PullRequestReviewState.ChangesRequested;\n\t\tdefault:\n\t\t\treturn PullRequestReviewState.ReviewRequested;\n\t}\n}\n\nexport function fromAzureUserWithVoteToReviewer(reviewer: AzureUserWithVote): PullRequestReviewer {\n\treturn {\n\t\tisCodeOwner: undefined,\n\t\treviewer: {\n\t\t\tavatarUrl: reviewer.imageUrl,\n\t\t\tid: reviewer.id,\n\t\t\tname: reviewer.displayName,\n\t\t\tusername: reviewer.uniqueName,\n\t\t\turl: reviewer.url,\n\t\t},\n\t\tstate: fromAzurePullRequestVoteToReviewState(reviewer.vote ?? 0),\n\t};\n}\n\nexport function getAzurePullRequestReviewDecision(\n\tvotes: AzurePullRequestVote[],\n): PullRequestReviewDecision | undefined {\n\tconst reviewStates = votes.map(vote => fromAzurePullRequestVoteToReviewState(vote));\n\tif (reviewStates.includes(PullRequestReviewState.ChangesRequested)) {\n\t\treturn PullRequestReviewDecision.ChangesRequested;\n\t}\n\n\tif (reviewStates.includes(PullRequestReviewState.ReviewRequested)) {\n\t\treturn PullRequestReviewDecision.ReviewRequired;\n\t}\n\n\tif (reviewStates.includes(PullRequestReviewState.Approved)) {\n\t\treturn PullRequestReviewDecision.Approved;\n\t}\n\n\treturn undefined;\n}\n\nexport function fromAzureReviewerToPullRequestMember(reviewer: AzureUser): PullRequestMember {\n\treturn {\n\t\tavatarUrl: reviewer.imageUrl,\n\t\tid: reviewer.id,\n\t\tname: reviewer.displayName,\n\t\tusername: reviewer.uniqueName,\n\t\turl: reviewer.url,\n\t};\n}\n\nexport function normalizeAzureBranchName(branchName: string): string {\n\treturn branchName.startsWith('refs/heads/') ? branchName.replace('refs/heads/', '') : branchName;\n}\n\nfunction fromAzureUserToMember(user: AzureUser, type: 'issue'): IssueMember;\nfunction fromAzureUserToMember(user: AzureUser, type: 'pullRequest'): PullRequestMember;\nfunction fromAzureUserToMember(user: AzureUser, _type: 'issue' | 'pullRequest'): PullRequestMember | IssueMember {\n\treturn {\n\t\tavatarUrl: user.imageUrl,\n\t\tid: user.id,\n\t\tname: user.displayName,\n\t\tusername: user.uniqueName,\n\t\turl: user.url,\n\t};\n}\n\n/**\n * The URLs of a cross-repository pull request's fork, resolved by a lookup because the pull request payload embeds\n * only an abbreviated reference to it: `url` is the URL the head ref reports — the fork's web URL, or its clone URL\n * when the response carries no web URL — and `cloneHttps` its HTTPS clone URL.\n *\n * A fork that resolves neither is reported as no fork at all rather than as an object with nothing in it, so `url`\n * is always present here; `cloneHttps` alone is best-effort, and is absent when the response omits it or its URL\n * sits outside the integration's collection.\n */\nexport interface AzureForkRepositoryUrls {\n\turl: string;\n\tcloneHttps: string | undefined;\n}\n\n/**\n * `baseUrl` and `owner` are the prefix the pull request was read through; every URL the model reports is built from\n * them. The required `forkRepositoryUrls` argument makes each call site resolve the best-effort fork URLs explicitly.\n */\nexport function fromAzurePullRequest(\n\tpr: AzurePullRequest,\n\tprovider: Provider,\n\towner: string,\n\tbaseUrl: string,\n\tforkRepositoryUrls: AzureForkRepositoryUrls | undefined,\n\tprojection?: PullRequestProjection,\n): PullRequest {\n\tconst baseRepositoryUrl = getAzureRepositoryWebUrl(baseUrl, owner, pr.repository.project.name, pr.repository.name);\n\tconst baseCloneHttps = getAzureRepositoryCloneUrl(pr.repository, baseUrl, owner);\n\n\tconst forkRepository = pr.forkSource?.repository;\n\tconst headRepositoryUrl = forkRepository == null ? baseRepositoryUrl : forkRepositoryUrls?.url;\n\tconst headCloneHttps = forkRepository == null ? baseCloneHttps : forkRepositoryUrls?.cloneHttps;\n\n\tconst result = new PullRequest(\n\t\tprovider,\n\t\tfromAzureUserToMember(pr.createdBy, 'pullRequest'),\n\t\tpr.pullRequestId.toString(),\n\t\tpr.pullRequestId.toString(),\n\t\tpr.title,\n\t\tgetAzurePullRequestWebUrl(pr, baseUrl, owner),\n\t\t{\n\t\t\towner: owner,\n\t\t\trepo: pr.repository.name,\n\t\t\tid: pr.repository.id,\n\t\t},\n\t\tazurePullRequestStatusToState(pr.status),\n\t\tnew Date(pr.creationDate),\n\t\tnew Date(pr.closedDate || pr.creationDate),\n\t\tpr.closedDate ? new Date(pr.closedDate) : undefined,\n\t\tpr.closedDate && pr.status === 'completed' ? new Date(pr.closedDate) : undefined,\n\t\t// The read selects the merge status, so an absent one is Azure's own \"not set\", as provider-apis maps it.\n\t\tfromAzurePullRequestMergeStatusToMergeableState(pr.mergeStatus ?? 'notSet'),\n\t\tundefined,\n\t\t{\n\t\t\tbase: {\n\t\t\t\tbranch: pr.targetRefName ? normalizeAzureBranchName(pr.targetRefName) : '',\n\t\t\t\tsha: pr.lastMergeTargetCommit?.commitId ?? '',\n\t\t\t\trepo: pr.repository.name,\n\t\t\t\towner: owner,\n\t\t\t\texists: pr.targetRefName != null,\n\t\t\t\turl: baseRepositoryUrl,\n\t\t\t\tcloneHttps: baseCloneHttps,\n\t\t\t},\n\t\t\thead: {\n\t\t\t\tbranch: pr.sourceRefName ? normalizeAzureBranchName(pr.sourceRefName) : '',\n\t\t\t\tsha: pr.lastMergeSourceCommit?.commitId ?? '',\n\t\t\t\trepo: forkRepository?.name ?? pr.repository.name,\n\t\t\t\towner: owner,\n\t\t\t\texists: pr.sourceRefName != null,\n\t\t\t\turl: headRepositoryUrl,\n\t\t\t\tcloneHttps: headCloneHttps,\n\t\t\t},\n\t\t\tisCrossRepository: pr.forkSource != null,\n\t\t},\n\t\tpr.isDraft,\n\t\tundefined,\n\t\tundefined,\n\t\tundefined,\n\t\tundefined,\n\t\tgetAzurePullRequestReviewDecision(pr.reviewers?.filter(r => r.isRequired).map(r => r.vote ?? 0) ?? []),\n\t\tpr.reviewers.filter(r => r.vote == null || r.vote === 0).map(r => fromAzureUserWithVoteToReviewer(r)),\n\t\tpr.reviewers.filter(r => r.vote != null && r.vote !== 0).map(r => fromAzureUserWithVoteToReviewer(r)),\n\t\tpr.reviewers.map(r => fromAzureReviewerToPullRequestMember(r)),\n\t\tundefined,\n\t\t{\n\t\t\tid: pr.repository?.project?.id,\n\t\t\tname: pr.repository.project.name,\n\t\t\tresourceId: '', // TODO: This is a workaround until we can get the org id here.\n\t\t\tresourceName: owner,\n\t\t},\n\t\tundefined, // version\n\t\tundefined, // commitCount\n\t\tundefined, // stack\n\t\tundefined, // filesChanged\n\t\tundefined, // body\n\t\tundefined, // number\n\t\tundefined, // authoredByMe\n\t\tprojection,\n\t);\n\treturn copyReadProvenance(result, pr);\n}\n\nfunction fromAzureWorkItemUserToMember(user: AzureUser | string | undefined): IssueMember | undefined {\n\tif (user == null || (typeof user === 'string' && !user.trim())) return undefined;\n\n\treturn typeof user === 'string' ? { id: user, name: user, username: user } : fromAzureUserToMember(user, 'issue');\n}\n\nexport function fromAzureWorkItem(\n\tworkItem: WorkItem,\n\tprovider: Provider,\n\tproject: AzureProjectDescriptor,\n\tstateCategory?: AzureWorkItemStateCategory,\n\tprojection?: IssueProjection,\n\thtmlFields?: readonly AzureWorkItemHtmlField[],\n\t/** As `toIssueShape` takes it: `null` where the read couldn't resolve it. */\n\tviewer?: { id: string } | null,\n): Issue {\n\tconst state = workItem.fields['System.State'];\n\tconst description = getAzureWorkItemDescription(workItem.fields, htmlFields);\n\tconst closedDate = parseAzureWorkItemDate(workItem.fields['Microsoft.VSTS.Common.ClosedDate']) ?? undefined;\n\tconst normalizedState = azureWorkItemsStateCategoryToState(stateCategory, closedDate);\n\tconst author = fromAzureWorkItemUserToMember(workItem.fields['System.CreatedBy']);\n\tconst assignee = fromAzureWorkItemUserToMember(workItem.fields['System.AssignedTo']);\n\tconst assignees = assignee != null ? [assignee] : [];\n\tconst viewerFields = toIssueViewer({ author: author, assignees: assignees }, viewer);\n\tconst result = new Issue(\n\t\tprovider,\n\t\tworkItem.id.toString(),\n\t\tworkItem.id.toString(),\n\t\tworkItem.fields['System.Title'],\n\t\tworkItem._links.html.href,\n\t\tnew Date(workItem.fields['System.CreatedDate']),\n\t\tnew Date(workItem.fields['System.ChangedDate']),\n\t\tnormalizedState === 'closed',\n\t\tnormalizedState,\n\t\tauthor,\n\t\tassignees,\n\t\tundefined,\n\t\tclosedDate,\n\t\tundefined,\n\t\tworkItem.fields['System.CommentCount'],\n\t\tundefined,\n\t\tdescription?.value,\n\t\tproject,\n\t\tundefined,\n\t\tworkItem.fields['System.WorkItemType'],\n\t\ttypeof state === 'string' && state\n\t\t\t? { name: state, category: azureIssueStateCategory(stateCategory) }\n\t\t\t: undefined,\n\t\tundefined,\n\t\ttoWorkItemIterations(workItem.fields['System.IterationPath']),\n\t\tprojection,\n\t\tdescription != null ? toIssueBodyField(description.field) : undefined,\n\t\tviewerFields?.viewer,\n\t\tviewerFields?.viewerUnresolved,\n\t);\n\treturn copyReadProvenance(result, workItem);\n}\n\n/**\n * Azure reports the iteration as a backslash-delimited path rooted at the project. The project root is its default\n * for a work item with no sprint, so only a nested path names one; the path is the identity because Azure supplies\n * no iteration id here.\n *\n * Mirrors `normalizeIteration` in provider-apis so the same work item yields the same identity whether it is read\n * here or through the SDK. That contract keeps the path **verbatim** — it is what the iteration is matched back by,\n * so it is deliberately not trimmed — and trims only the display name.\n */\nfunction toWorkItemIterations(path: string | undefined): IssueIteration[] | undefined {\n\tif (!path) return undefined;\n\n\tconst segments = path.split('\\\\');\n\tif (segments.length < 2) return undefined;\n\n\tconst name = segments.at(-1)?.trim();\n\treturn name ? [{ id: path, name: name }] : undefined;\n}\n\n/**\n * A work item as `GET …/_apis/wit/workitems/{id}?$expand=Links` returns it. Loosely typed because\n * {@link fromAzureWorkItemToProviderIssue} checks every field it reads, as provider-apis does.\n */\nexport interface AzureWorkItemResponse {\n\tid?: unknown;\n\tfields?: Record<string, unknown>;\n\t_links?: { html?: { href?: unknown } };\n}\n\n/**\n * A cheap read's work item with the workflow category its state classifies to (see\n * {@link toAzureWorkItemEtagFields}). Beside the work item rather than on it, so the wire type stays what Azure sends.\n */\nexport interface AzureWorkItemEtagRead {\n\treadonly workItem: AzureWorkItemResponse;\n\treadonly category: IssueProviderState['category'];\n}\n\n/**\n * Converts a work item as provider-apis' `getIssuesForAzureProject` converts each row it reads, so a work item read\n * by id reaches `toIssueShape` identical to the list read's row for it. provider-apis exports neither that converter\n * nor a single work item read, so this mirrors it field for field; the batch issue tests compare the two, so a\n * provider-apis change that this misses fails there.\n *\n * `undefined` for a work item the SDK would skip: no positive integer id, no title, or no valid created date.\n * `state.name` is the raw `System.State`, as on every list read here, which passes the SDK no state-name map. Like\n * the SDK's row, the state carries no workflow category: `ProvidersApi` classifies both reads' rows the same way\n * afterwards, from the work item type's states.\n */\nexport function fromAzureWorkItemToProviderIssue(\n\tworkItem: AzureWorkItemResponse,\n\tnamespace: string,\n\tproject: string,\n\thtmlFields?: readonly AzureWorkItemHtmlField[],\n): ProviderIssue | undefined {\n\tconst fields = workItem.fields;\n\tconst id = workItem.id;\n\tconst title = fields?.['System.Title'];\n\tconst createdDate = parseAzureWorkItemDate(fields?.['System.CreatedDate']);\n\tif (\n\t\tfields == null ||\n\t\ttypeof id !== 'number' ||\n\t\t!Number.isSafeInteger(id) ||\n\t\tid <= 0 ||\n\t\ttypeof title !== 'string' ||\n\t\t!title.trim() ||\n\t\tcreatedDate == null\n\t) {\n\t\treturn undefined;\n\t}\n\n\tconst assignee = fromAzureWorkItemIdentity(fields['System.AssignedTo']);\n\tconst commentCount = fields['System.CommentCount'];\n\tconst url = workItem._links?.html?.href;\n\tconst tags = fields['System.Tags'];\n\tconst state = fields['System.State'];\n\tconst type = fields['System.WorkItemType'];\n\tconst result: ProviderIssue = {\n\t\tid: id.toString(),\n\t\tnumber: id.toString(),\n\t\ttitle: title,\n\t\tcommentCount: typeof commentCount === 'number' && Number.isFinite(commentCount) ? commentCount : null,\n\t\tauthor: fromAzureWorkItemIdentity(fields['System.CreatedBy']),\n\t\tclosedDate: parseAzureWorkItemDate(fields['Microsoft.VSTS.Common.ClosedDate']),\n\t\tcreatedDate: createdDate,\n\t\tupdatedDate: parseAzureWorkItemDate(fields['System.ChangedDate']),\n\t\turl: typeof url === 'string' ? url : null,\n\t\tassignees: assignee != null ? [assignee] : [],\n\t\t...toAzureWorkItemDescriptionFields(fields, htmlFields),\n\t\tstate: typeof state === 'string' && state ? { name: state, color: null } : null,\n\t\ttype: typeof type === 'string' ? type : null,\n\t\titeration: toAzureWorkItemIteration(fields['System.IterationPath']),\n\t\trepository: null,\n\t\tproject: { namespace: namespace, name: project, resourceId: null, key: null, id: null },\n\t\t// provider-apis fills 0, but work items have no reactions.\n\t\tupvoteCount: null,\n\t\tlabels: (typeof tags === 'string' ? tags.split(';') : []).map(tag => ({\n\t\t\tcolor: null,\n\t\t\tdescription: null,\n\t\t\tid: null,\n\t\t\tname: tag.trim(),\n\t\t})),\n\t};\n\treturn copyReadProvenance(result, workItem);\n}\n\nexport function toAzureWorkItemDescriptionFields(\n\tfields: Readonly<Record<string, unknown>> | null | undefined,\n\thtmlFields?: readonly AzureWorkItemHtmlField[],\n): Pick<ProviderIssue, 'description' | 'descriptionField'> {\n\tconst description = getAzureWorkItemDescription(fields, htmlFields);\n\treturn {\n\t\tdescription: description?.value ?? null,\n\t\t...(description != null ? { descriptionField: description.field } : {}),\n\t};\n}\n\n/** An identity field, as provider-apis maps it: `name` from `uniqueName`, `username` from `displayName`. */\nfunction fromAzureWorkItemIdentity(value: unknown): ProviderAccount | null {\n\tif (typeof value === 'string') {\n\t\tif (!value.trim()) return null;\n\n\t\treturn { id: value, name: value, username: value, email: null, avatarUrl: null, url: null };\n\t}\n\n\tconst identity = value as\n\t\t| { id?: unknown; uniqueName?: unknown; displayName?: unknown; _links?: { avatar?: { href?: unknown } } }\n\t\t| null\n\t\t| undefined;\n\tif (typeof identity?.id !== 'string' || !identity.id.trim()) return null;\n\n\tconst avatarUrl = identity._links?.avatar?.href;\n\treturn {\n\t\tavatarUrl: typeof avatarUrl === 'string' ? avatarUrl : null,\n\t\temail: null,\n\t\tid: identity.id,\n\t\tname: typeof identity.uniqueName === 'string' ? identity.uniqueName : null,\n\t\tusername: typeof identity.displayName === 'string' ? identity.displayName : null,\n\t\turl: null,\n\t};\n}\n\n/** Only a UTC ISO timestamp naming a real calendar date and time, as provider-apis accepts; anything else is `null`. */\nexport function parseAzureWorkItemDate(value: unknown): Date | null {\n\tif (typeof value !== 'string') return null;\n\n\tconst match = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.\\d{1,7})?Z$/.exec(value);\n\tif (match == null) return null;\n\n\tconst [year, month, day, hour, minute, second] = match.slice(1).map(Number);\n\tconst isLeapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n\tconst daysInMonth = [31, isLeapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\tif (month < 1 || month > 12 || day < 1 || day > daysInMonth[month - 1] || hour > 23 || minute > 59 || second > 59) {\n\t\treturn null;\n\t}\n\n\tconst date = new Date(value);\n\treturn Number.isNaN(date.getTime()) ? null : date;\n}\n\n/** The SDK's `iteration`, by the same path rule as {@link toWorkItemIterations}. */\nfunction toAzureWorkItemIteration(path: unknown): ProviderIssue['iteration'] {\n\tconst [iteration] = toWorkItemIterations(typeof path === 'string' ? path : undefined) ?? [];\n\treturn iteration != null ? { path: iteration.id, name: iteration.name } : undefined;\n}\n\n/**\n * The most ids one cheap work item read asks for: the most Azure DevOps' work item list (`GET …/_apis/wit/workitems`)\n * takes.\n */\nexport const azureWorkItemsEtagFieldsMaxIds = 200;\n\n/**\n * The fields the cheap work item read selects: only the ones a full row's etag reads, and the project the full read\n * checks the work item against. The state and type let the cheap read resolve the same workflow category as the full\n * read, from the same work item type states.\n */\nexport const azureWorkItemEtagFieldNames: readonly string[] = [\n\t'System.TeamProject',\n\t'System.State',\n\t'System.WorkItemType',\n\t'System.ChangedDate',\n\t'Microsoft.VSTS.Common.ClosedDate',\n];\n\n/**\n * A cheap read's work item, as the fields its full batch row's etag reads: `toIssueShape` closes the row the full\n * read builds (see {@link fromAzureWorkItemToProviderIssue}) from its known workflow category, falling back to a\n * closed date only when the category is unavailable. A historical date must not close a reopened work item.\n * Throws where the full read fails the work item: on one in another project than `project` (compared as Azure\n * compares names), and on a missing or unparseable change date, so the target falls through to the full read.\n */\nexport function toAzureWorkItemEtagFields(\n\tworkItem: AzureWorkItemResponse,\n\tproject: string,\n\tcategory: IssueProviderState['category'],\n): IssueEtagFields {\n\tconst fields = workItem.fields;\n\tconst teamProject = fields?.['System.TeamProject'];\n\tif (typeof teamProject !== 'string' || !teamProject.trim()) {\n\t\tthrow new Error(`Azure DevOps work item ${String(workItem.id)} has no project`);\n\t}\n\n\tif (teamProject.toLowerCase() !== project.toLowerCase()) {\n\t\tthrow new Error(\n\t\t\t`Azure DevOps work item ${String(workItem.id)} is in project '${teamProject}', not '${project}'`,\n\t\t);\n\t}\n\n\tconst updatedDate = parseAzureWorkItemDate(fields?.['System.ChangedDate']);\n\tif (updatedDate == null) {\n\t\tthrow new Error(`Azure DevOps returned work item ${String(workItem.id)} without a change date`);\n\t}\n\n\tconst state =\n\t\tcategory != null\n\t\t\t? isTerminalIssueStateCategory(category)\n\t\t\t\t? 'closed'\n\t\t\t\t: 'opened'\n\t\t\t: parseAzureWorkItemDate(fields?.['Microsoft.VSTS.Common.ClosedDate']) != null\n\t\t\t\t? 'closed'\n\t\t\t\t: undefined;\n\treturn {\n\t\tstate: state,\n\t\tupdatedDate: updatedDate,\n\t\tdescriptionRule: azureWorkItemDescriptionRule,\n\t\tviewerRule: azureWorkItemViewerRule,\n\t};\n}\n\ntype ProviderPullRequestState = Parameters<typeof fromProviderPullRequestState>[0];\ntype ProviderMergeableState = keyof typeof fromProviderPullRequestMergeableState;\ntype ProviderReviewState = keyof typeof fromPullRequestReviewDecision;\n\n// The tables below mirror provider-apis' (0.61.0) Azure DevOps pull request mapping behind `getPullRequestForRepo` (`Xe`\n// and its helpers in the bundle), which it doesn't export. A full batch row takes these values on through\n// `fromProviderPullRequest`, so the cheap check composes the same steps to compute the same etag.\n\n/** provider-apis' pull request `status` map (`bi`). It has no `notSet`, which therefore maps to `undefined`. */\nconst azurePullRequestProviderStates: Partial<Record<string, ProviderPullRequestState>> = {\n\tactive: GitPullRequestState.Open,\n\tcompleted: GitPullRequestState.Merged,\n\tabandoned: GitPullRequestState.Closed,\n};\n\n/** provider-apis' `mergeStatus` map (`Ti`); any other status, or none, is unknown. */\nconst azureMergeStatusProviderStates: Partial<Record<string, ProviderMergeableState>> = {\n\tconflicts: GitPullRequestMergeableState.Conflicts,\n\tfailure: GitPullRequestMergeableState.FailingChecks,\n\trejectedByPolicy: GitPullRequestMergeableState.Blocked,\n\tsucceeded: GitPullRequestMergeableState.Mergeable,\n};\n\n/** provider-apis' reviewer `vote` map (`Di`); any other vote reads as review requested. */\nconst azureVoteProviderReviewStates: Partial<Record<number, ProviderReviewState>> = {\n\t10: GitPullRequestReviewState.Approved,\n\t5: GitPullRequestReviewState.Approved,\n\t0: GitPullRequestReviewState.ReviewRequested,\n\t[-5]: GitPullRequestReviewState.ChangesRequested,\n\t[-10]: GitPullRequestReviewState.ChangesRequested,\n};\n\n/** provider-apis' reviewer mapping (`ve`), with the state its vote maps to: every reviewer, required or optional. */\nfunction toAzureProviderReview(reviewer: AzureUserWithVote): ProviderPullRequestReview {\n\treturn {\n\t\treviewer: {\n\t\t\tid: reviewer.id,\n\t\t\tname: reviewer.displayName ?? null,\n\t\t\tusername: (reviewer.uniqueName || reviewer.displayName) ?? null,\n\t\t\temail: null,\n\t\t\tavatarUrl: reviewer.imageUrl ?? null,\n\t\t\turl: null,\n\t\t},\n\t\tstate: toAzureProviderReviewState(reviewer),\n\t};\n}\n\nfunction toAzureProviderReviewState(reviewer: AzureUserWithVote): ProviderReviewState {\n\treturn azureVoteProviderReviewStates[reviewer.vote ?? 0] ?? GitPullRequestReviewState.ReviewRequested;\n}\n\n/**\n * A cheap read's pull request (the same `GET …/pullrequests/{id}` provider-apis sends), as the fields its full batch\n * row's etag reads: provider-apis' mapping (see the tables above), then `fromProviderPullRequest`'s. Azure DevOps\n * reports no update time, so provider-apis' `updatedDate` is the close time, else the creation time, which is why\n * the fields Azure changes without one are fingerprinted into the `revision`, from the values the full row ends up\n * with: provider-apis' title, description (`?? null`, which the row reads `?? undefined`) and target branch, and its\n * reviews, split into requests and completed reviews by `fromProviderPullRequest`'s own helpers.\n *\n * Throws where provider-apis' mapping throws, on a field it reads without a guard, so a pull request the full read\n * fails on falls through to it rather than matching an etag. A full row never carries a check rollup (provider-apis\n * maps none for Azure DevOps), so the `checks` include always reads `undefined`, as there.\n */\nexport function toAzurePullRequestEtagFields(\n\tpr: AzurePullRequest,\n\tetagIncludes: readonly PullRequestEtagInclude[],\n): PullRequestEtagFields {\n\tif (\n\t\tpr.pullRequestId == null ||\n\t\tpr.createdBy == null ||\n\t\tpr.repository?.project == null ||\n\t\tpr.lastMergeSourceCommit == null ||\n\t\tpr.lastMergeTargetCommit == null ||\n\t\t!Array.isArray(pr.reviewers) ||\n\t\tpr.reviewers.some(r => r == null) ||\n\t\ttypeof pr.url !== 'string' ||\n\t\ttypeof pr.sourceRefName !== 'string' ||\n\t\ttypeof pr.targetRefName !== 'string'\n\t) {\n\t\tthrow new Error(`Azure DevOps returned pull request ${String(pr.pullRequestId)} without a field it maps`);\n\t}\n\n\tconst reviews = pr.reviewers.map(toAzureProviderReview);\n\tconst fields: PullRequestEtagFields = {\n\t\t// `notSet` passes `undefined` here, as its full row does.\n\t\tstate: fromProviderPullRequestState(azurePullRequestProviderStates[pr.status] as ProviderPullRequestState),\n\t\tisDraft: pr.isDraft,\n\t\tupdatedDate: new Date(pr.closedDate || pr.creationDate),\n\t\theadSha: pr.lastMergeSourceCommit.commitId ?? '',\n\t\trevision: pullRequestRevision({\n\t\t\ttitle: pr.title,\n\t\t\tbody: pr.description ?? undefined,\n\t\t\trefs: { base: { branch: normalizeAzureBranchName(pr.targetRefName) } },\n\t\t\treviewRequests: toReviewRequests(reviews),\n\t\t\tlatestReviews: toCompletedReviews(reviews),\n\t\t}),\n\t};\n\n\tif (etagIncludes.includes('mergeable')) {\n\t\tconst mergeable =\n\t\t\t(pr.mergeStatus != null ? azureMergeStatusProviderStates[pr.mergeStatus] : undefined) ??\n\t\t\tGitPullRequestMergeableState.Unknown;\n\t\tfields.mergeableState = fromProviderPullRequestMergeableState[mergeable];\n\t}\n\n\tif (etagIncludes.includes('reviewDecision')) {\n\t\t// Only the required reviewers decide.\n\t\tconst decision = decideProviderReviewDecision(\n\t\t\tpr.reviewers.filter(r => r.isRequired).map(toAzureProviderReviewState),\n\t\t);\n\t\tfields.reviewDecision = decision ? fromPullRequestReviewDecision[decision] : undefined;\n\t}\n\n\treturn fields;\n}\n"],"mappings":";;;;;;;;;;AAqCA,MAAa,qBAAqB;;;;;;AAuClC,SAAgB,wBACf,UACiC;CACjC,QAAQ,UAAR;EACC,KAAK,WACJ,OAAO;EACR,KAAK;EACL,KAAK,YACJ,OAAO;EACR,KAAK,cACJ,OAAO;EACR,KAAK,YACJ,OAAO;EACR,SACC;CACF;AACD;AAEA,SAAgB,mCAAmC,UAA2D;CAC7G,OAAO,6BAA6B,wBAAwB,QAAQ,CAAC;AACtE;AAEA,SAAgB,mCACf,UACA,YACsC;CACtC,IAAI,wBAAwB,QAAQ,KAAK,MACxC,OAAO,mCAAmC,QAAQ,IAAI,WAAW;CAGlE,OAAO,cAAc,OAAO,WAAW,KAAA;AACxC;AA+FA,SAAgB,8BAA8B,QAAyD;CACtG,QAAQ,QAAR;EACC,KAAK,aACJ,OAAO;EACR,KAAK,aACJ,OAAO;EAGR,SACC,OAAO;CACT;AACD;AACA,SAAgB,+BAA+B,QAAyC;CACvF,OAAO,8BAA8B,MAAM,MAAM;AAClD;AA4MA,SAAgB,oBAAoB,KAAkB;CACrD,OAAO,IAAI,SAAS,MAAM,GAAG,CAAC,CAAC;AAChC;AACA,SAAgB,OAAO,QAAyB;CAC/C,OAAO,OAAO,YAAY,CAAC,CAAC,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YAClB,OAAO,GAAG,kBAAkB,YAC5B,OAAO,GAAG,kBAAkB,UAE5B,MAAM,IAAI,MAAM,sCAAsC,OAAO,GAAG,aAAa,EAAE,yBAAyB;CAGzG,MAAM,UAAU,GAAG,UAAU,IAAI,qBAAqB;CACtD,MAAM,SAAgC;EAErC,OAAO,6BAA6B,+BAA+B,GAAG,OAAmC;EACzG,SAAS,GAAG;EACZ,aAAa,IAAI,KAAK,GAAG,cAAc,GAAG,YAAY;EACtD,SAAS,GAAG,sBAAsB,YAAY;EAC9C,UAAU,oBAAoB;GAC7B,OAAO,GAAG;GACV,MAAM,GAAG,eAAe,KAAA;GACxB,MAAM,EAAE,MAAM,EAAE,QAAQ,yBAAyB,GAAG,aAAa,EAAE,EAAE;GACrE,gBAAgB,iBAAiB,OAAO;GACxC,eAAe,mBAAmB,OAAO;EAC1C,CAAC;CACF;CAEA,IAAI,aAAa,SAAS,WAAW,GAAG;EACvC,MAAM,aACJ,GAAG,eAAe,OAAO,+BAA+B,GAAG,eAAe,KAAA,MAC3ED,+BAA6B;EAC9B,OAAO,iBAAiB,sCAAsC;CAC/D;CAEA,IAAI,aAAa,SAAS,gBAAgB,GAAG;EAE5C,MAAM,WAAW,6BAChB,GAAG,UAAU,QAAO,MAAK,EAAE,UAAU,CAAC,CAAC,IAAI,0BAA0B,CACtE;EACA,OAAO,iBAAiB,WAAW,8BAA8B,YAAY,KAAA;CAC9E;CAEA,OAAO;AACR"}
|
|
@@ -8,15 +8,18 @@ import { RepositoryMetadata } from "../../../git/models/repositoryMetadata.js";
|
|
|
8
8
|
import { PullRequestUrlIdentity } from "../../../git/utils/pullRequest.utils.js";
|
|
9
9
|
import { AuthenticationSessionLike, ProviderAuthenticationSession, TokenWithInfo } from "../authentication/models.js";
|
|
10
10
|
import { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId } from "../constants.js";
|
|
11
|
+
import { IntegrationAuthenticationProviderDescriptor } from "../authentication/integrationAuthenticationProvider.js";
|
|
12
|
+
import { IssueEtagFields, IssueEtagInclude, PullRequestEtagFields, PullRequestEtagInclude } from "../reads/etag.js";
|
|
11
13
|
import { ProviderOrganization, ProviderWarningCause, ProviderWarningScope } from "../results.js";
|
|
14
|
+
import { SearchMyPullRequestsOptions, SearchPullRequestsOptions } from "../models/publicIntegration.js";
|
|
12
15
|
import { ProviderRefusal } from "../collectionMetadata.js";
|
|
13
|
-
import {
|
|
14
|
-
import { AzureOrganizationDescriptor, AzureProjectDescriptor, AzureProjectInputDescriptor, AzureRemoteRepositoryDescriptor, AzureRepositoryDescriptor } from "./azure/models.js";
|
|
16
|
+
import { AzureOrganizationDescriptor, AzureProjectDescriptor, AzureRemoteRepositoryDescriptor, AzureRepositoryDescriptor } from "./azure/models.js";
|
|
15
17
|
import { AccountWideIssuesResult, SearchMyIssuesOptions } from "../models/issueReads.js";
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
+
import "../models/integration.js";
|
|
19
|
+
import { ProviderApiCollectionResult, ProviderApiPagedResult, ProviderAzureResource, ProviderHierarchyResult, ProviderIssue, ProviderPullRequest, ProviderRepository } from "./models.js";
|
|
20
|
+
import { GitHostIntegration } from "../models/gitHostIntegration.js";
|
|
18
21
|
import { AzureDevOpsApi } from "./azure/azure.js";
|
|
19
|
-
import {
|
|
22
|
+
import { AzureProjectInputDescriptor } from "./utils.js";
|
|
20
23
|
import { CollectionScopeFailure, GitPullRequestState } from "@gitkraken/provider-apis";
|
|
21
24
|
//#region ../plus/integrations/src/providers/azureDevOps.d.ts
|
|
22
25
|
export declare function getAzureRepositoryApiBaseUrl(baseUrl: string, repo: Pick<AzureRepositoryDescriptor, 'owner' | 'virtualDirectory'>): string;
|
|
@@ -9,8 +9,9 @@ import { throwProviderError } from "./providerErrors.js";
|
|
|
9
9
|
import { throwIfCallerContractError, toCollectionScopeFailure } from "../collectionMetadata.js";
|
|
10
10
|
import "../providerFilters.js";
|
|
11
11
|
import { collectProviderPagedResult, flatSettledResultsOrThrow, mergeCollectionMetadata, resolveBranchPullRequests, selectBranchPullRequests } from "./utils/providerPaging.js";
|
|
12
|
-
import {
|
|
12
|
+
import { providersMetadata } from "./metadata.js";
|
|
13
13
|
import { toTokenWithInfo } from "../authentication/models.js";
|
|
14
|
+
import { fromProviderIssue, fromProviderPullRequest, getProviderPullRequestIdentity, isNativePullRequest, issueNamesPeople, providerPullRequestMatchesSearch, pullRequestNamesPeople, toIssueShape, toProviderIssueStates, toProviderPullRequestStates } from "./models.js";
|
|
14
15
|
import { toAzurePullRequestEtagFields, toAzureWorkItemEtagFields } from "./azure/models.js";
|
|
15
16
|
import { decodeAzurePathSegment, getAzurePullRequestIdentityFromMaybeUrl, getAzureRepositoryIdentity } from "./azure/azure.utils.js";
|
|
16
17
|
import { GitHostIntegration } from "../models/gitHostIntegration.js";
|