@gitkraken/core-gitlens 0.44.0 → 0.45.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 +8 -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/github.d.ts +7 -0
- package/dist/plus/git-github/api/github.js +88 -29
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueWrites.d.ts +3 -1
- package/dist/plus/git-github/api/issueWrites.js.map +1 -1
- package/dist/plus/git-github/api/pullRequestWrites.d.ts +95 -0
- package/dist/plus/git-github/api/pullRequestWrites.js +469 -0
- package/dist/plus/git-github/api/pullRequestWrites.js.map +1 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +10 -9
- package/dist/plus/integrations/authentication/configuredIntegrationService.js +18 -12
- package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +9 -4
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +26 -9
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +1 -0
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js +3 -0
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
- package/dist/plus/integrations/authentication/observedAuthenticationProvider.d.ts +1 -0
- package/dist/plus/integrations/authentication/observedAuthenticationProvider.js +14 -4
- package/dist/plus/integrations/authentication/observedAuthenticationProvider.js.map +1 -1
- package/dist/plus/integrations/authentication/rejectedTokenTracker.d.ts +2 -2
- package/dist/plus/integrations/authentication/rejectedTokenTracker.js +19 -5
- package/dist/plus/integrations/authentication/rejectedTokenTracker.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +3 -2
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +6 -1
- package/dist/plus/integrations/integrationService.js +45 -1
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +11 -4
- package/dist/plus/integrations/models/integration.d.ts +2 -2
- package/dist/plus/integrations/models/integration.js +10 -5
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.js +1 -1
- package/dist/plus/integrations/providers/github.d.ts +5 -0
- package/dist/plus/integrations/providers/github.js +54 -1
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +0 -1
- package/dist/plus/integrations/reads/drains.d.ts +0 -1
- package/dist/utils/env/node/exec.js +2 -2
- package/docs/integrations.md +36 -0
- package/package.json +1 -1
|
@@ -27,6 +27,7 @@ import { gitHubIssueSearchRelationships, toGitHubIssueSearchQualifiers, toGitHub
|
|
|
27
27
|
import { mutateGitHubIssue } from "./issueWrites.js";
|
|
28
28
|
import { readGitHubPullRequestActivity } from "./pullRequestActivity.js";
|
|
29
29
|
import { toGitHubPullRequestSearchFacets } from "./pullRequestSearchQuery.js";
|
|
30
|
+
import { getGitHubPullRequestCreateCapability, resolveGitHubPullRequestWriteTarget, writeGitHubPullRequest } from "./pullRequestWrites.js";
|
|
30
31
|
import * as l10n from "@vscode/l10n";
|
|
31
32
|
import { captureReadNodes, copyReadProvenance, createReadCapture } from "@gitkraken/provider-apis/read-provenance";
|
|
32
33
|
import { GraphqlResponseError, graphql } from "@octokit/graphql";
|
|
@@ -2019,19 +2020,50 @@ var GitHubApi = class {
|
|
|
2019
2020
|
});
|
|
2020
2021
|
}
|
|
2021
2022
|
async mutateIssue(provider, token, input) {
|
|
2022
|
-
return mutateGitHubIssue(input, (query, variables) => this.
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2023
|
+
return mutateGitHubIssue(input, (query, variables) => this.writeGraphql(provider, token, query, variables));
|
|
2024
|
+
}
|
|
2025
|
+
async resolvePullRequestWriteTarget(provider, token, input, onUnauthorized) {
|
|
2026
|
+
return resolveGitHubPullRequestWriteTarget(input, (query, variables) => this.writeGraphql(provider, token, query, variables, onUnauthorized));
|
|
2027
|
+
}
|
|
2028
|
+
async getPullRequestCreateCapability(provider, token, input, onUnauthorized) {
|
|
2029
|
+
return getGitHubPullRequestCreateCapability(input, (query, variables) => this.writeGraphql(provider, token, query, variables, onUnauthorized));
|
|
2030
|
+
}
|
|
2031
|
+
async writePullRequest(provider, token, input, isSessionCurrent, onUnauthorized) {
|
|
2032
|
+
const request = (query, variables) => this.writeGraphql(provider, token, query, variables, onUnauthorized);
|
|
2033
|
+
return writeGitHubPullRequest(input, {
|
|
2034
|
+
graphql: request,
|
|
2035
|
+
isSessionCurrent,
|
|
2036
|
+
enqueue: (nodeId, headSha) => this.enqueuePullRequestForWrite(nodeId, headSha, request)
|
|
2037
|
+
});
|
|
2038
|
+
}
|
|
2039
|
+
async writeGraphql(provider, token, query, variables, onUnauthorized) {
|
|
2040
|
+
try {
|
|
2041
|
+
return await this.requestWithRetries(() => this.config.wrapForForcedInsecureSSL(provider.getIgnoreSSLErrors(), () => this.getDefaults(token.accessToken, graphql)(query, {
|
|
2042
|
+
...variables,
|
|
2043
|
+
headers: { "x-github-next-global-id": "1" }
|
|
2044
|
+
})), graphqlReadQueryRegex.test(query), void 0, void 0);
|
|
2045
|
+
} catch (ex) {
|
|
2046
|
+
if (ex instanceof RequestError && ex.status === 401) onUnauthorized?.();
|
|
2047
|
+
throw ex;
|
|
2048
|
+
}
|
|
2026
2049
|
}
|
|
2027
2050
|
_pendingGraphQL = /* @__PURE__ */ new Map();
|
|
2028
2051
|
async graphql(provider, token, query, variables, scope, cancellation, allowPartialNotFound, gatewayFailures) {
|
|
2029
2052
|
const { accessToken, ...tokenInfo } = token;
|
|
2030
|
-
const
|
|
2053
|
+
const readQuery = graphqlReadQueryRegex.test(query);
|
|
2054
|
+
const dedupable = readQuery && cancellation == null && variables?.request == null;
|
|
2031
2055
|
let dedupeKey;
|
|
2032
2056
|
if (dedupable) {
|
|
2033
2057
|
try {
|
|
2034
|
-
dedupeKey =
|
|
2058
|
+
dedupeKey = JSON.stringify([
|
|
2059
|
+
accessToken,
|
|
2060
|
+
token.connectionId,
|
|
2061
|
+
provider?.id,
|
|
2062
|
+
allowPartialNotFound,
|
|
2063
|
+
gatewayFailures,
|
|
2064
|
+
query,
|
|
2065
|
+
variables
|
|
2066
|
+
]);
|
|
2035
2067
|
} catch {
|
|
2036
2068
|
dedupeKey = void 0;
|
|
2037
2069
|
}
|
|
@@ -2052,7 +2084,6 @@ var GitHubApi = class {
|
|
|
2052
2084
|
}
|
|
2053
2085
|
};
|
|
2054
2086
|
}
|
|
2055
|
-
const retryable = graphqlReadQueryRegex.test(query);
|
|
2056
2087
|
const data = await this.requestWithRetries(() => this.config.wrapForForcedInsecureSSL(provider?.getIgnoreSSLErrors() ?? false, async () => {
|
|
2057
2088
|
const capture = createReadCapture();
|
|
2058
2089
|
try {
|
|
@@ -2061,7 +2092,7 @@ var GitHubApi = class {
|
|
|
2061
2092
|
if (ex instanceof GraphqlResponseError) captureReadNodes(ex.data, capture);
|
|
2062
2093
|
throw ex;
|
|
2063
2094
|
}
|
|
2064
|
-
}),
|
|
2095
|
+
}), readQuery, cancellation, scope, gatewayFailures != null);
|
|
2065
2096
|
return allowPartialNotFound === "aliased" ? {
|
|
2066
2097
|
data,
|
|
2067
2098
|
errors: []
|
|
@@ -3693,25 +3724,10 @@ var GitHubApi = class {
|
|
|
3693
3724
|
reason: "unsupported"
|
|
3694
3725
|
};
|
|
3695
3726
|
try {
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
$expectedHeadOid: GitObjectID!
|
|
3699
|
-
) {
|
|
3700
|
-
enqueuePullRequest(input: { pullRequestId: $id, expectedHeadOid: $expectedHeadOid }) {
|
|
3701
|
-
mergeQueueEntry {
|
|
3702
|
-
${gqlMergeQueueEntryFields}
|
|
3703
|
-
}
|
|
3704
|
-
}
|
|
3705
|
-
}`;
|
|
3706
|
-
const entry = (await this.graphql(provider, token, query, {
|
|
3707
|
-
id: nodeId,
|
|
3708
|
-
expectedHeadOid: expectedHeadSha,
|
|
3727
|
+
return await this.enqueuePullRequestCore(nodeId, expectedHeadSha, (query, variables) => this.graphql(provider, token, query, {
|
|
3728
|
+
...variables,
|
|
3709
3729
|
baseUrl: options?.baseUrl
|
|
3710
|
-
}, scope, cancellation))
|
|
3711
|
-
return {
|
|
3712
|
-
status: "queued",
|
|
3713
|
-
entry: entry != null ? fromGitHubMergeQueueEntry(entry) : void 0
|
|
3714
|
-
};
|
|
3730
|
+
}, scope, cancellation));
|
|
3715
3731
|
} catch (ex) {
|
|
3716
3732
|
if (isCancellationError(ex)) throw ex;
|
|
3717
3733
|
const failure = toGitHubMergeQueueActionFailure(ex);
|
|
@@ -3725,6 +3741,47 @@ var GitHubApi = class {
|
|
|
3725
3741
|
throw this.handleException(ex, provider, scope);
|
|
3726
3742
|
}
|
|
3727
3743
|
}
|
|
3744
|
+
async enqueuePullRequestCore(nodeId, expectedHeadSha, request) {
|
|
3745
|
+
const entry = (await request(`mutation enqueuePullRequest(
|
|
3746
|
+
$id: ID!
|
|
3747
|
+
$expectedHeadOid: GitObjectID!
|
|
3748
|
+
) {
|
|
3749
|
+
enqueuePullRequest(input: { pullRequestId: $id, expectedHeadOid: $expectedHeadOid }) {
|
|
3750
|
+
mergeQueueEntry {
|
|
3751
|
+
${gqlMergeQueueEntryFields}
|
|
3752
|
+
}
|
|
3753
|
+
}
|
|
3754
|
+
}`, {
|
|
3755
|
+
id: nodeId,
|
|
3756
|
+
expectedHeadOid: expectedHeadSha
|
|
3757
|
+
}))?.enqueuePullRequest?.mergeQueueEntry;
|
|
3758
|
+
return {
|
|
3759
|
+
status: "queued",
|
|
3760
|
+
entry: entry != null ? fromGitHubMergeQueueEntry(entry) : void 0
|
|
3761
|
+
};
|
|
3762
|
+
}
|
|
3763
|
+
async enqueuePullRequestForWrite(nodeId, expectedHeadSha, request) {
|
|
3764
|
+
try {
|
|
3765
|
+
return await this.enqueuePullRequestCore(nodeId, expectedHeadSha, request);
|
|
3766
|
+
} catch (ex) {
|
|
3767
|
+
const graphqlError = getGraphqlResponseError(ex);
|
|
3768
|
+
const partial = (graphqlError?.data)?.enqueuePullRequest?.mergeQueueEntry;
|
|
3769
|
+
if (partial?.state != null && partial.enqueuedAt != null) return {
|
|
3770
|
+
status: "queued",
|
|
3771
|
+
entry: fromGitHubMergeQueueEntry(partial)
|
|
3772
|
+
};
|
|
3773
|
+
if (graphqlError?.errors?.some((error) => error.path?.[0] === "enqueuePullRequest" && error.path.length > 1)) return {
|
|
3774
|
+
status: "failed",
|
|
3775
|
+
reason: "unknown"
|
|
3776
|
+
};
|
|
3777
|
+
const failure = toGitHubMergeQueueActionFailure(ex);
|
|
3778
|
+
if (failure != null && failure.reason !== "unknown") return {
|
|
3779
|
+
status: "failed",
|
|
3780
|
+
...failure
|
|
3781
|
+
};
|
|
3782
|
+
throw ex;
|
|
3783
|
+
}
|
|
3784
|
+
}
|
|
3728
3785
|
/**
|
|
3729
3786
|
* Removes a pull request from its base branch's merge queue, losing its place there. Fails and throws as
|
|
3730
3787
|
* {@link enqueuePullRequest} does, and is github.com only like it.
|
|
@@ -4102,6 +4159,10 @@ const mergeQueueActionFailurePatterns = [
|
|
|
4102
4159
|
["head-changed", /\bexpected head oid does not match\b/],
|
|
4103
4160
|
["not-allowed", /^pull request is (?:closed|in draft)\b/]
|
|
4104
4161
|
];
|
|
4162
|
+
function getGraphqlResponseError(ex) {
|
|
4163
|
+
const original = ex instanceof AuthenticationError || ex instanceof RequestNotFoundError ? ex.original : ex;
|
|
4164
|
+
return original instanceof GraphqlResponseError ? original : void 0;
|
|
4165
|
+
}
|
|
4105
4166
|
/**
|
|
4106
4167
|
* Why GitHub refused to add a pull request to its merge queue or remove it, from the error its GraphQL answer carried
|
|
4107
4168
|
* (`errors[]`, which `graphql` throws as a `GraphqlResponseError`, or wraps in an `AuthenticationError` for FORBIDDEN
|
|
@@ -4115,9 +4176,7 @@ const mergeQueueActionFailurePatterns = [
|
|
|
4115
4176
|
* The message is GitHub's own, for logs, never for display.
|
|
4116
4177
|
*/
|
|
4117
4178
|
function toGitHubMergeQueueActionFailure(ex) {
|
|
4118
|
-
const
|
|
4119
|
-
if (!(original instanceof GraphqlResponseError)) return void 0;
|
|
4120
|
-
const error = original.errors?.[0];
|
|
4179
|
+
const error = getGraphqlResponseError(ex)?.errors?.[0];
|
|
4121
4180
|
if (error == null) return void 0;
|
|
4122
4181
|
const message = error.message ?? "";
|
|
4123
4182
|
const text = message.toLowerCase();
|