@gitkraken/core-gitlens 0.11.1 → 0.13.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 +84 -1
- package/dist/git/cache.d.ts +84 -29
- package/dist/git/cache.js +188 -54
- package/dist/git/cache.js.map +1 -1
- package/dist/git/features.d.ts +1 -1
- package/dist/git/features.js +4 -0
- package/dist/git/features.js.map +1 -1
- package/dist/git/models/branch.d.ts +15 -2
- package/dist/git/models/branch.js +27 -5
- package/dist/git/models/branch.js.map +1 -1
- package/dist/git/models/issue.d.ts +3 -1
- package/dist/git/models/issue.js.map +1 -1
- package/dist/git/models/status.js +1 -1
- package/dist/git/models/worktree.d.ts +4 -1
- package/dist/git/models/worktree.js +4 -2
- package/dist/git/models/worktree.js.map +1 -1
- package/dist/git/providers/branches.d.ts +73 -8
- package/dist/git/providers/pausedOperations.d.ts +6 -0
- package/dist/git/providers/provider.d.ts +34 -2
- package/dist/git/providers/status.d.ts +8 -2
- package/dist/git/remotes/azure-devops.js +61 -53
- package/dist/git/remotes/azure-devops.js.map +1 -1
- package/dist/git/service.d.ts +8 -5
- package/dist/git/service.js +16 -8
- package/dist/git/service.js.map +1 -1
- package/dist/git/utils/branch.utils.d.ts +8 -1
- package/dist/git/utils/branch.utils.js +30 -1
- package/dist/git/utils/branch.utils.js.map +1 -1
- package/dist/git/utils/issue.utils.d.ts +3 -1
- package/dist/git/utils/issue.utils.js +5 -1
- package/dist/git/utils/issue.utils.js.map +1 -1
- package/dist/git/watching/changeEvent.d.ts +13 -2
- package/dist/git/watching/changeEvent.js +17 -3
- package/dist/git/watching/changeEvent.js.map +1 -1
- package/dist/git/watching/gitDirPoller.d.ts +111 -0
- package/dist/git/watching/gitDirPoller.js +266 -0
- package/dist/git/watching/gitDirPoller.js.map +1 -0
- package/dist/git/watching/provider.d.ts +16 -0
- package/dist/git/watching/watchGroup.d.ts +40 -4
- package/dist/git/watching/watchGroup.js +143 -17
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.d.ts +70 -1
- package/dist/git/watching/watchService.js +158 -13
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +44 -0
- package/dist/git/watching/watchSession.js +91 -6
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git/watching/watcherPatterns.d.ts +21 -0
- package/dist/git/watching/watcherPatterns.js +67 -1
- package/dist/git/watching/watcherPatterns.js.map +1 -1
- package/dist/git/watching/worktreeSummary.d.ts +34 -7
- package/dist/git/watching/worktreeSummary.js +39 -12
- package/dist/git/watching/worktreeSummary.js.map +1 -1
- package/dist/git-cli/cliGitProvider.d.ts +34 -2
- package/dist/git-cli/cliGitProvider.js +119 -17
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/commandClassifier.d.ts +15 -0
- package/dist/git-cli/exec/commandClassifier.js +48 -2
- package/dist/git-cli/exec/commandClassifier.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +15 -3
- package/dist/git-cli/exec/git.js +38 -17
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/gitQueue.d.ts +2 -0
- package/dist/git-cli/exec/gitQueue.js +2 -1
- package/dist/git-cli/exec/gitQueue.js.map +1 -1
- package/dist/git-cli/exec/indexLock.d.ts +38 -0
- package/dist/git-cli/exec/indexLock.js +150 -0
- package/dist/git-cli/exec/indexLock.js.map +1 -0
- package/dist/git-cli/parsers/worktreeParser.js +42 -2
- package/dist/git-cli/parsers/worktreeParser.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +109 -10
- package/dist/git-cli/providers/branches.js +624 -131
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +9 -5
- package/dist/git-cli/providers/config.js +60 -27
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts +17 -0
- package/dist/git-cli/providers/operations.js +153 -96
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.d.ts +8 -0
- package/dist/git-cli/providers/pausedOperations.js +60 -40
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/refs.js +11 -8
- package/dist/git-cli/providers/refs.js.map +1 -1
- package/dist/git-cli/providers/remotes.js +19 -10
- package/dist/git-cli/providers/remotes.js.map +1 -1
- package/dist/git-cli/providers/staging.js +40 -15
- package/dist/git-cli/providers/staging.js.map +1 -1
- package/dist/git-cli/providers/stash.d.ts +2 -0
- package/dist/git-cli/providers/stash.js +33 -18
- package/dist/git-cli/providers/stash.js.map +1 -1
- package/dist/git-cli/providers/status.d.ts +3 -1
- package/dist/git-cli/providers/status.js +38 -20
- package/dist/git-cli/providers/status.js.map +1 -1
- package/dist/git-cli/providers/tags.js +6 -4
- package/dist/git-cli/providers/tags.js.map +1 -1
- package/dist/git-cli/providers/worktrees.d.ts +1 -0
- package/dist/git-cli/providers/worktrees.js +60 -31
- package/dist/git-cli/providers/worktrees.js.map +1 -1
- package/dist/git-cli/service.d.ts +6 -0
- package/dist/git-cli/service.js +5 -2
- package/dist/git-cli/service.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/providers/github/status.d.ts +3 -1
- package/dist/plus/git-github/providers/github/status.js +1 -1
- package/dist/plus/git-github/providers/github/status.js.map +1 -1
- package/dist/plus/integrations/collectionMetadata.d.ts +13 -2
- package/dist/plus/integrations/collectionMetadata.js +14 -2
- package/dist/plus/integrations/collectionMetadata.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +2 -2
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +1 -0
- package/dist/plus/integrations/integrationService.js +1 -1
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +1 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +41 -5
- package/dist/plus/integrations/models/gitHostIntegration.js +109 -30
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.js +1 -1
- package/dist/plus/integrations/models/issueReads.d.ts +17 -4
- package/dist/plus/integrations/providers/apiClients.d.ts +2 -0
- package/dist/plus/integrations/providers/apiClients.js +7 -1
- package/dist/plus/integrations/providers/apiClients.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.d.ts +5 -4
- package/dist/plus/integrations/providers/azure/azure.js +38 -77
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.utils.js +20 -17
- package/dist/plus/integrations/providers/azure/azure.utils.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts +27 -10
- package/dist/plus/integrations/providers/azure/models.js +40 -20
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azure/workItemStateCategories.d.ts +23 -0
- package/dist/plus/integrations/providers/azure/workItemStateCategories.js +84 -0
- package/dist/plus/integrations/providers/azure/workItemStateCategories.js.map +1 -0
- package/dist/plus/integrations/providers/azureDevOps.d.ts +44 -0
- package/dist/plus/integrations/providers/azureDevOps.js +113 -22
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +45 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.js +121 -6
- package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +0 -1
- package/dist/plus/integrations/providers/jira-server.js +29 -19
- package/dist/plus/integrations/providers/jira-server.js.map +1 -1
- package/dist/plus/integrations/providers/jira.d.ts +5 -2
- package/dist/plus/integrations/providers/jira.js +63 -44
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.d.ts +3 -4
- package/dist/plus/integrations/providers/jiraIssueByKey.js +3 -4
- package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
- package/dist/plus/integrations/providers/linearIssuesEtag.d.ts +5 -5
- package/dist/plus/integrations/providers/linearIssuesEtag.js +6 -6
- package/dist/plus/integrations/providers/linearIssuesEtag.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +12 -3
- package/dist/plus/integrations/providers/models.js +16 -9
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +21 -33
- package/dist/plus/integrations/providers/providersApi.js +159 -49
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/utils/jiraIssueDrains.d.ts +49 -15
- package/dist/plus/integrations/providers/utils/jiraIssueDrains.js +132 -10
- package/dist/plus/integrations/providers/utils/jiraIssueDrains.js.map +1 -1
- package/dist/plus/integrations/providers/utils/providerPaging.js +8 -2
- package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
- package/dist/plus/integrations/reads/cursors.js +1 -1
- package/dist/plus/integrations/reads/drains.d.ts +0 -1
- package/dist/plus/integrations/reads/filters.d.ts +3 -3
- package/dist/plus/integrations/reads/filters.js.map +1 -1
- package/dist/plus/integrations/reads/hierarchy.js +2 -2
- package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
- package/dist/plus/integrations/reads/hierarchy.utils.d.ts +13 -0
- package/dist/plus/integrations/reads/hierarchy.utils.js +26 -1
- package/dist/plus/integrations/reads/hierarchy.utils.js.map +1 -1
- package/dist/plus/integrations/reads/issueBatch.d.ts +2 -1
- package/dist/plus/integrations/reads/issueBatch.js +1 -1
- package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.js +27 -18
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
- package/dist/plus/integrations/reads/issues.d.ts +2 -1
- package/dist/plus/integrations/reads/issues.js +19 -4
- package/dist/plus/integrations/reads/issues.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBatch.js +1 -1
- package/dist/plus/integrations/reads/resolveRepository.js +12 -3
- package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
- package/dist/plus/integrations/reads/warnings.d.ts +11 -4
- package/dist/plus/integrations/reads/warnings.js +15 -5
- package/dist/plus/integrations/reads/warnings.js.map +1 -1
- package/dist/plus/integrations/results.d.ts +48 -4
- package/dist/plus/integrations/results.js +33 -13
- package/dist/plus/integrations/results.js.map +1 -1
- package/dist/plus/integrations/utils/integration.utils.d.ts +6 -1
- package/dist/plus/integrations/utils/integration.utils.js +8 -1
- package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
- package/dist/utils/env/node/exec.js +2 -2
- package/dist/utils/promiseCache.d.ts +10 -0
- package/dist/utils/promiseCache.js +17 -2
- package/dist/utils/promiseCache.js.map +1 -1
- package/docs/integrations.md +93 -31
- package/package.json +2 -2
|
@@ -6,8 +6,9 @@ import { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, Integration
|
|
|
6
6
|
import { ProviderOrganization } from "../results.js";
|
|
7
7
|
import { ProviderPullRequestCount, ProviderPullRequestSearchPage } from "../models/pullRequestReads.js";
|
|
8
8
|
import { IssueFilter } from "../providerFilters.js";
|
|
9
|
-
import { GetIssuesOptions, GetPullRequestsForUserOptions, GetPullRequestsOptions, GetReposOptions, PageInfo, PagingInput, PagingMode, ProviderAccount, ProviderApiCollectionResult, ProviderApiPagedResult, ProviderAzureProject, ProviderAzureResource, ProviderBitbucketResource, ProviderGitHubOrganization, ProviderGitLabGroup, ProviderHierarchyResult, ProviderIssue, ProviderJiraProject, ProviderJiraResource, ProviderJiraServerProject, ProviderLinearOrganization, ProviderLinearTeam, ProviderPullRequest, ProviderRepoInput, ProviderReposInput, ProviderRepository, ProviderRequestResponse } from "./models.js";
|
|
10
|
-
import { AzurePullRequest,
|
|
9
|
+
import { GetIssuesOptions, GetPullRequestsForUserOptions, GetPullRequestsOptions, GetReposOptions, JiraIssuePage, PageInfo, PagingInput, PagingMode, ProviderAccount, ProviderApiCollectionResult, ProviderApiPagedResult, ProviderAzureProject, ProviderAzureResource, ProviderBitbucketResource, ProviderGitHubOrganization, ProviderGitLabGroup, ProviderHierarchyResult, ProviderIssue, ProviderJiraProject, ProviderJiraResource, ProviderJiraServerProject, ProviderLinearOrganization, ProviderLinearTeam, ProviderPullRequest, ProviderRepoInput, ProviderReposInput, ProviderRepository, ProviderRequestResponse } from "./models.js";
|
|
10
|
+
import { AzurePullRequest, AzureWorkItemEtagRead } from "./azure/models.js";
|
|
11
|
+
import { AzureWorkItemStatesCache } from "./azure/workItemStateCategories.js";
|
|
11
12
|
import { countBitbucketServerPullRequests, searchBitbucketServerPullRequestsPage } from "./bitbucket-server/pullRequestSearch.js";
|
|
12
13
|
import { JiraIssueEtagResponse } from "./jiraIssueByKey.js";
|
|
13
14
|
import { LinearIssueEtagNode } from "./linearIssuesEtag.js";
|
|
@@ -16,9 +17,10 @@ import { CollectionMetadata, GitIssueState, GitPullRequestState, TrelloBoard, Tr
|
|
|
16
17
|
//#region ../plus/integrations/src/providers/providersApi.d.ts
|
|
17
18
|
export declare class ProvidersApi {
|
|
18
19
|
private readonly authenticationService;
|
|
20
|
+
private readonly azureWorkItemTypeStates;
|
|
19
21
|
private readonly providers;
|
|
20
22
|
private readonly request;
|
|
21
|
-
constructor(authenticationService: IntegrationAuthenticationService);
|
|
23
|
+
constructor(authenticationService: IntegrationAuthenticationService, azureWorkItemTypeStates?: AzureWorkItemStatesCache);
|
|
22
24
|
getScopesForProvider(providerId: IntegrationIds): string[] | undefined;
|
|
23
25
|
getProviderDomain(providerId: IntegrationIds): string | undefined;
|
|
24
26
|
getProviderPullRequestsPagingMode(providerId: IntegrationIds): PagingMode | undefined;
|
|
@@ -122,8 +124,9 @@ export declare class ProvidersApi {
|
|
|
122
124
|
* request, where {@link getAzureWorkItem} reads one work item per request, selecting only
|
|
123
125
|
* `azureWorkItemEtagFieldNames`. Asked with `errorPolicy=omit`, without which one missing id fails the whole
|
|
124
126
|
* request; Azure then leaves out every id it can't return, for whatever reason, so a caller matches the work items
|
|
125
|
-
* to its ids by `id`, never by position, and reads an omission as unknown rather than absent.
|
|
126
|
-
*
|
|
127
|
+
* to its ids by `id`, never by position, and reads an omission as unknown rather than absent. Each work item comes
|
|
128
|
+
* with the workflow category its state classifies to, as {@link getAzureWorkItem} classifies it. Every failure
|
|
129
|
+
* throws, classified as {@link getAzureWorkItem} classifies it, the states reads' included.
|
|
127
130
|
*/
|
|
128
131
|
getAzureWorkItemsEtagFields(tokenOptInfo: TokenOptInfo, scope: {
|
|
129
132
|
namespace: string;
|
|
@@ -131,7 +134,7 @@ export declare class ProvidersApi {
|
|
|
131
134
|
}, ids: readonly number[], options: {
|
|
132
135
|
isPAT?: boolean;
|
|
133
136
|
baseUrl?: string;
|
|
134
|
-
}): Promise<
|
|
137
|
+
}): Promise<AzureWorkItemEtagRead[]>;
|
|
135
138
|
/**
|
|
136
139
|
* The cheap check behind the batch pull request read's etags: one pull request as Azure DevOps returns it, by the
|
|
137
140
|
* same request {@link getPullRequestForRepo} has provider-apis send, but without the repository read it adds for
|
|
@@ -341,18 +344,19 @@ export declare class ProvidersApi {
|
|
|
341
344
|
getIssuesForAzureProject(tokenOptInfo: TokenOptInfo<GitCloudHostIntegrationId.AzureDevOps | GitSelfManagedHostIntegrationId.AzureDevOpsServer>, namespace: string, project: string, options?: GetIssuesOptions & {
|
|
342
345
|
isPAT?: boolean;
|
|
343
346
|
baseUrl?: string;
|
|
344
|
-
}): Promise<
|
|
347
|
+
}): Promise<ProviderApiPagedResult<ProviderIssue>>;
|
|
348
|
+
private azureStatesScope;
|
|
349
|
+
private readAzureStatesMetadata;
|
|
350
|
+
private getAzureTypeStates;
|
|
351
|
+
private getAzureProjectWorkItemStates;
|
|
352
|
+
private classifyAzureIssueStates;
|
|
345
353
|
getIssuesForProject(tokenOptInfo: TokenWithInfo, project: string, resourceId: string, options?: GetIssuesOptions): Promise<ProviderIssue[] | undefined>;
|
|
346
354
|
/**
|
|
347
355
|
* Single page of {@link getIssuesForProject} that preserves the SDK's `pageInfo` so a caller can drain
|
|
348
356
|
* every page (the plain {@link getIssuesForProject} discards it, silently capping at the first page).
|
|
349
357
|
* `nextCursor` is the raw provider cursor (Jira offset / nextPageToken) fed back verbatim as `options.cursor`.
|
|
350
358
|
*/
|
|
351
|
-
getIssuesForProjectPaged(tokenOptInfo: TokenWithInfo, project: string, resourceId: string, options?: GetIssuesOptions): Promise<
|
|
352
|
-
data: ProviderIssue[];
|
|
353
|
-
hasMore: boolean;
|
|
354
|
-
nextCursor: string | undefined;
|
|
355
|
-
} | undefined>;
|
|
359
|
+
getIssuesForProjectPaged(tokenOptInfo: TokenWithInfo, project: string, resourceId: string, options?: GetIssuesOptions): Promise<JiraIssuePage>;
|
|
356
360
|
getJiraServerCurrentUser(tokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>, baseUrl: string): Promise<ProviderAccount | undefined>;
|
|
357
361
|
/**
|
|
358
362
|
* Jira Server's project list, which is a single unpaged `/rest/api/2/project` read rather than Cloud's
|
|
@@ -363,42 +367,26 @@ export declare class ProvidersApi {
|
|
|
363
367
|
* One page of a Jira Server project's issues, preserving the SDK's `pageInfo` so the integration can drain
|
|
364
368
|
* every page — the same contract as {@link getIssuesForProjectPaged} on Cloud.
|
|
365
369
|
*/
|
|
366
|
-
getJiraServerIssuesForProjectPaged(tokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>, baseUrl: string, projectKey: string, options?: GetIssuesOptions): Promise<
|
|
367
|
-
data: ProviderIssue[];
|
|
368
|
-
hasMore: boolean;
|
|
369
|
-
nextCursor: string | undefined;
|
|
370
|
-
} | undefined>;
|
|
370
|
+
getJiraServerIssuesForProjectPaged(tokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>, baseUrl: string, projectKey: string, options?: GetIssuesOptions): Promise<JiraIssuePage>;
|
|
371
371
|
/**
|
|
372
372
|
* Single page of one issue search across several projects of a Jira Server instance — the contract of
|
|
373
373
|
* {@link getIssuesForProjectsPaged} on Cloud: the page and its cursor are global to the project set, and at
|
|
374
374
|
* most `JIRA_MAX_PROJECT_KEYS_PER_REQUEST` keys are accepted per call.
|
|
375
375
|
*/
|
|
376
|
-
getJiraServerIssuesForProjectsPaged(tokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>, baseUrl: string, projectKeys: string[], options?: GetIssuesOptions): Promise<
|
|
377
|
-
data: ProviderIssue[];
|
|
378
|
-
hasMore: boolean;
|
|
379
|
-
nextCursor: string | undefined;
|
|
380
|
-
} | undefined>;
|
|
376
|
+
getJiraServerIssuesForProjectsPaged(tokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>, baseUrl: string, projectKeys: string[], options?: GetIssuesOptions): Promise<JiraIssuePage>;
|
|
381
377
|
getJiraServerIssue(tokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>, baseUrl: string, number: string): Promise<ProviderIssue | undefined>;
|
|
382
378
|
/** The account-wide read: every issue related to the current user on this instance, no project needed. */
|
|
383
379
|
getJiraServerIssuesForCurrentUser(tokenOptInfo: TokenWithInfo<IssuesSelfManagedHostIntegrationId.JiraServer>, baseUrl: string, options?: {
|
|
384
380
|
cursor?: string;
|
|
385
381
|
states?: GitIssueState[];
|
|
386
382
|
sort?: IssueSorting;
|
|
387
|
-
}): Promise<
|
|
388
|
-
data: ProviderIssue[];
|
|
389
|
-
hasMore: boolean;
|
|
390
|
-
nextCursor: string | undefined;
|
|
391
|
-
} | undefined>;
|
|
383
|
+
}): Promise<JiraIssuePage>;
|
|
392
384
|
/**
|
|
393
385
|
* Single page of one issue search across several projects of the same Jira site. The page, its cursor and
|
|
394
386
|
* `hasMore` are global to the whole project set, not per project; at most `JIRA_MAX_PROJECT_KEYS_PER_REQUEST`
|
|
395
387
|
* keys are accepted per call (the SDK throws past it), so the caller chunks.
|
|
396
388
|
*/
|
|
397
|
-
getIssuesForProjectsPaged(tokenOptInfo: TokenWithInfo, projectKeys: string[], resourceId: string, options?: GetIssuesOptions): Promise<
|
|
398
|
-
data: ProviderIssue[];
|
|
399
|
-
hasMore: boolean;
|
|
400
|
-
nextCursor: string | undefined;
|
|
401
|
-
} | undefined>;
|
|
389
|
+
getIssuesForProjectsPaged(tokenOptInfo: TokenWithInfo, projectKeys: string[], resourceId: string, options?: GetIssuesOptions): Promise<JiraIssuePage>;
|
|
402
390
|
getTrelloCard(tokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Trello>, appKey: string, cardId: string, options?: {
|
|
403
391
|
trelloBoardListsById?: Record<string, {
|
|
404
392
|
name: string;
|
|
@@ -435,7 +423,7 @@ export declare class ProvidersApi {
|
|
|
435
423
|
states?: GitIssueState[];
|
|
436
424
|
isPAT?: boolean;
|
|
437
425
|
baseUrl?: string;
|
|
438
|
-
}): Promise<
|
|
426
|
+
}): Promise<ProviderApiPagedResult<ProviderIssue>>;
|
|
439
427
|
getJiraIssueByKey(tokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Jira>, resourceId: string, resourceUrl: string, key: string): Promise<ProviderIssue | undefined>;
|
|
440
428
|
/**
|
|
441
429
|
* The change state of up to `jiraBulkFetchMaxKeys` issues of one Jira Cloud site, in one bulk fetch. Unlike
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
+
import { mapSettledBounded } from "../../../utils/promise.js";
|
|
1
2
|
import { RequestNotFoundError } from "../../../git/errors.js";
|
|
2
3
|
import { base64 } from "../../../utils/base64.js";
|
|
3
4
|
import { toError } from "../errors.js";
|
|
4
5
|
import "../constants.js";
|
|
5
6
|
import { UnexpectedHtmlResponseError, getProviderResponseBodyMessage, isAzureProviderId, isProviderIssueNotFoundError, throwProviderError } from "./providerErrors.js";
|
|
6
|
-
import { isIncompleteCollection } from "../collectionMetadata.js";
|
|
7
|
+
import { isIncompleteCollection, toCollectionScopeFailure } from "../collectionMetadata.js";
|
|
7
8
|
import { toTokenWithInfo } from "../authentication/models.js";
|
|
8
9
|
import { collectProviderPagedResult, mergeCollectionMetadata, parsePageCursor, toPageCursor } from "./utils/providerPaging.js";
|
|
9
10
|
import { isRepoIdsInput, providersMetadata } from "./models.js";
|
|
10
|
-
import { azureWorkItemEtagFieldNames, encodeAzurePathSegment, fromAzureWorkItemToProviderIssue } from "./azure/models.js";
|
|
11
|
+
import { azureIssueStateCategory, azureWorkItemEtagFieldNames, encodeAzurePathSegment, fromAzureWorkItemToProviderIssue } from "./azure/models.js";
|
|
12
|
+
import { AzureWorkItemStatesCache, getAzureWorkItemTypeStatesUrl, getAzureWorkItemTypesUrl } from "./azure/workItemStateCategories.js";
|
|
11
13
|
import { requestJiraIssueByKey, requestJiraIssuesEtagFields } from "./jiraIssueByKey.js";
|
|
12
14
|
import { requestLinearIssuesEtagFields } from "./linearIssuesEtag.js";
|
|
13
15
|
import { requestBitbucketServerProjects, requestBitbucketServerRepositories } from "./bitbucket-server/discovery.js";
|
|
14
16
|
import { countBitbucketServerPullRequests, searchBitbucketServerPullRequestsPage } from "./bitbucket-server/pullRequestSearch.js";
|
|
15
|
-
import ProviderApis from "@gitkraken/provider-apis";
|
|
17
|
+
import ProviderApis, { GitIssueState } from "@gitkraken/provider-apis";
|
|
16
18
|
//#region ../plus/integrations/src/providers/providersApi.ts
|
|
17
19
|
const createProviderApis = ProviderApis.default ?? ProviderApis;
|
|
18
20
|
const repoNotFoundMessage = /^Repository .+ not found$/i;
|
|
@@ -103,12 +105,27 @@ function fromTrelloCard(card, trelloBoardListsById) {
|
|
|
103
105
|
}))
|
|
104
106
|
};
|
|
105
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* One Jira search page as the drains read it: `nextCursor` is the raw provider cursor (Jira offset / nextPageToken)
|
|
110
|
+
* fed back verbatim as `options.cursor`, and `metadata` is the SDK's, kept only when it reported something.
|
|
111
|
+
*/
|
|
112
|
+
function toJiraIssuePage(result) {
|
|
113
|
+
if (result == null) return void 0;
|
|
114
|
+
return {
|
|
115
|
+
data: result.data,
|
|
116
|
+
hasMore: result.pageInfo?.hasNextPage ?? false,
|
|
117
|
+
nextCursor: result.pageInfo?.endCursor ?? void 0,
|
|
118
|
+
...result.metadata != null ? { metadata: result.metadata } : {}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
106
121
|
var ProvidersApi = class {
|
|
107
122
|
authenticationService;
|
|
123
|
+
azureWorkItemTypeStates;
|
|
108
124
|
providers;
|
|
109
125
|
request;
|
|
110
|
-
constructor(authenticationService) {
|
|
126
|
+
constructor(authenticationService, azureWorkItemTypeStates = new AzureWorkItemStatesCache()) {
|
|
111
127
|
this.authenticationService = authenticationService;
|
|
128
|
+
this.azureWorkItemTypeStates = azureWorkItemTypeStates;
|
|
112
129
|
const http = authenticationService.ctx.http;
|
|
113
130
|
const userAgent = http.userAgent;
|
|
114
131
|
const customFetch = async ({ url, ...options }) => {
|
|
@@ -634,6 +651,7 @@ var ProvidersApi = class {
|
|
|
634
651
|
if (issue == null) throw new Error(`Azure DevOps returned no readable work item ${id}`);
|
|
635
652
|
const project = workItem?.fields?.["System.TeamProject"];
|
|
636
653
|
if (typeof project === "string" && project.toLowerCase() !== scope.project.toLowerCase()) throw new Error(`Azure DevOps work item ${id} is in project '${project}', not '${scope.project}'`);
|
|
654
|
+
await this.classifyAzureIssueStates([issue], tokenWithInfo, scope.namespace, scope.project, options);
|
|
637
655
|
return issue;
|
|
638
656
|
}
|
|
639
657
|
/**
|
|
@@ -641,8 +659,9 @@ var ProvidersApi = class {
|
|
|
641
659
|
* request, where {@link getAzureWorkItem} reads one work item per request, selecting only
|
|
642
660
|
* `azureWorkItemEtagFieldNames`. Asked with `errorPolicy=omit`, without which one missing id fails the whole
|
|
643
661
|
* request; Azure then leaves out every id it can't return, for whatever reason, so a caller matches the work items
|
|
644
|
-
* to its ids by `id`, never by position, and reads an omission as unknown rather than absent.
|
|
645
|
-
*
|
|
662
|
+
* to its ids by `id`, never by position, and reads an omission as unknown rather than absent. Each work item comes
|
|
663
|
+
* with the workflow category its state classifies to, as {@link getAzureWorkItem} classifies it. Every failure
|
|
664
|
+
* throws, classified as {@link getAzureWorkItem} classifies it, the states reads' included.
|
|
646
665
|
*/
|
|
647
666
|
async getAzureWorkItemsEtagFields(tokenOptInfo, scope, ids, options) {
|
|
648
667
|
const { tokenWithInfo } = await this.ensureProviderToken(tokenOptInfo);
|
|
@@ -656,7 +675,20 @@ var ProvidersApi = class {
|
|
|
656
675
|
headers: { Authorization: options.isPAT ? `Basic ${base64(`:${token}`)}` : `Bearer ${token}` }
|
|
657
676
|
})).body?.value;
|
|
658
677
|
if (!Array.isArray(workItems)) throw new Error("Azure DevOps returned no work items");
|
|
659
|
-
|
|
678
|
+
const readable = workItems.filter((w) => w != null);
|
|
679
|
+
const issues = readable.map((w) => {
|
|
680
|
+
const state = w.fields?.["System.State"];
|
|
681
|
+
const type = w.fields?.["System.WorkItemType"];
|
|
682
|
+
return {
|
|
683
|
+
type: typeof type === "string" ? type : void 0,
|
|
684
|
+
state: typeof state === "string" && state ? { name: state } : void 0
|
|
685
|
+
};
|
|
686
|
+
});
|
|
687
|
+
await this.classifyAzureIssueStates(issues, tokenWithInfo, scope.namespace, scope.project, options);
|
|
688
|
+
return readable.map((w, i) => ({
|
|
689
|
+
workItem: w,
|
|
690
|
+
category: issues[i].state?.category
|
|
691
|
+
}));
|
|
660
692
|
} catch (e) {
|
|
661
693
|
return this.handleProviderError(tokenWithInfo, e);
|
|
662
694
|
}
|
|
@@ -1088,11 +1120,119 @@ var ProvidersApi = class {
|
|
|
1088
1120
|
}
|
|
1089
1121
|
async getIssuesForAzureProject(tokenOptInfo, namespace, project, options) {
|
|
1090
1122
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, "getIssuesForAzureProjectFn");
|
|
1091
|
-
|
|
1123
|
+
const workItemTypeStates = options?.states?.includes(GitIssueState.Open) && options.states.includes(GitIssueState.Closed) ? void 0 : await this.getAzureProjectWorkItemStates(tokenWithInfo, namespace, project, options);
|
|
1124
|
+
const page = await this.getPagedResult({
|
|
1092
1125
|
namespace,
|
|
1093
1126
|
project,
|
|
1094
|
-
...options
|
|
1127
|
+
...options,
|
|
1128
|
+
workItemTypeStates
|
|
1095
1129
|
}, provider.getIssuesForAzureProjectFn, tokenWithInfo, options?.cursor, options?.isPAT, options?.baseUrl);
|
|
1130
|
+
const result = workItemTypeStates?.metadata == null ? page : {
|
|
1131
|
+
...page,
|
|
1132
|
+
metadata: mergeCollectionMetadata(page.metadata, workItemTypeStates.metadata),
|
|
1133
|
+
paging: {
|
|
1134
|
+
...page.paging ?? {
|
|
1135
|
+
cursor: "{}",
|
|
1136
|
+
more: false
|
|
1137
|
+
},
|
|
1138
|
+
truncated: true
|
|
1139
|
+
}
|
|
1140
|
+
};
|
|
1141
|
+
try {
|
|
1142
|
+
await this.classifyAzureIssueStates(result.values, tokenWithInfo, namespace, project, options, workItemTypeStates);
|
|
1143
|
+
} catch (ex) {
|
|
1144
|
+
return {
|
|
1145
|
+
...result,
|
|
1146
|
+
values: result.values,
|
|
1147
|
+
paging: {
|
|
1148
|
+
...result.paging ?? {
|
|
1149
|
+
cursor: "{}",
|
|
1150
|
+
more: false
|
|
1151
|
+
},
|
|
1152
|
+
truncated: true
|
|
1153
|
+
},
|
|
1154
|
+
metadata: mergeCollectionMetadata(result.metadata, {
|
|
1155
|
+
completeness: "partial",
|
|
1156
|
+
failures: [toCollectionScopeFailure({
|
|
1157
|
+
providerId: tokenWithInfo.providerId,
|
|
1158
|
+
resourceId: namespace,
|
|
1159
|
+
projectId: project
|
|
1160
|
+
}, ex)]
|
|
1161
|
+
})
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1164
|
+
return result;
|
|
1165
|
+
}
|
|
1166
|
+
azureStatesScope(token, namespace, project, options) {
|
|
1167
|
+
return {
|
|
1168
|
+
baseUrl: options?.baseUrl ?? azureDevOpsBaseUrl,
|
|
1169
|
+
namespace,
|
|
1170
|
+
project,
|
|
1171
|
+
token: token.accessToken,
|
|
1172
|
+
isPAT: options?.isPAT === true
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
async readAzureStatesMetadata(token, url, isPAT) {
|
|
1176
|
+
try {
|
|
1177
|
+
return (await this.request({
|
|
1178
|
+
url,
|
|
1179
|
+
headers: { Authorization: azureAuthorization(token.accessToken, isPAT) }
|
|
1180
|
+
})).body;
|
|
1181
|
+
} catch (ex) {
|
|
1182
|
+
return this.handleProviderError(token, ex);
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
getAzureTypeStates(token, scope, type) {
|
|
1186
|
+
return this.azureWorkItemTypeStates.getStates(scope, type, () => this.readAzureStatesMetadata(token, getAzureWorkItemTypeStatesUrl(scope.baseUrl, scope.namespace, scope.project, type), scope.isPAT));
|
|
1187
|
+
}
|
|
1188
|
+
async getAzureProjectWorkItemStates(token, namespace, project, options) {
|
|
1189
|
+
const scope = this.azureStatesScope(token, namespace, project, options);
|
|
1190
|
+
const failureScope = {
|
|
1191
|
+
providerId: token.providerId,
|
|
1192
|
+
resourceId: namespace,
|
|
1193
|
+
projectId: project
|
|
1194
|
+
};
|
|
1195
|
+
let types;
|
|
1196
|
+
try {
|
|
1197
|
+
types = await this.azureWorkItemTypeStates.getTypes(scope, () => this.readAzureStatesMetadata(token, getAzureWorkItemTypesUrl(scope.baseUrl, namespace, project), scope.isPAT));
|
|
1198
|
+
} catch (ex) {
|
|
1199
|
+
return {
|
|
1200
|
+
types: [],
|
|
1201
|
+
metadata: {
|
|
1202
|
+
completeness: "partial",
|
|
1203
|
+
failures: [toCollectionScopeFailure(failureScope, ex)]
|
|
1204
|
+
}
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
const results = await mapSettledBounded(types, 6, async (type) => ({
|
|
1208
|
+
name: type,
|
|
1209
|
+
states: await this.getAzureTypeStates(token, scope, type)
|
|
1210
|
+
}));
|
|
1211
|
+
const failures = results.flatMap((r) => r.status === "rejected" ? [toCollectionScopeFailure(failureScope, r.reason)] : []);
|
|
1212
|
+
return {
|
|
1213
|
+
types: results.map((r, i) => r.status === "fulfilled" ? r.value : { name: types[i] }),
|
|
1214
|
+
...failures.length ? { metadata: {
|
|
1215
|
+
completeness: "partial",
|
|
1216
|
+
failures
|
|
1217
|
+
} } : {}
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
async classifyAzureIssueStates(issues, tokenWithInfo, namespace, project, options, snapshot) {
|
|
1221
|
+
const scope = this.azureStatesScope(tokenWithInfo, namespace, project, options);
|
|
1222
|
+
const snapshotTypes = new Map(snapshot?.types.map((type) => [type.name, type.states]));
|
|
1223
|
+
const types = [...new Set(issues.flatMap((i) => i.state?.name && i.type && !snapshotTypes.has(i.type) ? [i.type] : []))];
|
|
1224
|
+
const results = await mapSettledBounded(types, 6, async (type) => [type, await this.getAzureTypeStates(tokenWithInfo, scope, type)]);
|
|
1225
|
+
const statesByType = new Map([...snapshotTypes, ...results.flatMap((r) => r.status === "fulfilled" ? [r.value] : [])]);
|
|
1226
|
+
for (const issue of issues) {
|
|
1227
|
+
const states = issue.type ? statesByType.get(issue.type) : void 0;
|
|
1228
|
+
if (states == null || issue.state == null) continue;
|
|
1229
|
+
issue.state = {
|
|
1230
|
+
...issue.state,
|
|
1231
|
+
category: azureIssueStateCategory(states.find((s) => s.name === issue.state?.name)?.category)
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
const failure = results.find((r) => r.status === "rejected");
|
|
1235
|
+
if (failure?.status === "rejected") throw failure.reason;
|
|
1096
1236
|
}
|
|
1097
1237
|
async getIssuesForProject(tokenOptInfo, project, resourceId, options) {
|
|
1098
1238
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, "getIssuesForProjectFn");
|
|
@@ -1117,18 +1257,12 @@ var ProvidersApi = class {
|
|
|
1117
1257
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, "getIssuesForProjectFn");
|
|
1118
1258
|
const token = tokenWithInfo.accessToken;
|
|
1119
1259
|
try {
|
|
1120
|
-
|
|
1260
|
+
return toJiraIssuePage(await provider.getIssuesForProjectFn?.({
|
|
1121
1261
|
projectKey: project,
|
|
1122
1262
|
resourceId,
|
|
1123
1263
|
...options,
|
|
1124
1264
|
includeTransitions: jiraListIncludeTransitions
|
|
1125
|
-
}, { token });
|
|
1126
|
-
if (result == null) return void 0;
|
|
1127
|
-
return {
|
|
1128
|
-
data: result.data,
|
|
1129
|
-
hasMore: result.pageInfo?.hasNextPage ?? false,
|
|
1130
|
-
nextCursor: result.pageInfo?.endCursor ?? void 0
|
|
1131
|
-
};
|
|
1265
|
+
}, { token }));
|
|
1132
1266
|
} catch (e) {
|
|
1133
1267
|
return this.handleProviderError(tokenWithInfo, e);
|
|
1134
1268
|
}
|
|
@@ -1166,20 +1300,14 @@ var ProvidersApi = class {
|
|
|
1166
1300
|
async getJiraServerIssuesForProjectPaged(tokenOptInfo, baseUrl, projectKey, options) {
|
|
1167
1301
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, "getJiraServerIssuesForProjectFn");
|
|
1168
1302
|
try {
|
|
1169
|
-
|
|
1303
|
+
return toJiraIssuePage(await provider.getJiraServerIssuesForProjectFn?.({
|
|
1170
1304
|
projectKey,
|
|
1171
1305
|
...options,
|
|
1172
1306
|
includeTransitions: jiraListIncludeTransitions
|
|
1173
1307
|
}, {
|
|
1174
1308
|
token: tokenWithInfo.accessToken,
|
|
1175
1309
|
baseUrl
|
|
1176
|
-
});
|
|
1177
|
-
if (result == null) return void 0;
|
|
1178
|
-
return {
|
|
1179
|
-
data: result.data,
|
|
1180
|
-
hasMore: result.pageInfo?.hasNextPage ?? false,
|
|
1181
|
-
nextCursor: result.pageInfo?.endCursor ?? void 0
|
|
1182
|
-
};
|
|
1310
|
+
}));
|
|
1183
1311
|
} catch (e) {
|
|
1184
1312
|
return this.handleProviderError(tokenWithInfo, e);
|
|
1185
1313
|
}
|
|
@@ -1192,20 +1320,14 @@ var ProvidersApi = class {
|
|
|
1192
1320
|
async getJiraServerIssuesForProjectsPaged(tokenOptInfo, baseUrl, projectKeys, options) {
|
|
1193
1321
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, "getJiraServerIssuesForProjectsFn");
|
|
1194
1322
|
try {
|
|
1195
|
-
|
|
1323
|
+
return toJiraIssuePage(await provider.getJiraServerIssuesForProjectsFn?.({
|
|
1196
1324
|
projectKeys,
|
|
1197
1325
|
...options,
|
|
1198
1326
|
includeTransitions: jiraListIncludeTransitions
|
|
1199
1327
|
}, {
|
|
1200
1328
|
token: tokenWithInfo.accessToken,
|
|
1201
1329
|
baseUrl
|
|
1202
|
-
});
|
|
1203
|
-
if (result == null) return void 0;
|
|
1204
|
-
return {
|
|
1205
|
-
data: result.data,
|
|
1206
|
-
hasMore: result.pageInfo?.hasNextPage ?? false,
|
|
1207
|
-
nextCursor: result.pageInfo?.endCursor ?? void 0
|
|
1208
|
-
};
|
|
1330
|
+
}));
|
|
1209
1331
|
} catch (e) {
|
|
1210
1332
|
return this.handleProviderError(tokenWithInfo, e);
|
|
1211
1333
|
}
|
|
@@ -1226,7 +1348,7 @@ var ProvidersApi = class {
|
|
|
1226
1348
|
async getJiraServerIssuesForCurrentUser(tokenOptInfo, baseUrl, options) {
|
|
1227
1349
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, "getJiraServerIssuesForCurrentUserFn");
|
|
1228
1350
|
try {
|
|
1229
|
-
|
|
1351
|
+
return toJiraIssuePage(await provider.getJiraServerIssuesForCurrentUserFn?.({
|
|
1230
1352
|
cursor: options?.cursor,
|
|
1231
1353
|
states: options?.states,
|
|
1232
1354
|
sort: options?.sort,
|
|
@@ -1234,13 +1356,7 @@ var ProvidersApi = class {
|
|
|
1234
1356
|
}, {
|
|
1235
1357
|
token: tokenWithInfo.accessToken,
|
|
1236
1358
|
baseUrl
|
|
1237
|
-
});
|
|
1238
|
-
if (result == null) return void 0;
|
|
1239
|
-
return {
|
|
1240
|
-
data: result.data,
|
|
1241
|
-
hasMore: result.pageInfo?.hasNextPage ?? false,
|
|
1242
|
-
nextCursor: result.pageInfo?.endCursor ?? void 0
|
|
1243
|
-
};
|
|
1359
|
+
}));
|
|
1244
1360
|
} catch (e) {
|
|
1245
1361
|
return this.handleProviderError(tokenWithInfo, e);
|
|
1246
1362
|
}
|
|
@@ -1254,18 +1370,12 @@ var ProvidersApi = class {
|
|
|
1254
1370
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(tokenOptInfo, "getIssuesForProjectsFn");
|
|
1255
1371
|
const token = tokenWithInfo.accessToken;
|
|
1256
1372
|
try {
|
|
1257
|
-
|
|
1373
|
+
return toJiraIssuePage(await provider.getIssuesForProjectsFn?.({
|
|
1258
1374
|
projectKeys,
|
|
1259
1375
|
resourceId,
|
|
1260
1376
|
...options,
|
|
1261
1377
|
includeTransitions: jiraListIncludeTransitions
|
|
1262
|
-
}, { token });
|
|
1263
|
-
if (result == null) return void 0;
|
|
1264
|
-
return {
|
|
1265
|
-
data: result.data,
|
|
1266
|
-
hasMore: result.pageInfo?.hasNextPage ?? false,
|
|
1267
|
-
nextCursor: result.pageInfo?.endCursor ?? void 0
|
|
1268
|
-
};
|
|
1378
|
+
}, { token }));
|
|
1269
1379
|
} catch (e) {
|
|
1270
1380
|
return this.handleProviderError(tokenWithInfo, e);
|
|
1271
1381
|
}
|