@gitkraken/core-gitlens 0.4.0 → 0.4.100
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 +71 -1
- package/README.md +9 -2
- package/dist/git/cache.d.ts +29 -2
- package/dist/git/cache.d.ts.map +1 -1
- package/dist/git/cache.js +67 -7
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts.map +1 -1
- package/dist/git/errors.d.ts +31 -1
- package/dist/git/errors.d.ts.map +1 -1
- package/dist/git/errors.js +29 -0
- package/dist/git/errors.js.map +1 -1
- package/dist/git/models/author.d.ts.map +1 -1
- package/dist/git/models/author.js.map +1 -1
- package/dist/git/models/autolink.d.ts.map +1 -1
- package/dist/git/models/autolink.js.map +1 -1
- package/dist/git/models/blame.d.ts.map +1 -1
- package/dist/git/models/blame.js.map +1 -1
- package/dist/git/models/branch.d.ts.map +1 -1
- package/dist/git/models/branch.js.map +1 -1
- package/dist/git/models/commit.d.ts.map +1 -1
- package/dist/git/models/commit.js +1 -1
- package/dist/git/models/commit.js.map +1 -1
- package/dist/git/models/contributor.d.ts.map +1 -1
- package/dist/git/models/contributor.js.map +1 -1
- package/dist/git/models/defaultBranch.d.ts.map +1 -1
- package/dist/git/models/defaultBranch.js.map +1 -1
- package/dist/git/models/diff.d.ts.map +1 -1
- package/dist/git/models/diff.js.map +1 -1
- package/dist/git/models/file.d.ts.map +1 -1
- package/dist/git/models/file.js.map +1 -1
- package/dist/git/models/fileChange.d.ts.map +1 -1
- package/dist/git/models/fileChange.js.map +1 -1
- package/dist/git/models/fileStatus.d.ts +22 -22
- package/dist/git/models/fileStatus.d.ts.map +1 -1
- package/dist/git/models/fileStatus.js.map +1 -1
- package/dist/git/models/graph.d.ts +122 -1
- package/dist/git/models/graph.d.ts.map +1 -1
- package/dist/git/models/graph.js +4 -0
- package/dist/git/models/graph.js.map +1 -1
- package/dist/git/models/graphSearch.d.ts.map +1 -1
- package/dist/git/models/graphSearch.js.map +1 -1
- package/dist/git/models/graphSession.d.ts +177 -0
- package/dist/git/models/graphSession.d.ts.map +1 -0
- package/dist/git/models/graphSession.js +7 -0
- package/dist/git/models/graphSession.js.map +1 -0
- package/dist/git/models/issue.d.ts +12 -2
- package/dist/git/models/issue.d.ts.map +1 -1
- package/dist/git/models/issue.js +3 -1
- package/dist/git/models/issue.js.map +1 -1
- package/dist/git/models/issueOrPullRequest.d.ts.map +1 -1
- package/dist/git/models/issueOrPullRequest.js.map +1 -1
- package/dist/git/models/lineRange.d.ts.map +1 -1
- package/dist/git/models/lineRange.js.map +1 -1
- package/dist/git/models/log.d.ts.map +1 -1
- package/dist/git/models/log.js.map +1 -1
- package/dist/git/models/mergeConflicts.d.ts.map +1 -1
- package/dist/git/models/mergeConflicts.js.map +1 -1
- package/dist/git/models/patch.d.ts.map +1 -1
- package/dist/git/models/patch.js.map +1 -1
- package/dist/git/models/pausedOperationStatus.d.ts.map +1 -1
- package/dist/git/models/pausedOperationStatus.js.map +1 -1
- package/dist/git/models/pullRequest.d.ts +27 -2
- package/dist/git/models/pullRequest.d.ts.map +1 -1
- package/dist/git/models/pullRequest.js +7 -1
- package/dist/git/models/pullRequest.js.map +1 -1
- package/dist/git/models/rebase.d.ts.map +1 -1
- package/dist/git/models/rebase.js.map +1 -1
- package/dist/git/models/reference.d.ts.map +1 -1
- package/dist/git/models/reference.js.map +1 -1
- package/dist/git/models/reflog.d.ts.map +1 -1
- package/dist/git/models/reflog.js.map +1 -1
- package/dist/git/models/remote.d.ts.map +1 -1
- package/dist/git/models/remote.js.map +1 -1
- package/dist/git/models/remoteProvider.d.ts.map +1 -1
- package/dist/git/models/remoteProvider.js.map +1 -1
- package/dist/git/models/remoteResource.d.ts.map +1 -1
- package/dist/git/models/remoteResource.js.map +1 -1
- package/dist/git/models/repository.d.ts +20 -2
- package/dist/git/models/repository.d.ts.map +1 -1
- package/dist/git/models/repository.js +19 -0
- package/dist/git/models/repository.js.map +1 -1
- package/dist/git/models/repositoryChangeEvent.d.ts.map +1 -1
- package/dist/git/models/repositoryChangeEvent.js.map +1 -1
- package/dist/git/models/repositoryIdentities.d.ts.map +1 -1
- package/dist/git/models/repositoryIdentities.js.map +1 -1
- package/dist/git/models/repositoryMetadata.d.ts.map +1 -1
- package/dist/git/models/repositoryMetadata.js.map +1 -1
- package/dist/git/models/resourceDescriptor.d.ts +16 -0
- package/dist/git/models/resourceDescriptor.d.ts.map +1 -1
- package/dist/git/models/resourceDescriptor.js.map +1 -1
- package/dist/git/models/revision.d.ts.map +1 -1
- package/dist/git/models/revision.js.map +1 -1
- package/dist/git/models/search.d.ts.map +1 -1
- package/dist/git/models/search.js.map +1 -1
- package/dist/git/models/shortlog.d.ts.map +1 -1
- package/dist/git/models/shortlog.js.map +1 -1
- package/dist/git/models/signature.d.ts +14 -0
- package/dist/git/models/signature.d.ts.map +1 -1
- package/dist/git/models/signature.js.map +1 -1
- package/dist/git/models/staging.d.ts.map +1 -1
- package/dist/git/models/staging.js.map +1 -1
- package/dist/git/models/stash.d.ts.map +1 -1
- package/dist/git/models/stash.js.map +1 -1
- package/dist/git/models/status.d.ts.map +1 -1
- package/dist/git/models/status.js.map +1 -1
- package/dist/git/models/statusFile.d.ts.map +1 -1
- package/dist/git/models/statusFile.js.map +1 -1
- package/dist/git/models/tag.d.ts +11 -1
- package/dist/git/models/tag.d.ts.map +1 -1
- package/dist/git/models/tag.js +9 -2
- package/dist/git/models/tag.js.map +1 -1
- package/dist/git/models/tree.d.ts.map +1 -1
- package/dist/git/models/tree.js.map +1 -1
- package/dist/git/models/user.d.ts.map +1 -1
- package/dist/git/models/user.js.map +1 -1
- package/dist/git/models/worktree.d.ts.map +1 -1
- package/dist/git/models/worktree.js.map +1 -1
- package/dist/git/parsers/diffParser.d.ts.map +1 -1
- package/dist/git/parsers/diffParser.js +1 -1
- package/dist/git/parsers/diffParser.js.map +1 -1
- package/dist/git/parsers/rebaseTodoParser.d.ts.map +1 -1
- package/dist/git/parsers/rebaseTodoParser.js.map +1 -1
- package/dist/git/providers/blame.d.ts.map +1 -1
- package/dist/git/providers/blame.js.map +1 -1
- package/dist/git/providers/branches.d.ts +8 -1
- package/dist/git/providers/branches.d.ts.map +1 -1
- package/dist/git/providers/branches.js.map +1 -1
- package/dist/git/providers/commits.d.ts +6 -1
- package/dist/git/providers/commits.d.ts.map +1 -1
- package/dist/git/providers/commits.js.map +1 -1
- package/dist/git/providers/config.d.ts +6 -2
- package/dist/git/providers/config.d.ts.map +1 -1
- package/dist/git/providers/config.js.map +1 -1
- package/dist/git/providers/contributors.d.ts.map +1 -1
- package/dist/git/providers/contributors.js.map +1 -1
- package/dist/git/providers/diff.d.ts.map +1 -1
- package/dist/git/providers/diff.js.map +1 -1
- package/dist/git/providers/graph.d.ts +55 -1
- package/dist/git/providers/graph.d.ts.map +1 -1
- package/dist/git/providers/graph.js.map +1 -1
- package/dist/git/providers/operations.d.ts.map +1 -1
- package/dist/git/providers/operations.js.map +1 -1
- package/dist/git/providers/patch.d.ts.map +1 -1
- package/dist/git/providers/patch.js.map +1 -1
- package/dist/git/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git/providers/pausedOperations.js.map +1 -1
- package/dist/git/providers/provider.d.ts.map +1 -1
- package/dist/git/providers/provider.js.map +1 -1
- package/dist/git/providers/refs.d.ts.map +1 -1
- package/dist/git/providers/refs.js.map +1 -1
- package/dist/git/providers/remotes.d.ts.map +1 -1
- package/dist/git/providers/remotes.js.map +1 -1
- package/dist/git/providers/revision.d.ts.map +1 -1
- package/dist/git/providers/revision.js.map +1 -1
- package/dist/git/providers/shared/remotes.d.ts.map +1 -1
- package/dist/git/providers/shared/remotes.js.map +1 -1
- package/dist/git/providers/staging.d.ts.map +1 -1
- package/dist/git/providers/staging.js.map +1 -1
- package/dist/git/providers/stash.d.ts.map +1 -1
- package/dist/git/providers/stash.js.map +1 -1
- package/dist/git/providers/status.d.ts +1 -0
- package/dist/git/providers/status.d.ts.map +1 -1
- package/dist/git/providers/status.js.map +1 -1
- package/dist/git/providers/tags.d.ts.map +1 -1
- package/dist/git/providers/tags.js.map +1 -1
- package/dist/git/providers/types.d.ts.map +1 -1
- package/dist/git/providers/types.js.map +1 -1
- package/dist/git/providers/worktrees.d.ts +3 -1
- package/dist/git/providers/worktrees.d.ts.map +1 -1
- package/dist/git/providers/worktrees.js.map +1 -1
- package/dist/git/remotes/azure-devops.d.ts.map +1 -1
- package/dist/git/remotes/azure-devops.js +27 -31
- package/dist/git/remotes/azure-devops.js.map +1 -1
- package/dist/git/remotes/bitbucket-server.d.ts.map +1 -1
- package/dist/git/remotes/bitbucket-server.js +21 -23
- package/dist/git/remotes/bitbucket-server.js.map +1 -1
- package/dist/git/remotes/bitbucket.d.ts.map +1 -1
- package/dist/git/remotes/bitbucket.js +21 -23
- package/dist/git/remotes/bitbucket.js.map +1 -1
- package/dist/git/remotes/custom.d.ts.map +1 -1
- package/dist/git/remotes/custom.js.map +1 -1
- package/dist/git/remotes/gerrit.d.ts.map +1 -1
- package/dist/git/remotes/gerrit.js +11 -13
- package/dist/git/remotes/gerrit.js.map +1 -1
- package/dist/git/remotes/gitea.d.ts.map +1 -1
- package/dist/git/remotes/gitea.js +12 -14
- package/dist/git/remotes/gitea.js.map +1 -1
- package/dist/git/remotes/github.d.ts.map +1 -1
- package/dist/git/remotes/github.js +54 -56
- package/dist/git/remotes/github.js.map +1 -1
- package/dist/git/remotes/gitlab.d.ts.map +1 -1
- package/dist/git/remotes/gitlab.js +93 -95
- package/dist/git/remotes/gitlab.js.map +1 -1
- package/dist/git/remotes/google-source.d.ts.map +1 -1
- package/dist/git/remotes/google-source.js.map +1 -1
- package/dist/git/remotes/matcher.d.ts.map +1 -1
- package/dist/git/remotes/matcher.js.map +1 -1
- package/dist/git/run.types.d.ts +62 -3
- package/dist/git/run.types.d.ts.map +1 -1
- package/dist/git/service.d.ts.map +1 -1
- package/dist/git/utils/autolink.utils.d.ts.map +1 -1
- package/dist/git/utils/autolink.utils.js.map +1 -1
- package/dist/git/utils/blame.utils.d.ts.map +1 -1
- package/dist/git/utils/blame.utils.js.map +1 -1
- package/dist/git/utils/branch.utils.d.ts.map +1 -1
- package/dist/git/utils/branch.utils.js +12 -1
- package/dist/git/utils/branch.utils.js.map +1 -1
- package/dist/git/utils/commit.utils.d.ts.map +1 -1
- package/dist/git/utils/commit.utils.js.map +1 -1
- package/dist/git/utils/conflictResolution.utils.d.ts.map +1 -1
- package/dist/git/utils/conflictResolution.utils.js.map +1 -1
- package/dist/git/utils/contributor.utils.d.ts +1 -1
- package/dist/git/utils/contributor.utils.d.ts.map +1 -1
- package/dist/git/utils/contributor.utils.js +1 -2
- package/dist/git/utils/contributor.utils.js.map +1 -1
- package/dist/git/utils/fetch.utils.d.ts.map +1 -1
- package/dist/git/utils/fetch.utils.js.map +1 -1
- package/dist/git/utils/fileStatus.utils.d.ts +7 -0
- package/dist/git/utils/fileStatus.utils.d.ts.map +1 -1
- package/dist/git/utils/fileStatus.utils.js +6 -0
- package/dist/git/utils/fileStatus.utils.js.map +1 -1
- package/dist/git/utils/graph.utils.d.ts +20 -0
- package/dist/git/utils/graph.utils.d.ts.map +1 -0
- package/dist/git/utils/graph.utils.js +40 -0
- package/dist/git/utils/graph.utils.js.map +1 -0
- package/dist/git/utils/issue.utils.d.ts.map +1 -1
- package/dist/git/utils/issue.utils.js +1 -0
- package/dist/git/utils/issue.utils.js.map +1 -1
- package/dist/git/utils/issueOrPullRequest.utils.d.ts.map +1 -1
- package/dist/git/utils/issueOrPullRequest.utils.js.map +1 -1
- package/dist/git/utils/mergeConflicts.utils.d.ts.map +1 -1
- package/dist/git/utils/mergeConflicts.utils.js.map +1 -1
- package/dist/git/utils/pausedOperationStatus.utils.d.ts +13 -13
- package/dist/git/utils/pausedOperationStatus.utils.d.ts.map +1 -1
- package/dist/git/utils/pausedOperationStatus.utils.js.map +1 -1
- package/dist/git/utils/pullRequest.utils.d.ts.map +1 -1
- package/dist/git/utils/pullRequest.utils.js +9 -0
- package/dist/git/utils/pullRequest.utils.js.map +1 -1
- package/dist/git/utils/reachability.utils.d.ts +20 -2
- package/dist/git/utils/reachability.utils.d.ts.map +1 -1
- package/dist/git/utils/reachability.utils.js +68 -7
- package/dist/git/utils/reachability.utils.js.map +1 -1
- package/dist/git/utils/rebase.utils.d.ts.map +1 -1
- package/dist/git/utils/rebase.utils.js.map +1 -1
- package/dist/git/utils/reference.utils.d.ts.map +1 -1
- package/dist/git/utils/reference.utils.js.map +1 -1
- package/dist/git/utils/remote.utils.d.ts.map +1 -1
- package/dist/git/utils/remote.utils.js.map +1 -1
- package/dist/git/utils/repository.utils.d.ts.map +1 -1
- package/dist/git/utils/repository.utils.js.map +1 -1
- package/dist/git/utils/resourceDescriptor.utils.d.ts.map +1 -1
- package/dist/git/utils/resourceDescriptor.utils.js.map +1 -1
- package/dist/git/utils/revision.utils.d.ts.map +1 -1
- package/dist/git/utils/revision.utils.js.map +1 -1
- package/dist/git/utils/search.utils.d.ts.map +1 -1
- package/dist/git/utils/search.utils.js.map +1 -1
- package/dist/git/utils/sorting.d.ts.map +1 -1
- package/dist/git/utils/sorting.js.map +1 -1
- package/dist/git/utils/sshKey.utils.d.ts +7 -0
- package/dist/git/utils/sshKey.utils.d.ts.map +1 -0
- package/dist/git/utils/sshKey.utils.js +25 -0
- package/dist/git/utils/sshKey.utils.js.map +1 -0
- package/dist/git/utils/status.utils.d.ts.map +1 -1
- package/dist/git/utils/status.utils.js.map +1 -1
- package/dist/git/utils/statusFile.utils.d.ts.map +1 -1
- package/dist/git/utils/statusFile.utils.js.map +1 -1
- package/dist/git/utils/tag.utils.d.ts.map +1 -1
- package/dist/git/utils/tag.utils.js.map +1 -1
- package/dist/git/utils/tooltip.utils.d.ts.map +1 -1
- package/dist/git/utils/tooltip.utils.js.map +1 -1
- package/dist/git/utils/uriAuthority.d.ts.map +1 -1
- package/dist/git/utils/uriAuthority.js.map +1 -1
- package/dist/git/utils/user.utils.d.ts.map +1 -1
- package/dist/git/utils/user.utils.js.map +1 -1
- package/dist/git/utils/worktree.utils.d.ts.map +1 -1
- package/dist/git/utils/worktree.utils.js.map +1 -1
- package/dist/git/watching/changeEvent.d.ts.map +1 -1
- package/dist/git/watching/changeEvent.js.map +1 -1
- package/dist/git/watching/classifyChange.d.ts.map +1 -1
- package/dist/git/watching/classifyChange.js.map +1 -1
- package/dist/git/watching/gitIgnoreFilter.d.ts.map +1 -1
- package/dist/git/watching/gitIgnoreFilter.js.map +1 -1
- package/dist/git/watching/initWatcher.d.ts.map +1 -1
- package/dist/git/watching/initWatcher.js.map +1 -1
- package/dist/git/watching/provider.d.ts.map +1 -1
- package/dist/git/watching/provider.js.map +1 -1
- package/dist/git/watching/watchGroup.d.ts.map +1 -1
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.d.ts +4 -0
- package/dist/git/watching/watchService.d.ts.map +1 -1
- package/dist/git/watching/watchService.js +15 -1
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +7 -0
- package/dist/git/watching/watchSession.d.ts.map +1 -1
- package/dist/git/watching/watchSession.js +14 -2
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git/watching/watcherPatterns.d.ts.map +1 -1
- package/dist/git/watching/watcherPatterns.js.map +1 -1
- package/dist/git-cli/cliGitProvider.d.ts.map +1 -1
- package/dist/git-cli/exec/exec.d.ts.map +1 -1
- package/dist/git-cli/exec/exec.errors.d.ts.map +1 -1
- package/dist/git-cli/exec/exec.errors.js.map +1 -1
- package/dist/git-cli/exec/exec.js.map +1 -1
- package/dist/git-cli/exec/exec.types.d.ts.map +1 -1
- package/dist/git-cli/exec/exec.types.js.map +1 -1
- package/dist/git-cli/exec/features.d.ts.map +1 -1
- package/dist/git-cli/exec/features.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +19 -27
- package/dist/git-cli/exec/git.d.ts.map +1 -1
- package/dist/git-cli/exec/git.js +126 -34
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/gitQueue.d.ts.map +1 -1
- package/dist/git-cli/exec/gitQueue.js.map +1 -1
- package/dist/git-cli/exec/locator.d.ts.map +1 -1
- package/dist/git-cli/exec/locator.js.map +1 -1
- package/dist/git-cli/parsers/blameParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/blameParser.js.map +1 -1
- package/dist/git-cli/parsers/indexParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/indexParser.js.map +1 -1
- package/dist/git-cli/parsers/logParser.d.ts +9 -1
- package/dist/git-cli/parsers/logParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/logParser.js +141 -60
- package/dist/git-cli/parsers/logParser.js.map +1 -1
- package/dist/git-cli/parsers/mergeTreeParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/mergeTreeParser.js.map +1 -1
- package/dist/git-cli/parsers/refParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/refParser.js.map +1 -1
- package/dist/git-cli/parsers/reflogParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/reflogParser.js.map +1 -1
- package/dist/git-cli/parsers/remoteParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/remoteParser.js.map +1 -1
- package/dist/git-cli/parsers/shortlogParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/shortlogParser.js.map +1 -1
- package/dist/git-cli/parsers/signatureParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/signatureParser.js.map +1 -1
- package/dist/git-cli/parsers/sshSignatureParser.d.ts +21 -0
- package/dist/git-cli/parsers/sshSignatureParser.d.ts.map +1 -0
- package/dist/git-cli/parsers/sshSignatureParser.js +78 -0
- package/dist/git-cli/parsers/sshSignatureParser.js.map +1 -0
- package/dist/git-cli/parsers/statusParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/statusParser.js.map +1 -1
- package/dist/git-cli/parsers/treeParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/treeParser.js.map +1 -1
- package/dist/git-cli/parsers/worktreeParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/worktreeParser.js +5 -7
- package/dist/git-cli/parsers/worktreeParser.js.map +1 -1
- package/dist/git-cli/providers/blame.d.ts.map +1 -1
- package/dist/git-cli/providers/blame.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +1 -0
- package/dist/git-cli/providers/branches.d.ts.map +1 -1
- package/dist/git-cli/providers/branches.js +51 -32
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commitFilesetUtils.d.ts.map +1 -1
- package/dist/git-cli/providers/commitFilesetUtils.js.map +1 -1
- package/dist/git-cli/providers/commits.d.ts +12 -1
- package/dist/git-cli/providers/commits.d.ts.map +1 -1
- package/dist/git-cli/providers/commits.js +89 -8
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts.map +1 -1
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/contributors.d.ts.map +1 -1
- package/dist/git-cli/providers/contributors.js.map +1 -1
- package/dist/git-cli/providers/diff.d.ts.map +1 -1
- package/dist/git-cli/providers/diff.js.map +1 -1
- package/dist/git-cli/providers/graph.d.ts +35 -1
- package/dist/git-cli/providers/graph.d.ts.map +1 -1
- package/dist/git-cli/providers/graph.js +1434 -330
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts.map +1 -1
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/patch.d.ts.map +1 -1
- package/dist/git-cli/providers/patch.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git-cli/providers/pausedOperations.js +3 -3
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/refs.d.ts.map +1 -1
- package/dist/git-cli/providers/refs.js.map +1 -1
- package/dist/git-cli/providers/remotes.d.ts.map +1 -1
- package/dist/git-cli/providers/remotes.js.map +1 -1
- package/dist/git-cli/providers/revision.d.ts +1 -0
- package/dist/git-cli/providers/revision.d.ts.map +1 -1
- package/dist/git-cli/providers/revision.js +33 -0
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/git-cli/providers/staging.d.ts.map +1 -1
- package/dist/git-cli/providers/staging.js.map +1 -1
- package/dist/git-cli/providers/stash.d.ts.map +1 -1
- package/dist/git-cli/providers/stash.js.map +1 -1
- package/dist/git-cli/providers/status.d.ts +28 -0
- package/dist/git-cli/providers/status.d.ts.map +1 -1
- package/dist/git-cli/providers/status.js +240 -154
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/git-cli/providers/tags.d.ts.map +1 -1
- package/dist/git-cli/providers/tags.js +2 -1
- package/dist/git-cli/providers/tags.js.map +1 -1
- package/dist/git-cli/providers/worktrees.d.ts +2 -1
- package/dist/git-cli/providers/worktrees.d.ts.map +1 -1
- package/dist/git-cli/providers/worktrees.js +28 -3
- package/dist/git-cli/providers/worktrees.js.map +1 -1
- package/dist/git-cli/service.d.ts.map +1 -1
- package/dist/git-cli/service.js +8 -0
- package/dist/git-cli/service.js.map +1 -1
- package/dist/ipc/ipcServer.d.ts.map +1 -1
- package/dist/ipc/ipcServer.js +1 -1
- package/dist/ipc/ipcServer.js.map +1 -1
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts +6 -1
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +1 -1
- package/dist/plus/agents/providers/claudeCodeProvider.js +19 -0
- package/dist/plus/agents/providers/claudeCodeProvider.js.map +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts +68 -0
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts.map +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +262 -8
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/agents/types.d.ts +36 -2
- package/dist/plus/agents/types.d.ts.map +1 -1
- package/dist/plus/ai/constants.d.ts +1 -2
- package/dist/plus/ai/constants.d.ts.map +1 -1
- package/dist/plus/ai/constants.js +1 -8
- package/dist/plus/ai/constants.js.map +1 -1
- package/dist/plus/ai/errors.d.ts.map +1 -1
- package/dist/plus/ai/errors.js.map +1 -1
- package/dist/plus/ai/models/conversation.d.ts.map +1 -1
- package/dist/plus/ai/models/conversation.js.map +1 -1
- package/dist/plus/ai/models/model.d.ts +2 -1
- package/dist/plus/ai/models/model.d.ts.map +1 -1
- package/dist/plus/ai/models/model.js +50 -1
- package/dist/plus/ai/models/model.js.map +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts +5 -2
- package/dist/plus/ai/models/promptTemplates.d.ts.map +1 -1
- package/dist/plus/ai/models/promptTemplates.js.map +1 -1
- package/dist/plus/ai/models/provider.d.ts.map +1 -1
- package/dist/plus/ai/models/provider.js.map +1 -1
- package/dist/plus/ai/models/results.d.ts.map +1 -1
- package/dist/plus/ai/models/results.js.map +1 -1
- package/dist/plus/ai/prompts.d.ts +1 -1
- package/dist/plus/ai/prompts.d.ts.map +1 -1
- package/dist/plus/ai/prompts.js +15 -47
- package/dist/plus/ai/prompts.js.map +1 -1
- package/dist/plus/ai/providers/anthropicProvider.d.ts +5 -0
- package/dist/plus/ai/providers/anthropicProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/anthropicProvider.js +40 -3
- package/dist/plus/ai/providers/anthropicProvider.js.map +1 -1
- package/dist/plus/ai/providers/azureProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/azureProvider.js.map +1 -1
- package/dist/plus/ai/providers/context.d.ts.map +1 -1
- package/dist/plus/ai/providers/context.js.map +1 -1
- package/dist/plus/ai/providers/deepSeekProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/deepSeekProvider.js +17 -1
- package/dist/plus/ai/providers/deepSeekProvider.js.map +1 -1
- package/dist/plus/ai/providers/geminiProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/geminiProvider.js +25 -6
- package/dist/plus/ai/providers/geminiProvider.js.map +1 -1
- package/dist/plus/ai/providers/gitkrakenProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/gitkrakenProvider.js +1 -0
- package/dist/plus/ai/providers/gitkrakenProvider.js.map +1 -1
- package/dist/plus/ai/providers/huggingFaceProvider.d.ts +1 -1
- package/dist/plus/ai/providers/huggingFaceProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/huggingFaceProvider.js +21 -18
- package/dist/plus/ai/providers/huggingFaceProvider.js.map +1 -1
- package/dist/plus/ai/providers/mistralProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/mistralProvider.js.map +1 -1
- package/dist/plus/ai/providers/ollamaProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/ollamaProvider.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProvider.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts +10 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +9 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js.map +1 -1
- package/dist/plus/ai/providers/openRouterProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/openRouterProvider.js.map +1 -1
- package/dist/plus/ai/providers/openaiProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/openaiProvider.js.map +1 -1
- package/dist/plus/ai/providers/xaiProvider.d.ts.map +1 -1
- package/dist/plus/ai/providers/xaiProvider.js +14 -1
- package/dist/plus/ai/providers/xaiProvider.js.map +1 -1
- package/dist/plus/ai/utils/ai.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/ai.utils.js +0 -2
- package/dist/plus/ai/utils/ai.utils.js.map +1 -1
- package/dist/plus/ai/utils/results.utils.d.ts +3 -0
- package/dist/plus/ai/utils/results.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/results.utils.js +26 -0
- package/dist/plus/ai/utils/results.utils.js.map +1 -1
- package/dist/plus/ai/utils/truncation.utils.d.ts +1 -1
- package/dist/plus/ai/utils/truncation.utils.d.ts.map +1 -1
- package/dist/plus/ai/utils/truncation.utils.js.map +1 -1
- package/dist/plus/git-github/api/config.d.ts.map +1 -1
- package/dist/plus/git-github/api/config.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +66 -3
- package/dist/plus/git-github/api/github.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.js +345 -74
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/github.utils.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.utils.js.map +1 -1
- package/dist/plus/git-github/api/token.d.ts.map +1 -1
- package/dist/plus/git-github/api/token.js.map +1 -1
- package/dist/plus/git-github/api/tokenUtils.d.ts.map +1 -1
- package/dist/plus/git-github/api/tokenUtils.js.map +1 -1
- package/dist/plus/git-github/api/types.d.ts.map +1 -1
- package/dist/plus/git-github/api/types.js.map +1 -1
- package/dist/plus/git-github/context.d.ts.map +1 -1
- package/dist/plus/git-github/models.d.ts +5 -0
- package/dist/plus/git-github/models.d.ts.map +1 -1
- package/dist/plus/git-github/models.js +27 -2
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/git-github/providers/github/blame.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/blame.js.map +1 -1
- package/dist/plus/git-github/providers/github/branches.d.ts +2 -1
- package/dist/plus/git-github/providers/github/branches.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/branches.js +7 -3
- package/dist/plus/git-github/providers/github/branches.js.map +1 -1
- package/dist/plus/git-github/providers/github/commits.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/commits.js.map +1 -1
- package/dist/plus/git-github/providers/github/config.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/config.js.map +1 -1
- package/dist/plus/git-github/providers/github/contributors.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/contributors.js.map +1 -1
- package/dist/plus/git-github/providers/github/diff.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/diff.js +2 -2
- package/dist/plus/git-github/providers/github/diff.js.map +1 -1
- package/dist/plus/git-github/providers/github/graph.d.ts +12 -1
- package/dist/plus/git-github/providers/github/graph.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/graph.js +85 -0
- package/dist/plus/git-github/providers/github/graph.js.map +1 -1
- package/dist/plus/git-github/providers/github/refs.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/refs.js.map +1 -1
- package/dist/plus/git-github/providers/github/remotes.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/remotes.js.map +1 -1
- package/dist/plus/git-github/providers/github/revision.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/revision.js.map +1 -1
- package/dist/plus/git-github/providers/github/status.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/status.js.map +1 -1
- package/dist/plus/git-github/providers/github/tags.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/tags.js +3 -1
- package/dist/plus/git-github/providers/github/tags.js.map +1 -1
- package/dist/plus/git-github/providers/githubGitProvider.d.ts.map +1 -1
- package/dist/plus/git-github/providers/githubGitProvider.js.map +1 -1
- package/dist/plus/git-github/providers/githubProvider.d.ts.map +1 -1
- package/dist/plus/git-github/providers/githubProvider.js.map +1 -1
- package/dist/plus/integrations/authentication/cloudIntegrationService.d.ts +20 -1
- package/dist/plus/integrations/authentication/cloudIntegrationService.d.ts.map +1 -1
- package/dist/plus/integrations/authentication/cloudIntegrationService.js +134 -10
- package/dist/plus/integrations/authentication/cloudIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +52 -5
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts.map +1 -1
- package/dist/plus/integrations/authentication/configuredIntegrationService.js +248 -46
- package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +24 -4
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +58 -26
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js +7 -3
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
- package/dist/plus/integrations/authentication/manualTokenProvider.d.ts +1 -0
- package/dist/plus/integrations/authentication/manualTokenProvider.d.ts.map +1 -1
- package/dist/plus/integrations/authentication/manualTokenProvider.js +9 -5
- package/dist/plus/integrations/authentication/manualTokenProvider.js.map +1 -1
- package/dist/plus/integrations/authentication/models.d.ts +33 -0
- package/dist/plus/integrations/authentication/models.d.ts.map +1 -1
- package/dist/plus/integrations/authentication/models.js.map +1 -1
- package/dist/plus/integrations/collectionMetadata.d.ts +21 -0
- package/dist/plus/integrations/collectionMetadata.d.ts.map +1 -0
- package/dist/plus/integrations/collectionMetadata.js +121 -0
- package/dist/plus/integrations/collectionMetadata.js.map +1 -0
- package/dist/plus/integrations/constants.d.ts +12 -2
- package/dist/plus/integrations/constants.d.ts.map +1 -1
- package/dist/plus/integrations/constants.js +10 -0
- package/dist/plus/integrations/constants.js.map +1 -1
- package/dist/plus/integrations/context.d.ts +10 -6
- package/dist/plus/integrations/context.d.ts.map +1 -1
- package/dist/plus/integrations/errors.d.ts +65 -0
- package/dist/plus/integrations/errors.d.ts.map +1 -1
- package/dist/plus/integrations/errors.js +131 -0
- package/dist/plus/integrations/errors.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +57 -12
- package/dist/plus/integrations/index.d.ts.map +1 -1
- package/dist/plus/integrations/index.js +39 -37
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +293 -12
- package/dist/plus/integrations/integrationService.d.ts.map +1 -1
- package/dist/plus/integrations/integrationService.js +1305 -37
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/lite.d.ts +47 -0
- package/dist/plus/integrations/lite.d.ts.map +1 -0
- package/dist/plus/integrations/lite.js +141 -0
- package/dist/plus/integrations/lite.js.map +1 -0
- package/dist/plus/integrations/manager.d.ts +332 -0
- package/dist/plus/integrations/manager.d.ts.map +1 -0
- package/dist/plus/integrations/manager.js +2 -0
- package/dist/plus/integrations/manager.js.map +1 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +269 -10
- package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +712 -88
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +88 -3
- package/dist/plus/integrations/models/integration.d.ts.map +1 -1
- package/dist/plus/integrations/models/integration.js +192 -21
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issuesIntegration.d.ts +87 -7
- package/dist/plus/integrations/models/issuesIntegration.d.ts.map +1 -1
- package/dist/plus/integrations/models/issuesIntegration.js +148 -33
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
- package/dist/plus/integrations/providerFilters.d.ts +12 -0
- package/dist/plus/integrations/providerFilters.d.ts.map +1 -0
- package/dist/plus/integrations/providerFilters.js +14 -0
- package/dist/plus/integrations/providerFilters.js.map +1 -0
- package/dist/plus/integrations/providers/apiClients.d.ts.map +1 -1
- package/dist/plus/integrations/providers/apiClients.js +3 -3
- package/dist/plus/integrations/providers/apiClients.js.map +1 -1
- package/dist/plus/integrations/providers/apiConfig.d.ts +52 -0
- package/dist/plus/integrations/providers/apiConfig.d.ts.map +1 -0
- package/dist/plus/integrations/providers/apiConfig.js +19 -0
- package/dist/plus/integrations/providers/apiConfig.js.map +1 -0
- package/dist/plus/integrations/providers/azure/azure.d.ts +14 -2
- package/dist/plus/integrations/providers/azure/azure.d.ts.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.js +107 -32
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts +16 -0
- package/dist/plus/integrations/providers/azure/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/azure/models.js +6 -6
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +55 -9
- package/dist/plus/integrations/providers/azureDevOps.d.ts.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.js +572 -79
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +13 -2
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js +108 -32
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.d.ts +19 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.js +20 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.d.ts +28 -4
- package/dist/plus/integrations/providers/bitbucket-server.d.ts.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.js +110 -6
- package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket.d.ts +38 -4
- package/dist/plus/integrations/providers/bitbucket.d.ts.map +1 -1
- package/dist/plus/integrations/providers/bitbucket.js +330 -34
- package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/github/github.d.ts.map +1 -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/github.utils.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github/github.utils.js.map +1 -1
- package/dist/plus/integrations/providers/github/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github/models.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +49 -6
- package/dist/plus/integrations/providers/github.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github.js +289 -4
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +11 -3
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.js +121 -47
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts +6 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.js +8 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/models.d.ts +10 -0
- package/dist/plus/integrations/providers/gitlab/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/gitlab/models.js +8 -5
- package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.d.ts +50 -5
- package/dist/plus/integrations/providers/gitlab.d.ts.map +1 -1
- package/dist/plus/integrations/providers/gitlab.js +274 -8
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/jira.d.ts +13 -2
- package/dist/plus/integrations/providers/jira.d.ts.map +1 -1
- package/dist/plus/integrations/providers/jira.js +200 -30
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/linear.d.ts +16 -5
- package/dist/plus/integrations/providers/linear.d.ts.map +1 -1
- package/dist/plus/integrations/providers/linear.js +127 -21
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +339 -60
- package/dist/plus/integrations/providers/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/models.js +307 -59
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +144 -11
- package/dist/plus/integrations/providers/providersApi.d.ts.map +1 -1
- package/dist/plus/integrations/providers/providersApi.js +486 -55
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/trello.d.ts +47 -0
- package/dist/plus/integrations/providers/trello.d.ts.map +1 -0
- package/dist/plus/integrations/providers/trello.js +141 -0
- package/dist/plus/integrations/providers/trello.js.map +1 -0
- package/dist/plus/integrations/providers/utils/providerPaging.d.ts +29 -0
- package/dist/plus/integrations/providers/utils/providerPaging.d.ts.map +1 -0
- package/dist/plus/integrations/providers/utils/providerPaging.js +154 -0
- package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -0
- package/dist/plus/integrations/providers/utils.d.ts +21 -0
- package/dist/plus/integrations/providers/utils.d.ts.map +1 -1
- package/dist/plus/integrations/providers/utils.js +57 -6
- package/dist/plus/integrations/providers/utils.js.map +1 -1
- package/dist/plus/integrations/reads/context.d.ts +52 -0
- package/dist/plus/integrations/reads/context.d.ts.map +1 -0
- package/dist/plus/integrations/reads/context.js +2 -0
- package/dist/plus/integrations/reads/context.js.map +1 -0
- package/dist/plus/integrations/reads/cursors.d.ts +66 -0
- package/dist/plus/integrations/reads/cursors.d.ts.map +1 -0
- package/dist/plus/integrations/reads/cursors.js +133 -0
- package/dist/plus/integrations/reads/cursors.js.map +1 -0
- package/dist/plus/integrations/reads/drains.d.ts +60 -0
- package/dist/plus/integrations/reads/drains.d.ts.map +1 -0
- package/dist/plus/integrations/reads/drains.js +255 -0
- package/dist/plus/integrations/reads/drains.js.map +1 -0
- package/dist/plus/integrations/reads/filters.d.ts +81 -0
- package/dist/plus/integrations/reads/filters.d.ts.map +1 -0
- package/dist/plus/integrations/reads/filters.js +87 -0
- package/dist/plus/integrations/reads/filters.js.map +1 -0
- package/dist/plus/integrations/reads/hierarchy.d.ts +17 -0
- package/dist/plus/integrations/reads/hierarchy.d.ts.map +1 -0
- package/dist/plus/integrations/reads/hierarchy.js +348 -0
- package/dist/plus/integrations/reads/hierarchy.js.map +1 -0
- package/dist/plus/integrations/reads/hierarchy.utils.d.ts +53 -0
- package/dist/plus/integrations/reads/hierarchy.utils.d.ts.map +1 -0
- package/dist/plus/integrations/reads/hierarchy.utils.js +85 -0
- package/dist/plus/integrations/reads/hierarchy.utils.js.map +1 -0
- package/dist/plus/integrations/reads/issueTracker.d.ts +19 -0
- package/dist/plus/integrations/reads/issueTracker.d.ts.map +1 -0
- package/dist/plus/integrations/reads/issueTracker.js +346 -0
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -0
- package/dist/plus/integrations/reads/issues.d.ts +34 -0
- package/dist/plus/integrations/reads/issues.d.ts.map +1 -0
- package/dist/plus/integrations/reads/issues.js +244 -0
- package/dist/plus/integrations/reads/issues.js.map +1 -0
- package/dist/plus/integrations/reads/paging.d.ts +136 -0
- package/dist/plus/integrations/reads/paging.d.ts.map +1 -0
- package/dist/plus/integrations/reads/paging.js +221 -0
- package/dist/plus/integrations/reads/paging.js.map +1 -0
- package/dist/plus/integrations/reads/pullRequests.d.ts +32 -0
- package/dist/plus/integrations/reads/pullRequests.d.ts.map +1 -0
- package/dist/plus/integrations/reads/pullRequests.js +151 -0
- package/dist/plus/integrations/reads/pullRequests.js.map +1 -0
- package/dist/plus/integrations/reads/warnings.d.ts +47 -0
- package/dist/plus/integrations/reads/warnings.d.ts.map +1 -0
- package/dist/plus/integrations/reads/warnings.js +81 -0
- package/dist/plus/integrations/reads/warnings.js.map +1 -0
- package/dist/plus/integrations/results.d.ts +189 -0
- package/dist/plus/integrations/results.d.ts.map +1 -0
- package/dist/plus/integrations/results.js +62 -0
- package/dist/plus/integrations/results.js.map +1 -0
- package/dist/plus/integrations/utils/domain.utils.d.ts +5 -0
- package/dist/plus/integrations/utils/domain.utils.d.ts.map +1 -0
- package/dist/plus/integrations/utils/domain.utils.js +27 -0
- package/dist/plus/integrations/utils/domain.utils.js.map +1 -0
- package/dist/plus/integrations/utils/integration.utils.d.ts +27 -1
- package/dist/plus/integrations/utils/integration.utils.d.ts.map +1 -1
- package/dist/plus/integrations/utils/integration.utils.js +86 -15
- package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
- package/dist/utils/array.d.ts.map +1 -1
- package/dist/utils/array.js.map +1 -1
- package/dist/utils/brand.d.ts.map +1 -1
- package/dist/utils/cancellation.d.ts +13 -0
- package/dist/utils/cancellation.d.ts.map +1 -1
- package/dist/utils/cancellation.js +52 -7
- package/dist/utils/cancellation.js.map +1 -1
- package/dist/utils/charCode.d.ts.map +1 -1
- package/dist/utils/coalescedRun.d.ts +16 -0
- package/dist/utils/coalescedRun.d.ts.map +1 -0
- package/dist/utils/coalescedRun.js +43 -0
- package/dist/utils/coalescedRun.js.map +1 -0
- package/dist/utils/color.d.ts.map +1 -1
- package/dist/utils/color.js +3 -3
- package/dist/utils/color.js.map +1 -1
- package/dist/utils/date.d.ts +24 -0
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +62 -0
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/debounce.js +1 -1
- package/dist/utils/debounce.js.map +1 -1
- package/dist/utils/decorators/debounce.d.ts.map +1 -1
- package/dist/utils/decorators/debounce.js.map +1 -1
- package/dist/utils/decorators/gate.d.ts.map +1 -1
- package/dist/utils/decorators/gate.js +2 -2
- package/dist/utils/decorators/gate.js.map +1 -1
- package/dist/utils/decorators/log.d.ts.map +1 -1
- package/dist/utils/decorators/log.js +5 -5
- package/dist/utils/decorators/log.js.map +1 -1
- package/dist/utils/decorators/memoize.d.ts.map +1 -1
- package/dist/utils/decorators/memoize.js +2 -2
- package/dist/utils/decorators/memoize.js.map +1 -1
- package/dist/utils/decorators/resolver.d.ts.map +1 -1
- package/dist/utils/decorators/resolver.js.map +1 -1
- package/dist/utils/decorators/sequentialize.d.ts.map +1 -1
- package/dist/utils/decorators/sequentialize.js +2 -2
- package/dist/utils/decorators/sequentialize.js.map +1 -1
- package/dist/utils/decorators/serializable.d.ts.map +1 -1
- package/dist/utils/decorators/serializable.js +1 -1
- package/dist/utils/decorators/serializable.js.map +1 -1
- package/dist/utils/dedupedAsyncCache.d.ts.map +1 -1
- package/dist/utils/env/browser/base64.d.ts.map +1 -1
- package/dist/utils/env/browser/base64.js.map +1 -1
- package/dist/utils/env/browser/crypto.d.ts.map +1 -1
- package/dist/utils/env/browser/crypto.js.map +1 -1
- package/dist/utils/env/browser/fs.d.ts.map +1 -1
- package/dist/utils/env/browser/fs.js.map +1 -1
- package/dist/utils/env/browser/hex.d.ts.map +1 -1
- package/dist/utils/env/browser/hex.js.map +1 -1
- package/dist/utils/env/browser/hrtime.d.ts.map +1 -1
- package/dist/utils/env/browser/hrtime.js.map +1 -1
- package/dist/utils/env/browser/logScope.d.ts.map +1 -1
- package/dist/utils/env/browser/logScope.js.map +1 -1
- package/dist/utils/env/browser/md5.d.ts.map +1 -1
- package/dist/utils/env/browser/md5.js.map +1 -1
- package/dist/utils/env/browser/platform.d.ts.map +1 -1
- package/dist/utils/env/browser/platform.js.map +1 -1
- package/dist/utils/env/node/base64.d.ts.map +1 -1
- package/dist/utils/env/node/base64.js.map +1 -1
- package/dist/utils/env/node/crypto.d.ts.map +1 -1
- package/dist/utils/env/node/crypto.js.map +1 -1
- package/dist/utils/env/node/exec.d.ts +9 -1
- package/dist/utils/env/node/exec.d.ts.map +1 -1
- package/dist/utils/env/node/exec.js +11 -4
- package/dist/utils/env/node/exec.js.map +1 -1
- package/dist/utils/env/node/fs.d.ts.map +1 -1
- package/dist/utils/env/node/fs.js.map +1 -1
- package/dist/utils/env/node/hex.d.ts.map +1 -1
- package/dist/utils/env/node/hex.js.map +1 -1
- package/dist/utils/env/node/hrtime.d.ts.map +1 -1
- package/dist/utils/env/node/hrtime.js.map +1 -1
- package/dist/utils/env/node/logScope.d.ts.map +1 -1
- package/dist/utils/env/node/logScope.js.map +1 -1
- package/dist/utils/env/node/platform.d.ts.map +1 -1
- package/dist/utils/env/node/platform.js.map +1 -1
- package/dist/utils/event.d.ts.map +1 -1
- package/dist/utils/event.js +18 -22
- package/dist/utils/event.js.map +1 -1
- package/dist/utils/formatter.d.ts.map +1 -1
- package/dist/utils/formatter.js.map +1 -1
- package/dist/utils/function.d.ts.map +1 -1
- package/dist/utils/function.js +3 -3
- package/dist/utils/function.js.map +1 -1
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/iterable.d.ts.map +1 -1
- package/dist/utils/iterable.js +2 -6
- package/dist/utils/iterable.js.map +1 -1
- package/dist/utils/lazy.d.ts.map +1 -1
- package/dist/utils/lazy.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/logger.scoped.js +1 -1
- package/dist/utils/logger.scoped.js.map +1 -1
- package/dist/utils/lruMap.d.ts.map +1 -1
- package/dist/utils/lruMap.js.map +1 -1
- package/dist/utils/mru.d.ts.map +1 -1
- package/dist/utils/mru.js.map +1 -1
- package/dist/utils/object.js.map +1 -1
- package/dist/utils/paging.d.ts +29 -0
- package/dist/utils/paging.d.ts.map +1 -1
- package/dist/utils/paging.js +18 -0
- package/dist/utils/paging.js.map +1 -1
- package/dist/utils/path.js.map +1 -1
- package/dist/utils/promise.d.ts +10 -0
- package/dist/utils/promise.d.ts.map +1 -1
- package/dist/utils/promise.js +26 -3
- package/dist/utils/promise.js.map +1 -1
- package/dist/utils/promiseCache.d.ts +12 -2
- package/dist/utils/promiseCache.d.ts.map +1 -1
- package/dist/utils/promiseCache.js +80 -50
- package/dist/utils/promiseCache.js.map +1 -1
- package/dist/utils/searchTree.d.ts.map +1 -1
- package/dist/utils/searchTree.js +4 -1
- package/dist/utils/searchTree.js.map +1 -1
- package/dist/utils/stopwatch.d.ts.map +1 -1
- package/dist/utils/string.js +1 -1
- package/dist/utils/string.js.map +1 -1
- package/dist/utils/subscriptionManager.d.ts.map +1 -1
- package/dist/utils/subscriptionManager.js.map +1 -1
- package/dist/utils/trie.d.ts.map +1 -1
- package/dist/utils/trie.js +1 -0
- package/dist/utils/trie.js.map +1 -1
- package/docs/integrations.md +372 -0
- package/docs/kepler-read-api-parity.md +112 -0
- package/package.json +238 -213
- package/src/git/cache.ts +75 -8
- package/src/git/errors.ts +36 -1
- package/src/git/models/commit.ts +1 -1
- package/src/git/models/graph.ts +147 -0
- package/src/git/models/graphSession.ts +205 -0
- package/src/git/models/issue.ts +12 -1
- package/src/git/models/pullRequest.ts +27 -1
- package/src/git/models/repository.ts +24 -1
- package/src/git/models/resourceDescriptor.ts +17 -0
- package/src/git/models/signature.ts +16 -0
- package/src/git/models/tag.ts +6 -1
- package/src/git/parsers/diffParser.ts +1 -1
- package/src/git/providers/branches.ts +6 -1
- package/src/git/providers/commits.ts +6 -1
- package/src/git/providers/config.ts +5 -1
- package/src/git/providers/graph.ts +69 -2
- package/src/git/providers/status.ts +1 -1
- package/src/git/providers/worktrees.ts +3 -1
- package/src/git/remotes/azure-devops.ts +29 -33
- package/src/git/remotes/bitbucket-server.ts +23 -25
- package/src/git/remotes/bitbucket.ts +23 -25
- package/src/git/remotes/gerrit.ts +12 -14
- package/src/git/remotes/gitea.ts +13 -15
- package/src/git/remotes/github.ts +56 -58
- package/src/git/remotes/gitlab.ts +102 -104
- package/src/git/run.types.ts +54 -4
- package/src/git/utils/branch.utils.ts +12 -1
- package/src/git/utils/contributor.utils.ts +1 -1
- package/src/git/utils/fileStatus.utils.ts +7 -0
- package/src/git/utils/graph.utils.ts +46 -0
- package/src/git/utils/issue.utils.ts +1 -0
- package/src/git/utils/pullRequest.utils.ts +9 -0
- package/src/git/utils/reachability.utils.ts +79 -8
- package/src/git/utils/sshKey.utils.ts +30 -0
- package/src/git/watching/watchService.ts +16 -1
- package/src/git/watching/watchSession.ts +20 -2
- package/src/git-cli/exec/git.ts +144 -42
- package/src/git-cli/parsers/logParser.ts +83 -1
- package/src/git-cli/parsers/sshSignatureParser.ts +85 -0
- package/src/git-cli/parsers/worktreeParser.ts +5 -7
- package/src/git-cli/providers/branches.ts +60 -38
- package/src/git-cli/providers/commits.ts +102 -9
- package/src/git-cli/providers/graph.ts +1771 -393
- package/src/git-cli/providers/pausedOperations.ts +3 -3
- package/src/git-cli/providers/revision.ts +42 -0
- package/src/git-cli/providers/status.ts +333 -178
- package/src/git-cli/providers/tags.ts +2 -0
- package/src/git-cli/providers/worktrees.ts +40 -4
- package/src/git-cli/service.ts +9 -0
- package/src/ipc/ipcServer.ts +1 -1
- package/src/plus/agents/providers/claudeCodeProvider.ts +25 -0
- package/src/plus/agents/providers/claudeCodeTranscript.ts +320 -8
- package/src/plus/agents/types.ts +34 -0
- package/src/plus/ai/constants.ts +1 -9
- package/src/plus/ai/models/model.ts +53 -2
- package/src/plus/ai/models/promptTemplates.ts +9 -2
- package/src/plus/ai/prompts.ts +16 -48
- package/src/plus/ai/providers/anthropicProvider.ts +45 -3
- package/src/plus/ai/providers/deepSeekProvider.ts +17 -1
- package/src/plus/ai/providers/geminiProvider.ts +25 -6
- package/src/plus/ai/providers/gitkrakenProvider.ts +2 -0
- package/src/plus/ai/providers/huggingFaceProvider.ts +28 -21
- package/src/plus/ai/providers/openAICompatibleProviderBase.ts +16 -1
- package/src/plus/ai/providers/xaiProvider.ts +14 -1
- package/src/plus/ai/utils/ai.utils.ts +0 -2
- package/src/plus/ai/utils/results.utils.ts +32 -0
- package/src/plus/ai/utils/truncation.utils.ts +0 -1
- package/src/plus/git-github/api/github.ts +484 -104
- package/src/plus/git-github/models.ts +33 -0
- package/src/plus/git-github/providers/github/branches.ts +6 -3
- package/src/plus/git-github/providers/github/diff.ts +1 -1
- package/src/plus/git-github/providers/github/graph.ts +131 -0
- package/src/plus/git-github/providers/github/tags.ts +2 -0
- package/src/plus/integrations/authentication/cloudIntegrationService.ts +189 -17
- package/src/plus/integrations/authentication/configuredIntegrationService.ts +287 -50
- package/src/plus/integrations/authentication/integrationAuthenticationProvider.ts +105 -31
- package/src/plus/integrations/authentication/integrationAuthenticationService.ts +7 -3
- package/src/plus/integrations/authentication/manualTokenProvider.ts +12 -5
- package/src/plus/integrations/authentication/models.ts +35 -1
- package/src/plus/integrations/collectionMetadata.ts +143 -0
- package/src/plus/integrations/constants.ts +21 -0
- package/src/plus/integrations/context.ts +8 -9
- package/src/plus/integrations/errors.ts +149 -0
- package/src/plus/integrations/index.ts +148 -51
- package/src/plus/integrations/integrationService.ts +1714 -49
- package/src/plus/integrations/lite.ts +233 -0
- package/src/plus/integrations/manager.ts +359 -0
- package/src/plus/integrations/models/gitHostIntegration.ts +1014 -121
- package/src/plus/integrations/models/integration.ts +293 -24
- package/src/plus/integrations/models/issuesIntegration.ts +178 -38
- package/src/plus/integrations/providerFilters.ts +12 -0
- package/src/plus/integrations/providers/apiClients.ts +8 -11
- package/src/plus/integrations/providers/apiConfig.ts +71 -0
- package/src/plus/integrations/providers/azure/azure.ts +164 -33
- package/src/plus/integrations/providers/azure/models.ts +19 -6
- package/src/plus/integrations/providers/azureDevOps.ts +766 -101
- package/src/plus/integrations/providers/bitbucket/bitbucket.ts +164 -34
- package/src/plus/integrations/providers/bitbucket-server/models.ts +32 -1
- package/src/plus/integrations/providers/bitbucket-server.ts +173 -8
- package/src/plus/integrations/providers/bitbucket.ts +489 -45
- package/src/plus/integrations/providers/github/github.ts +2 -2
- package/src/plus/integrations/providers/github/github.utils.ts +1 -1
- package/src/plus/integrations/providers/github.ts +390 -6
- package/src/plus/integrations/providers/gitlab/gitlab.ts +170 -60
- package/src/plus/integrations/providers/gitlab/gitlab.utils.ts +9 -0
- package/src/plus/integrations/providers/gitlab/models.ts +19 -5
- package/src/plus/integrations/providers/gitlab.ts +369 -10
- package/src/plus/integrations/providers/jira.ts +247 -42
- package/src/plus/integrations/providers/linear.ts +154 -27
- package/src/plus/integrations/providers/models.ts +583 -75
- package/src/plus/integrations/providers/providersApi.ts +849 -86
- package/src/plus/integrations/providers/trello.ts +205 -0
- package/src/plus/integrations/providers/utils/providerPaging.ts +177 -0
- package/src/plus/integrations/providers/utils.ts +68 -8
- package/src/plus/integrations/reads/context.ts +75 -0
- package/src/plus/integrations/reads/cursors.ts +224 -0
- package/src/plus/integrations/reads/drains.ts +343 -0
- package/src/plus/integrations/reads/filters.ts +124 -0
- package/src/plus/integrations/reads/hierarchy.ts +493 -0
- package/src/plus/integrations/reads/hierarchy.utils.ts +106 -0
- package/src/plus/integrations/reads/issueTracker.ts +480 -0
- package/src/plus/integrations/reads/issues.ts +407 -0
- package/src/plus/integrations/reads/paging.ts +277 -0
- package/src/plus/integrations/reads/pullRequests.ts +267 -0
- package/src/plus/integrations/reads/warnings.ts +170 -0
- package/src/plus/integrations/results.ts +275 -0
- package/src/plus/integrations/utils/domain.utils.ts +26 -0
- package/src/plus/integrations/utils/integration.utils.ts +93 -16
- package/src/utils/brand.ts +0 -2
- package/src/utils/cancellation.ts +56 -7
- package/src/utils/coalescedRun.ts +45 -0
- package/src/utils/color.ts +3 -3
- package/src/utils/date.ts +72 -0
- package/src/utils/debounce.ts +1 -1
- package/src/utils/decorators/gate.ts +2 -2
- package/src/utils/decorators/log.ts +5 -5
- package/src/utils/decorators/memoize.ts +2 -2
- package/src/utils/decorators/sequentialize.ts +2 -2
- package/src/utils/decorators/serializable.ts +1 -1
- package/src/utils/env/node/exec.ts +20 -5
- package/src/utils/event.ts +19 -25
- package/src/utils/function.ts +3 -3
- package/src/utils/iterable.ts +2 -6
- package/src/utils/logger.scoped.ts +1 -1
- package/src/utils/logger.ts +1 -1
- package/src/utils/paging.ts +46 -0
- package/src/utils/promise.ts +33 -3
- package/src/utils/promiseCache.ts +81 -51
- package/src/utils/searchTree.ts +4 -2
- package/src/utils/string.ts +1 -1
- package/src/utils/trie.ts +1 -0
- package/dist/plus/ai/providers/githubModelsProvider.d.ts +0 -19
- package/dist/plus/ai/providers/githubModelsProvider.d.ts.map +0 -1
- package/dist/plus/ai/providers/githubModelsProvider.js +0 -51
- package/dist/plus/ai/providers/githubModelsProvider.js.map +0 -1
- package/src/plus/ai/providers/githubModelsProvider.ts +0 -92
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import type { CollectionMetadata } from '@gitkraken/provider-apis';
|
|
1
2
|
import type { Account } from '../../git/models/author.js';
|
|
2
3
|
import type { IssueShape } from '../../git/models/issue.js';
|
|
3
|
-
import type { PullRequest } from '../../git/models/pullRequest.js';
|
|
4
|
+
import type { PullRequest, PullRequestShape, PullRequestStateFilter } from '../../git/models/pullRequest.js';
|
|
4
5
|
import type { GitRemote } from '../../git/models/remote.js';
|
|
5
6
|
import type { RemoteProviderId } from '../../git/models/remoteProvider.js';
|
|
6
|
-
import type { ResourceDescriptor } from '../../git/models/resourceDescriptor.js';
|
|
7
|
+
import type { IssueResourceDescriptor, ResourceDescriptor } from '../../git/models/resourceDescriptor.js';
|
|
8
|
+
import type { RemoteProviderConfig } from '../../git/remotes/matcher.js';
|
|
9
|
+
import { createRemoteProviderMatcher } from '../../git/remotes/matcher.js';
|
|
10
|
+
import { parseGitRemoteUrl } from '../../git/utils/remote.utils.js';
|
|
7
11
|
import { gate } from '../../utils/decorators/gate.js';
|
|
8
12
|
import { debug, trace } from '../../utils/decorators/log.js';
|
|
9
13
|
import type { Disposable } from '../../utils/disposable.js';
|
|
@@ -12,17 +16,23 @@ import type { Event } from '../../utils/event.js';
|
|
|
12
16
|
import { Emitter } from '../../utils/event.js';
|
|
13
17
|
import { filterMap, flatten } from '../../utils/iterable.js';
|
|
14
18
|
import { getScopedLogger } from '../../utils/logger.scoped.js';
|
|
19
|
+
import type { PagedResult } from '../../utils/paging.js';
|
|
20
|
+
import { mapBounded } from '../../utils/promise.js';
|
|
21
|
+
import { CloudIntegrationService } from './authentication/cloudIntegrationService.js';
|
|
22
|
+
import type { ConfiguredIntegrationsChangeEvent } from './authentication/configuredIntegrationService.js';
|
|
23
|
+
import { ConfiguredIntegrationService } from './authentication/configuredIntegrationService.js';
|
|
24
|
+
import { IntegrationAuthenticationService } from './authentication/integrationAuthenticationService.js';
|
|
15
25
|
import type {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import type { ConfiguredIntegrationDescriptor } from './authentication/models.js';
|
|
26
|
+
CloudIntegrationConnection,
|
|
27
|
+
ConfiguredIntegrationDescriptor,
|
|
28
|
+
ProviderAuthenticationSession,
|
|
29
|
+
} from './authentication/models.js';
|
|
21
30
|
import {
|
|
22
31
|
getSupportedCloudIntegrationIds,
|
|
23
32
|
isSupportedCloudIntegrationId,
|
|
24
33
|
toIntegrationId,
|
|
25
34
|
} from './authentication/models.js';
|
|
35
|
+
import { mergeAssessmentInto } from './collectionMetadata.js';
|
|
26
36
|
import type {
|
|
27
37
|
CloudGitSelfManagedHostIntegrationIds,
|
|
28
38
|
IntegrationIds,
|
|
@@ -32,9 +42,19 @@ import {
|
|
|
32
42
|
GitCloudHostIntegrationId,
|
|
33
43
|
GitSelfManagedHostIntegrationId,
|
|
34
44
|
IssuesCloudHostIntegrationId,
|
|
45
|
+
providerFanOutConcurrency,
|
|
35
46
|
} from './constants.js';
|
|
36
47
|
import type { AuthenticationSessionsChangeEvent, IntegrationServiceContext } from './context.js';
|
|
37
|
-
import
|
|
48
|
+
import { AuthenticationError, RequestNotFoundError } from './errors.js';
|
|
49
|
+
import type {
|
|
50
|
+
ClosedPullRequestSweepOptions,
|
|
51
|
+
ListOrgsOptions,
|
|
52
|
+
ListProjectsOptions,
|
|
53
|
+
ProviderBroadenOrg,
|
|
54
|
+
ProviderSweepTarget,
|
|
55
|
+
PullRequestSweepOptions,
|
|
56
|
+
} from './manager.js';
|
|
57
|
+
import type { GitHostIntegration, SearchMyPullRequestsOptions } from './models/gitHostIntegration.js';
|
|
38
58
|
import type {
|
|
39
59
|
Integration,
|
|
40
60
|
IntegrationBase,
|
|
@@ -43,30 +63,103 @@ import type {
|
|
|
43
63
|
IntegrationResult,
|
|
44
64
|
} from './models/integration.js';
|
|
45
65
|
import type { IssuesIntegration } from './models/issuesIntegration.js';
|
|
66
|
+
import { isIssuesIntegration } from './models/issuesIntegration.js';
|
|
46
67
|
import type { ApiClients } from './providers/apiClients.js';
|
|
47
68
|
import { createApiClients } from './providers/apiClients.js';
|
|
48
69
|
import type { GitHubApi } from './providers/github/github.js';
|
|
70
|
+
import type {
|
|
71
|
+
ProviderOrganization,
|
|
72
|
+
ProviderPullRequest,
|
|
73
|
+
ProviderReposInput,
|
|
74
|
+
ProviderRepository,
|
|
75
|
+
ProviderRepositoryShape,
|
|
76
|
+
PullRequestFilter,
|
|
77
|
+
} from './providers/models.js';
|
|
78
|
+
import {
|
|
79
|
+
fromProviderPullRequest,
|
|
80
|
+
getProviderPullRequestIdentity,
|
|
81
|
+
isAzureCloudDomain,
|
|
82
|
+
isBitbucketCloudDomain,
|
|
83
|
+
isGitHubDotCom,
|
|
84
|
+
isGitLabDotCom,
|
|
85
|
+
IssueFilter,
|
|
86
|
+
PagingMode,
|
|
87
|
+
providersMetadata,
|
|
88
|
+
toProviderRepositoryShape,
|
|
89
|
+
} from './providers/models.js';
|
|
49
90
|
import type { ProvidersApi } from './providers/providersApi.js';
|
|
91
|
+
import { mergeCollectionMetadata, parsePageCursor } from './providers/utils/providerPaging.js';
|
|
92
|
+
import { type ProviderReadContext } from './reads/context.js';
|
|
93
|
+
import {
|
|
94
|
+
getBroadenIssuesCursor,
|
|
95
|
+
isBroadenIssuesOrgExhausted,
|
|
96
|
+
parseIssueTrackerPageCursor,
|
|
97
|
+
toBroadenIssuesCursor,
|
|
98
|
+
toIssueTrackerPageCursor,
|
|
99
|
+
} from './reads/cursors.js';
|
|
100
|
+
import {
|
|
101
|
+
drainPullRequests,
|
|
102
|
+
drainRepositories,
|
|
103
|
+
getCurrentAccountId,
|
|
104
|
+
resolvePullRequestSweepTargets,
|
|
105
|
+
runCaptured,
|
|
106
|
+
} from './reads/drains.js';
|
|
107
|
+
import {
|
|
108
|
+
getSupportedFilters,
|
|
109
|
+
resolveAccountWidePullRequestFilters,
|
|
110
|
+
resolvePullRequestFilters,
|
|
111
|
+
} from './reads/filters.js';
|
|
112
|
+
import { listOrgs, listProjects, listRepos } from './reads/hierarchy.js';
|
|
113
|
+
import { resourceMatchesOrg } from './reads/hierarchy.utils.js';
|
|
114
|
+
import { listIssuesPage } from './reads/issues.js';
|
|
115
|
+
import { listIssueTrackerIssuesPage } from './reads/issueTracker.js';
|
|
116
|
+
import { resolveContinuation, toProviderPageInfo } from './reads/paging.js';
|
|
117
|
+
import { listPullRequestsPage } from './reads/pullRequests.js';
|
|
118
|
+
import {
|
|
119
|
+
gitHostOnlySurfaceWarning,
|
|
120
|
+
issuesUnsupportedWarning,
|
|
121
|
+
noConnectionWarning,
|
|
122
|
+
otherWarning,
|
|
123
|
+
unsupportedAccountWidePullRequestFiltersWarning,
|
|
124
|
+
unsupportedFiltersWarning,
|
|
125
|
+
} from './reads/warnings.js';
|
|
126
|
+
import type {
|
|
127
|
+
ConnectionStateChangeEvent,
|
|
128
|
+
ProviderBroadenResult,
|
|
129
|
+
ProviderPagedResult,
|
|
130
|
+
ProviderPageInfo,
|
|
131
|
+
ProviderResult,
|
|
132
|
+
ProviderSweepResult,
|
|
133
|
+
ProviderWarning,
|
|
134
|
+
RepositoryIdentity,
|
|
135
|
+
RepositoryResolution,
|
|
136
|
+
ResolveRepositoryResult,
|
|
137
|
+
} from './results.js';
|
|
138
|
+
import { appendDedupedWarning, toProviderWarning } from './results.js';
|
|
50
139
|
import type { Source } from './telemetry.js';
|
|
140
|
+
import { hostFromDomain } from './utils/domain.utils.js';
|
|
51
141
|
import {
|
|
52
142
|
convertRemoteProviderIdToIntegrationId,
|
|
53
143
|
getIntegrationIdForRemote,
|
|
54
144
|
isCloudGitSelfManagedHostIntegrationId,
|
|
55
145
|
isGitCloudHostIntegrationId,
|
|
146
|
+
isGitHostIntegration,
|
|
56
147
|
isGitSelfManagedHostIntegrationId,
|
|
148
|
+
isIssuesHostIntegrationId,
|
|
149
|
+
isNonExpiringZeroTokenIntegrationId,
|
|
150
|
+
remoteProviderTypeForConfig,
|
|
151
|
+
remoteProviderTypeForIntegration,
|
|
152
|
+
warnOnMissingSessionForDomain,
|
|
57
153
|
} from './utils/integration.utils.js';
|
|
58
154
|
|
|
59
|
-
export interface ConnectionStateChangeEvent {
|
|
60
|
-
key: string;
|
|
61
|
-
reason: 'connected' | 'disconnected';
|
|
62
|
-
}
|
|
63
|
-
|
|
64
155
|
/** @internal Event emitted when an integration connection state changes */
|
|
65
156
|
export interface IntegrationConnectionChangeEvent extends ConnectionStateChangeEvent {
|
|
66
157
|
integration: IntegrationBase;
|
|
67
158
|
}
|
|
68
159
|
|
|
69
|
-
|
|
160
|
+
const maxSmallIntegerV8 = 2 ** 30 - 1; // Max number that can be stored in V8's smis (small integers)
|
|
161
|
+
|
|
162
|
+
export class IntegrationService implements Disposable, ProviderReadContext {
|
|
70
163
|
get onDidChange(): Event<ConfiguredIntegrationsChangeEvent> {
|
|
71
164
|
return this.configuredIntegrationService.onDidChange;
|
|
72
165
|
}
|
|
@@ -193,6 +286,19 @@ export class IntegrationService implements Disposable {
|
|
|
193
286
|
return true;
|
|
194
287
|
}
|
|
195
288
|
|
|
289
|
+
/**
|
|
290
|
+
* Starts the cloud connect flow without skipping an already-connected provider, allowing the host/GK Dev
|
|
291
|
+
* flow to add another account for that provider instead of treating the existing primary as sufficient.
|
|
292
|
+
* Returns whether a new connection was actually added (measured by a new cloud connection id appearing),
|
|
293
|
+
* since {@link connectCloudIntegrations} only reports provider-level success and can't detect a newly added
|
|
294
|
+
* secondary for an already-connected provider.
|
|
295
|
+
*/
|
|
296
|
+
async connectSecondary(id: SupportedCloudIntegrationIds, source?: Source): Promise<boolean> {
|
|
297
|
+
const before = new Set(this.getConfigured(id, { cloud: true }).map(c => c.id));
|
|
298
|
+
await this.connectCloudIntegrations({ integrationIds: [id], skipIfConnected: false }, source);
|
|
299
|
+
return this.getConfigured(id, { cloud: true }).some(c => !before.has(c.id));
|
|
300
|
+
}
|
|
301
|
+
|
|
196
302
|
get(id: GitCloudHostIntegrationId): Promise<GitHostIntegration>;
|
|
197
303
|
get(id: IssuesCloudHostIntegrationId): Promise<IssuesIntegration>;
|
|
198
304
|
get(
|
|
@@ -202,6 +308,14 @@ export class IntegrationService implements Disposable {
|
|
|
202
308
|
get(id: GitSelfManagedHostIntegrationId, domain: string): Promise<GitHostIntegration | undefined>;
|
|
203
309
|
get<T extends IntegrationIds>(id: T, domain?: string): Promise<IntegrationById<T> | undefined>;
|
|
204
310
|
async get<T extends IntegrationIds>(id: T, domain?: string): Promise<IntegrationById<T> | undefined> {
|
|
311
|
+
// Normalize to a bare host before anything keys off it. Callers pass a self-managed domain in both shapes
|
|
312
|
+
// — a full URL from a stored session/descriptor, a bare host from `hostFromDomain` — and the cache key is
|
|
313
|
+
// `${id}:${domain}`, so the same host arriving in two shapes would build two instances (and two
|
|
314
|
+
// "primaries") for one host.
|
|
315
|
+
if (isGitSelfManagedHostIntegrationId(id)) {
|
|
316
|
+
domain = hostFromDomain(domain) ?? domain;
|
|
317
|
+
}
|
|
318
|
+
|
|
205
319
|
let integration = this.getCached(id, domain);
|
|
206
320
|
if (integration == null) {
|
|
207
321
|
switch (id) {
|
|
@@ -224,7 +338,7 @@ export class IntegrationService implements Disposable {
|
|
|
224
338
|
|
|
225
339
|
const configured = this.getConfigured(GitSelfManagedHostIntegrationId.CloudGitHubEnterprise);
|
|
226
340
|
if (configured.length) {
|
|
227
|
-
const { domain: configuredDomain } = configured[0];
|
|
341
|
+
const { domain: configuredDomain } = configured.find(c => c.primary) ?? configured[0];
|
|
228
342
|
if (configuredDomain == null) throw new Error(`Domain is required for '${id}' integration`);
|
|
229
343
|
|
|
230
344
|
integration = new (
|
|
@@ -275,7 +389,7 @@ export class IntegrationService implements Disposable {
|
|
|
275
389
|
|
|
276
390
|
const configured = this.getConfigured(GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted);
|
|
277
391
|
if (configured.length) {
|
|
278
|
-
const { domain: configuredDomain } = configured[0];
|
|
392
|
+
const { domain: configuredDomain } = configured.find(c => c.primary) ?? configured[0];
|
|
279
393
|
if (configuredDomain == null) throw new Error(`Domain is required for '${id}' integration`);
|
|
280
394
|
|
|
281
395
|
integration = new (
|
|
@@ -326,7 +440,7 @@ export class IntegrationService implements Disposable {
|
|
|
326
440
|
|
|
327
441
|
const configured = this.getConfigured(GitSelfManagedHostIntegrationId.BitbucketServer);
|
|
328
442
|
if (configured.length) {
|
|
329
|
-
const { domain: configuredDomain } = configured[0];
|
|
443
|
+
const { domain: configuredDomain } = configured.find(c => c.primary) ?? configured[0];
|
|
330
444
|
if (configuredDomain == null) throw new Error(`Domain is required for '${id}' integration`);
|
|
331
445
|
|
|
332
446
|
integration = new (
|
|
@@ -377,7 +491,7 @@ export class IntegrationService implements Disposable {
|
|
|
377
491
|
|
|
378
492
|
const configured = this.getConfigured(GitSelfManagedHostIntegrationId.AzureDevOpsServer);
|
|
379
493
|
if (configured.length) {
|
|
380
|
-
const { domain: configuredDomain } = configured[0];
|
|
494
|
+
const { domain: configuredDomain } = configured.find(c => c.primary) ?? configured[0];
|
|
381
495
|
if (configuredDomain == null) throw new Error(`Domain is required for '${id}' integration`);
|
|
382
496
|
|
|
383
497
|
integration = new (
|
|
@@ -430,6 +544,17 @@ export class IntegrationService implements Disposable {
|
|
|
430
544
|
this._onDidChangeIntegrationConnection,
|
|
431
545
|
) as IssuesIntegration as IntegrationById<T>;
|
|
432
546
|
break;
|
|
547
|
+
|
|
548
|
+
case IssuesCloudHostIntegrationId.Trello:
|
|
549
|
+
integration = new (
|
|
550
|
+
await import(/* webpackChunkName: "integrations" */ './providers/trello.js')
|
|
551
|
+
).TrelloIntegration(
|
|
552
|
+
this.ctx,
|
|
553
|
+
this.authenticationService,
|
|
554
|
+
this.getProvidersApi.bind(this),
|
|
555
|
+
this._onDidChangeIntegrationConnection,
|
|
556
|
+
) as IssuesIntegration as IntegrationById<T>;
|
|
557
|
+
break;
|
|
433
558
|
default:
|
|
434
559
|
throw new Error(`Integration with '${id}' is not supported`);
|
|
435
560
|
}
|
|
@@ -447,6 +572,20 @@ export class IntegrationService implements Disposable {
|
|
|
447
572
|
return this.configuredIntegrationService.getConfigured(id, options);
|
|
448
573
|
}
|
|
449
574
|
|
|
575
|
+
/**
|
|
576
|
+
* The filters this provider's reads accept — part of the public {@link IntegrationManager} contract, so it
|
|
577
|
+
* stays a method here even though it needs no instance state; see {@link getSupportedFilters} for the
|
|
578
|
+
* capability table itself and why a consumer should intersect against it before reading.
|
|
579
|
+
*/
|
|
580
|
+
getSupportedFilters(providerId: IntegrationIds): {
|
|
581
|
+
pullRequests: PullRequestFilter[];
|
|
582
|
+
pullRequestsAccountWide: PullRequestFilter[];
|
|
583
|
+
issues: IssueFilter[];
|
|
584
|
+
issuesAccountWide: IssueFilter[];
|
|
585
|
+
} {
|
|
586
|
+
return getSupportedFilters(providerId);
|
|
587
|
+
}
|
|
588
|
+
|
|
450
589
|
/**
|
|
451
590
|
* Returns the connected integration for a `GitRemote`, if any.
|
|
452
591
|
* Internal counterpart to the host's `getRemoteIntegration(remote)` helper.
|
|
@@ -588,18 +727,22 @@ export class IntegrationService implements Disposable {
|
|
|
588
727
|
}
|
|
589
728
|
|
|
590
729
|
@debug({
|
|
591
|
-
args: integrationIds => ({
|
|
730
|
+
args: (integrationIds, connectionId) => ({
|
|
731
|
+
integrationIds: integrationIds?.length ? integrationIds.join(',') : '<undefined>',
|
|
732
|
+
connectionId: connectionId ?? '<primary>',
|
|
733
|
+
}),
|
|
592
734
|
})
|
|
593
735
|
async getMyCurrentAccounts(
|
|
594
736
|
integrationIds: (GitCloudHostIntegrationId | CloudGitSelfManagedHostIntegrationIds)[],
|
|
737
|
+
connectionId?: string,
|
|
595
738
|
): Promise<Map<GitCloudHostIntegrationId | CloudGitSelfManagedHostIntegrationIds, Account>> {
|
|
596
739
|
const accounts = new Map<GitCloudHostIntegrationId | CloudGitSelfManagedHostIntegrationIds, Account>();
|
|
597
740
|
await Promise.allSettled(
|
|
598
741
|
integrationIds.map(async integrationId => {
|
|
599
|
-
const integration = await this.
|
|
742
|
+
const integration = await this.getIntegrationForRead(integrationId, connectionId);
|
|
600
743
|
if (integration == null) return;
|
|
601
744
|
|
|
602
|
-
const account = await integration.getCurrentAccount();
|
|
745
|
+
const account = await integration.getCurrentAccount({ connectionId: connectionId });
|
|
603
746
|
if (account) {
|
|
604
747
|
accounts.set(integrationId, account);
|
|
605
748
|
}
|
|
@@ -615,6 +758,7 @@ export class IntegrationService implements Disposable {
|
|
|
615
758
|
integrationIds?: (GitCloudHostIntegrationId | CloudGitSelfManagedHostIntegrationIds)[],
|
|
616
759
|
cancellation?: AbortSignal,
|
|
617
760
|
silent?: boolean,
|
|
761
|
+
options?: SearchMyPullRequestsOptions,
|
|
618
762
|
): Promise<IntegrationResult<PullRequest[] | undefined>> {
|
|
619
763
|
const integrations: Map<GitHostIntegration, ResourceDescriptor[] | undefined> = new Map();
|
|
620
764
|
for (const integrationId of integrationIds?.length
|
|
@@ -630,13 +774,14 @@ export class IntegrationService implements Disposable {
|
|
|
630
774
|
}
|
|
631
775
|
if (integrations.size === 0) return undefined;
|
|
632
776
|
|
|
633
|
-
return this.getMyPullRequestsCore(integrations, cancellation, silent);
|
|
777
|
+
return this.getMyPullRequestsCore(integrations, cancellation, silent, options);
|
|
634
778
|
}
|
|
635
779
|
|
|
636
780
|
private async getMyPullRequestsCore(
|
|
637
781
|
integrations: Map<GitHostIntegration, ResourceDescriptor[] | undefined>,
|
|
638
782
|
cancellation?: AbortSignal,
|
|
639
783
|
silent?: boolean,
|
|
784
|
+
options?: SearchMyPullRequestsOptions,
|
|
640
785
|
): Promise<IntegrationResult<PullRequest[] | undefined>> {
|
|
641
786
|
const start = performance.now();
|
|
642
787
|
|
|
@@ -644,7 +789,7 @@ export class IntegrationService implements Disposable {
|
|
|
644
789
|
for (const [integration, repos] of integrations) {
|
|
645
790
|
if (integration == null) continue;
|
|
646
791
|
|
|
647
|
-
promises.push(integration.searchMyPullRequests(repos, cancellation, silent));
|
|
792
|
+
promises.push(integration.searchMyPullRequests(repos, cancellation, silent, undefined, undefined, options));
|
|
648
793
|
}
|
|
649
794
|
|
|
650
795
|
const results = await Promise.allSettled(promises);
|
|
@@ -717,17 +862,1108 @@ export class IntegrationService implements Disposable {
|
|
|
717
862
|
return this.getMyPullRequestsCore(integrations);
|
|
718
863
|
}
|
|
719
864
|
|
|
865
|
+
// #region ProviderBackend surface (#5438)
|
|
866
|
+
//
|
|
867
|
+
// Generic discovery (orgs/projects/repos) and page-oriented reads that Kepler's ProviderBackend
|
|
868
|
+
// adapter maps to its own DTOs. All results are neutral (`ProviderResult`/`ProviderPagedResult`) and
|
|
869
|
+
// carry per-provider warnings recovered from the read cores, so a single provider's auth/rate-limit
|
|
870
|
+
// failure degrades to a warning instead of failing the whole call. The reads are repo-scoped (they
|
|
871
|
+
// compose the git-host `*Result` cores); account-scoped fan-out is the adapter's responsibility.
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Warnings for an early-returning read where the integration couldn't be resolved. When a specific
|
|
875
|
+
* `connectionId` or self-managed `domain` was requested, a missing integration means that target is
|
|
876
|
+
* unavailable — surface a `no-connection` warning + `fetchFailed` so the caller can tell it apart from
|
|
877
|
+
* a truly empty account. Without an explicit target, it's simply not connected, which stays a silent
|
|
878
|
+
* empty result.
|
|
879
|
+
*/
|
|
880
|
+
earlyReturnConnectionWarnings(
|
|
881
|
+
id: IntegrationIds,
|
|
882
|
+
connectionId: string | undefined,
|
|
883
|
+
domain?: string,
|
|
884
|
+
): { warnings: ProviderWarning[]; fetchFailed: boolean } {
|
|
885
|
+
const requestedDomain = isGitSelfManagedHostIntegrationId(id) ? domain : undefined;
|
|
886
|
+
const invalidDomain = this.isEmptyExplicitSelector(domain);
|
|
887
|
+
if (connectionId == null && requestedDomain == null && !invalidDomain) {
|
|
888
|
+
return { warnings: [], fetchFailed: false };
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
const resolvedDomain = invalidDomain
|
|
892
|
+
? domain?.trim()
|
|
893
|
+
: this.resolveDomainForRead(id, connectionId, requestedDomain);
|
|
894
|
+
return { warnings: [noConnectionWarning(id, resolvedDomain, connectionId)], fetchFailed: true };
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
private isEmptyExplicitSelector(value: string | undefined): boolean {
|
|
898
|
+
return value?.trim().length === 0;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
domainForRead(
|
|
902
|
+
integration: Integration,
|
|
903
|
+
id: IntegrationIds,
|
|
904
|
+
connectionId: string | undefined,
|
|
905
|
+
domain?: string,
|
|
906
|
+
): string | undefined {
|
|
907
|
+
if (!isGitSelfManagedHostIntegrationId(id)) {
|
|
908
|
+
return connectionId != null ? this.getConfiguredConnectionDomain(id, connectionId) : integration.domain;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
return this.resolveDomainForRead(id, connectionId, domain) ?? integration.domain;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* Resolves the right integration instance for a read. A configured connection domain takes precedence over
|
|
916
|
+
* an explicit fallback domain; the latter lets external/manual authentication providers address a
|
|
917
|
+
* self-managed host without persisting `ConfiguredIntegrationService` state.
|
|
918
|
+
*/
|
|
919
|
+
async getIntegrationForRead(
|
|
920
|
+
id: IntegrationIds,
|
|
921
|
+
connectionId: string | undefined,
|
|
922
|
+
domain?: string,
|
|
923
|
+
): Promise<Integration | undefined> {
|
|
924
|
+
// Empty explicit selectors are invalid targets, not an instruction to fall back to the primary
|
|
925
|
+
// connection. Keep this at the common read boundary so every public surface behaves consistently.
|
|
926
|
+
if (this.isEmptyExplicitSelector(connectionId) || this.isEmptyExplicitSelector(domain)) return undefined;
|
|
927
|
+
|
|
928
|
+
const resolvedDomain = this.resolveDomainForRead(id, connectionId, domain);
|
|
929
|
+
try {
|
|
930
|
+
return await this.get(id, resolvedDomain);
|
|
931
|
+
} catch {
|
|
932
|
+
return undefined;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
resolveDomainForRead(
|
|
937
|
+
id: IntegrationIds,
|
|
938
|
+
connectionId: string | undefined,
|
|
939
|
+
domain: string | undefined,
|
|
940
|
+
): string | undefined {
|
|
941
|
+
if (!isGitSelfManagedHostIntegrationId(id)) return undefined;
|
|
942
|
+
|
|
943
|
+
return (
|
|
944
|
+
(connectionId != null ? this.getConfiguredConnectionDomain(id, connectionId) : undefined) ??
|
|
945
|
+
hostFromDomain(domain) ??
|
|
946
|
+
// With no explicit target, pin the primary configured host rather than leaving the domain undefined:
|
|
947
|
+
// `get(id, undefined)` falls back to `findCachedById`, which returns the FIRST entry by Map insertion
|
|
948
|
+
// order. With two hosts of the same provider that makes the instance depend on which host happened to
|
|
949
|
+
// be constructed first, so orgs/repos could come from one host and PRs from another in the same UI.
|
|
950
|
+
this.primaryConfiguredDomain(id)
|
|
951
|
+
);
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/** The primary configured host for a self-managed provider (first configured when none is flagged primary). */
|
|
955
|
+
private primaryConfiguredDomain(id: IntegrationIds): string | undefined {
|
|
956
|
+
const configured = this.getConfigured(id);
|
|
957
|
+
return (configured.find(c => c.primary) ?? configured[0])?.domain;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Forces a real session refresh before a read when `forceSync` is set, so the read consumes a freshly
|
|
962
|
+
* exchanged token rather than a possibly-stale cached one. Both paths refresh, by different mechanisms: a
|
|
963
|
+
* per-connection (`connectionId`) read syncs that specific connection's session directly through the auth
|
|
964
|
+
* provider (the integration's primary-only sync path would never reach a secondary account), while a
|
|
965
|
+
* primary read syncs via the integration's own cloud-connection machinery.
|
|
966
|
+
* Best-effort — a failed sync is swallowed so the read still proceeds (and surfaces its own warning).
|
|
967
|
+
*/
|
|
968
|
+
async forceRefreshIfRequested(
|
|
969
|
+
integration: Integration,
|
|
970
|
+
forceSync: boolean | undefined,
|
|
971
|
+
connectionId: string | undefined,
|
|
972
|
+
): Promise<void> {
|
|
973
|
+
if (forceSync !== true) return;
|
|
974
|
+
|
|
975
|
+
try {
|
|
976
|
+
if (connectionId != null) {
|
|
977
|
+
// Refresh the specific connection's session directly; the primary-only sync path below would not
|
|
978
|
+
// reach a secondary account. `cloud: true` is required for multi-account backend connections.
|
|
979
|
+
const authProvider = await this.authenticationService.get(integration.authProvider.id);
|
|
980
|
+
const descriptor = { ...integration.authProviderDescriptor, connectionId: connectionId, cloud: true };
|
|
981
|
+
await authProvider?.deleteSession(descriptor);
|
|
982
|
+
await authProvider?.getSession(descriptor, { sync: true });
|
|
983
|
+
} else {
|
|
984
|
+
await integration.syncCloudConnection('connected', true);
|
|
985
|
+
}
|
|
986
|
+
} catch {}
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* Lists the orgs/workspaces/groups (and issue-tracker resources) visible to the user, unified into
|
|
991
|
+
* {@link ProviderOrganization}. Scoped to `providerId` when given, otherwise fanned out over every
|
|
992
|
+
* supported provider. `connectionId` only makes sense with a single `providerId`.
|
|
993
|
+
*/
|
|
994
|
+
async listOrgs(options?: ListOrgsOptions): Promise<ProviderResult<ProviderOrganization>> {
|
|
995
|
+
return listOrgs(this, options);
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* Lists the projects visible to the user, unified into the {@link ProviderOrganization}
|
|
1000
|
+
* `{ providerId, id, name, org?, url }` shape. Covers issue-tracker providers (Jira/Linear, which expose
|
|
1001
|
+
* projects under their resources) *and* git hosts that have a project tier (Azure DevOps, whose repos are
|
|
1002
|
+
* org + project scoped). Scoped to `providerId` when given, else fanned out over both the supported issue
|
|
1003
|
+
* trackers and Azure DevOps. Providers with no project tier (GitHub, GitLab, Bitbucket) contribute nothing.
|
|
1004
|
+
*/
|
|
1005
|
+
async listProjects(options?: ListProjectsOptions): Promise<ProviderResult<ProviderOrganization>> {
|
|
1006
|
+
return listProjects(this, options);
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
/**
|
|
1010
|
+
* Lists repositories under an org for a git-host provider, one page at a time. Pass `page` (1-based)
|
|
1011
|
+
* to advance; the returned `cursor` is only meaningful for cursor-only hosts.
|
|
1012
|
+
*/
|
|
1013
|
+
async listRepos(options: {
|
|
1014
|
+
providerId: IntegrationIds;
|
|
1015
|
+
/**
|
|
1016
|
+
* Org/workspace/group to scope to. Omitted = the account-wide, user-affiliated walk (the org-less
|
|
1017
|
+
* `gk provider repos <provider>` equivalent) for hosts with a native user-repos read (GitHub, GitLab);
|
|
1018
|
+
* hosts without one (Bitbucket, Azure DevOps) report the org-less read as unsupported so the caller
|
|
1019
|
+
* fans out per org instead.
|
|
1020
|
+
*/
|
|
1021
|
+
org?: string;
|
|
1022
|
+
project?: string;
|
|
1023
|
+
page?: number;
|
|
1024
|
+
cursor?: string;
|
|
1025
|
+
itemsPerPage?: number;
|
|
1026
|
+
connectionId?: string;
|
|
1027
|
+
/**
|
|
1028
|
+
* Explicit self-managed host domain. Used only when the requested connection has no configured domain;
|
|
1029
|
+
* it must come from the trusted authentication configuration, not repository or remote data.
|
|
1030
|
+
*/
|
|
1031
|
+
domain?: string;
|
|
1032
|
+
}): Promise<ProviderPagedResult<ProviderRepositoryShape>> {
|
|
1033
|
+
return listRepos(this, options);
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* Reads one page of the user's pull requests for the given git-host provider. With `repos`, reads those
|
|
1038
|
+
* repos' PRs (translating `page` ↔ the provider's opaque cursor) and maps the raw provider PRs to
|
|
1039
|
+
* {@link PullRequestShape}. With no `repos`, reads the current user's PRs account-wide — the
|
|
1040
|
+
* repo-scoped core rejects an empty `repos` input for GitHub/Bitbucket/Azure, so route to the
|
|
1041
|
+
* account-wide `searchMyPullRequests` core instead (which is already user-scoped and returns shapes).
|
|
1042
|
+
*/
|
|
1043
|
+
async listPullRequestsPage(options: {
|
|
1044
|
+
providerId: IntegrationIds;
|
|
1045
|
+
repos?: ProviderReposInput;
|
|
1046
|
+
states?: PullRequestStateFilter[];
|
|
1047
|
+
/**
|
|
1048
|
+
* PR relationship filters (e.g. `[Author, Assignee, ReviewRequested]`). On repo-scoped reads members
|
|
1049
|
+
* combine as provider query constraints (normally an intersection); on account-wide reads they form an
|
|
1050
|
+
* exact OR union. The whole set is validated against the selected path's capability.
|
|
1051
|
+
*/
|
|
1052
|
+
filters?: PullRequestFilter[];
|
|
1053
|
+
/**
|
|
1054
|
+
* Account-wide only: include review-requested PRs when the provider's native "my PRs" query omits them.
|
|
1055
|
+
* This extends the provider-native result; it is not a narrowing filter.
|
|
1056
|
+
*/
|
|
1057
|
+
includeReviewRequested?: boolean;
|
|
1058
|
+
page?: number;
|
|
1059
|
+
cursor?: string;
|
|
1060
|
+
itemsPerPage?: number;
|
|
1061
|
+
forceSync?: boolean;
|
|
1062
|
+
connectionId?: string;
|
|
1063
|
+
/**
|
|
1064
|
+
* Explicit self-managed host domain when no configured connection supplies one. The value must come
|
|
1065
|
+
* from the trusted authentication configuration, not repository or remote data.
|
|
1066
|
+
*/
|
|
1067
|
+
domain?: string;
|
|
1068
|
+
}): Promise<ProviderPagedResult<PullRequestShape>> {
|
|
1069
|
+
return listPullRequestsPage(this, options);
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
async listIssuesPage(options: {
|
|
1073
|
+
providerId: IntegrationIds;
|
|
1074
|
+
repos?: ProviderReposInput;
|
|
1075
|
+
/** Narrows the account-wide read to one org/account. Requires a host with a project layer (Azure). */
|
|
1076
|
+
org?: string;
|
|
1077
|
+
/** Narrows the account-wide read to one project. Requires a host with a project layer (Azure). */
|
|
1078
|
+
project?: string;
|
|
1079
|
+
/**
|
|
1080
|
+
* Narrows to the requested relationship(s). On the account-wide path this replaces the provider's own
|
|
1081
|
+
* definition of "my issues" (GitHub/GHE: authored ∪ assigned ∪ mentioned; Azure: assigned ∪ authored;
|
|
1082
|
+
* GitLab: assigned-to-me), so `[Assignee]` yields `assignee:@me` everywhere it's expressible. A set the
|
|
1083
|
+
* provider can't express server-side is refused whole (warning + `fetchFailed`), never widened — check
|
|
1084
|
+
* {@link IntegrationService.getSupportedFilters} first to avoid that path.
|
|
1085
|
+
*/
|
|
1086
|
+
filters?: IssueFilter[];
|
|
1087
|
+
/** Broadens the read to every assignee. Contradicts `filters`; passing both is refused. */
|
|
1088
|
+
includeAllAssignees?: boolean;
|
|
1089
|
+
page?: number;
|
|
1090
|
+
cursor?: string;
|
|
1091
|
+
itemsPerPage?: number;
|
|
1092
|
+
forceSync?: boolean;
|
|
1093
|
+
connectionId?: string;
|
|
1094
|
+
/**
|
|
1095
|
+
* Explicit self-managed host domain. Used only when the requested connection has no configured domain;
|
|
1096
|
+
* it must come from the trusted authentication configuration, not repository or remote data.
|
|
1097
|
+
*/
|
|
1098
|
+
domain?: string;
|
|
1099
|
+
}): Promise<ProviderPagedResult<IssueShape>> {
|
|
1100
|
+
return listIssuesPage(this, options);
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Reads the user's issues from an issue-tracker provider (Jira/Linear/Trello), whose issues live under
|
|
1105
|
+
* resource → project (not repos), so they can't go through {@link listIssuesPage} (git-host, repo-scoped).
|
|
1106
|
+
* Returns the normalized {@link IssueShape} these providers produce, aggregated across the projects of the
|
|
1107
|
+
* given `org` (or every visible resource/project when omitted). `includeAllAssignees` drops the
|
|
1108
|
+
* "assigned to me" scoping so unassigned issues are included. Best-effort: a per-step failure becomes a
|
|
1109
|
+
* warning without failing the whole read.
|
|
1110
|
+
*
|
|
1111
|
+
* Paginated by project: these providers have no single cross-project issue cursor, so a page is a bounded
|
|
1112
|
+
* window of projects (each drained by its own read). Pagination is opt-in — a caller that supplies none of
|
|
1113
|
+
* `page`/`cursor`/`itemsPerPage` reads every matched project in one page (`hasMore: false`), preserving the
|
|
1114
|
+
* "aggregate everything" contract for callers that don't page. When any of those is supplied, the read is
|
|
1115
|
+
* windowed to `itemsPerPage` projects (default 20) advanced 1-based via `page`/`cursor`, with `hasMore`/
|
|
1116
|
+
* `cursor` carrying the next window. Note: a project's own read has an internal page backstop (see the
|
|
1117
|
+
* per-provider drains); if a single project exceeds it, its extra issues can't be paged from here, but that
|
|
1118
|
+
* incompleteness IS surfaced as `page.truncated` (Jira/Linear report the backstop hit) rather than passed
|
|
1119
|
+
* off as a complete read.
|
|
1120
|
+
*
|
|
1121
|
+
* Takes no `domain`, unlike the git-host reads: every issue-tracker provider is cloud-only
|
|
1122
|
+
* ({@link IssuesCloudHostIntegrationId}), so there is no self-managed host to address.
|
|
1123
|
+
*/
|
|
1124
|
+
async listIssueTrackerIssuesPage(options: {
|
|
1125
|
+
providerId: IntegrationIds;
|
|
1126
|
+
org?: string;
|
|
1127
|
+
project?: string;
|
|
1128
|
+
filters?: IssueFilter[];
|
|
1129
|
+
includeAllAssignees?: boolean;
|
|
1130
|
+
forceSync?: boolean;
|
|
1131
|
+
page?: number;
|
|
1132
|
+
cursor?: string;
|
|
1133
|
+
itemsPerPage?: number;
|
|
1134
|
+
connectionId?: string;
|
|
1135
|
+
}): Promise<ProviderPagedResult<IssueShape>> {
|
|
1136
|
+
return listIssueTrackerIssuesPage(this, options);
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* Sweeps the user's pull requests across providers by draining every page (an "all-pages" read),
|
|
1140
|
+
* returning the neutral sweep result with per-provider warnings. `truncated` is set when a provider
|
|
1141
|
+
* hit `maxPages` with more still available; `fetchFailed` when a drain aborted on a read error.
|
|
1142
|
+
* `targets` selects a connection/domain independently for each provider. The legacy `connectionId` is
|
|
1143
|
+
* honored only when `providerIds` resolves to a single provider (otherwise ambiguous).
|
|
1144
|
+
*/
|
|
1145
|
+
async sweepPullRequests(options?: PullRequestSweepOptions): Promise<ProviderSweepResult<PullRequestShape>> {
|
|
1146
|
+
const { targets, attributeUnavailableProviders } = resolvePullRequestSweepTargets(options);
|
|
1147
|
+
const maxPages = options?.maxPages ?? 100;
|
|
1148
|
+
const repos = options?.repos ?? [];
|
|
1149
|
+
|
|
1150
|
+
const results = await mapBounded(targets, providerFanOutConcurrency, async target => {
|
|
1151
|
+
const { providerId: id, connectionId, domain: requestedDomain } = target;
|
|
1152
|
+
if (isIssuesHostIntegrationId(id)) {
|
|
1153
|
+
return {
|
|
1154
|
+
items: [] as PullRequestShape[],
|
|
1155
|
+
warnings: [gitHostOnlySurfaceWarning(id, requestedDomain, connectionId, 'pull request sweeps')],
|
|
1156
|
+
fetchFailed: true,
|
|
1157
|
+
truncated: false,
|
|
1158
|
+
providerId: id,
|
|
1159
|
+
failedProvider: true,
|
|
1160
|
+
};
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
const integration = await this.getIntegrationForRead(id, connectionId, requestedDomain);
|
|
1164
|
+
if (integration == null) {
|
|
1165
|
+
// A requested connection that can't be resolved is a broken connection — surface it as a
|
|
1166
|
+
// warning + fetchFailed rather than dropping the provider's slice silently.
|
|
1167
|
+
const early = this.earlyReturnConnectionWarnings(id, connectionId, requestedDomain);
|
|
1168
|
+
if (early.warnings.length === 0 && !attributeUnavailableProviders) return undefined;
|
|
1169
|
+
return {
|
|
1170
|
+
items: [] as PullRequestShape[],
|
|
1171
|
+
warnings:
|
|
1172
|
+
early.warnings.length !== 0
|
|
1173
|
+
? early.warnings
|
|
1174
|
+
: [noConnectionWarning(id, requestedDomain, connectionId)],
|
|
1175
|
+
fetchFailed: true,
|
|
1176
|
+
truncated: false,
|
|
1177
|
+
providerId: id,
|
|
1178
|
+
failedProvider: true,
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
if (!isGitHostIntegration(integration)) {
|
|
1183
|
+
return {
|
|
1184
|
+
items: [] as PullRequestShape[],
|
|
1185
|
+
warnings: [gitHostOnlySurfaceWarning(id, requestedDomain, connectionId, 'pull request sweeps')],
|
|
1186
|
+
fetchFailed: true,
|
|
1187
|
+
truncated: false,
|
|
1188
|
+
providerId: id,
|
|
1189
|
+
failedProvider: true,
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
await this.forceRefreshIfRequested(integration, options?.forceSync, connectionId);
|
|
1194
|
+
|
|
1195
|
+
const domain = this.domainForRead(integration, id, connectionId, requestedDomain);
|
|
1196
|
+
const accountWide = repos.length === 0;
|
|
1197
|
+
const requestedFilters = target.filters ?? options?.filters;
|
|
1198
|
+
const resolved = accountWide
|
|
1199
|
+
? resolveAccountWidePullRequestFilters(id, requestedFilters)
|
|
1200
|
+
: resolvePullRequestFilters(id, requestedFilters);
|
|
1201
|
+
if (resolved.unsupported) {
|
|
1202
|
+
return {
|
|
1203
|
+
items: [] as PullRequestShape[],
|
|
1204
|
+
warnings: [
|
|
1205
|
+
accountWide
|
|
1206
|
+
? unsupportedAccountWidePullRequestFiltersWarning(
|
|
1207
|
+
id,
|
|
1208
|
+
domain,
|
|
1209
|
+
connectionId,
|
|
1210
|
+
requestedFilters ?? [],
|
|
1211
|
+
)
|
|
1212
|
+
: unsupportedFiltersWarning(id, domain, connectionId),
|
|
1213
|
+
],
|
|
1214
|
+
fetchFailed: true,
|
|
1215
|
+
truncated: false,
|
|
1216
|
+
providerId: id,
|
|
1217
|
+
failedProvider: true,
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
const drain = await drainPullRequests(
|
|
1222
|
+
integration,
|
|
1223
|
+
id,
|
|
1224
|
+
domain,
|
|
1225
|
+
repos,
|
|
1226
|
+
options?.states,
|
|
1227
|
+
resolved.filters,
|
|
1228
|
+
accountWide ? (options?.includeReviewRequested ?? false) : false,
|
|
1229
|
+
connectionId,
|
|
1230
|
+
maxPages,
|
|
1231
|
+
attributeUnavailableProviders,
|
|
1232
|
+
);
|
|
1233
|
+
const currentAccountId = drain.items.some(pr => pr.author != null)
|
|
1234
|
+
? await getCurrentAccountId(integration, connectionId)
|
|
1235
|
+
: undefined;
|
|
1236
|
+
// Normalize the raw provider-apis PRs to the GitLens-owned shape here, where the per-provider
|
|
1237
|
+
// `integration` (the mapper's provider reference) is in scope; the aggregation below only sees drains.
|
|
1238
|
+
return {
|
|
1239
|
+
...drain,
|
|
1240
|
+
items: drain.items.map(pr =>
|
|
1241
|
+
fromProviderPullRequest(pr, integration, { currentAccountId: currentAccountId }),
|
|
1242
|
+
),
|
|
1243
|
+
providerId: id,
|
|
1244
|
+
};
|
|
1245
|
+
});
|
|
1246
|
+
|
|
1247
|
+
const items: PullRequestShape[] = [];
|
|
1248
|
+
const warnings: ProviderWarning[] = [];
|
|
1249
|
+
const failedProviderIds = new Set<IntegrationIds>();
|
|
1250
|
+
const incompleteProviderIds = new Set<IntegrationIds>();
|
|
1251
|
+
let fetchFailed = false;
|
|
1252
|
+
let truncated = false;
|
|
1253
|
+
for (const drain of results) {
|
|
1254
|
+
if (drain == null) {
|
|
1255
|
+
continue;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
items.push(...drain.items);
|
|
1259
|
+
for (const w of drain.warnings) {
|
|
1260
|
+
appendDedupedWarning(warnings, w);
|
|
1261
|
+
}
|
|
1262
|
+
if (drain.fetchFailed) {
|
|
1263
|
+
fetchFailed = true;
|
|
1264
|
+
}
|
|
1265
|
+
if (drain.failedProvider) {
|
|
1266
|
+
failedProviderIds.add(drain.providerId);
|
|
1267
|
+
} else if (drain.fetchFailed || drain.truncated) {
|
|
1268
|
+
incompleteProviderIds.add(drain.providerId);
|
|
1269
|
+
}
|
|
1270
|
+
if (drain.truncated) {
|
|
1271
|
+
truncated = true;
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
return {
|
|
1276
|
+
items: items,
|
|
1277
|
+
warnings: warnings,
|
|
1278
|
+
// `allPages` asserts completeness — it must be false when any provider truncated (a single-page
|
|
1279
|
+
// account-wide read that couldn't confirm it drained everything) OR a drain aborted on a read
|
|
1280
|
+
// failure (its slice is incomplete). Either way the sweep did not read every page.
|
|
1281
|
+
page: {
|
|
1282
|
+
currentPage: 1,
|
|
1283
|
+
itemsPerPage: items.length,
|
|
1284
|
+
allPages: !truncated && !fetchFailed,
|
|
1285
|
+
truncated: truncated || undefined,
|
|
1286
|
+
},
|
|
1287
|
+
// A sweep drains every page itself and exposes no cursor to resume — so `hasMore` must be false even
|
|
1288
|
+
// when the read was incomplete. Terminal incompleteness is expressed through `page.truncated` +
|
|
1289
|
+
// `allPages: false` + warnings; setting `hasMore: true` here would make a consumer that drains while
|
|
1290
|
+
// `hasMore` re-run the identical sweep forever with no cursor to advance.
|
|
1291
|
+
hasMore: false,
|
|
1292
|
+
fetchFailed: fetchFailed || undefined,
|
|
1293
|
+
failedProviderIds: [...failedProviderIds],
|
|
1294
|
+
incompleteProviderIds: [...incompleteProviderIds],
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
/**
|
|
1299
|
+
* Closed/merged counterpart of {@link sweepPullRequests}, feeding Kepler's Kanban "done" column. Applies
|
|
1300
|
+
* the native cross-provider state filter (`Closed` + `Merged`) so it works beyond GitHub.
|
|
1301
|
+
*/
|
|
1302
|
+
async sweepClosedPullRequests(
|
|
1303
|
+
options?: ClosedPullRequestSweepOptions,
|
|
1304
|
+
): Promise<ProviderSweepResult<PullRequestShape>> {
|
|
1305
|
+
return this.sweepPullRequests({
|
|
1306
|
+
...options,
|
|
1307
|
+
states: ['closed', 'merged'],
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* Broadens the user's issues by fanning out over the supplied orgs: for each org it lists the org's
|
|
1313
|
+
* repositories, then reads that org's issues. A per-org failure becomes a warning without failing the
|
|
1314
|
+
* whole fan-out. `broadenedProviderIds` lists the distinct providers whose issue read resolved (even
|
|
1315
|
+
* if every issue duplicated a baseline). `failedProviderIds` identifies providers with no usable org;
|
|
1316
|
+
* `incompleteProviderIds` identifies providers with both a usable org and a failed/truncated sibling.
|
|
1317
|
+
* `fanOutCount` is the number of org work items spawned.
|
|
1318
|
+
* Each org may carry its own `connectionId` (and, for a self-managed host with no configured connection, its
|
|
1319
|
+
* own `domain`) to target a specific account — the fan-out spans providers, so the target is scoped per org
|
|
1320
|
+
* rather than globally.
|
|
1321
|
+
*/
|
|
1322
|
+
async broadenIssues(options: {
|
|
1323
|
+
orgs: ProviderBroadenOrg[];
|
|
1324
|
+
page?: number;
|
|
1325
|
+
cursor?: string;
|
|
1326
|
+
forceSync?: boolean;
|
|
1327
|
+
}): Promise<ProviderBroadenResult<IssueShape>> {
|
|
1328
|
+
const page = Math.max(1, Math.trunc(options.page ?? 1));
|
|
1329
|
+
|
|
1330
|
+
// Kepler's existing contract persists only a page number. When no opaque continuation was supplied,
|
|
1331
|
+
// advance through prior pages internally so cursor-only providers still return the requested page.
|
|
1332
|
+
// Each recursive call below carries a cursor, so it bypasses this block and performs exactly one round.
|
|
1333
|
+
if (options.cursor == null && page > 1) {
|
|
1334
|
+
let cursor: string | undefined;
|
|
1335
|
+
let previous: ProviderBroadenResult<IssueShape> | undefined;
|
|
1336
|
+
const traversalWarnings: ProviderWarning[] = [];
|
|
1337
|
+
const broadenedProviderIds = new Set<IntegrationIds>();
|
|
1338
|
+
const failedProviderIds = new Set<IntegrationIds>();
|
|
1339
|
+
const incompleteProviderIds = new Set<IntegrationIds>();
|
|
1340
|
+
const mergeProviderAttribution = (result: ProviderBroadenResult<IssueShape>): void => {
|
|
1341
|
+
for (const providerId of result.failedProviderIds) {
|
|
1342
|
+
if (broadenedProviderIds.has(providerId) || result.broadenedProviderIds.includes(providerId)) {
|
|
1343
|
+
incompleteProviderIds.add(providerId);
|
|
1344
|
+
} else {
|
|
1345
|
+
failedProviderIds.add(providerId);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
for (const providerId of result.incompleteProviderIds) {
|
|
1349
|
+
failedProviderIds.delete(providerId);
|
|
1350
|
+
incompleteProviderIds.add(providerId);
|
|
1351
|
+
}
|
|
1352
|
+
for (const providerId of result.broadenedProviderIds) {
|
|
1353
|
+
broadenedProviderIds.add(providerId);
|
|
1354
|
+
if (failedProviderIds.delete(providerId)) {
|
|
1355
|
+
incompleteProviderIds.add(providerId);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
let traversalFetchFailed = false;
|
|
1360
|
+
let traversalTruncated = false;
|
|
1361
|
+
for (let currentPage = 1; currentPage < page; currentPage++) {
|
|
1362
|
+
previous = await this.broadenIssues({
|
|
1363
|
+
...options,
|
|
1364
|
+
page: currentPage,
|
|
1365
|
+
cursor: cursor,
|
|
1366
|
+
// A forced refresh belongs to the logical read, not every cursor-advancement round.
|
|
1367
|
+
forceSync: currentPage === 1 ? options.forceSync : false,
|
|
1368
|
+
});
|
|
1369
|
+
for (const warning of previous.warnings) {
|
|
1370
|
+
appendDedupedWarning(traversalWarnings, warning);
|
|
1371
|
+
}
|
|
1372
|
+
mergeProviderAttribution(previous);
|
|
1373
|
+
traversalFetchFailed ||= previous.fetchFailed === true;
|
|
1374
|
+
traversalTruncated ||= previous.page.truncated === true;
|
|
1375
|
+
if (!previous.hasMore || previous.cursor == null) {
|
|
1376
|
+
return {
|
|
1377
|
+
items: [],
|
|
1378
|
+
warnings: traversalWarnings,
|
|
1379
|
+
page: {
|
|
1380
|
+
currentPage: page,
|
|
1381
|
+
itemsPerPage: 0,
|
|
1382
|
+
truncated: traversalTruncated || undefined,
|
|
1383
|
+
},
|
|
1384
|
+
hasMore: false,
|
|
1385
|
+
fetchFailed: traversalFetchFailed || undefined,
|
|
1386
|
+
broadenedProviderIds: [...broadenedProviderIds],
|
|
1387
|
+
failedProviderIds: [...failedProviderIds],
|
|
1388
|
+
incompleteProviderIds: [...incompleteProviderIds],
|
|
1389
|
+
fanOutCount: options.orgs.length,
|
|
1390
|
+
};
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
cursor = previous.cursor;
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
const requested = await this.broadenIssues({ ...options, page: page, cursor: cursor, forceSync: false });
|
|
1397
|
+
for (const warning of requested.warnings) {
|
|
1398
|
+
appendDedupedWarning(traversalWarnings, warning);
|
|
1399
|
+
}
|
|
1400
|
+
mergeProviderAttribution(requested);
|
|
1401
|
+
return {
|
|
1402
|
+
...requested,
|
|
1403
|
+
warnings: traversalWarnings,
|
|
1404
|
+
page: {
|
|
1405
|
+
...requested.page,
|
|
1406
|
+
truncated: traversalTruncated || requested.page.truncated === true || undefined,
|
|
1407
|
+
},
|
|
1408
|
+
fetchFailed: traversalFetchFailed || requested.fetchFailed === true || undefined,
|
|
1409
|
+
broadenedProviderIds: [...broadenedProviderIds],
|
|
1410
|
+
failedProviderIds: [...failedProviderIds],
|
|
1411
|
+
incompleteProviderIds: [...incompleteProviderIds],
|
|
1412
|
+
};
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
const results = await mapBounded(options.orgs, providerFanOutConcurrency, async org => {
|
|
1416
|
+
const connectionId = org.connectionId;
|
|
1417
|
+
const requestedDomain = org.domain;
|
|
1418
|
+
const cursorDomain = hostFromDomain(requestedDomain) ?? requestedDomain;
|
|
1419
|
+
// An org slice that yielded no issues and has nothing to continue: the org's identity (which the
|
|
1420
|
+
// aggregation below keys the per-org cursor bundle by) plus why it produced nothing. `exhausted` marks
|
|
1421
|
+
// an org a prior round already drained, so it stays skipped rather than being re-read from page 1.
|
|
1422
|
+
const barrenSlice = (
|
|
1423
|
+
warnings: ProviderWarning[],
|
|
1424
|
+
flags?: { exhausted?: boolean; fetchFailed?: boolean; truncated?: boolean },
|
|
1425
|
+
) => ({
|
|
1426
|
+
items: [] as IssueShape[],
|
|
1427
|
+
warnings: warnings,
|
|
1428
|
+
broadenedProviderIds: [] as IntegrationIds[],
|
|
1429
|
+
providerId: org.providerId,
|
|
1430
|
+
org: org.name,
|
|
1431
|
+
connectionId: connectionId,
|
|
1432
|
+
domain: cursorDomain,
|
|
1433
|
+
nextCursor: undefined as string | undefined,
|
|
1434
|
+
hasMore: false,
|
|
1435
|
+
exhausted: flags?.exhausted ?? false,
|
|
1436
|
+
fetchFailed: flags?.fetchFailed ?? false,
|
|
1437
|
+
truncated: flags?.truncated ?? false,
|
|
1438
|
+
});
|
|
1439
|
+
|
|
1440
|
+
if (isIssuesHostIntegrationId(org.providerId)) {
|
|
1441
|
+
return barrenSlice(
|
|
1442
|
+
[gitHostOnlySurfaceWarning(org.providerId, requestedDomain, connectionId, 'issue broadening')],
|
|
1443
|
+
{ fetchFailed: true },
|
|
1444
|
+
);
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
const integration = await this.getIntegrationForRead(org.providerId, connectionId, requestedDomain);
|
|
1448
|
+
if (integration == null) {
|
|
1449
|
+
// A requested connection or domain that can't be resolved is a broken target — surface it as a
|
|
1450
|
+
// warning + fetchFailed rather than dropping the org silently.
|
|
1451
|
+
const early = this.earlyReturnConnectionWarnings(org.providerId, connectionId, requestedDomain);
|
|
1452
|
+
return barrenSlice(
|
|
1453
|
+
early.warnings.length > 0
|
|
1454
|
+
? early.warnings
|
|
1455
|
+
: [noConnectionWarning(org.providerId, requestedDomain, connectionId)],
|
|
1456
|
+
{ fetchFailed: true },
|
|
1457
|
+
);
|
|
1458
|
+
}
|
|
1459
|
+
if (!isGitHostIntegration(integration)) {
|
|
1460
|
+
return barrenSlice(
|
|
1461
|
+
[gitHostOnlySurfaceWarning(org.providerId, requestedDomain, connectionId, 'issue broadening')],
|
|
1462
|
+
{ fetchFailed: true },
|
|
1463
|
+
);
|
|
1464
|
+
}
|
|
1465
|
+
// A git host whose issue tracker is deprecated (Bitbucket) exposes no issues here — surface a
|
|
1466
|
+
// warning + fetchFailed and skip it (no repo drain), so broadening never serves a legacy source.
|
|
1467
|
+
if (!integration.supportsIssues) {
|
|
1468
|
+
return barrenSlice(
|
|
1469
|
+
[
|
|
1470
|
+
issuesUnsupportedWarning(
|
|
1471
|
+
org.providerId,
|
|
1472
|
+
this.domainForRead(integration, org.providerId, connectionId, requestedDomain),
|
|
1473
|
+
connectionId,
|
|
1474
|
+
),
|
|
1475
|
+
],
|
|
1476
|
+
{ fetchFailed: true },
|
|
1477
|
+
);
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
// An org a prior round already drained must not be re-read: cursor-only providers would answer a
|
|
1481
|
+
// fresh page-1 request with their first page again, duplicating issues across rounds. Skip it
|
|
1482
|
+
// before any work (including the repo drain) and keep it marked exhausted so it stays skipped
|
|
1483
|
+
// for the rest of the fan-out.
|
|
1484
|
+
if (isBroadenIssuesOrgExhausted(options.cursor, org, options.orgs.length)) {
|
|
1485
|
+
return barrenSlice([], { exhausted: true });
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
await this.forceRefreshIfRequested(integration, options.forceSync, connectionId);
|
|
1489
|
+
|
|
1490
|
+
const domain = this.domainForRead(integration, org.providerId, connectionId, requestedDomain);
|
|
1491
|
+
const reposDrain = await drainRepositories(
|
|
1492
|
+
integration,
|
|
1493
|
+
org.providerId,
|
|
1494
|
+
domain,
|
|
1495
|
+
org.name,
|
|
1496
|
+
undefined,
|
|
1497
|
+
connectionId,
|
|
1498
|
+
100,
|
|
1499
|
+
);
|
|
1500
|
+
const warnings: ProviderWarning[] = [...reposDrain.warnings];
|
|
1501
|
+
const fetchFailed = reposDrain.fetchFailed;
|
|
1502
|
+
const truncated = reposDrain.truncated;
|
|
1503
|
+
|
|
1504
|
+
const repos: ProviderReposInput = reposDrain.repos.map(r => ({ ...r }));
|
|
1505
|
+
if (repos.length === 0) {
|
|
1506
|
+
return barrenSlice(warnings, { fetchFailed: fetchFailed, truncated: truncated });
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
// Broaden = "all visible": drop the assigned-to-me filter so unassigned issues are included.
|
|
1510
|
+
const cursor = getBroadenIssuesCursor(options.cursor, org, page, options.orgs.length);
|
|
1511
|
+
const issuesCaptured = await runCaptured(
|
|
1512
|
+
org.providerId,
|
|
1513
|
+
domain,
|
|
1514
|
+
connectionId,
|
|
1515
|
+
() =>
|
|
1516
|
+
// Normalized shapes seam, uniform with listIssuesPage.
|
|
1517
|
+
integration.getMyIssuesForReposAsShapesResult(
|
|
1518
|
+
repos,
|
|
1519
|
+
{
|
|
1520
|
+
includeAllAssignees: true,
|
|
1521
|
+
cursor: cursor,
|
|
1522
|
+
},
|
|
1523
|
+
connectionId,
|
|
1524
|
+
),
|
|
1525
|
+
{ warnOnMissingSession: true },
|
|
1526
|
+
);
|
|
1527
|
+
if (issuesCaptured.warning != null) {
|
|
1528
|
+
warnings.push(issuesCaptured.warning);
|
|
1529
|
+
}
|
|
1530
|
+
const issuesAssessment = mergeAssessmentInto(
|
|
1531
|
+
warnings,
|
|
1532
|
+
org.providerId,
|
|
1533
|
+
domain,
|
|
1534
|
+
connectionId,
|
|
1535
|
+
issuesCaptured.value?.metadata,
|
|
1536
|
+
);
|
|
1537
|
+
let issuesFetchFailed =
|
|
1538
|
+
issuesAssessment.fetchFailed || (issuesCaptured.warning != null && issuesCaptured.value == null);
|
|
1539
|
+
const items: IssueShape[] = [];
|
|
1540
|
+
let hasMore = false;
|
|
1541
|
+
let nextCursor: string | undefined;
|
|
1542
|
+
let retryPage: number | undefined;
|
|
1543
|
+
// Carry a truncation signal from the issue read too: a provider that couldn't confirm it drained
|
|
1544
|
+
// a repo (`paging.truncated`) means this org's issues may be incomplete, on top of any repo-drain
|
|
1545
|
+
// truncation already captured above.
|
|
1546
|
+
let issuesTruncated = false;
|
|
1547
|
+
if (issuesCaptured.value != null) {
|
|
1548
|
+
items.push(...issuesCaptured.value.values);
|
|
1549
|
+
const paged = toProviderPageInfo(issuesCaptured.value.values.length, issuesCaptured.value.paging);
|
|
1550
|
+
// An org that reports another page but no usable cursor can't be resumed: it would neither be
|
|
1551
|
+
// recorded in the composite cursor nor marked exhausted, so the next round would re-read its
|
|
1552
|
+
// page 1 and repeat every issue. Treat it as terminal-but-incomplete (which also marks the org
|
|
1553
|
+
// exhausted below, since `exhausted` keys off `!hasMore`).
|
|
1554
|
+
const continuation = resolveContinuation(paged, undefined);
|
|
1555
|
+
hasMore = continuation.hasMore;
|
|
1556
|
+
nextCursor = continuation.cursor;
|
|
1557
|
+
issuesTruncated = continuation.truncated || issuesAssessment.truncated;
|
|
1558
|
+
} else if (issuesCaptured.warning != null || cursor != null) {
|
|
1559
|
+
// Keep the exact position that failed. Without this retry cursor a multi-org continuation would
|
|
1560
|
+
// omit this org from the bundle, then synthesize the next numbered page and silently skip the
|
|
1561
|
+
// failed page. The synthesized page cursor is also actionable for a first-page cursor-only read:
|
|
1562
|
+
// that provider ignores the page marker and retries its first page. A retry slot alone is NOT
|
|
1563
|
+
// forward progress, though: advertising `hasMore` for a persistent failure would make an infinite
|
|
1564
|
+
// query request it forever. Healthy sibling continuations set `hasMore` independently.
|
|
1565
|
+
if (cursor != null) {
|
|
1566
|
+
nextCursor = cursor;
|
|
1567
|
+
if (issuesCaptured.warning == null) {
|
|
1568
|
+
appendDedupedWarning(
|
|
1569
|
+
warnings,
|
|
1570
|
+
otherWarning(
|
|
1571
|
+
org.providerId,
|
|
1572
|
+
domain,
|
|
1573
|
+
connectionId,
|
|
1574
|
+
'Issue continuation returned no result and must be retried',
|
|
1575
|
+
),
|
|
1576
|
+
);
|
|
1577
|
+
issuesFetchFailed = true;
|
|
1578
|
+
issuesTruncated = true;
|
|
1579
|
+
}
|
|
1580
|
+
} else {
|
|
1581
|
+
retryPage = page;
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
return {
|
|
1586
|
+
items: items,
|
|
1587
|
+
warnings: warnings,
|
|
1588
|
+
broadenedProviderIds: issuesCaptured.value != null ? [org.providerId] : ([] as IntegrationIds[]),
|
|
1589
|
+
providerId: org.providerId,
|
|
1590
|
+
org: org.name,
|
|
1591
|
+
connectionId: connectionId,
|
|
1592
|
+
domain: cursorDomain,
|
|
1593
|
+
nextCursor: nextCursor,
|
|
1594
|
+
retryPage: retryPage,
|
|
1595
|
+
hasMore: hasMore,
|
|
1596
|
+
// Exhausted once a successful read reports no more pages — recorded in the cursor so later
|
|
1597
|
+
// rounds skip it while other orgs keep paging.
|
|
1598
|
+
exhausted: issuesCaptured.value != null && !hasMore,
|
|
1599
|
+
fetchFailed: fetchFailed || issuesFetchFailed,
|
|
1600
|
+
truncated: truncated || issuesTruncated,
|
|
1601
|
+
};
|
|
1602
|
+
});
|
|
1603
|
+
|
|
1604
|
+
const items: IssueShape[] = [];
|
|
1605
|
+
const warnings: ProviderWarning[] = [];
|
|
1606
|
+
const broadenedProviderIds = new Set<IntegrationIds>();
|
|
1607
|
+
const problemProviderIds = new Set<IntegrationIds>();
|
|
1608
|
+
const cursors: {
|
|
1609
|
+
providerId: IntegrationIds;
|
|
1610
|
+
org: string;
|
|
1611
|
+
connectionId?: string;
|
|
1612
|
+
domain?: string;
|
|
1613
|
+
cursor?: string;
|
|
1614
|
+
retryPage?: number;
|
|
1615
|
+
}[] = [];
|
|
1616
|
+
const exhausted: { providerId: IntegrationIds; org: string; connectionId?: string; domain?: string }[] = [];
|
|
1617
|
+
let hasMore = false;
|
|
1618
|
+
let fetchFailed = false;
|
|
1619
|
+
let truncated = false;
|
|
1620
|
+
for (const result of results) {
|
|
1621
|
+
if (result == null) {
|
|
1622
|
+
continue;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
items.push(...result.items);
|
|
1626
|
+
warnings.push(...result.warnings);
|
|
1627
|
+
for (const id of result.broadenedProviderIds) {
|
|
1628
|
+
broadenedProviderIds.add(id);
|
|
1629
|
+
}
|
|
1630
|
+
const retryPage = 'retryPage' in result ? result.retryPage : undefined;
|
|
1631
|
+
if (result.nextCursor != null || retryPage != null) {
|
|
1632
|
+
cursors.push({
|
|
1633
|
+
providerId: result.providerId,
|
|
1634
|
+
org: result.org,
|
|
1635
|
+
connectionId: result.connectionId,
|
|
1636
|
+
domain: result.domain,
|
|
1637
|
+
cursor: result.nextCursor,
|
|
1638
|
+
retryPage: retryPage,
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
if (result.exhausted) {
|
|
1642
|
+
exhausted.push({
|
|
1643
|
+
providerId: result.providerId,
|
|
1644
|
+
org: result.org,
|
|
1645
|
+
connectionId: result.connectionId,
|
|
1646
|
+
domain: result.domain,
|
|
1647
|
+
});
|
|
1648
|
+
}
|
|
1649
|
+
if (result.hasMore) {
|
|
1650
|
+
hasMore = true;
|
|
1651
|
+
}
|
|
1652
|
+
if (result.fetchFailed) {
|
|
1653
|
+
fetchFailed = true;
|
|
1654
|
+
}
|
|
1655
|
+
if (result.truncated) {
|
|
1656
|
+
truncated = true;
|
|
1657
|
+
}
|
|
1658
|
+
if (result.fetchFailed || result.truncated) {
|
|
1659
|
+
problemProviderIds.add(result.providerId);
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
const cursor = toBroadenIssuesCursor(cursors, exhausted, options.orgs.length);
|
|
1664
|
+
const failedProviderIds: IntegrationIds[] = [];
|
|
1665
|
+
const incompleteProviderIds: IntegrationIds[] = [];
|
|
1666
|
+
for (const providerId of problemProviderIds) {
|
|
1667
|
+
if (broadenedProviderIds.has(providerId)) {
|
|
1668
|
+
incompleteProviderIds.push(providerId);
|
|
1669
|
+
} else {
|
|
1670
|
+
failedProviderIds.push(providerId);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
return {
|
|
1674
|
+
items: items,
|
|
1675
|
+
warnings: warnings,
|
|
1676
|
+
// `currentPage` is positional, per ProviderPageInfo.currentPage: this fan-out has no provider-reported
|
|
1677
|
+
// page of its own (its cursor is a per-org bundle, not a page), so the position is the one the caller
|
|
1678
|
+
// addressed — the `page` it supplied, or the page the internal traversal advanced to.
|
|
1679
|
+
page: { currentPage: page, itemsPerPage: items.length, truncated: truncated || undefined },
|
|
1680
|
+
// `hasMore` promises a resumable continuation, so it must be true ONLY when a real cursor was
|
|
1681
|
+
// produced. Repo-drain truncation (a backstop hit with no persisted repo cursor) can't be resumed —
|
|
1682
|
+
// re-invoking would re-drain the same repos and repeat issues — so it is surfaced as the terminal
|
|
1683
|
+
// `page.truncated` incompleteness signal instead of `hasMore`, matching listRepos. Guard `hasMore`
|
|
1684
|
+
// against a missing cursor so we never advertise a continuation the caller can't make.
|
|
1685
|
+
hasMore: hasMore && cursor != null,
|
|
1686
|
+
cursor: cursor,
|
|
1687
|
+
fetchFailed: fetchFailed || undefined,
|
|
1688
|
+
broadenedProviderIds: [...broadenedProviderIds],
|
|
1689
|
+
failedProviderIds: failedProviderIds,
|
|
1690
|
+
incompleteProviderIds: incompleteProviderIds,
|
|
1691
|
+
fanOutCount: options.orgs.length,
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
/**
|
|
1696
|
+
* Resolves a repository from a remote URL to its provider identity, using core-gitlens' remote matcher
|
|
1697
|
+
* plus the provider's `getRepo` (the equivalent of `gk repo resolve`). Supports every provider whose
|
|
1698
|
+
* client exposes `getRepo`. Per-request outcomes preserve the distinctions consumers need for their
|
|
1699
|
+
* canonicalization policy.
|
|
1700
|
+
*/
|
|
1701
|
+
async resolveRepository(options: {
|
|
1702
|
+
providerId?: IntegrationIds;
|
|
1703
|
+
remoteUrl: string;
|
|
1704
|
+
host?: string;
|
|
1705
|
+
connectionId?: string;
|
|
1706
|
+
/**
|
|
1707
|
+
* Explicit self-managed host domain used to select the integration instance. Used only when the requested
|
|
1708
|
+
* connection has no configured domain; it must come from the trusted authentication configuration, not
|
|
1709
|
+
* repository or remote data.
|
|
1710
|
+
*/
|
|
1711
|
+
domain?: string;
|
|
1712
|
+
}): Promise<ResolveRepositoryResult> {
|
|
1713
|
+
const result = (status: RepositoryResolution['status']): ResolveRepositoryResult => ({
|
|
1714
|
+
resolution: { status: status },
|
|
1715
|
+
});
|
|
1716
|
+
|
|
1717
|
+
const [scheme, parsedDomain, path] = parseGitRemoteUrl(options.remoteUrl);
|
|
1718
|
+
const parsedHost = hostFromDomain(parsedDomain);
|
|
1719
|
+
const explicitHost = hostFromDomain(options.host);
|
|
1720
|
+
if (parsedHost != null && explicitHost != null && parsedHost !== explicitHost) {
|
|
1721
|
+
return result('host-mismatch');
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
const matcherDomain = parsedDomain || options.host || '';
|
|
1725
|
+
|
|
1726
|
+
// An explicit cloud provider must agree with the remote's canonical cloud host. Without this guard the
|
|
1727
|
+
// synthetic matcher below can reinterpret, for example, a gitlab.com URL as GitHub and then resolve a
|
|
1728
|
+
// homonymous owner/repo through the wrong account. Match once without caller configs/synthetic entries;
|
|
1729
|
+
// Azure's matcher also normalizes ssh.dev.azure.com and vs-ssh.visualstudio.com to their web host.
|
|
1730
|
+
if (options.providerId != null && isGitCloudHostIntegrationId(options.providerId)) {
|
|
1731
|
+
const nativeProvider = createRemoteProviderMatcher([])(options.remoteUrl, matcherDomain, path, scheme);
|
|
1732
|
+
const nativeId = nativeProvider != null ? getIntegrationIdForRemote(nativeProvider) : undefined;
|
|
1733
|
+
const nativeDomain = nativeProvider?.domain ?? matcherDomain;
|
|
1734
|
+
const canonicalHost =
|
|
1735
|
+
options.providerId === GitCloudHostIntegrationId.GitHub
|
|
1736
|
+
? isGitHubDotCom(nativeDomain)
|
|
1737
|
+
: options.providerId === GitCloudHostIntegrationId.GitLab
|
|
1738
|
+
? isGitLabDotCom(nativeDomain)
|
|
1739
|
+
: options.providerId === GitCloudHostIntegrationId.Bitbucket
|
|
1740
|
+
? isBitbucketCloudDomain(nativeDomain)
|
|
1741
|
+
: isAzureCloudDomain(nativeDomain);
|
|
1742
|
+
if (nativeId !== options.providerId || !canonicalHost) return result('host-mismatch');
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
// Matcher configs: host remote configs (self-managed/custom domains) plus a synthetic entry for an
|
|
1746
|
+
// explicit providerId + host, so a custom domain still maps to the right provider for path parsing.
|
|
1747
|
+
const configs: RemoteProviderConfig[] = [];
|
|
1748
|
+
for (const cfg of this.ctx.config.getRemoteConfigs()) {
|
|
1749
|
+
const type = remoteProviderTypeForConfig(cfg.type);
|
|
1750
|
+
if (type == null) continue;
|
|
1751
|
+
|
|
1752
|
+
// Forward both domain- and regex-based custom remotes (carrying any protocol override), so a
|
|
1753
|
+
// regex-configured host resolves instead of falling through to `unsupported`.
|
|
1754
|
+
if (cfg.domain) {
|
|
1755
|
+
configs.push({ type: type, domain: cfg.domain, protocol: cfg.protocol });
|
|
1756
|
+
} else if (cfg.regex) {
|
|
1757
|
+
configs.push({ type: type, regex: cfg.regex, protocol: cfg.protocol });
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
if (options.providerId != null) {
|
|
1761
|
+
const type = remoteProviderTypeForIntegration(options.providerId);
|
|
1762
|
+
const domain = parsedDomain || options.host;
|
|
1763
|
+
if (type != null && domain) {
|
|
1764
|
+
// The synthetic exact-domain entry is unshifted to the front, so it wins the match over the
|
|
1765
|
+
// user's own config for the same host. Carry that config's protocol override across (matched by
|
|
1766
|
+
// domain or regex, mirroring `ignoreSSLErrors`) so a self-managed host configured for a custom
|
|
1767
|
+
// protocol — e.g. plain `http` — isn't silently downgraded to the provider default here.
|
|
1768
|
+
const lowerDomain = domain.toLowerCase();
|
|
1769
|
+
const protocol = configs.find(c => {
|
|
1770
|
+
if (c.type !== type) return false;
|
|
1771
|
+
if (c.domain != null) return c.domain.toLowerCase() === lowerDomain;
|
|
1772
|
+
|
|
1773
|
+
// Truthy (not just non-null): an empty regex would compile to a match-everything pattern.
|
|
1774
|
+
if (c.regex) {
|
|
1775
|
+
try {
|
|
1776
|
+
return new RegExp(c.regex, 'i').test(lowerDomain);
|
|
1777
|
+
} catch {
|
|
1778
|
+
return false;
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
return false;
|
|
1783
|
+
})?.protocol;
|
|
1784
|
+
configs.unshift({ type: type, domain: domain, protocol: protocol });
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
const provider = createRemoteProviderMatcher(configs)(options.remoteUrl, matcherDomain, path, scheme);
|
|
1789
|
+
if (provider == null) return result('invalid-remote-url');
|
|
1790
|
+
|
|
1791
|
+
let id = options.providerId ?? getIntegrationIdForRemote(provider);
|
|
1792
|
+
// Custom Azure DevOps Server domains matched via getRemoteConfigs return undefined from
|
|
1793
|
+
// getIntegrationIdForRemote because the provider is marked custom; map them to the server id so the
|
|
1794
|
+
// project-scoped lookup uses that host's configured connection and API base URL.
|
|
1795
|
+
if (id == null && provider.id === 'azure-devops' && provider.custom) {
|
|
1796
|
+
id = GitSelfManagedHostIntegrationId.AzureDevOpsServer;
|
|
1797
|
+
}
|
|
1798
|
+
if (id == null) return result('unsupported-provider');
|
|
1799
|
+
|
|
1800
|
+
const owner = provider.owner;
|
|
1801
|
+
const name = provider.repoName;
|
|
1802
|
+
if (owner == null || name == null) return result('invalid-remote-url');
|
|
1803
|
+
|
|
1804
|
+
// On a self-managed host, resolve only against a TRUSTED host: the pinned connection's configured
|
|
1805
|
+
// domain, the explicit `domain`, or — when neither was supplied — a configured host matching the
|
|
1806
|
+
// remote's. That last case keeps `remoteUrl` (repository-supplied) out of the trusted path: it selects
|
|
1807
|
+
// among hosts the user already authenticated and can never introduce a new one. Resolving `owner/repo`
|
|
1808
|
+
// against some other host's account would, if that host has the same owner/repo, return a confidently
|
|
1809
|
+
// wrong identity — and would seed the domain-keyed integration cache (never evicted before dispose) with
|
|
1810
|
+
// an entry derived from repository data.
|
|
1811
|
+
const urlHost = hostFromDomain(provider.domain);
|
|
1812
|
+
// Normalize BOTH sides before comparing: a stored connection domain is usually a full URL
|
|
1813
|
+
// (`https://git.example.com`) while `urlHost` is already a bare host, so a raw compare would fail on
|
|
1814
|
+
// scheme/trailing-slash alone and wrongly reject a correctly-configured connection.
|
|
1815
|
+
let trustedHost =
|
|
1816
|
+
options.connectionId != null || options.domain != null
|
|
1817
|
+
? hostFromDomain(this.resolveDomainForRead(id, options.connectionId, options.domain))
|
|
1818
|
+
: undefined;
|
|
1819
|
+
if (isGitSelfManagedHostIntegrationId(id)) {
|
|
1820
|
+
const configuredHosts = this.getConfigured(id).map(c => hostFromDomain(c.domain));
|
|
1821
|
+
if (trustedHost == null && urlHost != null) {
|
|
1822
|
+
trustedHost = configuredHosts.find(host => host === urlHost);
|
|
1823
|
+
}
|
|
1824
|
+
// A configured host that doesn't match the remote's is a genuine mismatch. With nothing configured
|
|
1825
|
+
// there is no host to mismatch against — it's simply not connected, so fall through to the
|
|
1826
|
+
// `unauthorized` path below (still WITHOUT resolving by the URL domain, so repo data can't seed the
|
|
1827
|
+
// cache).
|
|
1828
|
+
if (trustedHost == null && configuredHosts.length !== 0) return result('host-mismatch');
|
|
1829
|
+
if (trustedHost != null && urlHost != null && trustedHost !== urlHost) return result('host-mismatch');
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
let integration: Integration | undefined;
|
|
1833
|
+
try {
|
|
1834
|
+
// Resolve the instance through the trusted target (as `getIntegrationForRead` does):
|
|
1835
|
+
// `resolveReadSession` looks the session up against the instance's domain-scoped descriptor, so
|
|
1836
|
+
// selecting the instance by the URL domain could miss the session and degrade to `no-connection`.
|
|
1837
|
+
integration = isGitSelfManagedHostIntegrationId(id)
|
|
1838
|
+
? trustedHost != null
|
|
1839
|
+
? await this.getIntegrationForRead(id, options.connectionId, trustedHost)
|
|
1840
|
+
: undefined
|
|
1841
|
+
: await this.get(id, provider.domain);
|
|
1842
|
+
} catch {
|
|
1843
|
+
integration = undefined;
|
|
1844
|
+
}
|
|
1845
|
+
if (integration == null) {
|
|
1846
|
+
// Attach a warning, as the thrown-AuthenticationError branch below does: a consumer driving auth
|
|
1847
|
+
// recovery off `warning.kind` would otherwise get nothing for an unresolvable target.
|
|
1848
|
+
return {
|
|
1849
|
+
resolution: {
|
|
1850
|
+
status: 'unauthorized',
|
|
1851
|
+
warning: noConnectionWarning(id, provider.domain, options.connectionId),
|
|
1852
|
+
},
|
|
1853
|
+
};
|
|
1854
|
+
}
|
|
1855
|
+
// Issue trackers have no `getRepo` client; a git host without `getRepoFn` leaves `getRepoInfo`
|
|
1856
|
+
// undefined. Either way this provider can't resolve repositories.
|
|
1857
|
+
if (isIssuesIntegration(integration) || integration.getRepoInfo == null) {
|
|
1858
|
+
return result('unsupported-provider');
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
// Azure repos are org + project scoped; the remote provider exposes project as `providerDesc.repoDomain`.
|
|
1862
|
+
const project = provider.id === 'azure-devops' ? provider.providerDesc?.repoDomain : undefined;
|
|
1863
|
+
const domain = provider.domain;
|
|
1864
|
+
|
|
1865
|
+
// Azure's lookup is project-scoped and returns `undefined` without one, which the connection-gap branch
|
|
1866
|
+
// below would misreport as `unauthorized` (driving a pointless reconnect). A remote URL that carries no
|
|
1867
|
+
// project simply can't address an Azure repo.
|
|
1868
|
+
if (provider.id === 'azure-devops' && project == null) return result('invalid-remote-url');
|
|
1869
|
+
|
|
1870
|
+
try {
|
|
1871
|
+
const repo = await integration.getRepoInfo({
|
|
1872
|
+
owner: owner,
|
|
1873
|
+
name: name,
|
|
1874
|
+
project: project,
|
|
1875
|
+
connectionId: options.connectionId,
|
|
1876
|
+
});
|
|
1877
|
+
if (repo == null) {
|
|
1878
|
+
// `getRepoInfo` returns undefined only when no session could be resolved (not connected, or the
|
|
1879
|
+
// requested connection is gone) — a real 404 throws below. So this is a connection gap. Attach a
|
|
1880
|
+
// warning so a consumer driving auth recovery off `warning.kind` sees the same signal it gets from
|
|
1881
|
+
// the thrown-AuthenticationError branch below; without it, the most common unauthorized case is
|
|
1882
|
+
// silent.
|
|
1883
|
+
return {
|
|
1884
|
+
resolution: {
|
|
1885
|
+
status: 'unauthorized',
|
|
1886
|
+
warning: noConnectionWarning(id, domain, options.connectionId),
|
|
1887
|
+
},
|
|
1888
|
+
};
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
// Prefer the provider's canonical namespace/name (GitHub's REST/GraphQL lookup follows the 301
|
|
1892
|
+
// rename redirect, so a stale old name resolves to the new canonical identity), falling back to the
|
|
1893
|
+
// parsed remote when the response omits them. `renamed` is a case-insensitive compare of input vs
|
|
1894
|
+
// canonical, mirroring gkcli's `EqualFold`, so hosts that merely echo the input casing (e.g.
|
|
1895
|
+
// Bitbucket Server/Azure) don't get spuriously flagged.
|
|
1896
|
+
const canonicalOwner = repo.namespace || owner;
|
|
1897
|
+
const canonicalName = repo.name || name;
|
|
1898
|
+
const renamed =
|
|
1899
|
+
canonicalOwner.toLowerCase() !== owner.toLowerCase() ||
|
|
1900
|
+
canonicalName.toLowerCase() !== name.toLowerCase();
|
|
1901
|
+
|
|
1902
|
+
const identity: RepositoryIdentity = {
|
|
1903
|
+
providerId: id,
|
|
1904
|
+
domain: domain,
|
|
1905
|
+
owner: canonicalOwner,
|
|
1906
|
+
name: canonicalName,
|
|
1907
|
+
project: project,
|
|
1908
|
+
remoteUrl: options.remoteUrl,
|
|
1909
|
+
renamed: renamed,
|
|
1910
|
+
};
|
|
1911
|
+
return { resolution: { status: 'resolved', identity: identity } };
|
|
1912
|
+
} catch (ex) {
|
|
1913
|
+
// Order matters: 404 throws RequestNotFoundError (not `undefined`), so check not-found before auth
|
|
1914
|
+
// and before the generic 5xx/unknown bucket — never classify a 401/403 as not-found.
|
|
1915
|
+
let resolution: RepositoryResolution;
|
|
1916
|
+
if (ex instanceof RequestNotFoundError) {
|
|
1917
|
+
resolution = { status: 'not-found' };
|
|
1918
|
+
} else if (ex instanceof AuthenticationError) {
|
|
1919
|
+
resolution = {
|
|
1920
|
+
status: 'unauthorized',
|
|
1921
|
+
warning: toProviderWarning(id, domain, options.connectionId, ex),
|
|
1922
|
+
};
|
|
1923
|
+
} else {
|
|
1924
|
+
resolution = {
|
|
1925
|
+
status: 'undetermined',
|
|
1926
|
+
warning: toProviderWarning(id, domain, options.connectionId, ex),
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
return { resolution: resolution };
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
// #endregion ProviderBackend surface (#5438)
|
|
1934
|
+
|
|
720
1935
|
private _ignoreSSLErrors = new Map<string, boolean | 'force'>();
|
|
721
1936
|
ignoreSSLErrors(integration: GitHostIntegration | { id: IntegrationIds; domain?: string }): boolean | 'force' {
|
|
722
1937
|
if (this.ctx.http.isWeb) return false;
|
|
723
1938
|
|
|
724
|
-
|
|
1939
|
+
// Key by id + domain: the config lookup is domain-scoped, so a value computed for one self-managed
|
|
1940
|
+
// domain must not be reused for another domain of the same provider.
|
|
1941
|
+
const cacheKey = `${integration.id}:${integration.domain ?? ''}`;
|
|
1942
|
+
let ignoreSSLErrors = this._ignoreSSLErrors.get(cacheKey);
|
|
725
1943
|
if (ignoreSSLErrors === undefined) {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
1944
|
+
// Normalize both sides to a RemoteProviderId before comparing: a lowercased config type
|
|
1945
|
+
// (e.g. `AzureDevOps` → `azuredevops`, `BitbucketServer` → `bitbucketserver`) does not equal the
|
|
1946
|
+
// integration id (`azureDevOps`, `bitbucket-server`), so a plain `toLowerCase()` compare misses them.
|
|
1947
|
+
const integrationRemoteType = remoteProviderTypeForIntegration(integration.id);
|
|
1948
|
+
const cfg = this.ctx.config.getRemoteConfigs().find(remote => {
|
|
1949
|
+
if (integration.domain == null || integrationRemoteType == null) return false;
|
|
1950
|
+
if (remoteProviderTypeForConfig(remote.type) !== integrationRemoteType) return false;
|
|
1951
|
+
// Match domain- and regex-based remotes alike, so `ignoreSSLErrors` applies to a regex-configured
|
|
1952
|
+
// self-managed host too (mirrors the matcher's own regex handling).
|
|
1953
|
+
if (remote.domain != null) return remote.domain === integration.domain;
|
|
1954
|
+
|
|
1955
|
+
// Truthy (not just non-null): an empty regex would compile to a match-everything pattern.
|
|
1956
|
+
if (remote.regex) {
|
|
1957
|
+
try {
|
|
1958
|
+
return new RegExp(remote.regex, 'i').test(integration.domain);
|
|
1959
|
+
} catch {
|
|
1960
|
+
return false;
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
return false;
|
|
1964
|
+
});
|
|
729
1965
|
ignoreSSLErrors = cfg?.ignoreSSLErrors ?? false;
|
|
730
|
-
this._ignoreSSLErrors.set(
|
|
1966
|
+
this._ignoreSSLErrors.set(cacheKey, ignoreSSLErrors);
|
|
731
1967
|
}
|
|
732
1968
|
|
|
733
1969
|
return ignoreSSLErrors;
|
|
@@ -835,7 +2071,16 @@ export class IntegrationService implements Disposable {
|
|
|
835
2071
|
).ProvidersApi(authenticationService);
|
|
836
2072
|
}
|
|
837
2073
|
|
|
838
|
-
|
|
2074
|
+
// Never keep a rejected promise cached: a single failure (a module-resolution error, a transient
|
|
2075
|
+
// construction failure) would otherwise poison every `ProvidersApi` read for the lifetime of the
|
|
2076
|
+
// service, so consumers get instant empty results with no way to recover short of a restart.
|
|
2077
|
+
const loading = (this._providersApi = load());
|
|
2078
|
+
void loading.catch(() => {
|
|
2079
|
+
// Only clear our own attempt, so a newer load already in flight isn't dropped
|
|
2080
|
+
if (this._providersApi === loading) {
|
|
2081
|
+
this._providersApi = undefined;
|
|
2082
|
+
}
|
|
2083
|
+
});
|
|
839
2084
|
}
|
|
840
2085
|
|
|
841
2086
|
return this._providersApi;
|
|
@@ -852,25 +2097,64 @@ export class IntegrationService implements Disposable {
|
|
|
852
2097
|
return isGitSelfManagedHostIntegrationId(id) ? (`${id}:${domain}` as const) : id;
|
|
853
2098
|
}
|
|
854
2099
|
|
|
855
|
-
private async *getSupportedCloudIntegrations(
|
|
2100
|
+
private async *getSupportedCloudIntegrations(
|
|
2101
|
+
domainsById: Map<IntegrationIds, Set<string>>,
|
|
2102
|
+
): AsyncIterable<Integration> {
|
|
856
2103
|
for (const id of getSupportedCloudIntegrationIds()) {
|
|
857
|
-
if (isCloudGitSelfManagedHostIntegrationId(id)
|
|
858
|
-
|
|
859
|
-
const
|
|
860
|
-
|
|
861
|
-
|
|
2104
|
+
if (isCloudGitSelfManagedHostIntegrationId(id)) {
|
|
2105
|
+
const domains = new Set(domainsById.get(id) ?? []);
|
|
2106
|
+
for (const domain of this.configuredIntegrationService
|
|
2107
|
+
.getConfigured(id, { cloud: true })
|
|
2108
|
+
.map(c => c.domain)
|
|
2109
|
+
.filter((domain): domain is string => domain != null && domain.length > 0)) {
|
|
2110
|
+
domains.add(hostFromDomain(domain) ?? domain);
|
|
862
2111
|
}
|
|
863
|
-
|
|
864
|
-
|
|
2112
|
+
|
|
2113
|
+
if (domains.size !== 0) {
|
|
2114
|
+
for (const domain of domains) {
|
|
2115
|
+
const integration = await this.get(id, domain);
|
|
2116
|
+
if (integration != null) {
|
|
2117
|
+
yield integration;
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
continue;
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
// Try getting whatever we have now because we will need to disconnect.
|
|
2125
|
+
const integration = await this.get(id, undefined);
|
|
865
2126
|
if (integration != null) {
|
|
866
2127
|
yield integration;
|
|
867
2128
|
}
|
|
2129
|
+
|
|
2130
|
+
continue;
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
const integration = await this.get(id);
|
|
2134
|
+
if (integration != null) {
|
|
2135
|
+
yield integration;
|
|
868
2136
|
}
|
|
869
2137
|
}
|
|
870
2138
|
}
|
|
871
2139
|
|
|
2140
|
+
private getCloudConnectionState(
|
|
2141
|
+
integration: Integration,
|
|
2142
|
+
connectedIntegrations: Set<IntegrationIds>,
|
|
2143
|
+
domainsById: Map<IntegrationIds, Set<string>>,
|
|
2144
|
+
): 'connected' | 'disconnected' {
|
|
2145
|
+
if (isCloudGitSelfManagedHostIntegrationId(integration.id)) {
|
|
2146
|
+
const host = hostFromDomain(integration.domain) ?? integration.domain;
|
|
2147
|
+
return domainsById.get(integration.id)?.has(host) ? 'connected' : 'disconnected';
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
return connectedIntegrations.has(integration.id) ? 'connected' : 'disconnected';
|
|
2151
|
+
}
|
|
2152
|
+
|
|
872
2153
|
private findCachedById<T extends IntegrationIds>(id: T): IntegrationById<T> | undefined {
|
|
873
|
-
const
|
|
2154
|
+
const cached = this._integrations.get(id as IntegrationKey);
|
|
2155
|
+
if (cached != null) return cached as IntegrationById<T>;
|
|
2156
|
+
|
|
2157
|
+
const key = `${id}:`;
|
|
874
2158
|
for (const [k, integration] of this._integrations) {
|
|
875
2159
|
if (k.startsWith(key)) {
|
|
876
2160
|
return integration as IntegrationById<T>;
|
|
@@ -879,46 +2163,427 @@ export class IntegrationService implements Disposable {
|
|
|
879
2163
|
return undefined;
|
|
880
2164
|
}
|
|
881
2165
|
|
|
2166
|
+
private getCachedForDomain<T extends IntegrationIds>(id: T, domain?: string): IntegrationById<T> | undefined {
|
|
2167
|
+
return isGitSelfManagedHostIntegrationId(id) ? this.getCached(id, domain) : this.findCachedById(id);
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
private getConfiguredCloudConnection(id: IntegrationIds, connectionId: string): ConfiguredIntegrationDescriptor {
|
|
2171
|
+
const connection = this.configuredIntegrationService
|
|
2172
|
+
.getConfigured(id, { cloud: true })
|
|
2173
|
+
.find(c => c.id === connectionId);
|
|
2174
|
+
if (connection == null) {
|
|
2175
|
+
throw new Error(`Connection '${connectionId}' is not configured for '${id}'`);
|
|
2176
|
+
}
|
|
2177
|
+
return connection;
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
private getConfiguredConnectionDomain(id: IntegrationIds, connectionId: string): string | undefined {
|
|
2181
|
+
if (!isGitSelfManagedHostIntegrationId(id)) return undefined;
|
|
2182
|
+
return this.configuredIntegrationService.getConfigured(id).find(c => c.id === connectionId)?.domain;
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
private getCloudPrimaryConnectionIdsByDomain(id: IntegrationIds): Map<string | undefined, string> {
|
|
2186
|
+
const primaryByDomain = new Map<string | undefined, string>();
|
|
2187
|
+
const fallbackByDomain = new Map<string | undefined, string>();
|
|
2188
|
+
|
|
2189
|
+
for (const descriptor of this.configuredIntegrationService.getConfigured(id, { cloud: true })) {
|
|
2190
|
+
const domain = isGitSelfManagedHostIntegrationId(id)
|
|
2191
|
+
? (hostFromDomain(descriptor.domain) ?? descriptor.domain)
|
|
2192
|
+
: undefined;
|
|
2193
|
+
if (!fallbackByDomain.has(domain)) {
|
|
2194
|
+
fallbackByDomain.set(domain, descriptor.id);
|
|
2195
|
+
}
|
|
2196
|
+
if (descriptor.primary && !primaryByDomain.has(domain)) {
|
|
2197
|
+
primaryByDomain.set(domain, descriptor.id);
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
for (const [domain, connectionId] of fallbackByDomain) {
|
|
2202
|
+
if (!primaryByDomain.has(domain)) {
|
|
2203
|
+
primaryByDomain.set(domain, connectionId);
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
return primaryByDomain;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
882
2210
|
@gate()
|
|
883
2211
|
@trace()
|
|
884
|
-
private async syncCloudIntegrations(forceConnect: boolean) {
|
|
2212
|
+
private async syncCloudIntegrations(forceConnect: boolean): Promise<Set<IntegrationIds> | undefined> {
|
|
885
2213
|
const scope = getScopedLogger();
|
|
886
2214
|
const connectedIntegrations = new Set<IntegrationIds>();
|
|
887
|
-
const domainsById = new Map<IntegrationIds, string
|
|
2215
|
+
const domainsById = new Map<IntegrationIds, Set<string>>();
|
|
2216
|
+
const connectionsById = new Map<IntegrationIds, CloudIntegrationConnection[]>();
|
|
888
2217
|
|
|
889
2218
|
const loggedIn = (await this.ctx.account.getAccount()) != null;
|
|
890
2219
|
if (loggedIn) {
|
|
891
2220
|
const connections = await this.authenticationService.cloudIntegrations.getConnections();
|
|
892
2221
|
if (connections == null) return;
|
|
893
2222
|
|
|
894
|
-
|
|
2223
|
+
for (const p of connections) {
|
|
895
2224
|
const integrationId = toIntegrationId[p.provider];
|
|
896
2225
|
// GKDev includes some integrations like "google" that we don't support
|
|
897
|
-
if (integrationId == null)
|
|
2226
|
+
if (integrationId == null) continue;
|
|
2227
|
+
|
|
2228
|
+
connectedIntegrations.add(integrationId);
|
|
2229
|
+
|
|
2230
|
+
const list = connectionsById.get(integrationId);
|
|
2231
|
+
if (list != null) {
|
|
2232
|
+
list.push(p);
|
|
2233
|
+
} else {
|
|
2234
|
+
connectionsById.set(integrationId, [p]);
|
|
2235
|
+
}
|
|
898
2236
|
|
|
899
|
-
connectedIntegrations.add(toIntegrationId[p.provider]);
|
|
900
2237
|
if (p.domain?.length > 0) {
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
domainsById.
|
|
904
|
-
|
|
2238
|
+
const host = hostFromDomain(p.domain);
|
|
2239
|
+
if (host != null) {
|
|
2240
|
+
let domains = domainsById.get(integrationId);
|
|
2241
|
+
if (domains == null) {
|
|
2242
|
+
domains = new Set<string>();
|
|
2243
|
+
domainsById.set(integrationId, domains);
|
|
2244
|
+
}
|
|
2245
|
+
domains.add(host);
|
|
2246
|
+
} else {
|
|
905
2247
|
scope?.warn(`Invalid domain for ${integrationId} integration: ${p.domain}. Ignoring.`);
|
|
906
2248
|
}
|
|
907
2249
|
}
|
|
908
|
-
}
|
|
2250
|
+
}
|
|
909
2251
|
}
|
|
910
2252
|
|
|
911
2253
|
for await (const integration of this.getSupportedCloudIntegrations(domainsById)) {
|
|
912
2254
|
await integration.syncCloudConnection(
|
|
913
|
-
|
|
2255
|
+
this.getCloudConnectionState(integration, connectedIntegrations, domainsById),
|
|
914
2256
|
forceConnect,
|
|
915
2257
|
);
|
|
916
2258
|
}
|
|
917
2259
|
|
|
2260
|
+
// Persist every account when the backend advertises per-connection identity (multi-account). This
|
|
2261
|
+
// is a strict no-op for backends that return a single, id-less connection per provider.
|
|
2262
|
+
for (const [integrationId, connections] of connectionsById) {
|
|
2263
|
+
await this.reconcileCloudConnections(integrationId, connections, forceConnect);
|
|
2264
|
+
}
|
|
2265
|
+
|
|
918
2266
|
this.ctx.hooks?.connection?.onConnectedChanged?.({
|
|
919
2267
|
integrationIds: [...connectedIntegrations.values()],
|
|
920
2268
|
});
|
|
921
2269
|
|
|
922
2270
|
return connectedIntegrations;
|
|
923
2271
|
}
|
|
2272
|
+
|
|
2273
|
+
/**
|
|
2274
|
+
* Whether the user has locally disconnected this provider/host. Mirrors the integration model's
|
|
2275
|
+
* `connected:${key}` workspace flag (key = id for cloud, `${id}:${domain}` for self-managed), which is
|
|
2276
|
+
* set to `false` on a local disconnect and cleared on (re)connect.
|
|
2277
|
+
*/
|
|
2278
|
+
private isLocallyDisconnected(id: IntegrationIds, host: string | undefined): boolean {
|
|
2279
|
+
const key = isGitSelfManagedHostIntegrationId(id) ? `connected:${id}:${host ?? ''}` : `connected:${id}`;
|
|
2280
|
+
return this.ctx.storage.getWorkspace<boolean>(key) === false;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
/**
|
|
2284
|
+
* Reconciles the locally stored connections for a provider with what the backend reports, so that
|
|
2285
|
+
* multiple accounts on the same provider coexist. Only engages when the backend provides
|
|
2286
|
+
* per-connection ids; otherwise the single-connection flow above already handled the primary.
|
|
2287
|
+
*/
|
|
2288
|
+
private async reconcileCloudConnections(
|
|
2289
|
+
id: IntegrationIds,
|
|
2290
|
+
connections: CloudIntegrationConnection[],
|
|
2291
|
+
forceConnect: boolean,
|
|
2292
|
+
): Promise<void> {
|
|
2293
|
+
const scope = getScopedLogger();
|
|
2294
|
+
|
|
2295
|
+
const identified = connections.filter((c): c is CloudIntegrationConnection & { id: string } => c.id != null);
|
|
2296
|
+
if (identified.length === 0) return;
|
|
2297
|
+
|
|
2298
|
+
// Capture the effective primary before any mutation (sync store, prune-driven promotion, or the
|
|
2299
|
+
// backend primary selection below) so we can tell whether it actually changed. The prune step can
|
|
2300
|
+
// promote a secondary to primary via removeConfigured, so sampling this after pruning would miss it.
|
|
2301
|
+
const primaryBefore = this.getCloudPrimaryConnectionIdsByDomain(id);
|
|
2302
|
+
|
|
2303
|
+
const cloudIntegrations = this.authenticationService.cloudIntegrations;
|
|
2304
|
+
|
|
2305
|
+
// Fetch + store each connection's session so getConfigured() reflects every account.
|
|
2306
|
+
const syncedIds = new Set<string>();
|
|
2307
|
+
const syncEligibleIds = new Set<string>();
|
|
2308
|
+
const syncedPrimaryIdsByDomain = new Map<string | undefined, string>();
|
|
2309
|
+
// Snapshot existing cloud descriptors by id once, so the per-connection account-name lookup below is
|
|
2310
|
+
// O(1) instead of re-filtering the whole configured list each iteration (O(n²) with multi-account).
|
|
2311
|
+
// Each backend connection id is processed once, so reading the pre-loop snapshot is sufficient.
|
|
2312
|
+
const existingById = new Map(
|
|
2313
|
+
this.configuredIntegrationService.getConfigured(id, { cloud: true }).map(c => [c.id, c]),
|
|
2314
|
+
);
|
|
2315
|
+
for (const connection of identified) {
|
|
2316
|
+
// The wire `domain` is usually a full URL, though cloud providers can return a bare host.
|
|
2317
|
+
// Self-managed integrations are keyed/constructed by host.
|
|
2318
|
+
const host = hostFromDomain(connection.domain);
|
|
2319
|
+
|
|
2320
|
+
// Self-managed connections are keyed by host, so an unparseable/empty domain would store the
|
|
2321
|
+
// session and descriptor under an empty host — producing ambiguous keys (`connected:<id>:`) that
|
|
2322
|
+
// break later resolution and local-disconnect checks. Skip such a connection rather than corrupt
|
|
2323
|
+
// state; cloud providers key off their canonical domain and are unaffected.
|
|
2324
|
+
if (isGitSelfManagedHostIntegrationId(id) && !host) {
|
|
2325
|
+
scope?.warn(`Skipping connection '${connection.id}' for ${id}: unresolved host from domain`);
|
|
2326
|
+
continue;
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
// Don't resurrect a connection the user disconnected locally: a host "disconnect" only clears
|
|
2330
|
+
// local state (the backend still lists the token), so without this the next non-forced sync would
|
|
2331
|
+
// re-store the secret/config. A forced reconnect clears this flag (in the sync loop above) before
|
|
2332
|
+
// reconcile runs, so it proceeds normally.
|
|
2333
|
+
if (this.isLocallyDisconnected(id, host)) continue;
|
|
2334
|
+
|
|
2335
|
+
syncEligibleIds.add(connection.id);
|
|
2336
|
+
|
|
2337
|
+
// On a routine (non-forced) check-in, skip the token fetch + secret write for a connection we
|
|
2338
|
+
// already have stored and that hasn't expired: nothing to refresh, so avoid the extra GK API
|
|
2339
|
+
// traffic and secret churn. Still treat it as synced (so it doesn't trip the prune guard) and
|
|
2340
|
+
// record its primary below. Forced syncs, new connections, and expired tokens fall through and
|
|
2341
|
+
// fetch as before.
|
|
2342
|
+
const cached = existingById.get(connection.id);
|
|
2343
|
+
if (!forceConnect && cached != null && !isDescriptorExpired(cached)) {
|
|
2344
|
+
syncedIds.add(connection.id);
|
|
2345
|
+
if (connection.primary) {
|
|
2346
|
+
const domain = isGitSelfManagedHostIntegrationId(id) ? host : undefined;
|
|
2347
|
+
if (!syncedPrimaryIdsByDomain.has(domain)) {
|
|
2348
|
+
syncedPrimaryIdsByDomain.set(domain, connection.id);
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
continue;
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
try {
|
|
2355
|
+
const session = await cloudIntegrations.getConnectionSession(id, undefined, connection.id);
|
|
2356
|
+
if (session == null) continue;
|
|
2357
|
+
|
|
2358
|
+
let providerSession = toProviderSession(id, connection, session, host);
|
|
2359
|
+
|
|
2360
|
+
// Resolve a human-readable account handle with the same precedence as the gk CLI:
|
|
2361
|
+
// (1) the value the backend put on the connection, (2) a previously-resolved name cached in
|
|
2362
|
+
// our configured store (keyed by connection id), (3) a live provider-API lookup. This keeps
|
|
2363
|
+
// provider round-trips to the first sight of a connection; degrade to undefined on failure.
|
|
2364
|
+
const existing = existingById.get(connection.id);
|
|
2365
|
+
const accountName =
|
|
2366
|
+
normalizeAccountName(connection.accountName) ??
|
|
2367
|
+
normalizeAccountName(existing?.accountName) ??
|
|
2368
|
+
(await this.resolveAccountName(id, host, providerSession));
|
|
2369
|
+
if (accountName != null) {
|
|
2370
|
+
providerSession = {
|
|
2371
|
+
...providerSession,
|
|
2372
|
+
account: { ...providerSession.account, label: accountName },
|
|
2373
|
+
};
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
await this.configuredIntegrationService.storeSession(id, providerSession);
|
|
2377
|
+
syncedIds.add(connection.id);
|
|
2378
|
+
if (connection.primary) {
|
|
2379
|
+
const domain = isGitSelfManagedHostIntegrationId(id) ? host : undefined;
|
|
2380
|
+
if (!syncedPrimaryIdsByDomain.has(domain)) {
|
|
2381
|
+
syncedPrimaryIdsByDomain.set(domain, connection.id);
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
} catch (ex) {
|
|
2385
|
+
scope?.warn(
|
|
2386
|
+
`Failed to sync connection '${connection.id}' for ${id}: ${ex instanceof Error ? ex.message : String(ex)}`,
|
|
2387
|
+
);
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
// Prune stored cloud connections that no longer exist on the backend — but only when every backend
|
|
2392
|
+
// connection that should sync did sync this cycle. Otherwise a transient token fetch failure would
|
|
2393
|
+
// delete a still-valid connection with no replacement (e.g. a legacy single connection during the
|
|
2394
|
+
// backend id rollout); defer pruning to a later clean cycle. Deliberately skipped connections (local
|
|
2395
|
+
// disconnects or invalid self-managed hosts) don't block pruning of unrelated stale descriptors.
|
|
2396
|
+
// Scope deletes to cloud so a local PAT sharing the id survives.
|
|
2397
|
+
const prunedDomains = new Set<string | undefined>();
|
|
2398
|
+
if ([...syncEligibleIds].every(connectionId => syncedIds.has(connectionId))) {
|
|
2399
|
+
const liveIds = new Set(identified.map(c => c.id));
|
|
2400
|
+
for (const descriptor of this.configuredIntegrationService.getConfigured(id, { cloud: true })) {
|
|
2401
|
+
if (!liveIds.has(descriptor.id)) {
|
|
2402
|
+
prunedDomains.add(isGitSelfManagedHostIntegrationId(id) ? descriptor.domain : undefined);
|
|
2403
|
+
await this.configuredIntegrationService.deleteConnection(id, descriptor.id, true);
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
// Apply the backend's primary selection, then refresh any warm model only when the effective primary
|
|
2409
|
+
// actually changed (vs the pre-reconcile value captured above). switchConnection() drops the in-memory
|
|
2410
|
+
// session and fires change events, so calling it on every check-in (when the primary is unchanged)
|
|
2411
|
+
// causes needless churn for multi-account providers. Self-managed providers can have one primary per
|
|
2412
|
+
// host, so apply and refresh by host scope rather than by provider id alone.
|
|
2413
|
+
for (const connectionId of syncedPrimaryIdsByDomain.values()) {
|
|
2414
|
+
await this.configuredIntegrationService.setPrimaryConnection(id, connectionId);
|
|
2415
|
+
}
|
|
2416
|
+
const primaryAfter = this.getCloudPrimaryConnectionIdsByDomain(id);
|
|
2417
|
+
const domains = new Set<string | undefined>(primaryBefore.keys());
|
|
2418
|
+
for (const domain of primaryAfter.keys()) {
|
|
2419
|
+
domains.add(domain);
|
|
2420
|
+
}
|
|
2421
|
+
for (const domain of prunedDomains) {
|
|
2422
|
+
domains.add(domain);
|
|
2423
|
+
}
|
|
2424
|
+
for (const domain of domains) {
|
|
2425
|
+
if (primaryBefore.get(domain) === primaryAfter.get(domain) && !prunedDomains.has(domain)) continue;
|
|
2426
|
+
|
|
2427
|
+
this.getCachedForDomain(id, domain)?.switchConnection();
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
/**
|
|
2432
|
+
* Switches the default connection for a provider to `connectionId` (its backend token id). Performs
|
|
2433
|
+
* the server-side primary switch first, then mirrors it locally and refreshes any warm model. Throws
|
|
2434
|
+
* if the backend switch fails so the caller can surface it (local state stays untouched).
|
|
2435
|
+
*/
|
|
2436
|
+
async setPrimaryConnection(id: IntegrationIds, connectionId: string): Promise<void> {
|
|
2437
|
+
const connection = this.getConfiguredCloudConnection(id, connectionId);
|
|
2438
|
+
if (!(await this.authenticationService.cloudIntegrations.setPrimaryConnection(id, connectionId))) {
|
|
2439
|
+
throw new Error(`Failed to set primary connection '${connectionId}' for '${id}'`);
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2442
|
+
await this.configuredIntegrationService.setPrimaryConnection(id, connectionId);
|
|
2443
|
+
this.getCachedForDomain(id, connection.domain)?.switchConnection();
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2446
|
+
/**
|
|
2447
|
+
* Removes a single connection for a provider by its backend token id. The backend removes the
|
|
2448
|
+
* connection (auto-promoting a secondary to primary when the removed one was primary); we then mirror
|
|
2449
|
+
* that locally and refresh any warm model. Unlike {@link IntegrationBase.disconnect}, this targets one
|
|
2450
|
+
* account. This always talks to the cloud backend, so the local mirror is cloud-scoped and preserves any
|
|
2451
|
+
* local PAT that happens to share the same id.
|
|
2452
|
+
* Throws if the backend delete fails so the caller can surface it (local state stays untouched).
|
|
2453
|
+
*/
|
|
2454
|
+
async deleteConnection(id: IntegrationIds, connectionId: string): Promise<void> {
|
|
2455
|
+
const connection = this.getConfiguredCloudConnection(id, connectionId);
|
|
2456
|
+
if (!(await this.authenticationService.cloudIntegrations.disconnectConnection(id, connectionId))) {
|
|
2457
|
+
throw new Error(`Failed to delete connection '${connectionId}' for '${id}'`);
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
await this.configuredIntegrationService.deleteConnection(id, connectionId, true);
|
|
2461
|
+
this.getCachedForDomain(id, connection.domain)?.switchConnection();
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
/**
|
|
2465
|
+
* Resolves a human-readable account handle (e.g. the GitHub login) for a connection by asking the
|
|
2466
|
+
* provider API with that connection's token. The token backend doesn't expose it. Routes through the
|
|
2467
|
+
* integration model so the correct provider API base URL (incl. self-managed domains) and auth type
|
|
2468
|
+
* are used. Best-effort: returns undefined on any failure so callers degrade gracefully.
|
|
2469
|
+
*/
|
|
2470
|
+
private async resolveAccountName(
|
|
2471
|
+
id: IntegrationIds,
|
|
2472
|
+
host: string | undefined,
|
|
2473
|
+
session: ProviderAuthenticationSession,
|
|
2474
|
+
): Promise<string | undefined> {
|
|
2475
|
+
const scope = getScopedLogger();
|
|
2476
|
+
try {
|
|
2477
|
+
// Route through the integration so the correct provider API base URL (incl. the self-managed
|
|
2478
|
+
// host) and auth type are used. Cloud providers ignore the host.
|
|
2479
|
+
const integration = await this.get(id, host);
|
|
2480
|
+
const account = await integration?.getProviderAccountForSession(session);
|
|
2481
|
+
return account?.username ?? account?.name ?? undefined;
|
|
2482
|
+
} catch (ex) {
|
|
2483
|
+
scope?.warn(`Failed to resolve account name for '${id}': ${ex instanceof Error ? ex.message : String(ex)}`);
|
|
2484
|
+
return undefined;
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
/**
|
|
2489
|
+
* Forces a refresh of connected cloud integrations from the backend (equivalent to a "--sync" list),
|
|
2490
|
+
* reconciling local state (multi-account connections, primary flags, account names) so a subsequent
|
|
2491
|
+
* {@link getConfigured} reflects the latest server-side connections. Intended for consumers that need
|
|
2492
|
+
* an up-to-date connection list on demand. Rejects when the authoritative backend connection list cannot
|
|
2493
|
+
* be read, so callers never mistake stale local state for a successful refresh.
|
|
2494
|
+
*/
|
|
2495
|
+
async refreshConnections(): Promise<void> {
|
|
2496
|
+
const connected = await this.syncCloudIntegrations(true);
|
|
2497
|
+
if (connected == null) {
|
|
2498
|
+
throw new Error('Failed to refresh provider connections');
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
/** Internal factory used by the GitLens host and integration tests that need the full service surface. */
|
|
2504
|
+
export function createIntegrationService(ctx: IntegrationServiceContext): IntegrationService {
|
|
2505
|
+
const configured = new ConfiguredIntegrationService(ctx);
|
|
2506
|
+
const cloud = new CloudIntegrationService(ctx);
|
|
2507
|
+
let service: IntegrationService;
|
|
2508
|
+
const auth = new IntegrationAuthenticationService(configured, ctx, () => service, cloud);
|
|
2509
|
+
service = new IntegrationService(auth, configured, ctx);
|
|
2510
|
+
void purgeRetiredIntegrationStorage(ctx, configured);
|
|
2511
|
+
return service;
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
const retiredIntegrationsStorageKey = 'integrations:migrated:cloudOnly';
|
|
2515
|
+
async function purgeRetiredIntegrationStorage(
|
|
2516
|
+
ctx: IntegrationServiceContext,
|
|
2517
|
+
configured: ConfiguredIntegrationService,
|
|
2518
|
+
): Promise<void> {
|
|
2519
|
+
if (ctx.storage.get<boolean>(retiredIntegrationsStorageKey)) return;
|
|
2520
|
+
|
|
2521
|
+
try {
|
|
2522
|
+
await configured.purgeStoredConfiguration(['github-enterprise', 'gitlab-self-hosted']);
|
|
2523
|
+
await ctx.storage.store(retiredIntegrationsStorageKey, true);
|
|
2524
|
+
} catch {
|
|
2525
|
+
// Best-effort cleanup retries on the next startup while the migration flag remains unset.
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2529
|
+
function protocolFromDomain(domain: string | undefined): string | undefined {
|
|
2530
|
+
const value = domain?.trim();
|
|
2531
|
+
if (!value) return undefined;
|
|
2532
|
+
if (!/^[a-z][a-z\d+\-.]*:\/\//i.test(value)) return undefined;
|
|
2533
|
+
|
|
2534
|
+
try {
|
|
2535
|
+
return new URL(value).protocol || undefined;
|
|
2536
|
+
} catch {
|
|
2537
|
+
return undefined;
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
function normalizeAccountName(accountName: string | undefined): string | undefined {
|
|
2542
|
+
const value = accountName?.trim();
|
|
2543
|
+
return value ? value : undefined;
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
/**
|
|
2547
|
+
* Whether a stored connection descriptor's token has expired. A missing `expiresAt` is treated as
|
|
2548
|
+
* not-expired (non-expiring/legacy tokens, e.g. GitHub and self-managed cloud, carry no meaningful
|
|
2549
|
+
* expiry), matching the session-expiry checks elsewhere.
|
|
2550
|
+
*/
|
|
2551
|
+
function isDescriptorExpired(descriptor: ConfiguredIntegrationDescriptor): boolean {
|
|
2552
|
+
if (descriptor.expiresAt == null) return false;
|
|
2553
|
+
return new Date(descriptor.expiresAt).getTime() < Date.now();
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
function toProviderSession(
|
|
2557
|
+
id: IntegrationIds,
|
|
2558
|
+
connection: CloudIntegrationConnection & { id: string },
|
|
2559
|
+
session: {
|
|
2560
|
+
accessToken: string;
|
|
2561
|
+
expiresIn: number;
|
|
2562
|
+
scopes: string;
|
|
2563
|
+
type: CloudIntegrationConnection['type'];
|
|
2564
|
+
appKey?: string;
|
|
2565
|
+
},
|
|
2566
|
+
host: string | undefined,
|
|
2567
|
+
): ProviderAuthenticationSession {
|
|
2568
|
+
// GitHub, the cloud self-managed hosts, and Trello return `expiresIn: 0` for a non-expiring token; left
|
|
2569
|
+
// as 0 the session's `expiresAt` would be `now` and rejected as expired on the next read. Map it to the
|
|
2570
|
+
// maximum expiry (mirrors the auth provider's own guard).
|
|
2571
|
+
const expiresIn =
|
|
2572
|
+
session.expiresIn === 0 && isNonExpiringZeroTokenIntegrationId(id) ? maxSmallIntegerV8 : session.expiresIn;
|
|
2573
|
+
const protocol = protocolFromDomain(connection.domain);
|
|
2574
|
+
|
|
2575
|
+
return {
|
|
2576
|
+
id: connection.id,
|
|
2577
|
+
accessToken: session.accessToken,
|
|
2578
|
+
account: { id: '', label: '' },
|
|
2579
|
+
scopes: session.scopes ? session.scopes.split(',') : [],
|
|
2580
|
+
cloud: true,
|
|
2581
|
+
type: session.type,
|
|
2582
|
+
expiresAt: new Date(expiresIn * 1000 + Date.now()),
|
|
2583
|
+
// Self-managed connections are keyed by their host; cloud providers use the canonical domain.
|
|
2584
|
+
domain: isGitSelfManagedHostIntegrationId(id) ? (host ?? '') : (providersMetadata[id]?.domain ?? ''),
|
|
2585
|
+
...(protocol != null ? { protocol: protocol } : {}),
|
|
2586
|
+
// Carried for providers whose client needs an app key alongside the token (e.g. Trello).
|
|
2587
|
+
...(session.appKey != null ? { appKey: session.appKey } : {}),
|
|
2588
|
+
};
|
|
924
2589
|
}
|