@gitkraken/core-gitlens 0.41.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 +34 -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/models/issue.d.ts +2 -0
- package/dist/git/models/issue.js.map +1 -1
- package/dist/git/models/issueOrPullRequest.d.ts +4 -0
- package/dist/git/models/pullRequest.d.ts +2 -0
- package/dist/git/models/pullRequest.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 +7 -4
- package/dist/plus/git-github/api/github.js +112 -14
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueWrites.d.ts +5 -1
- package/dist/plus/git-github/api/issueWrites.js +15 -5
- package/dist/plus/git-github/api/issueWrites.js.map +1 -1
- package/dist/plus/git-github/models.js +7 -3
- package/dist/plus/git-github/models.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 +3 -2
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +18 -1
- package/dist/plus/integrations/integrationService.js +19 -0
- 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 +93 -0
- 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 +130 -33
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.js +7 -3
- package/dist/plus/integrations/providers/azure/models.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 +77 -32
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.js +5 -2
- package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.js +3 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.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 +9 -4
- 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 +128 -23
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/models.js +5 -2
- package/dist/plus/integrations/providers/gitlab/models.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/jiraIssueByKey.js +3 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
- package/dist/plus/integrations/providers/models.js +9 -4
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providerApiClient.js +10 -7
- package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
- 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/providers/providersApi.js +3 -1
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- 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 +105 -15
- package/package.json +2 -2
|
@@ -14,6 +14,7 @@ import { ProviderWarningCause, ProviderWarningScope } from "../results.js";
|
|
|
14
14
|
import { ProviderRefusal, ProviderScopeFailure } from "../collectionMetadata.js";
|
|
15
15
|
import { ProviderPullRequestCount, ProviderPullRequestSearchPage } from "./pullRequestReads.js";
|
|
16
16
|
import { ProvidersApi } from "../providers/providersApi.js";
|
|
17
|
+
import { FailureBackoff } from "../utils/failureBackoff.js";
|
|
17
18
|
import { AccountWideIssuesResult, ProviderIssueSearchPage, ProviderSearchCount, SearchMyIssuesOptions } from "./issueReads.js";
|
|
18
19
|
import { GitHostIntegration } from "./gitHostIntegration.js";
|
|
19
20
|
import { IssuesIntegration } from "./issuesIntegration.js";
|
|
@@ -214,7 +215,7 @@ type BatchTarget = {
|
|
|
214
215
|
} | {
|
|
215
216
|
resourceId: string;
|
|
216
217
|
};
|
|
217
|
-
type SyncReqUsecase = Exclude<'getAccountForCommit' | 'getAccountForEmail' | 'getAccountForResource' | 'getCurrentAccount' | 'getDefaultBranch' | 'getIssue' | 'getIssueOrPullRequest' | 'getIssuesBatch' | 'getIssuesEtagFields' | 'getIssuesForProject' | 'getIssuesForRepos' | 'getMyPullRequestsForUser' | 'getOrganizationsForUser' | 'getProjectsForOrg' | 'getProjectsForResources' | 'getPullRequest' | 'getPullRequestActivity' | 'getPullRequestCheckLogs' | 'getPullRequestsBatch' | 'getPullRequestsEtagFields' | 'getPullRequestsForBranches' | 'getRepositoriesForOrg' | 'getRepositoriesForUser' | 'getPullRequestForBranch' | 'getPullRequestForCommit' | 'getPullRequestsForRepos' | 'getRepositoryMetadata' | 'getResourcesForUser' | 'getSshSigningKeysForEmails' | 'countIssues' | 'countPullRequests' | 'dequeuePullRequest' | 'enqueuePullRequest' | 'mergePullRequest' | 'mutateIssue' | 'searchIssuesPage' | 'searchPullRequestsPage' | 'searchMyIssues' | 'searchMyPullRequests' | 'searchPullRequests', 'all'>;
|
|
218
|
+
type SyncReqUsecase = Exclude<'getAccountForCommit' | 'getAccountForEmail' | 'getAccountForResource' | 'getCurrentAccount' | 'getDefaultBranch' | 'getIssue' | 'getIssueOrPullRequest' | 'getIssuesBatch' | 'getIssuesEtagFields' | 'getIssuesForProject' | 'getIssuesForRepos' | 'getMyPullRequestsForUser' | 'getOrganizationsForUser' | 'getProjectsForOrg' | 'getProjectsForResources' | 'getPullRequest' | 'getPullRequestActivity' | 'getPullRequestCheckLogs' | 'getPullRequestsBatch' | 'getPullRequestsEtagFields' | 'getPullRequestsForBranches' | 'getPullRequestsForCommits' | 'getRepositoriesForOrg' | 'getRepositoriesForUser' | 'getPullRequestForBranch' | 'getPullRequestForCommit' | 'getPullRequestsForRepos' | 'getRepositoryMetadata' | 'getResourcesForUser' | 'getSshSigningKeysForEmails' | 'countIssues' | 'countPullRequests' | 'dequeuePullRequest' | 'enqueuePullRequest' | 'mergePullRequest' | 'mutateIssue' | 'searchIssuesPage' | 'searchPullRequestsPage' | 'searchMyIssues' | 'searchMyPullRequests' | 'searchPullRequests', 'all'>;
|
|
218
219
|
export declare abstract class IntegrationBase<ID extends IntegrationIds = IntegrationIds, T extends ResourceDescriptor = ResourceDescriptor> implements Disposable {
|
|
219
220
|
protected readonly ctx: IntegrationServiceContext;
|
|
220
221
|
protected readonly authenticationService: IntegrationAuthenticationService;
|
|
@@ -320,6 +321,8 @@ export declare abstract class IntegrationBase<ID extends IntegrationIds = Integr
|
|
|
320
321
|
* {@link resolveReadSession}; a rejection it declines belongs to {@link trackRequestException} instead.
|
|
321
322
|
*/
|
|
322
323
|
private readonly _rejectedTokens;
|
|
324
|
+
protected readonly lookupBackoff: FailureBackoff;
|
|
325
|
+
protected clearLookupBackoff(): void;
|
|
323
326
|
/**
|
|
324
327
|
* Called by every path that replaces or removes the stored tokens — a disconnect, a forced re-sync, a
|
|
325
328
|
* reauthentication, or the connection set changing. A rejection names a specific credential, so once that
|
|
@@ -470,6 +473,11 @@ export declare abstract class IntegrationBase<ID extends IntegrationIds = Integr
|
|
|
470
473
|
protected settleBatchRefusals<T>(session: ProviderAuthenticationSession, targets: readonly BatchTarget[], slots: PromiseSettledResult<T>[], options?: {
|
|
471
474
|
keepOtherFailures?: boolean;
|
|
472
475
|
}): Promise<BatchSlot<T>[]>;
|
|
476
|
+
protected settleBatchCredential<T>(syncReqUsecase: SyncReqUsecase, settled: readonly BatchSlot<T>[], options: {
|
|
477
|
+
scope: ScopedLogger | undefined;
|
|
478
|
+
connectionId: string | undefined;
|
|
479
|
+
reset: boolean;
|
|
480
|
+
}): void;
|
|
473
481
|
/**
|
|
474
482
|
* Shows one notice, and spends at most one strike, for a batch read whose targets failed with a server error or a
|
|
475
483
|
* timeout. Our own clients leave both to the batch (see `reportRequestFailure`) instead of spending them per
|
|
@@ -5,7 +5,7 @@ import { debug, trace } from "../../../utils/decorators/log.js";
|
|
|
5
5
|
import { Emitter } from "../../../utils/event.js";
|
|
6
6
|
import { PromiseCache } from "../../../utils/promiseCache.js";
|
|
7
7
|
import __decorate from "../../../_virtual/@oxc-project+runtime/helpers/esm/decorate.js";
|
|
8
|
-
import { AuthenticationError, RequestClientError,
|
|
8
|
+
import { AuthenticationError, RequestClientError, takeDeferredRequestFailure } from "../../../git/errors.js";
|
|
9
9
|
import { fnv1aHash64 } from "../../../utils/hash.js";
|
|
10
10
|
import { gate } from "../../../utils/decorators/gate.js";
|
|
11
11
|
import { isProviderUnreachableError, toError } from "../errors.js";
|
|
@@ -18,6 +18,7 @@ import { providersMetadata } from "../providers/models.js";
|
|
|
18
18
|
import { isSelfManagedHostIntegrationId } from "../utils/integration.utils.js";
|
|
19
19
|
import { getSessionIdentity } from "../authentication/models.js";
|
|
20
20
|
import { RejectedTokenTracker } from "../authentication/rejectedTokenTracker.js";
|
|
21
|
+
import { FailureBackoff } from "../utils/failureBackoff.js";
|
|
21
22
|
import { getCachedIssue } from "./issueCache.js";
|
|
22
23
|
//#region ../plus/integrations/src/models/integration.ts
|
|
23
24
|
/** A per-connection read's session that could not be resolved for a retryable reason (see `resolveReadSession`). */
|
|
@@ -100,6 +101,20 @@ const azureWorkItemViewerRule = 1;
|
|
|
100
101
|
function linearSyncedWithEtagKeys(links) {
|
|
101
102
|
return links.map((link) => link.owner != null ? `${link.id}:${link.owner}/${link.repo}#${link.number}` : `${link.id}:`).sort();
|
|
102
103
|
}
|
|
104
|
+
function batchTargetRepository(target) {
|
|
105
|
+
if ("resourceId" in target) return void 0;
|
|
106
|
+
return [
|
|
107
|
+
target.owner,
|
|
108
|
+
target.project ?? "",
|
|
109
|
+
target.repo
|
|
110
|
+
].join("/").toLowerCase();
|
|
111
|
+
}
|
|
112
|
+
function isRefusedCredential(reason) {
|
|
113
|
+
return reason instanceof AuthenticationError && reason.reason !== 3;
|
|
114
|
+
}
|
|
115
|
+
function findRefusedCredentialSlot(slots) {
|
|
116
|
+
return slots.find((slot) => slot.status === "rejected" && slot.failure == null && isRefusedCredential(slot.reason));
|
|
117
|
+
}
|
|
103
118
|
/**
|
|
104
119
|
* The scope a batch read records a refused target under. It is decided here rather than in the read, which has the
|
|
105
120
|
* same targets, because naming the refusal's cause (`describeRefusal`) needs it too. Azure DevOps: the organization
|
|
@@ -363,6 +378,10 @@ var IntegrationBase = class IntegrationBase {
|
|
|
363
378
|
* {@link resolveReadSession}; a rejection it declines belongs to {@link trackRequestException} instead.
|
|
364
379
|
*/
|
|
365
380
|
_rejectedTokens = new RejectedTokenTracker();
|
|
381
|
+
lookupBackoff = new FailureBackoff();
|
|
382
|
+
clearLookupBackoff() {
|
|
383
|
+
this.lookupBackoff.clearAll();
|
|
384
|
+
}
|
|
366
385
|
/**
|
|
367
386
|
* Called by every path that replaces or removes the stored tokens — a disconnect, a forced re-sync, a
|
|
368
387
|
* reauthentication, or the connection set changing. A rejection names a specific credential, so once that
|
|
@@ -376,6 +395,7 @@ var IntegrationBase = class IntegrationBase {
|
|
|
376
395
|
*/
|
|
377
396
|
onStoredTokensReplaced() {
|
|
378
397
|
this._rejectedTokens.clear();
|
|
398
|
+
this.clearLookupBackoff();
|
|
379
399
|
this.invalidateDiscoveryCaches();
|
|
380
400
|
}
|
|
381
401
|
/**
|
|
@@ -451,6 +471,7 @@ var IntegrationBase = class IntegrationBase {
|
|
|
451
471
|
this.connectionRequestExceptionCounts.clear();
|
|
452
472
|
this._syncRequestsPerFailedUsecase.clear();
|
|
453
473
|
this._rejectedTokens.clear();
|
|
474
|
+
this.clearLookupBackoff();
|
|
454
475
|
}
|
|
455
476
|
/**
|
|
456
477
|
* Clears the strikes of the selected connection (the primary when omitted) after a successful request,
|
|
@@ -535,6 +556,7 @@ var IntegrationBase = class IntegrationBase {
|
|
|
535
556
|
if (forceSync) {
|
|
536
557
|
if (reason === "explicit") {
|
|
537
558
|
this._rejectedTokens.clear();
|
|
559
|
+
this.clearLookupBackoff();
|
|
538
560
|
this.beginForcedRefresh();
|
|
539
561
|
}
|
|
540
562
|
await this.ctx.storage.deleteWorkspace(this.connectedKey);
|
|
@@ -622,7 +644,17 @@ var IntegrationBase = class IntegrationBase {
|
|
|
622
644
|
*/
|
|
623
645
|
async settleBatchRefusals(session, targets, slots, options) {
|
|
624
646
|
const keepOtherFailures = options?.keepOtherFailures ?? false;
|
|
625
|
-
const
|
|
647
|
+
const answered = new Set(slots.flatMap((slot, i) => slot.status === "fulfilled" ? [batchTargetRepository(targets[i])] : []));
|
|
648
|
+
const credentialDied = slots.some((slot, i) => {
|
|
649
|
+
if (slot.status !== "rejected" || !isRefusedCredential(slot.reason)) return false;
|
|
650
|
+
const repository = batchTargetRepository(targets[i]);
|
|
651
|
+
return repository != null && answered.has(repository);
|
|
652
|
+
});
|
|
653
|
+
const failures = slots.map((slot, i) => {
|
|
654
|
+
if (slot.status !== "rejected" || !(slot.reason instanceof AuthenticationError)) return void 0;
|
|
655
|
+
if (credentialDied && isRefusedCredential(slot.reason)) return void 0;
|
|
656
|
+
return toCollectionScopeFailure(batchTargetScope(this.id, targets[i]), slot.reason);
|
|
657
|
+
});
|
|
626
658
|
const refused = failures.filter((f) => f != null);
|
|
627
659
|
if (!refused.length) {
|
|
628
660
|
if (!keepOtherFailures) throwIfAllSettledFailed(slots);
|
|
@@ -650,6 +682,14 @@ var IntegrationBase = class IntegrationBase {
|
|
|
650
682
|
} : slot;
|
|
651
683
|
});
|
|
652
684
|
}
|
|
685
|
+
settleBatchCredential(syncReqUsecase, settled, options) {
|
|
686
|
+
const refusal = findRefusedCredentialSlot(settled);
|
|
687
|
+
if (refusal != null) this.handleProviderException(syncReqUsecase, refusal.reason, {
|
|
688
|
+
scope: options.scope,
|
|
689
|
+
connectionId: options.connectionId
|
|
690
|
+
});
|
|
691
|
+
else if (options.reset) this.resetRequestExceptionCount(syncReqUsecase, options.connectionId);
|
|
692
|
+
}
|
|
653
693
|
/**
|
|
654
694
|
* Shows one notice, and spends at most one strike, for a batch read whose targets failed with a server error or a
|
|
655
695
|
* timeout. Our own clients leave both to the batch (see `reportRequestFailure`) instead of spending them per
|
|
@@ -661,7 +701,7 @@ var IntegrationBase = class IntegrationBase {
|
|
|
661
701
|
let notify;
|
|
662
702
|
for (const slot of slots ?? []) {
|
|
663
703
|
if (slot.status !== "rejected") continue;
|
|
664
|
-
notify =
|
|
704
|
+
notify = takeDeferredRequestFailure(slot.reason);
|
|
665
705
|
if (notify != null) break;
|
|
666
706
|
}
|
|
667
707
|
if (notify == null) return;
|