@gitkraken/core-gitlens 0.39.0 → 0.40.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 +16 -1
- package/dist/plus/git-github/api/github.d.ts +4 -0
- package/dist/plus/git-github/api/github.js +7 -0
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueWrites.d.ts +51 -0
- package/dist/plus/git-github/api/issueWrites.js +192 -0
- package/dist/plus/git-github/api/issueWrites.js.map +1 -0
- package/dist/plus/integrations/authentication/rejectedTokenTracker.d.ts +7 -8
- package/dist/plus/integrations/authentication/rejectedTokenTracker.js +7 -8
- 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 +7 -1
- package/dist/plus/integrations/integrationService.js +37 -0
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +9 -0
- package/dist/plus/integrations/models/integration.d.ts +6 -4
- package/dist/plus/integrations/models/integration.js +15 -9
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/asana.d.ts +4 -5
- package/dist/plus/integrations/providers/asana.js +53 -12
- package/dist/plus/integrations/providers/asana.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +5 -1
- package/dist/plus/integrations/providers/github.js +25 -0
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +0 -1
- package/dist/plus/integrations/providers/linear.js +6 -6
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +6 -15
- package/dist/plus/integrations/providers/models.js +1 -1
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +1 -6
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/reads/drains.d.ts +0 -1
- package/docs/integrations.md +19 -0
- package/package.json +2 -2
|
@@ -2,6 +2,7 @@ import { Event } from "../../utils/event.js";
|
|
|
2
2
|
import { RefSet } from "../../git/models/autolink.js";
|
|
3
3
|
import { IssueSearchCriteria, IssueShape, IssueSorting, IssueStateFilter } from "../../git/models/issue.js";
|
|
4
4
|
import { PullRequestFilter, PullRequestSearchCriteria, PullRequestShape, PullRequestStateFilter } from "../../git/models/pullRequest.js";
|
|
5
|
+
import { GitHubIssueDelete, GitHubIssueWrite, IssueWriteResult } from "../git-github/api/issueWrites.js";
|
|
5
6
|
import { ConfiguredIntegrationDescriptor } from "./authentication/models.js";
|
|
6
7
|
import { IntegrationIds, IssuesCloudHostIntegrationId, IssuesSelfManagedHostIntegrationId } from "./constants.js";
|
|
7
8
|
import { ConfiguredIntegrationsChangeEvent } from "./authentication/configuredIntegrationService.js";
|
|
@@ -15,6 +16,12 @@ import { IssueBatchResult, IssueBatchTarget } from "./reads/issueBatch.js";
|
|
|
15
16
|
import { PullRequestBatchResult, PullRequestBatchTarget } from "./reads/pullRequestBatch.js";
|
|
16
17
|
import { PullRequestBranchResult, PullRequestBranchTarget } from "./reads/pullRequestBranches.js";
|
|
17
18
|
//#region ../plus/integrations/src/manager.d.ts
|
|
19
|
+
type IssueWriteConnection = {
|
|
20
|
+
providerId: IntegrationIds;
|
|
21
|
+
connectionId: string;
|
|
22
|
+
};
|
|
23
|
+
export type IssueWriteOptions = IssueWriteConnection & GitHubIssueWrite;
|
|
24
|
+
export type IssueDeleteOptions = IssueWriteConnection & GitHubIssueDelete;
|
|
18
25
|
/** Neutral repository input accepted by repo-scoped provider reads. */
|
|
19
26
|
export interface ProviderRepositoryInput {
|
|
20
27
|
namespace: string;
|
|
@@ -988,6 +995,8 @@ export interface IntegrationManager {
|
|
|
988
995
|
cursor?: string;
|
|
989
996
|
forceSync?: boolean;
|
|
990
997
|
}): Promise<ProviderBroadenResult<IssueShape>>;
|
|
998
|
+
writeIssue(options: IssueWriteOptions): Promise<IssueWriteResult>;
|
|
999
|
+
deleteIssue(options: IssueDeleteOptions): Promise<IssueWriteResult>;
|
|
991
1000
|
resolveRepository(options: {
|
|
992
1001
|
providerId?: IntegrationIds;
|
|
993
1002
|
remoteUrl: string;
|
|
@@ -195,7 +195,7 @@ type BatchTarget = {
|
|
|
195
195
|
} | {
|
|
196
196
|
resourceId: string;
|
|
197
197
|
};
|
|
198
|
-
type SyncReqUsecase = Exclude<'getAccountForCommit' | 'getAccountForEmail' | 'getAccountForResource' | 'getCurrentAccount' | 'getDefaultBranch' | 'getIssue' | 'getIssueOrPullRequest' | 'getIssuesBatch' | 'getIssuesEtagFields' | 'getIssuesForProject' | 'getIssuesForRepos' | 'getMyPullRequestsForUser' | 'getOrganizationsForUser' | 'getProjectsForOrg' | 'getProjectsForResources' | 'getPullRequest' | 'getPullRequestsBatch' | 'getPullRequestsEtagFields' | 'getPullRequestsForBranches' | 'getRepositoriesForOrg' | 'getRepositoriesForUser' | 'getPullRequestForBranch' | 'getPullRequestForCommit' | 'getPullRequestsForRepos' | 'getRepositoryMetadata' | 'getResourcesForUser' | 'getSshSigningKeysForEmails' | 'countIssues' | 'countPullRequests' | 'dequeuePullRequest' | 'enqueuePullRequest' | 'mergePullRequest' | 'searchIssuesPage' | 'searchPullRequestsPage' | 'searchMyIssues' | 'searchMyPullRequests' | 'searchPullRequests', 'all'>;
|
|
198
|
+
type SyncReqUsecase = Exclude<'getAccountForCommit' | 'getAccountForEmail' | 'getAccountForResource' | 'getCurrentAccount' | 'getDefaultBranch' | 'getIssue' | 'getIssueOrPullRequest' | 'getIssuesBatch' | 'getIssuesEtagFields' | 'getIssuesForProject' | 'getIssuesForRepos' | 'getMyPullRequestsForUser' | 'getOrganizationsForUser' | 'getProjectsForOrg' | 'getProjectsForResources' | 'getPullRequest' | 'getPullRequestsBatch' | 'getPullRequestsEtagFields' | 'getPullRequestsForBranches' | 'getRepositoriesForOrg' | 'getRepositoriesForUser' | 'getPullRequestForBranch' | 'getPullRequestForCommit' | 'getPullRequestsForRepos' | 'getRepositoryMetadata' | 'getResourcesForUser' | 'getSshSigningKeysForEmails' | 'countIssues' | 'countPullRequests' | 'dequeuePullRequest' | 'enqueuePullRequest' | 'mergePullRequest' | 'mutateIssue' | 'searchIssuesPage' | 'searchPullRequestsPage' | 'searchMyIssues' | 'searchMyPullRequests' | 'searchPullRequests', 'all'>;
|
|
199
199
|
export declare abstract class IntegrationBase<ID extends IntegrationIds = IntegrationIds, T extends ResourceDescriptor = ResourceDescriptor> implements Disposable {
|
|
200
200
|
protected readonly ctx: IntegrationServiceContext;
|
|
201
201
|
protected readonly authenticationService: IntegrationAuthenticationService;
|
|
@@ -297,7 +297,7 @@ export declare abstract class IntegrationBase<ID extends IntegrationIds = Integr
|
|
|
297
297
|
/**
|
|
298
298
|
* The per-connection counterpart of the primary session's expire-and-resync recovery: a token the
|
|
299
299
|
* provider refused is refreshed once through the GK cloud, which exchanges the refresh token server-side
|
|
300
|
-
* (the client never holds one). Armed by {@link
|
|
300
|
+
* (the client never holds one). Armed by {@link handleConnectionAuthenticationRejection} and consumed by
|
|
301
301
|
* {@link resolveReadSession}; a rejection it declines belongs to {@link trackRequestException} instead.
|
|
302
302
|
*/
|
|
303
303
|
private readonly _rejectedTokens;
|
|
@@ -353,8 +353,8 @@ export declare abstract class IntegrationBase<ID extends IntegrationIds = Integr
|
|
|
353
353
|
private getSecondaryConnectionId;
|
|
354
354
|
private resetRecoveryAccounting;
|
|
355
355
|
/**
|
|
356
|
-
* Clears the strikes of the connection
|
|
357
|
-
*
|
|
356
|
+
* Clears the strikes of the selected connection (the primary when omitted) after a successful request,
|
|
357
|
+
* or of every connection for `'all'`.
|
|
358
358
|
*/
|
|
359
359
|
resetRequestExceptionCount(syncReqUsecase: SyncReqUsecase | 'all', connectionId?: string): void;
|
|
360
360
|
/**
|
|
@@ -480,6 +480,8 @@ export declare abstract class IntegrationBase<ID extends IntegrationIds = Integr
|
|
|
480
480
|
/** Names each scoped refusal's cause (see {@link describeRefusal}); only once the credential is proven. */
|
|
481
481
|
private nameRefusalCauses;
|
|
482
482
|
/** Returns whether it spent a strike (see {@link trackRequestException}). */
|
|
483
|
+
protected handleConnectionAuthenticationRejection(connectionId: string, silent?: boolean): boolean;
|
|
484
|
+
/** Returns whether it spent a strike (see {@link trackRequestException}). */
|
|
483
485
|
protected handleProviderException(syncReqUsecase: SyncReqUsecase, ex: Error, options?: {
|
|
484
486
|
scope?: ScopedLogger | undefined;
|
|
485
487
|
silent?: boolean;
|
|
@@ -340,7 +340,7 @@ var IntegrationBase = class IntegrationBase {
|
|
|
340
340
|
/**
|
|
341
341
|
* The per-connection counterpart of the primary session's expire-and-resync recovery: a token the
|
|
342
342
|
* provider refused is refreshed once through the GK cloud, which exchanges the refresh token server-side
|
|
343
|
-
* (the client never holds one). Armed by {@link
|
|
343
|
+
* (the client never holds one). Armed by {@link handleConnectionAuthenticationRejection} and consumed by
|
|
344
344
|
* {@link resolveReadSession}; a rejection it declines belongs to {@link trackRequestException} instead.
|
|
345
345
|
*/
|
|
346
346
|
_rejectedTokens = new RejectedTokenTracker();
|
|
@@ -434,8 +434,8 @@ var IntegrationBase = class IntegrationBase {
|
|
|
434
434
|
this._rejectedTokens.clear();
|
|
435
435
|
}
|
|
436
436
|
/**
|
|
437
|
-
* Clears the strikes of the connection
|
|
438
|
-
*
|
|
437
|
+
* Clears the strikes of the selected connection (the primary when omitted) after a successful request,
|
|
438
|
+
* or of every connection for `'all'`.
|
|
439
439
|
*/
|
|
440
440
|
resetRequestExceptionCount(syncReqUsecase, connectionId) {
|
|
441
441
|
if (syncReqUsecase === "all") {
|
|
@@ -697,16 +697,22 @@ var IntegrationBase = class IntegrationBase {
|
|
|
697
697
|
attributeScopedAuthFailures(metadata, (refusal, scope) => describeRefusal(session, refusal, scope));
|
|
698
698
|
}
|
|
699
699
|
/** Returns whether it spent a strike (see {@link trackRequestException}). */
|
|
700
|
+
handleConnectionAuthenticationRejection(connectionId, silent) {
|
|
701
|
+
this._validatedCredentials.clear();
|
|
702
|
+
if (this._rejectedTokens.recordRejection(connectionId)) return false;
|
|
703
|
+
this.trackRequestException({
|
|
704
|
+
connectionId,
|
|
705
|
+
silent
|
|
706
|
+
});
|
|
707
|
+
return true;
|
|
708
|
+
}
|
|
709
|
+
/** Returns whether it spent a strike (see {@link trackRequestException}). */
|
|
700
710
|
handleProviderException(syncReqUsecase, ex, options) {
|
|
701
711
|
if (isCancellationError(ex)) return false;
|
|
702
|
-
if (ex instanceof AuthenticationError) this._validatedCredentials.clear();
|
|
712
|
+
if (ex instanceof AuthenticationError && !options?.connectionId) this._validatedCredentials.clear();
|
|
703
713
|
if (options?.scope != null) options.scope.error(ex);
|
|
704
714
|
else _logger.error(ex);
|
|
705
|
-
if (ex instanceof AuthenticationError && options?.connectionId)
|
|
706
|
-
if (this._rejectedTokens.recordRejection(options.connectionId)) return false;
|
|
707
|
-
this.trackRequestException(options);
|
|
708
|
-
return true;
|
|
709
|
-
}
|
|
715
|
+
if (ex instanceof AuthenticationError && options?.connectionId) return this.handleConnectionAuthenticationRejection(options.connectionId, options.silent);
|
|
710
716
|
if (ex instanceof AuthenticationError && this._session?.cloud && !this.hasSessionSyncRequests()) {
|
|
711
717
|
this.requestSessionSyncForUsecase(syncReqUsecase);
|
|
712
718
|
const refused = this._session.accessToken;
|