@gitkraken/core-gitlens 0.4.0 → 0.4.101
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 +74 -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 +135 -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 +297 -13
- package/dist/plus/integrations/integrationService.d.ts.map +1 -1
- package/dist/plus/integrations/integrationService.js +672 -36
- 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 +262 -10
- package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +675 -101
- 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 +70 -7
- package/dist/plus/integrations/models/issuesIntegration.d.ts.map +1 -1
- package/dist/plus/integrations/models/issuesIntegration.js +108 -35
- 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/broaden.d.ts +20 -0
- package/dist/plus/integrations/reads/broaden.d.ts.map +1 -0
- package/dist/plus/integrations/reads/broaden.js +326 -0
- package/dist/plus/integrations/reads/broaden.js.map +1 -0
- package/dist/plus/integrations/reads/context.d.ts +74 -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 +320 -0
- package/dist/plus/integrations/reads/hierarchy.js.map +1 -0
- package/dist/plus/integrations/reads/hierarchy.utils.d.ts +77 -0
- package/dist/plus/integrations/reads/hierarchy.utils.d.ts.map +1 -0
- package/dist/plus/integrations/reads/hierarchy.utils.js +128 -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 +334 -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/resolveRepository.d.ts +25 -0
- package/dist/plus/integrations/reads/resolveRepository.d.ts.map +1 -0
- package/dist/plus/integrations/reads/resolveRepository.js +235 -0
- package/dist/plus/integrations/reads/resolveRepository.js.map +1 -0
- package/dist/plus/integrations/reads/sweeps.d.ts +11 -0
- package/dist/plus/integrations/reads/sweeps.d.ts.map +1 -0
- package/dist/plus/integrations/reads/sweeps.js +125 -0
- package/dist/plus/integrations/reads/sweeps.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 +153 -0
- package/src/plus/integrations/index.ts +148 -51
- package/src/plus/integrations/integrationService.ts +940 -49
- package/src/plus/integrations/lite.ts +233 -0
- package/src/plus/integrations/manager.ts +359 -0
- package/src/plus/integrations/models/gitHostIntegration.ts +1005 -134
- package/src/plus/integrations/models/integration.ts +293 -24
- package/src/plus/integrations/models/issuesIntegration.ts +132 -39
- 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/broaden.ts +452 -0
- package/src/plus/integrations/reads/context.ts +99 -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 +473 -0
- package/src/plus/integrations/reads/hierarchy.utils.ts +155 -0
- package/src/plus/integrations/reads/issueTracker.ts +468 -0
- package/src/plus/integrations/reads/issues.ts +409 -0
- package/src/plus/integrations/reads/paging.ts +277 -0
- package/src/plus/integrations/reads/pullRequests.ts +260 -0
- package/src/plus/integrations/reads/resolveRepository.ts +272 -0
- package/src/plus/integrations/reads/sweeps.ts +185 -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,4 +1,12 @@
|
|
|
1
1
|
import ProviderApis from '@gitkraken/provider-apis';
|
|
2
|
+
import type {
|
|
3
|
+
CollectionMetadata,
|
|
4
|
+
GitPullRequestState,
|
|
5
|
+
GraphQLError,
|
|
6
|
+
GraphQLErrors,
|
|
7
|
+
TrelloBoard,
|
|
8
|
+
TrelloList,
|
|
9
|
+
} from '@gitkraken/provider-apis';
|
|
2
10
|
import type { PullRequest, PullRequestMergeMethod } from '../../../git/models/pullRequest.js';
|
|
3
11
|
import { base64 } from '../../../utils/base64.js';
|
|
4
12
|
import type { PagedResult } from '../../../utils/paging.js';
|
|
@@ -14,9 +22,11 @@ import {
|
|
|
14
22
|
import {
|
|
15
23
|
AuthenticationError,
|
|
16
24
|
AuthenticationErrorReason,
|
|
25
|
+
isRateLimitResponse,
|
|
17
26
|
RequestClientError,
|
|
18
27
|
RequestNotFoundError,
|
|
19
|
-
|
|
28
|
+
toError,
|
|
29
|
+
toRateLimitError,
|
|
20
30
|
} from '../errors.js';
|
|
21
31
|
import type {
|
|
22
32
|
GetIssueFn,
|
|
@@ -33,9 +43,14 @@ import type {
|
|
|
33
43
|
PagingInput,
|
|
34
44
|
PagingMode,
|
|
35
45
|
ProviderAccount,
|
|
46
|
+
ProviderApiCollectionResult,
|
|
47
|
+
ProviderApiPagedResult,
|
|
36
48
|
ProviderAzureProject,
|
|
37
49
|
ProviderAzureResource,
|
|
38
50
|
ProviderBitbucketResource,
|
|
51
|
+
ProviderGitHubOrganization,
|
|
52
|
+
ProviderGitLabGroup,
|
|
53
|
+
ProviderHierarchyResult,
|
|
39
54
|
ProviderInfo,
|
|
40
55
|
ProviderIssue,
|
|
41
56
|
ProviderJiraProject,
|
|
@@ -53,6 +68,12 @@ import type {
|
|
|
53
68
|
PullRequestFilter,
|
|
54
69
|
} from './models.js';
|
|
55
70
|
import { providersMetadata } from './models.js';
|
|
71
|
+
import {
|
|
72
|
+
collectProviderPagedResult,
|
|
73
|
+
mergeCollectionMetadata,
|
|
74
|
+
parsePageCursor,
|
|
75
|
+
toPageCursor,
|
|
76
|
+
} from './utils/providerPaging.js';
|
|
56
77
|
|
|
57
78
|
// `@gitkraken/provider-apis` is published as CommonJS with its factory on the `default` export.
|
|
58
79
|
// How that surfaces depends on the consuming bundler's CJS->ESM interop: esbuild yields the
|
|
@@ -62,8 +83,133 @@ type ProviderApisFactory = typeof ProviderApis;
|
|
|
62
83
|
const createProviderApis: ProviderApisFactory =
|
|
63
84
|
(ProviderApis as ProviderApisFactory & { default?: ProviderApisFactory }).default ?? ProviderApis;
|
|
64
85
|
|
|
86
|
+
// Both GitHub and GitLab `getRepo` throw a missing-repo error whose message is exactly
|
|
87
|
+
// `Repository <x> not found`. Anchoring to that shape (rather than a loose `not found` substring) keeps
|
|
88
|
+
// the message fallbacks from misclassifying unrelated GraphQL/transport failures as a confident negative.
|
|
89
|
+
const repoNotFoundMessage = /^Repository .+ not found$/i;
|
|
90
|
+
|
|
91
|
+
// Duck-typed rather than `ex instanceof GraphQLErrors`, because importing the class as a value makes this
|
|
92
|
+
// module unloadable from plain Node ESM consumers: `@gitkraken/provider-apis` is CommonJS and declares its
|
|
93
|
+
// exports through getters, which Node's `cjs-module-lexer` cannot see, so the only named exports it can
|
|
94
|
+
// synthesize are `default` and `module.exports`. Bundled hosts (webpack/esbuild) bind the named export
|
|
95
|
+
// fine, but the published package keeps third-party deps external, so the named import survives into
|
|
96
|
+
// consumers and breaks linking there. The SDK's constructor always assigns `graphQLErrors` (defaulting to
|
|
97
|
+
// `[]`) and it is the only SDK error carrying that field, so the shape check is unambiguous.
|
|
98
|
+
function isGraphQLErrors(ex: unknown): ex is GraphQLErrors {
|
|
99
|
+
return ex instanceof Error && Array.isArray((ex as Partial<GraphQLErrors>).graphQLErrors);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// `handleProviderError` classifies not-found by HTTP status (404/410/422), which only works for the
|
|
103
|
+
// REST `getRepo` clients (Bitbucket, Bitbucket Server, Azure DevOps). GitHub and GitLab `getRepo` are
|
|
104
|
+
// GraphQL: a missing repo comes back as HTTP 200 with a null node, and the SDK throws an unclassified
|
|
105
|
+
// error with no `response.status`, so it would otherwise fall through to the generic error bucket. This
|
|
106
|
+
// detects the SDK's not-found shapes so `getRepo` can rethrow them as `RequestNotFoundError`, keeping the
|
|
107
|
+
// facade's by-type mapping intact.
|
|
108
|
+
function isGraphQLRepoNotFoundError(ex: unknown): boolean {
|
|
109
|
+
// GitHub throws `GraphQLErrors`. The SDK reports the null repository node with the same
|
|
110
|
+
// `Repository <x> not found` message regardless of the underlying cause, so a `FORBIDDEN` or
|
|
111
|
+
// `RATE_LIMITED` GraphQL error would also surface with that message. Trust the structured error type
|
|
112
|
+
// when entries are present (only `NOT_FOUND` is a real not-found), and fall back to the repo-specific
|
|
113
|
+
// message only when there are no entries to disambiguate (a bare null node).
|
|
114
|
+
if (isGraphQLErrors(ex)) {
|
|
115
|
+
const errors = ex.graphQLErrors;
|
|
116
|
+
// Scope NOT_FOUND to the `repository` field: `getRepo`'s query only selects that node today, but
|
|
117
|
+
// were it to grow other selections that can emit NOT_FOUND, an unscoped check would misclassify
|
|
118
|
+
// them. Tolerate a missing `path` so we degrade to the current behavior if the SDK stops populating
|
|
119
|
+
// it, rather than silently regressing to `error`.
|
|
120
|
+
if (errors?.length) {
|
|
121
|
+
return errors.some(
|
|
122
|
+
(e: GraphQLError) => e.type === 'NOT_FOUND' && (e.path == null || e.path.includes('repository')),
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
return repoNotFoundMessage.test(ex.message);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// GitLab's `getRepo` throws a plain Error; match its not-found message specifically so unrelated
|
|
129
|
+
// bare Errors (network/parse failures) still reach the generic error bucket.
|
|
130
|
+
return ex instanceof Error && repoNotFoundMessage.test(ex.message);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const trelloBaseUrl = 'https://api.trello.com';
|
|
134
|
+
|
|
135
|
+
type TrelloMemberResponse = {
|
|
136
|
+
id: string;
|
|
137
|
+
username?: string | null;
|
|
138
|
+
fullName?: string | null;
|
|
139
|
+
avatarHash?: string | null;
|
|
140
|
+
avatarUrl?: string | null;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
type TrelloCardResponse = {
|
|
144
|
+
id: string;
|
|
145
|
+
idShort: number;
|
|
146
|
+
name: string;
|
|
147
|
+
url: string;
|
|
148
|
+
dateLastActivity: string;
|
|
149
|
+
idList?: string | null;
|
|
150
|
+
badges?: {
|
|
151
|
+
comments?: number | null;
|
|
152
|
+
votes?: number | null;
|
|
153
|
+
};
|
|
154
|
+
members?: TrelloMemberResponse[];
|
|
155
|
+
labels?: Array<{ color: string | null; id: string; name: string }>;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
function getTrelloAuthHeaders(appKey: string, token: string): Record<string, string> {
|
|
159
|
+
return {
|
|
160
|
+
Authorization: `OAuth oauth_consumer_key="${appKey}", oauth_token="${token}"`,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function getTrelloMemberAvatarUrl(member: TrelloMemberResponse): string | null {
|
|
165
|
+
if (member.avatarUrl != null) return member.avatarUrl;
|
|
166
|
+
if (member.avatarHash == null) return null;
|
|
167
|
+
|
|
168
|
+
return `https://trello-members.s3.amazonaws.com/${member.id}/${member.avatarHash}/50.png`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function fromTrelloCard(
|
|
172
|
+
card: TrelloCardResponse,
|
|
173
|
+
trelloBoardListsById: Record<string, { name: string }>,
|
|
174
|
+
): ProviderIssue {
|
|
175
|
+
const createdDate = new Date(1000 * parseInt(card.id.substring(0, 8), 16));
|
|
176
|
+
const list = card.idList != null ? trelloBoardListsById[card.idList] : undefined;
|
|
177
|
+
|
|
178
|
+
return {
|
|
179
|
+
id: card.id,
|
|
180
|
+
commentCount: card.badges?.comments ?? null,
|
|
181
|
+
number: String(card.idShort),
|
|
182
|
+
title: card.name,
|
|
183
|
+
url: card.url,
|
|
184
|
+
closedDate: null,
|
|
185
|
+
createdDate: new Date(createdDate.toISOString()),
|
|
186
|
+
author: null,
|
|
187
|
+
updatedDate: new Date(card.dateLastActivity),
|
|
188
|
+
assignees: (card.members ?? []).map(member => ({
|
|
189
|
+
id: member.id,
|
|
190
|
+
username: member.username ?? null,
|
|
191
|
+
name: member.fullName ?? null,
|
|
192
|
+
email: null,
|
|
193
|
+
avatarUrl: getTrelloMemberAvatarUrl(member),
|
|
194
|
+
url: null,
|
|
195
|
+
})),
|
|
196
|
+
description: null,
|
|
197
|
+
state: list != null ? { id: card.idList!, name: list.name, color: null } : null,
|
|
198
|
+
type: null,
|
|
199
|
+
repository: null,
|
|
200
|
+
upvoteCount: card.badges?.votes ?? null,
|
|
201
|
+
labels: (card.labels ?? []).map(label => ({
|
|
202
|
+
color: label.color,
|
|
203
|
+
description: null,
|
|
204
|
+
id: label.id,
|
|
205
|
+
name: label.name,
|
|
206
|
+
})),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
65
210
|
export class ProvidersApi {
|
|
66
211
|
private readonly providers: Providers;
|
|
212
|
+
private readonly request: ProviderRequestFunction;
|
|
67
213
|
|
|
68
214
|
constructor(private readonly authenticationService: IntegrationAuthenticationService) {
|
|
69
215
|
const http = authenticationService.ctx.http;
|
|
@@ -82,11 +228,13 @@ export class ProvidersApi {
|
|
|
82
228
|
|
|
83
229
|
return parseFetchResponseForApi<T>(response);
|
|
84
230
|
};
|
|
231
|
+
this.request = customFetch;
|
|
85
232
|
const providerApis = createProviderApis({ request: customFetch });
|
|
86
233
|
this.providers = {
|
|
87
234
|
[GitCloudHostIntegrationId.GitHub]: {
|
|
88
235
|
...providersMetadata[GitCloudHostIntegrationId.GitHub],
|
|
89
236
|
provider: providerApis.github,
|
|
237
|
+
getRepoFn: providerApis.github.getRepo.bind(providerApis.github),
|
|
90
238
|
getCurrentUserFn: providerApis.github.getCurrentUser.bind(providerApis.github),
|
|
91
239
|
getPullRequestsForReposFn: providerApis.github.getPullRequestsForRepos.bind(
|
|
92
240
|
providerApis.github,
|
|
@@ -97,10 +245,14 @@ export class ProvidersApi {
|
|
|
97
245
|
getIssuesForReposFn: providerApis.github.getIssuesForRepos.bind(
|
|
98
246
|
providerApis.github,
|
|
99
247
|
) as GetIssuesForReposFn,
|
|
248
|
+
getOrgsForCurrentUserFn: providerApis.github.getOrgsForCurrentUser.bind(providerApis.github),
|
|
249
|
+
getReposForOrgFn: providerApis.github.getReposForOrg.bind(providerApis.github),
|
|
250
|
+
getReposForCurrentUserFn: providerApis.github.getReposForCurrentUser.bind(providerApis.github),
|
|
100
251
|
},
|
|
101
252
|
[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise]: {
|
|
102
253
|
...providersMetadata[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise],
|
|
103
254
|
provider: providerApis.github,
|
|
255
|
+
getRepoFn: providerApis.github.getRepo.bind(providerApis.github),
|
|
104
256
|
getCurrentUserFn: providerApis.github.getCurrentUser.bind(providerApis.github),
|
|
105
257
|
getPullRequestsForReposFn: providerApis.github.getPullRequestsForRepos.bind(
|
|
106
258
|
providerApis.github,
|
|
@@ -111,6 +263,9 @@ export class ProvidersApi {
|
|
|
111
263
|
getIssuesForReposFn: providerApis.github.getIssuesForRepos.bind(
|
|
112
264
|
providerApis.github,
|
|
113
265
|
) as GetIssuesForReposFn,
|
|
266
|
+
getOrgsForCurrentUserFn: providerApis.github.getOrgsForCurrentUser.bind(providerApis.github),
|
|
267
|
+
getReposForOrgFn: providerApis.github.getReposForOrg.bind(providerApis.github),
|
|
268
|
+
getReposForCurrentUserFn: providerApis.github.getReposForCurrentUser.bind(providerApis.github),
|
|
114
269
|
},
|
|
115
270
|
[GitCloudHostIntegrationId.GitLab]: {
|
|
116
271
|
...providersMetadata[GitCloudHostIntegrationId.GitLab],
|
|
@@ -126,16 +281,23 @@ export class ProvidersApi {
|
|
|
126
281
|
getPullRequestsForUserFn: providerApis.gitlab.getPullRequestsAssociatedWithUser.bind(
|
|
127
282
|
providerApis.gitlab,
|
|
128
283
|
) as GetPullRequestsForUserFn,
|
|
284
|
+
getGitLabPullRequestsForUserAssociationFn: providerApis.gitlab.getPullRequestsForUser.bind(
|
|
285
|
+
providerApis.gitlab,
|
|
286
|
+
),
|
|
129
287
|
getIssueFn: providerApis.gitlab.getIssue.bind(providerApis.gitlab) as GetIssueFn,
|
|
130
288
|
getIssuesForReposFn: providerApis.gitlab.getIssuesForRepos.bind(
|
|
131
289
|
providerApis.gitlab,
|
|
132
290
|
) as GetIssuesForReposFn,
|
|
133
291
|
getIssuesForRepoFn: providerApis.gitlab.getIssuesForRepo.bind(providerApis.gitlab),
|
|
292
|
+
getIssuesForCurrentUserFn: providerApis.gitlab.getIssuesForCurrentUser.bind(providerApis.gitlab),
|
|
134
293
|
mergePullRequestFn: providerApis.gitlab.mergePullRequest.bind(providerApis.gitlab),
|
|
294
|
+
getGroupsForCurrentUserFn: providerApis.gitlab.getGroupsForCurrentUser.bind(providerApis.gitlab),
|
|
295
|
+
getReposForCurrentUserFn: providerApis.gitlab.getReposForCurrentUser.bind(providerApis.gitlab),
|
|
135
296
|
},
|
|
136
297
|
[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted]: {
|
|
137
298
|
...providersMetadata[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted],
|
|
138
299
|
provider: providerApis.gitlab,
|
|
300
|
+
getRepoFn: providerApis.gitlab.getRepo.bind(providerApis.gitlab),
|
|
139
301
|
getCurrentUserFn: providerApis.gitlab.getCurrentUser.bind(providerApis.gitlab),
|
|
140
302
|
getPullRequestsForReposFn: providerApis.gitlab.getPullRequestsForRepos.bind(
|
|
141
303
|
providerApis.gitlab,
|
|
@@ -146,16 +308,23 @@ export class ProvidersApi {
|
|
|
146
308
|
getPullRequestsForUserFn: providerApis.gitlab.getPullRequestsAssociatedWithUser.bind(
|
|
147
309
|
providerApis.gitlab,
|
|
148
310
|
) as GetPullRequestsForUserFn,
|
|
311
|
+
getGitLabPullRequestsForUserAssociationFn: providerApis.gitlab.getPullRequestsForUser.bind(
|
|
312
|
+
providerApis.gitlab,
|
|
313
|
+
),
|
|
149
314
|
getIssueFn: providerApis.gitlab.getIssue.bind(providerApis.gitlab) as GetIssueFn,
|
|
150
315
|
getIssuesForReposFn: providerApis.gitlab.getIssuesForRepos.bind(
|
|
151
316
|
providerApis.gitlab,
|
|
152
317
|
) as GetIssuesForReposFn,
|
|
153
318
|
getIssuesForRepoFn: providerApis.gitlab.getIssuesForRepo.bind(providerApis.gitlab),
|
|
319
|
+
getIssuesForCurrentUserFn: providerApis.gitlab.getIssuesForCurrentUser.bind(providerApis.gitlab),
|
|
154
320
|
mergePullRequestFn: providerApis.gitlab.mergePullRequest.bind(providerApis.gitlab),
|
|
321
|
+
getGroupsForCurrentUserFn: providerApis.gitlab.getGroupsForCurrentUser.bind(providerApis.gitlab),
|
|
322
|
+
getReposForCurrentUserFn: providerApis.gitlab.getReposForCurrentUser.bind(providerApis.gitlab),
|
|
155
323
|
},
|
|
156
324
|
[GitCloudHostIntegrationId.Bitbucket]: {
|
|
157
325
|
...providersMetadata[GitCloudHostIntegrationId.Bitbucket],
|
|
158
326
|
provider: providerApis.bitbucket,
|
|
327
|
+
getRepoFn: providerApis.bitbucket.getRepo.bind(providerApis.bitbucket),
|
|
159
328
|
getCurrentUserFn: providerApis.bitbucket.getCurrentUser.bind(providerApis.bitbucket),
|
|
160
329
|
getBitbucketResourcesForCurrentUserFn: providerApis.bitbucket.getWorkspacesForCurrentUser.bind(
|
|
161
330
|
providerApis.bitbucket,
|
|
@@ -167,6 +336,7 @@ export class ProvidersApi {
|
|
|
167
336
|
) as GetPullRequestsForReposFn,
|
|
168
337
|
getPullRequestsForRepoFn: providerApis.bitbucket.getPullRequestsForRepo.bind(providerApis.bitbucket),
|
|
169
338
|
mergePullRequestFn: providerApis.bitbucket.mergePullRequest.bind(providerApis.bitbucket),
|
|
339
|
+
getReposForWorkspaceFn: providerApis.bitbucket.getReposForWorkspace.bind(providerApis.bitbucket),
|
|
170
340
|
},
|
|
171
341
|
[GitSelfManagedHostIntegrationId.BitbucketServer]: {
|
|
172
342
|
...providersMetadata[GitSelfManagedHostIntegrationId.BitbucketServer],
|
|
@@ -202,6 +372,9 @@ export class ProvidersApi {
|
|
|
202
372
|
getPullRequestsForAzureProjectsFn: providerApis.azureDevOps.getPullRequestsForProjects.bind(
|
|
203
373
|
providerApis.azureDevOps,
|
|
204
374
|
),
|
|
375
|
+
getPullRequestsForAzureProjectFn: providerApis.azureDevOps.getPullRequestsForProject.bind(
|
|
376
|
+
providerApis.azureDevOps,
|
|
377
|
+
),
|
|
205
378
|
getIssuesForAzureProjectFn: providerApis.azureDevOps.getIssuesForAzureProject.bind(
|
|
206
379
|
providerApis.azureDevOps,
|
|
207
380
|
),
|
|
@@ -231,6 +404,9 @@ export class ProvidersApi {
|
|
|
231
404
|
getPullRequestsForAzureProjectsFn: providerApis.azureDevOps.getPullRequestsForProjects.bind(
|
|
232
405
|
providerApis.azureDevOps,
|
|
233
406
|
),
|
|
407
|
+
getPullRequestsForAzureProjectFn: providerApis.azureDevOps.getPullRequestsForProject.bind(
|
|
408
|
+
providerApis.azureDevOps,
|
|
409
|
+
),
|
|
234
410
|
getIssuesForAzureProjectFn: providerApis.azureDevOps.getIssuesForAzureProject.bind(
|
|
235
411
|
providerApis.azureDevOps,
|
|
236
412
|
),
|
|
@@ -247,6 +423,7 @@ export class ProvidersApi {
|
|
|
247
423
|
providerApis.jira,
|
|
248
424
|
),
|
|
249
425
|
getJiraProjectsForResourcesFn: providerApis.jira.getJiraProjectsForResources.bind(providerApis.jira),
|
|
426
|
+
getJiraProjectsForResourceFn: providerApis.jira.getJiraProjectsForResource.bind(providerApis.jira),
|
|
250
427
|
getIssueFn: providerApis.jira.getIssue.bind(providerApis.jira) as GetIssueFn,
|
|
251
428
|
getIssuesForProjectFn: providerApis.jira.getIssuesForProject.bind(providerApis.jira),
|
|
252
429
|
getIssuesForResourceForCurrentUserFn: providerApis.jira.getIssuesForResourceForCurrentUser.bind(
|
|
@@ -260,10 +437,18 @@ export class ProvidersApi {
|
|
|
260
437
|
getIssuesForCurrentUserFn: providerApis.linear.getIssuesForCurrentUser.bind(providerApis.linear),
|
|
261
438
|
getLinearOrganizationFn: providerApis.linear.getLinearOrganization.bind(providerApis.linear),
|
|
262
439
|
getLinearTeamsForCurrentUserFn: providerApis.linear.getTeamsForCurrentUser.bind(providerApis.linear),
|
|
440
|
+
getLinearIssuesFn: providerApis.linear.getIssues.bind(providerApis.linear),
|
|
441
|
+
getLinearCurrentUserFn: providerApis.linear.getCurrentUser.bind(providerApis.linear),
|
|
263
442
|
},
|
|
264
443
|
[IssuesCloudHostIntegrationId.Trello]: {
|
|
265
444
|
...providersMetadata[IssuesCloudHostIntegrationId.Trello],
|
|
266
445
|
provider: providerApis.trello,
|
|
446
|
+
getTrelloCurrentUserFn: providerApis.trello.getCurrentUser.bind(providerApis.trello),
|
|
447
|
+
getTrelloBoardsForCurrentUserFn: providerApis.trello.getBoardsForCurrentUser.bind(providerApis.trello),
|
|
448
|
+
getTrelloListsForBoardFn: providerApis.trello.getListsForTrelloBoard.bind(providerApis.trello),
|
|
449
|
+
getTrelloAccountForIdFn: providerApis.trello.getAccountForId.bind(providerApis.trello),
|
|
450
|
+
getTrelloIssuesForBoardFn: providerApis.trello.getIssuesForBoard.bind(providerApis.trello),
|
|
451
|
+
getTrelloLabelsForBoardFn: providerApis.trello.getLabelsForBoard.bind(providerApis.trello),
|
|
267
452
|
},
|
|
268
453
|
};
|
|
269
454
|
}
|
|
@@ -308,9 +493,14 @@ export class ProvidersApi {
|
|
|
308
493
|
|
|
309
494
|
private async getProviderToken<T extends IntegrationIds>(
|
|
310
495
|
provider: ProviderInfo & { id: T },
|
|
311
|
-
options?: { createSessionIfNeeded?: boolean },
|
|
496
|
+
options?: { createSessionIfNeeded?: boolean; connectionId?: string },
|
|
312
497
|
): Promise<TokenWithInfo<T> | undefined> {
|
|
313
|
-
|
|
498
|
+
// When a specific connection is requested, resolve that connection's cloud session (mirroring
|
|
499
|
+
// `Integration.resolveReadSession`); otherwise keep the plain descriptor so the primary is resolved.
|
|
500
|
+
// An empty string is not a real target, so it must also fall through to the primary path.
|
|
501
|
+
const providerDescriptor = options?.connectionId
|
|
502
|
+
? { domain: provider.domain, scopes: provider.scopes, connectionId: options.connectionId, cloud: true }
|
|
503
|
+
: { domain: provider.domain, scopes: provider.scopes };
|
|
314
504
|
try {
|
|
315
505
|
const authProvider = await this.authenticationService.get(provider.id);
|
|
316
506
|
const session = await authProvider.getSession(providerDescriptor, {
|
|
@@ -329,9 +519,8 @@ export class ProvidersApi {
|
|
|
329
519
|
return base64(`PAT:${oauthToken}`);
|
|
330
520
|
}
|
|
331
521
|
|
|
332
|
-
private async
|
|
522
|
+
private async ensureProviderToken<T extends IntegrationIds>(
|
|
333
523
|
tokenOptInfo: TokenOptInfo<T>,
|
|
334
|
-
providerFn: keyof ProviderInfo,
|
|
335
524
|
): Promise<{ provider: ProviderInfo; tokenWithInfo: TokenWithInfo<T> }> {
|
|
336
525
|
const providerId = tokenOptInfo.providerId;
|
|
337
526
|
const provider = this.providers[providerId];
|
|
@@ -343,13 +532,26 @@ export class ProvidersApi {
|
|
|
343
532
|
throw new Error(`Provider id mismatch: expected ${providerId} but got ${provider.id}`);
|
|
344
533
|
}
|
|
345
534
|
|
|
535
|
+
const connectionId = 'connectionId' in tokenOptInfo ? tokenOptInfo.connectionId : undefined;
|
|
346
536
|
const tokenWithInfo = tokenOptInfo?.accessToken
|
|
347
537
|
? tokenOptInfo
|
|
348
|
-
: await this.getProviderToken<T>(provider as ProviderInfo & { id: T }
|
|
538
|
+
: await this.getProviderToken<T>(provider as ProviderInfo & { id: T }, {
|
|
539
|
+
connectionId: connectionId,
|
|
540
|
+
});
|
|
349
541
|
if (tokenWithInfo == null) {
|
|
350
542
|
throw new Error(`Not connected to provider ${providerId}`);
|
|
351
543
|
}
|
|
352
544
|
|
|
545
|
+
return { provider: provider, tokenWithInfo: tokenWithInfo };
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
private async ensureProviderTokenAndFunction<T extends IntegrationIds>(
|
|
549
|
+
tokenOptInfo: TokenOptInfo<T>,
|
|
550
|
+
providerFn: keyof ProviderInfo,
|
|
551
|
+
): Promise<{ provider: ProviderInfo; tokenWithInfo: TokenWithInfo<T> }> {
|
|
552
|
+
const { provider, tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);
|
|
553
|
+
const providerId = tokenOptInfo.providerId;
|
|
554
|
+
|
|
353
555
|
if (provider[providerFn] == null) {
|
|
354
556
|
throw new Error(`Provider with id ${providerId} does not support function: ${providerFn}`);
|
|
355
557
|
}
|
|
@@ -366,44 +568,29 @@ export class ProvidersApi {
|
|
|
366
568
|
}
|
|
367
569
|
|
|
368
570
|
if (error?.response?.status != null) {
|
|
369
|
-
|
|
571
|
+
const status: number = error.response.status;
|
|
572
|
+
switch (status) {
|
|
370
573
|
case 404: // Not found
|
|
371
574
|
case 410: // Gone
|
|
372
575
|
case 422: // Unprocessable Entity
|
|
373
576
|
throw new RequestNotFoundError(error);
|
|
577
|
+
case 429: // Too Many Requests
|
|
578
|
+
throw toRateLimitError(error, token);
|
|
374
579
|
case 401: // Unauthorized
|
|
375
|
-
if (error.message?.includes('rate limit')) {
|
|
376
|
-
let resetAt: number | undefined;
|
|
377
|
-
|
|
378
|
-
const reset = error.response?.headers?.['x-ratelimit-reset'];
|
|
379
|
-
if (reset != null) {
|
|
380
|
-
resetAt = parseInt(reset, 10);
|
|
381
|
-
if (Number.isNaN(resetAt)) {
|
|
382
|
-
resetAt = undefined;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
throw new RequestRateLimitError(error, token, resetAt);
|
|
387
|
-
}
|
|
388
|
-
throw new AuthenticationError(tokenInfo, AuthenticationErrorReason.Unauthorized, error);
|
|
389
580
|
case 403: // Forbidden
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
//
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
const reset = error.response.headers?.['x-ratelimit-reset'];
|
|
396
|
-
if (reset != null) {
|
|
397
|
-
resetAt = parseInt(reset, 10);
|
|
398
|
-
if (Number.isNaN(resetAt)) {
|
|
399
|
-
resetAt = undefined;
|
|
400
|
-
}
|
|
581
|
+
// A throttled request arrives on both statuses depending on the host (see
|
|
582
|
+
// `isRateLimitResponse`); 403 previously skipped the check, so every provider going through the
|
|
583
|
+
// SDK reported a rate limit as `auth` and asked the user to reconnect a healthy account.
|
|
584
|
+
if (isRateLimitResponse({ status: status, message: error.message })) {
|
|
585
|
+
throw toRateLimitError(error, token);
|
|
401
586
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
587
|
+
throw new AuthenticationError(
|
|
588
|
+
tokenInfo,
|
|
589
|
+
status === 401 ? AuthenticationErrorReason.Unauthorized : AuthenticationErrorReason.Forbidden,
|
|
590
|
+
error,
|
|
591
|
+
);
|
|
405
592
|
default:
|
|
406
|
-
if (
|
|
593
|
+
if (status >= 400 && status < 500) {
|
|
407
594
|
throw new RequestClientError(error);
|
|
408
595
|
}
|
|
409
596
|
}
|
|
@@ -418,13 +605,13 @@ export class ProvidersApi {
|
|
|
418
605
|
| ((
|
|
419
606
|
input: any,
|
|
420
607
|
options?: { token?: string; isPAT?: boolean; baseUrl?: string },
|
|
421
|
-
) => Promise<{ data: NonNullable<T>[]; pageInfo?: PageInfo }>)
|
|
608
|
+
) => Promise<{ data: NonNullable<T>[]; pageInfo?: PageInfo; metadata?: CollectionMetadata }>)
|
|
422
609
|
| undefined,
|
|
423
610
|
tokenWithInfo: TokenWithInfo,
|
|
424
611
|
cursor: string = '{}',
|
|
425
612
|
isPAT: boolean = false,
|
|
426
613
|
baseUrl?: string,
|
|
427
|
-
): Promise<
|
|
614
|
+
): Promise<ProviderApiPagedResult<T>> {
|
|
428
615
|
let cursorInfo;
|
|
429
616
|
try {
|
|
430
617
|
cursorInfo = JSON.parse(cursor);
|
|
@@ -433,16 +620,29 @@ export class ProvidersApi {
|
|
|
433
620
|
}
|
|
434
621
|
const cursorValue = cursorInfo.value;
|
|
435
622
|
const cursorType = cursorInfo.type;
|
|
623
|
+
// An explicit numbered `page` request wins over a page-typed cursor; otherwise follow the cursor. A
|
|
624
|
+
// live cursor-typed cursor still takes precedence so an in-flight continuation is never clobbered.
|
|
625
|
+
const requestedPage: number | undefined = typeof args?.page === 'number' ? args.page : undefined;
|
|
626
|
+
const requestedPageSize: number | undefined = typeof args?.pageSize === 'number' ? args.pageSize : undefined;
|
|
436
627
|
let cursorOrPage = {};
|
|
437
|
-
if (cursorType
|
|
628
|
+
if (requestedPage != null && cursorType !== 'cursor') {
|
|
629
|
+
cursorOrPage = { page: requestedPage };
|
|
630
|
+
} else if (cursorType === 'page') {
|
|
438
631
|
cursorOrPage = { page: cursorValue };
|
|
439
632
|
} else if (cursorType === 'cursor') {
|
|
440
633
|
cursorOrPage = { cursor: cursorValue };
|
|
441
634
|
}
|
|
442
635
|
|
|
636
|
+
// Strip the caller's paging keys so `getPagedResult` fully controls them; otherwise `args.page` could
|
|
637
|
+
// survive alongside a resolved `cursor` (or the raw serialized wrapper `args.cursor` could leak in when
|
|
638
|
+
// following a page), letting the provider clobber the continuation we intended.
|
|
639
|
+
const { page: _page, pageSize: _pageSize, cursor: _cursor, ...restArgs } = args ?? {};
|
|
443
640
|
const input = {
|
|
444
|
-
...
|
|
641
|
+
...restArgs,
|
|
445
642
|
...cursorOrPage,
|
|
643
|
+
// `pageSize` is honored by numbered providers; GitHub reads `maxPageSize`. Set both so whichever
|
|
644
|
+
// the resolved provider understands takes effect; the other is ignored.
|
|
645
|
+
...(requestedPageSize != null ? { pageSize: requestedPageSize, maxPageSize: requestedPageSize } : {}),
|
|
446
646
|
};
|
|
447
647
|
|
|
448
648
|
try {
|
|
@@ -452,27 +652,57 @@ export class ProvidersApi {
|
|
|
452
652
|
baseUrl: baseUrl,
|
|
453
653
|
});
|
|
454
654
|
if (result == null) {
|
|
455
|
-
|
|
655
|
+
const continuationWasRequested =
|
|
656
|
+
(cursor != null && cursor !== '{}') || (requestedPage != null && requestedPage > 1);
|
|
657
|
+
return continuationWasRequested
|
|
658
|
+
? {
|
|
659
|
+
values: [],
|
|
660
|
+
paging: { cursor: '{}', more: false, truncated: true },
|
|
661
|
+
metadata: { completeness: 'partial' },
|
|
662
|
+
}
|
|
663
|
+
: { values: [] };
|
|
456
664
|
}
|
|
457
665
|
|
|
458
|
-
const
|
|
666
|
+
const pageInfo = result.pageInfo;
|
|
667
|
+
const hasMore = pageInfo?.hasNextPage ?? false;
|
|
459
668
|
|
|
460
669
|
let nextCursor = '{}';
|
|
461
|
-
if (
|
|
462
|
-
nextCursor = JSON.stringify({ value:
|
|
463
|
-
} else if (
|
|
464
|
-
nextCursor = JSON.stringify({ value:
|
|
670
|
+
if (pageInfo?.endCursor != null) {
|
|
671
|
+
nextCursor = JSON.stringify({ value: pageInfo.endCursor, type: 'cursor' });
|
|
672
|
+
} else if (pageInfo?.nextPage != null) {
|
|
673
|
+
nextCursor = JSON.stringify({ value: pageInfo.nextPage, type: 'page' });
|
|
465
674
|
}
|
|
675
|
+
const continuationBroken = hasMore && (nextCursor === '{}' || nextCursor === cursor);
|
|
676
|
+
const normalizedMetadata = mergeCollectionMetadata(
|
|
677
|
+
result.metadata,
|
|
678
|
+
continuationBroken ? { completeness: 'partial' } : undefined,
|
|
679
|
+
);
|
|
680
|
+
|
|
681
|
+
// SDK collection completeness is independent from provider-native pagination: a result can expose a
|
|
682
|
+
// real next page (`more`) and still have a failed sibling scope (`partial`/`unknown`). Surface the
|
|
683
|
+
// latter as `truncated` so consumers treat the page as incomplete. Absent metadata (old providers,
|
|
684
|
+
// test doubles) leaves `truncated` unset for backward compatibility.
|
|
685
|
+
const truncated =
|
|
686
|
+
normalizedMetadata != null && normalizedMetadata.completeness !== 'complete' ? true : undefined;
|
|
466
687
|
|
|
467
688
|
return {
|
|
468
689
|
values: result.data,
|
|
469
690
|
paging: {
|
|
470
691
|
cursor: nextCursor,
|
|
471
|
-
more: hasMore,
|
|
692
|
+
more: hasMore && !continuationBroken,
|
|
693
|
+
truncated: truncated,
|
|
694
|
+
// Numbered-page metadata; left undefined by cursor-based providers (which don't report a
|
|
695
|
+
// currentPage), so we never echo the requested page for a provider that ignored it.
|
|
696
|
+
page: pageInfo?.currentPage ?? undefined,
|
|
697
|
+
pageSize: requestedPageSize,
|
|
698
|
+
nextPage: pageInfo?.nextPage ?? undefined,
|
|
699
|
+
totalPages: pageInfo?.totalPages ?? undefined,
|
|
700
|
+
totalCount: pageInfo?.totalCount ?? undefined,
|
|
472
701
|
},
|
|
702
|
+
metadata: normalizedMetadata,
|
|
473
703
|
};
|
|
474
704
|
} catch (e) {
|
|
475
|
-
return this.handleProviderError<
|
|
705
|
+
return this.handleProviderError<ProviderApiPagedResult<T>>(tokenWithInfo, e);
|
|
476
706
|
}
|
|
477
707
|
}
|
|
478
708
|
|
|
@@ -484,7 +714,12 @@ export class ProvidersApi {
|
|
|
484
714
|
options?: { isPAT?: boolean; baseUrl?: string },
|
|
485
715
|
): Promise<ProviderRepository | undefined> {
|
|
486
716
|
const providerId = tokenOptInfo.providerId;
|
|
487
|
-
|
|
717
|
+
const isAzureDevOps =
|
|
718
|
+
providerId === GitCloudHostIntegrationId.AzureDevOps ||
|
|
719
|
+
providerId === GitSelfManagedHostIntegrationId.AzureDevOpsServer;
|
|
720
|
+
if (isAzureDevOps) {
|
|
721
|
+
if (project == null) return undefined;
|
|
722
|
+
|
|
488
723
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
489
724
|
tokenOptInfo,
|
|
490
725
|
'getRepoOfProjectFn',
|
|
@@ -498,6 +733,7 @@ export class ProvidersApi {
|
|
|
498
733
|
);
|
|
499
734
|
return result?.data;
|
|
500
735
|
} catch (e) {
|
|
736
|
+
if (isGraphQLRepoNotFoundError(e)) throw new RequestNotFoundError(toError(e));
|
|
501
737
|
return this.handleProviderError<ProviderRepository>(tokenWithInfo, e);
|
|
502
738
|
}
|
|
503
739
|
} else {
|
|
@@ -511,6 +747,7 @@ export class ProvidersApi {
|
|
|
511
747
|
);
|
|
512
748
|
return result?.data;
|
|
513
749
|
} catch (e) {
|
|
750
|
+
if (isGraphQLRepoNotFoundError(e)) throw new RequestNotFoundError(toError(e));
|
|
514
751
|
return this.handleProviderError<ProviderRepository>(tokenWithInfo, e);
|
|
515
752
|
}
|
|
516
753
|
}
|
|
@@ -627,6 +864,45 @@ export class ProvidersApi {
|
|
|
627
864
|
}
|
|
628
865
|
}
|
|
629
866
|
|
|
867
|
+
/**
|
|
868
|
+
* Reads issues scoped to Linear teams/projects/labels (Linear's issue-list filter). One page per call —
|
|
869
|
+
* follow `paging.cursor`. Linear's `getIssues` has no author/assignee filter, so per-user scoping is
|
|
870
|
+
* applied client-side by the caller.
|
|
871
|
+
*/
|
|
872
|
+
async getLinearIssues(
|
|
873
|
+
tokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Linear>,
|
|
874
|
+
input: { teams?: string[]; projects?: string[]; labels?: string[] },
|
|
875
|
+
options?: PagingInput,
|
|
876
|
+
): Promise<PagedResult<ProviderIssue>> {
|
|
877
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
878
|
+
tokenOptInfo,
|
|
879
|
+
'getLinearIssuesFn',
|
|
880
|
+
);
|
|
881
|
+
return this.getPagedResult<ProviderIssue>(
|
|
882
|
+
{ ...input, ...options },
|
|
883
|
+
provider.getLinearIssuesFn,
|
|
884
|
+
tokenWithInfo,
|
|
885
|
+
options?.cursor ?? undefined,
|
|
886
|
+
);
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/** Resolves Linear's current user (viewer). The viewer query returns only id/name/email/displayName. */
|
|
890
|
+
async getLinearCurrentUser(
|
|
891
|
+
tokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Linear>,
|
|
892
|
+
): Promise<{ id: string; name?: string | null; email?: string | null; displayName?: string | null } | undefined> {
|
|
893
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
894
|
+
tokenOptInfo,
|
|
895
|
+
'getLinearCurrentUserFn',
|
|
896
|
+
);
|
|
897
|
+
const token = tokenWithInfo.accessToken;
|
|
898
|
+
|
|
899
|
+
try {
|
|
900
|
+
return (await provider.getLinearCurrentUserFn?.({ token: token }))?.data;
|
|
901
|
+
} catch (e) {
|
|
902
|
+
return this.handleProviderError(tokenWithInfo, e);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
|
|
630
906
|
async getAzureResourcesForUser(
|
|
631
907
|
tokenOptInfo: TokenWithInfo<
|
|
632
908
|
GitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer
|
|
@@ -654,25 +930,58 @@ export class ProvidersApi {
|
|
|
654
930
|
|
|
655
931
|
async getBitbucketResourcesForCurrentUser(
|
|
656
932
|
tokenOptInfo: TokenWithInfo<GitCloudHostIntegrationId.Bitbucket>,
|
|
657
|
-
): Promise<ProviderBitbucketResource
|
|
933
|
+
): Promise<ProviderApiPagedResult<ProviderBitbucketResource> | undefined> {
|
|
658
934
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
659
935
|
tokenOptInfo,
|
|
660
936
|
'getBitbucketResourcesForCurrentUserFn',
|
|
661
937
|
);
|
|
662
938
|
const token = tokenWithInfo.accessToken;
|
|
663
939
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
940
|
+
// Drain every workspace page (numbered): the SDK returns 50 per page, and a user in more than one page
|
|
941
|
+
// of workspaces would otherwise silently lose the rest (with them, their orgs/PRs). A scoped drain keeps
|
|
942
|
+
// a successful prefix plus structured failure metadata when a later page fails.
|
|
943
|
+
const result = await collectProviderPagedResult(
|
|
944
|
+
async cursor => {
|
|
945
|
+
try {
|
|
946
|
+
const page = parsePageCursor(cursor);
|
|
947
|
+
const response = await provider.getBitbucketResourcesForCurrentUserFn?.(
|
|
948
|
+
{ page: page },
|
|
949
|
+
{ token: token },
|
|
950
|
+
);
|
|
951
|
+
if (response == null) return undefined;
|
|
952
|
+
|
|
953
|
+
const hasMore = response.pageInfo?.hasNextPage === true;
|
|
954
|
+
const nextPage = response.pageInfo?.nextPage;
|
|
955
|
+
return {
|
|
956
|
+
values: response.data,
|
|
957
|
+
paging: {
|
|
958
|
+
more: hasMore,
|
|
959
|
+
cursor: hasMore && nextPage != null ? toPageCursor(nextPage) : '{}',
|
|
960
|
+
},
|
|
961
|
+
};
|
|
962
|
+
} catch (ex) {
|
|
963
|
+
return this.handleProviderError<ProviderApiPagedResult<ProviderBitbucketResource>>(
|
|
964
|
+
tokenWithInfo,
|
|
965
|
+
ex,
|
|
966
|
+
);
|
|
967
|
+
}
|
|
968
|
+
},
|
|
969
|
+
20,
|
|
970
|
+
{ providerId: tokenWithInfo.providerId },
|
|
971
|
+
);
|
|
972
|
+
return {
|
|
973
|
+
values: result.values,
|
|
974
|
+
paging: { cursor: '{}', more: false, ...(result.truncated ? { truncated: true } : {}) },
|
|
975
|
+
...(result.metadata != null ? { metadata: result.metadata } : {}),
|
|
976
|
+
};
|
|
669
977
|
}
|
|
670
978
|
|
|
671
979
|
async getBitbucketPullRequestsAuthoredByUserForWorkspace(
|
|
672
980
|
tokenOptInfo: TokenWithInfo<GitCloudHostIntegrationId.Bitbucket>,
|
|
673
981
|
userId: string,
|
|
674
982
|
workspaceSlug: string,
|
|
675
|
-
|
|
983
|
+
options?: { states?: GitPullRequestState[]; page?: number },
|
|
984
|
+
): Promise<{ data: ProviderPullRequest[]; hasMore: boolean; nextPage: number | null } | undefined> {
|
|
676
985
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
677
986
|
tokenOptInfo,
|
|
678
987
|
'getBitbucketPullRequestsAuthoredByUserForWorkspaceFn',
|
|
@@ -680,12 +989,12 @@ export class ProvidersApi {
|
|
|
680
989
|
const token = tokenWithInfo.accessToken;
|
|
681
990
|
|
|
682
991
|
try {
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
992
|
+
const result = await provider.getBitbucketPullRequestsAuthoredByUserForWorkspaceFn?.(
|
|
993
|
+
{ userId: userId, workspaceSlug: workspaceSlug, states: options?.states, page: options?.page },
|
|
994
|
+
{ token: token },
|
|
995
|
+
);
|
|
996
|
+
if (result == null) return undefined;
|
|
997
|
+
return { data: result.data, hasMore: result.pageInfo.hasNextPage, nextPage: result.pageInfo.nextPage };
|
|
689
998
|
} catch (e) {
|
|
690
999
|
return this.handleProviderError(tokenWithInfo, e);
|
|
691
1000
|
}
|
|
@@ -694,16 +1003,20 @@ export class ProvidersApi {
|
|
|
694
1003
|
async getBitbucketServerPullRequestsForCurrentUser(
|
|
695
1004
|
tokenOptInfo: TokenWithInfo<GitSelfManagedHostIntegrationId.BitbucketServer>,
|
|
696
1005
|
baseUrl: string,
|
|
697
|
-
|
|
1006
|
+
options?: { states?: GitPullRequestState[]; page?: number },
|
|
1007
|
+
): Promise<{ data: ProviderPullRequest[]; hasMore: boolean; nextPage: number | null } | undefined> {
|
|
698
1008
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
699
1009
|
tokenOptInfo,
|
|
700
1010
|
'getBitbucketServerPullRequestsForCurrentUserFn',
|
|
701
1011
|
);
|
|
702
1012
|
const token = tokenWithInfo.accessToken;
|
|
703
1013
|
try {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
1014
|
+
const result = await provider.getBitbucketServerPullRequestsForCurrentUserFn?.(
|
|
1015
|
+
{ states: options?.states, page: options?.page },
|
|
1016
|
+
{ token: token, baseUrl: baseUrl },
|
|
1017
|
+
);
|
|
1018
|
+
if (result == null) return undefined;
|
|
1019
|
+
return { data: result.data, hasMore: result.pageInfo.hasNextPage, nextPage: result.pageInfo.nextPage };
|
|
707
1020
|
} catch (e) {
|
|
708
1021
|
return this.handleProviderError(tokenWithInfo, e);
|
|
709
1022
|
}
|
|
@@ -712,7 +1025,7 @@ export class ProvidersApi {
|
|
|
712
1025
|
async getJiraProjectsForResources(
|
|
713
1026
|
tokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Jira>,
|
|
714
1027
|
resourceIds: string[],
|
|
715
|
-
): Promise<ProviderJiraProject
|
|
1028
|
+
): Promise<ProviderApiCollectionResult<ProviderJiraProject>> {
|
|
716
1029
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
717
1030
|
tokenOptInfo,
|
|
718
1031
|
'getJiraProjectsForResourcesFn',
|
|
@@ -720,13 +1033,36 @@ export class ProvidersApi {
|
|
|
720
1033
|
const token = tokenWithInfo.accessToken;
|
|
721
1034
|
|
|
722
1035
|
try {
|
|
723
|
-
|
|
724
|
-
|
|
1036
|
+
const result = await provider.getJiraProjectsForResourcesFn?.(
|
|
1037
|
+
{ resourceIds: resourceIds },
|
|
1038
|
+
{ token: token },
|
|
1039
|
+
);
|
|
1040
|
+
// Preserve the SDK's per-resource completeness/failures instead of collapsing to a bare array, so the
|
|
1041
|
+
// Jira integration can cache only proven-successful resources and warn on the failed ones.
|
|
1042
|
+
return { values: result?.data ?? [], metadata: result?.metadata };
|
|
725
1043
|
} catch (e) {
|
|
726
|
-
return this.handleProviderError<ProviderJiraProject
|
|
1044
|
+
return this.handleProviderError<ProviderApiCollectionResult<ProviderJiraProject>>(tokenWithInfo, e);
|
|
727
1045
|
}
|
|
728
1046
|
}
|
|
729
1047
|
|
|
1048
|
+
async getJiraProjectsForResource(
|
|
1049
|
+
tokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Jira>,
|
|
1050
|
+
resourceId: string,
|
|
1051
|
+
options?: { cursor?: string },
|
|
1052
|
+
): Promise<ProviderApiPagedResult<ProviderJiraProject>> {
|
|
1053
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1054
|
+
tokenOptInfo,
|
|
1055
|
+
'getJiraProjectsForResourceFn',
|
|
1056
|
+
);
|
|
1057
|
+
|
|
1058
|
+
return this.getPagedResult(
|
|
1059
|
+
{ resourceId: resourceId },
|
|
1060
|
+
provider.getJiraProjectsForResourceFn,
|
|
1061
|
+
tokenWithInfo,
|
|
1062
|
+
options?.cursor,
|
|
1063
|
+
);
|
|
1064
|
+
}
|
|
1065
|
+
|
|
730
1066
|
async getAzureProjectsForResource(
|
|
731
1067
|
tokenOptInfo: TokenWithInfo<
|
|
732
1068
|
GitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer
|
|
@@ -780,11 +1116,149 @@ export class ProvidersApi {
|
|
|
780
1116
|
);
|
|
781
1117
|
}
|
|
782
1118
|
|
|
1119
|
+
async getGitHubOrgsForCurrentUser(
|
|
1120
|
+
tokenOptInfo: TokenWithInfo<
|
|
1121
|
+
GitCloudHostIntegrationId.GitHub | GitSelfManagedHostIntegrationId.CloudGitHubEnterprise
|
|
1122
|
+
>,
|
|
1123
|
+
options?: { isPAT?: boolean; baseUrl?: string },
|
|
1124
|
+
): Promise<ProviderHierarchyResult<ProviderGitHubOrganization>> {
|
|
1125
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1126
|
+
tokenOptInfo,
|
|
1127
|
+
'getOrgsForCurrentUserFn',
|
|
1128
|
+
);
|
|
1129
|
+
|
|
1130
|
+
// Drain all pages so a user in many orgs doesn't lose everything past the first page, while
|
|
1131
|
+
// surfacing `truncated` when the defensive backstop stops before the listing is exhausted.
|
|
1132
|
+
const result = await collectProviderPagedResult(
|
|
1133
|
+
cursor =>
|
|
1134
|
+
this.getPagedResult<ProviderGitHubOrganization>(
|
|
1135
|
+
{},
|
|
1136
|
+
provider.getOrgsForCurrentUserFn,
|
|
1137
|
+
tokenWithInfo,
|
|
1138
|
+
cursor,
|
|
1139
|
+
options?.isPAT,
|
|
1140
|
+
options?.baseUrl,
|
|
1141
|
+
),
|
|
1142
|
+
20,
|
|
1143
|
+
{ providerId: tokenWithInfo.providerId },
|
|
1144
|
+
);
|
|
1145
|
+
// This method drains internally and takes no cursor, so a backstop cursor isn't resumable by
|
|
1146
|
+
// callers — keep only the truncation signal rather than exposing a misleading `paging`.
|
|
1147
|
+
return {
|
|
1148
|
+
values: result.values,
|
|
1149
|
+
...(result.truncated ? { truncated: true } : {}),
|
|
1150
|
+
...(result.metadata != null ? { metadata: result.metadata } : {}),
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
async getReposForOrg(
|
|
1155
|
+
tokenOptInfo: TokenWithInfo<
|
|
1156
|
+
GitCloudHostIntegrationId.GitHub | GitSelfManagedHostIntegrationId.CloudGitHubEnterprise
|
|
1157
|
+
>,
|
|
1158
|
+
orgName: string,
|
|
1159
|
+
options?: GetReposOptions & { isPAT?: boolean; baseUrl?: string },
|
|
1160
|
+
): Promise<PagedResult<ProviderRepository>> {
|
|
1161
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, 'getReposForOrgFn');
|
|
1162
|
+
|
|
1163
|
+
return this.getPagedResult<ProviderRepository>(
|
|
1164
|
+
{ orgName: orgName },
|
|
1165
|
+
provider.getReposForOrgFn,
|
|
1166
|
+
tokenWithInfo,
|
|
1167
|
+
options?.cursor,
|
|
1168
|
+
options?.isPAT,
|
|
1169
|
+
options?.baseUrl,
|
|
1170
|
+
);
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
async getReposForBitbucketWorkspace(
|
|
1174
|
+
tokenOptInfo: TokenWithInfo<GitCloudHostIntegrationId.Bitbucket>,
|
|
1175
|
+
workspace: string,
|
|
1176
|
+
options?: GetReposOptions & { isPAT?: boolean; baseUrl?: string },
|
|
1177
|
+
): Promise<PagedResult<ProviderRepository>> {
|
|
1178
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1179
|
+
tokenOptInfo,
|
|
1180
|
+
'getReposForWorkspaceFn',
|
|
1181
|
+
);
|
|
1182
|
+
|
|
1183
|
+
return this.getPagedResult<ProviderRepository>(
|
|
1184
|
+
{ workspace: workspace },
|
|
1185
|
+
provider.getReposForWorkspaceFn,
|
|
1186
|
+
tokenWithInfo,
|
|
1187
|
+
options?.cursor,
|
|
1188
|
+
options?.isPAT,
|
|
1189
|
+
options?.baseUrl,
|
|
1190
|
+
);
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
async getReposForCurrentUser(
|
|
1194
|
+
tokenOptInfo: TokenWithInfo<
|
|
1195
|
+
| GitCloudHostIntegrationId.GitHub
|
|
1196
|
+
| GitSelfManagedHostIntegrationId.CloudGitHubEnterprise
|
|
1197
|
+
| GitCloudHostIntegrationId.GitLab
|
|
1198
|
+
| GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted
|
|
1199
|
+
>,
|
|
1200
|
+
options?: GetReposOptions & {
|
|
1201
|
+
/** GitHub `/user/repos` affiliation filter; ignored by GitLab's membership read. */
|
|
1202
|
+
affiliations?: ('owner' | 'collaborator' | 'organization_member')[];
|
|
1203
|
+
isPAT?: boolean;
|
|
1204
|
+
baseUrl?: string;
|
|
1205
|
+
},
|
|
1206
|
+
): Promise<PagedResult<ProviderRepository>> {
|
|
1207
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1208
|
+
tokenOptInfo,
|
|
1209
|
+
'getReposForCurrentUserFn',
|
|
1210
|
+
);
|
|
1211
|
+
|
|
1212
|
+
return this.getPagedResult<ProviderRepository>(
|
|
1213
|
+
options?.affiliations != null ? { affiliations: options.affiliations } : {},
|
|
1214
|
+
provider.getReposForCurrentUserFn,
|
|
1215
|
+
tokenWithInfo,
|
|
1216
|
+
options?.cursor,
|
|
1217
|
+
options?.isPAT,
|
|
1218
|
+
options?.baseUrl,
|
|
1219
|
+
);
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
async getGitlabGroupsForCurrentUser(
|
|
1223
|
+
tokenOptInfo: TokenWithInfo<
|
|
1224
|
+
GitCloudHostIntegrationId.GitLab | GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted
|
|
1225
|
+
>,
|
|
1226
|
+
options?: { topLevelOnly?: boolean; isPAT?: boolean; baseUrl?: string },
|
|
1227
|
+
): Promise<ProviderHierarchyResult<ProviderGitLabGroup>> {
|
|
1228
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1229
|
+
tokenOptInfo,
|
|
1230
|
+
'getGroupsForCurrentUserFn',
|
|
1231
|
+
);
|
|
1232
|
+
|
|
1233
|
+
// Drain all pages so a user in many groups doesn't lose everything past the first page, while
|
|
1234
|
+
// surfacing `truncated` when the defensive backstop stops before the listing is exhausted.
|
|
1235
|
+
const result = await collectProviderPagedResult(
|
|
1236
|
+
cursor =>
|
|
1237
|
+
this.getPagedResult<ProviderGitLabGroup>(
|
|
1238
|
+
{ topLevelOnly: options?.topLevelOnly },
|
|
1239
|
+
provider.getGroupsForCurrentUserFn,
|
|
1240
|
+
tokenWithInfo,
|
|
1241
|
+
cursor,
|
|
1242
|
+
options?.isPAT,
|
|
1243
|
+
options?.baseUrl,
|
|
1244
|
+
),
|
|
1245
|
+
20,
|
|
1246
|
+
{ providerId: tokenWithInfo.providerId },
|
|
1247
|
+
);
|
|
1248
|
+
// This method drains internally and takes no cursor, so a backstop cursor isn't resumable by
|
|
1249
|
+
// callers — keep only the truncation signal rather than exposing a misleading `paging`.
|
|
1250
|
+
return {
|
|
1251
|
+
values: result.values,
|
|
1252
|
+
...(result.truncated ? { truncated: true } : {}),
|
|
1253
|
+
...(result.metadata != null ? { metadata: result.metadata } : {}),
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
|
|
783
1257
|
async getPullRequestsForRepos(
|
|
784
1258
|
tokenOptInfo: TokenOptInfo,
|
|
785
1259
|
reposOrIds: ProviderReposInput,
|
|
786
1260
|
options?: GetPullRequestsOptions & { isPAT?: boolean; baseUrl?: string },
|
|
787
|
-
): Promise<
|
|
1261
|
+
): Promise<ProviderApiPagedResult<ProviderPullRequest>> {
|
|
788
1262
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
789
1263
|
tokenOptInfo,
|
|
790
1264
|
'getPullRequestsForReposFn',
|
|
@@ -807,7 +1281,7 @@ export class ProvidersApi {
|
|
|
807
1281
|
tokenOptInfo: TokenOptInfo,
|
|
808
1282
|
repo: ProviderRepoInput,
|
|
809
1283
|
options?: GetPullRequestsOptions & { isPAT?: boolean; baseUrl?: string },
|
|
810
|
-
): Promise<
|
|
1284
|
+
): Promise<ProviderApiPagedResult<ProviderPullRequest>> {
|
|
811
1285
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
812
1286
|
tokenOptInfo,
|
|
813
1287
|
'getPullRequestsForRepoFn',
|
|
@@ -827,17 +1301,17 @@ export class ProvidersApi {
|
|
|
827
1301
|
tokenWithInfo: TokenWithInfo<GitCloudHostIntegrationId.Bitbucket>,
|
|
828
1302
|
userId: string,
|
|
829
1303
|
options?: { isPAT?: boolean } & GetPullRequestsForUserOptions,
|
|
830
|
-
): Promise<
|
|
1304
|
+
): Promise<ProviderApiPagedResult<ProviderPullRequest>>;
|
|
831
1305
|
async getPullRequestsForUser(
|
|
832
1306
|
tokenWithInfo: TokenWithInfo<Exclude<IntegrationIds, GitCloudHostIntegrationId.Bitbucket>>,
|
|
833
1307
|
username: string,
|
|
834
1308
|
options?: { isPAT?: boolean } & GetPullRequestsForUserOptions,
|
|
835
|
-
): Promise<
|
|
1309
|
+
): Promise<ProviderApiPagedResult<ProviderPullRequest>>;
|
|
836
1310
|
async getPullRequestsForUser(
|
|
837
1311
|
tokenOptInfo: TokenWithInfo,
|
|
838
1312
|
usernameOrId: string,
|
|
839
1313
|
options?: { isPAT?: boolean } & GetPullRequestsForUserOptions,
|
|
840
|
-
): Promise<
|
|
1314
|
+
): Promise<ProviderApiPagedResult<ProviderPullRequest>> {
|
|
841
1315
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
842
1316
|
tokenOptInfo,
|
|
843
1317
|
'getPullRequestsForUserFn',
|
|
@@ -858,6 +1332,40 @@ export class ProvidersApi {
|
|
|
858
1332
|
);
|
|
859
1333
|
}
|
|
860
1334
|
|
|
1335
|
+
async getGitLabPullRequestsForUserAssociation(
|
|
1336
|
+
tokenOptInfo: TokenWithInfo<
|
|
1337
|
+
GitCloudHostIntegrationId.GitLab | GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted
|
|
1338
|
+
>,
|
|
1339
|
+
username: string,
|
|
1340
|
+
association: 'assigned' | 'authored' | 'reviewRequested',
|
|
1341
|
+
options?: {
|
|
1342
|
+
isPAT?: boolean;
|
|
1343
|
+
baseUrl?: string;
|
|
1344
|
+
states?: GitPullRequestState[];
|
|
1345
|
+
cursor?: string;
|
|
1346
|
+
pageSize?: number;
|
|
1347
|
+
},
|
|
1348
|
+
): Promise<ProviderApiPagedResult<ProviderPullRequest>> {
|
|
1349
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1350
|
+
tokenOptInfo,
|
|
1351
|
+
'getGitLabPullRequestsForUserAssociationFn',
|
|
1352
|
+
);
|
|
1353
|
+
|
|
1354
|
+
return this.getPagedResult(
|
|
1355
|
+
{
|
|
1356
|
+
username: username,
|
|
1357
|
+
association: association,
|
|
1358
|
+
states: options?.states,
|
|
1359
|
+
pageSize: options?.pageSize,
|
|
1360
|
+
},
|
|
1361
|
+
provider.getGitLabPullRequestsForUserAssociationFn,
|
|
1362
|
+
tokenWithInfo,
|
|
1363
|
+
options?.cursor,
|
|
1364
|
+
options?.isPAT,
|
|
1365
|
+
options?.baseUrl,
|
|
1366
|
+
);
|
|
1367
|
+
}
|
|
1368
|
+
|
|
861
1369
|
async getPullRequestsForAzureProjects(
|
|
862
1370
|
tokenOptInfo: TokenWithInfo<
|
|
863
1371
|
GitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer
|
|
@@ -866,10 +1374,13 @@ export class ProvidersApi {
|
|
|
866
1374
|
options?: {
|
|
867
1375
|
authorLogin?: string;
|
|
868
1376
|
assigneeLogins?: string[];
|
|
1377
|
+
reviewerId?: string;
|
|
1378
|
+
states?: GitPullRequestState[];
|
|
1379
|
+
repo?: ProviderRepoInput;
|
|
869
1380
|
isPAT?: boolean;
|
|
870
1381
|
baseUrl?: string;
|
|
871
1382
|
},
|
|
872
|
-
): Promise<ProviderPullRequest
|
|
1383
|
+
): Promise<ProviderApiCollectionResult<ProviderPullRequest>> {
|
|
873
1384
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
874
1385
|
tokenOptInfo,
|
|
875
1386
|
'getPullRequestsForAzureProjectsFn',
|
|
@@ -880,14 +1391,77 @@ export class ProvidersApi {
|
|
|
880
1391
|
const azureToken = options?.isPAT ? token : this.getAzurePATForOAuthToken(token);
|
|
881
1392
|
|
|
882
1393
|
try {
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
1394
|
+
const result = await provider.getPullRequestsForAzureProjectsFn?.(
|
|
1395
|
+
{
|
|
1396
|
+
projects: projects,
|
|
1397
|
+
authorLogin: options?.authorLogin,
|
|
1398
|
+
assigneeLogins: options?.assigneeLogins,
|
|
1399
|
+
reviewerId: options?.reviewerId,
|
|
1400
|
+
states: options?.states,
|
|
1401
|
+
repo: options?.repo,
|
|
1402
|
+
},
|
|
1403
|
+
// `azureToken` is always a PAT here (the raw token when `isPAT`, otherwise a PAT derived from
|
|
1404
|
+
// the OAuth token), so it must be sent as a PAT regardless of the incoming `options?.isPAT`.
|
|
1405
|
+
{ token: azureToken, isPAT: true, baseUrl: options?.baseUrl },
|
|
1406
|
+
);
|
|
1407
|
+
// The SDK's multi-project aggregate preserves successful projects and reports failed/incomplete ones
|
|
1408
|
+
// through `metadata` (it has no `pageInfo`); keep it so the account-wide drain can warn on the failed
|
|
1409
|
+
// projects and set `fetchFailed` instead of publishing a partial Azure read as complete.
|
|
1410
|
+
return { values: result?.data ?? [], metadata: result?.metadata };
|
|
889
1411
|
} catch (e) {
|
|
890
|
-
return this.handleProviderError<ProviderPullRequest
|
|
1412
|
+
return this.handleProviderError<ProviderApiCollectionResult<ProviderPullRequest>>(tokenWithInfo, e);
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
/**
|
|
1417
|
+
* Single Azure project PR read, paginated by number. Unlike {@link getPullRequestsForAzureProjects} (which
|
|
1418
|
+
* aggregates across projects and exposes no paging), this returns one page plus whether more remain, so a
|
|
1419
|
+
* caller can drain a project fully.
|
|
1420
|
+
*/
|
|
1421
|
+
async getPullRequestsForAzureProject(
|
|
1422
|
+
tokenOptInfo: TokenWithInfo<
|
|
1423
|
+
GitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer
|
|
1424
|
+
>,
|
|
1425
|
+
project: { namespace: string; project: string },
|
|
1426
|
+
options?: {
|
|
1427
|
+
authorLogin?: string;
|
|
1428
|
+
assigneeLogins?: string[];
|
|
1429
|
+
reviewerId?: string;
|
|
1430
|
+
states?: GitPullRequestState[];
|
|
1431
|
+
repo?: ProviderRepoInput;
|
|
1432
|
+
page?: number;
|
|
1433
|
+
isPAT?: boolean;
|
|
1434
|
+
baseUrl?: string;
|
|
1435
|
+
},
|
|
1436
|
+
): Promise<{ data: ProviderPullRequest[]; hasMore: boolean; nextPage: number | null } | undefined> {
|
|
1437
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1438
|
+
tokenOptInfo,
|
|
1439
|
+
'getPullRequestsForAzureProjectFn',
|
|
1440
|
+
);
|
|
1441
|
+
const token = tokenWithInfo.accessToken;
|
|
1442
|
+
// Azure only supports PAT for this call
|
|
1443
|
+
const azureToken = options?.isPAT ? token : this.getAzurePATForOAuthToken(token);
|
|
1444
|
+
|
|
1445
|
+
try {
|
|
1446
|
+
const result = await provider.getPullRequestsForAzureProjectFn?.(
|
|
1447
|
+
{
|
|
1448
|
+
namespace: project.namespace,
|
|
1449
|
+
project: project.project,
|
|
1450
|
+
authorLogin: options?.authorLogin,
|
|
1451
|
+
assigneeLogins: options?.assigneeLogins,
|
|
1452
|
+
reviewerId: options?.reviewerId,
|
|
1453
|
+
states: options?.states,
|
|
1454
|
+
repo: options?.repo,
|
|
1455
|
+
page: options?.page,
|
|
1456
|
+
},
|
|
1457
|
+
// `azureToken` is always a PAT here (already PAT-formatted when `isPAT`, otherwise derived from
|
|
1458
|
+
// the OAuth token), so it must be sent as a PAT regardless of the incoming `options?.isPAT`.
|
|
1459
|
+
{ token: azureToken, isPAT: true, baseUrl: options?.baseUrl },
|
|
1460
|
+
);
|
|
1461
|
+
if (result == null) return undefined;
|
|
1462
|
+
return { data: result.data, hasMore: result.pageInfo.hasNextPage, nextPage: result.pageInfo.nextPage };
|
|
1463
|
+
} catch (e) {
|
|
1464
|
+
return this.handleProviderError(tokenWithInfo, e);
|
|
891
1465
|
}
|
|
892
1466
|
}
|
|
893
1467
|
|
|
@@ -984,14 +1558,33 @@ export class ProvidersApi {
|
|
|
984
1558
|
|
|
985
1559
|
async getIssuesForCurrentUser(
|
|
986
1560
|
tokenOptInfo: TokenWithInfo,
|
|
987
|
-
options?: PagingInput & {
|
|
1561
|
+
options?: PagingInput & {
|
|
1562
|
+
// Forwarded to the provider fn (GitLab's account-wide REST read); Linear ignores them.
|
|
1563
|
+
scope?: 'assigned_to_me' | 'all';
|
|
1564
|
+
assigneeUsername?: string;
|
|
1565
|
+
/**
|
|
1566
|
+
* Narrows to issues authored by this user. Honored as of `@gitkraken/provider-apis` 0.54.0
|
|
1567
|
+
* (`author_username`); it composes with `assigneeUsername` as AND, so a caller wanting the UNION of the
|
|
1568
|
+
* two relationships must read each separately (see GitLab's account-wide issue read).
|
|
1569
|
+
*/
|
|
1570
|
+
authorUsername?: string;
|
|
1571
|
+
pageSize?: number;
|
|
1572
|
+
isPAT?: boolean;
|
|
1573
|
+
baseUrl?: string;
|
|
1574
|
+
},
|
|
988
1575
|
): Promise<PagedResult<ProviderIssue>> {
|
|
989
1576
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
990
1577
|
tokenOptInfo,
|
|
991
1578
|
'getIssuesForCurrentUserFn',
|
|
992
1579
|
);
|
|
993
1580
|
return this.getPagedResult<ProviderIssue>(
|
|
994
|
-
|
|
1581
|
+
{
|
|
1582
|
+
scope: options?.scope,
|
|
1583
|
+
assigneeUsername: options?.assigneeUsername,
|
|
1584
|
+
authorUsername: options?.authorUsername,
|
|
1585
|
+
page: options?.page,
|
|
1586
|
+
pageSize: options?.pageSize,
|
|
1587
|
+
},
|
|
995
1588
|
provider.getIssuesForCurrentUserFn,
|
|
996
1589
|
tokenWithInfo,
|
|
997
1590
|
options?.cursor ?? undefined,
|
|
@@ -1047,6 +1640,149 @@ export class ProvidersApi {
|
|
|
1047
1640
|
}
|
|
1048
1641
|
}
|
|
1049
1642
|
|
|
1643
|
+
/**
|
|
1644
|
+
* Single page of {@link getIssuesForProject} that preserves the SDK's `pageInfo` so a caller can drain
|
|
1645
|
+
* every page (the plain {@link getIssuesForProject} discards it, silently capping at the first page).
|
|
1646
|
+
* `nextCursor` is the raw provider cursor (Jira offset / nextPageToken) fed back verbatim as `options.cursor`.
|
|
1647
|
+
*/
|
|
1648
|
+
async getIssuesForProjectPaged(
|
|
1649
|
+
tokenOptInfo: TokenWithInfo,
|
|
1650
|
+
project: string,
|
|
1651
|
+
resourceId: string,
|
|
1652
|
+
options?: GetIssuesOptions,
|
|
1653
|
+
): Promise<{ data: ProviderIssue[]; hasMore: boolean; nextCursor: string | undefined } | undefined> {
|
|
1654
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1655
|
+
tokenOptInfo,
|
|
1656
|
+
'getIssuesForProjectFn',
|
|
1657
|
+
);
|
|
1658
|
+
const token = tokenWithInfo.accessToken;
|
|
1659
|
+
|
|
1660
|
+
try {
|
|
1661
|
+
const result = await provider.getIssuesForProjectFn?.(
|
|
1662
|
+
{ projectKey: project, resourceId: resourceId, ...options },
|
|
1663
|
+
{ token: token },
|
|
1664
|
+
);
|
|
1665
|
+
if (result == null) return undefined;
|
|
1666
|
+
return {
|
|
1667
|
+
data: result.data,
|
|
1668
|
+
hasMore: result.pageInfo?.hasNextPage ?? false,
|
|
1669
|
+
nextCursor: result.pageInfo?.endCursor ?? undefined,
|
|
1670
|
+
};
|
|
1671
|
+
} catch (e) {
|
|
1672
|
+
return this.handleProviderError(tokenWithInfo, e);
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
async getTrelloCard(
|
|
1677
|
+
tokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Trello>,
|
|
1678
|
+
appKey: string,
|
|
1679
|
+
cardId: string,
|
|
1680
|
+
options?: { trelloBoardListsById?: Record<string, { name: string }> },
|
|
1681
|
+
): Promise<ProviderIssue | undefined> {
|
|
1682
|
+
const { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);
|
|
1683
|
+
|
|
1684
|
+
try {
|
|
1685
|
+
const result = await this.request<TrelloCardResponse>({
|
|
1686
|
+
url: `${trelloBaseUrl}/1/cards/${encodeURIComponent(cardId)}?members=true`,
|
|
1687
|
+
headers: getTrelloAuthHeaders(appKey, tokenWithInfo.accessToken),
|
|
1688
|
+
});
|
|
1689
|
+
|
|
1690
|
+
return fromTrelloCard(result.body, options?.trelloBoardListsById ?? {});
|
|
1691
|
+
} catch (e) {
|
|
1692
|
+
try {
|
|
1693
|
+
return this.handleProviderError<ProviderIssue | undefined>(tokenWithInfo, e);
|
|
1694
|
+
} catch (ex) {
|
|
1695
|
+
if (RequestNotFoundError.is(ex)) return undefined;
|
|
1696
|
+
throw ex;
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
// Trello reads. The Trello client is keyed by an `appKey` (the Trello app key from the cloud token exchange)
|
|
1702
|
+
// paired with the OAuth token, so each wrapper threads `appKey` through alongside `tokenWithInfo`.
|
|
1703
|
+
async getTrelloCurrentUser(
|
|
1704
|
+
tokenOptInfo: TokenWithInfo,
|
|
1705
|
+
appKey: string,
|
|
1706
|
+
): Promise<
|
|
1707
|
+
{ id: string; name: string; email: string; username: string; url: string; avatarUrl: string | null } | undefined
|
|
1708
|
+
> {
|
|
1709
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1710
|
+
tokenOptInfo,
|
|
1711
|
+
'getTrelloCurrentUserFn',
|
|
1712
|
+
);
|
|
1713
|
+
try {
|
|
1714
|
+
const result = await provider.getTrelloCurrentUserFn?.(
|
|
1715
|
+
{ appKey: appKey },
|
|
1716
|
+
{ token: tokenWithInfo.accessToken },
|
|
1717
|
+
);
|
|
1718
|
+
return result?.data;
|
|
1719
|
+
} catch (e) {
|
|
1720
|
+
return this.handleProviderError(tokenWithInfo, e);
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
async getTrelloBoardsForCurrentUser(
|
|
1725
|
+
tokenOptInfo: TokenWithInfo,
|
|
1726
|
+
appKey: string,
|
|
1727
|
+
): Promise<TrelloBoard[] | undefined> {
|
|
1728
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1729
|
+
tokenOptInfo,
|
|
1730
|
+
'getTrelloBoardsForCurrentUserFn',
|
|
1731
|
+
);
|
|
1732
|
+
try {
|
|
1733
|
+
const result = await provider.getTrelloBoardsForCurrentUserFn?.(
|
|
1734
|
+
{ appKey: appKey },
|
|
1735
|
+
{ token: tokenWithInfo.accessToken },
|
|
1736
|
+
);
|
|
1737
|
+
return result?.data;
|
|
1738
|
+
} catch (e) {
|
|
1739
|
+
return this.handleProviderError(tokenWithInfo, e);
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
async getTrelloListsForBoard(
|
|
1744
|
+
tokenOptInfo: TokenWithInfo,
|
|
1745
|
+
appKey: string,
|
|
1746
|
+
boardId: string,
|
|
1747
|
+
): Promise<TrelloList[] | undefined> {
|
|
1748
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1749
|
+
tokenOptInfo,
|
|
1750
|
+
'getTrelloListsForBoardFn',
|
|
1751
|
+
);
|
|
1752
|
+
try {
|
|
1753
|
+
const result = await provider.getTrelloListsForBoardFn?.(
|
|
1754
|
+
{ appKey: appKey, boardId: boardId },
|
|
1755
|
+
{ token: tokenWithInfo.accessToken },
|
|
1756
|
+
);
|
|
1757
|
+
return result?.data;
|
|
1758
|
+
} catch (e) {
|
|
1759
|
+
return this.handleProviderError(tokenWithInfo, e);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
async getTrelloIssuesForBoard(
|
|
1764
|
+
tokenOptInfo: TokenWithInfo,
|
|
1765
|
+
appKey: string,
|
|
1766
|
+
boardId: string,
|
|
1767
|
+
options?: { assigneeLogins?: string[]; trelloBoardListsById?: Record<string, { name: string }> },
|
|
1768
|
+
): Promise<ProviderApiCollectionResult<ProviderIssue>> {
|
|
1769
|
+
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1770
|
+
tokenOptInfo,
|
|
1771
|
+
'getTrelloIssuesForBoardFn',
|
|
1772
|
+
);
|
|
1773
|
+
try {
|
|
1774
|
+
const result = await provider.getTrelloIssuesForBoardFn?.(
|
|
1775
|
+
{ appKey: appKey, boardId: boardId, ...options },
|
|
1776
|
+
{ token: tokenWithInfo.accessToken },
|
|
1777
|
+
);
|
|
1778
|
+
// Trello's search caps results and reports the cap through `metadata.completeness` (never a cursor).
|
|
1779
|
+
// Preserve it so the integration can signal a terminal truncation rather than a fake next page.
|
|
1780
|
+
return { values: result?.data ?? [], metadata: result?.metadata };
|
|
1781
|
+
} catch (e) {
|
|
1782
|
+
return this.handleProviderError<ProviderApiCollectionResult<ProviderIssue>>(tokenWithInfo, e);
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1050
1786
|
async getIssuesForResourceForCurrentUser(
|
|
1051
1787
|
tokenOptInfo: TokenWithInfo,
|
|
1052
1788
|
resourceId: string,
|
|
@@ -1117,10 +1853,37 @@ async function parseFetchResponseForApi<T>(response: Response): Promise<Provider
|
|
|
1117
1853
|
|
|
1118
1854
|
// throw an error if the response is not ok
|
|
1119
1855
|
if (!response.ok) {
|
|
1120
|
-
const
|
|
1856
|
+
const status = `(${response.status})${response.statusText ? ` ${response.statusText}` : ''}.`;
|
|
1857
|
+
const detail = getProviderResponseBodyMessage(body);
|
|
1858
|
+
const error = new Error(detail != null ? `${status} ${detail}` : status);
|
|
1121
1859
|
Object.assign(error, { response: result });
|
|
1122
1860
|
throw error;
|
|
1123
1861
|
}
|
|
1124
1862
|
|
|
1125
1863
|
return result;
|
|
1126
1864
|
}
|
|
1865
|
+
|
|
1866
|
+
const maxProviderErrorBodyLength = 500;
|
|
1867
|
+
|
|
1868
|
+
/** Extracts the useful provider prose from an already-parsed SDK response body. */
|
|
1869
|
+
function getProviderResponseBodyMessage(body: unknown): string | undefined {
|
|
1870
|
+
let message: string | undefined;
|
|
1871
|
+
if (typeof body === 'string') {
|
|
1872
|
+
message = body;
|
|
1873
|
+
} else if (body != null && typeof body === 'object') {
|
|
1874
|
+
const { message: direct, error } = body as { message?: unknown; error?: unknown };
|
|
1875
|
+
if (typeof direct === 'string') {
|
|
1876
|
+
message = direct;
|
|
1877
|
+
} else if (typeof error === 'string') {
|
|
1878
|
+
message = error;
|
|
1879
|
+
} else if (error != null && typeof error === 'object') {
|
|
1880
|
+
const nested = (error as { message?: unknown }).message;
|
|
1881
|
+
if (typeof nested === 'string') {
|
|
1882
|
+
message = nested;
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
message = message?.trim();
|
|
1888
|
+
return message ? message.slice(0, maxProviderErrorBodyLength) : undefined;
|
|
1889
|
+
}
|