@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,3 +1,5 @@
|
|
|
1
|
+
import type { IssueSorting } from '../../git/models/issue.js';
|
|
2
|
+
import type { PullRequestSorting } from '../../git/models/pullRequest.js';
|
|
1
3
|
import type { IntegrationIds } from './constants.js';
|
|
2
4
|
export interface ConnectionStateChangeEvent {
|
|
3
5
|
key: string;
|
|
@@ -70,6 +72,19 @@ export interface ProviderWarningOmission {
|
|
|
70
72
|
limit?: number;
|
|
71
73
|
/** Total matches the provider reported, when it reports one. Only GitHub's search cap does today. */
|
|
72
74
|
totalCount?: number;
|
|
75
|
+
/**
|
|
76
|
+
* The order the reachable window was selected under, as `field:direction`, when the omission is a result
|
|
77
|
+
* ceiling.
|
|
78
|
+
*
|
|
79
|
+
* Present so a consumer can word its own "N matched, showing the first M" without assuming WHICH M: the
|
|
80
|
+
* provider serves the top M under this key, so the sentence is only true if it names it. Absent for every
|
|
81
|
+
* omission that isn't a ceiling, where no window was selected by an order.
|
|
82
|
+
*
|
|
83
|
+
* A union of both vocabularies rather than the issue one alone: `PullRequestSorting` happens to be a subset
|
|
84
|
+
* today, so narrowing this to {@link IssueSorting} would still compile while describing only half the reads
|
|
85
|
+
* that set it — and would break the day the PR search gains a key the issue search has no name for.
|
|
86
|
+
*/
|
|
87
|
+
sort?: IssueSorting | PullRequestSorting;
|
|
73
88
|
/** Which repository / project / resource was affected, when one is attributed. */
|
|
74
89
|
scope?: ProviderWarningOmissionScope;
|
|
75
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../src/plus/integrations/results.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,WAAW,0BAA0B;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,cAAc,CAAC;CACrC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,eAAe,GAAG,OAAO,CAAC;AAElG;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,2BAA2B,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,uBAAuB,CAAC;AAEzG;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,+BAA+B,GAAG,MAAM,GAAG,aAAa,CAAC;AAErE,sHAAsH;AACtH,MAAM,WAAW,4BAA4B;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACvC,IAAI,EAAE,2BAA2B,CAAC;IAClC;;;OAGG;IACH,QAAQ,EAAE,+BAA+B,CAAC;IAC1C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qGAAqG;IACrG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kFAAkF;IAClF,KAAK,CAAC,EAAE,4BAA4B,CAAC;CACrC;AAED,MAAM,W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,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE,WAAW,EAAE,OAAO,GAAG,IAAI,CAerG;AAmBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,CAK5F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"results.js","sourceRoot":"","sources":["../../../src/plus/integrations/results.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"results.js","sourceRoot":"","sources":["../../../src/plus/integrations/results.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAsR1G,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAE5C,SAAS,sBAAsB,CAAC,EAAW;IAC1C,MAAM,GAAG,GAAG,CAAC,EAAE,YAAY,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACnE,MAAM,OAAO,GAAG,EAA8E,CAAC;IAC/F,MAAM,MAAM,GACX,OAAO,OAAO,EAAE,MAAM,KAAK,QAAQ;QAClC,CAAC,CAAC,OAAO,CAAC,MAAM;QAChB,CAAC,CAAC,OAAO,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,QAAQ;YAC9C,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM;YACzB,CAAC,CAAC,SAAS,CAAC;IAEf,4GAA4G;IAC5G,6GAA6G;IAC7G,IAAI,wCAAwC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACxD,OAAO,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,uCAAuC,MAAM,GAAG,CAA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AC,IAAI;QACZ,0BAA0B,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC5C,OAAO,CAAC,OAAO;KACf,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAuB,EAAE,OAAwB;IACrF,MAAM,GAAG,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC;QAAE,OAAO;IAExE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACpB,CAAC"}
|
package/docs/integrations.md
CHANGED
|
@@ -120,6 +120,7 @@ it with `page` + `hasMore` + `cursor?`. **No read throws for a provider-side fai
|
|
|
120
120
|
| `listRepos` | `ProviderRepositoryShape` | Repos of an `org`, or account-wide user-affiliated repos when `org` is omitted. |
|
|
121
121
|
| `listPullRequestsPage` | `PullRequestShape` | With `repos`: those repos' PRs. Without: the user's PRs account-wide. |
|
|
122
122
|
| `searchPullRequestsPage` | `PullRequestShape` | PRs involving the user that match structured criteria, optionally repo/org-scoped. |
|
|
123
|
+
| `countPullRequests` | `PullRequestCountResult` | How many PRs match each scope, fetching none of them. See §5.1. |
|
|
123
124
|
| `listIssuesPage` | `IssueShape` | Same split, for a **git host**'s issues. |
|
|
124
125
|
| `searchIssuesPage` | `IssueShape` | Issues matching structured criteria over a repo/org scope — **no** `@me` binding. |
|
|
125
126
|
| `countIssues` | `IssueCountResult` | How many match each scope, fetching none of them. See §5.1. |
|
|
@@ -280,6 +281,23 @@ const counts = await manager.countIssues({
|
|
|
280
281
|
double-count overlaps) nor max (it would under-report), so such a scope is refused. Give each relationship
|
|
281
282
|
its own `key`.
|
|
282
283
|
|
|
284
|
+
**`countPullRequests`** is the PR twin of `countIssues` — same `key`-echo contract, per-scope/per-batch
|
|
285
|
+
isolation, `count: undefined` ≠ zero rule, `exceedsProviderLimit`, and one-relationship-per-scope refusal. It
|
|
286
|
+
takes the same `criteria` as `searchPullRequestsPage` and is validated against the same capability table.
|
|
287
|
+
|
|
288
|
+
```ts
|
|
289
|
+
const counts = await manager.countPullRequests({
|
|
290
|
+
providerId: providerId,
|
|
291
|
+
scopes: [{ key: 'mine-open', repos: repos, criteria: { relationships: [PullRequestFilter.Author] } }],
|
|
292
|
+
});
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
The one difference is inherent to pull requests: a scope's `states` (open/closed/merged) are counted as
|
|
296
|
+
independent searches, so the reported `count` is the **largest** of them — the same total
|
|
297
|
+
`searchPullRequestsPage` surfaces — not their sum. Because the result ceiling applies per search, that max is
|
|
298
|
+
what `exceedsProviderLimit` compares against. Several states in one scope are therefore fine (they are
|
|
299
|
+
disjoint); only several relationships are refused.
|
|
300
|
+
|
|
283
301
|
## 6. Failures: warnings, `fetchFailed`, `truncated`
|
|
284
302
|
|
|
285
303
|
A per-provider (or per-connection, or per-scope) failure degrades to a **warning attached to a partial
|
|
@@ -400,15 +418,21 @@ So intersect against the capability table first:
|
|
|
400
418
|
|
|
401
419
|
```ts
|
|
402
420
|
const supported = manager.getSupportedFilters(providerId); // static, no connection needed
|
|
403
|
-
const capability = repos.length === 0 ?
|
|
421
|
+
const capability = repos.length === 0 ? supported.pullRequestsAccountWide : supported.pullRequests;
|
|
404
422
|
const filters = wanted.filter(f => capability.includes(f));
|
|
405
423
|
```
|
|
406
424
|
|
|
407
425
|
- `pullRequests` — the repo-scoped PR read.
|
|
408
|
-
- `pullRequestsAccountWide` — the
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
426
|
+
- `pullRequestsAccountWide` — the account-wide PR capability. Always reported, empty at worst. Usually
|
|
427
|
+
the narrower of the two, but **not** a subset of `pullRequests`: `Reviewed` (GitHub `reviewed-by:@me`) is
|
|
428
|
+
account-wide only, because the repo-scoped read has no reviewed-by axis to constrain. So pick the field by
|
|
429
|
+
the read you are about to issue rather than intersecting the two.
|
|
430
|
+
- `pullRequestSearch` — the filtered PR search (`searchPullRequestsPage`, and `countPullRequests` over the same
|
|
431
|
+
criteria). Always present; empty `relationships` means the provider has no such search. It declares the exact
|
|
432
|
+
`relationships` and `states`, plus `text`, `updatedAfter`, `createdAfter`, `includeArchived`, `draft`,
|
|
433
|
+
`repositoryScope`, `organizationScope`, and `sorts` — the ordering vocabulary, as `field:direction` keys. A key
|
|
434
|
+
not in `sorts` refuses the whole read, exactly like an inexpressible filter; `updated:desc` is always in it when
|
|
435
|
+
the search exists at all, so omitting `criteria.sort` never refuses.
|
|
412
436
|
- `issues` — the **repo-scoped** git-host read, **and** the issue-tracker read
|
|
413
437
|
(`listIssueTrackerIssuesPage` validates against this field).
|
|
414
438
|
- `issuesAccountWide` — the account-wide git-host read only. Usually narrower (GitLab can express
|
|
@@ -441,6 +465,11 @@ does the opposite (drops the user scope); passing both on that account-wide read
|
|
|
441
465
|
them, so requesting both is refused. Note that "all visible issues" is the **omitted** relationship set, not
|
|
442
466
|
`any-assignee` — which excludes unassigned issues.
|
|
443
467
|
|
|
468
|
+
`ReviewRequested` and `Reviewed` are different questions: the first is a request still waiting on you, the
|
|
469
|
+
second is a PR you have already reviewed (so it is waiting on the author). A "needs my review" surface wants
|
|
470
|
+
both, as separate reads. The review row itself rides along only where the full projection does — the
|
|
471
|
+
filtered search, or a sweep with `includeReviews` — not from `Reviewed` on its own.
|
|
472
|
+
|
|
444
473
|
`includeReviewRequested` is a legacy account-wide breadth option used only when no explicit `filters` are
|
|
445
474
|
supplied. It remains useful for Bitbucket Cloud, where the reviewer slice requires an expensive
|
|
446
475
|
O(workspaces × repos) fan-out; prefer `filters: [ReviewRequested]` when an exact relationship is required.
|
|
@@ -448,6 +477,34 @@ O(workspaces × repos) fan-out; prefer `filters: [ReviewRequested]` when an exac
|
|
|
448
477
|
Aggregate account-wide PR reads use a lightweight list shape. Stable list fields, body, and branch refs are
|
|
449
478
|
preserved; optional enrichments such as reviews, checks, and stats may be absent.
|
|
450
479
|
|
|
480
|
+
`includeReviews: true` on an account-wide **sweep** opts back into the full projection (review decision,
|
|
481
|
+
review requests, and `latestReviews` — each with the `commitOid` it was submitted against, so a consumer can
|
|
482
|
+
tell a review still at the tip from one the PR has moved past). GitHub/GHE only: no other provider's
|
|
483
|
+
account-wide read has a projection switch, so those targets return their native shape and the option is a
|
|
484
|
+
breadth request rather than a guarantee — it never refuses. It costs a heavier GraphQL selection, so the read
|
|
485
|
+
drops to the reduced 30-node page and pages for the rest; budget `maxPages` accordingly. That cost is per
|
|
486
|
+
**sweep**, not per relationship: every state × relationship facet uses the heavy selection and each facet is
|
|
487
|
+
its own request per page, and the selection dominates the smaller page. So ask for it on a narrow sweep — the
|
|
488
|
+
relationships that need the review, typically `Reviewed` (plus `ReviewRequested` when the reviewed commit of a
|
|
489
|
+
pending request matters) — and read the rest as a separate lightweight sweep.
|
|
490
|
+
|
|
491
|
+
It does not change WHICH pull requests come back: every GitHub account-wide read takes the same route
|
|
492
|
+
regardless of the option (the Launchpad ignored-repository and included/ignored-organization qualifiers apply
|
|
493
|
+
either way), so the option is purely projection plus its page cost. What it does scale with is the relationship
|
|
494
|
+
count, since one document holds every facet: five relationships × four states is 20 full-projection selections.
|
|
495
|
+
|
|
496
|
+
`listPullRequestsPage` has no projection switch. Scoped to `repos` it goes through the provider's repo-scoped
|
|
497
|
+
read, and GitHub's carries `latestReviews` natively; account-wide (no `repos`) it is always the lite shape and
|
|
498
|
+
no option opts it back in. `commitOid` is absent from both: only the full projection populates it.
|
|
499
|
+
|
|
500
|
+
The paginated read that does carry the full projection is `searchPullRequestsPage` with
|
|
501
|
+
`criteria.relationships` (GitHub/GHE, which is also the only family that exposes a filtered PR search at all):
|
|
502
|
+
its results always include the review projection with `commitOid`, it honors `itemsPerPage`, and one threaded
|
|
503
|
+
cursor page is exactly one upstream request — every relationship × state facet travels in the same query,
|
|
504
|
+
unlike the account-wide read, which spends one request per facet per page. So a surface that pages
|
|
505
|
+
incrementally should ask the search read for `Reviewed` (and `ReviewRequested` as its own read) rather than
|
|
506
|
+
reach for `includeReviews`, which only exists on the all-at-once sweep.
|
|
507
|
+
|
|
451
508
|
## 8. Provider capability matrix
|
|
452
509
|
|
|
453
510
|
Derived from the provider models and `providersMetadata`. ✓ supported · ✗ reported unsupported
|
|
@@ -463,6 +520,7 @@ Derived from the provider models and `providersMetadata`. ✓ supported · ✗ r
|
|
|
463
520
|
| PRs, account-wide | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ |
|
|
464
521
|
| PR `states` account-wide | ✓ | ✓ | ✓ | ✓ | ✓ | — | — | — |
|
|
465
522
|
| `searchPullRequestsPage` | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
523
|
+
| `countPullRequests` | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
466
524
|
| Issues, repo-scoped | ✓ | ✓ | ✗ | ✗ | ✓ | — | — | — |
|
|
467
525
|
| Issues, account-wide | ✓ | ✓ | ✗ | ✗ | ✓ | — | — | — |
|
|
468
526
|
| `searchIssuesPage` | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
@@ -475,13 +533,21 @@ Derived from the provider models and `providersMetadata`. ✓ supported · ✗ r
|
|
|
475
533
|
Repo-scoped PR filters: GitHub/GHE `Author, Assignee, ReviewRequested, Mention` · GitLab `Author, Assignee,
|
|
476
534
|
ReviewRequested` · Bitbucket + Bitbucket DC `Author, ReviewRequested` · Azure `Author, Assignee,
|
|
477
535
|
ReviewRequested`.
|
|
478
|
-
Account-wide PR filters: GitHub/GHE `Author, Assignee, ReviewRequested, Mention` · GitLab
|
|
536
|
+
Account-wide PR filters: GitHub/GHE `Author, Assignee, ReviewRequested, Reviewed, Mention` · GitLab
|
|
479
537
|
`Author, Assignee, ReviewRequested` · Bitbucket + Bitbucket DC `Author, ReviewRequested` · Azure
|
|
480
|
-
`Author, Assignee, ReviewRequested`.
|
|
538
|
+
`Author, Assignee, ReviewRequested`. `Reviewed` is the one member that is account-wide only — no provider
|
|
539
|
+
exposes a reviewed-by axis on the repo-scoped read, so it is absent from the repo-scoped list above.
|
|
481
540
|
PR **search** capabilities (`getSupportedFilters().pullRequestSearch`): GitHub/GHE express relationships
|
|
482
|
-
`Author, Assignee, ReviewRequested, Mention`, states `open, closed, merged, all`, `text`, `
|
|
483
|
-
repository/organization scopes
|
|
484
|
-
|
|
541
|
+
`Author, Assignee, ReviewRequested, Reviewed, Mention`, states `open, closed, merged, all`, `text`, `updatedAfter`,
|
|
542
|
+
`createdAfter`, `includeArchived`, `draft`, repository/organization scopes, and sorts
|
|
543
|
+
`updated:desc|asc, created:desc|asc`. Every other provider declares empty lists and false flags, so the read is
|
|
544
|
+
refused rather than returning a page that did not apply a requested criterion or scope. `updatedAfter` /
|
|
545
|
+
`createdAfter` are ISO `YYYY-MM-DD` and are the most effective narrowing on a large scope — the way to bound a broad
|
|
546
|
+
closed-PR read, rather than capping page iterations. `draft` is tri-state: `true` returns only drafts, `false` only
|
|
547
|
+
ready-for-review PRs, and omitting it places no constraint — so a consumer sending `draft: false` must not treat it
|
|
548
|
+
as "unset". The sort vocabulary is narrower than the issue search's on purpose: a merged page can only be re-ordered
|
|
549
|
+
by a field a normalized pull request carries, and GitHub PRs have neither a priority nor a relevance that ranks
|
|
550
|
+
stably under the result ceiling.
|
|
485
551
|
Issue filters: GitHub/GHE + Azure + Jira `Author, Assignee, Mention` · GitLab `Author, Assignee` ·
|
|
486
552
|
Linear + Trello `Assignee` · Bitbucket family none.
|
|
487
553
|
Account-wide issue filters: GitHub/GHE `Author, Assignee, Mention` · Azure `Author, Assignee` · GitLab
|
|
@@ -159,6 +159,15 @@ refused there rather than serving an unnarrowed list — unimplemented, not impo
|
|
|
159
159
|
`author_username` compose with AND, so relationships must stay separate drains), and Azure to per-project WIQL.
|
|
160
160
|
`withoutLinkedPullRequest` and free text have no equivalent on either.
|
|
161
161
|
|
|
162
|
+
**`countPullRequests`** is the PR twin, closing the asymmetry the audit flagged: the PR side had
|
|
163
|
+
`searchPullRequestsPage` but no count probe, so an explicit "search everywhere" on PRs ran blind while the same
|
|
164
|
+
action on issues showed a number. It reuses GitHub's `issueCount`-on-a-zero-node `search` — the same primitive
|
|
165
|
+
`countIssues` uses — over `PullRequestSearchCriteria`, with the same `key`-echo, per-scope isolation, and
|
|
166
|
+
one-relationship-per-scope rules. The one PR-specific decision: a scope's `states` are counted as independent
|
|
167
|
+
searches, so the reported count is the **largest** of them (the total `searchPullRequestsPage` itself surfaces
|
|
168
|
+
via `Math.max` over facets), not their sum, and `exceedsProviderLimit` compares that max against the per-search
|
|
169
|
+
ceiling. GitHub/GHE only, matching `searchPullRequestsPage`.
|
|
170
|
+
|
|
162
171
|
**Not done, deliberately:** `broadenIssues` was left as-is rather than reimplemented on top of this. It is a
|
|
163
172
|
multi-provider, multi-org fan-out with its own result type and per-org cursor bundle, so only its inner
|
|
164
173
|
per-org read could be swapped; and its "all visible" breadth maps to an OMITTED relationship set, not to
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitkraken/core-gitlens",
|
|
3
3
|
"description": "GitLens core — shared Git / AI / GitHub primitives for internal GitKraken consumption",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.110",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "GitKraken",
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
}
|
|
221
221
|
},
|
|
222
222
|
"dependencies": {
|
|
223
|
-
"@gitkraken/provider-apis": "0.
|
|
223
|
+
"@gitkraken/provider-apis": "0.56.0",
|
|
224
224
|
"@octokit/graphql": "9.0.3",
|
|
225
225
|
"@octokit/request": "10.0.11",
|
|
226
226
|
"@octokit/request-error": "7.1.0",
|
package/src/git/models/issue.ts
CHANGED
|
@@ -25,6 +25,60 @@ export type IssueSearchRelationship =
|
|
|
25
25
|
/** Assigned to nobody. The complement of `any-assignee`, not a broadening of it. */
|
|
26
26
|
| 'unassigned';
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* A field an issue read can be ordered by, provider-neutral. No provider expresses all of them: each read
|
|
30
|
+
* validates the requested key against the capability its provider declares and refuses one it can't express
|
|
31
|
+
* server-side, rather than serving a differently-ordered list under the name of the one that was asked for.
|
|
32
|
+
*
|
|
33
|
+
* `closed` and `resolved` are deliberately SEPARATE, not two names for the same date. Azure DevOps tracks both
|
|
34
|
+
* and they differ (an issue can be closed without being resolved and resolved without being closed), and Jira
|
|
35
|
+
* has no close date at all — it models the equivalent as `resolutiondate`. Collapsing them would force one of
|
|
36
|
+
* those two providers to lie about which date it ordered by.
|
|
37
|
+
*/
|
|
38
|
+
export type IssueSortField =
|
|
39
|
+
/** Creation date. */
|
|
40
|
+
| 'created'
|
|
41
|
+
/** Last activity. */
|
|
42
|
+
| 'updated'
|
|
43
|
+
/** Close date. Only where the provider orders by it server-side — notably NOT GitHub. */
|
|
44
|
+
| 'closed'
|
|
45
|
+
/** Resolution date (Jira `resolutiondate`, Azure `ResolvedDate`). Distinct from `closed`. */
|
|
46
|
+
| 'resolved'
|
|
47
|
+
/** Number of comments. */
|
|
48
|
+
| 'comments'
|
|
49
|
+
/** Reactions/upvotes. */
|
|
50
|
+
| 'reactions'
|
|
51
|
+
/** The provider's own priority field. */
|
|
52
|
+
| 'priority'
|
|
53
|
+
/** Due date. */
|
|
54
|
+
| 'dueDate'
|
|
55
|
+
/** Alphabetical by title. */
|
|
56
|
+
| 'title';
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* How an issue read is ordered, as `field:direction` — the same shape `BranchSorting`/`TagSorting` already use,
|
|
60
|
+
* so it is one serializable string a consumer can persist, compare, or bind straight to a setting or a dropdown.
|
|
61
|
+
*/
|
|
62
|
+
export type IssueSorting = `${IssueSortField}:asc` | `${IssueSortField}:desc`;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The order every issue read that HAS a default applies when the caller asks for none: most recently updated
|
|
66
|
+
* first, which is what those reads served before ordering was an option.
|
|
67
|
+
*
|
|
68
|
+
* One definition rather than one per layer, because it is a promise made in several places at once — the criteria
|
|
69
|
+
* model documents it, the GitHub query emits it, and the result-ceiling warning quotes it — and three copies would
|
|
70
|
+
* be free to disagree about what "the default" is.
|
|
71
|
+
*
|
|
72
|
+
* Note it is not a default every read has, and the two layers differ. The API client's account-wide "my issues"
|
|
73
|
+
* search (`GitHubApi.searchMyIssues`) never requested an order, so a direct caller omitting `sort` still gets
|
|
74
|
+
* GitHub's relevance order — the default is opt-in there, to keep that read's already-shipped results unchanged.
|
|
75
|
+
* The FACADE does apply it: GitHub declares `updated:desc` among its account-wide keys, so
|
|
76
|
+
* `readAccountWideIssuesPage` resolves the omission to this default and forwards it, and that read's emitted query
|
|
77
|
+
* gained a `sort:updated` qualifier it did not have before. A read whose surface cannot express even this key is
|
|
78
|
+
* the only one the facade leaves in the provider's own order.
|
|
79
|
+
*/
|
|
80
|
+
export const defaultIssueSort: IssueSorting = 'updated:desc';
|
|
81
|
+
|
|
28
82
|
/**
|
|
29
83
|
* What a filtered issue search narrows on: a provider-neutral criteria set, translated to each provider's own
|
|
30
84
|
* query language by its integration.
|
|
@@ -67,6 +121,19 @@ export interface IssueSearchCriteria {
|
|
|
67
121
|
withoutLinkedPullRequest?: boolean;
|
|
68
122
|
/** Includes issues in archived repositories, which are excluded by default. */
|
|
69
123
|
includeArchived?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* How to order the results. Omitted means `updated:desc`, which is what this search has always served.
|
|
126
|
+
*
|
|
127
|
+
* Validated like every other criterion — all-or-nothing against {@link IssueSearchCapabilities.sorts}: a key
|
|
128
|
+
* the provider can't express server-side refuses the WHOLE read rather than falling back to the default.
|
|
129
|
+
* Serving another order is not a smaller error than serving a wider result: combined with the provider's
|
|
130
|
+
* result ceiling it returns a different subset than was asked for, and the paging that comes with it describes
|
|
131
|
+
* that other subset.
|
|
132
|
+
*
|
|
133
|
+
* Do not change it mid-pagination. A cursor carries the sort it was produced under, and threading it under a
|
|
134
|
+
* different key is refused rather than serving a sequence with gaps and repeats: drop the cursor instead.
|
|
135
|
+
*/
|
|
136
|
+
sort?: IssueSorting;
|
|
70
137
|
}
|
|
71
138
|
|
|
72
139
|
/**
|
|
@@ -86,6 +153,12 @@ export interface IssueSearchCapabilities {
|
|
|
86
153
|
withoutLinkedPullRequest: boolean;
|
|
87
154
|
/** Whether {@link IssueSearchCriteria.state} can select anything other than the provider's default (open). */
|
|
88
155
|
states: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Sort keys the search can express IN SERVER. Always contains at least `updated:desc` — the historical default
|
|
158
|
+
* — when the search exists at all, so it is never empty for a usable surface; a provider without a filtered
|
|
159
|
+
* search reports an empty `relationships`, which is already the signal that there is no surface to order.
|
|
160
|
+
*/
|
|
161
|
+
sorts: IssueSorting[];
|
|
89
162
|
}
|
|
90
163
|
|
|
91
164
|
export interface IssueShape extends IssueOrPullRequest {
|
|
@@ -26,6 +26,15 @@ export interface PullRequestShape extends IssueOrPullRequest {
|
|
|
26
26
|
readonly mergeableState?: PullRequestMergeableState;
|
|
27
27
|
readonly reviewDecision?: PullRequestReviewDecision;
|
|
28
28
|
readonly reviewRequests?: PullRequestReviewer[];
|
|
29
|
+
/**
|
|
30
|
+
* Reviews already submitted, as opposed to the still-pending {@link reviewRequests}. Absent means the read
|
|
31
|
+
* didn't fetch reviews; empty means nobody has reviewed. Those are different answers and neither substitutes
|
|
32
|
+
* for the other, so which one you get is provider- and read-dependent: GitHub/GHE carry reviews on the
|
|
33
|
+
* repo-scoped read and the filtered search, and on the account-wide read only where `includeReviews` opts
|
|
34
|
+
* into the full projection, while GitLab never populates the field at all.
|
|
35
|
+
* {@link PullRequestReviewer.commitOid} is the narrower promise: only the full GitHub/GHE projection has it.
|
|
36
|
+
*/
|
|
37
|
+
readonly latestReviews?: PullRequestReviewer[];
|
|
29
38
|
readonly assignees?: PullRequestMember[];
|
|
30
39
|
readonly project?: IssueProject;
|
|
31
40
|
readonly number?: number;
|
|
@@ -154,12 +163,50 @@ export enum PullRequestFilter {
|
|
|
154
163
|
Author = 'author',
|
|
155
164
|
Assignee = 'assignee',
|
|
156
165
|
ReviewRequested = 'review-requested',
|
|
166
|
+
/**
|
|
167
|
+
* PRs the user has already reviewed (GitHub `reviewed-by:@me`), as opposed to `ReviewRequested` (a
|
|
168
|
+
* still-pending request). Distinguishes "waiting on the author after my review" from "waiting for my
|
|
169
|
+
* review". Not expressible on the repo-scoped listing — no provider SDK exposes a reviewed-by axis there —
|
|
170
|
+
* so it is advertised for the account-wide read and for the filtered search (which can still bound itself
|
|
171
|
+
* to repositories or an org), never under `supportedPullRequestFilters`.
|
|
172
|
+
*/
|
|
173
|
+
Reviewed = 'reviewed-by',
|
|
157
174
|
Mention = 'mention',
|
|
158
175
|
}
|
|
159
176
|
|
|
160
177
|
/** Selects which pull request states a read should include. `all` covers open + closed + merged. */
|
|
161
178
|
export type PullRequestStateFilter = 'open' | 'closed' | 'merged' | 'all';
|
|
162
179
|
|
|
180
|
+
/**
|
|
181
|
+
* A field a pull-request read can be ordered by, provider-neutral.
|
|
182
|
+
*
|
|
183
|
+
* Only two, and deliberately so — unlike {@link IssueSortField} this is the INTERSECTION of what GitHub's PR
|
|
184
|
+
* search can order by server-side and what a {@link PullRequestShape} carries, because the filtered PR search
|
|
185
|
+
* always merges its relationship × state facets in the facade and so must re-order the union itself (see
|
|
186
|
+
* `getPullRequestComparator`). `created` and `updated` are both. A field GitHub cannot order PRs by, or one a
|
|
187
|
+
* merged page can't reproduce, is left out rather than advertised and then approximated: relevance is unstable
|
|
188
|
+
* and has no comparable value on a merge, and priority is not a pull-request concept on any provider that has PRs.
|
|
189
|
+
*/
|
|
190
|
+
export type PullRequestSortField =
|
|
191
|
+
/** Creation date. */
|
|
192
|
+
| 'created'
|
|
193
|
+
/** Last activity. */
|
|
194
|
+
| 'updated';
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* How a pull-request read is ordered, as `field:direction` — the same serializable shape {@link IssueSorting}
|
|
198
|
+
* and `BranchSorting` use, so a consumer can persist it, compare it, or bind it straight to a setting or dropdown.
|
|
199
|
+
*/
|
|
200
|
+
export type PullRequestSorting = `${PullRequestSortField}:asc` | `${PullRequestSortField}:desc`;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* The order the filtered pull-request search applies when the caller asks for none: most recently updated first,
|
|
204
|
+
* which is what it served before ordering was an option. Named once rather than per layer — the criteria model
|
|
205
|
+
* documents it, the GitHub query emits it, and the result-ceiling warning quotes it — so the three cannot
|
|
206
|
+
* disagree about what "the default" is.
|
|
207
|
+
*/
|
|
208
|
+
export const defaultPullRequestSort: PullRequestSorting = 'updated:desc';
|
|
209
|
+
|
|
163
210
|
/**
|
|
164
211
|
* What the filtered pull-request search narrows on.
|
|
165
212
|
*
|
|
@@ -181,8 +228,27 @@ export interface PullRequestSearchCriteria {
|
|
|
181
228
|
relationships?: PullRequestFilter[];
|
|
182
229
|
/** Pull request states to union. Empty/omitted reads open PRs; `all` subsumes every other member. */
|
|
183
230
|
states?: PullRequestStateFilter[];
|
|
231
|
+
/** ISO date (`YYYY-MM-DD`). The most effective narrowing criterion by far on a large scope. */
|
|
232
|
+
updatedAfter?: string;
|
|
233
|
+
/** ISO date (`YYYY-MM-DD`). */
|
|
234
|
+
createdAfter?: string;
|
|
184
235
|
/** Includes PRs from archived repositories. They are excluded by default. */
|
|
185
236
|
includeArchived?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Narrows on draft state: `true` returns only drafts, `false` only ready-for-review PRs. Omitted places no
|
|
239
|
+
* constraint. A boolean rather than a truthy flag because `false` is a distinct request, not the absence of one.
|
|
240
|
+
*/
|
|
241
|
+
draft?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* How to order the results. Omitted means `updated:desc`, which is what this search has always served.
|
|
244
|
+
*
|
|
245
|
+
* Validated all-or-nothing against {@link PullRequestSearchCapabilities.sorts} like every other criterion: a
|
|
246
|
+
* key the provider can't express server-side refuses the WHOLE read rather than falling back to the default,
|
|
247
|
+
* because combined with the provider's result ceiling another order returns a different subset than was asked
|
|
248
|
+
* for and the paging that comes with it describes that other subset. Do not change it mid-pagination — a
|
|
249
|
+
* cursor carries the sort it was produced under; drop the cursor instead of threading it under a new key.
|
|
250
|
+
*/
|
|
251
|
+
sort?: PullRequestSorting;
|
|
186
252
|
}
|
|
187
253
|
|
|
188
254
|
/**
|
|
@@ -195,11 +261,21 @@ export interface PullRequestSearchCapabilities {
|
|
|
195
261
|
/** Individual state values the provider can union in one logical search. */
|
|
196
262
|
states: PullRequestStateFilter[];
|
|
197
263
|
text: boolean;
|
|
264
|
+
updatedAfter: boolean;
|
|
265
|
+
createdAfter: boolean;
|
|
198
266
|
includeArchived: boolean;
|
|
267
|
+
/** Whether the provider can constrain the search by draft state server-side. */
|
|
268
|
+
draft: boolean;
|
|
199
269
|
/** Whether the manager's repository-descriptor scope is supported. */
|
|
200
270
|
repositoryScope: boolean;
|
|
201
271
|
/** Whether the manager's organization scope is supported. */
|
|
202
272
|
organizationScope: boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Sort keys the search can express server-side. Always contains at least `updated:desc` — the historical
|
|
275
|
+
* default — when the search exists at all, so it is never empty for a usable surface; a provider without a
|
|
276
|
+
* filtered PR search reports an empty `relationships`, which is already the signal there is no surface to order.
|
|
277
|
+
*/
|
|
278
|
+
sorts: PullRequestSorting[];
|
|
203
279
|
}
|
|
204
280
|
|
|
205
281
|
export interface PullRequestRef {
|
|
@@ -227,6 +303,14 @@ export interface PullRequestReviewer {
|
|
|
227
303
|
isCodeOwner?: boolean;
|
|
228
304
|
reviewer: PullRequestMember;
|
|
229
305
|
state: PullRequestReviewState;
|
|
306
|
+
/**
|
|
307
|
+
* The head commit oid this review was submitted against (GitHub). Lets a consumer tell "the PR moved past
|
|
308
|
+
* my review" (oid !== the PR's current head) from a review still at the tip — without a per-review
|
|
309
|
+
* timestamp. Only populated where the full GitHub/GHE projection is selected: the filtered search read, and
|
|
310
|
+
* an account-wide sweep that opts in with `includeReviews`. Undefined elsewhere, including reviews the
|
|
311
|
+
* repo-scoped read carries natively.
|
|
312
|
+
*/
|
|
313
|
+
commitOid?: string;
|
|
230
314
|
}
|
|
231
315
|
|
|
232
316
|
export type PullRequestRepositoryIdentityDescriptor = RequireSomeWithProps<
|
|
@@ -1,4 +1,94 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
Issue,
|
|
3
|
+
IssueRepositoryIdentityDescriptor,
|
|
4
|
+
IssueShape,
|
|
5
|
+
IssueSortField,
|
|
6
|
+
IssueSorting,
|
|
7
|
+
} from '../models/issue.js';
|
|
8
|
+
import { defaultIssueSort } from '../models/issue.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* How each sort field is read off an {@link IssueShape}, for the reads that MERGE several provider queries and so
|
|
12
|
+
* have to order the union themselves instead of letting the provider do it.
|
|
13
|
+
*
|
|
14
|
+
* Only the fields the shape actually carries appear. `priority`, `dueDate` and `resolved` are absent because
|
|
15
|
+
* `IssueOrPullRequest`/`IssueShape` doesn't model them: a provider may well order by them server-side on a
|
|
16
|
+
* single-query read, but a merged one cannot — which is exactly what {@link getIssueComparator} returning
|
|
17
|
+
* `undefined` lets its caller refuse, instead of concatenating unordered runs and calling them sorted.
|
|
18
|
+
*/
|
|
19
|
+
const issueSortValues: Partial<Record<IssueSortField, (issue: IssueShape) => number | Date | string | undefined>> = {
|
|
20
|
+
created: i => i.createdDate,
|
|
21
|
+
updated: i => i.updatedDate,
|
|
22
|
+
closed: i => i.closedDate,
|
|
23
|
+
comments: i => i.commentsCount,
|
|
24
|
+
reactions: i => i.thumbsUpCount,
|
|
25
|
+
title: i => i.title,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The order a read that ALWAYS orders is being made under: the caller's key, or the facade's default.
|
|
30
|
+
*
|
|
31
|
+
* The one place `?? defaultIssueSort` may be written. Several things downstream must agree on the answer — the
|
|
32
|
+
* emitted provider qualifier, the fingerprint sealed into a cursor, the comparator that re-sorts a merged page and
|
|
33
|
+
* the ceiling warning that names the order — and re-deriving the fallback at each is how they come to disagree,
|
|
34
|
+
* which is not cosmetic: a cursor sealed with a key its query wasn't built with makes the fingerprint check refuse
|
|
35
|
+
* valid resumptions.
|
|
36
|
+
*
|
|
37
|
+
* Note this is for a surface that CAN always order. A read whose provider may not express even the default resolves
|
|
38
|
+
* through `resolveIssueSort` instead, which can answer "leave the provider's own order".
|
|
39
|
+
*/
|
|
40
|
+
export function effectiveIssueSort(sort: IssueSorting | undefined): IssueSorting {
|
|
41
|
+
return sort ?? defaultIssueSort;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A comparator for one sort key over normalized issues, or `undefined` when the field isn't derivable from an
|
|
46
|
+
* {@link IssueShape} — the signal that the key is only honorable on a SINGLE-origin read, where the provider
|
|
47
|
+
* already ordered the page.
|
|
48
|
+
*
|
|
49
|
+
* `@gitkraken/provider-apis` carries a twin of this over its own `Issue` shape (`src/issueSort.ts`), which it uses
|
|
50
|
+
* for the merges it performs itself. It is not importable — the SDK does not export it, and it takes a different
|
|
51
|
+
* shape — so the two are separate implementations of one rule, and the rule below is the part that must not drift.
|
|
52
|
+
*
|
|
53
|
+
* Missing values sort LAST in both directions. That is deliberately not the same as negating the descending
|
|
54
|
+
* comparator (which would float them to the front when ascending), and it is why they're partitioned before any
|
|
55
|
+
* arithmetic rather than mapped to an infinite sentinel: two missing values have to compare equal, and
|
|
56
|
+
* `-Infinity - -Infinity` is `NaN`, which makes the comparator inconsistent and the resulting order
|
|
57
|
+
* implementation-defined.
|
|
58
|
+
*
|
|
59
|
+
* Note it orders whatever it is handed. Sorting a page that was already capped does not make it the top N.
|
|
60
|
+
*
|
|
61
|
+
* KNOWN DIVERGENCE, `title` only: strings are compared by code unit, so `'B' < 'a'`. A single-scope read is
|
|
62
|
+
* ordered by the provider's own database instead — case-insensitive and accent-aware — so the same `title:asc`
|
|
63
|
+
* yields "Banana, apple, ábaco" from a merged page and "ábaco, apple, Banana" from one repository. Deliberately
|
|
64
|
+
* NOT fixed with `localeCompare`: the SDK's twin comparator (which performs the merges core doesn't, notably
|
|
65
|
+
* GitLab's repo-ids aggregate) compares by code unit, so switching here would make two paths of the SAME
|
|
66
|
+
* multi-repo read disagree — a worse divergence than the one it closes, and it would break the parity test in
|
|
67
|
+
* `issueSortCapabilities.test.ts`. Closing this properly means changing the rule on BOTH sides at once; until
|
|
68
|
+
* then it is a cosmetic ordering difference on one key, not wrong data.
|
|
69
|
+
*/
|
|
70
|
+
export function getIssueComparator(sort: IssueSorting): ((a: IssueShape, b: IssueShape) => number) | undefined {
|
|
71
|
+
// The union's shape guarantees both halves, so this needs no validation — only the cast tsc can't infer.
|
|
72
|
+
const [field, direction] = sort.split(':') as [IssueSortField, 'asc' | 'desc'];
|
|
73
|
+
const getValue = issueSortValues[field];
|
|
74
|
+
if (getValue == null) return undefined;
|
|
75
|
+
|
|
76
|
+
return (a, b) => {
|
|
77
|
+
const left = toComparable(getValue(a));
|
|
78
|
+
const right = toComparable(getValue(b));
|
|
79
|
+
if (left == null || right == null) {
|
|
80
|
+
if (left == null && right == null) return 0;
|
|
81
|
+
return left == null ? 1 : -1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const ordered = left < right ? -1 : left > right ? 1 : 0;
|
|
85
|
+
return direction === 'asc' ? ordered : -ordered;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function toComparable(value: number | Date | string | undefined): number | string | undefined {
|
|
90
|
+
return value instanceof Date ? value.getTime() : value;
|
|
91
|
+
}
|
|
2
92
|
|
|
3
93
|
export function getRepositoryIdentityForIssue(issue: IssueShape | Issue): IssueRepositoryIdentityDescriptor {
|
|
4
94
|
if (issue.repository == null) throw new Error('Missing repository');
|
|
@@ -4,9 +4,58 @@ import type {
|
|
|
4
4
|
PullRequestRefs,
|
|
5
5
|
PullRequestRepositoryIdentityDescriptor,
|
|
6
6
|
PullRequestShape,
|
|
7
|
+
PullRequestSortField,
|
|
8
|
+
PullRequestSorting,
|
|
7
9
|
} from '../models/pullRequest.js';
|
|
8
10
|
import { shortenRevision } from './revision.utils.js';
|
|
9
11
|
|
|
12
|
+
/**
|
|
13
|
+
* How each sort field is read off a {@link PullRequestShape}, for the filtered PR search, which MERGES its
|
|
14
|
+
* relationship × state facets in the facade and so has to order the union itself instead of trusting the
|
|
15
|
+
* per-facet server order. Only the fields the shape carries appear — the same rule as `getIssueComparator`, and
|
|
16
|
+
* the reason {@link PullRequestSortField} is just these two.
|
|
17
|
+
*/
|
|
18
|
+
const pullRequestSortValues: Partial<
|
|
19
|
+
Record<PullRequestSortField, (pr: PullRequestShape) => number | Date | string | undefined>
|
|
20
|
+
> = {
|
|
21
|
+
created: pr => pr.createdDate,
|
|
22
|
+
updated: pr => pr.updatedDate,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A comparator for one sort key over normalized pull requests, or `undefined` when the field isn't derivable
|
|
27
|
+
* from a {@link PullRequestShape} — the signal that the key is only honorable on a SINGLE-origin read where the
|
|
28
|
+
* provider already ordered the page. Missing values sort LAST in both directions (partitioned before any
|
|
29
|
+
* arithmetic so two missing values compare equal, exactly as `getIssueComparator` does).
|
|
30
|
+
*
|
|
31
|
+
* Note it orders whatever it is handed. Sorting a page already capped at the result ceiling does not make it the
|
|
32
|
+
* top N.
|
|
33
|
+
*/
|
|
34
|
+
export function getPullRequestComparator(
|
|
35
|
+
sort: PullRequestSorting,
|
|
36
|
+
): ((a: PullRequestShape, b: PullRequestShape) => number) | undefined {
|
|
37
|
+
const [field, direction] = sort.split(':') as [PullRequestSortField, 'asc' | 'desc'];
|
|
38
|
+
const getValue = pullRequestSortValues[field];
|
|
39
|
+
if (getValue == null) return undefined;
|
|
40
|
+
|
|
41
|
+
return (a, b) => {
|
|
42
|
+
const left = toComparable(getValue(a));
|
|
43
|
+
const right = toComparable(getValue(b));
|
|
44
|
+
if (left == null || right == null) {
|
|
45
|
+
if (left == null && right == null) return 0;
|
|
46
|
+
|
|
47
|
+
return left == null ? 1 : -1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const ordered = left < right ? -1 : left > right ? 1 : 0;
|
|
51
|
+
return direction === 'asc' ? ordered : -ordered;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function toComparable(value: number | Date | string | undefined): number | string | undefined {
|
|
56
|
+
return value instanceof Date ? value.getTime() : value;
|
|
57
|
+
}
|
|
58
|
+
|
|
10
59
|
export interface PullRequestUrlIdentity<TProvider extends string = string> {
|
|
11
60
|
provider?: TProvider;
|
|
12
61
|
|
|
@@ -143,6 +192,7 @@ export function serializePullRequest(value: PullRequest): PullRequestShape {
|
|
|
143
192
|
thumbsUpCount: value.thumbsUpCount,
|
|
144
193
|
reviewDecision: value.reviewDecision,
|
|
145
194
|
reviewRequests: value.reviewRequests,
|
|
195
|
+
latestReviews: value.latestReviews,
|
|
146
196
|
assignees: value.assignees,
|
|
147
197
|
authoredByMe: value.authoredByMe,
|
|
148
198
|
project: value.project
|