@gitkraken/core-gitlens 0.43.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -1
- package/dist/git/errors.d.ts +1 -0
- package/dist/git/errors.js +7 -1
- package/dist/git/errors.js.map +1 -1
- package/dist/git-cli/providers/config.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/staging.js +1 -1
- package/dist/ipc/discovery.js +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
- package/dist/plus/git-github/api/aliasedQuery.d.ts +3 -2
- package/dist/plus/git-github/api/aliasedQuery.js +7 -3
- package/dist/plus/git-github/api/aliasedQuery.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +5 -0
- package/dist/plus/git-github/api/github.js +100 -12
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueWrites.d.ts +4 -1
- package/dist/plus/git-github/api/issueWrites.js +9 -4
- package/dist/plus/git-github/api/issueWrites.js.map +1 -1
- package/dist/plus/integrations/collectionMetadata.js +2 -1
- package/dist/plus/integrations/collectionMetadata.js.map +1 -1
- package/dist/plus/integrations/context.d.ts +3 -3
- package/dist/plus/integrations/errors.d.ts +4 -0
- package/dist/plus/integrations/errors.js +8 -1
- package/dist/plus/integrations/errors.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +2 -1
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +16 -0
- package/dist/plus/integrations/integrationService.js +6 -1
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/lite.js +11 -1
- package/dist/plus/integrations/lite.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +87 -2
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +21 -2
- package/dist/plus/integrations/models/gitHostIntegration.js +182 -14
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +9 -1
- package/dist/plus/integrations/models/integration.js +43 -3
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/apiClients.d.ts +1 -0
- package/dist/plus/integrations/providers/apiClients.js +3 -0
- package/dist/plus/integrations/providers/apiClients.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.d.ts +3 -0
- package/dist/plus/integrations/providers/azure/azure.js +110 -19
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +12 -0
- package/dist/plus/integrations/providers/azureDevOps.js +22 -0
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +21 -2
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js +59 -19
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.d.ts +2 -0
- package/dist/plus/integrations/providers/bitbucket-server.js +11 -3
- package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket.d.ts +14 -0
- package/dist/plus/integrations/providers/bitbucket.js +30 -2
- package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +7 -0
- package/dist/plus/integrations/providers/github.js +12 -1
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +19 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.js +116 -17
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.d.ts +15 -2
- package/dist/plus/integrations/providers/gitlab.js +34 -4
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
- package/dist/plus/integrations/providers/providerErrors.d.ts +8 -0
- package/dist/plus/integrations/providers/providerErrors.js +15 -2
- package/dist/plus/integrations/providers/providerErrors.js.map +1 -1
- package/dist/plus/integrations/reads/drains.d.ts +1 -0
- package/dist/plus/integrations/reads/pullRequestsForCommits.d.ts +45 -0
- package/dist/plus/integrations/reads/pullRequestsForCommits.js +97 -0
- package/dist/plus/integrations/reads/pullRequestsForCommits.js.map +1 -0
- package/dist/plus/integrations/utils/domain.utils.d.ts +1 -0
- package/dist/plus/integrations/utils/domain.utils.js +5 -1
- package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
- package/dist/plus/integrations/utils/failureBackoff.d.ts +13 -0
- package/dist/plus/integrations/utils/failureBackoff.js +47 -0
- package/dist/plus/integrations/utils/failureBackoff.js.map +1 -0
- package/dist/utils/env/node/exec.js +2 -2
- package/docs/integrations.md +90 -6
- package/package.json +1 -1
|
@@ -135,6 +135,11 @@ export declare class GitHubApi {
|
|
|
135
135
|
*/
|
|
136
136
|
mergeQueue?: boolean;
|
|
137
137
|
}, cancellation?: AbortSignal): Promise<PullRequest | undefined>;
|
|
138
|
+
getPullRequestsForCommits(provider: Provider, token: GitHubTokenInfo, owner: string, repo: string, shas: readonly string[], options?: {
|
|
139
|
+
baseUrl?: string;
|
|
140
|
+
avatarSize?: number;
|
|
141
|
+
mergeQueue?: boolean;
|
|
142
|
+
}, cancellation?: AbortSignal): Promise<PromiseSettledResult<PullRequest | undefined>[]>;
|
|
138
143
|
getRepositoryMetadata(provider: Provider, token: GitHubTokenInfo, owner: string, repo: string, options?: {
|
|
139
144
|
baseUrl?: string;
|
|
140
145
|
}, cancellation?: AbortSignal): Promise<RepositoryMetadata | undefined>;
|
|
@@ -465,6 +465,23 @@ reactions(content: THUMBS_UP) {
|
|
|
465
465
|
function isByteStream(value) {
|
|
466
466
|
return typeof value === "object" && value != null && "getReader" in value && typeof value.getReader === "function";
|
|
467
467
|
}
|
|
468
|
+
function gqlCommitAssociatedPullRequests(options, config) {
|
|
469
|
+
return `associatedPullRequests(first: 2, orderBy: {field: UPDATED_AT, direction: DESC}) {
|
|
470
|
+
nodes {
|
|
471
|
+
${gqlPullRequestLiteFragment}
|
|
472
|
+
${gqlPullRequestStackFragmentFor(options)}
|
|
473
|
+
${gqlPullRequestMergeQueueFragmentFor(options, config)}
|
|
474
|
+
}
|
|
475
|
+
}`;
|
|
476
|
+
}
|
|
477
|
+
function selectCommitPullRequest(nodes, owner) {
|
|
478
|
+
const ownerKey = owner.toLowerCase();
|
|
479
|
+
const isOwners = (pr) => pr.repository.owner.login.toLowerCase() === ownerKey;
|
|
480
|
+
const prs = nodes?.filter((pr) => pr != null && (!pr.repository.isFork || isOwners(pr)));
|
|
481
|
+
if (prs == null || prs.length === 0) return void 0;
|
|
482
|
+
if (prs.length > 1) prs.sort((a, b) => (isOwners(a) ? -1 : 1) - (isOwners(b) ? -1 : 1) || (a.state === "MERGED" ? -1 : 1) - (b.state === "MERGED" ? -1 : 1) || new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());
|
|
483
|
+
return prs[0];
|
|
484
|
+
}
|
|
468
485
|
var GitHubApi = class {
|
|
469
486
|
config;
|
|
470
487
|
_onDidReauthenticate = new Emitter();
|
|
@@ -807,31 +824,98 @@ var GitHubApi = class {
|
|
|
807
824
|
repository(name: $repo, owner: $owner) {
|
|
808
825
|
object(oid: $rev) {
|
|
809
826
|
... on Commit {
|
|
810
|
-
|
|
811
|
-
nodes {
|
|
812
|
-
${gqlPullRequestLiteFragment}
|
|
813
|
-
${gqlPullRequestStackFragmentFor(options)}
|
|
814
|
-
${gqlPullRequestMergeQueueFragmentFor(options, this.config)}
|
|
815
|
-
}
|
|
816
|
-
}
|
|
827
|
+
${gqlCommitAssociatedPullRequests(options, this.config)}
|
|
817
828
|
}
|
|
818
829
|
}
|
|
819
830
|
}
|
|
820
831
|
}`;
|
|
821
|
-
const
|
|
832
|
+
const pr = selectCommitPullRequest((await this.graphql(provider, token, query, {
|
|
822
833
|
...options,
|
|
823
834
|
owner,
|
|
824
835
|
repo,
|
|
825
836
|
rev
|
|
826
|
-
}, scope, cancellation))?.repository?.object?.associatedPullRequests?.nodes
|
|
827
|
-
|
|
828
|
-
if (prs.length > 1) prs.sort((a, b) => (a.repository.owner.login === owner ? -1 : 1) - (b.repository.owner.login === owner ? -1 : 1) || (a.state === "MERGED" ? -1 : 1) - (b.state === "MERGED" ? -1 : 1) || new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());
|
|
829
|
-
return fromGitHubPullRequestLite(prs[0], provider, "point");
|
|
837
|
+
}, scope, cancellation))?.repository?.object?.associatedPullRequests?.nodes, owner);
|
|
838
|
+
return pr != null ? fromGitHubPullRequestLite(pr, provider, "point") : void 0;
|
|
830
839
|
} catch (ex) {
|
|
831
840
|
if (ex instanceof RequestNotFoundError) return void 0;
|
|
832
841
|
throw this.handleException(ex, provider, scope);
|
|
833
842
|
}
|
|
834
843
|
}
|
|
844
|
+
async getPullRequestsForCommits(provider, token, owner, repo, shas, options, cancellation) {
|
|
845
|
+
const scope = getScopedLogger();
|
|
846
|
+
const slots = shas.map(() => ({
|
|
847
|
+
status: "fulfilled",
|
|
848
|
+
value: void 0
|
|
849
|
+
}));
|
|
850
|
+
if (shas.length === 0) return slots;
|
|
851
|
+
const asked = shas.map((sha, index) => ({
|
|
852
|
+
sha,
|
|
853
|
+
index
|
|
854
|
+
}));
|
|
855
|
+
const query = `query getPullRequestsForCommits(
|
|
856
|
+
$owner: String!
|
|
857
|
+
$repo: String!
|
|
858
|
+
${asked.map((_, i) => `$sha${i}: GitObjectID!`).join("\n ")}
|
|
859
|
+
$avatarSize: Int
|
|
860
|
+
) {
|
|
861
|
+
repository(name: $repo, owner: $owner) {
|
|
862
|
+
${asked.map((_, i) => `c${i}: object(oid: $sha${i}) {
|
|
863
|
+
... on Commit {
|
|
864
|
+
${gqlCommitAssociatedPullRequests(options, this.config)}
|
|
865
|
+
}
|
|
866
|
+
}`).join("\n ")}
|
|
867
|
+
}
|
|
868
|
+
}`;
|
|
869
|
+
const variables = {
|
|
870
|
+
baseUrl: options?.baseUrl,
|
|
871
|
+
avatarSize: options?.avatarSize,
|
|
872
|
+
owner,
|
|
873
|
+
repo
|
|
874
|
+
};
|
|
875
|
+
asked.forEach((a, i) => {
|
|
876
|
+
variables[`sha${i}`] = a.sha;
|
|
877
|
+
});
|
|
878
|
+
try {
|
|
879
|
+
const rsp = await this.graphql(provider, token, query, variables, scope, cancellation, "aliased");
|
|
880
|
+
if (rsp?.data == null) throw new Error("GitHub returned no data for the pull requests by commit");
|
|
881
|
+
const repository = rsp.data.repository;
|
|
882
|
+
if (repository == null) {
|
|
883
|
+
const forbidden = rsp.errors.find((e) => e.path?.[0] === "repository" && e.type === "FORBIDDEN");
|
|
884
|
+
if (forbidden != null) {
|
|
885
|
+
const { accessToken: _accessToken, ...tokenInfo } = token;
|
|
886
|
+
throw new AuthenticationError(tokenInfo, 3, new Error(forbidden.message));
|
|
887
|
+
}
|
|
888
|
+
const verdict = getAliasErrorVerdict(rsp.errors, "repository", repository);
|
|
889
|
+
if (verdict != null && verdict !== "absent") for (const a of asked) slots[a.index] = verdict;
|
|
890
|
+
return slots;
|
|
891
|
+
}
|
|
892
|
+
asked.forEach((a, i) => {
|
|
893
|
+
const alias = `c${i}`;
|
|
894
|
+
const node = repository[alias];
|
|
895
|
+
const verdict = getAliasErrorVerdict(rsp.errors, alias, node, "repository");
|
|
896
|
+
if (verdict != null && verdict !== "absent") {
|
|
897
|
+
slots[a.index] = verdict;
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
try {
|
|
901
|
+
const pr = selectCommitPullRequest(node?.associatedPullRequests?.nodes, owner);
|
|
902
|
+
slots[a.index] = {
|
|
903
|
+
status: "fulfilled",
|
|
904
|
+
value: pr != null ? fromGitHubPullRequestLite(pr, provider, "point") : void 0
|
|
905
|
+
};
|
|
906
|
+
} catch (ex) {
|
|
907
|
+
scope?.warn(`failed to map pull request; ${owner}/${repo}@${a.sha}, ex=${ex}`);
|
|
908
|
+
slots[a.index] = {
|
|
909
|
+
status: "rejected",
|
|
910
|
+
reason: ex
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
return slots;
|
|
915
|
+
} catch (ex) {
|
|
916
|
+
throw this.handleException(ex, provider, scope, true);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
835
919
|
async getRepositoryMetadata(provider, token, owner, repo, options, cancellation) {
|
|
836
920
|
const scope = getScopedLogger();
|
|
837
921
|
try {
|
|
@@ -3736,6 +3820,10 @@ __decorate([trace({ args: (provider, token, owner, repo, rev) => ({
|
|
|
3736
3820
|
repo,
|
|
3737
3821
|
rev
|
|
3738
3822
|
}) })], GitHubApi.prototype, "getPullRequestForCommit", null);
|
|
3823
|
+
__decorate([trace({ args: (provider, token) => ({
|
|
3824
|
+
provider: provider.name,
|
|
3825
|
+
token: `<token:${token.microHash}>`
|
|
3826
|
+
}) })], GitHubApi.prototype, "getPullRequestsForCommits", null);
|
|
3739
3827
|
__decorate([trace({ args: (provider, token, owner, repo) => ({
|
|
3740
3828
|
provider: provider.name,
|
|
3741
3829
|
token: `<token:${token.microHash}>`,
|