@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
|
@@ -41,26 +41,22 @@ import type {
|
|
|
41
41
|
SetPullRequestInput,
|
|
42
42
|
Trello,
|
|
43
43
|
} from '@gitkraken/provider-apis';
|
|
44
|
-
import
|
|
45
|
-
import
|
|
44
|
+
import { EntityIdentifierUtils } from '@gitkraken/provider-apis/entity-identifiers';
|
|
45
|
+
import { GitProviderUtils } from '@gitkraken/provider-apis/provider-utils';
|
|
46
46
|
import { githubSearchResultLimit } from '../../git-github/api/config.js';
|
|
47
47
|
import type { Account as UserAccount } from '../../../git/models/author.js';
|
|
48
|
-
import type {
|
|
48
|
+
import type { IssueProject, IssueShape, IssueStateFilter } from '../../../git/models/issue.js';
|
|
49
49
|
import { Issue, RepositoryAccessLevel } from '../../../git/models/issue.js';
|
|
50
50
|
import type {
|
|
51
|
-
PullRequestMember,
|
|
52
51
|
PullRequestRef,
|
|
53
52
|
PullRequestRefs,
|
|
54
53
|
PullRequestRepositoryIdentityDescriptor,
|
|
55
|
-
PullRequestReviewer,
|
|
56
54
|
PullRequestState,
|
|
57
55
|
PullRequestStateFilter,
|
|
58
56
|
} from '../../../git/models/pullRequest.js';
|
|
59
57
|
import {
|
|
60
58
|
PullRequest,
|
|
61
59
|
PullRequestMergeableState,
|
|
62
|
-
PullRequestReviewDecision,
|
|
63
|
-
PullRequestReviewState,
|
|
64
60
|
PullRequestStatusCheckRollupState,
|
|
65
61
|
} from '../../../git/models/pullRequest.js';
|
|
66
62
|
import type { Provider, ProviderReference } from '../../../git/models/remoteProvider.js';
|
|
@@ -75,7 +71,12 @@ import {
|
|
|
75
71
|
IssuesCloudHostIntegrationId,
|
|
76
72
|
} from '../constants.js';
|
|
77
73
|
import type { Integration, IntegrationType } from '../models/integration.js';
|
|
78
|
-
import type {
|
|
74
|
+
import type {
|
|
75
|
+
IssueSearchCapabilities,
|
|
76
|
+
IssueSorting,
|
|
77
|
+
PullRequestSearchCapabilities,
|
|
78
|
+
PullRequestSorting,
|
|
79
|
+
} from '../providerFilters.js';
|
|
79
80
|
import { IssueFilter, PullRequestFilter } from '../providerFilters.js';
|
|
80
81
|
|
|
81
82
|
export { IssueFilter, PullRequestFilter } from '../providerFilters.js';
|
|
@@ -83,12 +84,37 @@ export type {
|
|
|
83
84
|
IssueSearchCapabilities,
|
|
84
85
|
IssueSearchCriteria,
|
|
85
86
|
IssueSearchRelationship,
|
|
87
|
+
IssueSortField,
|
|
88
|
+
IssueSorting,
|
|
86
89
|
PullRequestSearchCapabilities,
|
|
87
90
|
PullRequestSearchCriteria,
|
|
91
|
+
PullRequestSortField,
|
|
92
|
+
PullRequestSorting,
|
|
88
93
|
} from '../providerFilters.js';
|
|
89
94
|
import type { ProviderRepositoryShape } from '../results.js';
|
|
90
95
|
|
|
91
96
|
export type { ProviderOrganization, ProviderRepositoryShape } from '../results.js';
|
|
97
|
+
import { fromProviderAccount, toProviderAccount } from './accounts.js';
|
|
98
|
+
import {
|
|
99
|
+
azureAccountWideIssueSorts,
|
|
100
|
+
azureIssueSorts,
|
|
101
|
+
githubAccountWideIssueSorts,
|
|
102
|
+
githubIssueSorts,
|
|
103
|
+
gitlabAccountWideIssueSorts,
|
|
104
|
+
gitlabIssueSorts,
|
|
105
|
+
jiraIssueSorts,
|
|
106
|
+
linearIssueSorts,
|
|
107
|
+
trelloIssueSorts,
|
|
108
|
+
} from './issueSorts.js';
|
|
109
|
+
import type { ProviderPullRequestReview, ProviderPullRequestReviews } from './pullRequestReviews.js';
|
|
110
|
+
import {
|
|
111
|
+
fromPullRequestReviewDecision,
|
|
112
|
+
providerPullRequestReviewStateDismissed,
|
|
113
|
+
toCompletedReviews,
|
|
114
|
+
toProviderReviewDecision,
|
|
115
|
+
toProviderReviews,
|
|
116
|
+
toReviewRequests,
|
|
117
|
+
} from './pullRequestReviews.js';
|
|
92
118
|
import { getEntityIdentifierInput } from './utils.js';
|
|
93
119
|
|
|
94
120
|
type GitBuildStatusState = GitBuildStatusStateType;
|
|
@@ -97,9 +123,6 @@ type GitPullRequestMergeableState = GitPullRequestMergeableStateType;
|
|
|
97
123
|
type GitPullRequestReviewState = GitPullRequestReviewStateType;
|
|
98
124
|
type GitPullRequestState = GitPullRequestStateType;
|
|
99
125
|
|
|
100
|
-
const { EntityIdentifierUtils } = entityIdentifiersModule;
|
|
101
|
-
const { GitProviderUtils } = providerUtilsModule;
|
|
102
|
-
|
|
103
126
|
// Local runtime copies of the `@gitkraken/provider-apis` string enums. Duplicated (not imported as
|
|
104
127
|
// values) because the SDK ships as CJS whose named enum exports can't be statically imported as ESM
|
|
105
128
|
// values from the bundled `dist`. Exported so the enum-parity test can deep-equal them against the
|
|
@@ -156,7 +179,29 @@ type EnrichableItem = any;
|
|
|
156
179
|
export type ProviderAccount = Account;
|
|
157
180
|
export type ProviderReposInput = (string | number)[] | GetRepoInput[];
|
|
158
181
|
export type ProviderRepoInput = GetRepoInput;
|
|
159
|
-
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Which half of {@link ProviderReposInput} a caller supplied: repository IDS rather than descriptors.
|
|
185
|
+
*
|
|
186
|
+
* The union has no discriminant, so the answer is the element shape — and several layers need it for different
|
|
187
|
+
* reasons (`ProvidersApi` to pick `repoIds` vs `repos` in the SDK input, `GitHostIntegration` to refuse an
|
|
188
|
+
* id-based read a provider can't serve, `listIssuesPage` to know GitLab's id form takes the SDK's own merging
|
|
189
|
+
* aggregate). One predicate rather than one per layer, because each copy is free to disagree about the shape,
|
|
190
|
+
* and the symptom of disagreement is a read routed to the wrong provider query.
|
|
191
|
+
*
|
|
192
|
+
* Takes `unknown` rather than {@link ProviderReposInput} because `ProvidersApi.isRepoIdsInput` forwards here and
|
|
193
|
+
* is public with an unvalidated parameter, so the array check has to stay part of the rule rather than be assumed
|
|
194
|
+
* from the parameter type.
|
|
195
|
+
*/
|
|
196
|
+
export function isRepoIdsInput(input: unknown): input is (string | number)[] {
|
|
197
|
+
return (
|
|
198
|
+
input != null &&
|
|
199
|
+
Array.isArray(input) &&
|
|
200
|
+
input.every(repo => typeof repo === 'string' || typeof repo === 'number')
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export type ProviderPullRequest = Omit<GitPullRequest, 'reviews'> & { reviews: ProviderPullRequestReviews };
|
|
160
205
|
export type ProviderRepository = GitRepository;
|
|
161
206
|
export type ProviderIssue = ProviderApiIssue;
|
|
162
207
|
export type ProviderEnterpriseOptions = EnterpriseOptions;
|
|
@@ -331,6 +376,20 @@ export interface GetIssuesOptions {
|
|
|
331
376
|
page?: number;
|
|
332
377
|
// Items to request per page (numbered-page providers, plus GitHub's maxPageSize).
|
|
333
378
|
pageSize?: number;
|
|
379
|
+
/**
|
|
380
|
+
* How the provider should order the result, as `field:direction`.
|
|
381
|
+
*
|
|
382
|
+
* Passed through to the SDK verbatim — the translation to each provider's own vocabulary lives THERE, next to
|
|
383
|
+
* the capability map it validates against, so that the table this facade publishes and the table that does the
|
|
384
|
+
* translating can't drift apart across two repositories. A key the provider can't express raises the SDK's
|
|
385
|
+
* `UnsupportedSortError`, which is why the facade validates against `supportedIssueSorts` first: reaching that
|
|
386
|
+
* error means this table has outrun the SDK's.
|
|
387
|
+
*
|
|
388
|
+
* Always supplied by the facade's reads, never omitted. Omitting it would delegate the order to each provider's
|
|
389
|
+
* own default, which is the incoherence across providers the SDK deliberately preserves and this layer
|
|
390
|
+
* deliberately does not.
|
|
391
|
+
*/
|
|
392
|
+
sort?: IssueSorting;
|
|
334
393
|
}
|
|
335
394
|
|
|
336
395
|
export interface GetIssuesForRepoInput extends GetIssuesOptions {
|
|
@@ -492,6 +551,8 @@ export type GetIssuesForCurrentUserInput = PagingInput & {
|
|
|
492
551
|
assigneeUsername?: string;
|
|
493
552
|
authorUsername?: string;
|
|
494
553
|
pageSize?: number;
|
|
554
|
+
/** See {@link GetIssuesOptions.sort}. */
|
|
555
|
+
sort?: IssueSorting;
|
|
495
556
|
};
|
|
496
557
|
|
|
497
558
|
export type GetIssuesForCurrentUserFn = (
|
|
@@ -624,10 +685,10 @@ export type GetBitbucketServerPullRequestsForCurrentUserFn = (
|
|
|
624
685
|
data: GitPullRequest[];
|
|
625
686
|
}>;
|
|
626
687
|
export type GetIssuesForProjectFn = Jira['getIssuesForProject'];
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
688
|
+
// Derived from the client method rather than hand-declared, as its project-scoped sibling above already is: the
|
|
689
|
+
// hand-written shape named only `resourceId`, so every other field the SDK accepts (the cursor, the sort, the
|
|
690
|
+
// transitions switch) was invisible to the type system and had to be smuggled through `getPagedResult`'s `any`.
|
|
691
|
+
export type GetIssuesForResourceForCurrentUserFn = Jira['getIssuesForResourceForCurrentUser'];
|
|
631
692
|
|
|
632
693
|
// Trello reads (issues-capable provider). The Trello client is keyed by an `appKey` (the Trello app key from
|
|
633
694
|
// the cloud token exchange) alongside the OAuth token, so these mirror the client method shapes directly.
|
|
@@ -729,6 +790,36 @@ export interface ProviderMetadata {
|
|
|
729
790
|
* axes; it omits `Mention` because that REST read has no first-class mention filter.
|
|
730
791
|
*/
|
|
731
792
|
supportedAccountWideIssueFilters?: IssueFilter[];
|
|
793
|
+
/**
|
|
794
|
+
* Sort keys the REPO-scoped issue read can express server-side — and, for an issue tracker (Jira/Linear/Trello),
|
|
795
|
+
* its project-scoped read, which is the only issue surface a tracker has.
|
|
796
|
+
*
|
|
797
|
+
* Absent/empty means the read can't be ordered at all, so a request carrying `sort` is refused rather than
|
|
798
|
+
* served in whatever order the provider felt like. Present, it is a promise: every key here reaches the
|
|
799
|
+
* provider query.
|
|
800
|
+
*
|
|
801
|
+
* A key listed here is expressible on ONE provider query, which is what this read is when it is given ONE
|
|
802
|
+
* scope. Given several (GitLab across repositories, Azure across projects, a tracker across projects) it merges
|
|
803
|
+
* their results here and can only honor a key a normalized issue carries, so it additionally refuses
|
|
804
|
+
* `priority`/`dueDate`/`resolved` — see `getIssueComparator`. That depends on the caller's scope count rather
|
|
805
|
+
* than on the provider, which is why it is a runtime refusal and not a fourth table: encoding it here would
|
|
806
|
+
* under-report the single-scope read, which really does support those keys.
|
|
807
|
+
*/
|
|
808
|
+
supportedIssueSorts?: IssueSorting[];
|
|
809
|
+
/**
|
|
810
|
+
* Sort keys the ACCOUNT-WIDE issue read can express server-side, which is NOT the same set as
|
|
811
|
+
* {@link ProviderMetadata.supportedIssueSorts} — for GitLab the two reads are different APIs (GraphQL vs REST)
|
|
812
|
+
* with genuinely different vocabularies, not one narrowed twice.
|
|
813
|
+
*
|
|
814
|
+
* Absent means the account-wide read can't be ordered (or doesn't exist). An issue tracker leaves this empty
|
|
815
|
+
* and reports under `supportedIssueSorts`, so reading a tracker's capability from here under-reports it.
|
|
816
|
+
*
|
|
817
|
+
* Unlike {@link ProviderMetadata.supportedIssueSorts} this needs no companion runtime refusal, because every
|
|
818
|
+
* provider's account-wide read is a union of several queries with no scope count for a caller to reduce: it
|
|
819
|
+
* ALWAYS merges. So the keys a merge can't order by are simply absent here — the table states what the read can
|
|
820
|
+
* honor, which is what makes intersecting against it sufficient.
|
|
821
|
+
*/
|
|
822
|
+
supportedAccountWideIssueSorts?: IssueSorting[];
|
|
732
823
|
/**
|
|
733
824
|
* What the provider's FILTERED issue search (`searchIssuesPage`, and the `countIssues` probe over the same
|
|
734
825
|
* criteria) can express server-side. A third, wider surface than either filter set above: it is not bound to
|
|
@@ -774,21 +865,40 @@ const githubIssueSearchCapabilities: IssueSearchCapabilities = {
|
|
|
774
865
|
withoutLinkedPullRequest: true,
|
|
775
866
|
// `is:open` / `is:closed`, or neither for all states.
|
|
776
867
|
states: true,
|
|
868
|
+
// `sort:created-desc`, `sort:updated`, `sort:comments-asc`, … — see `githubIssueSorts`.
|
|
869
|
+
sorts: githubIssueSorts,
|
|
777
870
|
};
|
|
778
871
|
|
|
872
|
+
/**
|
|
873
|
+
* The ordering vocabulary of GitHub's filtered PR search: `created` and `updated`, both directions.
|
|
874
|
+
*
|
|
875
|
+
* Hand-declared rather than derived from `@gitkraken/provider-apis` (which has no PR-sort surface), and narrower
|
|
876
|
+
* than the issue set on purpose: the merged relationship × state facets can only be re-ordered by a field a
|
|
877
|
+
* `PullRequestShape` carries (see `getPullRequestComparator`), and GitHub PRs have no priority and no relevance
|
|
878
|
+
* that orders stably under the result ceiling. A parity test pins this to `gitHubPullRequestSortQualifiers`' keys
|
|
879
|
+
* so the capability can't outrun the emitter.
|
|
880
|
+
*/
|
|
881
|
+
const githubPullRequestSorts: PullRequestSorting[] = ['updated:desc', 'updated:asc', 'created:desc', 'created:asc'];
|
|
882
|
+
|
|
779
883
|
/** GitHub and GHE use the same filtered pull-request search syntax and result ceiling. */
|
|
780
884
|
const githubPullRequestSearchCapabilities: PullRequestSearchCapabilities = {
|
|
781
885
|
relationships: [
|
|
782
886
|
PullRequestFilter.Author,
|
|
783
887
|
PullRequestFilter.Assignee,
|
|
784
888
|
PullRequestFilter.ReviewRequested,
|
|
889
|
+
PullRequestFilter.Reviewed,
|
|
785
890
|
PullRequestFilter.Mention,
|
|
786
891
|
],
|
|
787
892
|
states: ['open', 'closed', 'merged', 'all'],
|
|
788
893
|
text: true,
|
|
894
|
+
updatedAfter: true,
|
|
895
|
+
createdAfter: true,
|
|
789
896
|
includeArchived: true,
|
|
897
|
+
draft: true,
|
|
790
898
|
repositoryScope: true,
|
|
791
899
|
organizationScope: true,
|
|
900
|
+
// `sort:updated`, `sort:updated-asc`, `sort:created-desc`, `sort:created-asc` — see `githubPullRequestSorts`.
|
|
901
|
+
sorts: githubPullRequestSorts,
|
|
792
902
|
};
|
|
793
903
|
|
|
794
904
|
export const providersMetadata: ProvidersMetadata = {
|
|
@@ -811,6 +921,7 @@ export const providersMetadata: ProvidersMetadata = {
|
|
|
811
921
|
PullRequestFilter.Author,
|
|
812
922
|
PullRequestFilter.Assignee,
|
|
813
923
|
PullRequestFilter.ReviewRequested,
|
|
924
|
+
PullRequestFilter.Reviewed,
|
|
814
925
|
PullRequestFilter.Mention,
|
|
815
926
|
],
|
|
816
927
|
supportedPullRequestSearch: githubPullRequestSearchCapabilities,
|
|
@@ -820,6 +931,10 @@ export const providersMetadata: ProvidersMetadata = {
|
|
|
820
931
|
// The account-wide read is three independent searches (`author:@me`, `assignee:@me`, `mentions:@me`) behind
|
|
821
932
|
// one composite cursor, so any subset of them is expressible.
|
|
822
933
|
supportedAccountWideIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],
|
|
934
|
+
// One `search` field serves all three issue reads (repo-scoped, account-wide, filtered search), so the same
|
|
935
|
+
// qualifiers are expressible on each — the account-wide one narrowed to what its three-alias merge can order.
|
|
936
|
+
supportedIssueSorts: githubIssueSorts,
|
|
937
|
+
supportedAccountWideIssueSorts: githubAccountWideIssueSorts,
|
|
823
938
|
supportedIssueSearch: githubIssueSearchCapabilities,
|
|
824
939
|
issueSearchResultLimit: githubSearchResultLimit,
|
|
825
940
|
scopes: ['repo', 'read:user', 'user:email'],
|
|
@@ -843,6 +958,7 @@ export const providersMetadata: ProvidersMetadata = {
|
|
|
843
958
|
PullRequestFilter.Author,
|
|
844
959
|
PullRequestFilter.Assignee,
|
|
845
960
|
PullRequestFilter.ReviewRequested,
|
|
961
|
+
PullRequestFilter.Reviewed,
|
|
846
962
|
PullRequestFilter.Mention,
|
|
847
963
|
],
|
|
848
964
|
supportedPullRequestSearch: githubPullRequestSearchCapabilities,
|
|
@@ -852,6 +968,10 @@ export const providersMetadata: ProvidersMetadata = {
|
|
|
852
968
|
// The account-wide read is three independent searches (`author:@me`, `assignee:@me`, `mentions:@me`) behind
|
|
853
969
|
// one composite cursor, so any subset of them is expressible.
|
|
854
970
|
supportedAccountWideIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],
|
|
971
|
+
// One `search` field serves all three issue reads (repo-scoped, account-wide, filtered search), so the same
|
|
972
|
+
// qualifiers are expressible on each — the account-wide one narrowed to what its three-alias merge can order.
|
|
973
|
+
supportedIssueSorts: githubIssueSorts,
|
|
974
|
+
supportedAccountWideIssueSorts: githubAccountWideIssueSorts,
|
|
855
975
|
supportedIssueSearch: githubIssueSearchCapabilities,
|
|
856
976
|
issueSearchResultLimit: githubSearchResultLimit,
|
|
857
977
|
scopes: ['repo', 'read:user', 'user:email'],
|
|
@@ -881,6 +1001,10 @@ export const providersMetadata: ProvidersMetadata = {
|
|
|
881
1001
|
// unioned, so either axis is expressible on its own. Mention is absent because GitLab's REST issue read has
|
|
882
1002
|
// no first-class mention filter to narrow with.
|
|
883
1003
|
supportedAccountWideIssueFilters: [IssueFilter.Assignee, IssueFilter.Author],
|
|
1004
|
+
// Two different surfaces, not one narrowed twice: the repository-scoped read is GraphQL and the
|
|
1005
|
+
// account-wide one is REST, and REST has neither `title` nor `closed_at`.
|
|
1006
|
+
supportedIssueSorts: gitlabIssueSorts,
|
|
1007
|
+
supportedAccountWideIssueSorts: gitlabAccountWideIssueSorts,
|
|
884
1008
|
scopes: ['api', 'read_user', 'read_repository'],
|
|
885
1009
|
},
|
|
886
1010
|
[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted]: {
|
|
@@ -908,6 +1032,10 @@ export const providersMetadata: ProvidersMetadata = {
|
|
|
908
1032
|
// unioned, so either axis is expressible on its own. Mention is absent because GitLab's REST issue read has
|
|
909
1033
|
// no first-class mention filter to narrow with.
|
|
910
1034
|
supportedAccountWideIssueFilters: [IssueFilter.Assignee, IssueFilter.Author],
|
|
1035
|
+
// Two different surfaces, not one narrowed twice: the repository-scoped read is GraphQL and the
|
|
1036
|
+
// account-wide one is REST, and REST has neither `title` nor `closed_at`.
|
|
1037
|
+
supportedIssueSorts: gitlabIssueSorts,
|
|
1038
|
+
supportedAccountWideIssueSorts: gitlabAccountWideIssueSorts,
|
|
911
1039
|
scopes: ['api', 'read_user', 'read_repository'],
|
|
912
1040
|
},
|
|
913
1041
|
[GitCloudHostIntegrationId.Bitbucket]: {
|
|
@@ -956,6 +1084,11 @@ export const providersMetadata: ProvidersMetadata = {
|
|
|
956
1084
|
// The account-wide read drains one (project × assignee) and one (project × author) query per project, so
|
|
957
1085
|
// either axis is expressible on its own. There is no mention query to narrow to.
|
|
958
1086
|
supportedAccountWideIssueFilters: [IssueFilter.Author, IssueFilter.Assignee],
|
|
1087
|
+
// Both reads emit the same WIQL, but the account-wide one drains every (project x relationship) query and
|
|
1088
|
+
// merges the results, so it can only honor keys a normalized issue carries — `resolved` and `priority` are
|
|
1089
|
+
// dropped from that surface for the same reason they are dropped from GitLab's.
|
|
1090
|
+
supportedIssueSorts: azureIssueSorts,
|
|
1091
|
+
supportedAccountWideIssueSorts: azureAccountWideIssueSorts,
|
|
959
1092
|
scopes: ['vso.code', 'vso.identity', 'vso.project', 'vso.profile', 'vso.work'],
|
|
960
1093
|
},
|
|
961
1094
|
[GitSelfManagedHostIntegrationId.AzureDevOpsServer]: {
|
|
@@ -982,6 +1115,11 @@ export const providersMetadata: ProvidersMetadata = {
|
|
|
982
1115
|
// The account-wide read drains one (project × assignee) and one (project × author) query per project, so
|
|
983
1116
|
// either axis is expressible on its own. There is no mention query to narrow to.
|
|
984
1117
|
supportedAccountWideIssueFilters: [IssueFilter.Author, IssueFilter.Assignee],
|
|
1118
|
+
// Both reads emit the same WIQL, but the account-wide one drains every (project x relationship) query and
|
|
1119
|
+
// merges the results, so it can only honor keys a normalized issue carries — `resolved` and `priority` are
|
|
1120
|
+
// dropped from that surface for the same reason they are dropped from GitLab's.
|
|
1121
|
+
supportedIssueSorts: azureIssueSorts,
|
|
1122
|
+
supportedAccountWideIssueSorts: azureAccountWideIssueSorts,
|
|
985
1123
|
scopes: ['vso.code', 'vso.identity', 'vso.project', 'vso.profile', 'vso.work'],
|
|
986
1124
|
},
|
|
987
1125
|
[IssuesCloudHostIntegrationId.Jira]: {
|
|
@@ -1027,6 +1165,9 @@ export const providersMetadata: ProvidersMetadata = {
|
|
|
1027
1165
|
'read:project-version:jira',
|
|
1028
1166
|
],
|
|
1029
1167
|
supportedIssueFilters: [IssueFilter.Author, IssueFilter.Assignee, IssueFilter.Mention],
|
|
1168
|
+
// A tracker's issues live under resource -> project, so it has no account-wide surface to declare: its
|
|
1169
|
+
// capability is reported under `issues`, which is what `listIssueTrackerIssuesPage` validates against.
|
|
1170
|
+
supportedIssueSorts: jiraIssueSorts,
|
|
1030
1171
|
},
|
|
1031
1172
|
[IssuesCloudHostIntegrationId.Linear]: {
|
|
1032
1173
|
domain: 'linear.app',
|
|
@@ -1037,6 +1178,9 @@ export const providersMetadata: ProvidersMetadata = {
|
|
|
1037
1178
|
scopes: [],
|
|
1038
1179
|
// Linear scopes "my issues" client-side by the viewer's assignee id; author/mention aren't supported.
|
|
1039
1180
|
supportedIssueFilters: [IssueFilter.Assignee],
|
|
1181
|
+
// Both directions, and one table for both reads: they are the same root `issues` query taking the same
|
|
1182
|
+
// `sort` argument, so there is no account-wide narrowing to declare.
|
|
1183
|
+
supportedIssueSorts: linearIssueSorts,
|
|
1040
1184
|
},
|
|
1041
1185
|
[IssuesCloudHostIntegrationId.Trello]: {
|
|
1042
1186
|
domain: 'trello.com',
|
|
@@ -1047,6 +1191,8 @@ export const providersMetadata: ProvidersMetadata = {
|
|
|
1047
1191
|
scopes: [],
|
|
1048
1192
|
// Trello cards are filtered by the assignee (member) only; author/mention have no Trello equivalent.
|
|
1049
1193
|
supportedIssueFilters: [IssueFilter.Assignee],
|
|
1194
|
+
// `sort:edited` / `sort:-edited`. Trello's other search sorts (`created`, `due`) have no card-order effect.
|
|
1195
|
+
supportedIssueSorts: trelloIssueSorts,
|
|
1050
1196
|
},
|
|
1051
1197
|
};
|
|
1052
1198
|
|
|
@@ -1203,22 +1349,6 @@ export const fromProviderBuildStatusState = {
|
|
|
1203
1349
|
[GitBuildStatusState.Warning]: undefined,
|
|
1204
1350
|
};
|
|
1205
1351
|
|
|
1206
|
-
export const toProviderPullRequestReviewState = {
|
|
1207
|
-
[PullRequestReviewState.Approved]: GitPullRequestReviewState.Approved,
|
|
1208
|
-
[PullRequestReviewState.ChangesRequested]: GitPullRequestReviewState.ChangesRequested,
|
|
1209
|
-
[PullRequestReviewState.Commented]: GitPullRequestReviewState.Commented,
|
|
1210
|
-
[PullRequestReviewState.ReviewRequested]: GitPullRequestReviewState.ReviewRequested,
|
|
1211
|
-
[PullRequestReviewState.Dismissed]: null,
|
|
1212
|
-
[PullRequestReviewState.Pending]: null,
|
|
1213
|
-
};
|
|
1214
|
-
|
|
1215
|
-
export const fromProviderPullRequestReviewState = {
|
|
1216
|
-
[GitPullRequestReviewState.Approved]: PullRequestReviewState.Approved,
|
|
1217
|
-
[GitPullRequestReviewState.ChangesRequested]: PullRequestReviewState.ChangesRequested,
|
|
1218
|
-
[GitPullRequestReviewState.Commented]: PullRequestReviewState.Commented,
|
|
1219
|
-
[GitPullRequestReviewState.ReviewRequested]: PullRequestReviewState.ReviewRequested,
|
|
1220
|
-
};
|
|
1221
|
-
|
|
1222
1352
|
export const toProviderPullRequestMergeableState = {
|
|
1223
1353
|
[PullRequestMergeableState.Mergeable]: GitPullRequestMergeableState.Mergeable,
|
|
1224
1354
|
[PullRequestMergeableState.Conflicting]: GitPullRequestMergeableState.Conflicts,
|
|
@@ -1238,68 +1368,6 @@ export const fromProviderPullRequestMergeableState = {
|
|
|
1238
1368
|
[GitPullRequestMergeableState.Unstable]: PullRequestMergeableState.Unknown,
|
|
1239
1369
|
};
|
|
1240
1370
|
|
|
1241
|
-
export function toProviderReviews(reviewers: PullRequestReviewer[]): ProviderPullRequest['reviews'] {
|
|
1242
|
-
return reviewers
|
|
1243
|
-
.filter(r => r.state !== PullRequestReviewState.Dismissed && r.state !== PullRequestReviewState.Pending)
|
|
1244
|
-
.map(reviewer => ({
|
|
1245
|
-
reviewer: toProviderAccount(reviewer.reviewer),
|
|
1246
|
-
state: toProviderPullRequestReviewState[reviewer.state] ?? GitPullRequestReviewState.ReviewRequested,
|
|
1247
|
-
}));
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
export function toReviewRequests(reviews: ProviderPullRequest['reviews']): PullRequestReviewer[] | undefined {
|
|
1251
|
-
return reviews == null
|
|
1252
|
-
? undefined
|
|
1253
|
-
: reviews
|
|
1254
|
-
?.filter(r => r.state === GitPullRequestReviewState.ReviewRequested)
|
|
1255
|
-
.map(r => ({
|
|
1256
|
-
isCodeOwner: false, // TODO: Find this value, and implement in the shared lib if needed
|
|
1257
|
-
reviewer: fromProviderAccount(r.reviewer),
|
|
1258
|
-
state: PullRequestReviewState.ReviewRequested,
|
|
1259
|
-
}));
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
export function toCompletedReviews(reviews: ProviderPullRequest['reviews']): PullRequestReviewer[] | undefined {
|
|
1263
|
-
return reviews == null
|
|
1264
|
-
? undefined
|
|
1265
|
-
: reviews
|
|
1266
|
-
?.filter(r => r.state !== GitPullRequestReviewState.ReviewRequested)
|
|
1267
|
-
.map(r => ({
|
|
1268
|
-
isCodeOwner: false, // TODO: Find this value, and implement in the shared lib if needed
|
|
1269
|
-
reviewer: fromProviderAccount(r.reviewer),
|
|
1270
|
-
state: fromProviderPullRequestReviewState[r.state],
|
|
1271
|
-
}));
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
export function toProviderReviewDecision(
|
|
1275
|
-
reviewDecision?: PullRequestReviewDecision,
|
|
1276
|
-
reviewers?: PullRequestReviewer[],
|
|
1277
|
-
): GitPullRequestReviewState | null {
|
|
1278
|
-
switch (reviewDecision) {
|
|
1279
|
-
case PullRequestReviewDecision.Approved:
|
|
1280
|
-
return GitPullRequestReviewState.Approved;
|
|
1281
|
-
case PullRequestReviewDecision.ChangesRequested:
|
|
1282
|
-
return GitPullRequestReviewState.ChangesRequested;
|
|
1283
|
-
case PullRequestReviewDecision.ReviewRequired:
|
|
1284
|
-
return GitPullRequestReviewState.ReviewRequested;
|
|
1285
|
-
default: {
|
|
1286
|
-
if (reviewers?.some(r => r.state === PullRequestReviewState.ReviewRequested)) {
|
|
1287
|
-
return GitPullRequestReviewState.ReviewRequested;
|
|
1288
|
-
} else if (reviewers?.some(r => r.state === PullRequestReviewState.Commented)) {
|
|
1289
|
-
return GitPullRequestReviewState.Commented;
|
|
1290
|
-
}
|
|
1291
|
-
return null;
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
export const fromPullRequestReviewDecision = {
|
|
1297
|
-
[GitPullRequestReviewState.Approved]: PullRequestReviewDecision.Approved,
|
|
1298
|
-
[GitPullRequestReviewState.ChangesRequested]: PullRequestReviewDecision.ChangesRequested,
|
|
1299
|
-
[GitPullRequestReviewState.Commented]: undefined,
|
|
1300
|
-
[GitPullRequestReviewState.ReviewRequested]: PullRequestReviewDecision.ReviewRequired,
|
|
1301
|
-
};
|
|
1302
|
-
|
|
1303
1371
|
export function toProviderPullRequestState(state: PullRequestState): GitPullRequestState {
|
|
1304
1372
|
return state === 'opened'
|
|
1305
1373
|
? GitPullRequestState.Open
|
|
@@ -1424,7 +1492,11 @@ export function toProviderPullRequest(pr: PullRequest): ProviderPullRequest {
|
|
|
1424
1492
|
name: pr.refs.head.branch,
|
|
1425
1493
|
oid: pr.refs.head.sha,
|
|
1426
1494
|
},
|
|
1427
|
-
|
|
1495
|
+
// `null` when the source carried no review data at all, rather than the empty array a lite read would
|
|
1496
|
+
// otherwise produce: `toCompletedReviews`/`toReviewRequests` map `null` back to `undefined`, which is what
|
|
1497
|
+
// lets a consumer tell "nobody has reviewed this" from "this read never fetched reviews" (see
|
|
1498
|
+
// `PullRequestShape.latestReviews`). An empty array from a full projection stays an empty array.
|
|
1499
|
+
reviews: pr.reviewRequests == null && pr.latestReviews == null ? null : toProviderReviews(prReviews),
|
|
1428
1500
|
reviewDecision: toProviderReviewDecision(pr.reviewDecision, prReviews),
|
|
1429
1501
|
repository:
|
|
1430
1502
|
pr.repository != null
|
|
@@ -1623,46 +1695,31 @@ export function fromProviderIssue(
|
|
|
1623
1695
|
}
|
|
1624
1696
|
|
|
1625
1697
|
export function toProviderPullRequestWithUniqueId(pr: PullRequest): PullRequestWithUniqueID {
|
|
1698
|
+
const { reviews, ...providerPr } = toProviderPullRequest(pr);
|
|
1626
1699
|
return {
|
|
1627
|
-
...
|
|
1700
|
+
...providerPr,
|
|
1701
|
+
// The SDK boundary: `getActionablePullRequests` categorizes by review state and only knows
|
|
1702
|
+
// provider-apis' own vocabulary, so the locally-added dismissed state is dropped here rather than
|
|
1703
|
+
// handed over as a value it would fall through on. Our own projection keeps it — see
|
|
1704
|
+
// `providerPullRequestReviewStateDismissed`. `commitOid` rides along on the surviving reviews: it is an
|
|
1705
|
+
// extra property the SDK ignores, not a value it could misread.
|
|
1706
|
+
reviews:
|
|
1707
|
+
reviews?.filter(
|
|
1708
|
+
(r): r is ProviderPullRequestReview & { state: GitPullRequestReviewState } =>
|
|
1709
|
+
r.state !== providerPullRequestReviewStateDismissed,
|
|
1710
|
+
) ?? null,
|
|
1628
1711
|
uuid: EntityIdentifierUtils.encode(getEntityIdentifierInput(pr)),
|
|
1629
1712
|
};
|
|
1630
1713
|
}
|
|
1631
1714
|
|
|
1632
|
-
export function toProviderAccount(account: PullRequestMember | IssueMember): ProviderAccount {
|
|
1633
|
-
return {
|
|
1634
|
-
id: account.id ?? null,
|
|
1635
|
-
avatarUrl: account.avatarUrl ?? null,
|
|
1636
|
-
name: account.name ?? null,
|
|
1637
|
-
url: account.url ?? null,
|
|
1638
|
-
// TODO: Implement these in our own model
|
|
1639
|
-
email: '',
|
|
1640
|
-
username: account.name ?? null,
|
|
1641
|
-
};
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
export function fromProviderAccount(account: ProviderAccount | null): PullRequestMember | IssueMember {
|
|
1645
|
-
return {
|
|
1646
|
-
id: account?.id ?? '',
|
|
1647
|
-
// An absent name stays absent. `'unknown'` was a display fallback invented in the provider layer, and a
|
|
1648
|
-
// consumer couldn't tell it apart from a member genuinely named that — so it couldn't be undone where a
|
|
1649
|
-
// name-shaped placeholder is wrong (rendering an avatar-only chip, or building an AI prompt, where
|
|
1650
|
-
// `Assignees: unknown` reads as a real assignee). It also disagreed with {@link toIssueShape}, which
|
|
1651
|
-
// collapsed the same absent name to `''` — same facade method, two fallbacks. Both now emit `undefined`.
|
|
1652
|
-
name: account?.name ?? undefined,
|
|
1653
|
-
avatarUrl: account?.avatarUrl ?? undefined,
|
|
1654
|
-
// `url` is optional, so an absent one must be `undefined`, not `''`. `''` passes a `!= null` presence
|
|
1655
|
-
// check and renders as a link to nowhere, and it disagreed with {@link toIssueShape} — which already
|
|
1656
|
-
// collapses to `undefined` — even though BOTH mappers feed `listIssuesPage` (the repo-scoped path goes
|
|
1657
|
-
// through `toIssueShape`, Azure's account-wide path through {@link fromProviderIssue}). Same facade
|
|
1658
|
-
// method, two shapes. Matches {@link toProviderRepositoryShape}, which collapses every absent optional.
|
|
1659
|
-
url: account?.url ?? undefined,
|
|
1660
|
-
};
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
1715
|
export type ProviderActionablePullRequest = ActionablePullRequest;
|
|
1664
1716
|
|
|
1665
|
-
|
|
1717
|
+
/**
|
|
1718
|
+
* Built on the SDK's `GitPullRequest`, NOT the local {@link ProviderPullRequest} widening: this is handed to
|
|
1719
|
+
* `getActionablePullRequests`, which categorizes by review state and only knows provider-apis' vocabulary.
|
|
1720
|
+
* {@link toProviderPullRequestWithUniqueId} is what narrows `reviews` down to it.
|
|
1721
|
+
*/
|
|
1722
|
+
export type EnrichablePullRequest = GitPullRequest & {
|
|
1666
1723
|
uuid: string;
|
|
1667
1724
|
type: 'pullrequest';
|
|
1668
1725
|
provider: ProviderReference;
|
|
@@ -39,6 +39,7 @@ import type {
|
|
|
39
39
|
GetPullRequestsOptions,
|
|
40
40
|
GetReposOptions,
|
|
41
41
|
IssueFilter,
|
|
42
|
+
IssueSorting,
|
|
42
43
|
PageInfo,
|
|
43
44
|
PagingInput,
|
|
44
45
|
PagingMode,
|
|
@@ -67,7 +68,7 @@ import type {
|
|
|
67
68
|
Providers,
|
|
68
69
|
PullRequestFilter,
|
|
69
70
|
} from './models.js';
|
|
70
|
-
import { providersMetadata } from './models.js';
|
|
71
|
+
import { isRepoIdsInput, providersMetadata } from './models.js';
|
|
71
72
|
import {
|
|
72
73
|
collectProviderPagedResult,
|
|
73
74
|
mergeCollectionMetadata,
|
|
@@ -132,6 +133,14 @@ function isGraphQLRepoNotFoundError(ex: unknown): boolean {
|
|
|
132
133
|
|
|
133
134
|
const trelloBaseUrl = 'https://api.trello.com';
|
|
134
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Jira computes an issue's available transitions per issue, from the workflow and the reader's permissions, so a
|
|
138
|
+
* list read at a page size of 100 pays for 100 of those in both server work and response payload. Nothing in this
|
|
139
|
+
* package reads `statusTransitions` off a list — only the singular `getIssue` path exposes them, and it always
|
|
140
|
+
* expands them — so every list read opts out. Revisit the day a list row offers a status change straight off it.
|
|
141
|
+
*/
|
|
142
|
+
const jiraListIncludeTransitions = false;
|
|
143
|
+
|
|
135
144
|
type TrelloMemberResponse = {
|
|
136
145
|
id: string;
|
|
137
146
|
username?: string | null;
|
|
@@ -479,12 +488,9 @@ export class ProvidersApi {
|
|
|
479
488
|
);
|
|
480
489
|
}
|
|
481
490
|
|
|
482
|
-
isRepoIdsInput
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
Array.isArray(input) &&
|
|
486
|
-
input.every((id: any) => typeof id === 'string' || typeof id === 'number')
|
|
487
|
-
);
|
|
491
|
+
/** See {@link isRepoIdsInput}, which owns the rule; kept as a method because callers reach it through the api. */
|
|
492
|
+
isRepoIdsInput(input: unknown): input is (string | number)[] {
|
|
493
|
+
return isRepoIdsInput(input);
|
|
488
494
|
}
|
|
489
495
|
|
|
490
496
|
private async getProviderToken<T extends IntegrationIds>(
|
|
@@ -868,7 +874,10 @@ export class ProvidersApi {
|
|
|
868
874
|
async getLinearIssues(
|
|
869
875
|
tokenOptInfo: TokenWithInfo<IssuesCloudHostIntegrationId.Linear>,
|
|
870
876
|
input: { teams?: string[]; projects?: string[]; labels?: string[] },
|
|
871
|
-
options?: PagingInput
|
|
877
|
+
options?: PagingInput & {
|
|
878
|
+
/** See {@link GetIssuesOptions.sort}. Linear expresses `created`/`updated`, descending only. */
|
|
879
|
+
sort?: IssueSorting;
|
|
880
|
+
},
|
|
872
881
|
): Promise<PagedResult<ProviderIssue>> {
|
|
873
882
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
874
883
|
tokenOptInfo,
|
|
@@ -1565,6 +1574,8 @@ export class ProvidersApi {
|
|
|
1565
1574
|
*/
|
|
1566
1575
|
authorUsername?: string;
|
|
1567
1576
|
pageSize?: number;
|
|
1577
|
+
/** See {@link GetIssuesOptions.sort}. Forwarded to the provider fn; ordering is translated in the SDK. */
|
|
1578
|
+
sort?: IssueSorting;
|
|
1568
1579
|
isPAT?: boolean;
|
|
1569
1580
|
baseUrl?: string;
|
|
1570
1581
|
},
|
|
@@ -1580,6 +1591,7 @@ export class ProvidersApi {
|
|
|
1580
1591
|
authorUsername: options?.authorUsername,
|
|
1581
1592
|
page: options?.page,
|
|
1582
1593
|
pageSize: options?.pageSize,
|
|
1594
|
+
sort: options?.sort,
|
|
1583
1595
|
},
|
|
1584
1596
|
provider.getIssuesForCurrentUserFn,
|
|
1585
1597
|
tokenWithInfo,
|
|
@@ -1626,7 +1638,12 @@ export class ProvidersApi {
|
|
|
1626
1638
|
|
|
1627
1639
|
try {
|
|
1628
1640
|
const result = await provider.getIssuesForProjectFn?.(
|
|
1629
|
-
{
|
|
1641
|
+
{
|
|
1642
|
+
projectKey: project,
|
|
1643
|
+
resourceId: resourceId,
|
|
1644
|
+
...options,
|
|
1645
|
+
includeTransitions: jiraListIncludeTransitions,
|
|
1646
|
+
},
|
|
1630
1647
|
{ token: token },
|
|
1631
1648
|
);
|
|
1632
1649
|
|
|
@@ -1655,7 +1672,12 @@ export class ProvidersApi {
|
|
|
1655
1672
|
|
|
1656
1673
|
try {
|
|
1657
1674
|
const result = await provider.getIssuesForProjectFn?.(
|
|
1658
|
-
{
|
|
1675
|
+
{
|
|
1676
|
+
projectKey: project,
|
|
1677
|
+
resourceId: resourceId,
|
|
1678
|
+
...options,
|
|
1679
|
+
includeTransitions: jiraListIncludeTransitions,
|
|
1680
|
+
},
|
|
1659
1681
|
{ token: token },
|
|
1660
1682
|
);
|
|
1661
1683
|
if (result == null) return undefined;
|
|
@@ -1760,7 +1782,12 @@ export class ProvidersApi {
|
|
|
1760
1782
|
tokenOptInfo: TokenWithInfo,
|
|
1761
1783
|
appKey: string,
|
|
1762
1784
|
boardId: string,
|
|
1763
|
-
options?: {
|
|
1785
|
+
options?: {
|
|
1786
|
+
assigneeLogins?: string[];
|
|
1787
|
+
trelloBoardListsById?: Record<string, { name: string }>;
|
|
1788
|
+
/** See {@link GetIssuesOptions.sort}. Trello expresses only `updated`, in either direction. */
|
|
1789
|
+
sort?: IssueSorting;
|
|
1790
|
+
},
|
|
1764
1791
|
): Promise<ProviderApiCollectionResult<ProviderIssue>> {
|
|
1765
1792
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1766
1793
|
tokenOptInfo,
|
|
@@ -1782,7 +1809,18 @@ export class ProvidersApi {
|
|
|
1782
1809
|
async getIssuesForResourceForCurrentUser(
|
|
1783
1810
|
tokenOptInfo: TokenWithInfo,
|
|
1784
1811
|
resourceId: string,
|
|
1785
|
-
options?: {
|
|
1812
|
+
options?: {
|
|
1813
|
+
cursor?: string;
|
|
1814
|
+
/**
|
|
1815
|
+
* See {@link GetIssuesOptions.sort}. Forwarded for the same reason as every sibling issue read, even
|
|
1816
|
+
* though nothing reaches this one with a sort today: `IssuesIntegration.searchProviderMyIssues` is the
|
|
1817
|
+
* only caller and takes no options. A wrapper that accepted the SDK's input and silently dropped one
|
|
1818
|
+
* field of it would give whoever adds that option no ordering and no error.
|
|
1819
|
+
*/
|
|
1820
|
+
sort?: IssueSorting;
|
|
1821
|
+
isPAT?: boolean;
|
|
1822
|
+
baseUrl?: string;
|
|
1823
|
+
},
|
|
1786
1824
|
): Promise<PagedResult<ProviderIssue>> {
|
|
1787
1825
|
const { provider, tokenWithInfo } = await this.ensureProviderTokenAndFunction(
|
|
1788
1826
|
tokenOptInfo,
|
|
@@ -1790,7 +1828,7 @@ export class ProvidersApi {
|
|
|
1790
1828
|
);
|
|
1791
1829
|
|
|
1792
1830
|
return this.getPagedResult<ProviderIssue>(
|
|
1793
|
-
{ resourceId: resourceId },
|
|
1831
|
+
{ resourceId: resourceId, sort: options?.sort, includeTransitions: jiraListIncludeTransitions },
|
|
1794
1832
|
provider.getIssuesForResourceForCurrentUserFn,
|
|
1795
1833
|
tokenWithInfo,
|
|
1796
1834
|
options?.cursor,
|