@gitkraken/core-gitlens 0.45.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -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/plus/git-github/api/github.d.ts +6 -1
- package/dist/plus/git-github/api/github.js +14 -4
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueWrites.d.ts +6 -1
- package/dist/plus/git-github/api/issueWrites.js +61 -31
- package/dist/plus/git-github/api/issueWrites.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 +13 -13
- package/dist/plus/integrations/index.d.ts +39 -24
- package/dist/plus/integrations/index.js +40 -8
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +15 -22
- package/dist/plus/integrations/integrationService.js +39 -12
- 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 +65 -17
- 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 +15 -4
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +10 -175
- package/dist/plus/integrations/models/integration.js +11 -72
- package/dist/plus/integrations/models/integration.js.map +1 -1
- 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 +252 -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.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 +11 -6
- package/dist/plus/integrations/providers/github.js +70 -26
- 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/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 +3 -2
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.d.ts +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
- 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 +3 -2
- package/dist/plus/integrations/providers/providersApi.js +2 -1
- 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 +3 -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 +1 -6
- package/dist/plus/integrations/utils/integration.utils.js +2 -9
- package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
- 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 +99 -16
- 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":"issuesIntegration.js","names":[],"sources":["../../../../../plus/integrations/src/models/issuesIntegration.ts"],"sourcesContent":["import type { Account } from '@gitlens/git/models/author.js';\nimport type { Issue, IssueShape } from '@gitlens/git/models/issue.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport { gate } from '@gitlens/utils/decorators/gate.js';\nimport { trace } from '@gitlens/utils/decorators/log.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { mapBounded, mapSettledBounded } from '@gitlens/utils/promise.js';\nimport type { ProviderAuthenticationSession, SessionPublication } from '../authentication/models.js';\nimport { failsEveryScope } from '../collectionMetadata.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { providerFanOutConcurrency } from '../constants.js';\nimport { toError } from '../errors.js';\nimport type { ProviderApiCollectionResult } from '../providers/models.js';\nimport type {\n\tBatchSlot,\n\tIntegration,\n\tIntegrationResult,\n\tIntegrationType,\n\tIssueEtagFields,\n\tIssueEtagInclude,\n} from './integration.js';\nimport { IntegrationBase, isReadSessionFailure } from './integration.js';\nimport type { IssuesForProjectOptions, ProjectIssuesDrain, ProjectIssuesRequest } from './issueReads.js';\n\n/**\n * Groups requests into searches of at most `maxPerSearch` projects sharing `searchKey`. Undefined, reading\n * every project on its own, when any request has no key, i.e. cannot be searched together with others.\n */\nexport function groupProjectIssuesSearches<P>(\n\trequests: readonly ProjectIssuesRequest<P>[],\n\tsearchKey: (request: ProjectIssuesRequest<P>) => string | undefined,\n\tmaxPerSearch: number = Number.POSITIVE_INFINITY,\n): number[][] | undefined {\n\tconst searchesByKey = new Map<string, number[][]>();\n\tfor (let index = 0; index < requests.length; index++) {\n\t\tconst key = searchKey(requests[index]);\n\t\tif (key == null) return undefined;\n\n\t\tlet searches = searchesByKey.get(key);\n\t\tif (searches == null) {\n\t\t\tsearches = [];\n\t\t\tsearchesByKey.set(key, searches);\n\t\t}\n\n\t\tlet search = searches.at(-1);\n\t\tif (search == null || search.length >= maxPerSearch) {\n\t\t\tsearch = [];\n\t\t\tsearches.push(search);\n\t\t}\n\t\tsearch.push(index);\n\t}\n\treturn [...searchesByKey.values()].flat();\n}\n\n/**\n * Splits one search's issues back to its projects, in the order of `projectKeys`. Undefined when an issue belongs to\n * no requested project (or `projectKeyOf` can't tell), since the split then can't be trusted and the search's\n * projects are read one by one instead.\n */\nexport function splitProjectIssuesSearch<I>(\n\tprojectKeys: readonly string[],\n\tissues: readonly I[],\n\tprojectKeyOf: (issue: I) => string | undefined,\n): I[][] | undefined {\n\tconst indexByKey = new Map(projectKeys.map((key, index) => [key, index]));\n\tconst split = projectKeys.map((): I[] => []);\n\tfor (const issue of issues) {\n\t\tconst key = projectKeyOf(issue);\n\t\tconst index = key != null ? indexByKey.get(key) : undefined;\n\t\tif (index == null) return undefined;\n\n\t\tsplit[index].push(issue);\n\t}\n\treturn split;\n}\n\nexport function isIssuesIntegration(integration: Integration): integration is IssuesIntegration {\n\treturn integration.type === 'issues';\n}\n\nfunction sessionPublicationKey(id: string, cloud: boolean | undefined): string {\n\treturn JSON.stringify([id, cloud]);\n}\n\nexport abstract class IssuesIntegration<\n\tID extends IntegrationIds = IntegrationIds,\n\tT extends ResourceDescriptor = ResourceDescriptor,\n> extends IntegrationBase<ID> {\n\treadonly type: IntegrationType = 'issues';\n\tprivate _discoverySequence = 0;\n\tprivate _globalRetirement = 0;\n\tprivate _primaryPublication = 0;\n\tprivate readonly _actualPublications = new Map<string, number>();\n\tprivate readonly _actualCredentials = new Map<string, { cloud: boolean; accessToken?: string }>();\n\tprivate readonly _retiredCredentialVariants = new Set<boolean>();\n\tprivate _discoveryDisposed = false;\n\tprivate readonly _selectorPublications = new Map<string, number>();\n\tprivate readonly _selectorSessions = new Map<string, { id: string; cloud?: boolean }>();\n\tprivate readonly _sessionPublications = new WeakMap<\n\t\tProviderAuthenticationSession,\n\t\tMap<string, { beforeGeneration: number; afterGeneration: number }>\n\t>();\n\n\toverride get discoveryGeneration(): number {\n\t\treturn this._discoverySequence;\n\t}\n\n\toverride getSessionDiscoveryGeneration(sessionId?: string, connectionId?: string, cloud?: boolean): number {\n\t\tconst actual =\n\t\t\tsessionId == null\n\t\t\t\t? 0\n\t\t\t\t: Math.max(\n\t\t\t\t\t\tthis._actualPublications.get(sessionPublicationKey(sessionId, undefined)) ?? 0,\n\t\t\t\t\t\t...(cloud == null ? [true, false] : [cloud]).map(\n\t\t\t\t\t\t\tvariant => this._actualPublications.get(sessionPublicationKey(sessionId, variant)) ?? 0,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\treturn Math.max(\n\t\t\tthis._globalRetirement,\n\t\t\tactual,\n\t\t\tconnectionId != null ? (this._selectorPublications.get(connectionId) ?? 0) : this._primaryPublication,\n\t\t);\n\t}\n\n\toverride invalidateDiscoveryCaches(): void {\n\t\tthis._globalRetirement = ++this._discoverySequence;\n\t\tthis.clearDiscoveryCaches();\n\t}\n\n\toverride invalidateDiscoveryForConnection(connectionId?: string): void {\n\t\tconst stamp = ++this._discoverySequence;\n\t\tif (connectionId != null) {\n\t\t\tthis._selectorPublications.set(connectionId, stamp);\n\t\t\tconst session = this._selectorSessions.get(connectionId);\n\t\t\tthis._actualPublications.set(\n\t\t\t\tsessionPublicationKey(session?.id ?? connectionId, session == null ? true : session.cloud),\n\t\t\t\tstamp,\n\t\t\t);\n\t\t} else {\n\t\t\tthis._primaryPublication = stamp;\n\t\t\tif (this._session != null) {\n\t\t\t\tthis._actualPublications.set(sessionPublicationKey(this._session.id, this._session.cloud), stamp);\n\t\t\t}\n\t\t}\n\t\tthis.clearDiscoveryCaches();\n\t}\n\n\tprotected captureDiscoveryLifetime(session: ProviderAuthenticationSession): () => boolean {\n\t\tconst { id, cloud } = session;\n\t\tconst key = sessionPublicationKey(id, cloud);\n\t\t// A caller can retain a resolved session across awaits that publish a different credential.\n\t\tconst ownsCredential =\n\t\t\t!this._discoveryDisposed &&\n\t\t\t(this._actualCredentials.has(key)\n\t\t\t\t? this._actualCredentials.get(key)?.accessToken === session.accessToken\n\t\t\t\t: !this._retiredCredentialVariants.has(cloud));\n\t\t// An explicit actual-session selector avoids retiring secondary ownership when only the primary changes.\n\t\tconst generation = this.getSessionDiscoveryGeneration(id, id, cloud);\n\t\treturn () => ownsCredential && this.getSessionDiscoveryGeneration(id, id, cloud) === generation;\n\t}\n\n\tprotected clearDiscoveryCaches(): void {}\n\n\toverride dispose(): void {\n\t\tthis._discoveryDisposed = true;\n\t\tfor (const [key, credential] of this._actualCredentials) {\n\t\t\tthis._actualCredentials.set(key, { cloud: credential.cloud });\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\tprotected override invalidatePublishedSession(publication: SessionPublication, affectsPrimary: boolean): void {\n\t\tconst stamp = ++this._discoverySequence;\n\t\tconst cloud = publication.session != null ? publication.session.cloud : publication.cloud;\n\t\tif (publication.retireAll) {\n\t\t\tconst variants = cloud == null ? [true, false] : [cloud];\n\t\t\tfor (const variant of variants) {\n\t\t\t\tthis._retiredCredentialVariants.add(variant);\n\t\t\t}\n\t\t\tfor (const [key, credential] of this._actualCredentials) {\n\t\t\t\tif (variants.includes(credential.cloud)) {\n\t\t\t\t\tthis._actualCredentials.set(key, { cloud: credential.cloud });\n\t\t\t\t\tthis._actualPublications.set(key, stamp);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._globalRetirement = stamp;\n\t\t\tthis.clearDiscoveryCaches();\n\t\t}\n\t\tfor (const id of [publication.session?.id, publication.previousSessionId]) {\n\t\t\tif (id != null) {\n\t\t\t\tthis._actualPublications.set(sessionPublicationKey(id, cloud), stamp);\n\t\t\t\tfor (const variant of cloud == null ? [true, false] : [cloud]) {\n\t\t\t\t\tthis._actualCredentials.set(sessionPublicationKey(id, variant), {\n\t\t\t\t\t\tcloud: variant,\n\t\t\t\t\t\taccessToken: id === publication.session?.id ? publication.session.accessToken : undefined,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (publication.connectionId != null) {\n\t\t\tthis._selectorPublications.set(publication.connectionId, stamp);\n\t\t\tif (publication.session != null) {\n\t\t\t\tthis._selectorSessions.set(publication.connectionId, {\n\t\t\t\t\tid: publication.session.id,\n\t\t\t\t\tcloud: publication.session.cloud,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tif (affectsPrimary) {\n\t\t\tthis._primaryPublication = stamp;\n\t\t\tthis.clearDiscoveryCaches();\n\t\t}\n\t}\n\n\toverride onSessionPublishing(publication: SessionPublication): void {\n\t\tif (this._discoveryDisposed) return;\n\n\t\tconst session = publication.session;\n\t\tconst transitions = session != null ? (this._sessionPublications.get(session) ?? new Map()) : undefined;\n\t\tconst selectors = new Set([\n\t\t\t...(transitions?.keys() ?? []),\n\t\t\t'',\n\t\t\tpublication.connectionId ?? '',\n\t\t\tsession?.id ?? '',\n\t\t]);\n\t\tconst before = new Map(\n\t\t\tArray.from(selectors, selector => [\n\t\t\t\tselector,\n\t\t\t\tthis.getSessionDiscoveryGeneration(session?.id, selector || undefined, session?.cloud),\n\t\t\t]),\n\t\t);\n\t\tsuper.onSessionPublishing(publication);\n\t\tif (session == null || transitions == null) return;\n\n\t\tfor (const selector of selectors) {\n\t\t\tconst beforeGeneration = before.get(selector)!;\n\t\t\tconst previous = transitions.get(selector);\n\t\t\ttransitions.set(selector, {\n\t\t\t\tbeforeGeneration:\n\t\t\t\t\tprevious?.afterGeneration === beforeGeneration ? previous.beforeGeneration : beforeGeneration,\n\t\t\t\tafterGeneration: this.getSessionDiscoveryGeneration(session.id, selector || undefined, session.cloud),\n\t\t\t});\n\t\t}\n\t\tthis._sessionPublications.set(session, transitions);\n\t}\n\n\tprivate isResolvedDiscoverySessionCurrent(\n\t\tsession: ProviderAuthenticationSession,\n\t\tstartingGeneration: number,\n\t\tconnectionId: string | undefined,\n\t): boolean {\n\t\tif (!connectionId && session !== this._session) return false;\n\t\treturn this.isResolvedSessionCurrent(session, startingGeneration, connectionId);\n\t}\n\n\tprotected override isResolvedSessionCurrent(\n\t\tsession: ProviderAuthenticationSession | undefined,\n\t\tstartingGeneration: number,\n\t\tconnectionId?: string,\n\t): boolean {\n\t\tif (session == null) return startingGeneration === this.discoveryGeneration;\n\n\t\tconst current = this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud);\n\t\tif (current <= startingGeneration) return true;\n\n\t\t// Only this resolution's publications may bridge a retirement boundary.\n\t\tconst publication = this._sessionPublications.get(session)?.get(connectionId ?? '');\n\t\treturn (\n\t\t\tpublication != null &&\n\t\t\tpublication.beforeGeneration <= startingGeneration &&\n\t\t\tpublication.afterGeneration === current\n\t\t);\n\t}\n\n\tget supportsIssueLookupByResourceId(): boolean {\n\t\treturn this.getProviderIssueByResourceId != null;\n\t}\n\n\t/**\n\t * Whether this tracker has the cheap check behind the batch issue read's etags\n\t * ({@link getProviderIssuesEtagFieldsByResourceId}). The read decides before calling anything, so a tracker without\n\t * one makes one call.\n\t */\n\tget supportsIssueEtagsByResourceId(): boolean {\n\t\treturn this.getProviderIssuesEtagFieldsByResourceId != null;\n\t}\n\n\t/**\n\t * Result-returning wrapper for the BATCH tracker issue read: resolves several `(resourceId, identifier)` targets\n\t * with one {@link getProviderIssueByResourceId} request each, run with bounded concurrency. One settled slot per\n\t * input target: `fulfilled` with `undefined` means the issue does not exist or is not visible to this token;\n\t * `rejected` means that target could not be checked, never that it is absent.\n\t *\n\t * Failure isolation happens PER TARGET, mirroring `GitHostIntegration.getPullRequestsBatchResult`: the whole\n\t * call counts as a failure against the integration's request-exception budget only when EVERY slot rejected,\n\t * and not even then when a credential that checks out was refused by each target's own resource\n\t * (`settleBatchRefusals`), so a batch of mostly-good targets never spends more than one strike. A batch read with\n\t * etags makes up to two such calls (a full read of the targets without an etag, and a full read of the ones that\n\t * changed), so it can spend two; its cheap check ({@link getIssuesEtagFieldsByResourceIdBatchResult}) spends\n\t * nothing unless the credential is refused.\n\t *\n\t * Uncached on purpose: the caller owns caching, as with the git hosts' batch reads.\n\t */\n\tasync getIssuesByResourceIdBatchResult(\n\t\ttargets: readonly { resourceId: string; identifier: string; resourceUrl?: string }[],\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<BatchSlot<IssueShape | undefined>[] | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\tconst getProviderIssue = this.getProviderIssueByResourceId;\n\t\tif (getProviderIssue == null) return { value: undefined };\n\n\t\tconst start = performance.now();\n\t\ttry {\n\t\t\tconst slots = await mapSettledBounded(targets, providerFanOutConcurrency, t =>\n\t\t\t\tgetProviderIssue.call(this, session, t.resourceId, t.identifier, t.resourceUrl),\n\t\t\t);\n\n\t\t\tconst settled = await this.settleBatchRefusals(session, targets, slots);\n\n\t\t\tthis.resetRequestExceptionCount('getIssue', connectionId);\n\t\t\treturn { value: settled, duration: performance.now() - start };\n\t\t} catch (ex) {\n\t\t\tthis.handleProviderException('getIssue', ex, { scope: scope, connectionId: connectionId });\n\t\t\treturn { error: toError(ex), duration: performance.now() - start };\n\t\t}\n\t}\n\n\tprotected getProviderIssueByResourceId?(\n\t\t_session: ProviderAuthenticationSession,\n\t\t_resourceId: string,\n\t\t_id: string,\n\t\t_resourceUrl: string | undefined,\n\t): Promise<Issue | undefined>;\n\n\t/**\n\t * Result-returning wrapper for the cheap check behind the batch tracker issue read's etags: each target's change\n\t * state ({@link IssueEtagFields}), in ONE call to {@link getProviderIssuesEtagFieldsByResourceId}, which is handed\n\t * `options.etagIncludes` as the git hosts' check is. The slots mean\n\t * what {@link getIssuesByResourceIdBatchResult}'s do — `fulfilled` with `undefined` is a PROVEN ABSENCE, `rejected`\n\t * means that target could not be checked. Failures are judged and budgeted as in\n\t * `GitHostIntegration.getIssuesEtagFieldsResult`: every slot comes back as it settled, even when none answered, and\n\t * only a refused credential fails the call or spends a strike.\n\t */\n\tasync getIssuesEtagFieldsByResourceIdBatchResult(\n\t\ttargets: readonly { resourceId: string; identifier: string; resourceUrl?: string }[],\n\t\toptions: { etagIncludes?: readonly IssueEtagInclude[] },\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<BatchSlot<IssueEtagFields | undefined>[] | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\tconst getProviderEtagFields = this.getProviderIssuesEtagFieldsByResourceId;\n\t\tif (getProviderEtagFields == null) return { value: undefined };\n\n\t\tconst start = performance.now();\n\t\ttry {\n\t\t\tconst slots = await getProviderEtagFields.call(this, session, targets, options);\n\t\t\tif (slots == null) return { value: undefined, duration: performance.now() - start };\n\n\t\t\tconst settled = await this.settleBatchRefusals(session, targets, slots, { keepOtherFailures: true });\n\n\t\t\tif (slots.some(slot => slot.status === 'fulfilled')) {\n\t\t\t\tthis.resetRequestExceptionCount('getIssuesEtagFields', connectionId);\n\t\t\t}\n\t\t\treturn { value: settled, duration: performance.now() - start };\n\t\t} catch (ex) {\n\t\t\tthis.handleEtagCheckException('getIssuesEtagFields', ex, { scope: scope, connectionId: connectionId });\n\t\t\treturn { error: toError(ex), duration: performance.now() - start };\n\t\t}\n\t}\n\n\t/**\n\t * OPTIONAL: the cheap check behind the batch tracker issue read's etags — one settled slot per input target, in\n\t * order, holding the issue's change state in the vocabulary {@link getProviderIssueByResourceId}'s issues end in,\n\t * so both reads compute the same etag. `fulfilled` with `undefined` is a PROVEN ABSENCE, as there; a tracker whose\n\t * cheap read can't prove one rejects the slot instead, so the full read decides. `undefined` declines the whole\n\t * check, sending every target to the full read without counting as a failure. A tracker implements this only\n\t * where it is cheaper than the full read. No tracker's row carries a real reaction count, so `'reactions'` in\n\t * `options.etagIncludes` reads nothing here.\n\t */\n\tprotected getProviderIssuesEtagFieldsByResourceId?(\n\t\tsession: ProviderAuthenticationSession,\n\t\ttargets: readonly { resourceId: string; identifier: string; resourceUrl?: string }[],\n\t\toptions: { etagIncludes?: readonly IssueEtagInclude[] },\n\t): Promise<PromiseSettledResult<IssueEtagFields | undefined>[] | undefined>;\n\n\t@trace()\n\tasync getAccountForResource(resource: T, connectionId?: string): Promise<Account | undefined> {\n\t\treturn (await this.getAccountForResourceResult(resource, connectionId))?.value;\n\t}\n\n\t/**\n\t * Result-returning core of {@link getAccountForResource}. Recovers a thrown error into `{ error }` so\n\t * callers can preserve its classification (e.g. a 401/403 → an `auth` warning that drives re-auth)\n\t * instead of collapsing every failure into an untyped `undefined`. Gated here (not on the wrapper) so\n\t * direct callers such as the ProviderBackend facade share the same dedup as `getAccountForResource`.\n\t */\n\t@gate()\n\tasync getAccountForResourceResult(\n\t\tresource: T,\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<Account | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\ttry {\n\t\t\tconst account = await this.getProviderAccountForResource(session, resource);\n\t\t\tthis.resetRequestExceptionCount('getAccountForResource', connectionId);\n\t\t\treturn { value: account };\n\t\t} catch (ex) {\n\t\t\tthis.handleProviderException('getAccountForResource', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\tprotected abstract getProviderAccountForResource(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresource: T,\n\t): Promise<Account | undefined>;\n\n\t@trace()\n\tasync getResourcesForUser(connectionId?: string): Promise<T[] | undefined> {\n\t\treturn (await this.getResourcesForUserResult(connectionId))?.value;\n\t}\n\n\t/**\n\t * Result-returning core of {@link getResourcesForUser}. Recovers thrown errors into `{ error }` so callers\n\t * can surface them as warnings rather than silently swallowing them to `undefined`. Deduped here (not on the\n\t * wrapper) so direct callers such as the ProviderBackend facade share the same dedup as `getResourcesForUser`.\n\t */\n\tgetResourcesForUserResult(connectionId?: string): Promise<IntegrationResult<T[] | undefined>> {\n\t\t// Joined only within a discovery generation: a read started after a drop (a forced refresh) must not take the\n\t\t// lookup a read made before it, which answers with the resources as they were then (#6162). An empty\n\t\t// connectionId reads the primary, so it shares the primary's lookup.\n\t\treturn this.getResourcesForUserResultCore(connectionId || undefined, this.discoveryGeneration);\n\t}\n\n\t@gate()\n\tprivate async getResourcesForUserResultCore(\n\t\tconnectionId: string | undefined,\n\t\t_discoveryGeneration: number,\n\t): Promise<IntegrationResult<T[] | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\ttry {\n\t\t\tconst resources = await this.getProviderResourcesForUser(session);\n\t\t\tthis.resetRequestExceptionCount('getResourcesForUser', connectionId);\n\t\t\treturn { value: resources };\n\t\t} catch (ex) {\n\t\t\tthis.handleProviderException('getResourcesForUser', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\tprotected abstract getProviderResourcesForUser(session: ProviderAuthenticationSession): Promise<T[] | undefined>;\n\n\t/**\n\t * Project discovery for a set of resources, returning the SDK collection `{ values, metadata }` (completeness\n\t * + per-resource failures) so callers can warn on failed resources and set `fetchFailed` without discarding\n\t * the resources that succeeded. Thrown errors are recovered into `{ error }` for the same reason: a caller\n\t * surfaces them as a warning rather than swallowing them to `undefined`.\n\t */\n\t@trace()\n\tasync getProjectsForResourcesWithMetadataResult(\n\t\tresources: T[],\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<ProviderApiCollectionResult<T> | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\tconst startingGeneration = this.discoveryGeneration;\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\t\t// Primary resolution can refresh its own session before discovery starts.\n\t\tif (!this.isResolvedDiscoverySessionCurrent(session, startingGeneration, connectionId)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst generation = this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud);\n\n\t\ttry {\n\t\t\tconst projects = await this.getProviderProjectsForResourcesWithMetadata(session, resources);\n\t\t\t// Existing cached readers keep their snapshot after invalidation without changing the replacement session.\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn { value: projects };\n\t\t\t}\n\n\t\t\tawait this.confirmScopedAuthFailures(session, projects.metadata);\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn { value: projects };\n\t\t\t}\n\n\t\t\tthis.resetRequestExceptionCount('getProjectsForResources', connectionId);\n\t\t\treturn { value: projects };\n\t\t} catch (ex) {\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tthis.handleProviderException('getProjectsForResources', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\t/**\n\t * Metadata-aware provider project discovery. The default wraps the array-returning\n\t * {@link getProviderProjectsForResources} in `{ values }`, so providers without a fan-out completeness signal\n\t * (Jira Data Center, Trello) need no change; a read that returned no data is `unknown`, not an empty project list.\n\t * Jira Cloud and Linear override it to preserve their completeness/failures.\n\t */\n\tprotected async getProviderProjectsForResourcesWithMetadata(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources: T[],\n\t): Promise<ProviderApiCollectionResult<T>> {\n\t\treturn toProjectsCollection(await this.getProviderProjectsForResources(session, resources));\n\t}\n\n\tprotected abstract getProviderProjectsForResources(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources: T[],\n\t): Promise<T[] | undefined>;\n\n\t/**\n\t * The resources, and the projects of those `projectsOf` keeps, as the provider lists them now. For a read that must\n\t * not take a cached list for the current one: what it decides from this snapshot (that a selection is gone) would\n\t * be wrong for as long as the cache is stale. Shares nothing with the cached discovery: joins no read in flight,\n\t * reads and writes no cache, so it can neither be answered by a read started before what it needs to see, nor put\n\t * its answer into a cache a concurrent read relies on. `projects` is omitted when no resource list came back.\n\t */\n\t@trace()\n\tasync getUncachedDiscoveryResult(\n\t\tprojectsOf: (resource: T) => boolean,\n\t\tconnectionId?: string,\n\t): Promise<\n\t\tIntegrationResult<\n\t\t\t| {\n\t\t\t\t\tresources: T[] | undefined;\n\t\t\t\t\tprojects?: ProviderApiCollectionResult<T>;\n\t\t\t\t\tgeneration: number;\n\t\t\t\t\tsessionId: string;\n\t\t\t\t\tsessionCloud?: boolean;\n\t\t\t }\n\t\t\t| undefined\n\t\t>\n\t> {\n\t\tconst scope = getScopedLogger();\n\t\tconst startingGeneration = this.discoveryGeneration;\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\t\tif (!this.isResolvedDiscoverySessionCurrent(session, startingGeneration, connectionId)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst generation = this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud);\n\n\t\ttry {\n\t\t\t// Reset on success as the cached reads are, so a refusal a re-sync healed doesn't count toward a disconnect.\n\t\t\tconst resources = await this.getProviderUncachedResourcesForUser(session);\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tthis.resetRequestExceptionCount('getResourcesForUser', connectionId);\n\t\t\tif (resources == null) {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tresources: undefined,\n\t\t\t\t\t\tgeneration: generation,\n\t\t\t\t\t\tsessionId: session.id,\n\t\t\t\t\t\tsessionCloud: session.cloud,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst projects = await this.getProviderUncachedProjectsForResourcesWithMetadata(\n\t\t\t\tsession,\n\t\t\t\tresources.filter(projectsOf),\n\t\t\t);\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tawait this.confirmScopedAuthFailures(session, projects.metadata);\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tthis.resetRequestExceptionCount('getProjectsForResources', connectionId);\n\t\t\treturn {\n\t\t\t\tvalue: {\n\t\t\t\t\tresources: resources,\n\t\t\t\t\tprojects: projects,\n\t\t\t\t\tgeneration: generation,\n\t\t\t\t\tsessionId: session.id,\n\t\t\t\t\tsessionCloud: session.cloud,\n\t\t\t\t},\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tthis.handleProviderException('getProjectsForResources', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\t/**\n\t * {@link getAccountForResourceResult} asked of the provider now, joining no lookup in flight and served from no\n\t * account it lends: a lookup started before the credential was revoked would vouch for it.\n\t */\n\t@trace()\n\tasync getUncachedAccountForResourceResult(\n\t\tresource: T,\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<Account | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\ttry {\n\t\t\tconst account = await this.getProviderUncachedAccountForResource(session, resource);\n\t\t\tthis.resetRequestExceptionCount('getAccountForResource', connectionId);\n\t\t\treturn { value: account };\n\t\t} catch (ex) {\n\t\t\tthis.handleProviderException('getAccountForResource', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\t/** The account, asked of the provider; the default is {@link getProviderAccountForResource}, which lends none. */\n\tprotected getProviderUncachedAccountForResource(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresource: T,\n\t): Promise<Account | undefined> {\n\t\treturn this.getProviderAccountForResource(session, resource);\n\t}\n\n\t/**\n\t * The provider's resources, read past any cache it keeps and without storing into it. The default is\n\t * {@link getProviderResourcesForUser}, right for a provider that keeps none.\n\t */\n\tprotected getProviderUncachedResourcesForUser(session: ProviderAuthenticationSession): Promise<T[] | undefined> {\n\t\treturn this.getProviderResourcesForUser(session);\n\t}\n\n\t/**\n\t * The projects of `resources`, read past any cache the provider keeps and without storing into it. The default is\n\t * {@link getProviderProjectsForResourcesWithMetadata}, right for a provider that keeps none.\n\t */\n\tprotected getProviderUncachedProjectsForResourcesWithMetadata(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources: T[],\n\t): Promise<ProviderApiCollectionResult<T>> {\n\t\treturn this.getProviderProjectsForResourcesWithMetadata(session, resources);\n\t}\n\n\t@trace()\n\tasync getIssuesForProject(\n\t\tproject: T,\n\t\toptions?: IssuesForProjectOptions,\n\t\tconnectionId?: string,\n\t): Promise<IssueShape[] | undefined> {\n\t\treturn (await this.getIssuesForProjectResult(project, options, connectionId))?.value;\n\t}\n\n\t/**\n\t * Result-returning core of {@link getIssuesForProject}. Recovers thrown errors into `{ error }` so callers\n\t * (e.g. the ProviderBackend facade) can surface a per-provider warning instead of a silent empty read —\n\t * important for providers that throw on unsupported operations (e.g. Linear's not-implemented issue read).\n\t */\n\tasync getIssuesForProjectResult(\n\t\tproject: T,\n\t\toptions?: IssuesForProjectOptions,\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<IssueShape[] | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\ttry {\n\t\t\tconst issues = await this.getProviderIssuesForProject(session, project, options);\n\t\t\tthis.resetRequestExceptionCount('getIssuesForProject', connectionId);\n\t\t\treturn { value: issues };\n\t\t} catch (ex) {\n\t\t\tthis.handleProviderException('getIssuesForProject', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\t/**\n\t * Truncation-aware variant of {@link getIssuesForProjectResult}. A provider that drains a project's issues\n\t * with an internal page backstop (Jira/Linear) overrides {@link getProviderIssuesForProjectWithTruncation}\n\t * to report when that backstop was hit, so the facade can surface an incomplete project read instead of\n\t * publishing it as complete. The default reports `truncated: false`.\n\t */\n\tasync getIssuesForProjectWithTruncationResult(\n\t\tproject: T,\n\t\toptions?: IssuesForProjectOptions,\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<ProjectIssuesDrain | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\ttry {\n\t\t\tconst result = await this.getProviderIssuesForProjectWithTruncation(session, project, options);\n\t\t\tawait this.confirmScopedAuthFailures(session, result?.metadata);\n\t\t\tthis.resetRequestExceptionCount('getIssuesForProject', connectionId);\n\t\t\treturn { value: result };\n\t\t} catch (ex) {\n\t\t\tthis.handleProviderException('getIssuesForProject', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\t/**\n\t * Reads several projects' issues, one result per request in request order, each with the contract of\n\t * {@link getIssuesForProjectWithTruncationResult}, so one project failing leaves its siblings readable.\n\t *\n\t * A tracker that can read several projects in one query (Jira, Linear) groups them through\n\t * {@link getProjectIssuesSearches}, so a project with none of the user's issues costs no request of its own.\n\t * Every other request, and every project of a search that did not complete, is read on its own.\n\t *\n\t * A search's pages are global to its project set, so only a search that completes says something about each\n\t * of its projects: one that does not, or that fails for a reason that may be one project's\n\t * ({@link failsEveryScope}), is read again project by project, which reports completeness, failures and\n\t * retries per project. Only a failure every project would hit on its own read too fails them all at once.\n\t */\n\tasync getIssuesForProjectsWithTruncationResult(\n\t\trequests: readonly ProjectIssuesRequest<T>[],\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<ProjectIssuesDrain | undefined>[]> {\n\t\tconst searches = this.getProjectIssuesSearches(requests);\n\t\tif (searches == null) return this.readProjectsOneByOne(requests, connectionId);\n\n\t\tconst scope = getScopedLogger();\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) {\n\t\t\treturn requests.map(() => session && { error: session.error });\n\t\t}\n\n\t\tconst results: IntegrationResult<ProjectIssuesDrain | undefined>[] = requests.map(() => undefined);\n\t\tconst unsearchedIndices: number[] = [];\n\t\tawait mapBounded(searches, providerFanOutConcurrency, async indices => {\n\t\t\ttry {\n\t\t\t\tconst values = await this.searchProviderProjectIssues(\n\t\t\t\t\tsession,\n\t\t\t\t\tindices.map(index => requests[index]),\n\t\t\t\t);\n\t\t\t\tif (values == null) {\n\t\t\t\t\tunsearchedIndices.push(...indices);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.resetRequestExceptionCount('getIssuesForProject', connectionId);\n\t\t\t\tindices.forEach((index, i) => {\n\t\t\t\t\tresults[index] = { value: { values: values[i], truncated: false } };\n\t\t\t\t});\n\t\t\t} catch (ex) {\n\t\t\t\tif (!failsEveryScope(ex)) {\n\t\t\t\t\tLogger.warn(scope, `Project search failed (${String(ex)}); reading its projects one by one`);\n\t\t\t\t\tunsearchedIndices.push(...indices);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.handleProviderException('getIssuesForProject', ex, { connectionId: connectionId });\n\t\t\t\tconst error = toError(ex);\n\t\t\t\tfor (const index of indices) {\n\t\t\t\t\tresults[index] = { error: error };\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// After every search rather than inside each, so the fallback reads share one concurrency bound.\n\t\tif (unsearchedIndices.length > 0) {\n\t\t\tconst fallback = await this.readProjectsOneByOne(\n\t\t\t\tunsearchedIndices.map(index => requests[index]),\n\t\t\t\tconnectionId,\n\t\t\t);\n\t\t\tunsearchedIndices.forEach((index, i) => {\n\t\t\t\tresults[index] = fallback[i];\n\t\t\t});\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Groups requests into searches, as lists of request indices, that {@link searchProviderProjectIssues} can read\n\t * in one query each. Undefined reads every project on its own, which is the default.\n\t */\n\tprotected getProjectIssuesSearches(_requests: readonly ProjectIssuesRequest<T>[]): number[][] | undefined {\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Reads the projects of one search in one query: each project's issues in request order, or undefined when the\n\t * query did not complete, which reads them one by one instead. A throw is classified by {@link failsEveryScope}.\n\t */\n\tprotected searchProviderProjectIssues(\n\t\t_session: ProviderAuthenticationSession,\n\t\t_requests: readonly ProjectIssuesRequest<T>[],\n\t): Promise<IssueShape[][] | undefined> {\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\tprivate readProjectsOneByOne(\n\t\trequests: readonly ProjectIssuesRequest<T>[],\n\t\tconnectionId: string | undefined,\n\t): Promise<IntegrationResult<ProjectIssuesDrain | undefined>[]> {\n\t\treturn mapBounded(requests, providerFanOutConcurrency, async request => {\n\t\t\ttry {\n\t\t\t\treturn await this.getIssuesForProjectWithTruncationResult(\n\t\t\t\t\trequest.project,\n\t\t\t\t\trequest.options,\n\t\t\t\t\tconnectionId,\n\t\t\t\t);\n\t\t\t} catch (ex) {\n\t\t\t\treturn { error: toError(ex) };\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected abstract getProviderIssuesForProject(\n\t\tsession: ProviderAuthenticationSession,\n\t\tproject: T,\n\t\toptions?: IssuesForProjectOptions,\n\t): Promise<IssueShape[] | undefined>;\n\n\t/**\n\t * Truncation-aware core of {@link getProviderIssuesForProject}. The default wraps the plain read and\n\t * reports `truncated: false`; a provider whose per-project drain is capped by a page backstop overrides\n\t * this to report incompleteness. Optional metadata lets providers surface structured per-project failures\n\t * (e.g. a page-level auth rejection) without discarding the already-fetched prefix.\n\t */\n\tprotected async getProviderIssuesForProjectWithTruncation(\n\t\tsession: ProviderAuthenticationSession,\n\t\tproject: T,\n\t\toptions?: IssuesForProjectOptions,\n\t): Promise<ProjectIssuesDrain | undefined> {\n\t\tconst values = await this.getProviderIssuesForProject(session, project, options);\n\t\tif (values == null) return undefined;\n\t\treturn { values: values, truncated: false };\n\t}\n}\n\n/** A project list as a collection: no data is no list, `unknown`, never an empty complete one. */\nexport function toProjectsCollection<T extends ResourceDescriptor>(\n\tprojects: T[] | undefined,\n): ProviderApiCollectionResult<T> {\n\treturn projects != null ? { values: projects } : { values: [], metadata: { completeness: 'unknown' } };\n}\n"],"mappings":";;;;;;;;;;;;;;;AA6BA,SAAgB,2BACf,UACA,WACA,eAAuB,OAAO,mBACL;CACzB,MAAM,gCAAgB,IAAI,IAAwB;CAClD,KAAK,IAAI,QAAQ,GAAG,QAAQ,SAAS,QAAQ,SAAS;EACrD,MAAM,MAAM,UAAU,SAAS,MAAM;EACrC,IAAI,OAAO,MAAM,OAAO,KAAA;EAExB,IAAI,WAAW,cAAc,IAAI,GAAG;EACpC,IAAI,YAAY,MAAM;GACrB,WAAW,CAAC;GACZ,cAAc,IAAI,KAAK,QAAQ;EAChC;EAEA,IAAI,SAAS,SAAS,GAAG,EAAE;EAC3B,IAAI,UAAU,QAAQ,OAAO,UAAU,cAAc;GACpD,SAAS,CAAC;GACV,SAAS,KAAK,MAAM;EACrB;EACA,OAAO,KAAK,KAAK;CAClB;CACA,OAAO,CAAC,GAAG,cAAc,OAAO,CAAC,CAAC,CAAC,KAAK;AACzC;;;;;;AAOA,SAAgB,yBACf,aACA,QACA,cACoB;CACpB,MAAM,aAAa,IAAI,IAAI,YAAY,KAAK,KAAK,UAAU,CAAC,KAAK,KAAK,CAAC,CAAC;CACxE,MAAM,QAAQ,YAAY,UAAe,CAAC,CAA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IAAA;AA4BL,WAAA,CAAA,MAAM,CAAA,GAAA,kBAAA,WAAA,6CAAA,IAAA;AAkEN,WAAA,CAAA,MAAM,CAAA,GAAA,kBAAA,WAAA,8BAAA,IAAA;AAkFN,WAAA,CAAA,MAAM,CAAA,GAAA,kBAAA,WAAA,uCAAA,IAAA;AA8CN,WAAA,CAAA,MAAM,CAAA,GAAA,kBAAA,WAAA,uBAAA,IAAA;;AA+LR,SAAgB,qBACf,UACiC;CACjC,OAAO,YAAY,OAAO,EAAE,QAAQ,SAAS,IAAI;EAAE,QAAQ,CAAC;EAAG,UAAU,EAAE,cAAc,UAAU;CAAE;AACtG"}
|
|
1
|
+
{"version":3,"file":"issuesIntegration.js","names":[],"sources":["../../../../../plus/integrations/src/models/issuesIntegration.ts"],"sourcesContent":["import type { Account } from '@gitlens/git/models/author.js';\nimport type { Issue, IssueShape } from '@gitlens/git/models/issue.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport { gate } from '@gitlens/utils/decorators/gate.js';\nimport { trace } from '@gitlens/utils/decorators/log.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport { mapBounded, mapSettledBounded } from '@gitlens/utils/promise.js';\nimport type { ProviderAuthenticationSession, SessionPublication } from '../authentication/models.js';\nimport { failsEveryScope } from '../collectionMetadata.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { IssuesCloudHostIntegrationId } from '../constants.js';\nimport { toError } from '../errors.js';\nimport type { LinearIntegration } from '../providers/linear.js';\nimport type { ProviderApiCollectionResult } from '../providers/models.js';\nimport { providerFanOutConcurrency } from '../providers/utils/providerPaging.js';\nimport type { IssueEtagFields, IssueEtagInclude } from '../reads/etag.js';\nimport type { BatchSlot, Integration } from './integration.js';\nimport { IntegrationBase, isReadSessionFailure } from './integration.js';\nimport type { IssuesForProjectOptions, ProjectIssuesDrain, ProjectIssuesRequest } from './issueReads.js';\nimport type { IntegrationResult, IssuesIntegration as IssuesIntegrationView } from './publicIntegration.js';\n\n/**\n * Groups requests into searches of at most `maxPerSearch` projects sharing `searchKey`. Undefined, reading\n * every project on its own, when any request has no key, i.e. cannot be searched together with others.\n */\nexport function groupProjectIssuesSearches<P>(\n\trequests: readonly ProjectIssuesRequest<P>[],\n\tsearchKey: (request: ProjectIssuesRequest<P>) => string | undefined,\n\tmaxPerSearch: number = Number.POSITIVE_INFINITY,\n): number[][] | undefined {\n\tconst searchesByKey = new Map<string, number[][]>();\n\tfor (let index = 0; index < requests.length; index++) {\n\t\tconst key = searchKey(requests[index]);\n\t\tif (key == null) return undefined;\n\n\t\tlet searches = searchesByKey.get(key);\n\t\tif (searches == null) {\n\t\t\tsearches = [];\n\t\t\tsearchesByKey.set(key, searches);\n\t\t}\n\n\t\tlet search = searches.at(-1);\n\t\tif (search == null || search.length >= maxPerSearch) {\n\t\t\tsearch = [];\n\t\t\tsearches.push(search);\n\t\t}\n\t\tsearch.push(index);\n\t}\n\treturn [...searchesByKey.values()].flat();\n}\n\n/**\n * Splits one search's issues back to its projects, in the order of `projectKeys`. Undefined when an issue belongs to\n * no requested project (or `projectKeyOf` can't tell), since the split then can't be trusted and the search's\n * projects are read one by one instead.\n */\nexport function splitProjectIssuesSearch<I>(\n\tprojectKeys: readonly string[],\n\tissues: readonly I[],\n\tprojectKeyOf: (issue: I) => string | undefined,\n): I[][] | undefined {\n\tconst indexByKey = new Map(projectKeys.map((key, index) => [key, index]));\n\tconst split = projectKeys.map((): I[] => []);\n\tfor (const issue of issues) {\n\t\tconst key = projectKeyOf(issue);\n\t\tconst index = key != null ? indexByKey.get(key) : undefined;\n\t\tif (index == null) return undefined;\n\n\t\tsplit[index].push(issue);\n\t}\n\treturn split;\n}\n\n/** By id: the provider class is loaded lazily, so it can't be checked with `instanceof` here. */\nexport function isLinearIntegration(integration: Integration): integration is LinearIntegration {\n\treturn integration.id === IssuesCloudHostIntegrationId.Linear;\n}\n\nfunction sessionPublicationKey(id: string, cloud: boolean | undefined): string {\n\treturn JSON.stringify([id, cloud]);\n}\n\nexport abstract class IssuesIntegration<\n\tID extends IntegrationIds = IntegrationIds,\n\tT extends ResourceDescriptor = ResourceDescriptor,\n>\n\textends IntegrationBase<ID>\n\timplements IssuesIntegrationView\n{\n\treadonly type = 'issues';\n\tprivate _discoverySequence = 0;\n\tprivate _globalRetirement = 0;\n\tprivate _primaryPublication = 0;\n\tprivate readonly _actualPublications = new Map<string, number>();\n\tprivate readonly _actualCredentials = new Map<string, { cloud: boolean; accessToken?: string }>();\n\tprivate readonly _retiredCredentialVariants = new Set<boolean>();\n\tprivate _discoveryDisposed = false;\n\tprivate readonly _selectorPublications = new Map<string, number>();\n\tprivate readonly _selectorSessions = new Map<string, { id: string; cloud?: boolean }>();\n\tprivate readonly _sessionPublications = new WeakMap<\n\t\tProviderAuthenticationSession,\n\t\tMap<string, { beforeGeneration: number; afterGeneration: number }>\n\t>();\n\n\toverride get discoveryGeneration(): number {\n\t\treturn this._discoverySequence;\n\t}\n\n\toverride getSessionDiscoveryGeneration(sessionId?: string, connectionId?: string, cloud?: boolean): number {\n\t\tconst actual =\n\t\t\tsessionId == null\n\t\t\t\t? 0\n\t\t\t\t: Math.max(\n\t\t\t\t\t\tthis._actualPublications.get(sessionPublicationKey(sessionId, undefined)) ?? 0,\n\t\t\t\t\t\t...(cloud == null ? [true, false] : [cloud]).map(\n\t\t\t\t\t\t\tvariant => this._actualPublications.get(sessionPublicationKey(sessionId, variant)) ?? 0,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\treturn Math.max(\n\t\t\tthis._globalRetirement,\n\t\t\tactual,\n\t\t\tconnectionId != null ? (this._selectorPublications.get(connectionId) ?? 0) : this._primaryPublication,\n\t\t);\n\t}\n\n\toverride invalidateDiscoveryCaches(): void {\n\t\tthis._globalRetirement = ++this._discoverySequence;\n\t\tthis.clearDiscoveryCaches();\n\t}\n\n\toverride invalidateDiscoveryForConnection(connectionId?: string): void {\n\t\tconst stamp = ++this._discoverySequence;\n\t\tif (connectionId != null) {\n\t\t\tthis._selectorPublications.set(connectionId, stamp);\n\t\t\tconst session = this._selectorSessions.get(connectionId);\n\t\t\tthis._actualPublications.set(\n\t\t\t\tsessionPublicationKey(session?.id ?? connectionId, session == null ? true : session.cloud),\n\t\t\t\tstamp,\n\t\t\t);\n\t\t} else {\n\t\t\tthis._primaryPublication = stamp;\n\t\t\tif (this._session != null) {\n\t\t\t\tthis._actualPublications.set(sessionPublicationKey(this._session.id, this._session.cloud), stamp);\n\t\t\t}\n\t\t}\n\t\tthis.clearDiscoveryCaches();\n\t}\n\n\tprotected captureDiscoveryLifetime(session: ProviderAuthenticationSession): () => boolean {\n\t\tconst { id, cloud } = session;\n\t\tconst key = sessionPublicationKey(id, cloud);\n\t\t// A caller can retain a resolved session across awaits that publish a different credential.\n\t\tconst ownsCredential =\n\t\t\t!this._discoveryDisposed &&\n\t\t\t(this._actualCredentials.has(key)\n\t\t\t\t? this._actualCredentials.get(key)?.accessToken === session.accessToken\n\t\t\t\t: !this._retiredCredentialVariants.has(cloud));\n\t\t// An explicit actual-session selector avoids retiring secondary ownership when only the primary changes.\n\t\tconst generation = this.getSessionDiscoveryGeneration(id, id, cloud);\n\t\treturn () => ownsCredential && this.getSessionDiscoveryGeneration(id, id, cloud) === generation;\n\t}\n\n\tprotected clearDiscoveryCaches(): void {}\n\n\toverride dispose(): void {\n\t\tthis._discoveryDisposed = true;\n\t\tfor (const [key, credential] of this._actualCredentials) {\n\t\t\tthis._actualCredentials.set(key, { cloud: credential.cloud });\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\tprotected override invalidatePublishedSession(publication: SessionPublication, affectsPrimary: boolean): void {\n\t\tconst stamp = ++this._discoverySequence;\n\t\tconst cloud = publication.session != null ? publication.session.cloud : publication.cloud;\n\t\tif (publication.retireAll) {\n\t\t\tconst variants = cloud == null ? [true, false] : [cloud];\n\t\t\tfor (const variant of variants) {\n\t\t\t\tthis._retiredCredentialVariants.add(variant);\n\t\t\t}\n\t\t\tfor (const [key, credential] of this._actualCredentials) {\n\t\t\t\tif (variants.includes(credential.cloud)) {\n\t\t\t\t\tthis._actualCredentials.set(key, { cloud: credential.cloud });\n\t\t\t\t\tthis._actualPublications.set(key, stamp);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._globalRetirement = stamp;\n\t\t\tthis.clearDiscoveryCaches();\n\t\t}\n\t\tfor (const id of [publication.session?.id, publication.previousSessionId]) {\n\t\t\tif (id != null) {\n\t\t\t\tthis._actualPublications.set(sessionPublicationKey(id, cloud), stamp);\n\t\t\t\tfor (const variant of cloud == null ? [true, false] : [cloud]) {\n\t\t\t\t\tthis._actualCredentials.set(sessionPublicationKey(id, variant), {\n\t\t\t\t\t\tcloud: variant,\n\t\t\t\t\t\taccessToken: id === publication.session?.id ? publication.session.accessToken : undefined,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (publication.connectionId != null) {\n\t\t\tthis._selectorPublications.set(publication.connectionId, stamp);\n\t\t\tif (publication.session != null) {\n\t\t\t\tthis._selectorSessions.set(publication.connectionId, {\n\t\t\t\t\tid: publication.session.id,\n\t\t\t\t\tcloud: publication.session.cloud,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tif (affectsPrimary) {\n\t\t\tthis._primaryPublication = stamp;\n\t\t\tthis.clearDiscoveryCaches();\n\t\t}\n\t}\n\n\toverride onSessionPublishing(publication: SessionPublication): void {\n\t\tif (this._discoveryDisposed) return;\n\n\t\tconst session = publication.session;\n\t\tconst transitions = session != null ? (this._sessionPublications.get(session) ?? new Map()) : undefined;\n\t\tconst selectors = new Set([\n\t\t\t...(transitions?.keys() ?? []),\n\t\t\t'',\n\t\t\tpublication.connectionId ?? '',\n\t\t\tsession?.id ?? '',\n\t\t]);\n\t\tconst before = new Map(\n\t\t\tArray.from(selectors, selector => [\n\t\t\t\tselector,\n\t\t\t\tthis.getSessionDiscoveryGeneration(session?.id, selector || undefined, session?.cloud),\n\t\t\t]),\n\t\t);\n\t\tsuper.onSessionPublishing(publication);\n\t\tif (session == null || transitions == null) return;\n\n\t\tfor (const selector of selectors) {\n\t\t\tconst beforeGeneration = before.get(selector)!;\n\t\t\tconst previous = transitions.get(selector);\n\t\t\ttransitions.set(selector, {\n\t\t\t\tbeforeGeneration:\n\t\t\t\t\tprevious?.afterGeneration === beforeGeneration ? previous.beforeGeneration : beforeGeneration,\n\t\t\t\tafterGeneration: this.getSessionDiscoveryGeneration(session.id, selector || undefined, session.cloud),\n\t\t\t});\n\t\t}\n\t\tthis._sessionPublications.set(session, transitions);\n\t}\n\n\tprivate isResolvedDiscoverySessionCurrent(\n\t\tsession: ProviderAuthenticationSession,\n\t\tstartingGeneration: number,\n\t\tconnectionId: string | undefined,\n\t): boolean {\n\t\tif (!connectionId && session !== this._session) return false;\n\t\treturn this.isResolvedSessionCurrent(session, startingGeneration, connectionId);\n\t}\n\n\tprotected override isResolvedSessionCurrent(\n\t\tsession: ProviderAuthenticationSession | undefined,\n\t\tstartingGeneration: number,\n\t\tconnectionId?: string,\n\t): boolean {\n\t\tif (session == null) return startingGeneration === this.discoveryGeneration;\n\n\t\tconst current = this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud);\n\t\tif (current <= startingGeneration) return true;\n\n\t\t// Only this resolution's publications may bridge a retirement boundary.\n\t\tconst publication = this._sessionPublications.get(session)?.get(connectionId ?? '');\n\t\treturn (\n\t\t\tpublication != null &&\n\t\t\tpublication.beforeGeneration <= startingGeneration &&\n\t\t\tpublication.afterGeneration === current\n\t\t);\n\t}\n\n\tget supportsIssueLookupByResourceId(): boolean {\n\t\treturn this.getProviderIssueByResourceId != null;\n\t}\n\n\t/**\n\t * Whether this tracker has the cheap check behind the batch issue read's etags\n\t * ({@link getProviderIssuesEtagFieldsByResourceId}). The read decides before calling anything, so a tracker without\n\t * one makes one call.\n\t */\n\tget supportsIssueEtagsByResourceId(): boolean {\n\t\treturn this.getProviderIssuesEtagFieldsByResourceId != null;\n\t}\n\n\t/**\n\t * Result-returning wrapper for the BATCH tracker issue read: resolves several `(resourceId, identifier)` targets\n\t * with one {@link getProviderIssueByResourceId} request each, run with bounded concurrency. One settled slot per\n\t * input target: `fulfilled` with `undefined` means the issue does not exist or is not visible to this token;\n\t * `rejected` means that target could not be checked, never that it is absent.\n\t *\n\t * Failure isolation happens PER TARGET, mirroring `GitHostIntegration.getPullRequestsBatchResult`: the whole\n\t * call counts as a failure against the integration's request-exception budget only when EVERY slot rejected,\n\t * and not even then when a credential that checks out was refused by each target's own resource\n\t * (`settleBatchRefusals`), so a batch of mostly-good targets never spends more than one strike. A batch read with\n\t * etags makes up to two such calls (a full read of the targets without an etag, and a full read of the ones that\n\t * changed), so it can spend two; its cheap check ({@link getIssuesEtagFieldsByResourceIdBatchResult}) spends\n\t * nothing unless the credential is refused.\n\t *\n\t * Uncached on purpose: the caller owns caching, as with the git hosts' batch reads.\n\t */\n\tasync getIssuesByResourceIdBatchResult(\n\t\ttargets: readonly { resourceId: string; identifier: string; resourceUrl?: string }[],\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<BatchSlot<IssueShape | undefined>[] | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\tconst getProviderIssue = this.getProviderIssueByResourceId;\n\t\tif (getProviderIssue == null) return { value: undefined };\n\n\t\tconst start = performance.now();\n\t\ttry {\n\t\t\tconst slots = await mapSettledBounded(targets, providerFanOutConcurrency, t =>\n\t\t\t\tgetProviderIssue.call(this, session, t.resourceId, t.identifier, t.resourceUrl),\n\t\t\t);\n\n\t\t\tconst settled = await this.settleBatchRefusals(session, targets, slots);\n\n\t\t\tthis.resetRequestExceptionCount('getIssue', connectionId);\n\t\t\treturn { value: settled, duration: performance.now() - start };\n\t\t} catch (ex) {\n\t\t\tthis.handleProviderException('getIssue', ex, { scope: scope, connectionId: connectionId });\n\t\t\treturn { error: toError(ex), duration: performance.now() - start };\n\t\t}\n\t}\n\n\tprotected getProviderIssueByResourceId?(\n\t\t_session: ProviderAuthenticationSession,\n\t\t_resourceId: string,\n\t\t_id: string,\n\t\t_resourceUrl: string | undefined,\n\t): Promise<Issue | undefined>;\n\n\t/**\n\t * Result-returning wrapper for the cheap check behind the batch tracker issue read's etags: each target's change\n\t * state ({@link IssueEtagFields}), in ONE call to {@link getProviderIssuesEtagFieldsByResourceId}, which is handed\n\t * `options.etagIncludes` as the git hosts' check is. The slots mean\n\t * what {@link getIssuesByResourceIdBatchResult}'s do — `fulfilled` with `undefined` is a PROVEN ABSENCE, `rejected`\n\t * means that target could not be checked. Failures are judged and budgeted as in\n\t * `GitHostIntegration.getIssuesEtagFieldsResult`: every slot comes back as it settled, even when none answered, and\n\t * only a refused credential fails the call or spends a strike.\n\t */\n\tasync getIssuesEtagFieldsByResourceIdBatchResult(\n\t\ttargets: readonly { resourceId: string; identifier: string; resourceUrl?: string }[],\n\t\toptions: { etagIncludes?: readonly IssueEtagInclude[] },\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<BatchSlot<IssueEtagFields | undefined>[] | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\tconst getProviderEtagFields = this.getProviderIssuesEtagFieldsByResourceId;\n\t\tif (getProviderEtagFields == null) return { value: undefined };\n\n\t\tconst start = performance.now();\n\t\ttry {\n\t\t\tconst slots = await getProviderEtagFields.call(this, session, targets, options);\n\t\t\tif (slots == null) return { value: undefined, duration: performance.now() - start };\n\n\t\t\tconst settled = await this.settleBatchRefusals(session, targets, slots, { keepOtherFailures: true });\n\n\t\t\tif (slots.some(slot => slot.status === 'fulfilled')) {\n\t\t\t\tthis.resetRequestExceptionCount('getIssuesEtagFields', connectionId);\n\t\t\t}\n\t\t\treturn { value: settled, duration: performance.now() - start };\n\t\t} catch (ex) {\n\t\t\tthis.handleEtagCheckException('getIssuesEtagFields', ex, { scope: scope, connectionId: connectionId });\n\t\t\treturn { error: toError(ex), duration: performance.now() - start };\n\t\t}\n\t}\n\n\t/**\n\t * OPTIONAL: the cheap check behind the batch tracker issue read's etags — one settled slot per input target, in\n\t * order, holding the issue's change state in the vocabulary {@link getProviderIssueByResourceId}'s issues end in,\n\t * so both reads compute the same etag. `fulfilled` with `undefined` is a PROVEN ABSENCE, as there; a tracker whose\n\t * cheap read can't prove one rejects the slot instead, so the full read decides. `undefined` declines the whole\n\t * check, sending every target to the full read without counting as a failure. A tracker implements this only\n\t * where it is cheaper than the full read. No tracker's row carries a real reaction count, so `'reactions'` in\n\t * `options.etagIncludes` reads nothing here.\n\t */\n\tprotected getProviderIssuesEtagFieldsByResourceId?(\n\t\tsession: ProviderAuthenticationSession,\n\t\ttargets: readonly { resourceId: string; identifier: string; resourceUrl?: string }[],\n\t\toptions: { etagIncludes?: readonly IssueEtagInclude[] },\n\t): Promise<PromiseSettledResult<IssueEtagFields | undefined>[] | undefined>;\n\n\t@trace()\n\tasync getAccountForResource(resource: T, connectionId?: string): Promise<Account | undefined> {\n\t\treturn (await this.getAccountForResourceResult(resource, connectionId))?.value;\n\t}\n\n\t/**\n\t * Result-returning core of {@link getAccountForResource}. Recovers a thrown error into `{ error }` so\n\t * callers can preserve its classification (e.g. a 401/403 → an `auth` warning that drives re-auth)\n\t * instead of collapsing every failure into an untyped `undefined`. Gated here (not on the wrapper) so\n\t * direct callers such as the ProviderBackend facade share the same dedup as `getAccountForResource`.\n\t */\n\t@gate()\n\tasync getAccountForResourceResult(\n\t\tresource: T,\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<Account | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\ttry {\n\t\t\tconst account = await this.getProviderAccountForResource(session, resource);\n\t\t\tthis.resetRequestExceptionCount('getAccountForResource', connectionId);\n\t\t\treturn { value: account };\n\t\t} catch (ex) {\n\t\t\tthis.handleProviderException('getAccountForResource', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\tprotected abstract getProviderAccountForResource(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresource: T,\n\t): Promise<Account | undefined>;\n\n\t@trace()\n\tasync getResourcesForUser(connectionId?: string): Promise<T[] | undefined> {\n\t\treturn (await this.getResourcesForUserResult(connectionId))?.value;\n\t}\n\n\t/**\n\t * Result-returning core of {@link getResourcesForUser}. Recovers thrown errors into `{ error }` so callers\n\t * can surface them as warnings rather than silently swallowing them to `undefined`. Deduped here (not on the\n\t * wrapper) so direct callers such as the ProviderBackend facade share the same dedup as `getResourcesForUser`.\n\t */\n\tgetResourcesForUserResult(connectionId?: string): Promise<IntegrationResult<T[] | undefined>> {\n\t\t// Joined only within a discovery generation: a read started after a drop (a forced refresh) must not take the\n\t\t// lookup a read made before it, which answers with the resources as they were then (#6162). An empty\n\t\t// connectionId reads the primary, so it shares the primary's lookup.\n\t\treturn this.getResourcesForUserResultCore(connectionId || undefined, this.discoveryGeneration);\n\t}\n\n\t@gate()\n\tprivate async getResourcesForUserResultCore(\n\t\tconnectionId: string | undefined,\n\t\t_discoveryGeneration: number,\n\t): Promise<IntegrationResult<T[] | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\ttry {\n\t\t\tconst resources = await this.getProviderResourcesForUser(session);\n\t\t\tthis.resetRequestExceptionCount('getResourcesForUser', connectionId);\n\t\t\treturn { value: resources };\n\t\t} catch (ex) {\n\t\t\tthis.handleProviderException('getResourcesForUser', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\tprotected abstract getProviderResourcesForUser(session: ProviderAuthenticationSession): Promise<T[] | undefined>;\n\n\t/**\n\t * Project discovery for a set of resources, returning the SDK collection `{ values, metadata }` (completeness\n\t * + per-resource failures) so callers can warn on failed resources and set `fetchFailed` without discarding\n\t * the resources that succeeded. Thrown errors are recovered into `{ error }` for the same reason: a caller\n\t * surfaces them as a warning rather than swallowing them to `undefined`.\n\t */\n\t@trace()\n\tasync getProjectsForResourcesWithMetadataResult(\n\t\tresources: T[],\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<ProviderApiCollectionResult<T> | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\tconst startingGeneration = this.discoveryGeneration;\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\t\t// Primary resolution can refresh its own session before discovery starts.\n\t\tif (!this.isResolvedDiscoverySessionCurrent(session, startingGeneration, connectionId)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst generation = this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud);\n\n\t\ttry {\n\t\t\tconst projects = await this.getProviderProjectsForResourcesWithMetadata(session, resources);\n\t\t\t// Existing cached readers keep their snapshot after invalidation without changing the replacement session.\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn { value: projects };\n\t\t\t}\n\n\t\t\tawait this.confirmScopedAuthFailures(session, projects.metadata);\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn { value: projects };\n\t\t\t}\n\n\t\t\tthis.resetRequestExceptionCount('getProjectsForResources', connectionId);\n\t\t\treturn { value: projects };\n\t\t} catch (ex) {\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tthis.handleProviderException('getProjectsForResources', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\t/**\n\t * Metadata-aware provider project discovery. The default wraps the array-returning\n\t * {@link getProviderProjectsForResources} in `{ values }`, so providers without a fan-out completeness signal\n\t * (Jira Data Center, Trello) need no change; a read that returned no data is `unknown`, not an empty project list.\n\t * Jira Cloud and Linear override it to preserve their completeness/failures.\n\t */\n\tprotected async getProviderProjectsForResourcesWithMetadata(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources: T[],\n\t): Promise<ProviderApiCollectionResult<T>> {\n\t\treturn toProjectsCollection(await this.getProviderProjectsForResources(session, resources));\n\t}\n\n\tprotected abstract getProviderProjectsForResources(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources: T[],\n\t): Promise<T[] | undefined>;\n\n\t/**\n\t * The resources, and the projects of those `projectsOf` keeps, as the provider lists them now. For a read that must\n\t * not take a cached list for the current one: what it decides from this snapshot (that a selection is gone) would\n\t * be wrong for as long as the cache is stale. Shares nothing with the cached discovery: joins no read in flight,\n\t * reads and writes no cache, so it can neither be answered by a read started before what it needs to see, nor put\n\t * its answer into a cache a concurrent read relies on. `projects` is omitted when no resource list came back.\n\t */\n\t@trace()\n\tasync getUncachedDiscoveryResult(\n\t\tprojectsOf: (resource: T) => boolean,\n\t\tconnectionId?: string,\n\t): Promise<\n\t\tIntegrationResult<\n\t\t\t| {\n\t\t\t\t\tresources: T[] | undefined;\n\t\t\t\t\tprojects?: ProviderApiCollectionResult<T>;\n\t\t\t\t\tgeneration: number;\n\t\t\t\t\tsessionId: string;\n\t\t\t\t\tsessionCloud?: boolean;\n\t\t\t }\n\t\t\t| undefined\n\t\t>\n\t> {\n\t\tconst scope = getScopedLogger();\n\t\tconst startingGeneration = this.discoveryGeneration;\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\t\tif (!this.isResolvedDiscoverySessionCurrent(session, startingGeneration, connectionId)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst generation = this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud);\n\n\t\ttry {\n\t\t\t// Reset on success as the cached reads are, so a refusal a re-sync healed doesn't count toward a disconnect.\n\t\t\tconst resources = await this.getProviderUncachedResourcesForUser(session);\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tthis.resetRequestExceptionCount('getResourcesForUser', connectionId);\n\t\t\tif (resources == null) {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tresources: undefined,\n\t\t\t\t\t\tgeneration: generation,\n\t\t\t\t\t\tsessionId: session.id,\n\t\t\t\t\t\tsessionCloud: session.cloud,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst projects = await this.getProviderUncachedProjectsForResourcesWithMetadata(\n\t\t\t\tsession,\n\t\t\t\tresources.filter(projectsOf),\n\t\t\t);\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tawait this.confirmScopedAuthFailures(session, projects.metadata);\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tthis.resetRequestExceptionCount('getProjectsForResources', connectionId);\n\t\t\treturn {\n\t\t\t\tvalue: {\n\t\t\t\t\tresources: resources,\n\t\t\t\t\tprojects: projects,\n\t\t\t\t\tgeneration: generation,\n\t\t\t\t\tsessionId: session.id,\n\t\t\t\t\tsessionCloud: session.cloud,\n\t\t\t\t},\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\tif (generation !== this.getSessionDiscoveryGeneration(session.id, connectionId, session.cloud)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tthis.handleProviderException('getProjectsForResources', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\t/**\n\t * {@link getAccountForResourceResult} asked of the provider now, joining no lookup in flight and served from no\n\t * account it lends: a lookup started before the credential was revoked would vouch for it.\n\t */\n\t@trace()\n\tasync getUncachedAccountForResourceResult(\n\t\tresource: T,\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<Account | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\ttry {\n\t\t\tconst account = await this.getProviderUncachedAccountForResource(session, resource);\n\t\t\tthis.resetRequestExceptionCount('getAccountForResource', connectionId);\n\t\t\treturn { value: account };\n\t\t} catch (ex) {\n\t\t\tthis.handleProviderException('getAccountForResource', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\t/** The account, asked of the provider; the default is {@link getProviderAccountForResource}, which lends none. */\n\tprotected getProviderUncachedAccountForResource(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresource: T,\n\t): Promise<Account | undefined> {\n\t\treturn this.getProviderAccountForResource(session, resource);\n\t}\n\n\t/**\n\t * The provider's resources, read past any cache it keeps and without storing into it. The default is\n\t * {@link getProviderResourcesForUser}, right for a provider that keeps none.\n\t */\n\tprotected getProviderUncachedResourcesForUser(session: ProviderAuthenticationSession): Promise<T[] | undefined> {\n\t\treturn this.getProviderResourcesForUser(session);\n\t}\n\n\t/**\n\t * The projects of `resources`, read past any cache the provider keeps and without storing into it. The default is\n\t * {@link getProviderProjectsForResourcesWithMetadata}, right for a provider that keeps none.\n\t */\n\tprotected getProviderUncachedProjectsForResourcesWithMetadata(\n\t\tsession: ProviderAuthenticationSession,\n\t\tresources: T[],\n\t): Promise<ProviderApiCollectionResult<T>> {\n\t\treturn this.getProviderProjectsForResourcesWithMetadata(session, resources);\n\t}\n\n\t@trace()\n\tasync getIssuesForProject(\n\t\tproject: T,\n\t\toptions?: IssuesForProjectOptions,\n\t\tconnectionId?: string,\n\t): Promise<IssueShape[] | undefined> {\n\t\treturn (await this.getIssuesForProjectResult(project, options, connectionId))?.value;\n\t}\n\n\t/**\n\t * Result-returning core of {@link getIssuesForProject}. Recovers thrown errors into `{ error }` so callers\n\t * (e.g. the ProviderBackend facade) can surface a per-provider warning instead of a silent empty read —\n\t * important for providers that throw on unsupported operations (e.g. Linear's not-implemented issue read).\n\t */\n\tasync getIssuesForProjectResult(\n\t\tproject: T,\n\t\toptions?: IssuesForProjectOptions,\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<IssueShape[] | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\ttry {\n\t\t\tconst issues = await this.getProviderIssuesForProject(session, project, options);\n\t\t\tthis.resetRequestExceptionCount('getIssuesForProject', connectionId);\n\t\t\treturn { value: issues };\n\t\t} catch (ex) {\n\t\t\tthis.handleProviderException('getIssuesForProject', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\t/**\n\t * Truncation-aware variant of {@link getIssuesForProjectResult}. A provider that drains a project's issues\n\t * with an internal page backstop (Jira/Linear) overrides {@link getProviderIssuesForProjectWithTruncation}\n\t * to report when that backstop was hit, so the facade can surface an incomplete project read instead of\n\t * publishing it as complete. The default reports `truncated: false`.\n\t */\n\tasync getIssuesForProjectWithTruncationResult(\n\t\tproject: T,\n\t\toptions?: IssuesForProjectOptions,\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<ProjectIssuesDrain | undefined>> {\n\t\tconst scope = getScopedLogger();\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) return session && { error: session.error };\n\n\t\ttry {\n\t\t\tconst result = await this.getProviderIssuesForProjectWithTruncation(session, project, options);\n\t\t\tawait this.confirmScopedAuthFailures(session, result?.metadata);\n\t\t\tthis.resetRequestExceptionCount('getIssuesForProject', connectionId);\n\t\t\treturn { value: result };\n\t\t} catch (ex) {\n\t\t\tthis.handleProviderException('getIssuesForProject', ex, { connectionId: connectionId });\n\t\t\treturn { error: toError(ex) };\n\t\t}\n\t}\n\n\t/**\n\t * Reads several projects' issues, one result per request in request order, each with the contract of\n\t * {@link getIssuesForProjectWithTruncationResult}, so one project failing leaves its siblings readable.\n\t *\n\t * A tracker that can read several projects in one query (Jira, Linear) groups them through\n\t * {@link getProjectIssuesSearches}, so a project with none of the user's issues costs no request of its own.\n\t * Every other request, and every project of a search that did not complete, is read on its own.\n\t *\n\t * A search's pages are global to its project set, so only a search that completes says something about each\n\t * of its projects: one that does not, or that fails for a reason that may be one project's\n\t * ({@link failsEveryScope}), is read again project by project, which reports completeness, failures and\n\t * retries per project. Only a failure every project would hit on its own read too fails them all at once.\n\t */\n\tasync getIssuesForProjectsWithTruncationResult(\n\t\trequests: readonly ProjectIssuesRequest<T>[],\n\t\tconnectionId?: string,\n\t): Promise<IntegrationResult<ProjectIssuesDrain | undefined>[]> {\n\t\tconst searches = this.getProjectIssuesSearches(requests);\n\t\tif (searches == null) return this.readProjectsOneByOne(requests, connectionId);\n\n\t\tconst scope = getScopedLogger();\n\t\tconst session = await this.resolveReadSession(connectionId, scope);\n\t\tif (session == null || isReadSessionFailure(session)) {\n\t\t\treturn requests.map(() => session && { error: session.error });\n\t\t}\n\n\t\tconst results: IntegrationResult<ProjectIssuesDrain | undefined>[] = requests.map(() => undefined);\n\t\tconst unsearchedIndices: number[] = [];\n\t\tawait mapBounded(searches, providerFanOutConcurrency, async indices => {\n\t\t\ttry {\n\t\t\t\tconst values = await this.searchProviderProjectIssues(\n\t\t\t\t\tsession,\n\t\t\t\t\tindices.map(index => requests[index]),\n\t\t\t\t);\n\t\t\t\tif (values == null) {\n\t\t\t\t\tunsearchedIndices.push(...indices);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.resetRequestExceptionCount('getIssuesForProject', connectionId);\n\t\t\t\tindices.forEach((index, i) => {\n\t\t\t\t\tresults[index] = { value: { values: values[i], truncated: false } };\n\t\t\t\t});\n\t\t\t} catch (ex) {\n\t\t\t\tif (!failsEveryScope(ex)) {\n\t\t\t\t\tLogger.warn(scope, `Project search failed (${String(ex)}); reading its projects one by one`);\n\t\t\t\t\tunsearchedIndices.push(...indices);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.handleProviderException('getIssuesForProject', ex, { connectionId: connectionId });\n\t\t\t\tconst error = toError(ex);\n\t\t\t\tfor (const index of indices) {\n\t\t\t\t\tresults[index] = { error: error };\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// After every search rather than inside each, so the fallback reads share one concurrency bound.\n\t\tif (unsearchedIndices.length > 0) {\n\t\t\tconst fallback = await this.readProjectsOneByOne(\n\t\t\t\tunsearchedIndices.map(index => requests[index]),\n\t\t\t\tconnectionId,\n\t\t\t);\n\t\t\tunsearchedIndices.forEach((index, i) => {\n\t\t\t\tresults[index] = fallback[i];\n\t\t\t});\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Groups requests into searches, as lists of request indices, that {@link searchProviderProjectIssues} can read\n\t * in one query each. Undefined reads every project on its own, which is the default.\n\t */\n\tprotected getProjectIssuesSearches(_requests: readonly ProjectIssuesRequest<T>[]): number[][] | undefined {\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Reads the projects of one search in one query: each project's issues in request order, or undefined when the\n\t * query did not complete, which reads them one by one instead. A throw is classified by {@link failsEveryScope}.\n\t */\n\tprotected searchProviderProjectIssues(\n\t\t_session: ProviderAuthenticationSession,\n\t\t_requests: readonly ProjectIssuesRequest<T>[],\n\t): Promise<IssueShape[][] | undefined> {\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\tprivate readProjectsOneByOne(\n\t\trequests: readonly ProjectIssuesRequest<T>[],\n\t\tconnectionId: string | undefined,\n\t): Promise<IntegrationResult<ProjectIssuesDrain | undefined>[]> {\n\t\treturn mapBounded(requests, providerFanOutConcurrency, async request => {\n\t\t\ttry {\n\t\t\t\treturn await this.getIssuesForProjectWithTruncationResult(\n\t\t\t\t\trequest.project,\n\t\t\t\t\trequest.options,\n\t\t\t\t\tconnectionId,\n\t\t\t\t);\n\t\t\t} catch (ex) {\n\t\t\t\treturn { error: toError(ex) };\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected abstract getProviderIssuesForProject(\n\t\tsession: ProviderAuthenticationSession,\n\t\tproject: T,\n\t\toptions?: IssuesForProjectOptions,\n\t): Promise<IssueShape[] | undefined>;\n\n\t/**\n\t * Truncation-aware core of {@link getProviderIssuesForProject}. The default wraps the plain read and\n\t * reports `truncated: false`; a provider whose per-project drain is capped by a page backstop overrides\n\t * this to report incompleteness. Optional metadata lets providers surface structured per-project failures\n\t * (e.g. a page-level auth rejection) without discarding the already-fetched prefix.\n\t */\n\tprotected async getProviderIssuesForProjectWithTruncation(\n\t\tsession: ProviderAuthenticationSession,\n\t\tproject: T,\n\t\toptions?: IssuesForProjectOptions,\n\t): Promise<ProjectIssuesDrain | undefined> {\n\t\tconst values = await this.getProviderIssuesForProject(session, project, options);\n\t\tif (values == null) return undefined;\n\t\treturn { values: values, truncated: false };\n\t}\n}\n\n/** A project list as a collection: no data is no list, `unknown`, never an empty complete one. */\nexport function toProjectsCollection<T extends ResourceDescriptor>(\n\tprojects: T[] | undefined,\n): ProviderApiCollectionResult<T> {\n\treturn projects != null ? { values: projects } : { values: [], metadata: { completeness: 'unknown' } };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0BA,SAAgB,2BACf,UACA,WACA,eAAuB,OAAO,mBACL;CACzB,MAAM,gCAAgB,IA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+D;EAC/D,OAAO,WAAW,UAAA,GAAqC,OAAM,YAAW;GACvE,IAAI;IACH,OAAO,MAAM,KAAK,wCACjB,QAAQ,SACR,QAAQ,SACR,YACD;GACD,SAAS,IAAI;IACZ,OAAO,EAAE,OAAO,QAAQ,EAAE,EAAE;GAC7B;EACD,CAAC;CACF;;;;;;;CAcA,MAAgB,0CACf,SACA,SACA,SAC0C;EAC1C,MAAM,SAAS,MAAM,KAAK,4BAA4B,SAAS,SAAS,OAAO;EAC/E,IAAI,UAAU,MAAM,OAAO,KAAA;EAC3B,OAAO;GAAU;GAAQ,WAAW;EAAM;CAC3C;AACD;AA/cE,WAAA,CAAA,MAAM,CAAA,GAAA,kBAAA,WAAA,yBAAA,IAAA;AAWN,WAAA,CAAA,KAAK,CAAA,GAAA,kBAAA,WAAA,+BAAA,IAAA;AAyBL,WAAA,CAAA,MAAM,CAAA,GAAA,kBAAA,WAAA,uBAAA,IAAA;AAiBN,WAAA,CAAA,KAAK,CAAA,GAAA,kBAAA,WAAA,iCAAA,IAAA;AA4BL,WAAA,CAAA,MAAM,CAAA,GAAA,kBAAA,WAAA,6CAAA,IAAA;AAkEN,WAAA,CAAA,MAAM,CAAA,GAAA,kBAAA,WAAA,8BAAA,IAAA;AAkFN,WAAA,CAAA,MAAM,CAAA,GAAA,kBAAA,WAAA,uCAAA,IAAA;AA8CN,WAAA,CAAA,MAAM,CAAA,GAAA,kBAAA,WAAA,uBAAA,IAAA;;AA+LR,SAAgB,qBACf,UACiC;CACjC,OAAO,YAAY,OAAO,EAAE,QAAQ,SAAS,IAAI;EAAE,QAAQ,CAAC;EAAG,UAAU,EAAE,cAAc,UAAU;CAAE;AACtG"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { PagedResult } from "../../../utils/paging.js";
|
|
2
|
+
import { ResourceDescriptor } from "../../../git/models/resourceDescriptor.js";
|
|
3
|
+
import { AutolinkReference, DynamicAutolinkReference } from "../../../git/models/autolink.js";
|
|
4
|
+
import { IssueOrPullRequest, IssueOrPullRequestState, IssueOrPullRequestType } from "../../../git/models/issueOrPullRequest.js";
|
|
5
|
+
import { Issue } from "../../../git/models/issue.js";
|
|
6
|
+
import { PullRequest, PullRequestFilter, PullRequestMergeMethod, PullRequestMergeQueueActionResult, PullRequestMergeQueueEntry, PullRequestStackInfo, PullRequestStackLayers, PullRequestStateFilter } from "../../../git/models/pullRequest.js";
|
|
7
|
+
import { Account, UnidentifiedAuthor } from "../../../git/models/author.js";
|
|
8
|
+
import { DefaultBranch } from "../../../git/models/defaultBranch.js";
|
|
9
|
+
import { RepositoryMetadata } from "../../../git/models/repositoryMetadata.js";
|
|
10
|
+
import { PullRequestUrlIdentity } from "../../../git/utils/pullRequest.utils.js";
|
|
11
|
+
import { GitCloudHostIntegrationId, IntegrationIds, IssuesCloudHostIntegrationId, IssuesHostIntegrationIds } from "../constants.js";
|
|
12
|
+
import { Sources } from "../telemetry.js";
|
|
13
|
+
import { ProviderRepositoryShape } from "../results.js";
|
|
14
|
+
import { ProviderRepositoriesInput } from "../manager.js";
|
|
15
|
+
//#region ../plus/integrations/src/models/publicIntegration.d.ts
|
|
16
|
+
/** The kind of an integration: a git host or an issue tracker. */
|
|
17
|
+
export type IntegrationType = 'git' | 'issues';
|
|
18
|
+
export type IntegrationKey<T extends IntegrationIds = IntegrationIds> = T extends GitCloudHostIntegrationId | IssuesCloudHostIntegrationId ? `${T}` : `${T}:${string}`;
|
|
19
|
+
export type IntegrationConnectedKey<T extends IntegrationIds = IntegrationIds> = `connected:${IntegrationKey<T>}`;
|
|
20
|
+
/** A read's outcome: its value, or the error it failed with; `undefined` when there was nothing to read. */
|
|
21
|
+
export type IntegrationResult<T> = {
|
|
22
|
+
value: T;
|
|
23
|
+
duration?: number;
|
|
24
|
+
error?: Error;
|
|
25
|
+
} | {
|
|
26
|
+
error: Error;
|
|
27
|
+
duration?: number;
|
|
28
|
+
value?: never;
|
|
29
|
+
} | undefined;
|
|
30
|
+
/** The credential an integration is connected with, for a consumer that has to hand it to another service. */
|
|
31
|
+
export interface IntegrationCredential {
|
|
32
|
+
/** The id of the provider the token was issued for, which is the integration's own id. */
|
|
33
|
+
readonly providerId: IntegrationIds;
|
|
34
|
+
readonly accessToken: string;
|
|
35
|
+
}
|
|
36
|
+
/** Read options for {@link GitHostIntegration.searchMyPullRequests} and the provider hook behind it. */
|
|
37
|
+
export type SearchMyPullRequestsOptions = {
|
|
38
|
+
/** Suppresses the user-facing notification when the read fails. */
|
|
39
|
+
silent?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* PR states to include (open/closed/merged/all). Providers that cannot express it in a single query
|
|
42
|
+
* filter the normalized results; omitted preserves the historical open-only behavior.
|
|
43
|
+
*/
|
|
44
|
+
state?: PullRequestStateFilter;
|
|
45
|
+
includeReviewRequested?: boolean;
|
|
46
|
+
};
|
|
47
|
+
/** Read options for {@link GitHostIntegration.searchPullRequests} and the provider hook behind it. */
|
|
48
|
+
export type SearchPullRequestsOptions = {
|
|
49
|
+
/** PR states to include; omitted preserves the provider's default. */
|
|
50
|
+
include?: IssueOrPullRequestState[];
|
|
51
|
+
};
|
|
52
|
+
/** Read options for {@link GitHostIntegration.getMyPullRequestsForRepos}. */
|
|
53
|
+
export type MyPullRequestsForReposOptions = {
|
|
54
|
+
filters?: PullRequestFilter[];
|
|
55
|
+
cursor?: string;
|
|
56
|
+
customUrl?: string;
|
|
57
|
+
page?: number;
|
|
58
|
+
pageSize?: number;
|
|
59
|
+
/** PR states to include; when omitted the provider returns its default (open only). */
|
|
60
|
+
state?: PullRequestStateFilter | PullRequestStateFilter[];
|
|
61
|
+
/** Requests the lightweight row shape without per-row build status or commit count. */
|
|
62
|
+
summary?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Most per-repository requests one provider read keeps in flight. Defaults to 6. Only hosts that read repository
|
|
65
|
+
* by repository fan out — GitLab, GitLab self-managed, Bitbucket Cloud, Bitbucket Data Center and Azure DevOps;
|
|
66
|
+
* GitHub/GHE send one query whatever the repo count. A value that isn't a finite number >= 1 falls back to the
|
|
67
|
+
* default.
|
|
68
|
+
*/
|
|
69
|
+
scopeConcurrency?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Azure DevOps only, repo-scoped: `false` skips the lookup that fills each row's clone URLs, saving one
|
|
72
|
+
* request per repository (and fork source) per page. Rows then carry no `refs.base.url`/`refs.head.url`
|
|
73
|
+
* (empty) and no `cloneHttps`/`cloneSsh`, so leave it on for rows that will be checked out or matched to local
|
|
74
|
+
* remotes. Defaults to `true`; other providers ignore it.
|
|
75
|
+
*/
|
|
76
|
+
includeRemoteInfo?: boolean;
|
|
77
|
+
};
|
|
78
|
+
/** The members shared by every integration view. */
|
|
79
|
+
interface IntegrationViewBase {
|
|
80
|
+
readonly type: IntegrationType;
|
|
81
|
+
readonly id: IntegrationIds;
|
|
82
|
+
readonly name: string;
|
|
83
|
+
/**
|
|
84
|
+
* The `gl-provider-<key>` glicon key for this provider, which is NOT always its id: a self-managed variant
|
|
85
|
+
* draws with its cloud family's glyph.
|
|
86
|
+
*/
|
|
87
|
+
readonly icon: string;
|
|
88
|
+
readonly domain: string;
|
|
89
|
+
/** Whether the integration has a session; `undefined` until it has looked. */
|
|
90
|
+
readonly maybeConnected: boolean | undefined;
|
|
91
|
+
/** Whether the user's plan allows this integration (a trial or paid account; GitHub and GitLab cloud always do). */
|
|
92
|
+
access(): Promise<boolean>;
|
|
93
|
+
autolinks(): (AutolinkReference | DynamicAutolinkReference)[] | Promise<(AutolinkReference | DynamicAutolinkReference)[]>;
|
|
94
|
+
/** Connects the integration, prompting the user if needed; whether it became connected. */
|
|
95
|
+
connect(source: Sources): Promise<boolean>;
|
|
96
|
+
isConnected(): Promise<boolean>;
|
|
97
|
+
/**
|
|
98
|
+
* The credential the integration is connected with, refreshed first when it has expired; `undefined` when it isn't
|
|
99
|
+
* connected or the refresh failed. An unexpired token is returned as is, so one the provider has since revoked still
|
|
100
|
+
* comes back.
|
|
101
|
+
*/
|
|
102
|
+
getCredential(source: Sources): Promise<IntegrationCredential | undefined>;
|
|
103
|
+
getIssue(resource: ResourceDescriptor, id: string, options?: {
|
|
104
|
+
connectionId?: string;
|
|
105
|
+
expiryOverride?: boolean | number;
|
|
106
|
+
}): Promise<Issue | undefined>;
|
|
107
|
+
getLinkedIssueOrPullRequest(resource: ResourceDescriptor, link: {
|
|
108
|
+
id: string;
|
|
109
|
+
key: string;
|
|
110
|
+
}, options?: {
|
|
111
|
+
expiryOverride?: boolean | number;
|
|
112
|
+
type?: IssueOrPullRequestType;
|
|
113
|
+
throwOnError?: boolean;
|
|
114
|
+
}): Promise<IssueOrPullRequest | undefined>;
|
|
115
|
+
}
|
|
116
|
+
/** A git host integration (GitHub, GitLab, Bitbucket, Azure DevOps, and their self-managed variants). */
|
|
117
|
+
export interface GitHostIntegration extends IntegrationViewBase {
|
|
118
|
+
readonly type: 'git';
|
|
119
|
+
/**
|
|
120
|
+
* Removes a queued pull request from its base branch's merge queue, losing its place there. Results, failures and
|
|
121
|
+
* cancellation as {@link GitHostIntegration.enqueuePullRequest}.
|
|
122
|
+
*/
|
|
123
|
+
dequeuePullRequest(pr: PullRequest, cancellation?: AbortSignal): Promise<PullRequestMergeQueueActionResult>;
|
|
124
|
+
disconnect(options?: {
|
|
125
|
+
silent?: boolean;
|
|
126
|
+
currentSessionOnly?: boolean;
|
|
127
|
+
}): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Adds a pull request to its base branch's merge queue (where `mergeQueueRequired` says merging means queueing).
|
|
130
|
+
* The result says why on failure: the host's refusal (`already-queued`, `head-changed`, `permission`, …),
|
|
131
|
+
* `unsupported` where this host has no merge queue to act on (only GitHub.com's is), or `unknown` for anything
|
|
132
|
+
* else, including no connection or a failure to reach the host; the provider's message rides along for logs, not
|
|
133
|
+
* for display. Cancellation throws `CancellationError`.
|
|
134
|
+
*/
|
|
135
|
+
enqueuePullRequest(pr: PullRequest, cancellation?: AbortSignal): Promise<PullRequestMergeQueueActionResult>;
|
|
136
|
+
getAccountForCommit(repo: ResourceDescriptor, rev: string, options?: {
|
|
137
|
+
avatarSize?: number;
|
|
138
|
+
}): Promise<Account | UnidentifiedAuthor | undefined>;
|
|
139
|
+
getCurrentAccount(options?: {
|
|
140
|
+
avatarSize?: number;
|
|
141
|
+
connectionId?: string;
|
|
142
|
+
expiryOverride?: boolean | number;
|
|
143
|
+
}): Promise<Account | undefined>;
|
|
144
|
+
getDefaultBranch(repo: ResourceDescriptor, options?: {
|
|
145
|
+
cancellation?: AbortSignal;
|
|
146
|
+
expiryOverride?: boolean | number;
|
|
147
|
+
}): Promise<DefaultBranch | undefined>;
|
|
148
|
+
/**
|
|
149
|
+
* Merge-queue entries for the given base branches of the repository, keyed by pull request number, for rows from a
|
|
150
|
+
* read that selects no merge queue. Only hosts with a readable merge queue implement this (currently GitHub.com);
|
|
151
|
+
* `undefined` means unavailable. Interim: expect it to go once every pull request read can carry its entry.
|
|
152
|
+
*/
|
|
153
|
+
getMergeQueueEntriesByPullRequestNumber?(owner: string, repo: string, branches: readonly string[], cancellation?: AbortSignal): Promise<Map<number, PullRequestMergeQueueEntry> | undefined>;
|
|
154
|
+
/**
|
|
155
|
+
* The current user's pull requests (or, without `filters`, every pull request) in `reposOrRepoIds`, one page at a
|
|
156
|
+
* time; `undefined` when the read failed.
|
|
157
|
+
*/
|
|
158
|
+
getMyPullRequestsForRepos(reposOrRepoIds: ProviderRepositoriesInput, options?: MyPullRequestsForReposOptions, connectionId?: string): Promise<PagedResult<PullRequest> | undefined>;
|
|
159
|
+
getPullRequest(resource: ResourceDescriptor, id: string, options?: {
|
|
160
|
+
expiryOverride?: boolean | number;
|
|
161
|
+
throwOnError?: boolean;
|
|
162
|
+
}): Promise<PullRequest | undefined>;
|
|
163
|
+
getPullRequestForBranch(repo: ResourceDescriptor, branch: string, options?: {
|
|
164
|
+
avatarSize?: number;
|
|
165
|
+
expiryOverride?: boolean | number;
|
|
166
|
+
include?: IssueOrPullRequestState[];
|
|
167
|
+
/**
|
|
168
|
+
* Rethrow a failed lookup instead of folding it into `undefined`, for callers that must tell
|
|
169
|
+
* "no pull request" apart from "couldn't ask".
|
|
170
|
+
*/
|
|
171
|
+
throwOnError?: boolean;
|
|
172
|
+
}): Promise<PullRequest | undefined>;
|
|
173
|
+
getPullRequestForCommit(repo: ResourceDescriptor, rev: string, options?: {
|
|
174
|
+
expiryOverride?: boolean | number;
|
|
175
|
+
throwOnError?: boolean;
|
|
176
|
+
}): Promise<PullRequest | undefined>;
|
|
177
|
+
getPullRequestIdentityFromMaybeUrl(search: string): PullRequestUrlIdentity | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* The repository a host reports for `repo`, or `undefined` when it can't be read. Only the hosts that can look a
|
|
180
|
+
* repository up implement it.
|
|
181
|
+
*/
|
|
182
|
+
getRepoInfo?(repo: {
|
|
183
|
+
owner: string;
|
|
184
|
+
name: string;
|
|
185
|
+
project?: string;
|
|
186
|
+
connectionId?: string;
|
|
187
|
+
}): Promise<Pick<ProviderRepositoryShape, 'id' | 'namespace' | 'name' | 'project'> | undefined>;
|
|
188
|
+
getRepositoryMetadata(repo: ResourceDescriptor, options?: {
|
|
189
|
+
cancellation?: AbortSignal;
|
|
190
|
+
expiryOverride?: boolean | number;
|
|
191
|
+
}): Promise<RepositoryMetadata | undefined>;
|
|
192
|
+
/**
|
|
193
|
+
* The SSH signing keys (full OpenSSH-format `<type> <key> [comment]` strings) registered by the accounts matching
|
|
194
|
+
* `emails`, for building an `allowed_signers` file. Keyed by lowercased email; an email with no match is absent.
|
|
195
|
+
* A provider that doesn't expose signing keys (or isn't connected, or fails the read) returns an empty map.
|
|
196
|
+
*/
|
|
197
|
+
getSshSigningKeysForEmails(repo: ResourceDescriptor, emails: string[]): Promise<Map<string, string[]>>;
|
|
198
|
+
/**
|
|
199
|
+
* The ordered layers of the stack the given pull request belongs to, bottom to top. `undefined` when the host
|
|
200
|
+
* has no stacks concept, the repository isn't enrolled, or the pull request isn't stacked.
|
|
201
|
+
*/
|
|
202
|
+
getStackLayersForPullRequest?(owner: string, repo: string, pullRequestNumber: number, cancellation?: AbortSignal): Promise<PullRequestStackLayers | undefined>;
|
|
203
|
+
/**
|
|
204
|
+
* Stack membership for every stacked pull request in the repository, keyed by pull request number. Only hosts
|
|
205
|
+
* with a stacks concept implement this (currently GitHub).
|
|
206
|
+
*/
|
|
207
|
+
getStacksByPullRequestNumber?(owner: string, repo: string, cancellation?: AbortSignal): Promise<Map<number, PullRequestStackInfo> | undefined>;
|
|
208
|
+
mergePullRequest(pr: PullRequest, options?: {
|
|
209
|
+
mergeMethod?: PullRequestMergeMethod;
|
|
210
|
+
}, cancellation?: AbortSignal): Promise<boolean>;
|
|
211
|
+
/** Account-wide (or repo-scoped) search for the current user's pull requests. */
|
|
212
|
+
searchMyPullRequests(repos?: ResourceDescriptor | ResourceDescriptor[], cancellation?: AbortSignal, options?: SearchMyPullRequestsOptions & {
|
|
213
|
+
connectionId?: string;
|
|
214
|
+
}): Promise<IntegrationResult<PullRequest[] | undefined>>;
|
|
215
|
+
/** Free-text search across pull requests, optionally narrowed to `repos`. */
|
|
216
|
+
searchPullRequests(searchQuery: string, repos?: ResourceDescriptor | ResourceDescriptor[], cancellation?: AbortSignal, options?: SearchPullRequestsOptions & {
|
|
217
|
+
connectionId?: string;
|
|
218
|
+
}): Promise<PullRequest[] | undefined>;
|
|
219
|
+
}
|
|
220
|
+
/** An issue tracker integration (Jira, Linear, Trello, and their self-managed variants). */
|
|
221
|
+
export interface IssuesIntegration extends IntegrationViewBase {
|
|
222
|
+
readonly type: 'issues';
|
|
223
|
+
}
|
|
224
|
+
export type Integration = GitHostIntegration | IssuesIntegration;
|
|
225
|
+
export type IntegrationById<T extends IntegrationIds> = T extends IssuesHostIntegrationIds ? IssuesIntegration : GitHostIntegration;
|
|
226
|
+
/**
|
|
227
|
+
* What a consumer-owned cache is told about the integration a cached value was read through: enough to key the value
|
|
228
|
+
* by host and to invalidate it when the connection or its credential changes.
|
|
229
|
+
*/
|
|
230
|
+
export interface IntegrationCacheDescriptor {
|
|
231
|
+
readonly id: IntegrationIds;
|
|
232
|
+
readonly domain?: string;
|
|
233
|
+
/** Whether the integration has a session; `undefined` until it has looked. */
|
|
234
|
+
readonly maybeConnected?: boolean;
|
|
235
|
+
/** A hash of the current session's token, which changes when the account or token does. */
|
|
236
|
+
readonly sessionFingerprint?: string;
|
|
237
|
+
}
|
|
238
|
+
/** Whether `value` is an integration. Replaces an `instanceof` check against the internal base class. */
|
|
239
|
+
export declare function isIntegration(value: unknown): value is Integration;
|
|
240
|
+
/**
|
|
241
|
+
* Whether `integration` is a git host. Generic so it narrows whatever integration type it is handed: the public
|
|
242
|
+
* {@link Integration} views, or (inside the package) the classes, which implement them.
|
|
243
|
+
*/
|
|
244
|
+
export declare function isGitHostIntegration<T extends Integration>(integration: T): integration is Extract<T, {
|
|
245
|
+
readonly type: 'git';
|
|
246
|
+
}>;
|
|
247
|
+
/** Whether `integration` is an issue tracker. Generic for the same reason as {@link isGitHostIntegration}. */
|
|
248
|
+
export declare function isIssuesIntegration<T extends Integration>(integration: T): integration is Extract<T, {
|
|
249
|
+
readonly type: 'issues';
|
|
250
|
+
}>;
|
|
251
|
+
//#endregion
|
|
252
|
+
//# sourceMappingURL=publicIntegration.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IntegrationBase } from "./integration.js";
|
|
2
|
+
//#region ../plus/integrations/src/models/publicIntegration.ts
|
|
3
|
+
/** Whether `value` is an integration. Replaces an `instanceof` check against the internal base class. */
|
|
4
|
+
function isIntegration(value) {
|
|
5
|
+
return value instanceof IntegrationBase;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Whether `integration` is a git host. Generic so it narrows whatever integration type it is handed: the public
|
|
9
|
+
* {@link Integration} views, or (inside the package) the classes, which implement them.
|
|
10
|
+
*/
|
|
11
|
+
function isGitHostIntegration(integration) {
|
|
12
|
+
return integration.type === "git";
|
|
13
|
+
}
|
|
14
|
+
/** Whether `integration` is an issue tracker. Generic for the same reason as {@link isGitHostIntegration}. */
|
|
15
|
+
function isIssuesIntegration(integration) {
|
|
16
|
+
return integration.type === "issues";
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { isGitHostIntegration, isIntegration, isIssuesIntegration };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=publicIntegration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publicIntegration.js","names":[],"sources":["../../../../../plus/integrations/src/models/publicIntegration.ts"],"sourcesContent":["import type { Account, UnidentifiedAuthor } from '@gitlens/git/models/author.js';\nimport type { AutolinkReference, DynamicAutolinkReference } from '@gitlens/git/models/autolink.js';\nimport type { DefaultBranch } from '@gitlens/git/models/defaultBranch.js';\nimport type { Issue } from '@gitlens/git/models/issue.js';\nimport type {\n\tIssueOrPullRequest,\n\tIssueOrPullRequestState,\n\tIssueOrPullRequestType,\n} from '@gitlens/git/models/issueOrPullRequest.js';\nimport type {\n\tPullRequest,\n\tPullRequestMergeMethod,\n\tPullRequestMergeQueueActionResult,\n\tPullRequestMergeQueueEntry,\n\tPullRequestStackInfo,\n\tPullRequestStackLayers,\n\tPullRequestStateFilter,\n} from '@gitlens/git/models/pullRequest.js';\nimport type { RepositoryMetadata } from '@gitlens/git/models/repositoryMetadata.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport type { PullRequestUrlIdentity } from '@gitlens/git/utils/pullRequest.utils.js';\nimport type { PagedResult } from '@gitlens/utils/paging.js';\nimport type {\n\tGitCloudHostIntegrationId,\n\tIntegrationIds,\n\tIssuesCloudHostIntegrationId,\n\tIssuesHostIntegrationIds,\n} from '../constants.js';\nimport type { ProviderRepositoriesInput } from '../manager.js';\nimport type { PullRequestFilter } from '../providerFilters.js';\nimport type { ProviderRepositoryShape } from '../results.js';\nimport type { Sources } from '../telemetry.js';\nimport { IntegrationBase } from './integration.js';\n\n// The public, interface-only views of the integration classes: what a consumer of the `index.js` facade may call on\n// an integration. They are written out member by member, in package-owned and `@gitlens/*` types only, so nothing\n// a consumer can reach from them names `@gitkraken/provider-apis` or an internal class. The classes `implements`\n// these views, so the compiler keeps each class member assignable to the view's.\n// Code inside the package keeps importing the classes from `models/*`.\n// The views' doc comments are the consumer contract; the classes' doc comments are maintainer notes.\n\n/** The kind of an integration: a git host or an issue tracker. */\nexport type IntegrationType = 'git' | 'issues';\n\n// Keep this in step with `isSelfManagedHostIntegrationId`: it is the type-level twin of that predicate, and a\n// disagreement compiles cleanly while the runtime writes a domain-keyed key the type says is unkeyed (so the\n// local-disconnect flag is written under one key and read under another).\nexport type IntegrationKey<T extends IntegrationIds = IntegrationIds> = T extends\n\t| GitCloudHostIntegrationId\n\t| IssuesCloudHostIntegrationId\n\t? `${T}`\n\t: `${T}:${string}`;\n\nexport type IntegrationConnectedKey<T extends IntegrationIds = IntegrationIds> = `connected:${IntegrationKey<T>}`;\n\n/** A read's outcome: its value, or the error it failed with; `undefined` when there was nothing to read. */\nexport type IntegrationResult<T> =\n\t| { value: T; duration?: number; error?: Error }\n\t| { error: Error; duration?: number; value?: never }\n\t| undefined;\n\n/** The credential an integration is connected with, for a consumer that has to hand it to another service. */\nexport interface IntegrationCredential {\n\t/** The id of the provider the token was issued for, which is the integration's own id. */\n\treadonly providerId: IntegrationIds;\n\treadonly accessToken: string;\n}\n\n/** Read options for {@link GitHostIntegration.searchMyPullRequests} and the provider hook behind it. */\nexport type SearchMyPullRequestsOptions = {\n\t/** Suppresses the user-facing notification when the read fails. */\n\tsilent?: boolean;\n\t/**\n\t * PR states to include (open/closed/merged/all). Providers that cannot express it in a single query\n\t * filter the normalized results; omitted preserves the historical open-only behavior.\n\t */\n\tstate?: PullRequestStateFilter;\n\tincludeReviewRequested?: boolean;\n};\n\n/** Read options for {@link GitHostIntegration.searchPullRequests} and the provider hook behind it. */\nexport type SearchPullRequestsOptions = {\n\t/** PR states to include; omitted preserves the provider's default. */\n\tinclude?: IssueOrPullRequestState[];\n};\n\n/** Read options for {@link GitHostIntegration.getMyPullRequestsForRepos}. */\nexport type MyPullRequestsForReposOptions = {\n\tfilters?: PullRequestFilter[];\n\tcursor?: string;\n\tcustomUrl?: string;\n\tpage?: number;\n\tpageSize?: number;\n\t/** PR states to include; when omitted the provider returns its default (open only). */\n\tstate?: PullRequestStateFilter | PullRequestStateFilter[];\n\t/** Requests the lightweight row shape without per-row build status or commit count. */\n\tsummary?: boolean;\n\t/**\n\t * Most per-repository requests one provider read keeps in flight. Defaults to 6. Only hosts that read repository\n\t * by repository fan out — GitLab, GitLab self-managed, Bitbucket Cloud, Bitbucket Data Center and Azure DevOps;\n\t * GitHub/GHE send one query whatever the repo count. A value that isn't a finite number >= 1 falls back to the\n\t * default.\n\t */\n\tscopeConcurrency?: number;\n\t/**\n\t * Azure DevOps only, repo-scoped: `false` skips the lookup that fills each row's clone URLs, saving one\n\t * request per repository (and fork source) per page. Rows then carry no `refs.base.url`/`refs.head.url`\n\t * (empty) and no `cloneHttps`/`cloneSsh`, so leave it on for rows that will be checked out or matched to local\n\t * remotes. Defaults to `true`; other providers ignore it.\n\t */\n\tincludeRemoteInfo?: boolean;\n};\n\n/** The members shared by every integration view. */\ninterface IntegrationViewBase {\n\treadonly type: IntegrationType;\n\treadonly id: IntegrationIds;\n\treadonly name: string;\n\t/**\n\t * The `gl-provider-<key>` glicon key for this provider, which is NOT always its id: a self-managed variant\n\t * draws with its cloud family's glyph.\n\t */\n\treadonly icon: string;\n\treadonly domain: string;\n\t/** Whether the integration has a session; `undefined` until it has looked. */\n\treadonly maybeConnected: boolean | undefined;\n\n\t/** Whether the user's plan allows this integration (a trial or paid account; GitHub and GitLab cloud always do). */\n\taccess(): Promise<boolean>;\n\tautolinks():\n\t\t| (AutolinkReference | DynamicAutolinkReference)[]\n\t\t| Promise<(AutolinkReference | DynamicAutolinkReference)[]>;\n\t/** Connects the integration, prompting the user if needed; whether it became connected. */\n\tconnect(source: Sources): Promise<boolean>;\n\tisConnected(): Promise<boolean>;\n\t/**\n\t * The credential the integration is connected with, refreshed first when it has expired; `undefined` when it isn't\n\t * connected or the refresh failed. An unexpired token is returned as is, so one the provider has since revoked still\n\t * comes back.\n\t */\n\tgetCredential(source: Sources): Promise<IntegrationCredential | undefined>;\n\tgetIssue(\n\t\tresource: ResourceDescriptor,\n\t\tid: string,\n\t\toptions?: { connectionId?: string; expiryOverride?: boolean | number },\n\t): Promise<Issue | undefined>;\n\tgetLinkedIssueOrPullRequest(\n\t\tresource: ResourceDescriptor,\n\t\tlink: { id: string; key: string },\n\t\toptions?: { expiryOverride?: boolean | number; type?: IssueOrPullRequestType; throwOnError?: boolean },\n\t): Promise<IssueOrPullRequest | undefined>;\n}\n\n/** A git host integration (GitHub, GitLab, Bitbucket, Azure DevOps, and their self-managed variants). */\nexport interface GitHostIntegration extends IntegrationViewBase {\n\treadonly type: 'git';\n\n\t/**\n\t * Removes a queued pull request from its base branch's merge queue, losing its place there. Results, failures and\n\t * cancellation as {@link GitHostIntegration.enqueuePullRequest}.\n\t */\n\tdequeuePullRequest(pr: PullRequest, cancellation?: AbortSignal): Promise<PullRequestMergeQueueActionResult>;\n\tdisconnect(options?: { silent?: boolean; currentSessionOnly?: boolean }): Promise<void>;\n\t/**\n\t * Adds a pull request to its base branch's merge queue (where `mergeQueueRequired` says merging means queueing).\n\t * The result says why on failure: the host's refusal (`already-queued`, `head-changed`, `permission`, …),\n\t * `unsupported` where this host has no merge queue to act on (only GitHub.com's is), or `unknown` for anything\n\t * else, including no connection or a failure to reach the host; the provider's message rides along for logs, not\n\t * for display. Cancellation throws `CancellationError`.\n\t */\n\tenqueuePullRequest(pr: PullRequest, cancellation?: AbortSignal): Promise<PullRequestMergeQueueActionResult>;\n\tgetAccountForCommit(\n\t\trepo: ResourceDescriptor,\n\t\trev: string,\n\t\toptions?: { avatarSize?: number },\n\t): Promise<Account | UnidentifiedAuthor | undefined>;\n\tgetCurrentAccount(options?: {\n\t\tavatarSize?: number;\n\t\tconnectionId?: string;\n\t\texpiryOverride?: boolean | number;\n\t}): Promise<Account | undefined>;\n\tgetDefaultBranch(\n\t\trepo: ResourceDescriptor,\n\t\toptions?: { cancellation?: AbortSignal; expiryOverride?: boolean | number },\n\t): Promise<DefaultBranch | undefined>;\n\t/**\n\t * Merge-queue entries for the given base branches of the repository, keyed by pull request number, for rows from a\n\t * read that selects no merge queue. Only hosts with a readable merge queue implement this (currently GitHub.com);\n\t * `undefined` means unavailable. Interim: expect it to go once every pull request read can carry its entry.\n\t */\n\tgetMergeQueueEntriesByPullRequestNumber?(\n\t\towner: string,\n\t\trepo: string,\n\t\tbranches: readonly string[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<Map<number, PullRequestMergeQueueEntry> | undefined>;\n\t/**\n\t * The current user's pull requests (or, without `filters`, every pull request) in `reposOrRepoIds`, one page at a\n\t * time; `undefined` when the read failed.\n\t */\n\tgetMyPullRequestsForRepos(\n\t\treposOrRepoIds: ProviderRepositoriesInput,\n\t\toptions?: MyPullRequestsForReposOptions,\n\t\tconnectionId?: string,\n\t): Promise<PagedResult<PullRequest> | undefined>;\n\tgetPullRequest(\n\t\tresource: ResourceDescriptor,\n\t\tid: string,\n\t\toptions?: { expiryOverride?: boolean | number; throwOnError?: boolean },\n\t): Promise<PullRequest | undefined>;\n\tgetPullRequestForBranch(\n\t\trepo: ResourceDescriptor,\n\t\tbranch: string,\n\t\toptions?: {\n\t\t\tavatarSize?: number;\n\t\t\texpiryOverride?: boolean | number;\n\t\t\tinclude?: IssueOrPullRequestState[];\n\t\t\t/**\n\t\t\t * Rethrow a failed lookup instead of folding it into `undefined`, for callers that must tell\n\t\t\t * \"no pull request\" apart from \"couldn't ask\".\n\t\t\t */\n\t\t\tthrowOnError?: boolean;\n\t\t},\n\t): Promise<PullRequest | undefined>;\n\tgetPullRequestForCommit(\n\t\trepo: ResourceDescriptor,\n\t\trev: string,\n\t\toptions?: { expiryOverride?: boolean | number; throwOnError?: boolean },\n\t): Promise<PullRequest | undefined>;\n\tgetPullRequestIdentityFromMaybeUrl(search: string): PullRequestUrlIdentity | undefined;\n\t/**\n\t * The repository a host reports for `repo`, or `undefined` when it can't be read. Only the hosts that can look a\n\t * repository up implement it.\n\t */\n\tgetRepoInfo?(repo: {\n\t\towner: string;\n\t\tname: string;\n\t\tproject?: string;\n\t\tconnectionId?: string;\n\t}): Promise<Pick<ProviderRepositoryShape, 'id' | 'namespace' | 'name' | 'project'> | undefined>;\n\tgetRepositoryMetadata(\n\t\trepo: ResourceDescriptor,\n\t\toptions?: { cancellation?: AbortSignal; expiryOverride?: boolean | number },\n\t): Promise<RepositoryMetadata | undefined>;\n\t/**\n\t * The SSH signing keys (full OpenSSH-format `<type> <key> [comment]` strings) registered by the accounts matching\n\t * `emails`, for building an `allowed_signers` file. Keyed by lowercased email; an email with no match is absent.\n\t * A provider that doesn't expose signing keys (or isn't connected, or fails the read) returns an empty map.\n\t */\n\tgetSshSigningKeysForEmails(repo: ResourceDescriptor, emails: string[]): Promise<Map<string, string[]>>;\n\t/**\n\t * The ordered layers of the stack the given pull request belongs to, bottom to top. `undefined` when the host\n\t * has no stacks concept, the repository isn't enrolled, or the pull request isn't stacked.\n\t */\n\tgetStackLayersForPullRequest?(\n\t\towner: string,\n\t\trepo: string,\n\t\tpullRequestNumber: number,\n\t\tcancellation?: AbortSignal,\n\t): Promise<PullRequestStackLayers | undefined>;\n\t/**\n\t * Stack membership for every stacked pull request in the repository, keyed by pull request number. Only hosts\n\t * with a stacks concept implement this (currently GitHub).\n\t */\n\tgetStacksByPullRequestNumber?(\n\t\towner: string,\n\t\trepo: string,\n\t\tcancellation?: AbortSignal,\n\t): Promise<Map<number, PullRequestStackInfo> | undefined>;\n\tmergePullRequest(\n\t\tpr: PullRequest,\n\t\toptions?: { mergeMethod?: PullRequestMergeMethod },\n\t\tcancellation?: AbortSignal,\n\t): Promise<boolean>;\n\t/** Account-wide (or repo-scoped) search for the current user's pull requests. */\n\tsearchMyPullRequests(\n\t\trepos?: ResourceDescriptor | ResourceDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t\toptions?: SearchMyPullRequestsOptions & { connectionId?: string },\n\t): Promise<IntegrationResult<PullRequest[] | undefined>>;\n\t/** Free-text search across pull requests, optionally narrowed to `repos`. */\n\tsearchPullRequests(\n\t\tsearchQuery: string,\n\t\trepos?: ResourceDescriptor | ResourceDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t\toptions?: SearchPullRequestsOptions & { connectionId?: string },\n\t): Promise<PullRequest[] | undefined>;\n}\n\n/** An issue tracker integration (Jira, Linear, Trello, and their self-managed variants). */\nexport interface IssuesIntegration extends IntegrationViewBase {\n\treadonly type: 'issues';\n}\n\nexport type Integration = GitHostIntegration | IssuesIntegration;\n\nexport type IntegrationById<T extends IntegrationIds> = T extends IssuesHostIntegrationIds\n\t? IssuesIntegration\n\t: GitHostIntegration;\n\n/**\n * What a consumer-owned cache is told about the integration a cached value was read through: enough to key the value\n * by host and to invalidate it when the connection or its credential changes.\n */\nexport interface IntegrationCacheDescriptor {\n\treadonly id: IntegrationIds;\n\treadonly domain?: string;\n\t/** Whether the integration has a session; `undefined` until it has looked. */\n\treadonly maybeConnected?: boolean;\n\t/** A hash of the current session's token, which changes when the account or token does. */\n\treadonly sessionFingerprint?: string;\n}\n\n/** Whether `value` is an integration. Replaces an `instanceof` check against the internal base class. */\nexport function isIntegration(value: unknown): value is Integration {\n\treturn value instanceof IntegrationBase;\n}\n\n/**\n * Whether `integration` is a git host. Generic so it narrows whatever integration type it is handed: the public\n * {@link Integration} views, or (inside the package) the classes, which implement them.\n */\nexport function isGitHostIntegration<T extends Integration>(\n\tintegration: T,\n): integration is Extract<T, { readonly type: 'git' }> {\n\treturn integration.type === 'git';\n}\n\n/** Whether `integration` is an issue tracker. Generic for the same reason as {@link isGitHostIntegration}. */\nexport function isIssuesIntegration<T extends Integration>(\n\tintegration: T,\n): integration is Extract<T, { readonly type: 'issues' }> {\n\treturn integration.type === 'issues';\n}\n"],"mappings":";;;AA0TA,SAAgB,cAAc,OAAsC;CACnE,OAAO,iBAAiB;AACzB;;;;;AAMA,SAAgB,qBACf,aACsD;CACtD,OAAO,YAAY,SAAS;AAC7B;;AAGA,SAAgB,oBACf,aACyD;CACzD,OAAO,YAAY,SAAS;AAC7B"}
|