@gitkraken/core-gitlens 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -1
- package/dist/git/models/remote.js +2 -2
- package/dist/git/models/remote.js.map +1 -1
- package/dist/git/remotes/matcher.js +25 -3
- package/dist/git/remotes/matcher.js.map +1 -1
- package/dist/git/utils/branchLanded.utils.d.ts +7 -0
- package/dist/git/utils/branchLanded.utils.js +10 -1
- package/dist/git/utils/branchLanded.utils.js.map +1 -1
- package/dist/git/utils/remote.utils.d.ts +1 -0
- package/dist/git/utils/remote.utils.js +14 -5
- package/dist/git/utils/remote.utils.js.map +1 -1
- package/dist/git-cli/parsers/logParser.js +227 -468
- package/dist/git-cli/parsers/logParser.js.map +1 -1
- package/dist/git-cli/parsers/refParser.js +4 -4
- package/dist/git-cli/parsers/refParser.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +5 -0
- package/dist/git-cli/providers/branches.js +25 -21
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/config.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/staging.js +1 -1
- package/dist/ipc/discovery.js +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
- package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.d.ts +31 -0
- package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js +166 -0
- package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js.map +1 -0
- package/dist/plus/git-github/api/github.d.ts +13 -5
- package/dist/plus/git-github/api/github.js +53 -13
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueWrites.d.ts +7 -1
- package/dist/plus/git-github/api/issueWrites.js +62 -32
- package/dist/plus/git-github/api/issueWrites.js.map +1 -1
- package/dist/plus/git-github/api/pullRequestWrites.d.ts +7 -3
- package/dist/plus/git-github/api/pullRequestWrites.js +120 -67
- package/dist/plus/git-github/api/pullRequestWrites.js.map +1 -1
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.d.ts +44 -0
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js +199 -0
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js.map +1 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +7 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.js +53 -7
- package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +2 -38
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +0 -199
- package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +4 -2
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js +12 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
- package/dist/plus/integrations/authentication/models.d.ts +0 -1
- package/dist/plus/integrations/authentication/models.js +1 -2
- package/dist/plus/integrations/authentication/models.js.map +1 -1
- package/dist/plus/integrations/constants.d.ts +0 -10
- package/dist/plus/integrations/constants.js +1 -95
- package/dist/plus/integrations/constants.js.map +1 -1
- package/dist/plus/integrations/context.d.ts +17 -17
- package/dist/plus/integrations/index.d.ts +44 -25
- package/dist/plus/integrations/index.js +41 -8
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +24 -24
- package/dist/plus/integrations/integrationService.js +125 -34
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/lite.js +1 -1
- package/dist/plus/integrations/lite.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +81 -21
- package/dist/plus/integrations/models/actionablePullRequest.d.ts +213 -0
- package/dist/plus/integrations/models/actionablePullRequest.js +25 -0
- package/dist/plus/integrations/models/actionablePullRequest.js.map +1 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +13 -46
- package/dist/plus/integrations/models/gitHostIntegration.js +22 -8
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +11 -175
- package/dist/plus/integrations/models/integration.js +22 -76
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issueTrackerWrites.d.ts +128 -0
- package/dist/plus/integrations/models/issueTrackerWrites.js +0 -0
- package/dist/plus/integrations/models/issuesIntegration.d.ts +9 -5
- package/dist/plus/integrations/models/issuesIntegration.js +5 -3
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
- package/dist/plus/integrations/models/publicIntegration.d.ts +257 -0
- package/dist/plus/integrations/models/publicIntegration.js +21 -0
- package/dist/plus/integrations/models/publicIntegration.js.map +1 -0
- package/dist/plus/integrations/providerFilters.d.ts +58 -0
- package/dist/plus/integrations/providerFilters.js.map +1 -1
- package/dist/plus/integrations/providers/actionablePullRequests.d.ts +19 -0
- package/dist/plus/integrations/providers/actionablePullRequests.js +32 -0
- package/dist/plus/integrations/providers/actionablePullRequests.js.map +1 -0
- package/dist/plus/integrations/providers/apiClients.d.ts +1 -2
- package/dist/plus/integrations/providers/apiClients.js.map +1 -1
- package/dist/plus/integrations/providers/asana.d.ts +3 -2
- package/dist/plus/integrations/providers/asana.js +2 -1
- package/dist/plus/integrations/providers/asana.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.d.ts +1 -1
- package/dist/plus/integrations/providers/azure/azure.js +1 -1
- package/dist/plus/integrations/providers/azure/azure.utils.d.ts +10 -3
- package/dist/plus/integrations/providers/azure/azure.utils.js +5 -1
- package/dist/plus/integrations/providers/azure/azure.utils.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts +1 -5
- package/dist/plus/integrations/providers/azure/models.js +1 -1
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +8 -5
- package/dist/plus/integrations/providers/azureDevOps.js +2 -1
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +5 -4
- package/dist/plus/integrations/providers/azureDevOpsServer.js +3 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +2 -2
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.d.ts +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.d.ts +5 -4
- package/dist/plus/integrations/providers/bitbucket-server.js +2 -1
- package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket.d.ts +4 -3
- package/dist/plus/integrations/providers/bitbucket.js +2 -1
- package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/github/github.d.ts +0 -1
- package/dist/plus/integrations/providers/github/github.js +1 -1
- package/dist/plus/integrations/providers/github/github.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +29 -11
- package/dist/plus/integrations/providers/github.js +195 -78
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +2 -2
- package/dist/plus/integrations/providers/gitlab/gitlab.js +1 -2
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts +14 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/models.d.ts +2 -10
- package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.d.ts +7 -5
- package/dist/plus/integrations/providers/gitlab.js +2 -1
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
- package/dist/plus/integrations/providers/jira-server.d.ts +4 -4
- package/dist/plus/integrations/providers/jira-server.js +3 -2
- package/dist/plus/integrations/providers/jira-server.js.map +1 -1
- package/dist/plus/integrations/providers/jira.d.ts +3 -3
- package/dist/plus/integrations/providers/jira.js +4 -3
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.d.ts +3 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueWriteErrors.d.ts +10 -0
- package/dist/plus/integrations/providers/jiraIssueWriteErrors.js +68 -0
- package/dist/plus/integrations/providers/jiraIssueWriteErrors.js.map +1 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.d.ts +40 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.js +397 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.js.map +1 -0
- package/dist/plus/integrations/providers/linear.d.ts +4 -3
- package/dist/plus/integrations/providers/linear.js +3 -2
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/providers/linearIssuesEtag.d.ts +1 -1
- package/dist/plus/integrations/providers/linearIssuesEtag.js +1 -1
- package/dist/plus/integrations/providers/linearIssuesEtag.js.map +1 -1
- package/dist/plus/integrations/providers/metadata.d.ts +136 -0
- package/dist/plus/integrations/providers/metadata.js +513 -0
- package/dist/plus/integrations/providers/metadata.js.map +1 -0
- package/dist/plus/integrations/providers/models.d.ts +10 -206
- package/dist/plus/integrations/providers/models.js +8 -539
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +7 -3
- package/dist/plus/integrations/providers/providersApi.js +23 -11
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/trello.d.ts +1 -1
- package/dist/plus/integrations/providers/trello.js +2 -1
- package/dist/plus/integrations/providers/trello.js.map +1 -1
- package/dist/plus/integrations/providers/utils/providerPaging.d.ts +2 -0
- package/dist/plus/integrations/providers/utils/providerPaging.js +3 -2
- package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
- package/dist/plus/integrations/providers/utils.d.ts +119 -10
- package/dist/plus/integrations/providers/utils.js +57 -3
- package/dist/plus/integrations/providers/utils.js.map +1 -1
- package/dist/plus/integrations/reads/autolinks.d.ts +1 -1
- package/dist/plus/integrations/reads/autolinks.js +1 -1
- package/dist/plus/integrations/reads/autolinks.js.map +1 -1
- package/dist/plus/integrations/reads/broaden.d.ts +1 -1
- package/dist/plus/integrations/reads/broaden.js +3 -2
- package/dist/plus/integrations/reads/broaden.js.map +1 -1
- package/dist/plus/integrations/reads/context.d.ts +1 -1
- package/dist/plus/integrations/reads/counts.d.ts +1 -88
- package/dist/plus/integrations/reads/counts.js +4 -2
- package/dist/plus/integrations/reads/counts.js.map +1 -1
- package/dist/plus/integrations/reads/currentAccount.d.ts +1 -18
- package/dist/plus/integrations/reads/currentAccount.js.map +1 -1
- package/dist/plus/integrations/reads/drains.d.ts +4 -3
- package/dist/plus/integrations/reads/drains.js +1 -1
- package/dist/plus/integrations/reads/drains.js.map +1 -1
- package/dist/plus/integrations/reads/etag.d.ts +174 -3
- package/dist/plus/integrations/reads/etag.js +69 -14
- package/dist/plus/integrations/reads/etag.js.map +1 -1
- package/dist/plus/integrations/reads/filters.d.ts +3 -61
- package/dist/plus/integrations/reads/filters.js +1 -1
- package/dist/plus/integrations/reads/filters.js.map +1 -1
- package/dist/plus/integrations/reads/hierarchy.d.ts +1 -1
- package/dist/plus/integrations/reads/hierarchy.js +4 -2
- package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
- package/dist/plus/integrations/reads/issueBatch.d.ts +2 -102
- package/dist/plus/integrations/reads/issueBatch.js +3 -4
- package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.d.ts +1 -1
- package/dist/plus/integrations/reads/issueTracker.js +4 -3
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
- package/dist/plus/integrations/reads/issues.d.ts +1 -1
- package/dist/plus/integrations/reads/issues.js +4 -2
- package/dist/plus/integrations/reads/issues.js.map +1 -1
- package/dist/plus/integrations/reads/paging.d.ts +1 -1
- package/dist/plus/integrations/reads/paging.js +1 -1
- package/dist/plus/integrations/reads/paging.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestActivity.d.ts +1 -24
- package/dist/plus/integrations/reads/pullRequestActivity.js +2 -1
- package/dist/plus/integrations/reads/pullRequestActivity.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBatch.d.ts +2 -56
- package/dist/plus/integrations/reads/pullRequestBatch.js +23 -3
- package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBranches.d.ts +1 -47
- package/dist/plus/integrations/reads/pullRequestBranches.js +2 -1
- package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestCheckLogs.d.ts +1 -15
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js +2 -1
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequests.js +4 -2
- package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestsForCommits.d.ts +1 -16
- package/dist/plus/integrations/reads/pullRequestsForCommits.js +2 -1
- package/dist/plus/integrations/reads/pullRequestsForCommits.js.map +1 -1
- package/dist/plus/integrations/reads/resolveRepository.js +10 -5
- package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
- package/dist/plus/integrations/reads/searchIssues.js +2 -1
- package/dist/plus/integrations/reads/searchIssues.js.map +1 -1
- package/dist/plus/integrations/reads/searchPullRequests.js +2 -1
- package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/sweeps.d.ts +1 -1
- package/dist/plus/integrations/reads/sweeps.js +3 -2
- package/dist/plus/integrations/reads/sweeps.js.map +1 -1
- package/dist/plus/integrations/reads/warnings.d.ts +1 -1
- package/dist/plus/integrations/reads/warnings.js +1 -1
- package/dist/plus/integrations/reads/warnings.js.map +1 -1
- package/dist/plus/integrations/results.d.ts +324 -2
- package/dist/plus/integrations/results.js.map +1 -1
- package/dist/plus/integrations/telemetry.d.ts +0 -10
- package/dist/plus/integrations/telemetry.js +0 -11
- package/dist/plus/integrations/utils/domain.utils.d.ts +1 -0
- package/dist/plus/integrations/utils/domain.utils.js +10 -2
- package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
- package/dist/plus/integrations/utils/integration.utils.d.ts +2 -6
- package/dist/plus/integrations/utils/integration.utils.js +8 -9
- package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
- package/dist/utils/env/node/exec.js +2 -2
- package/dist/utils/keys/chord.d.ts +13 -2
- package/dist/utils/keys/chord.js +76 -17
- package/dist/utils/keys/chord.js.map +1 -1
- package/dist/utils/keys/keybinding.d.ts +12 -0
- package/dist/utils/keys/keybinding.js +52 -2
- package/dist/utils/keys/keybinding.js.map +1 -1
- package/dist/utils/markdown.d.ts +21 -0
- package/dist/utils/markdown.js +33 -1
- package/dist/utils/markdown.js.map +1 -1
- package/docs/integrations.md +174 -19
- package/package.json +5 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +0 -1
- package/dist/plus/integrations/telemetry.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { trimTrailingSlashes } from "../../utils/path.js";
|
|
2
2
|
import "./constants.js";
|
|
3
|
-
import { providersMetadata } from "./providers/
|
|
3
|
+
import { providersMetadata } from "./providers/metadata.js";
|
|
4
4
|
import { toTokenInfo } from "./authentication/models.js";
|
|
5
5
|
import { GitHubApi } from "../git-github/api/github.js";
|
|
6
6
|
import { AzureDevOpsApi } from "./providers/azure/azure.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lite.js","names":[],"sources":["../../../../plus/integrations/src/lite.ts"],"sourcesContent":["// A lightweight, token-scoped entry point for stateless single-shot provider reads.\n//\n// Unlike `createIntegrationManager`, this does NOT build an `IntegrationServiceContext`\n// (no storage/account/config/cache/repositories/hooks) and runs no session/OAuth lifecycle.\n// A consumer that already holds a provider access token (obtained by its own means, e.g.\n// the GitKraken account backend's `v1/provider-tokens/{provider}` endpoint) can call the\n// per-provider API client directly and get back the same DTOs the session-managed\n// `GitHostIntegration` returns.\n//\n// Provider notes:\n// - Azure DevOps encodes the repository as the composite string `\"{project}/_git/{repoName}\"`\n// in the `repo` argument (matching the descriptor `GitHostIntegration` uses); `owner` is the\n// organization. Pass `repo` in that shape for Azure.\n// - Bitbucket Cloud `getDefaultBranch`/`getRepositoryMetadata` depend on `mainbranch`/`parent`\n// fields the API may omit for some repos; they resolve to `undefined` when absent.\n// - Bitbucket Server (`bitbucket-server`) is not supported here — its reads use a different\n// REST surface that this token-scoped path doesn't wire up.\n\nimport type { GitHubApiConfig } from '@gitlens/git-github/api/config.js';\nimport { GitHubApi } from '@gitlens/git-github/api/github.js';\nimport type { DefaultBranch } from '@gitlens/git/models/defaultBranch.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\nimport type { RepositoryMetadata } from '@gitlens/git/models/repositoryMetadata.js';\nimport { trimTrailingSlashes } from '@gitlens/utils/path.js';\nimport type { TokenWithInfo } from './authentication/models.js';\nimport { toTokenInfo } from './authentication/models.js';\nimport { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId } from './constants.js';\nimport type { ProviderApiConfig } from './providers/apiConfig.js';\nimport { AzureDevOpsApi } from './providers/azure/azure.js';\nimport { BitbucketApi } from './providers/bitbucket/bitbucket.js';\nimport { GitLabApi } from './providers/gitlab/gitlab.js';\nimport { providersMetadata } from './providers/models.js';\n\n/** The git-hosting integrations that expose a token-scoped read path here. */\nexport type TokenScopedGitHostId =\n\t| GitCloudHostIntegrationId.GitHub\n\t| GitCloudHostIntegrationId.GitLab\n\t| GitCloudHostIntegrationId.Bitbucket\n\t| GitCloudHostIntegrationId.AzureDevOps\n\t| GitSelfManagedHostIntegrationId.CloudGitHubEnterprise\n\t| GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted\n\t| GitSelfManagedHostIntegrationId.AzureDevOpsServer;\n\nexport interface TokenScopedGitHostToken {\n\t/** The provider access token the consumer already holds. */\n\treadonly accessToken: string;\n\t/**\n\t * Host domain for self-managed instances (e.g. `git.example.com`). Ignored for cloud ids. For an Azure\n\t * DevOps Server reachable over plain HTTP, include the scheme (e.g. `http://tfs.example.com`); otherwise\n\t * `https` is assumed.\n\t */\n\treadonly domain?: string;\n\t/** Optional scopes carried by the token, surfaced only in logging metadata. */\n\treadonly scopes?: readonly string[];\n\t/** Whether the token came from a GK-cloud connection (vs a raw PAT). Defaults to `true`. */\n\treadonly cloud?: boolean;\n}\n\nexport interface TokenScopedHttpConfig {\n\t/** The `fetch` implementation to use for HTTP requests. */\n\tfetch(input: string | URL, init?: RequestInit): Promise<Response>;\n\t/**\n\t * Wrap an async op so TLS validation is disabled when `ignoreSSLErrors` is `'force'`. Optional —\n\t * defaults to a pass-through, which is correct for the browser and for any consumer not toggling SSL.\n\t */\n\twrapForForcedInsecureSSL?<T>(ignoreSSLErrors: boolean | 'force', fn: () => Promise<T> | PromiseLike<T>): Promise<T>;\n\t/** Whether to ignore SSL certificate errors on requests. Defaults to `false`. */\n\tignoreSSLErrors?: boolean | 'force';\n\t/**\n\t * Whether the consumer runs in a web worker / browser (vs Node.js). GitHub uses this to drop the\n\t * `user-agent` header, which browsers reject and warn about. Defaults to `false`.\n\t */\n\tisWeb?: boolean;\n}\n\n/** The stateless reads a token-scoped integration exposes. */\nexport interface TokenScopedGitHostIntegration {\n\tgetRepositoryMetadata(\n\t\towner: string,\n\t\trepo: string,\n\t\tcancellation?: AbortSignal,\n\t): Promise<RepositoryMetadata | undefined>;\n\tgetDefaultBranch(owner: string, repo: string, cancellation?: AbortSignal): Promise<DefaultBranch | undefined>;\n}\n\n/**\n * Build a token-scoped git-host integration for a single provider, backed only by a `fetch` + a token —\n * no `IntegrationServiceContext`, no session/OAuth lifecycle. The returned DTOs match those from the\n * session-managed {@link GitHostIntegration}.\n */\nexport function createTokenScopedGitHostIntegration(\n\tid: TokenScopedGitHostId,\n\ttoken: TokenScopedGitHostToken,\n\thttp: TokenScopedHttpConfig,\n): TokenScopedGitHostIntegration {\n\tconst selfManaged =\n\t\tid === GitSelfManagedHostIntegrationId.CloudGitHubEnterprise ||\n\t\tid === GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted ||\n\t\tid === GitSelfManagedHostIntegrationId.AzureDevOpsServer;\n\t// Self-managed ids carry no canonical domain (`providersMetadata[id].domain` is empty), so a missing\n\t// `token.domain` would silently build a malformed base URL (e.g. `https:///api/v3`). Fail fast instead.\n\tif (selfManaged && !token.domain) {\n\t\tthrow new Error(`A token-scoped integration for the self-managed host '${id}' requires 'token.domain'.`);\n\t}\n\n\tconst rawDomain = (selfManaged && token.domain) || providersMetadata[id].domain;\n\t// The provider/DTO domain drops the scheme (a subpath/collection is preserved for Azure Server and subpath\n\t// installs); only Azure DevOps Server's base URL honors an explicit scheme (per its doc). Stripping keeps a\n\t// scheme out of the DTO and prevents a malformed base URL (e.g. `https://http://host/api/v3`) if one is\n\t// accidentally passed for GHE/GitLab.\n\tconst host = stripScheme(rawDomain);\n\tconst provider = createProviderStub(id, host, http.ignoreSSLErrors ?? false);\n\tconst tokenInfo = buildTokenWithInfo(id, token);\n\n\tconst wrapForForcedInsecureSSL: NonNullable<TokenScopedHttpConfig['wrapForForcedInsecureSSL']> =\n\t\t// `Promise.resolve().then(fn)` (not `Promise.resolve(fn())`) so a synchronous throw in `fn` surfaces as\n\t\t// a rejected promise, honoring the `Promise<T>` contract.\n\t\thttp.wrapForForcedInsecureSSL ?? ((_ignore, fn) => Promise.resolve().then(fn));\n\n\tif (id === GitCloudHostIntegrationId.GitHub || id === GitSelfManagedHostIntegrationId.CloudGitHubEnterprise) {\n\t\tconst config: GitHubApiConfig = {\n\t\t\tisWeb: http.isWeb ?? false,\n\t\t\tfetch: (url, init) => http.fetch(url, init),\n\t\t\twrapForForcedInsecureSSL: wrapForForcedInsecureSSL,\n\t\t};\n\t\tconst api = new GitHubApi(config);\n\t\t// GitHub is the one family whose base URL can legitimately be absent — see `resolveGitHubApiBaseUrl`.\n\t\tconst baseUrl = resolveGitHubApiBaseUrl(id, host);\n\t\treturn {\n\t\t\tgetRepositoryMetadata: (owner, repo, cancellation) =>\n\t\t\t\tapi.getRepositoryMetadata(provider, tokenInfo, owner, repo, { baseUrl: baseUrl }, cancellation),\n\t\t\t// `GitHubApi.getDefaultBranch` has no cancellation param; accept and intentionally ignore it here so\n\t\t\t// the signature matches the other providers and the drop is explicit at the call site.\n\t\t\tgetDefaultBranch: (owner, repo, _cancellation) =>\n\t\t\t\tapi.getDefaultBranch(provider, tokenInfo, owner, repo, { baseUrl: baseUrl }),\n\t\t};\n\t}\n\n\tconst baseUrl = resolveApiBaseUrl(id, rawDomain, host);\n\tconst config = toProviderApiConfig(http, wrapForForcedInsecureSSL);\n\tif (id === GitCloudHostIntegrationId.GitLab || id === GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted) {\n\t\tconst api = new GitLabApi(config);\n\t\treturn {\n\t\t\tgetRepositoryMetadata: (owner, repo, cancellation) =>\n\t\t\t\tapi.getRepositoryMetadata(\n\t\t\t\t\tprovider,\n\t\t\t\t\ttokenInfo,\n\t\t\t\t\towner,\n\t\t\t\t\trepo,\n\t\t\t\t\t{ baseUrl: baseUrl, backoff: false },\n\t\t\t\t\tcancellation,\n\t\t\t\t),\n\t\t\tgetDefaultBranch: (owner, repo, cancellation) =>\n\t\t\t\tapi.getDefaultBranch(provider, tokenInfo, owner, repo, { baseUrl: baseUrl }, cancellation),\n\t\t};\n\t}\n\n\tconst api = id === GitCloudHostIntegrationId.Bitbucket ? new BitbucketApi(config) : new AzureDevOpsApi(config);\n\treturn {\n\t\tgetRepositoryMetadata: (owner, repo, cancellation) =>\n\t\t\tapi.getRepositoryMetadata(provider, tokenInfo, owner, repo, { baseUrl: baseUrl }, cancellation),\n\t\tgetDefaultBranch: (owner, repo, cancellation) =>\n\t\t\tapi.getDefaultBranch(provider, tokenInfo, owner, repo, { baseUrl: baseUrl }, cancellation),\n\t};\n}\n\nfunction toProviderApiConfig(\n\thttp: TokenScopedHttpConfig,\n\twrapForForcedInsecureSSL: NonNullable<TokenScopedHttpConfig['wrapForForcedInsecureSSL']>,\n): ProviderApiConfig {\n\treturn {\n\t\tfetch: (input, init) => http.fetch(input, init),\n\t\twrapForForcedInsecureSSL: wrapForForcedInsecureSSL,\n\t};\n}\n\nfunction buildTokenWithInfo(id: TokenScopedGitHostId, token: TokenScopedGitHostToken): TokenWithInfo {\n\tconst cloud = token.cloud ?? true;\n\treturn {\n\t\t...toTokenInfo(id, token.accessToken, { cloud: cloud, type: undefined, scopes: token.scopes }),\n\t\taccessToken: token.accessToken,\n\t};\n}\n\n/** A minimal {@link Provider} for the API clients: identity + no-op reauth/telemetry, SSL from config. */\nfunction createProviderStub(id: TokenScopedGitHostId, domain: string, ignoreSSLErrors: boolean | 'force'): Provider {\n\tconst metadata = providersMetadata[id];\n\treturn {\n\t\tid: id,\n\t\tname: metadata.name,\n\t\tdomain: domain,\n\t\ticon: metadata.iconKey,\n\t\tgetIgnoreSSLErrors: () => ignoreSSLErrors,\n\t\treauthenticate: () => Promise.resolve(),\n\t\ttrackRequestException: () => {},\n\t};\n}\n\n/** Strips a leading `scheme://` and any trailing slashes; a subpath/collection (e.g. `host/tfs/Col`) is preserved. */\nfunction stripScheme(domain: string): string {\n\treturn trimTrailingSlashes(domain.replace(/^[a-z][\\w+.-]*:\\/\\//i, ''));\n}\n\n/**\n * GitHub's base URL, which `@gitkraken/provider-apis` derives BOTH the REST and the GraphQL endpoint from. Omitting it\n * is what selects the cloud endpoints, so cloud passes nothing. Mirrors the cloud `GitHubIntegration.apiBaseUrlFor`.\n */\nfunction resolveGitHubApiBaseUrl(\n\tid: GitCloudHostIntegrationId.GitHub | GitSelfManagedHostIntegrationId.CloudGitHubEnterprise,\n\thost: string,\n): string | undefined {\n\treturn id === GitCloudHostIntegrationId.GitHub ? undefined : `https://${host}/api/v3`;\n}\n\n/**\n * Mirrors the per-provider `apiBaseUrlFor` methods on the `GitHostIntegration` subclasses for an installation at\n * the host root. Covers every family whose base URL is always concrete (GitHub's is not — see\n * {@link resolveGitHubApiBaseUrl}). `rawDomain` may carry a scheme (only Azure DevOps Server honors it); `host` is\n * the bare host used everywhere else.\n */\nfunction resolveApiBaseUrl(\n\tid: Exclude<\n\t\tTokenScopedGitHostId,\n\t\tGitCloudHostIntegrationId.GitHub | GitSelfManagedHostIntegrationId.CloudGitHubEnterprise\n\t>,\n\trawDomain: string,\n\thost: string,\n): string {\n\tswitch (id) {\n\t\tcase GitCloudHostIntegrationId.GitLab:\n\t\t\treturn 'https://gitlab.com/api';\n\t\tcase GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted:\n\t\t\treturn `https://${host}/api`;\n\t\tcase GitCloudHostIntegrationId.Bitbucket:\n\t\t\treturn 'https://api.bitbucket.org/2.0';\n\t\tcase GitCloudHostIntegrationId.AzureDevOps:\n\t\t\treturn 'https://dev.azure.com';\n\t\tcase GitSelfManagedHostIntegrationId.AzureDevOpsServer:\n\t\t\t// Mirror the session-managed getter, which honors the connection protocol; default to https.\n\t\t\treturn rawDomain.includes('://') ? trimTrailingSlashes(rawDomain) : `https://${host}`;\n\t}\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"lite.js","names":[],"sources":["../../../../plus/integrations/src/lite.ts"],"sourcesContent":["// A lightweight, token-scoped entry point for stateless single-shot provider reads.\n//\n// Unlike `createIntegrationManager`, this does NOT build an `IntegrationServiceContext`\n// (no storage/account/config/cache/repositories/hooks) and runs no session/OAuth lifecycle.\n// A consumer that already holds a provider access token (obtained by its own means, e.g.\n// the GitKraken account backend's `v1/provider-tokens/{provider}` endpoint) can call the\n// per-provider API client directly and get back the same DTOs the session-managed\n// `GitHostIntegration` returns.\n//\n// Provider notes:\n// - Azure DevOps encodes the repository as the composite string `\"{project}/_git/{repoName}\"`\n// in the `repo` argument (matching the descriptor `GitHostIntegration` uses); `owner` is the\n// organization. Pass `repo` in that shape for Azure.\n// - Bitbucket Cloud `getDefaultBranch`/`getRepositoryMetadata` depend on `mainbranch`/`parent`\n// fields the API may omit for some repos; they resolve to `undefined` when absent.\n// - Bitbucket Server (`bitbucket-server`) is not supported here — its reads use a different\n// REST surface that this token-scoped path doesn't wire up.\n\nimport type { GitHubApiConfig } from '@gitlens/git-github/api/config.js';\nimport { GitHubApi } from '@gitlens/git-github/api/github.js';\nimport type { DefaultBranch } from '@gitlens/git/models/defaultBranch.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\nimport type { RepositoryMetadata } from '@gitlens/git/models/repositoryMetadata.js';\nimport { trimTrailingSlashes } from '@gitlens/utils/path.js';\nimport type { TokenWithInfo } from './authentication/models.js';\nimport { toTokenInfo } from './authentication/models.js';\nimport { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId } from './constants.js';\nimport type { ProviderApiConfig } from './providers/apiConfig.js';\nimport { AzureDevOpsApi } from './providers/azure/azure.js';\nimport { BitbucketApi } from './providers/bitbucket/bitbucket.js';\nimport { GitLabApi } from './providers/gitlab/gitlab.js';\nimport { providersMetadata } from './providers/metadata.js';\n\n/** The git-hosting integrations that expose a token-scoped read path here. */\nexport type TokenScopedGitHostId =\n\t| GitCloudHostIntegrationId.GitHub\n\t| GitCloudHostIntegrationId.GitLab\n\t| GitCloudHostIntegrationId.Bitbucket\n\t| GitCloudHostIntegrationId.AzureDevOps\n\t| GitSelfManagedHostIntegrationId.CloudGitHubEnterprise\n\t| GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted\n\t| GitSelfManagedHostIntegrationId.AzureDevOpsServer;\n\nexport interface TokenScopedGitHostToken {\n\t/** The provider access token the consumer already holds. */\n\treadonly accessToken: string;\n\t/**\n\t * Host domain for self-managed instances (e.g. `git.example.com`). Ignored for cloud ids. For an Azure\n\t * DevOps Server reachable over plain HTTP, include the scheme (e.g. `http://tfs.example.com`); otherwise\n\t * `https` is assumed.\n\t */\n\treadonly domain?: string;\n\t/** Optional scopes carried by the token, surfaced only in logging metadata. */\n\treadonly scopes?: readonly string[];\n\t/** Whether the token came from a GK-cloud connection (vs a raw PAT). Defaults to `true`. */\n\treadonly cloud?: boolean;\n}\n\nexport interface TokenScopedHttpConfig {\n\t/** The `fetch` implementation to use for HTTP requests. */\n\tfetch(input: string | URL, init?: RequestInit): Promise<Response>;\n\t/**\n\t * Wrap an async op so TLS validation is disabled when `ignoreSSLErrors` is `'force'`. Optional —\n\t * defaults to a pass-through, which is correct for the browser and for any consumer not toggling SSL.\n\t */\n\twrapForForcedInsecureSSL?<T>(ignoreSSLErrors: boolean | 'force', fn: () => Promise<T> | PromiseLike<T>): Promise<T>;\n\t/** Whether to ignore SSL certificate errors on requests. Defaults to `false`. */\n\tignoreSSLErrors?: boolean | 'force';\n\t/**\n\t * Whether the consumer runs in a web worker / browser (vs Node.js). GitHub uses this to drop the\n\t * `user-agent` header, which browsers reject and warn about. Defaults to `false`.\n\t */\n\tisWeb?: boolean;\n}\n\n/** The stateless reads a token-scoped integration exposes. */\nexport interface TokenScopedGitHostIntegration {\n\tgetRepositoryMetadata(\n\t\towner: string,\n\t\trepo: string,\n\t\tcancellation?: AbortSignal,\n\t): Promise<RepositoryMetadata | undefined>;\n\tgetDefaultBranch(owner: string, repo: string, cancellation?: AbortSignal): Promise<DefaultBranch | undefined>;\n}\n\n/**\n * Build a token-scoped git-host integration for a single provider, backed only by a `fetch` + a token —\n * no `IntegrationServiceContext`, no session/OAuth lifecycle. The returned DTOs match those from the\n * session-managed {@link GitHostIntegration}.\n */\nexport function createTokenScopedGitHostIntegration(\n\tid: TokenScopedGitHostId,\n\ttoken: TokenScopedGitHostToken,\n\thttp: TokenScopedHttpConfig,\n): TokenScopedGitHostIntegration {\n\tconst selfManaged =\n\t\tid === GitSelfManagedHostIntegrationId.CloudGitHubEnterprise ||\n\t\tid === GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted ||\n\t\tid === GitSelfManagedHostIntegrationId.AzureDevOpsServer;\n\t// Self-managed ids carry no canonical domain (`providersMetadata[id].domain` is empty), so a missing\n\t// `token.domain` would silently build a malformed base URL (e.g. `https:///api/v3`). Fail fast instead.\n\tif (selfManaged && !token.domain) {\n\t\tthrow new Error(`A token-scoped integration for the self-managed host '${id}' requires 'token.domain'.`);\n\t}\n\n\tconst rawDomain = (selfManaged && token.domain) || providersMetadata[id].domain;\n\t// The provider/DTO domain drops the scheme (a subpath/collection is preserved for Azure Server and subpath\n\t// installs); only Azure DevOps Server's base URL honors an explicit scheme (per its doc). Stripping keeps a\n\t// scheme out of the DTO and prevents a malformed base URL (e.g. `https://http://host/api/v3`) if one is\n\t// accidentally passed for GHE/GitLab.\n\tconst host = stripScheme(rawDomain);\n\tconst provider = createProviderStub(id, host, http.ignoreSSLErrors ?? false);\n\tconst tokenInfo = buildTokenWithInfo(id, token);\n\n\tconst wrapForForcedInsecureSSL: NonNullable<TokenScopedHttpConfig['wrapForForcedInsecureSSL']> =\n\t\t// `Promise.resolve().then(fn)` (not `Promise.resolve(fn())`) so a synchronous throw in `fn` surfaces as\n\t\t// a rejected promise, honoring the `Promise<T>` contract.\n\t\thttp.wrapForForcedInsecureSSL ?? ((_ignore, fn) => Promise.resolve().then(fn));\n\n\tif (id === GitCloudHostIntegrationId.GitHub || id === GitSelfManagedHostIntegrationId.CloudGitHubEnterprise) {\n\t\tconst config: GitHubApiConfig = {\n\t\t\tisWeb: http.isWeb ?? false,\n\t\t\tfetch: (url, init) => http.fetch(url, init),\n\t\t\twrapForForcedInsecureSSL: wrapForForcedInsecureSSL,\n\t\t};\n\t\tconst api = new GitHubApi(config);\n\t\t// GitHub is the one family whose base URL can legitimately be absent — see `resolveGitHubApiBaseUrl`.\n\t\tconst baseUrl = resolveGitHubApiBaseUrl(id, host);\n\t\treturn {\n\t\t\tgetRepositoryMetadata: (owner, repo, cancellation) =>\n\t\t\t\tapi.getRepositoryMetadata(provider, tokenInfo, owner, repo, { baseUrl: baseUrl }, cancellation),\n\t\t\t// `GitHubApi.getDefaultBranch` has no cancellation param; accept and intentionally ignore it here so\n\t\t\t// the signature matches the other providers and the drop is explicit at the call site.\n\t\t\tgetDefaultBranch: (owner, repo, _cancellation) =>\n\t\t\t\tapi.getDefaultBranch(provider, tokenInfo, owner, repo, { baseUrl: baseUrl }),\n\t\t};\n\t}\n\n\tconst baseUrl = resolveApiBaseUrl(id, rawDomain, host);\n\tconst config = toProviderApiConfig(http, wrapForForcedInsecureSSL);\n\tif (id === GitCloudHostIntegrationId.GitLab || id === GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted) {\n\t\tconst api = new GitLabApi(config);\n\t\treturn {\n\t\t\tgetRepositoryMetadata: (owner, repo, cancellation) =>\n\t\t\t\tapi.getRepositoryMetadata(\n\t\t\t\t\tprovider,\n\t\t\t\t\ttokenInfo,\n\t\t\t\t\towner,\n\t\t\t\t\trepo,\n\t\t\t\t\t{ baseUrl: baseUrl, backoff: false },\n\t\t\t\t\tcancellation,\n\t\t\t\t),\n\t\t\tgetDefaultBranch: (owner, repo, cancellation) =>\n\t\t\t\tapi.getDefaultBranch(provider, tokenInfo, owner, repo, { baseUrl: baseUrl }, cancellation),\n\t\t};\n\t}\n\n\tconst api = id === GitCloudHostIntegrationId.Bitbucket ? new BitbucketApi(config) : new AzureDevOpsApi(config);\n\treturn {\n\t\tgetRepositoryMetadata: (owner, repo, cancellation) =>\n\t\t\tapi.getRepositoryMetadata(provider, tokenInfo, owner, repo, { baseUrl: baseUrl }, cancellation),\n\t\tgetDefaultBranch: (owner, repo, cancellation) =>\n\t\t\tapi.getDefaultBranch(provider, tokenInfo, owner, repo, { baseUrl: baseUrl }, cancellation),\n\t};\n}\n\nfunction toProviderApiConfig(\n\thttp: TokenScopedHttpConfig,\n\twrapForForcedInsecureSSL: NonNullable<TokenScopedHttpConfig['wrapForForcedInsecureSSL']>,\n): ProviderApiConfig {\n\treturn {\n\t\tfetch: (input, init) => http.fetch(input, init),\n\t\twrapForForcedInsecureSSL: wrapForForcedInsecureSSL,\n\t};\n}\n\nfunction buildTokenWithInfo(id: TokenScopedGitHostId, token: TokenScopedGitHostToken): TokenWithInfo {\n\tconst cloud = token.cloud ?? true;\n\treturn {\n\t\t...toTokenInfo(id, token.accessToken, { cloud: cloud, type: undefined, scopes: token.scopes }),\n\t\taccessToken: token.accessToken,\n\t};\n}\n\n/** A minimal {@link Provider} for the API clients: identity + no-op reauth/telemetry, SSL from config. */\nfunction createProviderStub(id: TokenScopedGitHostId, domain: string, ignoreSSLErrors: boolean | 'force'): Provider {\n\tconst metadata = providersMetadata[id];\n\treturn {\n\t\tid: id,\n\t\tname: metadata.name,\n\t\tdomain: domain,\n\t\ticon: metadata.iconKey,\n\t\tgetIgnoreSSLErrors: () => ignoreSSLErrors,\n\t\treauthenticate: () => Promise.resolve(),\n\t\ttrackRequestException: () => {},\n\t};\n}\n\n/** Strips a leading `scheme://` and any trailing slashes; a subpath/collection (e.g. `host/tfs/Col`) is preserved. */\nfunction stripScheme(domain: string): string {\n\treturn trimTrailingSlashes(domain.replace(/^[a-z][\\w+.-]*:\\/\\//i, ''));\n}\n\n/**\n * GitHub's base URL, which `@gitkraken/provider-apis` derives BOTH the REST and the GraphQL endpoint from. Omitting it\n * is what selects the cloud endpoints, so cloud passes nothing. Mirrors the cloud `GitHubIntegration.apiBaseUrlFor`.\n */\nfunction resolveGitHubApiBaseUrl(\n\tid: GitCloudHostIntegrationId.GitHub | GitSelfManagedHostIntegrationId.CloudGitHubEnterprise,\n\thost: string,\n): string | undefined {\n\treturn id === GitCloudHostIntegrationId.GitHub ? undefined : `https://${host}/api/v3`;\n}\n\n/**\n * Mirrors the per-provider `apiBaseUrlFor` methods on the `GitHostIntegration` subclasses for an installation at\n * the host root. Covers every family whose base URL is always concrete (GitHub's is not — see\n * {@link resolveGitHubApiBaseUrl}). `rawDomain` may carry a scheme (only Azure DevOps Server honors it); `host` is\n * the bare host used everywhere else.\n */\nfunction resolveApiBaseUrl(\n\tid: Exclude<\n\t\tTokenScopedGitHostId,\n\t\tGitCloudHostIntegrationId.GitHub | GitSelfManagedHostIntegrationId.CloudGitHubEnterprise\n\t>,\n\trawDomain: string,\n\thost: string,\n): string {\n\tswitch (id) {\n\t\tcase GitCloudHostIntegrationId.GitLab:\n\t\t\treturn 'https://gitlab.com/api';\n\t\tcase GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted:\n\t\t\treturn `https://${host}/api`;\n\t\tcase GitCloudHostIntegrationId.Bitbucket:\n\t\t\treturn 'https://api.bitbucket.org/2.0';\n\t\tcase GitCloudHostIntegrationId.AzureDevOps:\n\t\t\treturn 'https://dev.azure.com';\n\t\tcase GitSelfManagedHostIntegrationId.AzureDevOpsServer:\n\t\t\t// Mirror the session-managed getter, which honors the connection protocol; default to https.\n\t\t\treturn rawDomain.includes('://') ? trimTrailingSlashes(rawDomain) : `https://${host}`;\n\t}\n}\n"],"mappings":"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"}
|
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { Event } from "../../utils/event.js";
|
|
2
2
|
import { RefSet } from "../../git/models/autolink.js";
|
|
3
3
|
import { IssueSearchCriteria, IssueShape, IssueSorting, IssueStateFilter } from "../../git/models/issue.js";
|
|
4
|
-
import { PullRequestFilter, PullRequestSearchCriteria, PullRequestShape, PullRequestStateFilter } from "../../git/models/pullRequest.js";
|
|
5
|
-
import { GitHubIssueDelete, GitHubIssueWrite, IssueWriteResult } from "../git-github/api/issueWrites.js";
|
|
4
|
+
import { PullRequest, PullRequestFilter, PullRequestSearchCriteria, PullRequestShape, PullRequestStateFilter } from "../../git/models/pullRequest.js";
|
|
6
5
|
import { GitHubPullRequestCreateTarget, GitHubPullRequestWrite, GitHubPullRequestWriteTarget, PullRequestCreateCapabilityResult, PullRequestWriteResult, PullRequestWriteTargetResult } from "../git-github/api/pullRequestWrites.js";
|
|
6
|
+
import { GitHubIssueDelete, GitHubIssueWrite, IssueWriteResult } from "../git-github/api/issueWrites.js";
|
|
7
|
+
import { GitHubApi } from "../git-github/api/github.js";
|
|
7
8
|
import { ConfiguredIntegrationDescriptor } from "./authentication/models.js";
|
|
8
|
-
import { IntegrationIds, IssuesCloudHostIntegrationId, IssuesSelfManagedHostIntegrationId } from "./constants.js";
|
|
9
|
+
import { CloudGitSelfManagedHostIntegrationIds, GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, IntegrationIds, IssuesCloudHostIntegrationId, IssuesSelfManagedHostIntegrationId, SupportedCloudIntegrationIds } from "./constants.js";
|
|
10
|
+
import { Source } from "./telemetry.js";
|
|
11
|
+
import { IssueTrackerCreateOptions, IssueTrackerCreateOptionsResult, IssueTrackerDeleteOptions, IssueTrackerIssueWriteOptions, IssueTrackerIssueWriteOptionsResult, IssueTrackerWriteOptions, IssueTrackerWriteResult, IssueTrackerWriteTargetOptions, IssueTrackerWriteTargetResult } from "./models/issueTrackerWrites.js";
|
|
12
|
+
import { IssueFilter, SupportedFilters } from "./providerFilters.js";
|
|
13
|
+
import { IssueEtagInclude, PullRequestEtagInclude } from "./reads/etag.js";
|
|
14
|
+
import { ConnectionStateChangeEvent, CurrentAccountResult, IssueBatchResult, IssueBatchTarget, IssueCountResult, IssueCountScope, ProviderBroadenResult, ProviderLinearProjectShape, ProviderOrganization, ProviderPagedResult, ProviderRepositoryShape, ProviderResult, ProviderSweepResult, PullRequestActivityResult, PullRequestActivityTarget, PullRequestBatchResult, PullRequestBatchTarget, PullRequestBranchResult, PullRequestBranchTarget, PullRequestCheckLogResult, PullRequestCheckLogTarget, PullRequestCountResult, PullRequestCountScope, PullRequestForCommitResult, ResolveRepositoryResult } from "./results.js";
|
|
15
|
+
import { GitHostIntegration, IntegrationById, IntegrationResult, IssuesIntegration, SearchMyPullRequestsOptions } from "./models/publicIntegration.js";
|
|
9
16
|
import { ConfiguredIntegrationsChangeEvent } from "./authentication/configuredIntegrationService.js";
|
|
10
|
-
import { ConnectionStateChangeEvent, ProviderBroadenResult, ProviderLinearProjectShape, ProviderOrganization, ProviderPagedResult, ProviderRepositoryShape, ProviderResult, ProviderSweepResult, ResolveRepositoryResult } from "./results.js";
|
|
11
|
-
import { IssueFilter } from "./providerFilters.js";
|
|
12
|
-
import { IssueEtagInclude, PullRequestEtagInclude } from "./models/integration.js";
|
|
13
|
-
import { IssueCountResult, IssueCountScope, PullRequestCountResult, PullRequestCountScope } from "./reads/counts.js";
|
|
14
|
-
import { CurrentAccountResult } from "./reads/currentAccount.js";
|
|
15
|
-
import { SupportedFilters } from "./reads/filters.js";
|
|
16
|
-
import { IssueBatchResult, IssueBatchTarget } from "./reads/issueBatch.js";
|
|
17
|
-
import { PullRequestActivityResult, PullRequestActivityTarget } from "./reads/pullRequestActivity.js";
|
|
18
|
-
import { PullRequestBatchResult, PullRequestBatchTarget } from "./reads/pullRequestBatch.js";
|
|
19
|
-
import { PullRequestBranchResult, PullRequestBranchTarget } from "./reads/pullRequestBranches.js";
|
|
20
|
-
import { PullRequestCheckLogResult, PullRequestCheckLogTarget } from "./reads/pullRequestCheckLogs.js";
|
|
21
|
-
import { PullRequestForCommitResult } from "./reads/pullRequestsForCommits.js";
|
|
22
17
|
//#region ../plus/integrations/src/manager.d.ts
|
|
23
18
|
type WriteConnection = {
|
|
24
19
|
providerId: IntegrationIds;
|
|
25
20
|
connectionId: string;
|
|
26
21
|
};
|
|
27
|
-
|
|
22
|
+
type IssueWriteConnection = WriteConnection & {
|
|
23
|
+
/** Required for GitHub Enterprise Server. Must match the configured connection's host and port. */
|
|
24
|
+
domain?: string;
|
|
25
|
+
/** When provided, the exact credential for this operation must authenticate as this GitHub login. */
|
|
26
|
+
expectedLogin?: string;
|
|
27
|
+
};
|
|
28
|
+
export type IssueWriteOptions = IssueWriteConnection & GitHubIssueWrite;
|
|
28
29
|
/**
|
|
29
30
|
* `intent: 'delete'` also requires that the connection may delete the issue, so a host can refuse before asking
|
|
30
31
|
* the user to confirm a deletion GitHub would reject.
|
|
31
32
|
*/
|
|
32
|
-
export type IssueWriteTargetOptions =
|
|
33
|
+
export type IssueWriteTargetOptions = IssueWriteConnection & GitHubIssueDelete & {
|
|
33
34
|
intent?: 'delete';
|
|
34
35
|
};
|
|
35
|
-
export type IssueDeleteOptions =
|
|
36
|
+
export type IssueDeleteOptions = IssueWriteConnection & GitHubIssueDelete;
|
|
36
37
|
/** The canonical node ID, and the issue as GitHub reports it now: where it lives, its URL, title and state. */
|
|
37
38
|
export type IssueWriteTargetResult = {
|
|
38
39
|
ok: true;
|
|
@@ -43,9 +44,15 @@ export type IssueWriteTargetResult = {
|
|
|
43
44
|
} | Extract<IssueWriteResult, {
|
|
44
45
|
ok: false;
|
|
45
46
|
}>;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
type PullRequestWriteConnection = WriteConnection & {
|
|
48
|
+
/** Required for GitHub Enterprise Server. The HTTP(S) origin of the configured installation. */
|
|
49
|
+
domain?: string;
|
|
50
|
+
/** Required for GitHub Enterprise Server. The login the selected credential must authenticate as. */
|
|
51
|
+
expectedLogin?: string;
|
|
52
|
+
};
|
|
53
|
+
export type PullRequestWriteOptions = PullRequestWriteConnection & GitHubPullRequestWrite;
|
|
54
|
+
export type PullRequestWriteTargetOptions = PullRequestWriteConnection & GitHubPullRequestWriteTarget;
|
|
55
|
+
export type PullRequestCreateCapabilityOptions = PullRequestWriteConnection & GitHubPullRequestCreateTarget;
|
|
49
56
|
/** Neutral repository input accepted by repo-scoped provider reads. */
|
|
50
57
|
export interface ProviderRepositoryInput {
|
|
51
58
|
namespace: string;
|
|
@@ -1155,6 +1162,11 @@ export interface IntegrationManager {
|
|
|
1155
1162
|
*/
|
|
1156
1163
|
domain?: string;
|
|
1157
1164
|
}): Promise<ProviderPagedResult<IssueShape>>;
|
|
1165
|
+
getIssueTrackerCreateOptions(options: IssueTrackerCreateOptions): Promise<IssueTrackerCreateOptionsResult>;
|
|
1166
|
+
getIssueTrackerIssueWriteOptions(options: IssueTrackerIssueWriteOptions): Promise<IssueTrackerIssueWriteOptionsResult>;
|
|
1167
|
+
writeIssueTrackerIssue(options: IssueTrackerWriteOptions): Promise<IssueTrackerWriteResult>;
|
|
1168
|
+
deleteIssueTrackerIssue(options: IssueTrackerDeleteOptions): Promise<IssueTrackerWriteResult>;
|
|
1169
|
+
resolveIssueTrackerIssueWriteTarget(options: IssueTrackerWriteTargetOptions): Promise<IssueTrackerWriteTargetResult>;
|
|
1158
1170
|
sweepPullRequests(options?: PullRequestSweepOptions): Promise<ProviderSweepResult<PullRequestShape>>;
|
|
1159
1171
|
sweepClosedPullRequests(options?: ClosedPullRequestSweepOptions): Promise<ProviderSweepResult<PullRequestShape>>;
|
|
1160
1172
|
broadenIssues(options: {
|
|
@@ -1201,6 +1213,54 @@ export interface IntegrationManager {
|
|
|
1201
1213
|
*/
|
|
1202
1214
|
domain?: string;
|
|
1203
1215
|
}): Promise<CurrentAccountResult>;
|
|
1216
|
+
/**
|
|
1217
|
+
* The integration for `id` (and, for a self-managed host, `domain`), as its public view. A cloud id always
|
|
1218
|
+
* resolves; a self-managed one resolves to `undefined` when no connection names the host.
|
|
1219
|
+
*/
|
|
1220
|
+
get(id: GitCloudHostIntegrationId): Promise<GitHostIntegration>;
|
|
1221
|
+
get(id: IssuesCloudHostIntegrationId): Promise<IssuesIntegration>;
|
|
1222
|
+
get(id: GitCloudHostIntegrationId | CloudGitSelfManagedHostIntegrationIds, domain?: string): Promise<GitHostIntegration | undefined>;
|
|
1223
|
+
get(id: GitSelfManagedHostIntegrationId, domain: string): Promise<GitHostIntegration | undefined>;
|
|
1224
|
+
get<T extends IntegrationIds>(id: T, domain?: string): Promise<IntegrationById<T> | undefined>;
|
|
1225
|
+
/**
|
|
1226
|
+
* Every instance of `id` an account-wide read should cover: one per configured host for a self-managed id, else
|
|
1227
|
+
* the single instance. A lookup that throws is left out.
|
|
1228
|
+
*/
|
|
1229
|
+
getIntegrationsForAccountWideRead<T extends IntegrationIds>(id: T): Promise<IntegrationById<T>[]>;
|
|
1230
|
+
/** Whether any instance {@link getIntegrationsForAccountWideRead} returns is connected (and, with `access`, usable). */
|
|
1231
|
+
isConnectedForAccountWideRead(id: IntegrationIds, options?: {
|
|
1232
|
+
access?: boolean;
|
|
1233
|
+
}): Promise<boolean>;
|
|
1234
|
+
/**
|
|
1235
|
+
* Runs the host's cloud connect flow for `integrationIds` (all cloud integrations when omitted) and re-syncs.
|
|
1236
|
+
* Resolves whether a requested integration became connected (or, with none requested, whether the flow completed).
|
|
1237
|
+
*/
|
|
1238
|
+
connectCloudIntegrations(options?: {
|
|
1239
|
+
integrationIds: SupportedCloudIntegrationIds[];
|
|
1240
|
+
skipIfConnected?: boolean;
|
|
1241
|
+
skipPreSync?: boolean;
|
|
1242
|
+
}, source?: Source): Promise<boolean>;
|
|
1243
|
+
/** Opens the host's cloud integrations management, re-syncing once the user returns. */
|
|
1244
|
+
manageCloudIntegrations(source?: Source): Promise<void>;
|
|
1245
|
+
/** Resets every integration's local connection state. */
|
|
1246
|
+
reset(): Promise<void>;
|
|
1247
|
+
/** The current user's open pull requests across `integrationIds` (every git host when omitted). */
|
|
1248
|
+
getMyPullRequests(integrationIds?: (GitCloudHostIntegrationId | CloudGitSelfManagedHostIntegrationIds)[], cancellation?: AbortSignal, options?: SearchMyPullRequestsOptions): Promise<IntegrationResult<PullRequest[] | undefined>>;
|
|
1249
|
+
/** The current user's issues across `integrationIds` (every integration when omitted). */
|
|
1250
|
+
getMyIssues(integrationIds?: IntegrationIds[], options?: {
|
|
1251
|
+
openRepositoriesOnly?: boolean;
|
|
1252
|
+
cancellation?: AbortSignal;
|
|
1253
|
+
}): Promise<IntegrationResult<IssueShape[] | undefined>>;
|
|
1254
|
+
/** The `ignoreSSLErrors` setting of the remote configured for the integration's host, if any. */
|
|
1255
|
+
ignoreSSLErrors(integration: {
|
|
1256
|
+
id: IntegrationIds;
|
|
1257
|
+
domain?: string;
|
|
1258
|
+
}): boolean | 'force';
|
|
1259
|
+
/**
|
|
1260
|
+
* The shared `GitHubApi` client, for a host that runs its own GitHub-backed git provider over the same instance.
|
|
1261
|
+
* Host-oriented: it hands out a whole client rather than a read, so it is a candidate to narrow.
|
|
1262
|
+
*/
|
|
1263
|
+
readonly github: Promise<GitHubApi | undefined>;
|
|
1204
1264
|
}
|
|
1205
1265
|
//#endregion
|
|
1206
1266
|
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
//#region ../plus/integrations/src/models/actionablePullRequest.d.ts
|
|
2
|
+
/** Same values as provider-apis' `GitBuildStatusState`. */
|
|
3
|
+
export declare const ActionablePullRequestBuildStatusState: {
|
|
4
|
+
readonly ActionRequired: 'ACTION_REQUIRED';
|
|
5
|
+
readonly Cancelled: 'CANCELLED';
|
|
6
|
+
readonly Error: 'ERROR';
|
|
7
|
+
readonly Failed: 'FAILED';
|
|
8
|
+
readonly Pending: 'PENDING';
|
|
9
|
+
readonly Running: 'RUNNING';
|
|
10
|
+
readonly Skipped: 'SKIPPED';
|
|
11
|
+
readonly Success: 'SUCCESS';
|
|
12
|
+
readonly Warning: 'WARNING';
|
|
13
|
+
readonly OptionalActionRequired: 'OPTIONAL_ACTION_REQUIRED';
|
|
14
|
+
};
|
|
15
|
+
export type ActionablePullRequestBuildStatusState = (typeof ActionablePullRequestBuildStatusState)[keyof typeof ActionablePullRequestBuildStatusState];
|
|
16
|
+
/** Same values as provider-apis' `GitPullRequestReviewState`. */
|
|
17
|
+
export declare const ActionablePullRequestReviewState: {
|
|
18
|
+
readonly Approved: 'APPROVED';
|
|
19
|
+
readonly ChangesRequested: 'CHANGES_REQUESTED';
|
|
20
|
+
readonly Commented: 'COMMENTED';
|
|
21
|
+
readonly ReviewRequested: 'REVIEW_REQUESTED';
|
|
22
|
+
};
|
|
23
|
+
export type ActionablePullRequestReviewState = (typeof ActionablePullRequestReviewState)[keyof typeof ActionablePullRequestReviewState];
|
|
24
|
+
/** Same values as provider-apis' `GitPullRequestState`. */
|
|
25
|
+
export type ActionablePullRequestState = 'OPEN' | 'CLOSED' | 'MERGED';
|
|
26
|
+
/** Same values as provider-apis' `GitPullRequestMergeableState`. */
|
|
27
|
+
export type ActionablePullRequestMergeableState = 'BEHIND' | 'BLOCKED' | 'CONFLICTS' | 'FAILING_CHECKS' | 'MERGEABLE' | 'UNKNOWN' | 'UNKNOWN_AND_BLOCKED' | 'UNSTABLE';
|
|
28
|
+
/** Same values as provider-apis' `GitBuildStatusStage`. */
|
|
29
|
+
export type ActionablePullRequestBuildStatusStage = 'build' | 'production' | 'staging' | 'test';
|
|
30
|
+
/** Same values as provider-apis' `PullRequestActionCategory`. */
|
|
31
|
+
export type ActionablePullRequestCategory = 'readyToMerge' | 'unassignedReviewers' | 'failingCI' | 'conflicts' | 'needsMyReview' | 'changesRequested' | 'reviewerCommented' | 'waitingForReview' | 'draft' | 'other';
|
|
32
|
+
/** Copy of provider-apis' `Account`. */
|
|
33
|
+
export interface ActionablePullRequestAccount {
|
|
34
|
+
id: string;
|
|
35
|
+
graphQLId?: string;
|
|
36
|
+
username: string | null;
|
|
37
|
+
url: string | null;
|
|
38
|
+
name: string | null;
|
|
39
|
+
email: string | null;
|
|
40
|
+
avatarUrl: string | null;
|
|
41
|
+
}
|
|
42
|
+
/** Copy of provider-apis' `GitRefWithOID`. */
|
|
43
|
+
export interface ActionablePullRequestRef {
|
|
44
|
+
name: string;
|
|
45
|
+
oid: string | null;
|
|
46
|
+
}
|
|
47
|
+
/** Copy of provider-apis' `GitRepositoryRemoteInfo`. */
|
|
48
|
+
export interface ActionablePullRequestRemoteInfo {
|
|
49
|
+
cloneUrlHTTPS: string;
|
|
50
|
+
cloneUrlSSH: string;
|
|
51
|
+
}
|
|
52
|
+
/** Copy of provider-apis' `GitBuildStatus`. */
|
|
53
|
+
export interface ActionablePullRequestBuildStatus {
|
|
54
|
+
completedAt: Date | null;
|
|
55
|
+
description: string | null;
|
|
56
|
+
name: string | null;
|
|
57
|
+
state: ActionablePullRequestBuildStatusState | null;
|
|
58
|
+
stage: ActionablePullRequestBuildStatusStage | null;
|
|
59
|
+
startedAt: Date | null;
|
|
60
|
+
url: string;
|
|
61
|
+
}
|
|
62
|
+
/** Copy of provider-apis' `GitMilestone`. */
|
|
63
|
+
export interface ActionablePullRequestMilestone {
|
|
64
|
+
id: string;
|
|
65
|
+
graphQLId?: string;
|
|
66
|
+
number: number;
|
|
67
|
+
title: string;
|
|
68
|
+
description: string | null;
|
|
69
|
+
isOpen: boolean;
|
|
70
|
+
url: string;
|
|
71
|
+
startDate: Date | null;
|
|
72
|
+
dueDate: Date | null;
|
|
73
|
+
}
|
|
74
|
+
/** Copy of provider-apis' `GitLabel`. */
|
|
75
|
+
export interface ActionablePullRequestLabel {
|
|
76
|
+
color: string | null;
|
|
77
|
+
description: string | null;
|
|
78
|
+
graphQLId?: string;
|
|
79
|
+
id: string | null;
|
|
80
|
+
name: string;
|
|
81
|
+
}
|
|
82
|
+
/** Copy of provider-apis' `GitPullRequestStackMembership`: a pull request's place within its stack. */
|
|
83
|
+
export interface ActionablePullRequestStackMembership {
|
|
84
|
+
/** Identifies the stack within its repository; pair it with the repository to key a stack globally. */
|
|
85
|
+
number: number;
|
|
86
|
+
graphQLId?: string;
|
|
87
|
+
/** The number of pull requests in the stack as the provider reports it, which may exceed how many a read holds. */
|
|
88
|
+
size: number;
|
|
89
|
+
/** The name of the stack's trunk, which is not any member's own base branch. */
|
|
90
|
+
baseRefName: string;
|
|
91
|
+
/** The 1-based position in the stack, where 1 is the bottom and `size` is the top. */
|
|
92
|
+
position: number;
|
|
93
|
+
/** The node ID of this pull request's entry in the stack. */
|
|
94
|
+
entryGraphQLId: string;
|
|
95
|
+
}
|
|
96
|
+
/** Copy of provider-apis' `PullRequestWithUniqueID` (its `GitPullRequest` plus the entity-identifier `uuid`). */
|
|
97
|
+
export interface ActionablePullRequestInput {
|
|
98
|
+
/** Epoch milliseconds at the start of the request that supplied this result. */
|
|
99
|
+
readonly capturedAt?: number;
|
|
100
|
+
/** Opaque identity shared by results from the same request. */
|
|
101
|
+
readonly captureId?: string;
|
|
102
|
+
id: string;
|
|
103
|
+
graphQLId?: string;
|
|
104
|
+
number: number;
|
|
105
|
+
title: string;
|
|
106
|
+
description: string | null;
|
|
107
|
+
url: string | null;
|
|
108
|
+
state: ActionablePullRequestState;
|
|
109
|
+
isDraft: boolean;
|
|
110
|
+
createdDate: Date;
|
|
111
|
+
updatedDate: Date;
|
|
112
|
+
closedDate: Date | null;
|
|
113
|
+
mergedDate: Date | null;
|
|
114
|
+
baseRef: ActionablePullRequestRef | null;
|
|
115
|
+
headRef: ActionablePullRequestRef | null;
|
|
116
|
+
commentCount: number | null;
|
|
117
|
+
upvoteCount: number | null;
|
|
118
|
+
commitCount: number | null;
|
|
119
|
+
fileCount: number | null;
|
|
120
|
+
additions: number | null;
|
|
121
|
+
deletions: number | null;
|
|
122
|
+
author: ActionablePullRequestAccount | null;
|
|
123
|
+
assignees: ActionablePullRequestAccount[] | null;
|
|
124
|
+
reviews: {
|
|
125
|
+
reviewer: ActionablePullRequestAccount;
|
|
126
|
+
state: ActionablePullRequestReviewState;
|
|
127
|
+
}[] | null;
|
|
128
|
+
reviewDecision: ActionablePullRequestReviewState | null;
|
|
129
|
+
isCrossRepository: boolean;
|
|
130
|
+
repository: {
|
|
131
|
+
id: string;
|
|
132
|
+
graphQLId?: string;
|
|
133
|
+
name: string;
|
|
134
|
+
project?: string;
|
|
135
|
+
owner: {
|
|
136
|
+
login: string;
|
|
137
|
+
};
|
|
138
|
+
remoteInfo: ActionablePullRequestRemoteInfo | null;
|
|
139
|
+
};
|
|
140
|
+
headRepository: {
|
|
141
|
+
id: string;
|
|
142
|
+
graphQLId?: string;
|
|
143
|
+
name: string;
|
|
144
|
+
project?: string;
|
|
145
|
+
owner: {
|
|
146
|
+
login: string;
|
|
147
|
+
};
|
|
148
|
+
remoteInfo: ActionablePullRequestRemoteInfo | null;
|
|
149
|
+
isFork?: boolean;
|
|
150
|
+
} | null;
|
|
151
|
+
headCommit: {
|
|
152
|
+
buildStatuses: ActionablePullRequestBuildStatus[] | null;
|
|
153
|
+
} | null;
|
|
154
|
+
mergeableState: ActionablePullRequestMergeableState;
|
|
155
|
+
milestone?: ActionablePullRequestMilestone | null;
|
|
156
|
+
labels?: ActionablePullRequestLabel[];
|
|
157
|
+
permissions: {
|
|
158
|
+
canMerge: boolean;
|
|
159
|
+
canMergeAndBypassProtections: boolean;
|
|
160
|
+
} | null;
|
|
161
|
+
version?: number;
|
|
162
|
+
/**
|
|
163
|
+
* Its stacked-pull-request membership: `undefined` when stacking isn't knowable (every provider but GitHub, or a
|
|
164
|
+
* read that had to drop the field), `null` when the host reported it isn't in a stack.
|
|
165
|
+
*/
|
|
166
|
+
stack?: ActionablePullRequestStackMembership | null;
|
|
167
|
+
uuid: string;
|
|
168
|
+
}
|
|
169
|
+
/** Copy of provider-apis' `EnrichedItem`: a pin or snooze stored against an entity. */
|
|
170
|
+
export interface ActionablePullRequestEnrichedItem {
|
|
171
|
+
id: string;
|
|
172
|
+
userId?: string;
|
|
173
|
+
type: 'pin' | 'snooze';
|
|
174
|
+
provider: 'azure' | 'bitbucket' | 'github' | 'gitlab' | 'jira' | 'linear' | 'trello' | 'gitkraken';
|
|
175
|
+
entityType: 'issue' | 'pr';
|
|
176
|
+
entityId: string;
|
|
177
|
+
entityUrl: string;
|
|
178
|
+
createdAt: string;
|
|
179
|
+
updatedAt: string;
|
|
180
|
+
expiresAt?: string;
|
|
181
|
+
}
|
|
182
|
+
/** Copy of provider-apis' `EnrichedItemsByUniqueId`, keyed by an input's `uuid`. */
|
|
183
|
+
export interface ActionablePullRequestEnrichedItems {
|
|
184
|
+
[uuid: string]: ActionablePullRequestEnrichedItem[];
|
|
185
|
+
}
|
|
186
|
+
/** What categorization adds to an {@link ActionablePullRequestInput} (provider-apis' `ActionablePullRequest` minus its input). */
|
|
187
|
+
export interface ActionablePullRequestFields {
|
|
188
|
+
suggestedActionCategory: ActionablePullRequestCategory;
|
|
189
|
+
priority: number;
|
|
190
|
+
viewer: {
|
|
191
|
+
canMerge: boolean;
|
|
192
|
+
isAuthor: boolean;
|
|
193
|
+
isAssignee: boolean;
|
|
194
|
+
isReviewer: boolean;
|
|
195
|
+
shouldMerge: boolean;
|
|
196
|
+
shouldAssignReviewer: boolean;
|
|
197
|
+
waitingOnReviews: boolean;
|
|
198
|
+
shouldReview: boolean;
|
|
199
|
+
pinned?: boolean;
|
|
200
|
+
snoozed?: boolean;
|
|
201
|
+
enrichedItems?: ActionablePullRequestEnrichedItem[];
|
|
202
|
+
};
|
|
203
|
+
failingCI: boolean;
|
|
204
|
+
hasConflicts: boolean;
|
|
205
|
+
changeRequestReviewCount: number;
|
|
206
|
+
codeSuggestionsCount: number;
|
|
207
|
+
commentReviewCount: number;
|
|
208
|
+
approvalReviewCount: number;
|
|
209
|
+
}
|
|
210
|
+
/** Copy of provider-apis' `ActionablePullRequest`. */
|
|
211
|
+
export type ActionablePullRequest = ActionablePullRequestInput & ActionablePullRequestFields;
|
|
212
|
+
//#endregion
|
|
213
|
+
//# sourceMappingURL=actionablePullRequest.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region ../plus/integrations/src/models/actionablePullRequest.ts
|
|
2
|
+
/** Same values as provider-apis' `GitBuildStatusState`. */
|
|
3
|
+
const ActionablePullRequestBuildStatusState = {
|
|
4
|
+
ActionRequired: "ACTION_REQUIRED",
|
|
5
|
+
Cancelled: "CANCELLED",
|
|
6
|
+
Error: "ERROR",
|
|
7
|
+
Failed: "FAILED",
|
|
8
|
+
Pending: "PENDING",
|
|
9
|
+
Running: "RUNNING",
|
|
10
|
+
Skipped: "SKIPPED",
|
|
11
|
+
Success: "SUCCESS",
|
|
12
|
+
Warning: "WARNING",
|
|
13
|
+
OptionalActionRequired: "OPTIONAL_ACTION_REQUIRED"
|
|
14
|
+
};
|
|
15
|
+
/** Same values as provider-apis' `GitPullRequestReviewState`. */
|
|
16
|
+
const ActionablePullRequestReviewState = {
|
|
17
|
+
Approved: "APPROVED",
|
|
18
|
+
ChangesRequested: "CHANGES_REQUESTED",
|
|
19
|
+
Commented: "COMMENTED",
|
|
20
|
+
ReviewRequested: "REVIEW_REQUESTED"
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { ActionablePullRequestBuildStatusState, ActionablePullRequestReviewState };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=actionablePullRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionablePullRequest.js","names":[],"sources":["../../../../../plus/integrations/src/models/actionablePullRequest.ts"],"sourcesContent":["// GitLens-neutral structural copies of the `@gitkraken/provider-apis` actionable pull-request shapes that Launchpad\n// categorizes. Consumers depend on these instead of the SDK, so the SDK can later be absorbed into this package\n// without touching them. Every shape here must stay value-for-value identical to its SDK original:\n// `__tests__/actionablePullRequestParity.test.ts` fails to compile on any drift.\n//\n// The SDK's string enums are nominal, so the copies use the same strings as literal unions. An SDK value is\n// assignable to its copy; the reverse needs a cast, which only `getActionablePullRequests` makes, at the boundary.\n\n/** Same values as provider-apis' `GitBuildStatusState`. */\nexport const ActionablePullRequestBuildStatusState = {\n\tActionRequired: 'ACTION_REQUIRED',\n\tCancelled: 'CANCELLED',\n\tError: 'ERROR',\n\tFailed: 'FAILED',\n\tPending: 'PENDING',\n\tRunning: 'RUNNING',\n\tSkipped: 'SKIPPED',\n\tSuccess: 'SUCCESS',\n\tWarning: 'WARNING',\n\tOptionalActionRequired: 'OPTIONAL_ACTION_REQUIRED',\n} as const;\nexport type ActionablePullRequestBuildStatusState =\n\t(typeof ActionablePullRequestBuildStatusState)[keyof typeof ActionablePullRequestBuildStatusState];\n\n/** Same values as provider-apis' `GitPullRequestReviewState`. */\nexport const ActionablePullRequestReviewState = {\n\tApproved: 'APPROVED',\n\tChangesRequested: 'CHANGES_REQUESTED',\n\tCommented: 'COMMENTED',\n\tReviewRequested: 'REVIEW_REQUESTED',\n} as const;\nexport type ActionablePullRequestReviewState =\n\t(typeof ActionablePullRequestReviewState)[keyof typeof ActionablePullRequestReviewState];\n\n/** Same values as provider-apis' `GitPullRequestState`. */\nexport type ActionablePullRequestState = 'OPEN' | 'CLOSED' | 'MERGED';\n\n/** Same values as provider-apis' `GitPullRequestMergeableState`. */\nexport type ActionablePullRequestMergeableState =\n\t| 'BEHIND'\n\t| 'BLOCKED'\n\t| 'CONFLICTS'\n\t| 'FAILING_CHECKS'\n\t| 'MERGEABLE'\n\t| 'UNKNOWN'\n\t| 'UNKNOWN_AND_BLOCKED'\n\t| 'UNSTABLE';\n\n/** Same values as provider-apis' `GitBuildStatusStage`. */\nexport type ActionablePullRequestBuildStatusStage = 'build' | 'production' | 'staging' | 'test';\n\n/** Same values as provider-apis' `PullRequestActionCategory`. */\nexport type ActionablePullRequestCategory =\n\t| 'readyToMerge'\n\t| 'unassignedReviewers'\n\t| 'failingCI'\n\t| 'conflicts'\n\t| 'needsMyReview'\n\t| 'changesRequested'\n\t| 'reviewerCommented'\n\t| 'waitingForReview'\n\t| 'draft'\n\t| 'other';\n\n/** Copy of provider-apis' `Account`. */\nexport interface ActionablePullRequestAccount {\n\tid: string;\n\tgraphQLId?: string;\n\tusername: string | null;\n\turl: string | null;\n\tname: string | null;\n\temail: string | null;\n\tavatarUrl: string | null;\n}\n\n/** Copy of provider-apis' `GitRefWithOID`. */\nexport interface ActionablePullRequestRef {\n\tname: string;\n\toid: string | null;\n}\n\n/** Copy of provider-apis' `GitRepositoryRemoteInfo`. */\nexport interface ActionablePullRequestRemoteInfo {\n\tcloneUrlHTTPS: string;\n\tcloneUrlSSH: string;\n}\n\n/** Copy of provider-apis' `GitBuildStatus`. */\nexport interface ActionablePullRequestBuildStatus {\n\tcompletedAt: Date | null;\n\tdescription: string | null;\n\tname: string | null;\n\tstate: ActionablePullRequestBuildStatusState | null;\n\tstage: ActionablePullRequestBuildStatusStage | null;\n\tstartedAt: Date | null;\n\turl: string;\n}\n\n/** Copy of provider-apis' `GitMilestone`. */\nexport interface ActionablePullRequestMilestone {\n\tid: string;\n\tgraphQLId?: string;\n\tnumber: number;\n\ttitle: string;\n\tdescription: string | null;\n\tisOpen: boolean;\n\turl: string;\n\tstartDate: Date | null;\n\tdueDate: Date | null;\n}\n\n/** Copy of provider-apis' `GitLabel`. */\nexport interface ActionablePullRequestLabel {\n\tcolor: string | null;\n\tdescription: string | null;\n\tgraphQLId?: string;\n\tid: string | null;\n\tname: string;\n}\n\n/** Copy of provider-apis' `GitPullRequestStackMembership`: a pull request's place within its stack. */\nexport interface ActionablePullRequestStackMembership {\n\t/** Identifies the stack within its repository; pair it with the repository to key a stack globally. */\n\tnumber: number;\n\tgraphQLId?: string;\n\t/** The number of pull requests in the stack as the provider reports it, which may exceed how many a read holds. */\n\tsize: number;\n\t/** The name of the stack's trunk, which is not any member's own base branch. */\n\tbaseRefName: string;\n\t/** The 1-based position in the stack, where 1 is the bottom and `size` is the top. */\n\tposition: number;\n\t/** The node ID of this pull request's entry in the stack. */\n\tentryGraphQLId: string;\n}\n\n/** Copy of provider-apis' `PullRequestWithUniqueID` (its `GitPullRequest` plus the entity-identifier `uuid`). */\nexport interface ActionablePullRequestInput {\n\t/** Epoch milliseconds at the start of the request that supplied this result. */\n\treadonly capturedAt?: number;\n\t/** Opaque identity shared by results from the same request. */\n\treadonly captureId?: string;\n\tid: string;\n\tgraphQLId?: string;\n\tnumber: number;\n\ttitle: string;\n\tdescription: string | null;\n\turl: string | null;\n\tstate: ActionablePullRequestState;\n\tisDraft: boolean;\n\tcreatedDate: Date;\n\tupdatedDate: Date;\n\tclosedDate: Date | null;\n\tmergedDate: Date | null;\n\tbaseRef: ActionablePullRequestRef | null;\n\theadRef: ActionablePullRequestRef | null;\n\tcommentCount: number | null;\n\tupvoteCount: number | null;\n\tcommitCount: number | null;\n\tfileCount: number | null;\n\tadditions: number | null;\n\tdeletions: number | null;\n\tauthor: ActionablePullRequestAccount | null;\n\tassignees: ActionablePullRequestAccount[] | null;\n\treviews:\n\t\t| {\n\t\t\t\treviewer: ActionablePullRequestAccount;\n\t\t\t\tstate: ActionablePullRequestReviewState;\n\t\t }[]\n\t\t| null;\n\treviewDecision: ActionablePullRequestReviewState | null;\n\tisCrossRepository: boolean;\n\trepository: {\n\t\tid: string;\n\t\tgraphQLId?: string;\n\t\tname: string;\n\t\tproject?: string;\n\t\towner: {\n\t\t\tlogin: string;\n\t\t};\n\t\tremoteInfo: ActionablePullRequestRemoteInfo | null;\n\t};\n\theadRepository: {\n\t\tid: string;\n\t\tgraphQLId?: string;\n\t\tname: string;\n\t\tproject?: string;\n\t\towner: {\n\t\t\tlogin: string;\n\t\t};\n\t\tremoteInfo: ActionablePullRequestRemoteInfo | null;\n\t\tisFork?: boolean;\n\t} | null;\n\theadCommit: {\n\t\tbuildStatuses: ActionablePullRequestBuildStatus[] | null;\n\t} | null;\n\tmergeableState: ActionablePullRequestMergeableState;\n\tmilestone?: ActionablePullRequestMilestone | null;\n\tlabels?: ActionablePullRequestLabel[];\n\tpermissions: {\n\t\tcanMerge: boolean;\n\t\tcanMergeAndBypassProtections: boolean;\n\t} | null;\n\tversion?: number;\n\t/**\n\t * Its stacked-pull-request membership: `undefined` when stacking isn't knowable (every provider but GitHub, or a\n\t * read that had to drop the field), `null` when the host reported it isn't in a stack.\n\t */\n\tstack?: ActionablePullRequestStackMembership | null;\n\tuuid: string;\n}\n\n/** Copy of provider-apis' `EnrichedItem`: a pin or snooze stored against an entity. */\nexport interface ActionablePullRequestEnrichedItem {\n\tid: string;\n\tuserId?: string;\n\ttype: 'pin' | 'snooze';\n\tprovider: 'azure' | 'bitbucket' | 'github' | 'gitlab' | 'jira' | 'linear' | 'trello' | 'gitkraken';\n\tentityType: 'issue' | 'pr';\n\tentityId: string;\n\tentityUrl: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\texpiresAt?: string;\n}\n\n/** Copy of provider-apis' `EnrichedItemsByUniqueId`, keyed by an input's `uuid`. */\nexport interface ActionablePullRequestEnrichedItems {\n\t[uuid: string]: ActionablePullRequestEnrichedItem[];\n}\n\n/** What categorization adds to an {@link ActionablePullRequestInput} (provider-apis' `ActionablePullRequest` minus its input). */\nexport interface ActionablePullRequestFields {\n\tsuggestedActionCategory: ActionablePullRequestCategory;\n\tpriority: number;\n\tviewer: {\n\t\tcanMerge: boolean;\n\t\tisAuthor: boolean;\n\t\tisAssignee: boolean;\n\t\tisReviewer: boolean;\n\t\tshouldMerge: boolean;\n\t\tshouldAssignReviewer: boolean;\n\t\twaitingOnReviews: boolean;\n\t\tshouldReview: boolean;\n\t\tpinned?: boolean;\n\t\tsnoozed?: boolean;\n\t\tenrichedItems?: ActionablePullRequestEnrichedItem[];\n\t};\n\tfailingCI: boolean;\n\thasConflicts: boolean;\n\tchangeRequestReviewCount: number;\n\tcodeSuggestionsCount: number;\n\tcommentReviewCount: number;\n\tapprovalReviewCount: number;\n}\n\n/** Copy of provider-apis' `ActionablePullRequest`. */\nexport type ActionablePullRequest = ActionablePullRequestInput & ActionablePullRequestFields;\n"],"mappings":";;AASA,MAAa,wCAAwC;CACpD,gBAAgB;CAChB,WAAW;CACX,OAAO;CACP,QAAQ;CACR,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,wBAAwB;AACzB;;AAKA,MAAa,mCAAmC;CAC/C,UAAU;CACV,kBAAkB;CAClB,WAAW;CACX,iBAAiB;AAClB"}
|
|
@@ -10,55 +10,17 @@ import { RepositoryMetadata } from "../../../git/models/repositoryMetadata.js";
|
|
|
10
10
|
import { PullRequestUrlIdentity } from "../../../git/utils/pullRequest.utils.js";
|
|
11
11
|
import { ProviderAuthenticationSession } from "../authentication/models.js";
|
|
12
12
|
import { IntegrationIds } from "../constants.js";
|
|
13
|
+
import { IssueEtagFields, IssueEtagInclude, PullRequestEtagFields, PullRequestEtagInclude } from "../reads/etag.js";
|
|
13
14
|
import { ProviderOrganization } from "../results.js";
|
|
15
|
+
import { ProviderRepositoriesInput } from "../manager.js";
|
|
16
|
+
import { GitHostIntegration as GitHostIntegration$1, IntegrationResult, MyPullRequestsForReposOptions, SearchMyPullRequestsOptions, SearchPullRequestsOptions } from "./publicIntegration.js";
|
|
14
17
|
import { ProviderScopeFailure } from "../collectionMetadata.js";
|
|
15
18
|
import { ProviderPullRequestCount, ProviderPullRequestSearchPage } from "./pullRequestReads.js";
|
|
16
|
-
import { ProviderApiPagedResult, ProviderHierarchyResult, ProviderIssue, ProviderPullRequest, ProviderRepoInput, ProviderReposInput, ProviderRepository } from "../providers/models.js";
|
|
17
19
|
import { MyIssuesForReposOptions, ProviderIssueSearchPage, ProviderSearchCount } from "./issueReads.js";
|
|
18
|
-
import { BatchSlot, IntegrationBase
|
|
20
|
+
import { BatchSlot, IntegrationBase } from "./integration.js";
|
|
21
|
+
import { ProviderApiPagedResult, ProviderHierarchyResult, ProviderIssue, ProviderPullRequest, ProviderRepoInput, ProviderReposInput, ProviderRepository } from "../providers/models.js";
|
|
19
22
|
import { CollectionMetadata } from "@gitkraken/provider-apis";
|
|
20
23
|
//#region ../plus/integrations/src/models/gitHostIntegration.d.ts
|
|
21
|
-
/** Read options for {@link GitHostIntegration.searchMyPullRequests} and the provider hook behind it. */
|
|
22
|
-
export type SearchMyPullRequestsOptions = {
|
|
23
|
-
/** Suppresses the user-facing notification when the read fails. */
|
|
24
|
-
silent?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* PR states to include (open/closed/merged/all). Providers that cannot express it in a single query
|
|
27
|
-
* filter the normalized results; omitted preserves the historical open-only behavior.
|
|
28
|
-
*/
|
|
29
|
-
state?: PullRequestStateFilter;
|
|
30
|
-
includeReviewRequested?: boolean;
|
|
31
|
-
};
|
|
32
|
-
/** Read options for {@link GitHostIntegration.searchPullRequests} and the provider hook behind it. */
|
|
33
|
-
export type SearchPullRequestsOptions = {
|
|
34
|
-
/** PR states to include; omitted preserves the provider's default. */
|
|
35
|
-
include?: IssueOrPullRequestState[];
|
|
36
|
-
};
|
|
37
|
-
type MyPullRequestsForReposOptions = {
|
|
38
|
-
filters?: PullRequestFilter[];
|
|
39
|
-
cursor?: string;
|
|
40
|
-
customUrl?: string;
|
|
41
|
-
page?: number;
|
|
42
|
-
pageSize?: number;
|
|
43
|
-
/** PR states to include; when omitted the provider returns its default (open only). */
|
|
44
|
-
state?: PullRequestStateFilter | PullRequestStateFilter[];
|
|
45
|
-
/** Requests the lightweight row shape without per-row build status or commit count. */
|
|
46
|
-
summary?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Most per-repository requests one provider read keeps in flight. Defaults to 6. Only hosts that read repository
|
|
49
|
-
* by repository fan out — GitLab, GitLab self-managed, Bitbucket Cloud, Bitbucket Data Center and Azure DevOps;
|
|
50
|
-
* GitHub/GHE send one query whatever the repo count. A value that isn't a finite number >= 1 falls back to the
|
|
51
|
-
* default.
|
|
52
|
-
*/
|
|
53
|
-
scopeConcurrency?: number;
|
|
54
|
-
/**
|
|
55
|
-
* Azure DevOps only, repo-scoped: `false` skips the lookup that fills each row's clone URLs, saving one
|
|
56
|
-
* request per repository (and fork source) per page. Rows then carry no `refs.base.url`/`refs.head.url`
|
|
57
|
-
* (empty) and no `cloneHttps`/`cloneSsh`, so leave it on for rows that will be checked out or matched to local
|
|
58
|
-
* remotes. Defaults to `true`; other providers ignore it.
|
|
59
|
-
*/
|
|
60
|
-
includeRemoteInfo?: boolean;
|
|
61
|
-
};
|
|
62
24
|
/** A repository as the batch and branch reads name it. */
|
|
63
25
|
export type RepositoryCoordinate = {
|
|
64
26
|
owner: string;
|
|
@@ -84,8 +46,8 @@ export type SettledRepositoryScopes = {
|
|
|
84
46
|
repos: ProviderReposInput;
|
|
85
47
|
unsettled?: readonly boolean[];
|
|
86
48
|
};
|
|
87
|
-
export declare abstract class GitHostIntegration<ID extends IntegrationIds = IntegrationIds, T extends ResourceDescriptor = ResourceDescriptor> extends IntegrationBase<ID> {
|
|
88
|
-
readonly type
|
|
49
|
+
export declare abstract class GitHostIntegration<ID extends IntegrationIds = IntegrationIds, T extends ResourceDescriptor = ResourceDescriptor> extends IntegrationBase<ID> implements GitHostIntegration$1 {
|
|
50
|
+
readonly type = "git";
|
|
89
51
|
/** The self-managed installation `session` addresses, validated against this integration's host. */
|
|
90
52
|
protected getSelfManagedInstallationUrl(session: ProviderAuthenticationSession): string;
|
|
91
53
|
protected getSelfManagedApiBaseUrl(session: ProviderAuthenticationSession): string;
|
|
@@ -398,7 +360,12 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
|
|
|
398
360
|
getMyIssuesForReposAsShapesResult(reposOrRepoIds: ProviderReposInput | SettledRepositoryScopes, options?: MyIssuesForReposOptions, connectionId?: string): Promise<IntegrationResult<(PagedResult<IssueShape> & {
|
|
399
361
|
metadata?: CollectionMetadata;
|
|
400
362
|
}) | undefined>>;
|
|
401
|
-
|
|
363
|
+
/**
|
|
364
|
+
* The current user's pull requests (or, without `filters`, every pull request) in `reposOrRepoIds`, one page at a
|
|
365
|
+
* time; `undefined` when the read failed. {@link getMyPullRequestsForReposResult} keeps the error and the SDK's
|
|
366
|
+
* collection metadata.
|
|
367
|
+
*/
|
|
368
|
+
getMyPullRequestsForRepos(reposOrRepoIds: ProviderRepositoriesInput, options?: MyPullRequestsForReposOptions, connectionId?: string): Promise<PagedResult<PullRequest> | undefined>;
|
|
402
369
|
/**
|
|
403
370
|
* Result-returning core of {@link getMyPullRequestsForRepos}. Resolves the session for `connectionId`
|
|
404
371
|
* (or the primary connection when omitted, so multi-account reads use the right token) and recovers
|