@gitkraken/core-gitlens 0.7.1 → 0.8.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 +48 -1
- package/dist/git/cache.d.ts +18 -5
- package/dist/git/cache.js +26 -8
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts +5 -1
- package/dist/git/context.js.map +1 -1
- package/dist/git/errors.d.ts +28 -1
- package/dist/git/errors.js +45 -1
- package/dist/git/errors.js.map +1 -1
- package/dist/git/providers/branches.d.ts +5 -1
- package/dist/git/providers/commits.d.ts +24 -1
- package/dist/git/providers/config.d.ts +7 -1
- package/dist/git/providers/operations.d.ts +6 -0
- package/dist/git/providers/provider.d.ts +17 -0
- package/dist/git/providers/refs.d.ts +38 -3
- package/dist/git/providers/revision.d.ts +5 -1
- package/dist/git/providers/staging.d.ts +12 -0
- package/dist/git/providers/worktrees.d.ts +23 -3
- package/dist/git/run.types.d.ts +6 -0
- package/dist/git-cli/cliGitProvider.d.ts +17 -1
- package/dist/git-cli/cliGitProvider.js +37 -1
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +12 -2
- package/dist/git-cli/exec/git.js +48 -17
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/gitQueue.d.ts +4 -1
- package/dist/git-cli/exec/gitQueue.js +1 -1
- package/dist/git-cli/exec/gitQueue.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +10 -1
- package/dist/git-cli/providers/branches.js +15 -8
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commits.d.ts +23 -1
- package/dist/git-cli/providers/commits.js +57 -8
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/config.js +4 -3
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts +1 -0
- package/dist/git-cli/providers/operations.js +39 -3
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/patch.js +20 -41
- package/dist/git-cli/providers/patch.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/refs.d.ts +15 -3
- package/dist/git-cli/providers/refs.js +115 -10
- package/dist/git-cli/providers/refs.js.map +1 -1
- package/dist/git-cli/providers/revision.d.ts +3 -1
- package/dist/git-cli/providers/revision.js +9 -5
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/git-cli/providers/staging.d.ts +8 -0
- package/dist/git-cli/providers/staging.js +59 -7
- package/dist/git-cli/providers/staging.js.map +1 -1
- package/dist/git-cli/providers/worktrees.d.ts +31 -2
- package/dist/git-cli/providers/worktrees.js +75 -7
- package/dist/git-cli/providers/worktrees.js.map +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 +64 -3
- package/dist/plus/git-github/api/github.js +237 -24
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/providers/github/branches.d.ts +3 -1
- package/dist/plus/git-github/providers/github/branches.js +2 -1
- package/dist/plus/git-github/providers/github/branches.js.map +1 -1
- package/dist/plus/git-github/providers/github/refs.d.ts +10 -3
- package/dist/plus/git-github/providers/github/refs.js +4 -4
- package/dist/plus/git-github/providers/github/refs.js.map +1 -1
- package/dist/plus/git-github/providers/github/revision.d.ts +3 -1
- package/dist/plus/git-github/providers/github/revision.js +1 -1
- package/dist/plus/git-github/providers/github/revision.js.map +1 -1
- package/dist/plus/integrations/collectionMetadata.d.ts +48 -3
- package/dist/plus/integrations/collectionMetadata.js +138 -8
- package/dist/plus/integrations/collectionMetadata.js.map +1 -1
- package/dist/plus/integrations/errors.d.ts +3 -1
- package/dist/plus/integrations/errors.js +7 -3
- package/dist/plus/integrations/errors.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +6 -3
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +36 -10
- package/dist/plus/integrations/integrationService.js +16 -3
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +107 -37
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +129 -14
- package/dist/plus/integrations/models/gitHostIntegration.js +142 -18
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +117 -11
- package/dist/plus/integrations/models/integration.js +175 -13
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issuesIntegration.d.ts +18 -5
- package/dist/plus/integrations/models/issuesIntegration.js +42 -10
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.d.ts +1 -1
- package/dist/plus/integrations/providers/azure/azure.js +14 -18
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts +29 -0
- package/dist/plus/integrations/providers/azure/models.js +112 -1
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +73 -3
- package/dist/plus/integrations/providers/azureDevOps.js +117 -3
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.js +2 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +61 -0
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js +165 -23
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.d.ts +6 -1
- package/dist/plus/integrations/providers/bitbucket/models.js +4 -3
- package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js +2 -2
- package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.d.ts +48 -2
- package/dist/plus/integrations/providers/bitbucket-server.js +51 -1
- package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket.d.ts +45 -2
- package/dist/plus/integrations/providers/bitbucket.js +41 -2
- package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +49 -5
- package/dist/plus/integrations/providers/github.js +102 -7
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +35 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.js +132 -15
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/models.d.ts +1 -0
- package/dist/plus/integrations/providers/gitlab/models.js +1 -1
- package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.d.ts +49 -2
- package/dist/plus/integrations/providers/gitlab.js +80 -4
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/jira-server.d.ts +3 -3
- package/dist/plus/integrations/providers/jira-server.js +5 -8
- package/dist/plus/integrations/providers/jira-server.js.map +1 -1
- package/dist/plus/integrations/providers/jira.d.ts +9 -0
- package/dist/plus/integrations/providers/jira.js +13 -1
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/linear.js +1 -1
- package/dist/plus/integrations/providers/models.d.ts +13 -2
- package/dist/plus/integrations/providers/models.js +11 -1
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providerErrors.d.ts +9 -1
- package/dist/plus/integrations/providers/providerErrors.js +10 -1
- package/dist/plus/integrations/providers/providerErrors.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +60 -1
- package/dist/plus/integrations/providers/providersApi.js +137 -2
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/utils/providerPaging.d.ts +42 -0
- package/dist/plus/integrations/providers/utils/providerPaging.js +58 -1
- package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
- package/dist/plus/integrations/providers/utils.d.ts +1 -1
- package/dist/plus/integrations/reads/broaden.js +1 -1
- package/dist/plus/integrations/reads/context.d.ts +1 -1
- package/dist/plus/integrations/reads/counts.js +1 -1
- package/dist/plus/integrations/reads/currentAccount.d.ts +35 -0
- package/dist/plus/integrations/reads/currentAccount.js +46 -0
- package/dist/plus/integrations/reads/currentAccount.js.map +1 -0
- package/dist/plus/integrations/reads/drains.d.ts +5 -2
- package/dist/plus/integrations/reads/drains.js +8 -4
- package/dist/plus/integrations/reads/drains.js.map +1 -1
- package/dist/plus/integrations/reads/hierarchy.js +1 -1
- package/dist/plus/integrations/reads/hierarchy.utils.js +1 -1
- package/dist/plus/integrations/reads/issueBatch.d.ts +72 -12
- package/dist/plus/integrations/reads/issueBatch.js +193 -48
- package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.js +1 -1
- package/dist/plus/integrations/reads/issues.js +1 -1
- package/dist/plus/integrations/reads/pullRequestBatch.d.ts +57 -0
- package/dist/plus/integrations/reads/pullRequestBatch.js +80 -0
- package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -0
- package/dist/plus/integrations/reads/pullRequestBranches.d.ts +58 -0
- package/dist/plus/integrations/reads/pullRequestBranches.js +111 -0
- package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -0
- package/dist/plus/integrations/reads/pullRequests.js +3 -3
- package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/resolveRepository.js +1 -1
- package/dist/plus/integrations/reads/sweeps.js +4 -4
- package/dist/plus/integrations/reads/sweeps.js.map +1 -1
- package/dist/plus/integrations/results.d.ts +87 -6
- package/dist/plus/integrations/results.js +9 -2
- package/dist/plus/integrations/results.js.map +1 -1
- package/dist/utils/env/node/exec.js +3 -3
- package/dist/utils/env/node/exec.js.map +1 -1
- package/docs/integrations.md +175 -35
- package/docs/kepler-git-write-api-parity.md +239 -0
- package/docs/kepler-read-api-parity.md +75 -28
- package/package.json +1 -1
- package/dist/plus/integrations/reads/trackerIssue.d.ts +0 -33
- package/dist/plus/integrations/reads/trackerIssue.js +0 -60
- package/dist/plus/integrations/reads/trackerIssue.js.map +0 -1
|
@@ -8,8 +8,9 @@ import __decorate from "../../../_virtual/@oxc-project+runtime/helpers/esm/decor
|
|
|
8
8
|
import { gate } from "../../../utils/decorators/gate.js";
|
|
9
9
|
import "../../../git/models/pullRequest.js";
|
|
10
10
|
import { toError } from "../errors.js";
|
|
11
|
-
import { throwIfCallerContractError, toCollectionFailureError, toCollectionScopeFailure } from "../collectionMetadata.js";
|
|
12
11
|
import "../constants.js";
|
|
12
|
+
import { isAzureProviderId } from "../providers/providerErrors.js";
|
|
13
|
+
import { throwIfCallerContractError, toCollectionFailureError, toCollectionScopeFailure } from "../collectionMetadata.js";
|
|
13
14
|
import { toTokenWithInfo } from "../authentication/models.js";
|
|
14
15
|
import "../providerFilters.js";
|
|
15
16
|
import { mergeCollectionMetadata, throwIfAllSettledFailed } from "../providers/utils/providerPaging.js";
|
|
@@ -26,10 +27,7 @@ import { IntegrationBase } from "./integration.js";
|
|
|
26
27
|
* reads here are shared by every host, so they have to ask; every other provider keeps the SDK's default.
|
|
27
28
|
*/
|
|
28
29
|
function sendsBasicCredential(providerId, session) {
|
|
29
|
-
return
|
|
30
|
-
}
|
|
31
|
-
function isAzureDevOpsProvider(providerId) {
|
|
32
|
-
return providerId === "azureDevOps" || providerId === "azure-devops-server";
|
|
30
|
+
return isAzureProviderId(providerId) ? session.type !== "oauth" : void 0;
|
|
33
31
|
}
|
|
34
32
|
/**
|
|
35
33
|
* Rejects a read the provider can't serve as asked: logs the reason and returns it as the `{ error }` half of an
|
|
@@ -210,6 +208,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
210
208
|
const start = performance.now();
|
|
211
209
|
try {
|
|
212
210
|
const result = await this.getProviderOrganizationsForUser?.(session);
|
|
211
|
+
await this.confirmScopedAuthFailures(session, result?.metadata);
|
|
213
212
|
const authFailure = result?.metadata?.failures?.find((failure) => failure.kind === "authentication" && failure.scope != null && failure.scope.providerId === this.id && Object.keys(failure.scope).length === 1);
|
|
214
213
|
if (authFailure != null) this.handleProviderException("getOrganizationsForUser", toCollectionFailureError(authFailure, toTokenWithInfo(this.id, session)), {
|
|
215
214
|
scope,
|
|
@@ -246,6 +245,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
246
245
|
const start = performance.now();
|
|
247
246
|
try {
|
|
248
247
|
const result = await this.getProviderProjectsForOrg(session, org);
|
|
248
|
+
await this.confirmScopedAuthFailures(session, result?.metadata);
|
|
249
249
|
this.resetRequestExceptionCount("getProjectsForOrg");
|
|
250
250
|
return {
|
|
251
251
|
value: result,
|
|
@@ -280,6 +280,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
280
280
|
const start = performance.now();
|
|
281
281
|
try {
|
|
282
282
|
const result = await this.getProviderRepositoriesForOrg?.(session, org, options);
|
|
283
|
+
await this.confirmScopedAuthFailures(session, result?.metadata);
|
|
283
284
|
this.resetRequestExceptionCount("getRepositoriesForOrg");
|
|
284
285
|
return {
|
|
285
286
|
value: result,
|
|
@@ -311,6 +312,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
311
312
|
const start = performance.now();
|
|
312
313
|
try {
|
|
313
314
|
const result = await this.getProviderRepositoriesForUser(session, options);
|
|
315
|
+
await this.confirmScopedAuthFailures(session, result?.metadata);
|
|
314
316
|
this.resetRequestExceptionCount("getRepositoriesForUser");
|
|
315
317
|
return {
|
|
316
318
|
value: result,
|
|
@@ -452,9 +454,9 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
452
454
|
};
|
|
453
455
|
}
|
|
454
456
|
const repoIdsInput = api.isRepoIdsInput(reposOrRepoIds);
|
|
455
|
-
if (providerId !== "gitlab" && (repoIdsInput ||
|
|
457
|
+
if (providerId !== "gitlab" && (repoIdsInput || isAzureProviderId(providerId) && !reposOrRepoIds.every((repo) => repo.project != null && repo.namespace != null))) return unsupportedRead(`Unsupported input for provider ${providerId}`, start, "getIssuesForRepos");
|
|
456
458
|
let getIssuesOptions;
|
|
457
|
-
if (
|
|
459
|
+
if (isAzureProviderId(providerId)) {
|
|
458
460
|
const organizations = /* @__PURE__ */ new Set();
|
|
459
461
|
const projects = /* @__PURE__ */ new Set();
|
|
460
462
|
for (const repo of reposOrRepoIds) {
|
|
@@ -546,6 +548,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
546
548
|
}
|
|
547
549
|
}
|
|
548
550
|
if (options?.page != null) cursor.page = options.page;
|
|
551
|
+
await this.confirmScopedAuthFailures(session, metadata);
|
|
549
552
|
this.resetRequestExceptionCount("getIssuesForRepos");
|
|
550
553
|
return {
|
|
551
554
|
value: {
|
|
@@ -650,6 +653,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
650
653
|
}
|
|
651
654
|
}
|
|
652
655
|
if (options?.page != null) cursor.page = options.page;
|
|
656
|
+
await this.confirmScopedAuthFailures(session, metadata);
|
|
653
657
|
this.resetRequestExceptionCount("getIssuesForRepos");
|
|
654
658
|
return {
|
|
655
659
|
value: {
|
|
@@ -699,6 +703,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
699
703
|
duration: performance.now() - start
|
|
700
704
|
};
|
|
701
705
|
}
|
|
706
|
+
await this.confirmScopedAuthFailures(session, result.metadata);
|
|
702
707
|
this.resetRequestExceptionCount("getIssuesForRepos");
|
|
703
708
|
return {
|
|
704
709
|
value: result,
|
|
@@ -776,12 +781,12 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
776
781
|
duration: performance.now() - start
|
|
777
782
|
};
|
|
778
783
|
}
|
|
779
|
-
if (providerId !== "gitlab" && (api.isRepoIdsInput(reposOrRepoIds) ||
|
|
784
|
+
if (providerId !== "gitlab" && (api.isRepoIdsInput(reposOrRepoIds) || isAzureProviderId(providerId) && !reposOrRepoIds.every((repo) => repo.project != null && repo.namespace != null))) return unsupportedRead(`Unsupported input for provider ${providerId}`, start);
|
|
780
785
|
let getPullRequestsOptions;
|
|
781
786
|
if (options?.filters != null) {
|
|
782
787
|
if (!api.providerSupportsPullRequestFilters(providerId, options.filters)) return unsupportedRead(`Unsupported filters for provider ${providerId}`, start, "getPullRequestsForRepos");
|
|
783
788
|
let userAccount;
|
|
784
|
-
if (
|
|
789
|
+
if (isAzureProviderId(providerId)) {
|
|
785
790
|
const organizations = /* @__PURE__ */ new Set();
|
|
786
791
|
for (const repo of reposOrRepoIds) organizations.add(repo.namespace);
|
|
787
792
|
if (organizations.size > 1) {
|
|
@@ -875,7 +880,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
875
880
|
page: repoInput.cursor == null ? options?.page : void 0,
|
|
876
881
|
pageSize: options?.pageSize,
|
|
877
882
|
states,
|
|
878
|
-
includeRemoteInfo:
|
|
883
|
+
includeRemoteInfo: isAzureProviderId(providerId) ? true : void 0
|
|
879
884
|
})
|
|
880
885
|
};
|
|
881
886
|
}));
|
|
@@ -906,6 +911,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
906
911
|
failures
|
|
907
912
|
});
|
|
908
913
|
if (options?.page != null) cursor.page = options.page;
|
|
914
|
+
await this.confirmScopedAuthFailures(session, metadata);
|
|
909
915
|
this.resetRequestExceptionCount("getPullRequestsForRepos");
|
|
910
916
|
return {
|
|
911
917
|
value: {
|
|
@@ -940,9 +946,10 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
940
946
|
page: options?.page,
|
|
941
947
|
pageSize: options?.pageSize,
|
|
942
948
|
states,
|
|
943
|
-
includeRemoteInfo:
|
|
949
|
+
includeRemoteInfo: isAzureProviderId(providerId) ? true : void 0,
|
|
944
950
|
fields: options?.summary ? summaryPullRequestFields : void 0
|
|
945
951
|
});
|
|
952
|
+
await this.confirmScopedAuthFailures(session, result.metadata);
|
|
946
953
|
this.resetRequestExceptionCount("getPullRequestsForRepos");
|
|
947
954
|
return {
|
|
948
955
|
value: result,
|
|
@@ -1000,6 +1007,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1000
1007
|
const start = performance.now();
|
|
1001
1008
|
try {
|
|
1002
1009
|
const result = await this.getProviderMyPullRequestsForUser(session, options);
|
|
1010
|
+
await this.confirmScopedAuthFailures(session, result?.metadata);
|
|
1003
1011
|
this.resetRequestExceptionCount("getMyPullRequestsForUser");
|
|
1004
1012
|
return {
|
|
1005
1013
|
value: result,
|
|
@@ -1042,6 +1050,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1042
1050
|
const start = performance.now();
|
|
1043
1051
|
try {
|
|
1044
1052
|
const result = await this.searchProviderPullRequestsPage?.(session, options, cancellation);
|
|
1053
|
+
await this.confirmScopedAuthFailures(session, result?.metadata);
|
|
1045
1054
|
this.resetRequestExceptionCount("searchPullRequestsPage");
|
|
1046
1055
|
return {
|
|
1047
1056
|
value: result,
|
|
@@ -1141,8 +1150,10 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1141
1150
|
}
|
|
1142
1151
|
}
|
|
1143
1152
|
/**
|
|
1144
|
-
* Result-returning wrapper for the BATCH issue read: resolves several `(owner, repo, number)` coordinates
|
|
1145
|
-
*
|
|
1153
|
+
* Result-returning wrapper for the BATCH issue read: resolves several `(owner, repo, number)` coordinates, plus
|
|
1154
|
+
* `project` on Azure DevOps, in ONE call to {@link getProviderIssuesBatch}. One settled slot per input
|
|
1155
|
+
* coordinate: `fulfilled` with `undefined` means the issue does not exist or is not visible to this token;
|
|
1156
|
+
* `rejected` means that target could not be checked, never that it is absent.
|
|
1146
1157
|
*
|
|
1147
1158
|
* Distinct from every search on this class, and deliberately so. A search answers "what matches"; this answers
|
|
1148
1159
|
* "does this exact issue exist", which is the question a caller correlating a branch name to an issue is
|
|
@@ -1151,26 +1162,139 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1151
1162
|
* miss instead of re-walking for it forever.
|
|
1152
1163
|
*
|
|
1153
1164
|
* Results come back POSITIONALLY — one per input coordinate, in order — for the same reason
|
|
1154
|
-
* {@link countIssuesResult} does: a caller's key must never reach the provider query.
|
|
1155
|
-
*
|
|
1165
|
+
* {@link countIssuesResult} does: a caller's key must never reach the provider query.
|
|
1166
|
+
*
|
|
1167
|
+
* Failure isolation happens PER TARGET, mirroring {@link getPullRequestsBatchResult}: the whole call counts
|
|
1168
|
+
* as a failure against the integration's request-exception budget only when EVERY slot rejected, and not even
|
|
1169
|
+
* then when a credential that checks out was refused by each target's own scope (`settleBatchRefusals`).
|
|
1170
|
+
* Server errors and timeouts on the targets show one notice however many hit one, and cost a strike only as
|
|
1171
|
+
* part of that whole-call failure (`reportDeferredRequestFailures`), so a call never spends more than one.
|
|
1156
1172
|
*/
|
|
1157
1173
|
async getIssuesBatchResult(coordinates, cancellation, connectionId) {
|
|
1158
1174
|
const scope = getScopedLogger();
|
|
1159
1175
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
1160
1176
|
if (session == null) return void 0;
|
|
1161
1177
|
const start = performance.now();
|
|
1178
|
+
let slots;
|
|
1162
1179
|
try {
|
|
1163
|
-
|
|
1180
|
+
slots = await this.getProviderIssuesBatch?.(session, coordinates, cancellation);
|
|
1181
|
+
if (slots == null) {
|
|
1182
|
+
this.resetRequestExceptionCount("getIssuesBatch");
|
|
1183
|
+
return {
|
|
1184
|
+
value: void 0,
|
|
1185
|
+
duration: performance.now() - start
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1188
|
+
const settled = await this.settleBatchRefusals(session, coordinates, slots);
|
|
1164
1189
|
this.resetRequestExceptionCount("getIssuesBatch");
|
|
1190
|
+
this.reportDeferredRequestFailures(slots, false);
|
|
1191
|
+
return {
|
|
1192
|
+
value: settled,
|
|
1193
|
+
duration: performance.now() - start
|
|
1194
|
+
};
|
|
1195
|
+
} catch (ex) {
|
|
1196
|
+
const struck = this.handleProviderException("getIssuesBatch", ex, {
|
|
1197
|
+
scope,
|
|
1198
|
+
connectionId
|
|
1199
|
+
});
|
|
1200
|
+
this.reportDeferredRequestFailures(slots, !struck);
|
|
1201
|
+
return {
|
|
1202
|
+
error: toError(ex),
|
|
1203
|
+
duration: performance.now() - start
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Result-returning wrapper for the BATCH pull request read: resolves several coordinates, in any state, BY
|
|
1209
|
+
* IDENTITY, in ONE call to {@link getProviderPullRequestsBatch}. One settled slot per input coordinate:
|
|
1210
|
+
* `fulfilled` with `undefined` means the pull request does not exist or is not visible to this token;
|
|
1211
|
+
* `rejected` means that target could not be checked, never that it is absent.
|
|
1212
|
+
*
|
|
1213
|
+
* Failure isolation happens PER TARGET, not per call: a hook that reads one pull request per request (every
|
|
1214
|
+
* host but GitHub/GHE) fans its coordinates out itself and settles each independently, so one bad target
|
|
1215
|
+
* rejects only its own slot. Mirrors {@link getMyPullRequestsForReposResult}'s per-repo fan-out — the whole
|
|
1216
|
+
* call counts as a failure against the integration's request-exception budget only when EVERY slot rejected,
|
|
1217
|
+
* and not even then when a credential that checks out was refused by each target's own scope
|
|
1218
|
+
* (`settleBatchRefusals`). Server errors and timeouts on the targets show one notice however many hit one, and
|
|
1219
|
+
* cost a strike only as part of that whole-call failure (`reportDeferredRequestFailures`).
|
|
1220
|
+
*/
|
|
1221
|
+
async getPullRequestsBatchResult(coordinates, options, cancellation, connectionId) {
|
|
1222
|
+
const scope = getScopedLogger();
|
|
1223
|
+
const session = await this.resolveReadSession(connectionId, scope);
|
|
1224
|
+
if (session == null) return void 0;
|
|
1225
|
+
const start = performance.now();
|
|
1226
|
+
let slots;
|
|
1227
|
+
try {
|
|
1228
|
+
slots = await this.getProviderPullRequestsBatch?.(session, coordinates, options, cancellation);
|
|
1229
|
+
if (slots == null) {
|
|
1230
|
+
this.resetRequestExceptionCount("getPullRequestsBatch");
|
|
1231
|
+
return {
|
|
1232
|
+
value: void 0,
|
|
1233
|
+
duration: performance.now() - start
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
const settled = await this.settleBatchRefusals(session, coordinates, slots);
|
|
1237
|
+
this.resetRequestExceptionCount("getPullRequestsBatch");
|
|
1238
|
+
this.reportDeferredRequestFailures(slots, false);
|
|
1239
|
+
return {
|
|
1240
|
+
value: settled,
|
|
1241
|
+
duration: performance.now() - start
|
|
1242
|
+
};
|
|
1243
|
+
} catch (ex) {
|
|
1244
|
+
const struck = this.handleProviderException("getPullRequestsBatch", ex, {
|
|
1245
|
+
scope,
|
|
1246
|
+
connectionId
|
|
1247
|
+
});
|
|
1248
|
+
this.reportDeferredRequestFailures(slots, !struck);
|
|
1249
|
+
return {
|
|
1250
|
+
error: toError(ex),
|
|
1251
|
+
duration: performance.now() - start
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Result-returning wrapper for the pull-requests-by-branch read: for each target, every pull request whose head
|
|
1257
|
+
* is that branch, in any state, in ONE call to {@link getProviderPullRequestsForBranches}. One settled slot
|
|
1258
|
+
* per target: `fulfilled` with an empty list means the host answered and nothing matched; `rejected` means
|
|
1259
|
+
* that target could not be checked, never that it has no pull requests.
|
|
1260
|
+
*
|
|
1261
|
+
* Uncached, and deliberately not built on {@link getPullRequestForBranch}: that read caches through
|
|
1262
|
+
* `IntegrationCacheProvider.getPullRequestForBranch`, answers one pull request, and on several hosts looks the
|
|
1263
|
+
* branch ref up, which answers "none" once a merged pull request's branch is deleted.
|
|
1264
|
+
*
|
|
1265
|
+
* Failure isolation is per target, as in {@link getPullRequestsBatchResult}: the whole call counts against the
|
|
1266
|
+
* request-exception budget only when EVERY slot rejected, and not when each target's own scope refused a
|
|
1267
|
+
* credential that checks out. Server errors and timeouts on the targets show one notice however many hit one, and
|
|
1268
|
+
* cost a strike only as part of that whole-call failure.
|
|
1269
|
+
*/
|
|
1270
|
+
async getPullRequestsForBranchesResult(targets, options, cancellation, connectionId) {
|
|
1271
|
+
const scope = getScopedLogger();
|
|
1272
|
+
const session = await this.resolveReadSession(connectionId, scope);
|
|
1273
|
+
if (session == null) return void 0;
|
|
1274
|
+
const start = performance.now();
|
|
1275
|
+
let slots;
|
|
1276
|
+
try {
|
|
1277
|
+
slots = await this.getProviderPullRequestsForBranches?.(session, targets, options, cancellation);
|
|
1278
|
+
if (slots == null) {
|
|
1279
|
+
this.resetRequestExceptionCount("getPullRequestsForBranches");
|
|
1280
|
+
return {
|
|
1281
|
+
value: void 0,
|
|
1282
|
+
duration: performance.now() - start
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
const settled = await this.settleBatchRefusals(session, targets, slots);
|
|
1286
|
+
this.resetRequestExceptionCount("getPullRequestsForBranches");
|
|
1287
|
+
this.reportDeferredRequestFailures(slots, false);
|
|
1165
1288
|
return {
|
|
1166
|
-
value:
|
|
1289
|
+
value: settled,
|
|
1167
1290
|
duration: performance.now() - start
|
|
1168
1291
|
};
|
|
1169
1292
|
} catch (ex) {
|
|
1170
|
-
this.handleProviderException("
|
|
1293
|
+
const struck = this.handleProviderException("getPullRequestsForBranches", ex, {
|
|
1171
1294
|
scope,
|
|
1172
1295
|
connectionId
|
|
1173
1296
|
});
|
|
1297
|
+
this.reportDeferredRequestFailures(slots, !struck);
|
|
1174
1298
|
return {
|
|
1175
1299
|
error: toError(ex),
|
|
1176
1300
|
duration: performance.now() - start
|