@gitkraken/core-gitlens 0.5.108 → 0.5.110
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 +49 -1
- package/dist/git/models/issue.d.ts +70 -0
- package/dist/git/models/issue.d.ts.map +1 -1
- package/dist/git/models/issue.js +17 -0
- package/dist/git/models/issue.js.map +1 -1
- package/dist/git/models/pullRequest.d.ts +81 -0
- package/dist/git/models/pullRequest.d.ts.map +1 -1
- package/dist/git/models/pullRequest.js +15 -0
- package/dist/git/models/pullRequest.js.map +1 -1
- package/dist/git/utils/issue.utils.d.ts +41 -1
- package/dist/git/utils/issue.utils.d.ts.map +1 -1
- package/dist/git/utils/issue.utils.js +80 -0
- package/dist/git/utils/issue.utils.js.map +1 -1
- package/dist/git/utils/pullRequest.utils.d.ts +11 -1
- package/dist/git/utils/pullRequest.utils.d.ts.map +1 -1
- package/dist/git/utils/pullRequest.utils.js +40 -0
- package/dist/git/utils/pullRequest.utils.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +70 -10
- package/dist/plus/git-github/api/github.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.js +284 -31
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueSearchQuery.d.ts +49 -5
- package/dist/plus/git-github/api/issueSearchQuery.d.ts.map +1 -1
- package/dist/plus/git-github/api/issueSearchQuery.js +64 -6
- package/dist/plus/git-github/api/issueSearchQuery.js.map +1 -1
- package/dist/plus/git-github/api/pullRequestSearchQuery.d.ts +27 -1
- package/dist/plus/git-github/api/pullRequestSearchQuery.d.ts.map +1 -1
- package/dist/plus/git-github/api/pullRequestSearchQuery.js +73 -6
- package/dist/plus/git-github/api/pullRequestSearchQuery.js.map +1 -1
- package/dist/plus/git-github/models.d.ts +17 -5
- package/dist/plus/git-github/models.d.ts.map +1 -1
- package/dist/plus/git-github/models.js +14 -1
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/integrations/collectionMetadata.d.ts +18 -0
- package/dist/plus/integrations/collectionMetadata.d.ts.map +1 -1
- package/dist/plus/integrations/collectionMetadata.js +24 -0
- package/dist/plus/integrations/collectionMetadata.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +31 -10
- package/dist/plus/integrations/integrationService.d.ts.map +1 -1
- package/dist/plus/integrations/integrationService.js +9 -1
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +85 -31
- package/dist/plus/integrations/manager.d.ts.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +18 -31
- package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +29 -1
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +1 -1
- package/dist/plus/integrations/models/integration.d.ts.map +1 -1
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issueReads.d.ts +63 -1
- package/dist/plus/integrations/models/issueReads.d.ts.map +1 -1
- package/dist/plus/integrations/models/issuesIntegration.d.ts +7 -21
- package/dist/plus/integrations/models/issuesIntegration.d.ts.map +1 -1
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
- package/dist/plus/integrations/providerFilters.d.ts +2 -2
- package/dist/plus/integrations/providerFilters.d.ts.map +1 -1
- package/dist/plus/integrations/providers/accounts.d.ts +6 -0
- package/dist/plus/integrations/providers/accounts.d.ts.map +1 -0
- package/dist/plus/integrations/providers/accounts.js +30 -0
- package/dist/plus/integrations/providers/accounts.js.map +1 -0
- package/dist/plus/integrations/providers/azureDevOps.d.ts.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.js +1 -0
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +9 -0
- package/dist/plus/integrations/providers/github.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github.js +115 -135
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.d.ts +9 -0
- package/dist/plus/integrations/providers/gitlab.d.ts.map +1 -1
- package/dist/plus/integrations/providers/gitlab.js +24 -4
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +36 -0
- package/dist/plus/integrations/providers/issueSorts.d.ts.map +1 -0
- package/dist/plus/integrations/providers/issueSorts.js +76 -0
- package/dist/plus/integrations/providers/issueSorts.js.map +1 -0
- package/dist/plus/integrations/providers/jira.d.ts +3 -9
- package/dist/plus/integrations/providers/jira.d.ts.map +1 -1
- package/dist/plus/integrations/providers/jira.js +5 -1
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/linear.d.ts +24 -9
- package/dist/plus/integrations/providers/linear.d.ts.map +1 -1
- package/dist/plus/integrations/providers/linear.js +63 -5
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +76 -38
- package/dist/plus/integrations/providers/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/models.js +91 -105
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +18 -3
- package/dist/plus/integrations/providers/providersApi.d.ts.map +1 -1
- package/dist/plus/integrations/providers/providersApi.js +24 -7
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/pullRequestReviews.d.ts +50 -0
- package/dist/plus/integrations/providers/pullRequestReviews.d.ts.map +1 -0
- package/dist/plus/integrations/providers/pullRequestReviews.js +99 -0
- package/dist/plus/integrations/providers/pullRequestReviews.js.map +1 -0
- package/dist/plus/integrations/providers/trello.d.ts +3 -9
- package/dist/plus/integrations/providers/trello.d.ts.map +1 -1
- package/dist/plus/integrations/providers/trello.js +1 -0
- package/dist/plus/integrations/providers/trello.js.map +1 -1
- package/dist/plus/integrations/providers/utils/providerPaging.d.ts.map +1 -1
- package/dist/plus/integrations/providers/utils/providerPaging.js +5 -1
- package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
- package/dist/plus/integrations/reads/broaden.d.ts +6 -0
- package/dist/plus/integrations/reads/broaden.d.ts.map +1 -1
- package/dist/plus/integrations/reads/broaden.js.map +1 -1
- package/dist/plus/integrations/reads/counts.d.ts +63 -1
- package/dist/plus/integrations/reads/counts.d.ts.map +1 -1
- package/dist/plus/integrations/reads/counts.js +146 -2
- package/dist/plus/integrations/reads/counts.js.map +1 -1
- package/dist/plus/integrations/reads/drains.d.ts +7 -1
- package/dist/plus/integrations/reads/drains.d.ts.map +1 -1
- package/dist/plus/integrations/reads/drains.js +13 -2
- package/dist/plus/integrations/reads/drains.js.map +1 -1
- package/dist/plus/integrations/reads/filters.d.ts +59 -9
- package/dist/plus/integrations/reads/filters.d.ts.map +1 -1
- package/dist/plus/integrations/reads/filters.js +39 -0
- package/dist/plus/integrations/reads/filters.js.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.d.ts +18 -1
- package/dist/plus/integrations/reads/issueTracker.d.ts.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.js +40 -3
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
- package/dist/plus/integrations/reads/issues.d.ts +27 -3
- package/dist/plus/integrations/reads/issues.d.ts.map +1 -1
- package/dist/plus/integrations/reads/issues.js +223 -123
- package/dist/plus/integrations/reads/issues.js.map +1 -1
- package/dist/plus/integrations/reads/ordering.d.ts +101 -0
- package/dist/plus/integrations/reads/ordering.d.ts.map +1 -0
- package/dist/plus/integrations/reads/ordering.js +48 -0
- package/dist/plus/integrations/reads/ordering.js.map +1 -0
- package/dist/plus/integrations/reads/searchIssues.d.ts +7 -2
- package/dist/plus/integrations/reads/searchIssues.d.ts.map +1 -1
- package/dist/plus/integrations/reads/searchIssues.js +9 -3
- package/dist/plus/integrations/reads/searchIssues.js.map +1 -1
- package/dist/plus/integrations/reads/searchPullRequests.d.ts +4 -3
- package/dist/plus/integrations/reads/searchPullRequests.d.ts.map +1 -1
- package/dist/plus/integrations/reads/searchPullRequests.js +6 -4
- package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/sweeps.js +1 -1
- package/dist/plus/integrations/reads/sweeps.js.map +1 -1
- package/dist/plus/integrations/reads/warnings.d.ts +35 -3
- package/dist/plus/integrations/reads/warnings.d.ts.map +1 -1
- package/dist/plus/integrations/reads/warnings.js +58 -4
- package/dist/plus/integrations/reads/warnings.js.map +1 -1
- package/dist/plus/integrations/results.d.ts +15 -0
- package/dist/plus/integrations/results.d.ts.map +1 -1
- package/dist/plus/integrations/results.js.map +1 -1
- package/docs/integrations.md +76 -10
- package/docs/kepler-read-api-parity.md +9 -0
- package/package.json +2 -2
- package/src/git/models/issue.ts +73 -0
- package/src/git/models/pullRequest.ts +84 -0
- package/src/git/utils/issue.utils.ts +91 -1
- package/src/git/utils/pullRequest.utils.ts +50 -0
- package/src/plus/git-github/api/github.ts +356 -36
- package/src/plus/git-github/api/issueSearchQuery.ts +67 -7
- package/src/plus/git-github/api/pullRequestSearchQuery.ts +81 -7
- package/src/plus/git-github/models.ts +29 -5
- package/src/plus/integrations/collectionMetadata.ts +24 -0
- package/src/plus/integrations/integrationService.ts +40 -12
- package/src/plus/integrations/manager.ts +89 -35
- package/src/plus/integrations/models/gitHostIntegration.ts +47 -31
- package/src/plus/integrations/models/integration.ts +1 -0
- package/src/plus/integrations/models/issueReads.ts +65 -1
- package/src/plus/integrations/models/issuesIntegration.ts +7 -6
- package/src/plus/integrations/providerFilters.ts +8 -1
- package/src/plus/integrations/providers/accounts.ts +34 -0
- package/src/plus/integrations/providers/azureDevOps.ts +1 -0
- package/src/plus/integrations/providers/github.ts +134 -144
- package/src/plus/integrations/providers/gitlab.ts +29 -10
- package/src/plus/integrations/providers/issueSorts.ts +89 -0
- package/src/plus/integrations/providers/jira.ts +9 -3
- package/src/plus/integrations/providers/linear.ts +77 -8
- package/src/plus/integrations/providers/models.ts +185 -128
- package/src/plus/integrations/providers/providersApi.ts +51 -13
- package/src/plus/integrations/providers/pullRequestReviews.ts +122 -0
- package/src/plus/integrations/providers/trello.ts +4 -3
- package/src/plus/integrations/providers/utils/providerPaging.ts +6 -1
- package/src/plus/integrations/reads/broaden.ts +6 -0
- package/src/plus/integrations/reads/counts.ts +281 -3
- package/src/plus/integrations/reads/drains.ts +12 -2
- package/src/plus/integrations/reads/filters.ts +92 -8
- package/src/plus/integrations/reads/issueTracker.ts +78 -4
- package/src/plus/integrations/reads/issues.ts +386 -194
- package/src/plus/integrations/reads/ordering.ts +124 -0
- package/src/plus/integrations/reads/searchIssues.ts +15 -3
- package/src/plus/integrations/reads/searchPullRequests.ts +12 -4
- package/src/plus/integrations/reads/sweeps.ts +1 -1
- package/src/plus/integrations/reads/warnings.ts +84 -2
- package/src/plus/integrations/results.ts +15 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CollectionMetadata, CollectionScopeFailure } from '@gitkraken/provider-apis';
|
|
2
2
|
import type { Account, UnidentifiedAuthor } from '../../../git/models/author.js';
|
|
3
3
|
import type { DefaultBranch } from '../../../git/models/defaultBranch.js';
|
|
4
|
-
import type { IssueSearchCriteria, IssueShape
|
|
4
|
+
import type { IssueSearchCriteria, IssueShape } from '../../../git/models/issue.js';
|
|
5
5
|
import type { IssueOrPullRequestState as PullRequestState } from '../../../git/models/issueOrPullRequest.js';
|
|
6
6
|
import type {
|
|
7
7
|
PullRequest,
|
|
@@ -20,7 +20,7 @@ import { getScopedLogger } from '../../../utils/logger.scoped.js';
|
|
|
20
20
|
import type { PagedResult } from '../../../utils/paging.js';
|
|
21
21
|
import type { ProviderAuthenticationSession } from '../authentication/models.js';
|
|
22
22
|
import { toTokenWithInfo } from '../authentication/models.js';
|
|
23
|
-
import { toCollectionScopeFailure } from '../collectionMetadata.js';
|
|
23
|
+
import { throwIfCallerContractError, toCollectionScopeFailure } from '../collectionMetadata.js';
|
|
24
24
|
import type { IntegrationIds } from '../constants.js';
|
|
25
25
|
import { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId } from '../constants.js';
|
|
26
26
|
import { toError } from '../errors.js';
|
|
@@ -56,6 +56,7 @@ import type {
|
|
|
56
56
|
ProviderPullRequestSearchPage,
|
|
57
57
|
} from './integration.js';
|
|
58
58
|
import { IntegrationBase } from './integration.js';
|
|
59
|
+
import type { MyIssuesForReposOptions } from './issueReads.js';
|
|
59
60
|
|
|
60
61
|
function isAzureDevOpsProvider(
|
|
61
62
|
providerId: IntegrationIds,
|
|
@@ -673,17 +674,7 @@ export abstract class GitHostIntegration<
|
|
|
673
674
|
|
|
674
675
|
async getMyIssuesForRepos(
|
|
675
676
|
reposOrRepoIds: ProviderReposInput,
|
|
676
|
-
options?:
|
|
677
|
-
filters?: IssueFilter[];
|
|
678
|
-
cursor?: string;
|
|
679
|
-
customUrl?: string;
|
|
680
|
-
page?: number;
|
|
681
|
-
pageSize?: number;
|
|
682
|
-
/** When true, don't constrain to the current user's assigned issues even if the Assignee filter is set. */
|
|
683
|
-
includeAllAssignees?: boolean;
|
|
684
|
-
/** Issue states to include; when omitted the provider returns its default (open only). */
|
|
685
|
-
state?: IssueStateFilter;
|
|
686
|
-
},
|
|
677
|
+
options?: MyIssuesForReposOptions,
|
|
687
678
|
connectionId?: string,
|
|
688
679
|
): Promise<PagedResult<ProviderIssue> | undefined> {
|
|
689
680
|
return (await this.getMyIssuesForReposResult(reposOrRepoIds, options, connectionId))?.value;
|
|
@@ -697,15 +688,7 @@ export abstract class GitHostIntegration<
|
|
|
697
688
|
*/
|
|
698
689
|
async getMyIssuesForReposResult(
|
|
699
690
|
reposOrRepoIds: ProviderReposInput,
|
|
700
|
-
options?:
|
|
701
|
-
filters?: IssueFilter[];
|
|
702
|
-
cursor?: string;
|
|
703
|
-
customUrl?: string;
|
|
704
|
-
page?: number;
|
|
705
|
-
pageSize?: number;
|
|
706
|
-
includeAllAssignees?: boolean;
|
|
707
|
-
state?: IssueStateFilter;
|
|
708
|
-
},
|
|
691
|
+
options?: MyIssuesForReposOptions,
|
|
709
692
|
connectionId?: string,
|
|
710
693
|
): Promise<IntegrationResult<(PagedResult<ProviderIssue> & { metadata?: CollectionMetadata }) | undefined>> {
|
|
711
694
|
const scope = getScopedLogger();
|
|
@@ -828,6 +811,7 @@ export abstract class GitHostIntegration<
|
|
|
828
811
|
page: projectInput.cursor == null ? options?.page : undefined,
|
|
829
812
|
pageSize: options?.pageSize,
|
|
830
813
|
states: states,
|
|
814
|
+
sort: options?.sort,
|
|
831
815
|
},
|
|
832
816
|
);
|
|
833
817
|
return { projectInput: projectInput, results: results };
|
|
@@ -838,6 +822,10 @@ export abstract class GitHostIntegration<
|
|
|
838
822
|
const outcome = settled[i];
|
|
839
823
|
const projectInput = projectInputs[i];
|
|
840
824
|
if (outcome.status !== 'fulfilled') {
|
|
825
|
+
// Errors that really are per-scope (auth, rate limit, a missing project) degrade below; one
|
|
826
|
+
// that is a fact about the call is re-thrown instead — see `throwIfCallerContractError`.
|
|
827
|
+
throwIfCallerContractError(outcome.reason);
|
|
828
|
+
|
|
841
829
|
truncated = true;
|
|
842
830
|
const failure = toCollectionScopeFailure(
|
|
843
831
|
{
|
|
@@ -963,6 +951,7 @@ export abstract class GitHostIntegration<
|
|
|
963
951
|
page: repoInput.cursor == null ? options?.page : undefined,
|
|
964
952
|
pageSize: options?.pageSize,
|
|
965
953
|
states: states,
|
|
954
|
+
sort: options?.sort,
|
|
966
955
|
},
|
|
967
956
|
);
|
|
968
957
|
return { repoInput: repoInput, results: results };
|
|
@@ -973,6 +962,11 @@ export abstract class GitHostIntegration<
|
|
|
973
962
|
const outcome = settled[i];
|
|
974
963
|
const repoInput = repoInputs[i];
|
|
975
964
|
if (outcome.status !== 'fulfilled') {
|
|
965
|
+
// See the project fan-out above. Reachable in practice even though the facade validates the
|
|
966
|
+
// key first — a self-managed GitLab can reject an `IssueSort` member the SDK declares, which
|
|
967
|
+
// is only discoverable from the response.
|
|
968
|
+
throwIfCallerContractError(outcome.reason);
|
|
969
|
+
|
|
976
970
|
truncated = true;
|
|
977
971
|
const failure = toCollectionScopeFailure(
|
|
978
972
|
{
|
|
@@ -1030,6 +1024,7 @@ export abstract class GitHostIntegration<
|
|
|
1030
1024
|
page: options?.page,
|
|
1031
1025
|
pageSize: options?.pageSize,
|
|
1032
1026
|
states: states,
|
|
1027
|
+
sort: options?.sort,
|
|
1033
1028
|
});
|
|
1034
1029
|
return { value: result, duration: performance.now() - start };
|
|
1035
1030
|
} catch (ex) {
|
|
@@ -1050,15 +1045,7 @@ export abstract class GitHostIntegration<
|
|
|
1050
1045
|
*/
|
|
1051
1046
|
async getMyIssuesForReposAsShapesResult(
|
|
1052
1047
|
reposOrRepoIds: ProviderReposInput,
|
|
1053
|
-
options?:
|
|
1054
|
-
filters?: IssueFilter[];
|
|
1055
|
-
cursor?: string;
|
|
1056
|
-
customUrl?: string;
|
|
1057
|
-
page?: number;
|
|
1058
|
-
pageSize?: number;
|
|
1059
|
-
includeAllAssignees?: boolean;
|
|
1060
|
-
state?: IssueStateFilter;
|
|
1061
|
-
},
|
|
1048
|
+
options?: MyIssuesForReposOptions,
|
|
1062
1049
|
connectionId?: string,
|
|
1063
1050
|
): Promise<IntegrationResult<(PagedResult<IssueShape> & { metadata?: CollectionMetadata }) | undefined>> {
|
|
1064
1051
|
const result = await this.getMyIssuesForReposResult(reposOrRepoIds, options, connectionId);
|
|
@@ -1768,6 +1755,35 @@ export abstract class GitHostIntegration<
|
|
|
1768
1755
|
cancellation?: AbortSignal,
|
|
1769
1756
|
): Promise<(number | undefined)[] | undefined>;
|
|
1770
1757
|
|
|
1758
|
+
/** The PR twin of {@link countIssuesResult}: counts each scope's pull requests, transferring none. */
|
|
1759
|
+
async countPullRequestsResult(
|
|
1760
|
+
scopes: readonly { repos?: ProviderRepoInput[]; org?: string; criteria?: PullRequestSearchCriteria }[],
|
|
1761
|
+
cancellation?: AbortSignal,
|
|
1762
|
+
connectionId?: string,
|
|
1763
|
+
): Promise<IntegrationResult<(number | undefined)[] | undefined>> {
|
|
1764
|
+
const scope = getScopedLogger();
|
|
1765
|
+
// `connectionId` targets a specific account (multi-account); omitted reads the primary.
|
|
1766
|
+
const session = await this.resolveReadSession(connectionId, scope);
|
|
1767
|
+
if (session == null) return undefined;
|
|
1768
|
+
|
|
1769
|
+
const start = performance.now();
|
|
1770
|
+
try {
|
|
1771
|
+
const counts = await this.countProviderPullRequests?.(session, scopes, cancellation);
|
|
1772
|
+
this.resetRequestExceptionCount('countPullRequests');
|
|
1773
|
+
return { value: counts, duration: performance.now() - start };
|
|
1774
|
+
} catch (ex) {
|
|
1775
|
+
this.handleProviderException('countPullRequests', ex, { scope: scope, connectionId: connectionId });
|
|
1776
|
+
return { error: toError(ex), duration: performance.now() - start };
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
/** OPTIONAL, like {@link countProviderIssues}: only a provider that can count without fetching implements it. */
|
|
1781
|
+
protected countProviderPullRequests?(
|
|
1782
|
+
session: ProviderAuthenticationSession,
|
|
1783
|
+
scopes: readonly { repos?: ProviderRepoInput[]; org?: string; criteria?: PullRequestSearchCriteria }[],
|
|
1784
|
+
cancellation?: AbortSignal,
|
|
1785
|
+
): Promise<(number | undefined)[] | undefined>;
|
|
1786
|
+
|
|
1771
1787
|
getPullRequestIdentityFromMaybeUrl(search: string): PullRequestUrlIdentity | undefined {
|
|
1772
1788
|
return this.getProviderPullRequestIdentityFromMaybeUrl?.(search);
|
|
1773
1789
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CollectionMetadata } from '@gitkraken/provider-apis';
|
|
2
|
-
import type { IssueShape } from '../../../git/models/issue.js';
|
|
2
|
+
import type { IssueShape, IssueSorting, IssueStateFilter } from '../../../git/models/issue.js';
|
|
3
3
|
import type { IssueFilter } from '../providerFilters.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -42,6 +42,58 @@ export type ProviderIssueSearchPage = {
|
|
|
42
42
|
totalCount?: number;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Options for an issue tracker's PROJECT-scoped read (`IssuesIntegration.getIssuesForProject*`), which is the
|
|
47
|
+
* only issue surface a tracker has — its issues live under resource -> project, so there is no account-wide read
|
|
48
|
+
* to pair this with.
|
|
49
|
+
*
|
|
50
|
+
* Named rather than repeated inline at each of the six declarations this shape appears in (the two public
|
|
51
|
+
* `Result` methods, the two protected provider cores, and their Jira/Linear/Trello overrides), so a field added
|
|
52
|
+
* here can't reach five of them and be forgotten in the sixth.
|
|
53
|
+
*/
|
|
54
|
+
export type IssuesForProjectOptions = {
|
|
55
|
+
/** The account handle to scope to, resolved per resource by the caller. Omitted reads every assignee. */
|
|
56
|
+
user?: string;
|
|
57
|
+
/** Validated by the caller against `ProviderMetadata.supportedIssueFilters`; unsupported refuses the read. */
|
|
58
|
+
filters?: IssueFilter[];
|
|
59
|
+
/**
|
|
60
|
+
* How the provider should order the project's issues, as `field:direction`.
|
|
61
|
+
*
|
|
62
|
+
* Validated against `ProviderMetadata.supportedIssueSorts` — a tracker reports there, not under the
|
|
63
|
+
* account-wide table. Note the caller reads MANY projects and merges them, so it additionally refuses a key
|
|
64
|
+
* no normalized issue carries; this option orders one project's query.
|
|
65
|
+
*/
|
|
66
|
+
sort?: IssueSorting;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Options for the REPO-scoped issue read (`GitHostIntegration.getMyIssuesForRepos*`), the git-host counterpart of
|
|
71
|
+
* {@link IssuesForProjectOptions}.
|
|
72
|
+
*
|
|
73
|
+
* Named for the same reason that one is: the shape appears at three declarations — the public method, its
|
|
74
|
+
* result-returning core, and the shapes-returning core that maps it — and was previously spelled out inline at
|
|
75
|
+
* each, so `sort` had to be added three times and two of the copies grew a `See {@link getMyIssuesForRepos}`
|
|
76
|
+
* breadcrumb to admit they were the same contract. One name means a field added here reaches all three.
|
|
77
|
+
*/
|
|
78
|
+
export type MyIssuesForReposOptions = {
|
|
79
|
+
/** Validated by the caller against `ProviderMetadata.supportedIssueFilters`; unsupported refuses the read. */
|
|
80
|
+
filters?: IssueFilter[];
|
|
81
|
+
cursor?: string;
|
|
82
|
+
customUrl?: string;
|
|
83
|
+
page?: number;
|
|
84
|
+
pageSize?: number;
|
|
85
|
+
/** When true, don't constrain to the current user's assigned issues even if the Assignee filter is set. */
|
|
86
|
+
includeAllAssignees?: boolean;
|
|
87
|
+
/** Issue states to include; when omitted the provider returns its default (open only). */
|
|
88
|
+
state?: IssueStateFilter;
|
|
89
|
+
/**
|
|
90
|
+
* How the provider should order the read. Forwarded to every query this read issues, so the ORDER WITHIN each
|
|
91
|
+
* scope is the provider's; the union across scopes is not ordered here — the facade (`listIssuesPage`) owns
|
|
92
|
+
* that, because it is also the layer that can refuse a key no merge can honor.
|
|
93
|
+
*/
|
|
94
|
+
sort?: IssueSorting;
|
|
95
|
+
};
|
|
96
|
+
|
|
45
97
|
/**
|
|
46
98
|
* Options for the account-wide issue read. `includeAllAssignees` drops the "assigned to me" scoping so the
|
|
47
99
|
* read broadens to issues assigned to anyone (the account-wide equivalent of the repo-scoped
|
|
@@ -70,4 +122,16 @@ export type SearchMyIssuesOptions = {
|
|
|
70
122
|
*/
|
|
71
123
|
org?: string;
|
|
72
124
|
project?: string;
|
|
125
|
+
/**
|
|
126
|
+
* How the provider should order the read, as `field:direction`.
|
|
127
|
+
*
|
|
128
|
+
* Validated by the facade against `ProviderMetadata.supportedAccountWideIssueSorts` — a DIFFERENT table from
|
|
129
|
+
* the repo-scoped one, because for GitLab the two reads are different APIs with different sort vocabularies —
|
|
130
|
+
* and refused rather than downgraded when the provider can't express it.
|
|
131
|
+
*
|
|
132
|
+
* Supplied on every facade read, never omitted: an omitted sort leaves each provider's own default, which is
|
|
133
|
+
* exactly the cross-provider incoherence this layer exists to remove. A provider that reaches this with
|
|
134
|
+
* `undefined` was called directly, not through the facade, and keeps whatever order it had.
|
|
135
|
+
*/
|
|
136
|
+
sort?: IssueSorting;
|
|
73
137
|
};
|
|
@@ -8,9 +8,10 @@ import { getScopedLogger } from '../../../utils/logger.scoped.js';
|
|
|
8
8
|
import type { ProviderAuthenticationSession } from '../authentication/models.js';
|
|
9
9
|
import type { IntegrationIds } from '../constants.js';
|
|
10
10
|
import { toError } from '../errors.js';
|
|
11
|
-
import type {
|
|
11
|
+
import type { ProviderApiCollectionResult } from '../providers/models.js';
|
|
12
12
|
import type { Integration, IntegrationResult, IntegrationType } from './integration.js';
|
|
13
13
|
import { IntegrationBase } from './integration.js';
|
|
14
|
+
import type { IssuesForProjectOptions } from './issueReads.js';
|
|
14
15
|
|
|
15
16
|
export function isIssuesIntegration(integration: Integration): integration is IssuesIntegration {
|
|
16
17
|
return integration.type === 'issues';
|
|
@@ -135,7 +136,7 @@ export abstract class IssuesIntegration<
|
|
|
135
136
|
@trace()
|
|
136
137
|
async getIssuesForProject(
|
|
137
138
|
project: T,
|
|
138
|
-
options?:
|
|
139
|
+
options?: IssuesForProjectOptions,
|
|
139
140
|
connectionId?: string,
|
|
140
141
|
): Promise<IssueShape[] | undefined> {
|
|
141
142
|
return (await this.getIssuesForProjectResult(project, options, connectionId))?.value;
|
|
@@ -148,7 +149,7 @@ export abstract class IssuesIntegration<
|
|
|
148
149
|
*/
|
|
149
150
|
async getIssuesForProjectResult(
|
|
150
151
|
project: T,
|
|
151
|
-
options?:
|
|
152
|
+
options?: IssuesForProjectOptions,
|
|
152
153
|
connectionId?: string,
|
|
153
154
|
): Promise<IntegrationResult<IssueShape[] | undefined>> {
|
|
154
155
|
const scope = getScopedLogger();
|
|
@@ -174,7 +175,7 @@ export abstract class IssuesIntegration<
|
|
|
174
175
|
*/
|
|
175
176
|
async getIssuesForProjectWithTruncationResult(
|
|
176
177
|
project: T,
|
|
177
|
-
options?:
|
|
178
|
+
options?: IssuesForProjectOptions,
|
|
178
179
|
connectionId?: string,
|
|
179
180
|
): Promise<
|
|
180
181
|
IntegrationResult<{ values: IssueShape[]; truncated: boolean; metadata?: CollectionMetadata } | undefined>
|
|
@@ -196,7 +197,7 @@ export abstract class IssuesIntegration<
|
|
|
196
197
|
protected abstract getProviderIssuesForProject(
|
|
197
198
|
session: ProviderAuthenticationSession,
|
|
198
199
|
project: T,
|
|
199
|
-
options?:
|
|
200
|
+
options?: IssuesForProjectOptions,
|
|
200
201
|
): Promise<IssueShape[] | undefined>;
|
|
201
202
|
|
|
202
203
|
/**
|
|
@@ -208,7 +209,7 @@ export abstract class IssuesIntegration<
|
|
|
208
209
|
protected async getProviderIssuesForProjectWithTruncation(
|
|
209
210
|
session: ProviderAuthenticationSession,
|
|
210
211
|
project: T,
|
|
211
|
-
options?:
|
|
212
|
+
options?: IssuesForProjectOptions,
|
|
212
213
|
): Promise<{ values: IssueShape[]; truncated: boolean; metadata?: CollectionMetadata } | undefined> {
|
|
213
214
|
const values = await this.getProviderIssuesForProject(session, project, options);
|
|
214
215
|
if (values == null) return undefined;
|
|
@@ -19,6 +19,8 @@ export type {
|
|
|
19
19
|
IssueSearchCapabilities,
|
|
20
20
|
IssueSearchCriteria,
|
|
21
21
|
IssueSearchRelationship,
|
|
22
|
+
IssueSortField,
|
|
23
|
+
IssueSorting,
|
|
22
24
|
} from '../../git/models/issue.js';
|
|
23
25
|
|
|
24
26
|
/**
|
|
@@ -26,4 +28,9 @@ export type {
|
|
|
26
28
|
* same dependency-direction reason as the issue-search model above: provider API clients translate them below
|
|
27
29
|
* this package and cannot import this facade.
|
|
28
30
|
*/
|
|
29
|
-
export type {
|
|
31
|
+
export type {
|
|
32
|
+
PullRequestSearchCapabilities,
|
|
33
|
+
PullRequestSearchCriteria,
|
|
34
|
+
PullRequestSortField,
|
|
35
|
+
PullRequestSorting,
|
|
36
|
+
} from '../../git/models/pullRequest.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Account as ProviderAccount } from '@gitkraken/provider-apis';
|
|
2
|
+
import type { IssueMember } from '../../../git/models/issue.js';
|
|
3
|
+
import type { PullRequestMember } from '../../../git/models/pullRequest.js';
|
|
4
|
+
|
|
5
|
+
export function toProviderAccount(account: PullRequestMember | IssueMember): ProviderAccount {
|
|
6
|
+
return {
|
|
7
|
+
id: account.id ?? null,
|
|
8
|
+
avatarUrl: account.avatarUrl ?? null,
|
|
9
|
+
name: account.name ?? null,
|
|
10
|
+
url: account.url ?? null,
|
|
11
|
+
// TODO: Implement these in our own model
|
|
12
|
+
email: '',
|
|
13
|
+
username: account.name ?? null,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function fromProviderAccount(account: ProviderAccount | null): PullRequestMember | IssueMember {
|
|
18
|
+
return {
|
|
19
|
+
id: account?.id ?? '',
|
|
20
|
+
// An absent name stays absent. `'unknown'` was a display fallback invented in the provider layer, and a
|
|
21
|
+
// consumer couldn't tell it apart from a member genuinely named that — so it couldn't be undone where a
|
|
22
|
+
// name-shaped placeholder is wrong (rendering an avatar-only chip, or building an AI prompt, where
|
|
23
|
+
// `Assignees: unknown` reads as a real assignee). It also disagreed with {@link toIssueShape}, which
|
|
24
|
+
// collapsed the same absent name to `''` — same facade method, two fallbacks. Both now emit `undefined`.
|
|
25
|
+
name: account?.name ?? undefined,
|
|
26
|
+
avatarUrl: account?.avatarUrl ?? undefined,
|
|
27
|
+
// `url` is optional, so an absent one must be `undefined`, not `''`. `''` passes a `!= null` presence
|
|
28
|
+
// check and renders as a link to nowhere, and it disagreed with {@link toIssueShape} — which already
|
|
29
|
+
// collapses to `undefined` — even though BOTH mappers feed `listIssuesPage` (the repo-scoped path goes
|
|
30
|
+
// through `toIssueShape`, Azure's account-wide path through {@link fromProviderIssue}). Same facade
|
|
31
|
+
// method, two shapes. Matches {@link toProviderRepositoryShape}, which collapses every absent optional.
|
|
32
|
+
url: account?.url ?? undefined,
|
|
33
|
+
};
|
|
34
|
+
}
|