@gitkraken/core-gitlens 0.39.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -1
- package/dist/git/models/pullRequest.d.ts +55 -1
- package/dist/git/models/pullRequest.js +5 -1
- package/dist/git/models/pullRequest.js.map +1 -1
- package/dist/git/models/pullRequestActivity.d.ts +55 -0
- package/dist/git/models/pullRequestActivity.js +0 -0
- package/dist/git/utils/pullRequest.utils.js +3 -1
- package/dist/git/utils/pullRequest.utils.js.map +1 -1
- package/dist/git/watching/worktreeSummary.d.ts +1 -0
- package/dist/git/watching/worktreeSummary.js +34 -2
- package/dist/git/watching/worktreeSummary.js.map +1 -1
- package/dist/plus/git-github/api/aliasedQuery.d.ts +19 -0
- package/dist/plus/git-github/api/aliasedQuery.js +21 -0
- package/dist/plus/git-github/api/aliasedQuery.js.map +1 -0
- package/dist/plus/git-github/api/cancellation.d.ts +4 -0
- package/dist/plus/git-github/api/cancellation.js +9 -0
- package/dist/plus/git-github/api/cancellation.js.map +1 -0
- package/dist/plus/git-github/api/checkRunLogs.d.ts +31 -0
- package/dist/plus/git-github/api/checkRunLogs.js +252 -0
- package/dist/plus/git-github/api/checkRunLogs.js.map +1 -0
- package/dist/plus/git-github/api/checkRuns.d.ts +26 -0
- package/dist/plus/git-github/api/checkRuns.js +191 -0
- package/dist/plus/git-github/api/checkRuns.js.map +1 -0
- package/dist/plus/git-github/api/github.d.ts +25 -2
- package/dist/plus/git-github/api/github.js +169 -37
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueWrites.d.ts +51 -0
- package/dist/plus/git-github/api/issueWrites.js +192 -0
- package/dist/plus/git-github/api/issueWrites.js.map +1 -0
- package/dist/plus/git-github/api/pullRequestActivity.d.ts +19 -0
- package/dist/plus/git-github/api/pullRequestActivity.js +355 -0
- package/dist/plus/git-github/api/pullRequestActivity.js.map +1 -0
- package/dist/plus/git-github/models.d.ts +100 -4
- package/dist/plus/git-github/models.js +135 -3
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/integrations/authentication/rejectedTokenTracker.d.ts +7 -8
- package/dist/plus/integrations/authentication/rejectedTokenTracker.js +7 -8
- package/dist/plus/integrations/authentication/rejectedTokenTracker.js.map +1 -1
- package/dist/plus/integrations/fieldPresence.d.ts +10 -5
- package/dist/plus/integrations/fieldPresence.js +46 -25
- package/dist/plus/integrations/fieldPresence.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +6 -2
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +31 -1
- package/dist/plus/integrations/integrationService.js +45 -0
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +86 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +31 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +68 -0
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +26 -5
- package/dist/plus/integrations/models/integration.js +35 -10
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/asana.d.ts +4 -5
- package/dist/plus/integrations/providers/asana.js +53 -12
- package/dist/plus/integrations/providers/asana.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +18 -3
- package/dist/plus/integrations/providers/github.js +90 -5
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/linear.js +6 -6
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +6 -15
- package/dist/plus/integrations/providers/models.js +1 -1
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +1 -6
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/reads/etag.js +20 -5
- package/dist/plus/integrations/reads/etag.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestActivity.d.ts +36 -0
- package/dist/plus/integrations/reads/pullRequestActivity.js +103 -0
- package/dist/plus/integrations/reads/pullRequestActivity.js.map +1 -0
- package/dist/plus/integrations/reads/pullRequestBatch.d.ts +4 -1
- package/dist/plus/integrations/reads/pullRequestBatch.js +5 -2
- package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBranches.d.ts +2 -0
- package/dist/plus/integrations/reads/pullRequestBranches.js +2 -1
- package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestCheckLogs.d.ts +27 -0
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js +92 -0
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js.map +1 -0
- package/docs/integrations.md +115 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,32 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.41.0] - 2026-11-21
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Adds `checkRuns` to `IntegrationManager.getPullRequestsBatch` and `getPullRequestsForBranches` for GitHub and GitHub Enterprise. With it on, each fully read row carries its head commit's individual checks (`PullRequestShape.checkRuns`: each check run or commit status with its status, conclusion, links, times, whether it has a log, and on github.com's batch read whether it is required), reading past the first 100 up to 500 and marking `checkRunsTruncated` beyond that. Each check's state is an etag input, so a check that changes under an unchanged rollup no longer compares `unchanged`, and the new `checkRuns` field-presence group says whether a row's read fetched them. Off by default, so no existing read changes its query, cost or etag (git, git-github, plus/integrations)
|
|
14
|
+
- Adds `IntegrationManager.getPullRequestCheckLogs` for GitHub and GitHub Enterprise: the last lines (`tailLines`, default 200) of each check's log, by the `PullRequestCheckRun.id` a `checkRuns` read returned. An Actions job returns its job log, read on Node with one REST request plus two ranged, unauthenticated storage requests downloading at most 256 KiB; any other check run returns its output (title, summary and text), 25 to a GraphQL request; a commit status answers `unavailable: 'no-log'` without a request. A check with nothing to read answers `'no-log'`, a job still running `'log-not-ready'`, a job whose log is gone `'log-expired'`, and a log the host would only serve whole that is over 20 MiB `'log-too-large'`. Targets are read in chunks of 25, up to 6 at once, with at most 4 Actions logs read at a time in each. Same result contract as `getPullRequestsBatch`; every other provider refuses (git, git-github, plus/integrations)
|
|
15
|
+
- Adds `IntegrationManager.getPullRequestActivity` for GitHub and GitHub Enterprise: each pull request's new reviews, inline review comments and conversation comments after a caller-held cursor, in timeline order, with each review followed by its inline comments. A first read without a cursor returns the newest `limit` items (default 30, up to 100) as a baseline; every row returns an opaque `cursor` to send back and `hasMore` when more items follow. Items are matched by when they were published (a review by its submission), so edits are not seen, and pending reviews are skipped. One GraphQL request per 25 pull requests, up to 6 at once, plus one for each page with nothing new on it (up to 4), which follow their request one after another. A missing pull request answers `notFound`. Same result contract as `getPullRequestsBatch`; every other provider refuses (git, git-github, plus/integrations)
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Fixes `WorktreeSummaryService` leaving a subscribed worktree's summary `dirty` on a clean tree after a short-lived untracked file, such as a build tool's temp file, when the file watcher dropped its creation and deletion as one batch, so no event read it again until some unrelated change. When the dirty flag rests on untracked files alone, the summary now reads it once more about a second later; that second read never schedules another, so untracked files that stay cost one extra read after each burst of changes (git)
|
|
20
|
+
|
|
21
|
+
## [0.40.0] - 2026-11-20
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- Adds `IntegrationManager.writeIssue` and `deleteIssue` for GitHub.com. Create and edit issues, close as completed or not planned, reopen, or permanently delete with GitHub's permission. Writes use the specified connection and resolve the repository and issue before mutating them. Success returns the canonical issue identity and URL, and refusals report a typed reason (plus/integrations)
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- Fixes a user-scoped Asana tracker read (`listIssueTrackerIssuesPage` without `includeAllAssignees`, and `IssuesIntegration.getIssuesForProjects*` with `options.user`) leaving out the viewer's tasks that are in several projects: the shared "my tasks" read filed each task under only the first project Asana lists for it, so a sprint board whose tasks are also on each customer's own board showed only the tasks that live on it alone. A task is now filed under every requested project it is in, with its section in that project as its state, read from the `Issue.projectMemberships` that `@gitkraken/provider-apis` 0.69.0 reports (plus/integrations)
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- Changes `@gitkraken/provider-apis` to 0.69.0, which also brings 0.68.0's breaking Linear changes. The Linear account core reads for the viewer now carries their avatar, and its `username` is still Linear's display name (plus/integrations)
|
|
34
|
+
|
|
9
35
|
## [0.39.0] - 2026-11-16
|
|
10
36
|
|
|
11
37
|
### Added
|
|
@@ -1333,7 +1359,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
|
1333
1359
|
|
|
1334
1360
|
- Initial release. Bundles `@gitlens/utils`, `@gitlens/git`, `@gitlens/git-cli`, `@gitlens/ai`, and `@gitlens/git-github` into a single core npm package with subpath exports.
|
|
1335
1361
|
|
|
1336
|
-
[unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.
|
|
1362
|
+
[unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.41.0...HEAD
|
|
1363
|
+
[0.41.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.40.0...gitkraken:releases/core/v0.41.0
|
|
1364
|
+
[0.40.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.39.0...gitkraken:releases/core/v0.40.0
|
|
1337
1365
|
[0.39.0]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.38.4...gitkraken:releases/core/v0.39.0
|
|
1338
1366
|
[0.38.4]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.38.3...gitkraken:releases/core/v0.38.4
|
|
1339
1367
|
[0.38.3]: https://github.com/gitkraken/vscode-gitlens/compare/releases/core/v0.38.2...gitkraken:releases/core/v0.38.3
|
|
@@ -75,6 +75,14 @@ export interface PullRequestShape extends IssueOrPullRequest {
|
|
|
75
75
|
* Read wherever `mergeQueue` is (the same `mergeQueue` field group); absent there means no such removal.
|
|
76
76
|
*/
|
|
77
77
|
readonly mergeQueueRemoval?: PullRequestMergeQueueRemoval;
|
|
78
|
+
/**
|
|
79
|
+
* The head commit's individual check results. `undefined` means not read; empty means read and the head has no
|
|
80
|
+
* checks. Only GitHub and GitHub Enterprise read them, and only for a read that asks (`checkRuns`); ask
|
|
81
|
+
* `getPullRequestFieldPresence` (`@gitkraken/core-gitlens/plus/integrations`) for the row's `checkRuns` group.
|
|
82
|
+
*/
|
|
83
|
+
readonly checkRuns?: readonly PullRequestCheckRun[];
|
|
84
|
+
/** Set when the head has more checks than {@link checkRuns} holds. Read wherever `checkRuns` is. */
|
|
85
|
+
readonly checkRunsTruncated?: true;
|
|
78
86
|
readonly number?: number;
|
|
79
87
|
readonly authoredByMe?: boolean;
|
|
80
88
|
/**
|
|
@@ -150,6 +158,8 @@ export declare class PullRequest implements PullRequestShape {
|
|
|
150
158
|
readonly mergeQueue?: PullRequestMergeQueueEntry | undefined;
|
|
151
159
|
readonly mergeQueueRequired?: boolean | undefined;
|
|
152
160
|
readonly mergeQueueRemoval?: PullRequestMergeQueueRemoval | undefined;
|
|
161
|
+
readonly checkRuns?: readonly PullRequestCheckRun[] | undefined;
|
|
162
|
+
readonly checkRunsTruncated?: true | undefined;
|
|
153
163
|
readonly type = "pullrequest";
|
|
154
164
|
constructor(provider: ProviderReference, author: PullRequestMember, id: string, nodeId: string | undefined, title: string, url: string, repository: IssueRepository, state: IssueOrPullRequestState, createdDate: Date, updatedDate: Date, closedDate?: Date | undefined, mergedDate?: Date | undefined, mergeableState?: PullRequestMergeableState | undefined, viewerCanUpdate?: boolean | undefined, refs?: PullRequestRefs | undefined, isDraft?: boolean | undefined, additions?: number | undefined, deletions?: number | undefined, commentsCount?: number | undefined, thumbsUpCount?: number | undefined, reviewDecision?: PullRequestReviewDecision | undefined, reviewRequests?: PullRequestReviewer[] | undefined, latestReviews?: PullRequestReviewer[] | undefined, assignees?: PullRequestMember[] | undefined, statusCheckRollupState?: PullRequestStatusCheckRollupState | undefined, project?: IssueProject | undefined, version?: number | undefined,
|
|
155
165
|
/** Commits on the head that aren't on the base. Appended rather than slotted with the other counts:
|
|
@@ -159,7 +169,7 @@ export declare class PullRequest implements PullRequestShape {
|
|
|
159
169
|
body?: string | undefined, number?: number | undefined, authoredByMe?: boolean | undefined, projection?: PullRequestProjection | undefined, viewer?: {
|
|
160
170
|
readonly id: string;
|
|
161
171
|
readonly username?: string;
|
|
162
|
-
} | undefined, viewerUnresolved?: true | undefined, milestone?: IssueMilestone | null | undefined, mergeQueue?: PullRequestMergeQueueEntry | undefined, mergeQueueRequired?: boolean | undefined, mergeQueueRemoval?: PullRequestMergeQueueRemoval | undefined);
|
|
172
|
+
} | undefined, viewerUnresolved?: true | undefined, milestone?: IssueMilestone | null | undefined, mergeQueue?: PullRequestMergeQueueEntry | undefined, mergeQueueRequired?: boolean | undefined, mergeQueueRemoval?: PullRequestMergeQueueRemoval | undefined, checkRuns?: readonly PullRequestCheckRun[] | undefined, checkRunsTruncated?: true | undefined);
|
|
163
173
|
get closed(): boolean;
|
|
164
174
|
static is(pr: unknown): pr is PullRequest;
|
|
165
175
|
static formatDate(pr: PullRequestShape, format?: string | null): string;
|
|
@@ -465,6 +475,50 @@ export interface PullRequestMergeQueueRemoval {
|
|
|
465
475
|
/** When the pull request was removed. */
|
|
466
476
|
removedAt: Date;
|
|
467
477
|
}
|
|
478
|
+
/** One check on a pull request's head commit: a check run, or a commit status. */
|
|
479
|
+
export interface PullRequestCheckRun {
|
|
480
|
+
/** Opaque: compare for equality or hand back to core, never parse. */
|
|
481
|
+
readonly id: string;
|
|
482
|
+
readonly kind: 'check-run' | 'status';
|
|
483
|
+
/** A check run's name, or a commit status's context. */
|
|
484
|
+
readonly name: string;
|
|
485
|
+
/** The workflow an Actions check run belongs to. */
|
|
486
|
+
readonly workflowName?: string;
|
|
487
|
+
readonly status: PullRequestCheckRunStatus;
|
|
488
|
+
/** Set once `status` is `completed`. */
|
|
489
|
+
readonly conclusion?: PullRequestCheckRunConclusion;
|
|
490
|
+
readonly url?: string;
|
|
491
|
+
/** Whether the base branch requires it to pass. `undefined` means not read (only GitHub.com reads it). */
|
|
492
|
+
readonly required?: boolean;
|
|
493
|
+
readonly startedAt?: Date;
|
|
494
|
+
readonly completedAt?: Date;
|
|
495
|
+
/** Whether the check has output or a job log to read. */
|
|
496
|
+
readonly hasLog: boolean;
|
|
497
|
+
}
|
|
498
|
+
export type PullRequestCheckRunStatus = 'queued' | 'in-progress' | 'waiting' | 'pending' | 'requested' | 'completed';
|
|
499
|
+
export type PullRequestCheckRunConclusion = 'success' | 'failure' | 'neutral' | 'cancelled' | 'skipped' | 'timed-out' | 'action-required' | 'stale' | 'startup-failure' | 'error';
|
|
500
|
+
/** A check's log tail, or why it has none. Exactly one of `log` and `unavailable` is set. */
|
|
501
|
+
export type PullRequestCheckLog = {
|
|
502
|
+
readonly log: PullRequestCheckLogText;
|
|
503
|
+
readonly unavailable?: never;
|
|
504
|
+
} | {
|
|
505
|
+
readonly unavailable: PullRequestCheckLogUnavailableReason;
|
|
506
|
+
readonly log?: never;
|
|
507
|
+
};
|
|
508
|
+
/** The last lines of a check's log. `truncated` means earlier lines exist that `text` doesn't hold. */
|
|
509
|
+
export interface PullRequestCheckLogText {
|
|
510
|
+
readonly text: string;
|
|
511
|
+
readonly lineCount: number;
|
|
512
|
+
readonly truncated: boolean;
|
|
513
|
+
/** An Actions job's log, or another check run's output (its title, summary and text). */
|
|
514
|
+
readonly source: 'actions-job-log' | 'check-run-output';
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* `'no-log'`: the check has nothing to read. `'log-not-ready'`: its job is still running. `'log-expired'`: its job
|
|
518
|
+
* finished but the host no longer keeps the log. `'log-too-large'`: the host would only serve the log whole, and it is
|
|
519
|
+
* larger than a read takes, so its last lines can't be told apart from its middle.
|
|
520
|
+
*/
|
|
521
|
+
export type PullRequestCheckLogUnavailableReason = 'no-log' | 'log-not-ready' | 'log-expired' | 'log-too-large';
|
|
468
522
|
/** Why adding a pull request to its merge queue, or removing it, failed. */
|
|
469
523
|
export type PullRequestMergeQueueActionFailureReason =
|
|
470
524
|
/** Adding a pull request that is already queued. */
|
|
@@ -45,8 +45,10 @@ let PullRequest = _PullRequest = class PullRequest {
|
|
|
45
45
|
mergeQueue;
|
|
46
46
|
mergeQueueRequired;
|
|
47
47
|
mergeQueueRemoval;
|
|
48
|
+
checkRuns;
|
|
49
|
+
checkRunsTruncated;
|
|
48
50
|
type = "pullrequest";
|
|
49
|
-
constructor(provider, author, id, nodeId, title, url, repository, state, createdDate, updatedDate, closedDate, mergedDate, mergeableState, viewerCanUpdate, refs, isDraft, additions, deletions, commentsCount, thumbsUpCount, reviewDecision, reviewRequests, latestReviews, assignees, statusCheckRollupState, project, version, commitCount, stack, filesChanged, body, number, authoredByMe, projection, viewer, viewerUnresolved, milestone, mergeQueue, mergeQueueRequired, mergeQueueRemoval) {
|
|
51
|
+
constructor(provider, author, id, nodeId, title, url, repository, state, createdDate, updatedDate, closedDate, mergedDate, mergeableState, viewerCanUpdate, refs, isDraft, additions, deletions, commentsCount, thumbsUpCount, reviewDecision, reviewRequests, latestReviews, assignees, statusCheckRollupState, project, version, commitCount, stack, filesChanged, body, number, authoredByMe, projection, viewer, viewerUnresolved, milestone, mergeQueue, mergeQueueRequired, mergeQueueRemoval, checkRuns, checkRunsTruncated) {
|
|
50
52
|
this.provider = provider;
|
|
51
53
|
this.author = author;
|
|
52
54
|
this.id = id;
|
|
@@ -87,6 +89,8 @@ let PullRequest = _PullRequest = class PullRequest {
|
|
|
87
89
|
this.mergeQueue = mergeQueue;
|
|
88
90
|
this.mergeQueueRequired = mergeQueueRequired;
|
|
89
91
|
this.mergeQueueRemoval = mergeQueueRemoval;
|
|
92
|
+
this.checkRuns = checkRuns;
|
|
93
|
+
this.checkRunsTruncated = checkRunsTruncated;
|
|
90
94
|
}
|
|
91
95
|
get closed() {
|
|
92
96
|
return this.state === "closed";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pullRequest.js","names":[],"sources":["../../../../git/src/models/pullRequest.ts"],"sourcesContent":["import { formatDate, fromNow } from '@gitlens/utils/date.js';\nimport { loggable } from '@gitlens/utils/decorators/log.js';\nimport { serializable } from '@gitlens/utils/decorators/serializable.js';\nimport type { RequireSome, RequireSomeWithProps } from '@gitlens/utils/types.js';\nimport type { IssueProject, IssueRepository } from './issue.js';\nimport type {\n\tIssueMilestone,\n\tIssueOrPullRequest,\n\tIssueOrPullRequestState as PullRequestState,\n} from './issueOrPullRequest.js';\nimport type { ProviderReference } from './remoteProvider.js';\nimport type { RepositoryIdentityDescriptor } from './repositoryIdentities.js';\n\nexport type { PullRequestState };\n\n/**\n * The read that produced a pull request row, as a key for `getPullRequestFieldPresence` (`@gitlens/integrations`). It\n * names a READ, not a field set: the same tag can carry different fields on different providers.\n */\nexport type PullRequestProjection =\n\t/** A single-item read: by number, for a branch, or for a commit. */\n\t| 'point'\n\t/** The filtered search with the full projection, and the host's \"my pull requests\" search. */\n\t| 'search'\n\t/** The filtered search with `summary`. */\n\t| 'search-summary'\n\t/** The free-text search (`searchPullRequests`). */\n\t| 'text-search'\n\t/** An account-wide sweep with the full projection (`includeReviews`). */\n\t| 'account'\n\t/** An account-wide list or sweep with the lightweight projection. */\n\t| 'account-summary'\n\t/** A repository-scoped list or sweep. */\n\t| 'repos'\n\t/** A repository-scoped list with `summary`. */\n\t| 'repos-summary'\n\t/** The coordinate and branch batch reads. */\n\t| 'batch';\n\nexport interface PullRequestShape extends IssueOrPullRequest {\n\treadonly state: PullRequestState;\n\treadonly author: PullRequestMember;\n\t/**\n\t * Canonical base-repository identity returned by the provider. Some providers\n\t * scope pull-request ids to a repository, so consumers must not have to infer\n\t * identity from optional refs or URLs.\n\t */\n\treadonly repository?: IssueRepository;\n\treadonly mergedDate?: Date;\n\treadonly refs?: PullRequestRefs;\n\treadonly isDraft?: boolean;\n\treadonly additions?: number;\n\treadonly deletions?: number;\n\treadonly filesChanged?: number;\n\treadonly body?: string;\n\treadonly mergeableState?: PullRequestMergeableState;\n\treadonly reviewDecision?: PullRequestReviewDecision;\n\treadonly reviewRequests?: PullRequestReviewer[];\n\t/**\n\t * Reviews already submitted, as opposed to the still-pending {@link reviewRequests}. Absent means the read\n\t * didn't fetch reviews; empty means nobody has reviewed — but only where the read actually fetched them, which\n\t * is provider- and read-dependent: ask `getPullRequestFieldPresence` (`@gitlens/integrations`) for the row's\n\t * `reviews` group rather than trusting an empty array.\n\t * {@link PullRequestReviewer.commitOid} is the narrower promise: only the full GitHub/GHE projection has it.\n\t */\n\treadonly latestReviews?: PullRequestReviewer[];\n\treadonly assignees?: PullRequestMember[];\n\treadonly project?: IssueProject;\n\treadonly stack?: PullRequestStackInfo;\n\t/**\n\t * The pull request's place in its base branch's merge queue. Absent means either not queued or not fetched — ask\n\t * `getPullRequestFieldPresence` (`@gitlens/integrations`) for the row's `mergeQueue` group to tell them apart.\n\t * Only GitHub.com reports one.\n\t */\n\treadonly mergeQueue?: PullRequestMergeQueueEntry;\n\t/**\n\t * Whether the base branch accepts this pull request only through a merge queue, so merging it means adding it to\n\t * the queue. `undefined` means not read; read wherever `mergeQueue` is (the same `mergeQueue` field group).\n\t */\n\treadonly mergeQueueRequired?: boolean;\n\t/**\n\t * The pull request's latest removal from its merge queue, set only while that removal is its latest merge-queue\n\t * event (it hasn't rejoined since) and the removal didn't merge it. It stays set however much later the pull\n\t * request changes, so ask `isPullRequestMergeQueueRemovalCurrent` whether it still describes the pull request.\n\t * Read wherever `mergeQueue` is (the same `mergeQueue` field group); absent there means no such removal.\n\t */\n\treadonly mergeQueueRemoval?: PullRequestMergeQueueRemoval;\n\treadonly number?: number;\n\treadonly authoredByMe?: boolean;\n\t/**\n\t * The current account as this pull request's members identify it: the identity its people were matched against,\n\t * present whenever it was resolved (see {@link viewerUnresolved} for an Azure DevOps row it couldn't be for). {@link authoredByMe} is matched against it too, and stays `undefined` when the\n\t * row has no author, though its reviewers or assignees still get this. A consumer matching {@link reviewRequests}\n\t * or {@link latestReviews} entries to the current user compares against this, not the account `getCurrentAccount`\n\t * returns: Azure DevOps can know one person by another id in each organization (Azure DevOps Server: collection)\n\t * than the account's, and the members carry the organization's. Core matches `username` too only on GitHub and\n\t * GitHub Enterprise, whose rows key people by login.\n\t */\n\treadonly viewer?: { readonly id: string; readonly username?: string };\n\t/**\n\t * Set, and only ever `true`, on an Azure DevOps row that names someone (its author, a reviewer or an assignee)\n\t * whose organization's (Azure DevOps Server: collection's) identity the read tried and failed to resolve: its\n\t * `ConnectionData` failed, answered without an identity, or didn't answer within 10 seconds. Such a row has neither\n\t * {@link viewer} nor {@link authoredByMe}, and neither the account `getCurrentAccount` returns nor anyone else can\n\t * be matched against its people: whether it is the current user's, or asks for their review, is unknown, not \"no\".\n\t * Absent everywhere else, so a row with neither field is still one whose identity wasn't resolved for another\n\t * reason (a read that doesn't resolve it, or a failed account read), as before.\n\t */\n\treadonly viewerUnresolved?: true;\n\t/** The read that produced this row. Absent means unknown: a legacy row, or a provider or read not yet tagged. */\n\treadonly projection?: PullRequestProjection;\n}\n\n@loggable(i => i.id)\n@serializable\nexport class PullRequest implements PullRequestShape {\n\treadonly type = 'pullrequest';\n\n\tconstructor(\n\t\tpublic readonly provider: ProviderReference,\n\t\tpublic readonly author: PullRequestMember,\n\t\tpublic readonly id: string,\n\t\tpublic readonly nodeId: string | undefined,\n\t\tpublic readonly title: string,\n\t\tpublic readonly url: string,\n\t\tpublic readonly repository: IssueRepository,\n\t\tpublic readonly state: PullRequestState,\n\t\tpublic readonly createdDate: Date,\n\t\tpublic readonly updatedDate: Date,\n\t\tpublic readonly closedDate?: Date,\n\t\tpublic readonly mergedDate?: Date,\n\t\tpublic readonly mergeableState?: PullRequestMergeableState,\n\t\tpublic readonly viewerCanUpdate?: boolean,\n\t\tpublic readonly refs?: PullRequestRefs,\n\t\tpublic readonly isDraft?: boolean,\n\t\tpublic readonly additions?: number,\n\t\tpublic readonly deletions?: number,\n\t\tpublic readonly commentsCount?: number,\n\t\tpublic readonly thumbsUpCount?: number,\n\t\tpublic readonly reviewDecision?: PullRequestReviewDecision,\n\t\tpublic readonly reviewRequests?: PullRequestReviewer[],\n\t\tpublic readonly latestReviews?: PullRequestReviewer[],\n\t\tpublic readonly assignees?: PullRequestMember[],\n\t\tpublic readonly statusCheckRollupState?: PullRequestStatusCheckRollupState,\n\t\tpublic readonly project?: IssueProject,\n\t\tpublic readonly version?: number,\n\t\t/** Commits on the head that aren't on the base. Appended rather than slotted with the other counts:\n\t\t * this constructor is positional and every mapper passes through it. */\n\t\tpublic readonly commitCount?: number,\n\t\tpublic readonly stack?: PullRequestStackInfo,\n\t\tpublic readonly filesChanged?: number,\n\t\t/** The pull request's description, as markdown. */\n\t\tpublic readonly body?: string,\n\t\tpublic readonly number?: number,\n\t\tpublic readonly authoredByMe?: boolean,\n\t\tpublic readonly projection?: PullRequestProjection,\n\t\tpublic readonly viewer?: { readonly id: string; readonly username?: string },\n\t\tpublic readonly viewerUnresolved?: true,\n\t\tpublic readonly milestone?: IssueMilestone | null,\n\t\tpublic readonly mergeQueue?: PullRequestMergeQueueEntry,\n\t\tpublic readonly mergeQueueRequired?: boolean,\n\t\tpublic readonly mergeQueueRemoval?: PullRequestMergeQueueRemoval,\n\t) {}\n\n\tget closed(): boolean {\n\t\treturn this.state === 'closed';\n\t}\n\n\tstatic is(pr: unknown): pr is PullRequest {\n\t\treturn pr instanceof PullRequest;\n\t}\n\n\tstatic formatDate(pr: PullRequestShape, format?: string | null): string {\n\t\treturn formatDate(pr.mergedDate ?? pr.closedDate ?? pr.updatedDate, format ?? 'MMMM Do, YYYY h:mma');\n\t}\n\n\tstatic formatDateFromNow(pr: PullRequestShape): string {\n\t\treturn fromNow(pr.mergedDate ?? pr.closedDate ?? pr.updatedDate);\n\t}\n\n\tstatic formatDateWithStyle(\n\t\tpr: PullRequestShape,\n\t\tformatting: { dateStyle: string; dateFormat: string | null },\n\t): string {\n\t\treturn formatting.dateStyle === 'absolute'\n\t\t\t? PullRequest.formatDate(pr, formatting.dateFormat)\n\t\t\t: PullRequest.formatDateFromNow(pr);\n\t}\n}\n\nexport const enum PullRequestReviewDecision {\n\tApproved = 'Approved',\n\tChangesRequested = 'ChangesRequested',\n\tReviewRequired = 'ReviewRequired',\n}\n\nexport const enum PullRequestMergeableState {\n\tUnknown = 'Unknown',\n\tMergeable = 'Mergeable',\n\tConflicting = 'Conflicting',\n\tFailingChecks = 'FailingChecks',\n\tBlockedByPolicy = 'BlockedByPolicy',\n}\n\n/** Where a queued pull request stands in its merge queue. Mirrors GitHub's `MergeQueueEntryState`. */\nexport const enum PullRequestMergeQueueState {\n\tQueued = 'Queued',\n\t/** Waiting for its required checks to pass. */\n\tAwaitingChecks = 'AwaitingChecks',\n\tMergeable = 'Mergeable',\n\tUnmergeable = 'Unmergeable',\n\tLocked = 'Locked',\n}\n\nexport const enum PullRequestStatusCheckRollupState {\n\tSuccess = 'success',\n\tPending = 'pending',\n\tFailed = 'failed',\n}\n\nexport const enum PullRequestMergeMethod {\n\tMerge = 'merge',\n\tSquash = 'squash',\n\tRebase = 'rebase',\n}\n\nexport const enum PullRequestReviewState {\n\tApproved = 'APPROVED',\n\tChangesRequested = 'CHANGES_REQUESTED',\n\tCommented = 'COMMENTED',\n\tDismissed = 'DISMISSED',\n\tPending = 'PENDING',\n\tReviewRequested = 'REVIEW_REQUESTED',\n}\n\nexport interface PullRequestComparisonRefs {\n\trepoPath: string;\n\tbase: { ref: string; label: string };\n\thead: { ref: string; label: string };\n}\n\nexport interface PullRequestMember {\n\tid: string;\n\t/**\n\t * Absent when the provider exposes no display name for the member — same contract as `IssueMember.name`: a\n\t * fallback invented here can't be told apart from a real name downstream, so each consumer picks its own\n\t * presentation.\n\t */\n\tname?: string;\n\t/** The provider's handle for this person, when it has one — GitHub's login, Azure's `uniqueName` (a UPN,\n\t * so an email), Bitbucket's mutable `nickname`. Display/labelling only: it is neither guaranteed present\n\t * (GitLab's native mapper has none) nor a stable identity, so never key a match off it. */\n\tusername?: string;\n\tavatarUrl?: string;\n\turl?: string;\n}\n\n/** Provider-neutral relationship facets shared by PR listings and filtered PR search. */\nexport enum PullRequestFilter {\n\tAuthor = 'author',\n\tAssignee = 'assignee',\n\tReviewRequested = 'review-requested',\n\t/**\n\t * PRs the user has already reviewed (GitHub `reviewed-by:@me`), as opposed to `ReviewRequested` (a\n\t * still-pending request). Distinguishes \"waiting on the author after my review\" from \"waiting for my\n\t * review\". Not expressible on the repo-scoped listing — no provider SDK exposes a reviewed-by axis there —\n\t * so it is advertised for the account-wide read and for the filtered search (which can still bound itself\n\t * to repositories or an org), never under `supportedPullRequestFilters`.\n\t */\n\tReviewed = 'reviewed-by',\n\tMention = 'mention',\n}\n\n/** Selects which pull request states a read should include. `all` covers open + closed + merged. */\nexport type PullRequestStateFilter = 'open' | 'closed' | 'merged' | 'all';\n\n/**\n * A field a pull-request read can be ordered by, provider-neutral.\n *\n * Only two, and deliberately so — unlike {@link IssueSortField} this is the INTERSECTION of what GitHub's PR\n * search can order by server-side and what a {@link PullRequestShape} carries, because the filtered PR search\n * always merges its relationship × state facets in the facade and so must re-order the union itself (see\n * `getPullRequestComparator`). `created` and `updated` are both. A field GitHub cannot order PRs by, or one a\n * merged page can't reproduce, is left out rather than advertised and then approximated: relevance is unstable\n * and has no comparable value on a merge, and priority is not a pull-request concept on any provider that has PRs.\n */\nexport type PullRequestSortField =\n\t/** Creation date. */\n\t| 'created'\n\t/** Last activity. */\n\t| 'updated';\n\n/**\n * How a pull-request read is ordered, as `field:direction` — the same serializable shape {@link IssueSorting}\n * and `BranchSorting` use, so a consumer can persist it, compare it, or bind it straight to a setting or dropdown.\n */\nexport type PullRequestSorting = `${PullRequestSortField}:asc` | `${PullRequestSortField}:desc`;\n\n/**\n * The order the filtered pull-request search applies when the caller asks for none: most recently updated first,\n * which is what it served before ordering was an option. Named once rather than per layer — the criteria model\n * documents it, the GitHub query emits it, and the result-ceiling warning quotes it — so the three cannot\n * disagree about what \"the default\" is.\n */\nexport const defaultPullRequestSort: PullRequestSorting = 'updated:desc';\n\n/**\n * What the filtered pull-request search narrows on.\n *\n * Structured rather than a provider query string so callers can send free text without giving it a qualifier\n * channel, and can check {@link PullRequestSearchCapabilities} before issuing a read. Every requested criterion\n * is validated all-or-nothing before the provider runs; unsupported criteria never fall through to a wider\n * result set whose paging would no longer describe the returned items.\n *\n * Relationships are OR-ed, as are states. Omitting `relationships` removes the current-user constraint, which is\n * only safe when the manager call supplies a repository or organization scope. Omitting `states` reads open PRs.\n */\nexport interface PullRequestSearchCriteria {\n\t/**\n\t * Free text matched by the provider's own relevance rules. Tokens that look like provider qualifiers are\n\t * removed before the query is built, so text cannot change the search's scope or state.\n\t */\n\ttext?: string;\n\t/** Current-user relationship facets to union. Empty/omitted means no relationship constraint. */\n\trelationships?: PullRequestFilter[];\n\t/** Pull request states to union. Empty/omitted reads open PRs; `all` subsumes every other member. */\n\tstates?: PullRequestStateFilter[];\n\t/** ISO date (`YYYY-MM-DD`). The most effective narrowing criterion by far on a large scope. */\n\tupdatedAfter?: string;\n\t/** ISO date (`YYYY-MM-DD`). */\n\tcreatedAfter?: string;\n\t/** Includes PRs from archived repositories. They are excluded by default. */\n\tincludeArchived?: boolean;\n\t/**\n\t * Narrows on draft state: `true` returns only drafts, `false` only ready-for-review PRs. Omitted places no\n\t * constraint. A boolean rather than a truthy flag because `false` is a distinct request, not the absence of one.\n\t */\n\tdraft?: boolean;\n\t/**\n\t * How to order the results. Omitted means `updated:desc`, which is what this search has always served.\n\t *\n\t * Validated all-or-nothing against {@link PullRequestSearchCapabilities.sorts} like every other criterion: a\n\t * key the provider can't express server-side refuses the WHOLE read rather than falling back to the default,\n\t * because combined with the provider's result ceiling another order returns a different subset than was asked\n\t * for and the paging that comes with it describes that other subset. Do not change it mid-pagination — a\n\t * cursor carries the sort it was produced under; drop the cursor instead of threading it under a new key.\n\t */\n\tsort?: PullRequestSorting;\n}\n\n/**\n * Which {@link PullRequestSearchCriteria} fields and manager-level scopes a provider can express server-side.\n * An empty `relationships` means the provider has no filtered PR search at all.\n */\nexport interface PullRequestSearchCapabilities {\n\t/** Current-user relationship facets the provider can union. Empty means the search itself is unsupported. */\n\trelationships: PullRequestFilter[];\n\t/** Individual state values the provider can union in one logical search. */\n\tstates: PullRequestStateFilter[];\n\ttext: boolean;\n\tupdatedAfter: boolean;\n\tcreatedAfter: boolean;\n\tincludeArchived: boolean;\n\t/** Whether the provider can constrain the search by draft state server-side. */\n\tdraft: boolean;\n\t/** Whether the manager's repository-descriptor scope is supported. */\n\trepositoryScope: boolean;\n\t/** Whether the manager's organization scope is supported. */\n\torganizationScope: boolean;\n\t/**\n\t * Sort keys the search can express server-side. Always contains at least `updated:desc` — the historical\n\t * default — when the search exists at all, so it is never empty for a usable surface; a provider without a\n\t * filtered PR search reports an empty `relationships`, which is already the signal there is no surface to order.\n\t */\n\tsorts: PullRequestSorting[];\n}\n\nexport interface PullRequestRef {\n\t/**\n\t * `undefined` when the ref's repository was deleted (a removed fork): GitHub's rows say so, with `exists` false.\n\t * provider-apis' converters fill `''` instead, so test for a value rather than for `undefined`.\n\t */\n\towner: string | undefined;\n\t/**\n\t * The repository's name, never a path: a GitLab nested group is all {@link owner}. `undefined` (or `''`) when the\n\t * ref's repository was deleted, as {@link owner}.\n\t */\n\trepo: string | undefined;\n\tbranch: string;\n\tsha: string;\n\texists: boolean;\n\t/**\n\t * Web URL of the ref's repository. `undefined` when the provider cannot resolve it — Azure DevOps embeds an\n\t * abbreviated repository reference in a pull request, so a fork's URL may need a lookup that can fail.\n\t */\n\turl: string | undefined;\n\t/** HTTPS clone URL of the ref's repository, when the provider exposes it. */\n\tcloneHttps?: string;\n\t/** SSH clone URL of the ref's repository, when the provider exposes it. */\n\tcloneSsh?: string;\n\t/** Best-effort flag: whether the ref's repository is a fork. `undefined` when the provider can't tell. */\n\tisFork?: boolean;\n}\n\nexport interface PullRequestRefs {\n\tbase: PullRequestRef & { url: string };\n\thead: PullRequestRef;\n\tisCrossRepository: boolean;\n}\n\n/**\n * A pull request's membership in a stack — an ordered chain of dependent pull requests where each\n * targets the branch of the one below it.\n *\n * `baseRef` is the stack's ultimate target (its trunk) and is NOT the same as `refs.base`, which for\n * anything above the bottom layer names the layer below. Use `refs.base` to diff a single layer; use\n * `baseRef` to answer where the work ultimately lands.\n */\nexport interface PullRequestStackInfo {\n\t/**\n\t * Opaque, and NOT comparable across read paths: GitHub's GraphQL selection returns a node id\n\t * (`PRS_kwDO…`) while its REST stacks endpoint returns a numeric id (`1347135`) that we stringify —\n\t * both verified against the same live stack. Use {@link number} to identify a stack; two views of one\n\t * stack agree there and will not agree here.\n\t */\n\tid: string;\n\t/** Identifies the stack within its repository. */\n\tnumber: number;\n\t/** Total pull requests in the stack. */\n\tsize: number;\n\t/** This pull request's layer, 1-based, where 1 is closest to `baseRef`. */\n\tposition: number;\n\t/** The branch the bottom of the stack targets. */\n\tbaseRef: string;\n}\n\n/**\n * One layer of a stack — the pull request occupying it, and the head ref a rebase or push needs to act\n * on. Unlike {@link PullRequestStackInfo}, which locates a single pull request within a stack, this is\n * the per-layer detail a caller walking the whole stack needs, e.g. to cascade a rebase bottom to top.\n */\nexport interface PullRequestStackLayer {\n\t/** The pull request's number. */\n\tnumber: number;\n\t/** The pull request's head branch name, without a remote prefix. */\n\theadRef: string;\n\t/** The head branch's tip when the stack was read. */\n\theadSha: string;\n\t/** `true` once this layer has landed. */\n\tmerged: boolean;\n\t/** `true` while this layer is still a draft. */\n\tdraft: boolean;\n}\n\n/**\n * A stack's layers, ordered bottom to top. `baseRef` is the stack's ultimate target (its trunk), the\n * same distinction drawn on {@link PullRequestStackInfo} — it is NOT the base of any individual layer\n * above the bottom, which targets the layer below it instead.\n */\nexport interface PullRequestStackLayers {\n\t/** Opaque and not comparable across read paths — see {@link PullRequestStackInfo.id}. */\n\tid: string;\n\tnumber: number;\n\t/** The branch the bottom of the stack targets. */\n\tbaseRef: string;\n\t/** The stack's layers, ordered bottom (closest to {@link baseRef}) to top. */\n\tlayers: PullRequestStackLayer[];\n}\n\n/** A pull request's entry in its base branch's merge queue. */\nexport interface PullRequestMergeQueueEntry {\n\tstate: PullRequestMergeQueueState;\n\t/** When the pull request joined the queue. */\n\tenqueuedAt: Date;\n\t/**\n\t * When the provider expects it to merge: its estimate of the time remaining, fixed to a date when the entry was\n\t * read, so it counts down while the entry is held rather than restarting at each render. Absent when the provider\n\t * gives none; may already be past on an entry held a while.\n\t */\n\testimatedMergeAt?: Date;\n\t/** The merge queue's web URL. */\n\turl?: string;\n\t/**\n\t * The entry's 1-based place in the queue, in enqueue order. Absent when the provider gives none. It moves as the\n\t * entries ahead of it merge or leave, so it is never an etag input: an `unchanged` row's position can be stale.\n\t */\n\tposition?: number;\n}\n\n/** A pull request's removal from its base branch's merge queue, other than by merging. */\nexport interface PullRequestMergeQueueRemoval {\n\t/**\n\t * The provider's own reason, passed through as given — GitHub's include `failed_checks` and `manual`, and others\n\t * are undocumented. Empty when the provider gives none. Classify it with `getPullRequestMergeQueueRemovalKind`.\n\t */\n\treason: string;\n\t/** When the pull request was removed. */\n\tremovedAt: Date;\n}\n\n/** Why adding a pull request to its merge queue, or removing it, failed. */\nexport type PullRequestMergeQueueActionFailureReason =\n\t/** Adding a pull request that is already queued. */\n\t| 'already-queued'\n\t/** The pull request's head moved since it was read, so the head it was asked to queue is stale. */\n\t| 'head-changed'\n\t/** The host refused the action for the pull request's own state: its base branch has no merge queue, it is a\n\t * draft or closed, or it doesn't meet the queue's requirements. */\n\t| 'not-allowed'\n\t/** The account may not add to or remove from this queue. */\n\t| 'permission'\n\t/** The host (or this integration) has no merge queue to act on. */\n\t| 'unsupported'\n\t/** Anything else, including a failure to reach the host. */\n\t| 'unknown';\n\n/**\n * What adding a pull request to its merge queue, or removing it, did. A failure says why, with the host's own message\n * when it gave one — for logs and diagnostics, not for display.\n */\nexport type PullRequestMergeQueueActionResult =\n\t| {\n\t\t\treadonly status: 'queued';\n\t\t\t/** The new entry, when the host returned one. */\n\t\t\treadonly entry?: PullRequestMergeQueueEntry;\n\t }\n\t| { readonly status: 'dequeued' }\n\t| {\n\t\t\treadonly status: 'failed';\n\t\t\treadonly reason: PullRequestMergeQueueActionFailureReason;\n\t\t\treadonly message?: string;\n\t };\n\nexport interface PullRequestReviewer {\n\tisCodeOwner?: boolean;\n\treviewer: PullRequestMember;\n\tstate: PullRequestReviewState;\n\t/**\n\t * The head commit oid this review was submitted against (GitHub). Lets a consumer tell \"the PR moved past\n\t * my review\" (oid !== the PR's current head) from a review still at the tip — without a per-review\n\t * timestamp. Only populated where the full GitHub/GHE projection is selected: the filtered search read, and\n\t * an account-wide sweep that opts in with `includeReviews`. Undefined elsewhere, including reviews the\n\t * repo-scoped read carries natively.\n\t */\n\tcommitOid?: string;\n\t/**\n\t * The reviewer is a group the current user is a member of (a team or another group, directly or through a group\n\t * nested in it) rather than a person: a request to it is one the user can answer as a member, not one addressed to\n\t * them by name. Only the Azure DevOps reads that resolve the user's groups set it; absent elsewhere, including for\n\t * groups a read could not tell the user belongs to.\n\t */\n\tisMyGroup?: boolean;\n}\n\nexport type PullRequestRepositoryIdentityDescriptor = RequireSomeWithProps<\n\tRequireSome<RepositoryIdentityDescriptor<string>, 'provider'>,\n\t'provider',\n\t'id' | 'domain' | 'repoDomain' | 'repoName'\n> &\n\tRequireSomeWithProps<RequireSome<RepositoryIdentityDescriptor<string>, 'remote'>, 'remote', 'domain'>;\n"],"mappings":";;;;;;AAmHO,IAAM,cAAA,eAAN,MAAM,YAAwC;CAInC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;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|
|
1
|
+
{"version":3,"file":"pullRequest.js","names":[],"sources":["../../../../git/src/models/pullRequest.ts"],"sourcesContent":["import { formatDate, fromNow } from '@gitlens/utils/date.js';\nimport { loggable } from '@gitlens/utils/decorators/log.js';\nimport { serializable } from '@gitlens/utils/decorators/serializable.js';\nimport type { RequireSome, RequireSomeWithProps } from '@gitlens/utils/types.js';\nimport type { IssueProject, IssueRepository } from './issue.js';\nimport type {\n\tIssueMilestone,\n\tIssueOrPullRequest,\n\tIssueOrPullRequestState as PullRequestState,\n} from './issueOrPullRequest.js';\nimport type { ProviderReference } from './remoteProvider.js';\nimport type { RepositoryIdentityDescriptor } from './repositoryIdentities.js';\n\nexport type { PullRequestState };\n\n/**\n * The read that produced a pull request row, as a key for `getPullRequestFieldPresence` (`@gitlens/integrations`). It\n * names a READ, not a field set: the same tag can carry different fields on different providers.\n */\nexport type PullRequestProjection =\n\t/** A single-item read: by number, for a branch, or for a commit. */\n\t| 'point'\n\t/** The filtered search with the full projection, and the host's \"my pull requests\" search. */\n\t| 'search'\n\t/** The filtered search with `summary`. */\n\t| 'search-summary'\n\t/** The free-text search (`searchPullRequests`). */\n\t| 'text-search'\n\t/** An account-wide sweep with the full projection (`includeReviews`). */\n\t| 'account'\n\t/** An account-wide list or sweep with the lightweight projection. */\n\t| 'account-summary'\n\t/** A repository-scoped list or sweep. */\n\t| 'repos'\n\t/** A repository-scoped list with `summary`. */\n\t| 'repos-summary'\n\t/** The coordinate and branch batch reads. */\n\t| 'batch';\n\nexport interface PullRequestShape extends IssueOrPullRequest {\n\treadonly state: PullRequestState;\n\treadonly author: PullRequestMember;\n\t/**\n\t * Canonical base-repository identity returned by the provider. Some providers\n\t * scope pull-request ids to a repository, so consumers must not have to infer\n\t * identity from optional refs or URLs.\n\t */\n\treadonly repository?: IssueRepository;\n\treadonly mergedDate?: Date;\n\treadonly refs?: PullRequestRefs;\n\treadonly isDraft?: boolean;\n\treadonly additions?: number;\n\treadonly deletions?: number;\n\treadonly filesChanged?: number;\n\treadonly body?: string;\n\treadonly mergeableState?: PullRequestMergeableState;\n\treadonly reviewDecision?: PullRequestReviewDecision;\n\treadonly reviewRequests?: PullRequestReviewer[];\n\t/**\n\t * Reviews already submitted, as opposed to the still-pending {@link reviewRequests}. Absent means the read\n\t * didn't fetch reviews; empty means nobody has reviewed — but only where the read actually fetched them, which\n\t * is provider- and read-dependent: ask `getPullRequestFieldPresence` (`@gitlens/integrations`) for the row's\n\t * `reviews` group rather than trusting an empty array.\n\t * {@link PullRequestReviewer.commitOid} is the narrower promise: only the full GitHub/GHE projection has it.\n\t */\n\treadonly latestReviews?: PullRequestReviewer[];\n\treadonly assignees?: PullRequestMember[];\n\treadonly project?: IssueProject;\n\treadonly stack?: PullRequestStackInfo;\n\t/**\n\t * The pull request's place in its base branch's merge queue. Absent means either not queued or not fetched — ask\n\t * `getPullRequestFieldPresence` (`@gitlens/integrations`) for the row's `mergeQueue` group to tell them apart.\n\t * Only GitHub.com reports one.\n\t */\n\treadonly mergeQueue?: PullRequestMergeQueueEntry;\n\t/**\n\t * Whether the base branch accepts this pull request only through a merge queue, so merging it means adding it to\n\t * the queue. `undefined` means not read; read wherever `mergeQueue` is (the same `mergeQueue` field group).\n\t */\n\treadonly mergeQueueRequired?: boolean;\n\t/**\n\t * The pull request's latest removal from its merge queue, set only while that removal is its latest merge-queue\n\t * event (it hasn't rejoined since) and the removal didn't merge it. It stays set however much later the pull\n\t * request changes, so ask `isPullRequestMergeQueueRemovalCurrent` whether it still describes the pull request.\n\t * Read wherever `mergeQueue` is (the same `mergeQueue` field group); absent there means no such removal.\n\t */\n\treadonly mergeQueueRemoval?: PullRequestMergeQueueRemoval;\n\t/**\n\t * The head commit's individual check results. `undefined` means not read; empty means read and the head has no\n\t * checks. Only GitHub and GitHub Enterprise read them, and only for a read that asks (`checkRuns`); ask\n\t * `getPullRequestFieldPresence` (`@gitlens/integrations`) for the row's `checkRuns` group.\n\t */\n\treadonly checkRuns?: readonly PullRequestCheckRun[];\n\t/** Set when the head has more checks than {@link checkRuns} holds. Read wherever `checkRuns` is. */\n\treadonly checkRunsTruncated?: true;\n\treadonly number?: number;\n\treadonly authoredByMe?: boolean;\n\t/**\n\t * The current account as this pull request's members identify it: the identity its people were matched against,\n\t * present whenever it was resolved (see {@link viewerUnresolved} for an Azure DevOps row it couldn't be for). {@link authoredByMe} is matched against it too, and stays `undefined` when the\n\t * row has no author, though its reviewers or assignees still get this. A consumer matching {@link reviewRequests}\n\t * or {@link latestReviews} entries to the current user compares against this, not the account `getCurrentAccount`\n\t * returns: Azure DevOps can know one person by another id in each organization (Azure DevOps Server: collection)\n\t * than the account's, and the members carry the organization's. Core matches `username` too only on GitHub and\n\t * GitHub Enterprise, whose rows key people by login.\n\t */\n\treadonly viewer?: { readonly id: string; readonly username?: string };\n\t/**\n\t * Set, and only ever `true`, on an Azure DevOps row that names someone (its author, a reviewer or an assignee)\n\t * whose organization's (Azure DevOps Server: collection's) identity the read tried and failed to resolve: its\n\t * `ConnectionData` failed, answered without an identity, or didn't answer within 10 seconds. Such a row has neither\n\t * {@link viewer} nor {@link authoredByMe}, and neither the account `getCurrentAccount` returns nor anyone else can\n\t * be matched against its people: whether it is the current user's, or asks for their review, is unknown, not \"no\".\n\t * Absent everywhere else, so a row with neither field is still one whose identity wasn't resolved for another\n\t * reason (a read that doesn't resolve it, or a failed account read), as before.\n\t */\n\treadonly viewerUnresolved?: true;\n\t/** The read that produced this row. Absent means unknown: a legacy row, or a provider or read not yet tagged. */\n\treadonly projection?: PullRequestProjection;\n}\n\n@loggable(i => i.id)\n@serializable\nexport class PullRequest implements PullRequestShape {\n\treadonly type = 'pullrequest';\n\n\tconstructor(\n\t\tpublic readonly provider: ProviderReference,\n\t\tpublic readonly author: PullRequestMember,\n\t\tpublic readonly id: string,\n\t\tpublic readonly nodeId: string | undefined,\n\t\tpublic readonly title: string,\n\t\tpublic readonly url: string,\n\t\tpublic readonly repository: IssueRepository,\n\t\tpublic readonly state: PullRequestState,\n\t\tpublic readonly createdDate: Date,\n\t\tpublic readonly updatedDate: Date,\n\t\tpublic readonly closedDate?: Date,\n\t\tpublic readonly mergedDate?: Date,\n\t\tpublic readonly mergeableState?: PullRequestMergeableState,\n\t\tpublic readonly viewerCanUpdate?: boolean,\n\t\tpublic readonly refs?: PullRequestRefs,\n\t\tpublic readonly isDraft?: boolean,\n\t\tpublic readonly additions?: number,\n\t\tpublic readonly deletions?: number,\n\t\tpublic readonly commentsCount?: number,\n\t\tpublic readonly thumbsUpCount?: number,\n\t\tpublic readonly reviewDecision?: PullRequestReviewDecision,\n\t\tpublic readonly reviewRequests?: PullRequestReviewer[],\n\t\tpublic readonly latestReviews?: PullRequestReviewer[],\n\t\tpublic readonly assignees?: PullRequestMember[],\n\t\tpublic readonly statusCheckRollupState?: PullRequestStatusCheckRollupState,\n\t\tpublic readonly project?: IssueProject,\n\t\tpublic readonly version?: number,\n\t\t/** Commits on the head that aren't on the base. Appended rather than slotted with the other counts:\n\t\t * this constructor is positional and every mapper passes through it. */\n\t\tpublic readonly commitCount?: number,\n\t\tpublic readonly stack?: PullRequestStackInfo,\n\t\tpublic readonly filesChanged?: number,\n\t\t/** The pull request's description, as markdown. */\n\t\tpublic readonly body?: string,\n\t\tpublic readonly number?: number,\n\t\tpublic readonly authoredByMe?: boolean,\n\t\tpublic readonly projection?: PullRequestProjection,\n\t\tpublic readonly viewer?: { readonly id: string; readonly username?: string },\n\t\tpublic readonly viewerUnresolved?: true,\n\t\tpublic readonly milestone?: IssueMilestone | null,\n\t\tpublic readonly mergeQueue?: PullRequestMergeQueueEntry,\n\t\tpublic readonly mergeQueueRequired?: boolean,\n\t\tpublic readonly mergeQueueRemoval?: PullRequestMergeQueueRemoval,\n\t\tpublic readonly checkRuns?: readonly PullRequestCheckRun[],\n\t\tpublic readonly checkRunsTruncated?: true,\n\t) {}\n\n\tget closed(): boolean {\n\t\treturn this.state === 'closed';\n\t}\n\n\tstatic is(pr: unknown): pr is PullRequest {\n\t\treturn pr instanceof PullRequest;\n\t}\n\n\tstatic formatDate(pr: PullRequestShape, format?: string | null): string {\n\t\treturn formatDate(pr.mergedDate ?? pr.closedDate ?? pr.updatedDate, format ?? 'MMMM Do, YYYY h:mma');\n\t}\n\n\tstatic formatDateFromNow(pr: PullRequestShape): string {\n\t\treturn fromNow(pr.mergedDate ?? pr.closedDate ?? pr.updatedDate);\n\t}\n\n\tstatic formatDateWithStyle(\n\t\tpr: PullRequestShape,\n\t\tformatting: { dateStyle: string; dateFormat: string | null },\n\t): string {\n\t\treturn formatting.dateStyle === 'absolute'\n\t\t\t? PullRequest.formatDate(pr, formatting.dateFormat)\n\t\t\t: PullRequest.formatDateFromNow(pr);\n\t}\n}\n\nexport const enum PullRequestReviewDecision {\n\tApproved = 'Approved',\n\tChangesRequested = 'ChangesRequested',\n\tReviewRequired = 'ReviewRequired',\n}\n\nexport const enum PullRequestMergeableState {\n\tUnknown = 'Unknown',\n\tMergeable = 'Mergeable',\n\tConflicting = 'Conflicting',\n\tFailingChecks = 'FailingChecks',\n\tBlockedByPolicy = 'BlockedByPolicy',\n}\n\n/** Where a queued pull request stands in its merge queue. Mirrors GitHub's `MergeQueueEntryState`. */\nexport const enum PullRequestMergeQueueState {\n\tQueued = 'Queued',\n\t/** Waiting for its required checks to pass. */\n\tAwaitingChecks = 'AwaitingChecks',\n\tMergeable = 'Mergeable',\n\tUnmergeable = 'Unmergeable',\n\tLocked = 'Locked',\n}\n\nexport const enum PullRequestStatusCheckRollupState {\n\tSuccess = 'success',\n\tPending = 'pending',\n\tFailed = 'failed',\n}\n\nexport const enum PullRequestMergeMethod {\n\tMerge = 'merge',\n\tSquash = 'squash',\n\tRebase = 'rebase',\n}\n\nexport const enum PullRequestReviewState {\n\tApproved = 'APPROVED',\n\tChangesRequested = 'CHANGES_REQUESTED',\n\tCommented = 'COMMENTED',\n\tDismissed = 'DISMISSED',\n\tPending = 'PENDING',\n\tReviewRequested = 'REVIEW_REQUESTED',\n}\n\nexport interface PullRequestComparisonRefs {\n\trepoPath: string;\n\tbase: { ref: string; label: string };\n\thead: { ref: string; label: string };\n}\n\nexport interface PullRequestMember {\n\tid: string;\n\t/**\n\t * Absent when the provider exposes no display name for the member — same contract as `IssueMember.name`: a\n\t * fallback invented here can't be told apart from a real name downstream, so each consumer picks its own\n\t * presentation.\n\t */\n\tname?: string;\n\t/** The provider's handle for this person, when it has one — GitHub's login, Azure's `uniqueName` (a UPN,\n\t * so an email), Bitbucket's mutable `nickname`. Display/labelling only: it is neither guaranteed present\n\t * (GitLab's native mapper has none) nor a stable identity, so never key a match off it. */\n\tusername?: string;\n\tavatarUrl?: string;\n\turl?: string;\n}\n\n/** Provider-neutral relationship facets shared by PR listings and filtered PR search. */\nexport enum PullRequestFilter {\n\tAuthor = 'author',\n\tAssignee = 'assignee',\n\tReviewRequested = 'review-requested',\n\t/**\n\t * PRs the user has already reviewed (GitHub `reviewed-by:@me`), as opposed to `ReviewRequested` (a\n\t * still-pending request). Distinguishes \"waiting on the author after my review\" from \"waiting for my\n\t * review\". Not expressible on the repo-scoped listing — no provider SDK exposes a reviewed-by axis there —\n\t * so it is advertised for the account-wide read and for the filtered search (which can still bound itself\n\t * to repositories or an org), never under `supportedPullRequestFilters`.\n\t */\n\tReviewed = 'reviewed-by',\n\tMention = 'mention',\n}\n\n/** Selects which pull request states a read should include. `all` covers open + closed + merged. */\nexport type PullRequestStateFilter = 'open' | 'closed' | 'merged' | 'all';\n\n/**\n * A field a pull-request read can be ordered by, provider-neutral.\n *\n * Only two, and deliberately so — unlike {@link IssueSortField} this is the INTERSECTION of what GitHub's PR\n * search can order by server-side and what a {@link PullRequestShape} carries, because the filtered PR search\n * always merges its relationship × state facets in the facade and so must re-order the union itself (see\n * `getPullRequestComparator`). `created` and `updated` are both. A field GitHub cannot order PRs by, or one a\n * merged page can't reproduce, is left out rather than advertised and then approximated: relevance is unstable\n * and has no comparable value on a merge, and priority is not a pull-request concept on any provider that has PRs.\n */\nexport type PullRequestSortField =\n\t/** Creation date. */\n\t| 'created'\n\t/** Last activity. */\n\t| 'updated';\n\n/**\n * How a pull-request read is ordered, as `field:direction` — the same serializable shape {@link IssueSorting}\n * and `BranchSorting` use, so a consumer can persist it, compare it, or bind it straight to a setting or dropdown.\n */\nexport type PullRequestSorting = `${PullRequestSortField}:asc` | `${PullRequestSortField}:desc`;\n\n/**\n * The order the filtered pull-request search applies when the caller asks for none: most recently updated first,\n * which is what it served before ordering was an option. Named once rather than per layer — the criteria model\n * documents it, the GitHub query emits it, and the result-ceiling warning quotes it — so the three cannot\n * disagree about what \"the default\" is.\n */\nexport const defaultPullRequestSort: PullRequestSorting = 'updated:desc';\n\n/**\n * What the filtered pull-request search narrows on.\n *\n * Structured rather than a provider query string so callers can send free text without giving it a qualifier\n * channel, and can check {@link PullRequestSearchCapabilities} before issuing a read. Every requested criterion\n * is validated all-or-nothing before the provider runs; unsupported criteria never fall through to a wider\n * result set whose paging would no longer describe the returned items.\n *\n * Relationships are OR-ed, as are states. Omitting `relationships` removes the current-user constraint, which is\n * only safe when the manager call supplies a repository or organization scope. Omitting `states` reads open PRs.\n */\nexport interface PullRequestSearchCriteria {\n\t/**\n\t * Free text matched by the provider's own relevance rules. Tokens that look like provider qualifiers are\n\t * removed before the query is built, so text cannot change the search's scope or state.\n\t */\n\ttext?: string;\n\t/** Current-user relationship facets to union. Empty/omitted means no relationship constraint. */\n\trelationships?: PullRequestFilter[];\n\t/** Pull request states to union. Empty/omitted reads open PRs; `all` subsumes every other member. */\n\tstates?: PullRequestStateFilter[];\n\t/** ISO date (`YYYY-MM-DD`). The most effective narrowing criterion by far on a large scope. */\n\tupdatedAfter?: string;\n\t/** ISO date (`YYYY-MM-DD`). */\n\tcreatedAfter?: string;\n\t/** Includes PRs from archived repositories. They are excluded by default. */\n\tincludeArchived?: boolean;\n\t/**\n\t * Narrows on draft state: `true` returns only drafts, `false` only ready-for-review PRs. Omitted places no\n\t * constraint. A boolean rather than a truthy flag because `false` is a distinct request, not the absence of one.\n\t */\n\tdraft?: boolean;\n\t/**\n\t * How to order the results. Omitted means `updated:desc`, which is what this search has always served.\n\t *\n\t * Validated all-or-nothing against {@link PullRequestSearchCapabilities.sorts} like every other criterion: a\n\t * key the provider can't express server-side refuses the WHOLE read rather than falling back to the default,\n\t * because combined with the provider's result ceiling another order returns a different subset than was asked\n\t * for and the paging that comes with it describes that other subset. Do not change it mid-pagination — a\n\t * cursor carries the sort it was produced under; drop the cursor instead of threading it under a new key.\n\t */\n\tsort?: PullRequestSorting;\n}\n\n/**\n * Which {@link PullRequestSearchCriteria} fields and manager-level scopes a provider can express server-side.\n * An empty `relationships` means the provider has no filtered PR search at all.\n */\nexport interface PullRequestSearchCapabilities {\n\t/** Current-user relationship facets the provider can union. Empty means the search itself is unsupported. */\n\trelationships: PullRequestFilter[];\n\t/** Individual state values the provider can union in one logical search. */\n\tstates: PullRequestStateFilter[];\n\ttext: boolean;\n\tupdatedAfter: boolean;\n\tcreatedAfter: boolean;\n\tincludeArchived: boolean;\n\t/** Whether the provider can constrain the search by draft state server-side. */\n\tdraft: boolean;\n\t/** Whether the manager's repository-descriptor scope is supported. */\n\trepositoryScope: boolean;\n\t/** Whether the manager's organization scope is supported. */\n\torganizationScope: boolean;\n\t/**\n\t * Sort keys the search can express server-side. Always contains at least `updated:desc` — the historical\n\t * default — when the search exists at all, so it is never empty for a usable surface; a provider without a\n\t * filtered PR search reports an empty `relationships`, which is already the signal there is no surface to order.\n\t */\n\tsorts: PullRequestSorting[];\n}\n\nexport interface PullRequestRef {\n\t/**\n\t * `undefined` when the ref's repository was deleted (a removed fork): GitHub's rows say so, with `exists` false.\n\t * provider-apis' converters fill `''` instead, so test for a value rather than for `undefined`.\n\t */\n\towner: string | undefined;\n\t/**\n\t * The repository's name, never a path: a GitLab nested group is all {@link owner}. `undefined` (or `''`) when the\n\t * ref's repository was deleted, as {@link owner}.\n\t */\n\trepo: string | undefined;\n\tbranch: string;\n\tsha: string;\n\texists: boolean;\n\t/**\n\t * Web URL of the ref's repository. `undefined` when the provider cannot resolve it — Azure DevOps embeds an\n\t * abbreviated repository reference in a pull request, so a fork's URL may need a lookup that can fail.\n\t */\n\turl: string | undefined;\n\t/** HTTPS clone URL of the ref's repository, when the provider exposes it. */\n\tcloneHttps?: string;\n\t/** SSH clone URL of the ref's repository, when the provider exposes it. */\n\tcloneSsh?: string;\n\t/** Best-effort flag: whether the ref's repository is a fork. `undefined` when the provider can't tell. */\n\tisFork?: boolean;\n}\n\nexport interface PullRequestRefs {\n\tbase: PullRequestRef & { url: string };\n\thead: PullRequestRef;\n\tisCrossRepository: boolean;\n}\n\n/**\n * A pull request's membership in a stack — an ordered chain of dependent pull requests where each\n * targets the branch of the one below it.\n *\n * `baseRef` is the stack's ultimate target (its trunk) and is NOT the same as `refs.base`, which for\n * anything above the bottom layer names the layer below. Use `refs.base` to diff a single layer; use\n * `baseRef` to answer where the work ultimately lands.\n */\nexport interface PullRequestStackInfo {\n\t/**\n\t * Opaque, and NOT comparable across read paths: GitHub's GraphQL selection returns a node id\n\t * (`PRS_kwDO…`) while its REST stacks endpoint returns a numeric id (`1347135`) that we stringify —\n\t * both verified against the same live stack. Use {@link number} to identify a stack; two views of one\n\t * stack agree there and will not agree here.\n\t */\n\tid: string;\n\t/** Identifies the stack within its repository. */\n\tnumber: number;\n\t/** Total pull requests in the stack. */\n\tsize: number;\n\t/** This pull request's layer, 1-based, where 1 is closest to `baseRef`. */\n\tposition: number;\n\t/** The branch the bottom of the stack targets. */\n\tbaseRef: string;\n}\n\n/**\n * One layer of a stack — the pull request occupying it, and the head ref a rebase or push needs to act\n * on. Unlike {@link PullRequestStackInfo}, which locates a single pull request within a stack, this is\n * the per-layer detail a caller walking the whole stack needs, e.g. to cascade a rebase bottom to top.\n */\nexport interface PullRequestStackLayer {\n\t/** The pull request's number. */\n\tnumber: number;\n\t/** The pull request's head branch name, without a remote prefix. */\n\theadRef: string;\n\t/** The head branch's tip when the stack was read. */\n\theadSha: string;\n\t/** `true` once this layer has landed. */\n\tmerged: boolean;\n\t/** `true` while this layer is still a draft. */\n\tdraft: boolean;\n}\n\n/**\n * A stack's layers, ordered bottom to top. `baseRef` is the stack's ultimate target (its trunk), the\n * same distinction drawn on {@link PullRequestStackInfo} — it is NOT the base of any individual layer\n * above the bottom, which targets the layer below it instead.\n */\nexport interface PullRequestStackLayers {\n\t/** Opaque and not comparable across read paths — see {@link PullRequestStackInfo.id}. */\n\tid: string;\n\tnumber: number;\n\t/** The branch the bottom of the stack targets. */\n\tbaseRef: string;\n\t/** The stack's layers, ordered bottom (closest to {@link baseRef}) to top. */\n\tlayers: PullRequestStackLayer[];\n}\n\n/** A pull request's entry in its base branch's merge queue. */\nexport interface PullRequestMergeQueueEntry {\n\tstate: PullRequestMergeQueueState;\n\t/** When the pull request joined the queue. */\n\tenqueuedAt: Date;\n\t/**\n\t * When the provider expects it to merge: its estimate of the time remaining, fixed to a date when the entry was\n\t * read, so it counts down while the entry is held rather than restarting at each render. Absent when the provider\n\t * gives none; may already be past on an entry held a while.\n\t */\n\testimatedMergeAt?: Date;\n\t/** The merge queue's web URL. */\n\turl?: string;\n\t/**\n\t * The entry's 1-based place in the queue, in enqueue order. Absent when the provider gives none. It moves as the\n\t * entries ahead of it merge or leave, so it is never an etag input: an `unchanged` row's position can be stale.\n\t */\n\tposition?: number;\n}\n\n/** A pull request's removal from its base branch's merge queue, other than by merging. */\nexport interface PullRequestMergeQueueRemoval {\n\t/**\n\t * The provider's own reason, passed through as given — GitHub's include `failed_checks` and `manual`, and others\n\t * are undocumented. Empty when the provider gives none. Classify it with `getPullRequestMergeQueueRemovalKind`.\n\t */\n\treason: string;\n\t/** When the pull request was removed. */\n\tremovedAt: Date;\n}\n\n/** One check on a pull request's head commit: a check run, or a commit status. */\nexport interface PullRequestCheckRun {\n\t/** Opaque: compare for equality or hand back to core, never parse. */\n\treadonly id: string;\n\treadonly kind: 'check-run' | 'status';\n\t/** A check run's name, or a commit status's context. */\n\treadonly name: string;\n\t/** The workflow an Actions check run belongs to. */\n\treadonly workflowName?: string;\n\treadonly status: PullRequestCheckRunStatus;\n\t/** Set once `status` is `completed`. */\n\treadonly conclusion?: PullRequestCheckRunConclusion;\n\treadonly url?: string;\n\t/** Whether the base branch requires it to pass. `undefined` means not read (only GitHub.com reads it). */\n\treadonly required?: boolean;\n\treadonly startedAt?: Date;\n\treadonly completedAt?: Date;\n\t/** Whether the check has output or a job log to read. */\n\treadonly hasLog: boolean;\n}\n\nexport type PullRequestCheckRunStatus = 'queued' | 'in-progress' | 'waiting' | 'pending' | 'requested' | 'completed';\n\nexport type PullRequestCheckRunConclusion =\n\t| 'success'\n\t| 'failure'\n\t| 'neutral'\n\t| 'cancelled'\n\t| 'skipped'\n\t| 'timed-out'\n\t| 'action-required'\n\t| 'stale'\n\t| 'startup-failure'\n\t| 'error';\n\n/** A check's log tail, or why it has none. Exactly one of `log` and `unavailable` is set. */\nexport type PullRequestCheckLog =\n\t| { readonly log: PullRequestCheckLogText; readonly unavailable?: never }\n\t| { readonly unavailable: PullRequestCheckLogUnavailableReason; readonly log?: never };\n\n/** The last lines of a check's log. `truncated` means earlier lines exist that `text` doesn't hold. */\nexport interface PullRequestCheckLogText {\n\treadonly text: string;\n\treadonly lineCount: number;\n\treadonly truncated: boolean;\n\t/** An Actions job's log, or another check run's output (its title, summary and text). */\n\treadonly source: 'actions-job-log' | 'check-run-output';\n}\n\n/**\n * `'no-log'`: the check has nothing to read. `'log-not-ready'`: its job is still running. `'log-expired'`: its job\n * finished but the host no longer keeps the log. `'log-too-large'`: the host would only serve the log whole, and it is\n * larger than a read takes, so its last lines can't be told apart from its middle.\n */\nexport type PullRequestCheckLogUnavailableReason = 'no-log' | 'log-not-ready' | 'log-expired' | 'log-too-large';\n\n/** Why adding a pull request to its merge queue, or removing it, failed. */\nexport type PullRequestMergeQueueActionFailureReason =\n\t/** Adding a pull request that is already queued. */\n\t| 'already-queued'\n\t/** The pull request's head moved since it was read, so the head it was asked to queue is stale. */\n\t| 'head-changed'\n\t/** The host refused the action for the pull request's own state: its base branch has no merge queue, it is a\n\t * draft or closed, or it doesn't meet the queue's requirements. */\n\t| 'not-allowed'\n\t/** The account may not add to or remove from this queue. */\n\t| 'permission'\n\t/** The host (or this integration) has no merge queue to act on. */\n\t| 'unsupported'\n\t/** Anything else, including a failure to reach the host. */\n\t| 'unknown';\n\n/**\n * What adding a pull request to its merge queue, or removing it, did. A failure says why, with the host's own message\n * when it gave one — for logs and diagnostics, not for display.\n */\nexport type PullRequestMergeQueueActionResult =\n\t| {\n\t\t\treadonly status: 'queued';\n\t\t\t/** The new entry, when the host returned one. */\n\t\t\treadonly entry?: PullRequestMergeQueueEntry;\n\t }\n\t| { readonly status: 'dequeued' }\n\t| {\n\t\t\treadonly status: 'failed';\n\t\t\treadonly reason: PullRequestMergeQueueActionFailureReason;\n\t\t\treadonly message?: string;\n\t };\n\nexport interface PullRequestReviewer {\n\tisCodeOwner?: boolean;\n\treviewer: PullRequestMember;\n\tstate: PullRequestReviewState;\n\t/**\n\t * The head commit oid this review was submitted against (GitHub). Lets a consumer tell \"the PR moved past\n\t * my review\" (oid !== the PR's current head) from a review still at the tip — without a per-review\n\t * timestamp. Only populated where the full GitHub/GHE projection is selected: the filtered search read, and\n\t * an account-wide sweep that opts in with `includeReviews`. Undefined elsewhere, including reviews the\n\t * repo-scoped read carries natively.\n\t */\n\tcommitOid?: string;\n\t/**\n\t * The reviewer is a group the current user is a member of (a team or another group, directly or through a group\n\t * nested in it) rather than a person: a request to it is one the user can answer as a member, not one addressed to\n\t * them by name. Only the Azure DevOps reads that resolve the user's groups set it; absent elsewhere, including for\n\t * groups a read could not tell the user belongs to.\n\t */\n\tisMyGroup?: boolean;\n}\n\nexport type PullRequestRepositoryIdentityDescriptor = RequireSomeWithProps<\n\tRequireSome<RepositoryIdentityDescriptor<string>, 'provider'>,\n\t'provider',\n\t'id' | 'domain' | 'repoDomain' | 'repoName'\n> &\n\tRequireSomeWithProps<RequireSome<RepositoryIdentityDescriptor<string>, 'remote'>, 'remote', 'domain'>;\n"],"mappings":";;;;;;AA2HO,IAAM,cAAA,eAAN,MAAM,YAAwC;CAInC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CA/CjB,OAAgB;CAEhB,YACC,UACA,QACA,IACA,QACA,OACA,KACA,YACA,OACA,aACA,aACA,YACA,YACA,gBACA,iBACA,MACA,SACA,WACA,WACA,eACA,eACA,gBACA,gBACA,eACA,WACA,wBACA,SACA,SAGA,aACA,OACA,cAEA,MACA,QACA,cACA,YACA,QACA,kBACA,WACA,YACA,oBACA,mBACA,WACA,oBACC;EA7Ce,KAAA,WAAA;EACA,KAAA,SAAA;EACA,KAAA,KAAA;EACA,KAAA,SAAA;EACA,KAAA,QAAA;EACA,KAAA,MAAA;EACA,KAAA,aAAA;EACA,KAAA,QAAA;EACA,KAAA,cAAA;EACA,KAAA,cAAA;EACA,KAAA,aAAA;EACA,KAAA,aAAA;EACA,KAAA,iBAAA;EACA,KAAA,kBAAA;EACA,KAAA,OAAA;EACA,KAAA,UAAA;EACA,KAAA,YAAA;EACA,KAAA,YAAA;EACA,KAAA,gBAAA;EACA,KAAA,gBAAA;EACA,KAAA,iBAAA;EACA,KAAA,iBAAA;EACA,KAAA,gBAAA;EACA,KAAA,YAAA;EACA,KAAA,yBAAA;EACA,KAAA,UAAA;EACA,KAAA,UAAA;EAGA,KAAA,cAAA;EACA,KAAA,QAAA;EACA,KAAA,eAAA;EAEA,KAAA,OAAA;EACA,KAAA,SAAA;EACA,KAAA,eAAA;EACA,KAAA,aAAA;EACA,KAAA,SAAA;EACA,KAAA,mBAAA;EACA,KAAA,YAAA;EACA,KAAA,aAAA;EACA,KAAA,qBAAA;EACA,KAAA,oBAAA;EACA,KAAA,YAAA;EACA,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BAAA;CACA,uBAAA,eAAA;CACA,uBAAA,eAAA;CACA,uBAAA,aAAA;CACA,uBAAA,qBAAA;;AACD,EAAA,CAAA,CAAA;;AAyBA,IAAY,oBAAL,yBAAA,mBAAA;CACN,kBAAA,YAAA;CACA,kBAAA,cAAA;CACA,kBAAA,qBAAA;;;;;;;;CAQA,kBAAA,cAAA;CACA,kBAAA,aAAA;;AACD,EAAA,CAAA,CAAA;;;;;;;AAiCA,MAAa,yBAA6C"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region ../git/src/models/pullRequestActivity.d.ts
|
|
2
|
+
/** Who wrote a pull request activity item. GitHub reports no author for a deleted account. */
|
|
3
|
+
export interface PullRequestActivityAuthor {
|
|
4
|
+
readonly login: string;
|
|
5
|
+
readonly url?: string;
|
|
6
|
+
readonly isBot: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface PullRequestActivityItemBase {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly url: string;
|
|
11
|
+
readonly author?: PullRequestActivityAuthor;
|
|
12
|
+
/** When it was published: a review's submission, and for an inline comment its review's. */
|
|
13
|
+
readonly publishedAt: Date;
|
|
14
|
+
/** Written by the connection's own account. */
|
|
15
|
+
readonly byViewer: boolean;
|
|
16
|
+
readonly isMinimized: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** A submitted review. Its inline comments follow it as `review-comment` items. */
|
|
19
|
+
export interface PullRequestActivityReview extends PullRequestActivityItemBase {
|
|
20
|
+
readonly kind: 'review';
|
|
21
|
+
readonly state: 'approved' | 'changes-requested' | 'commented' | 'dismissed';
|
|
22
|
+
readonly body: string;
|
|
23
|
+
readonly commitSha?: string;
|
|
24
|
+
/** The review has more inline comments than were returned. */
|
|
25
|
+
readonly commentsTruncated?: true;
|
|
26
|
+
}
|
|
27
|
+
/** An inline comment of the review named by `reviewId`. `inReplyTo` is the comment it answers in its thread. */
|
|
28
|
+
export interface PullRequestActivityReviewComment extends PullRequestActivityItemBase {
|
|
29
|
+
readonly kind: 'review-comment';
|
|
30
|
+
readonly reviewId: string;
|
|
31
|
+
readonly body: string;
|
|
32
|
+
readonly path: string;
|
|
33
|
+
readonly line?: number;
|
|
34
|
+
readonly startLine?: number;
|
|
35
|
+
readonly originalLine?: number;
|
|
36
|
+
readonly outdated: boolean;
|
|
37
|
+
readonly inReplyTo?: string;
|
|
38
|
+
readonly commitSha?: string;
|
|
39
|
+
}
|
|
40
|
+
/** A comment on the pull request's conversation. */
|
|
41
|
+
export interface PullRequestActivityComment extends PullRequestActivityItemBase {
|
|
42
|
+
readonly kind: 'comment';
|
|
43
|
+
readonly body: string;
|
|
44
|
+
}
|
|
45
|
+
export type PullRequestActivityItem = PullRequestActivityReview | PullRequestActivityReviewComment | PullRequestActivityComment;
|
|
46
|
+
/** One pull request's activity after a cursor, oldest first. */
|
|
47
|
+
export interface PullRequestActivityPage {
|
|
48
|
+
readonly items: readonly PullRequestActivityItem[];
|
|
49
|
+
/** Opaque: send it back as the next read's cursor. */
|
|
50
|
+
readonly cursor: string;
|
|
51
|
+
/** More items follow this page. */
|
|
52
|
+
readonly hasMore: boolean;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//# sourceMappingURL=pullRequestActivity.d.ts.map
|
|
File without changes
|
|
@@ -297,7 +297,9 @@ function serializePullRequest(value) {
|
|
|
297
297
|
mergeQueueRemoval: value.mergeQueueRemoval ? {
|
|
298
298
|
reason: value.mergeQueueRemoval.reason,
|
|
299
299
|
removedAt: value.mergeQueueRemoval.removedAt
|
|
300
|
-
} : void 0
|
|
300
|
+
} : void 0,
|
|
301
|
+
checkRuns: value.checkRuns?.map((run) => ({ ...run })),
|
|
302
|
+
checkRunsTruncated: value.checkRunsTruncated
|
|
301
303
|
};
|
|
302
304
|
}
|
|
303
305
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pullRequest.utils.js","names":[],"sources":["../../../../git/src/utils/pullRequest.utils.ts"],"sourcesContent":["import * as l10n from '@vscode/l10n';\nimport { fromNow } from '@gitlens/utils/date.js';\nimport type {\n\tPullRequest,\n\tPullRequestComparisonRefs,\n\tPullRequestMergeQueueEntry,\n\tPullRequestRefs,\n\tPullRequestRepositoryIdentityDescriptor,\n\tPullRequestShape,\n\tPullRequestSortField,\n\tPullRequestSorting,\n\tPullRequestStackInfo,\n} from '../models/pullRequest.js';\nimport { PullRequestMergeQueueState } from '../models/pullRequest.js';\nimport { serializeMilestone } from './issueOrPullRequest.utils.js';\nimport { shortenRevision } from './revision.utils.js';\n\n/** How many pull requests a merge action affects — unstacked is always 1; a stacked merge lands either\n * just this layer and everything below it (`position`), or the whole stack (`wholeStack`). The one\n * source every merge-confirmation and merge-action label counts from, so they can't drift apart.\n * Takes only the two fields it needs (not the full {@link PullRequestStackInfo}) since callers on the\n * webview side carry narrower serialized stack shapes. */\nexport function getStackedMergeCount(\n\tstack: Pick<PullRequestStackInfo, 'position' | 'size'> | undefined,\n\toptions?: { wholeStack?: boolean },\n): number {\n\tif (stack == null) return 1;\n\treturn options?.wholeStack ? stack.size : stack.position;\n}\n\n/** Whether an open pull request is waiting in a merge queue. `false` also when the read didn't fetch the queue —\n * check the row's `mergeQueue` field presence before treating that as \"not queued\". Narrows to the shape's own entry\n * type, since webview shapes carry a serialized one, or to {@link PullRequestMergeQueueEntry} for a shape that\n * doesn't declare one (an `IssueOrPullRequest` that is a pull request). */\nexport function isPullRequestInMergeQueue<T extends { readonly state?: string; readonly mergeQueue?: unknown }>(\n\tpr: T,\n): pr is T & {\n\treadonly mergeQueue: 'mergeQueue' extends keyof T ? NonNullable<T['mergeQueue']> : PullRequestMergeQueueEntry;\n} {\n\treturn pr.state === 'opened' && pr.mergeQueue != null;\n}\n\n/** A pull request's state as shown to users: its provider state, except an open pull request waiting in a merge queue is `queued`. */\nexport function getPullRequestDisplayState<S extends string | undefined>(pr: {\n\treadonly state: S;\n\treadonly mergeQueue?: unknown;\n}): S | 'queued' {\n\treturn isPullRequestInMergeQueue(pr) ? 'queued' : pr.state;\n}\n\n/** A pull request's {@link getPullRequestDisplayState display state} paired with its\n * {@link formatPullRequestMergeQueueStatus merge-queue status}, place in line included, which is set only while it's\n * queued — the pair a pull request chip renders. */\nexport function getPullRequestDisplayStatus<S extends string | undefined>(pr: {\n\treadonly state: S;\n\treadonly mergeQueue?: Parameters<typeof formatPullRequestMergeQueueStatus>[0];\n}): { status: S | 'queued'; queueStatus: string | undefined } {\n\treturn isPullRequestInMergeQueue(pr)\n\t\t? { status: 'queued', queueStatus: formatPullRequestMergeQueueStatus(pr.mergeQueue) }\n\t\t: { status: pr.state, queueStatus: undefined };\n}\n\n/**\n * Describes where a queued pull request stands in its merge queue, with its place in line when the provider gave one\n * (\"#2 in the merge queue, checks running\"). Merging and failing entries read the same with or without a place, since\n * the place no longer says anything there. Takes only the fields it reads, and the estimate as a date or a timestamp\n * (ms), since webview shapes carry a serialized entry.\n */\nexport function formatPullRequestMergeQueueStatus(entry: {\n\treadonly state: PullRequestMergeQueueState;\n\treadonly estimatedMergeAt?: Date | number;\n\treadonly position?: number;\n}): string {\n\tconst position = entry.position;\n\n\tlet status: string;\n\tswitch (entry.state) {\n\t\tcase PullRequestMergeQueueState.AwaitingChecks:\n\t\t\tstatus =\n\t\t\t\tposition != null\n\t\t\t\t\t? l10n.t('#{position} in the merge queue, checks running', { position: position })\n\t\t\t\t\t: l10n.t('Queued to merge, checks running');\n\t\t\tbreak;\n\t\tcase PullRequestMergeQueueState.Mergeable:\n\t\t\tstatus =\n\t\t\t\tposition != null\n\t\t\t\t\t? l10n.t('#{position} in the merge queue, next up', { position: position })\n\t\t\t\t\t: l10n.t('Queued to merge, next up');\n\t\t\tbreak;\n\t\tcase PullRequestMergeQueueState.Locked:\n\t\t\t// The merge is already in flight, so an estimate adds nothing\n\t\t\treturn l10n.t('Merging');\n\t\tcase PullRequestMergeQueueState.Unmergeable:\n\t\t\treturn l10n.t('Failing in the merge queue');\n\t\tdefault:\n\t\t\tstatus =\n\t\t\t\tposition != null\n\t\t\t\t\t? l10n.t('#{position} in the merge queue', { position: position })\n\t\t\t\t\t: l10n.t('Queued to merge');\n\t\t\tbreak;\n\t}\n\n\tif (entry.estimatedMergeAt == null) return status;\n\n\t// An estimate already past is wrong, not late news: \"estimated to merge 2 minutes ago\" would only mislead\n\tconst estimatedMergeAt = new Date(entry.estimatedMergeAt).getTime();\n\tif (Number.isNaN(estimatedMergeAt) || estimatedMergeAt <= Date.now()) return status;\n\n\treturn l10n.t('{0}, estimated to merge {1}', status, fromNow(estimatedMergeAt));\n}\n\n/** When a queued pull request joined its merge queue, as the clause that follows its\n * {@link formatPullRequestMergeQueueStatus status} — \"queued 3 hours ago\" — so a status that ends in an estimate\n * doesn't run straight into a bare date. */\nexport function formatPullRequestMergeQueueEnqueuedFromNow(entry: { readonly enqueuedAt: Date | number }): string {\n\treturn l10n.t('queued {0}', fromNow(entry.enqueuedAt));\n}\n\n/** What a `PullRequestMergeQueueRemoval`'s reason says about the pull request: its queue run `failed`, someone\n * removed it (`manual`), or a reason this doesn't recognize (`other`), which the removal's raw reason still names. */\nexport type PullRequestMergeQueueRemovalKind = 'failed' | 'manual' | 'other';\n\n/**\n * Classifies a merge-queue removal's provider reason. Only the reasons seen from GitHub are recognized —\n * `failed_checks` (its queue run failed) and `manual` — matched without regard to case; every other reason is\n * `other` rather than guessed at, so a caller that shows one can fall back to the raw reason.\n */\nexport function getPullRequestMergeQueueRemovalKind(reason: string): PullRequestMergeQueueRemovalKind {\n\tswitch (reason.toLowerCase()) {\n\t\tcase 'failed_checks':\n\t\t\treturn 'failed';\n\t\tcase 'manual':\n\t\t\treturn 'manual';\n\t\tdefault:\n\t\t\treturn 'other';\n\t}\n}\n\n/**\n * Whether a pull request's merge-queue removal (`mergeQueueRemoval`) still describes it: it is set,\n * the pull request is open and not queued, and nothing has touched the pull request since — its update time is no\n * later than the removal, which GitHub's removal doesn't move. Narrows `mergeQueueRemoval` to set.\n *\n * The trade-off: any later update clears it, not only a push that may have fixed the failure, so a comment or a\n * label added after a failed queue run also stops it reading as failing. A provider's timeline can't say whether a\n * push followed the removal (GitHub orders commits by commit date, not push time), and a stale \"failing\" is worse\n * than a missed one. Takes dates or timestamps (ms), since webview shapes carry serialized ones.\n */\nexport function isPullRequestMergeQueueRemovalCurrent<\n\tT extends {\n\t\treadonly state?: string;\n\t\treadonly updatedDate: Date | number;\n\t\treadonly mergeQueue?: unknown;\n\t\treadonly mergeQueueRemoval?: { readonly removedAt: Date | number };\n\t},\n>(pr: T): pr is T & { readonly mergeQueueRemoval: NonNullable<T['mergeQueueRemoval']> } {\n\tif (pr.mergeQueueRemoval == null || pr.state !== 'opened' || pr.mergeQueue != null) return false;\n\n\tconst removedAt = new Date(pr.mergeQueueRemoval.removedAt).getTime();\n\tconst updatedAt = new Date(pr.updatedDate).getTime();\n\tif (Number.isNaN(removedAt) || Number.isNaN(updatedAt)) return false;\n\n\treturn removedAt >= updatedAt;\n}\n\n/**\n * How each sort field is read off a {@link PullRequestShape}, for the filtered PR search, which MERGES its\n * relationship × state facets in the facade and so has to order the union itself instead of trusting the\n * per-facet server order. Only the fields the shape carries appear — the same rule as `getIssueComparator`, and\n * the reason {@link PullRequestSortField} is just these two.\n */\nconst pullRequestSortValues: Partial<\n\tRecord<PullRequestSortField, (pr: PullRequestShape) => number | Date | string | undefined>\n> = {\n\tcreated: pr => pr.createdDate,\n\tupdated: pr => pr.updatedDate,\n};\n\n/**\n * A comparator for one sort key over normalized pull requests, or `undefined` when the field isn't derivable\n * from a {@link PullRequestShape} — the signal that the key is only honorable on a SINGLE-origin read where the\n * provider already ordered the page. Missing values sort LAST in both directions (partitioned before any\n * arithmetic so two missing values compare equal, exactly as `getIssueComparator` does).\n *\n * Note it orders whatever it is handed. Sorting a page already capped at the result ceiling does not make it the\n * top N.\n */\nexport function getPullRequestComparator(\n\tsort: PullRequestSorting,\n): ((a: PullRequestShape, b: PullRequestShape) => number) | undefined {\n\tconst [field, direction] = sort.split(':') as [PullRequestSortField, 'asc' | 'desc'];\n\tconst getValue = pullRequestSortValues[field];\n\tif (getValue == null) return undefined;\n\n\treturn (a, b) => {\n\t\tconst left = toComparable(getValue(a));\n\t\tconst right = toComparable(getValue(b));\n\t\tif (left == null || right == null) {\n\t\t\tif (left == null && right == null) return 0;\n\n\t\t\treturn left == null ? 1 : -1;\n\t\t}\n\n\t\tconst ordered = left < right ? -1 : left > right ? 1 : 0;\n\t\treturn direction === 'asc' ? ordered : -ordered;\n\t};\n}\n\nfunction toComparable(value: number | Date | string | undefined): number | string | undefined {\n\treturn value instanceof Date ? value.getTime() : value;\n}\n\nexport interface PullRequestUrlIdentity<TProvider extends string = string> {\n\tprovider?: TProvider;\n\n\townerAndRepo?: string;\n\tprNumber: string;\n}\n\nexport function getComparisonRefsForPullRequest(repoPath: string, prRefs: PullRequestRefs): PullRequestComparisonRefs {\n\tconst refs: PullRequestComparisonRefs = {\n\t\trepoPath: repoPath,\n\t\tbase: { ref: prRefs.base.sha, label: `${prRefs.base.branch} (${shortenRevision(prRefs.base.sha)})` },\n\t\thead: { ref: prRefs.head.sha, label: prRefs.head.branch },\n\t};\n\treturn refs;\n}\n\nexport function getPullRequestIdentityFromMaybeUrl(search: string): PullRequestUrlIdentity | undefined {\n\tlet prNumber: string | undefined = undefined;\n\n\tlet match = search.match(/(?:\\/)(\\d+)/); // any number starting with \"/\"\n\tif (match != null) {\n\t\tprNumber = match[1];\n\t}\n\n\tif (prNumber == null) {\n\t\tmatch = search.match(/^#?(\\d+)$/); // just a number or with a leading \"#\"\n\t\tif (match != null) {\n\t\t\tprNumber = match[1];\n\t\t}\n\t}\n\n\treturn prNumber == null ? undefined : { ownerAndRepo: undefined, prNumber: prNumber, provider: undefined };\n}\n\n/** A pull request's display number from its url, or `undefined` for a url naming no pull request. Anchors\n * on the provider's pull request path segment (GitHub `pull`, Bitbucket `pull-requests`, GitLab\n * `merge_requests`, Azure `pullrequest`) so a digit-leading owner (`github.com/1Password/x/pull/123`)\n * can't win. */\nexport function getPullRequestNumberFromUrl(url: string): string | undefined {\n\t// No loose fallback: `getPullRequestIdentityFromMaybeUrl` scans for any `/<digits>`, which reads a bare\n\t// repository url like `github.com/1Password/sdk` as pull request #1. Callers that hold a real pull\n\t// request fall back to its id instead, and the one that asks whether a pasted url names a pull request\n\t// needs \"no\" for an answer.\n\treturn url.match(/(?:pull|pull-requests|merge_requests|pullrequest)\\/(\\d+)(?:\\b|\\/|$)/)?.[1];\n}\n\nexport function getRepositoryIdentityForPullRequest(\n\tpr: PullRequest,\n\theadRepo: boolean = true,\n): PullRequestRepositoryIdentityDescriptor {\n\tif (headRepo) {\n\t\treturn {\n\t\t\tremote: {\n\t\t\t\turl: pr.refs?.head?.url,\n\t\t\t\tdomain: pr.provider.domain,\n\t\t\t},\n\t\t\tname: `${pr.refs?.head?.owner ?? pr.repository.owner}/${pr.refs?.head?.repo ?? pr.repository.repo}`,\n\t\t\tprovider: {\n\t\t\t\tid: pr.provider.id,\n\t\t\t\tdomain: pr.provider.domain,\n\t\t\t\trepoDomain: pr.refs?.head?.owner ?? pr.repository.owner,\n\t\t\t\trepoName: pr.refs?.head?.repo ?? pr.repository.repo,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn {\n\t\tremote: {\n\t\t\turl: pr.refs?.base?.url ?? pr.url,\n\t\t\tdomain: pr.provider.domain,\n\t\t},\n\t\tname: `${pr.refs?.base?.owner ?? pr.repository.owner}/${pr.refs?.base?.repo ?? pr.repository.repo}`,\n\t\tprovider: {\n\t\t\tid: pr.provider.id,\n\t\t\tdomain: pr.provider.domain,\n\t\t\trepoDomain: pr.refs?.base?.owner ?? pr.repository.owner,\n\t\t\trepoName: pr.refs?.base?.repo ?? pr.repository.repo,\n\t\t\trepoOwnerDomain: pr.refs?.base?.owner ?? pr.repository.owner,\n\t\t},\n\t};\n}\n\nexport function isMaybeNonSpecificPullRequestSearchUrl(search: string): boolean {\n\treturn getPullRequestIdentityFromMaybeUrl(search) != null;\n}\n\n/**\n * Deliberately leaves `projection` out: this copy drops `filesChanged`, `repository` and the class-only check rollup,\n * commit count and `viewerCanUpdate`, so a tag would have field presence report as fetched what the copy no longer has.\n */\nexport function serializePullRequest(value: PullRequest): PullRequestShape {\n\tconst serialized: PullRequestShape = {\n\t\ttype: value.type,\n\t\tprovider: {\n\t\t\tid: value.provider.id,\n\t\t\tname: value.provider.name,\n\t\t\tdomain: value.provider.domain,\n\t\t\ticon: value.provider.icon,\n\t\t},\n\t\tid: value.id,\n\t\tnodeId: value.nodeId,\n\t\tnumber: value.number,\n\t\ttitle: value.title,\n\t\tbody: value.body,\n\t\turl: value.url,\n\t\tcreatedDate: value.createdDate,\n\t\tupdatedDate: value.updatedDate,\n\t\tclosedDate: value.closedDate,\n\t\tclosed: value.closed,\n\t\tauthor: {\n\t\t\tid: value.author.id,\n\t\t\tname: value.author.name,\n\t\t\tusername: value.author.username,\n\t\t\tavatarUrl: value.author.avatarUrl,\n\t\t\turl: value.author.url,\n\t\t},\n\t\tstate: value.state,\n\t\tmergedDate: value.mergedDate,\n\t\tmergeableState: value.mergeableState,\n\t\trefs: value.refs\n\t\t\t? {\n\t\t\t\t\thead: {\n\t\t\t\t\t\texists: value.refs.head.exists,\n\t\t\t\t\t\towner: value.refs.head.owner,\n\t\t\t\t\t\trepo: value.refs.head.repo,\n\t\t\t\t\t\tsha: value.refs.head.sha,\n\t\t\t\t\t\tbranch: value.refs.head.branch,\n\t\t\t\t\t\turl: value.refs.head.url,\n\t\t\t\t\t\tcloneHttps: value.refs.head.cloneHttps,\n\t\t\t\t\t\tcloneSsh: value.refs.head.cloneSsh,\n\t\t\t\t\t\tisFork: value.refs.head.isFork,\n\t\t\t\t\t},\n\t\t\t\t\tbase: {\n\t\t\t\t\t\texists: value.refs.base.exists,\n\t\t\t\t\t\towner: value.refs.base.owner,\n\t\t\t\t\t\trepo: value.refs.base.repo,\n\t\t\t\t\t\tsha: value.refs.base.sha,\n\t\t\t\t\t\tbranch: value.refs.base.branch,\n\t\t\t\t\t\turl: value.refs.base.url,\n\t\t\t\t\t\tcloneHttps: value.refs.base.cloneHttps,\n\t\t\t\t\t\tcloneSsh: value.refs.base.cloneSsh,\n\t\t\t\t\t\tisFork: value.refs.base.isFork,\n\t\t\t\t\t},\n\t\t\t\t\tisCrossRepository: value.refs.isCrossRepository,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tisDraft: value.isDraft,\n\t\tadditions: value.additions,\n\t\tdeletions: value.deletions,\n\t\tcommentsCount: value.commentsCount,\n\t\tthumbsUpCount: value.thumbsUpCount,\n\t\treviewDecision: value.reviewDecision,\n\t\treviewRequests: value.reviewRequests,\n\t\tlatestReviews: value.latestReviews,\n\t\tassignees: value.assignees,\n\t\tauthoredByMe: value.authoredByMe,\n\t\tviewer: value.viewer != null ? { id: value.viewer.id, username: value.viewer.username } : undefined,\n\t\tviewerUnresolved: value.viewerUnresolved,\n\t\tmilestone: serializeMilestone(value.milestone),\n\t\tproject: value.project\n\t\t\t? {\n\t\t\t\t\tid: value.project.id,\n\t\t\t\t\tname: value.project.name,\n\t\t\t\t\tresourceId: value.project.resourceId,\n\t\t\t\t\tresourceName: value.project.resourceName,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tstack: value.stack\n\t\t\t? {\n\t\t\t\t\tid: value.stack.id,\n\t\t\t\t\tnumber: value.stack.number,\n\t\t\t\t\tsize: value.stack.size,\n\t\t\t\t\tposition: value.stack.position,\n\t\t\t\t\tbaseRef: value.stack.baseRef,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tmergeQueue: value.mergeQueue\n\t\t\t? {\n\t\t\t\t\tstate: value.mergeQueue.state,\n\t\t\t\t\tenqueuedAt: value.mergeQueue.enqueuedAt,\n\t\t\t\t\testimatedMergeAt: value.mergeQueue.estimatedMergeAt,\n\t\t\t\t\turl: value.mergeQueue.url,\n\t\t\t\t\tposition: value.mergeQueue.position,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tmergeQueueRequired: value.mergeQueueRequired,\n\t\tmergeQueueRemoval: value.mergeQueueRemoval\n\t\t\t? { reason: value.mergeQueueRemoval.reason, removedAt: value.mergeQueueRemoval.removedAt }\n\t\t\t: undefined,\n\t};\n\treturn serialized;\n}\n"],"mappings":";;;;;;;;;;;AAsBA,SAAgB,qBACf,OACA,SACS;CACT,IAAI,SAAS,MAAM,OAAO;CAC1B,OAAO,SAAS,aAAa,MAAM,OAAO,MAAM;AACjD;;;;;AAMA,SAAgB,0BACf,IAGC;CACD,OAAO,GAAG,UAAU,YAAY,GAAG,cAAc;AAClD;;AAGA,SAAgB,2BAAyD,IAGxD;CAChB,OAAO,0BAA0B,EAAE,IAAI,WAAW,GAAG;AACtD;;;;AAKA,SAAgB,4BAA0D,IAGZ;CAC7D,OAAO,0BAA0B,EAAE,IAChC;EAAE,QAAQ;EAAU,aAAa,kCAAkC,GAAG,UAAU;CAAE,IAClF;EAAE,QAAQ,GAAG;EAAO,aAAa,KAAA;CAAU;AAC/C;;;;;;;AAQA,SAAgB,kCAAkC,OAIvC;CACV,MAAM,WAAW,MAAM;CAEvB,IAAI;CACJ,QAAQ,MAAM,OAAd;EACC,KAAA;GACC,SACC,YAAY,OACT,KAAK,EAAE,kDAAkD,EAAY,SAAS,CAAC,IAC/E,KAAK,EAAE,iCAAiC;GAC5C;EACD,KAAA;GACC,SACC,YAAY,OACT,KAAK,EAAE,2CAA2C,EAAY,SAAS,CAAC,IACxE,KAAK,EAAE,0BAA0B;GACrC;EACD,KAAA,UAEC,OAAO,KAAK,EAAE,SAAS;EACxB,KAAA,eACC,OAAO,KAAK,EAAE,4BAA4B;EAC3C,SACC,SACC,YAAY,OACT,KAAK,EAAE,kCAAkC,EAAY,SAAS,CAAC,IAC/D,KAAK,EAAE,iBAAiB;CAE9B;CAEA,IAAI,MAAM,oBAAoB,MAAM,OAAO;CAG3C,MAAM,mBAAmB,IAAI,KAAK,MAAM,gBAAgB,CAAC,CAAC,QAAQ;CAClE,IAAI,OAAO,MAAM,gBAAgB,KAAK,oBAAoB,KAAK,IA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AAkB;GAAQ,WAAW,MAAM,kBAAkB;EAAU,IACvF,KAAA;CAEY;AACjB"}
|
|
1
|
+
{"version":3,"file":"pullRequest.utils.js","names":[],"sources":["../../../../git/src/utils/pullRequest.utils.ts"],"sourcesContent":["import * as l10n from '@vscode/l10n';\nimport { fromNow } from '@gitlens/utils/date.js';\nimport type {\n\tPullRequest,\n\tPullRequestComparisonRefs,\n\tPullRequestMergeQueueEntry,\n\tPullRequestRefs,\n\tPullRequestRepositoryIdentityDescriptor,\n\tPullRequestShape,\n\tPullRequestSortField,\n\tPullRequestSorting,\n\tPullRequestStackInfo,\n} from '../models/pullRequest.js';\nimport { PullRequestMergeQueueState } from '../models/pullRequest.js';\nimport { serializeMilestone } from './issueOrPullRequest.utils.js';\nimport { shortenRevision } from './revision.utils.js';\n\n/** How many pull requests a merge action affects — unstacked is always 1; a stacked merge lands either\n * just this layer and everything below it (`position`), or the whole stack (`wholeStack`). The one\n * source every merge-confirmation and merge-action label counts from, so they can't drift apart.\n * Takes only the two fields it needs (not the full {@link PullRequestStackInfo}) since callers on the\n * webview side carry narrower serialized stack shapes. */\nexport function getStackedMergeCount(\n\tstack: Pick<PullRequestStackInfo, 'position' | 'size'> | undefined,\n\toptions?: { wholeStack?: boolean },\n): number {\n\tif (stack == null) return 1;\n\treturn options?.wholeStack ? stack.size : stack.position;\n}\n\n/** Whether an open pull request is waiting in a merge queue. `false` also when the read didn't fetch the queue —\n * check the row's `mergeQueue` field presence before treating that as \"not queued\". Narrows to the shape's own entry\n * type, since webview shapes carry a serialized one, or to {@link PullRequestMergeQueueEntry} for a shape that\n * doesn't declare one (an `IssueOrPullRequest` that is a pull request). */\nexport function isPullRequestInMergeQueue<T extends { readonly state?: string; readonly mergeQueue?: unknown }>(\n\tpr: T,\n): pr is T & {\n\treadonly mergeQueue: 'mergeQueue' extends keyof T ? NonNullable<T['mergeQueue']> : PullRequestMergeQueueEntry;\n} {\n\treturn pr.state === 'opened' && pr.mergeQueue != null;\n}\n\n/** A pull request's state as shown to users: its provider state, except an open pull request waiting in a merge queue is `queued`. */\nexport function getPullRequestDisplayState<S extends string | undefined>(pr: {\n\treadonly state: S;\n\treadonly mergeQueue?: unknown;\n}): S | 'queued' {\n\treturn isPullRequestInMergeQueue(pr) ? 'queued' : pr.state;\n}\n\n/** A pull request's {@link getPullRequestDisplayState display state} paired with its\n * {@link formatPullRequestMergeQueueStatus merge-queue status}, place in line included, which is set only while it's\n * queued — the pair a pull request chip renders. */\nexport function getPullRequestDisplayStatus<S extends string | undefined>(pr: {\n\treadonly state: S;\n\treadonly mergeQueue?: Parameters<typeof formatPullRequestMergeQueueStatus>[0];\n}): { status: S | 'queued'; queueStatus: string | undefined } {\n\treturn isPullRequestInMergeQueue(pr)\n\t\t? { status: 'queued', queueStatus: formatPullRequestMergeQueueStatus(pr.mergeQueue) }\n\t\t: { status: pr.state, queueStatus: undefined };\n}\n\n/**\n * Describes where a queued pull request stands in its merge queue, with its place in line when the provider gave one\n * (\"#2 in the merge queue, checks running\"). Merging and failing entries read the same with or without a place, since\n * the place no longer says anything there. Takes only the fields it reads, and the estimate as a date or a timestamp\n * (ms), since webview shapes carry a serialized entry.\n */\nexport function formatPullRequestMergeQueueStatus(entry: {\n\treadonly state: PullRequestMergeQueueState;\n\treadonly estimatedMergeAt?: Date | number;\n\treadonly position?: number;\n}): string {\n\tconst position = entry.position;\n\n\tlet status: string;\n\tswitch (entry.state) {\n\t\tcase PullRequestMergeQueueState.AwaitingChecks:\n\t\t\tstatus =\n\t\t\t\tposition != null\n\t\t\t\t\t? l10n.t('#{position} in the merge queue, checks running', { position: position })\n\t\t\t\t\t: l10n.t('Queued to merge, checks running');\n\t\t\tbreak;\n\t\tcase PullRequestMergeQueueState.Mergeable:\n\t\t\tstatus =\n\t\t\t\tposition != null\n\t\t\t\t\t? l10n.t('#{position} in the merge queue, next up', { position: position })\n\t\t\t\t\t: l10n.t('Queued to merge, next up');\n\t\t\tbreak;\n\t\tcase PullRequestMergeQueueState.Locked:\n\t\t\t// The merge is already in flight, so an estimate adds nothing\n\t\t\treturn l10n.t('Merging');\n\t\tcase PullRequestMergeQueueState.Unmergeable:\n\t\t\treturn l10n.t('Failing in the merge queue');\n\t\tdefault:\n\t\t\tstatus =\n\t\t\t\tposition != null\n\t\t\t\t\t? l10n.t('#{position} in the merge queue', { position: position })\n\t\t\t\t\t: l10n.t('Queued to merge');\n\t\t\tbreak;\n\t}\n\n\tif (entry.estimatedMergeAt == null) return status;\n\n\t// An estimate already past is wrong, not late news: \"estimated to merge 2 minutes ago\" would only mislead\n\tconst estimatedMergeAt = new Date(entry.estimatedMergeAt).getTime();\n\tif (Number.isNaN(estimatedMergeAt) || estimatedMergeAt <= Date.now()) return status;\n\n\treturn l10n.t('{0}, estimated to merge {1}', status, fromNow(estimatedMergeAt));\n}\n\n/** When a queued pull request joined its merge queue, as the clause that follows its\n * {@link formatPullRequestMergeQueueStatus status} — \"queued 3 hours ago\" — so a status that ends in an estimate\n * doesn't run straight into a bare date. */\nexport function formatPullRequestMergeQueueEnqueuedFromNow(entry: { readonly enqueuedAt: Date | number }): string {\n\treturn l10n.t('queued {0}', fromNow(entry.enqueuedAt));\n}\n\n/** What a `PullRequestMergeQueueRemoval`'s reason says about the pull request: its queue run `failed`, someone\n * removed it (`manual`), or a reason this doesn't recognize (`other`), which the removal's raw reason still names. */\nexport type PullRequestMergeQueueRemovalKind = 'failed' | 'manual' | 'other';\n\n/**\n * Classifies a merge-queue removal's provider reason. Only the reasons seen from GitHub are recognized —\n * `failed_checks` (its queue run failed) and `manual` — matched without regard to case; every other reason is\n * `other` rather than guessed at, so a caller that shows one can fall back to the raw reason.\n */\nexport function getPullRequestMergeQueueRemovalKind(reason: string): PullRequestMergeQueueRemovalKind {\n\tswitch (reason.toLowerCase()) {\n\t\tcase 'failed_checks':\n\t\t\treturn 'failed';\n\t\tcase 'manual':\n\t\t\treturn 'manual';\n\t\tdefault:\n\t\t\treturn 'other';\n\t}\n}\n\n/**\n * Whether a pull request's merge-queue removal (`mergeQueueRemoval`) still describes it: it is set,\n * the pull request is open and not queued, and nothing has touched the pull request since — its update time is no\n * later than the removal, which GitHub's removal doesn't move. Narrows `mergeQueueRemoval` to set.\n *\n * The trade-off: any later update clears it, not only a push that may have fixed the failure, so a comment or a\n * label added after a failed queue run also stops it reading as failing. A provider's timeline can't say whether a\n * push followed the removal (GitHub orders commits by commit date, not push time), and a stale \"failing\" is worse\n * than a missed one. Takes dates or timestamps (ms), since webview shapes carry serialized ones.\n */\nexport function isPullRequestMergeQueueRemovalCurrent<\n\tT extends {\n\t\treadonly state?: string;\n\t\treadonly updatedDate: Date | number;\n\t\treadonly mergeQueue?: unknown;\n\t\treadonly mergeQueueRemoval?: { readonly removedAt: Date | number };\n\t},\n>(pr: T): pr is T & { readonly mergeQueueRemoval: NonNullable<T['mergeQueueRemoval']> } {\n\tif (pr.mergeQueueRemoval == null || pr.state !== 'opened' || pr.mergeQueue != null) return false;\n\n\tconst removedAt = new Date(pr.mergeQueueRemoval.removedAt).getTime();\n\tconst updatedAt = new Date(pr.updatedDate).getTime();\n\tif (Number.isNaN(removedAt) || Number.isNaN(updatedAt)) return false;\n\n\treturn removedAt >= updatedAt;\n}\n\n/**\n * How each sort field is read off a {@link PullRequestShape}, for the filtered PR search, which MERGES its\n * relationship × state facets in the facade and so has to order the union itself instead of trusting the\n * per-facet server order. Only the fields the shape carries appear — the same rule as `getIssueComparator`, and\n * the reason {@link PullRequestSortField} is just these two.\n */\nconst pullRequestSortValues: Partial<\n\tRecord<PullRequestSortField, (pr: PullRequestShape) => number | Date | string | undefined>\n> = {\n\tcreated: pr => pr.createdDate,\n\tupdated: pr => pr.updatedDate,\n};\n\n/**\n * A comparator for one sort key over normalized pull requests, or `undefined` when the field isn't derivable\n * from a {@link PullRequestShape} — the signal that the key is only honorable on a SINGLE-origin read where the\n * provider already ordered the page. Missing values sort LAST in both directions (partitioned before any\n * arithmetic so two missing values compare equal, exactly as `getIssueComparator` does).\n *\n * Note it orders whatever it is handed. Sorting a page already capped at the result ceiling does not make it the\n * top N.\n */\nexport function getPullRequestComparator(\n\tsort: PullRequestSorting,\n): ((a: PullRequestShape, b: PullRequestShape) => number) | undefined {\n\tconst [field, direction] = sort.split(':') as [PullRequestSortField, 'asc' | 'desc'];\n\tconst getValue = pullRequestSortValues[field];\n\tif (getValue == null) return undefined;\n\n\treturn (a, b) => {\n\t\tconst left = toComparable(getValue(a));\n\t\tconst right = toComparable(getValue(b));\n\t\tif (left == null || right == null) {\n\t\t\tif (left == null && right == null) return 0;\n\n\t\t\treturn left == null ? 1 : -1;\n\t\t}\n\n\t\tconst ordered = left < right ? -1 : left > right ? 1 : 0;\n\t\treturn direction === 'asc' ? ordered : -ordered;\n\t};\n}\n\nfunction toComparable(value: number | Date | string | undefined): number | string | undefined {\n\treturn value instanceof Date ? value.getTime() : value;\n}\n\nexport interface PullRequestUrlIdentity<TProvider extends string = string> {\n\tprovider?: TProvider;\n\n\townerAndRepo?: string;\n\tprNumber: string;\n}\n\nexport function getComparisonRefsForPullRequest(repoPath: string, prRefs: PullRequestRefs): PullRequestComparisonRefs {\n\tconst refs: PullRequestComparisonRefs = {\n\t\trepoPath: repoPath,\n\t\tbase: { ref: prRefs.base.sha, label: `${prRefs.base.branch} (${shortenRevision(prRefs.base.sha)})` },\n\t\thead: { ref: prRefs.head.sha, label: prRefs.head.branch },\n\t};\n\treturn refs;\n}\n\nexport function getPullRequestIdentityFromMaybeUrl(search: string): PullRequestUrlIdentity | undefined {\n\tlet prNumber: string | undefined = undefined;\n\n\tlet match = search.match(/(?:\\/)(\\d+)/); // any number starting with \"/\"\n\tif (match != null) {\n\t\tprNumber = match[1];\n\t}\n\n\tif (prNumber == null) {\n\t\tmatch = search.match(/^#?(\\d+)$/); // just a number or with a leading \"#\"\n\t\tif (match != null) {\n\t\t\tprNumber = match[1];\n\t\t}\n\t}\n\n\treturn prNumber == null ? undefined : { ownerAndRepo: undefined, prNumber: prNumber, provider: undefined };\n}\n\n/** A pull request's display number from its url, or `undefined` for a url naming no pull request. Anchors\n * on the provider's pull request path segment (GitHub `pull`, Bitbucket `pull-requests`, GitLab\n * `merge_requests`, Azure `pullrequest`) so a digit-leading owner (`github.com/1Password/x/pull/123`)\n * can't win. */\nexport function getPullRequestNumberFromUrl(url: string): string | undefined {\n\t// No loose fallback: `getPullRequestIdentityFromMaybeUrl` scans for any `/<digits>`, which reads a bare\n\t// repository url like `github.com/1Password/sdk` as pull request #1. Callers that hold a real pull\n\t// request fall back to its id instead, and the one that asks whether a pasted url names a pull request\n\t// needs \"no\" for an answer.\n\treturn url.match(/(?:pull|pull-requests|merge_requests|pullrequest)\\/(\\d+)(?:\\b|\\/|$)/)?.[1];\n}\n\nexport function getRepositoryIdentityForPullRequest(\n\tpr: PullRequest,\n\theadRepo: boolean = true,\n): PullRequestRepositoryIdentityDescriptor {\n\tif (headRepo) {\n\t\treturn {\n\t\t\tremote: {\n\t\t\t\turl: pr.refs?.head?.url,\n\t\t\t\tdomain: pr.provider.domain,\n\t\t\t},\n\t\t\tname: `${pr.refs?.head?.owner ?? pr.repository.owner}/${pr.refs?.head?.repo ?? pr.repository.repo}`,\n\t\t\tprovider: {\n\t\t\t\tid: pr.provider.id,\n\t\t\t\tdomain: pr.provider.domain,\n\t\t\t\trepoDomain: pr.refs?.head?.owner ?? pr.repository.owner,\n\t\t\t\trepoName: pr.refs?.head?.repo ?? pr.repository.repo,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn {\n\t\tremote: {\n\t\t\turl: pr.refs?.base?.url ?? pr.url,\n\t\t\tdomain: pr.provider.domain,\n\t\t},\n\t\tname: `${pr.refs?.base?.owner ?? pr.repository.owner}/${pr.refs?.base?.repo ?? pr.repository.repo}`,\n\t\tprovider: {\n\t\t\tid: pr.provider.id,\n\t\t\tdomain: pr.provider.domain,\n\t\t\trepoDomain: pr.refs?.base?.owner ?? pr.repository.owner,\n\t\t\trepoName: pr.refs?.base?.repo ?? pr.repository.repo,\n\t\t\trepoOwnerDomain: pr.refs?.base?.owner ?? pr.repository.owner,\n\t\t},\n\t};\n}\n\nexport function isMaybeNonSpecificPullRequestSearchUrl(search: string): boolean {\n\treturn getPullRequestIdentityFromMaybeUrl(search) != null;\n}\n\n/**\n * Deliberately leaves `projection` out: this copy drops `filesChanged`, `repository` and the class-only check rollup,\n * commit count and `viewerCanUpdate`, so a tag would have field presence report as fetched what the copy no longer has.\n */\nexport function serializePullRequest(value: PullRequest): PullRequestShape {\n\tconst serialized: PullRequestShape = {\n\t\ttype: value.type,\n\t\tprovider: {\n\t\t\tid: value.provider.id,\n\t\t\tname: value.provider.name,\n\t\t\tdomain: value.provider.domain,\n\t\t\ticon: value.provider.icon,\n\t\t},\n\t\tid: value.id,\n\t\tnodeId: value.nodeId,\n\t\tnumber: value.number,\n\t\ttitle: value.title,\n\t\tbody: value.body,\n\t\turl: value.url,\n\t\tcreatedDate: value.createdDate,\n\t\tupdatedDate: value.updatedDate,\n\t\tclosedDate: value.closedDate,\n\t\tclosed: value.closed,\n\t\tauthor: {\n\t\t\tid: value.author.id,\n\t\t\tname: value.author.name,\n\t\t\tusername: value.author.username,\n\t\t\tavatarUrl: value.author.avatarUrl,\n\t\t\turl: value.author.url,\n\t\t},\n\t\tstate: value.state,\n\t\tmergedDate: value.mergedDate,\n\t\tmergeableState: value.mergeableState,\n\t\trefs: value.refs\n\t\t\t? {\n\t\t\t\t\thead: {\n\t\t\t\t\t\texists: value.refs.head.exists,\n\t\t\t\t\t\towner: value.refs.head.owner,\n\t\t\t\t\t\trepo: value.refs.head.repo,\n\t\t\t\t\t\tsha: value.refs.head.sha,\n\t\t\t\t\t\tbranch: value.refs.head.branch,\n\t\t\t\t\t\turl: value.refs.head.url,\n\t\t\t\t\t\tcloneHttps: value.refs.head.cloneHttps,\n\t\t\t\t\t\tcloneSsh: value.refs.head.cloneSsh,\n\t\t\t\t\t\tisFork: value.refs.head.isFork,\n\t\t\t\t\t},\n\t\t\t\t\tbase: {\n\t\t\t\t\t\texists: value.refs.base.exists,\n\t\t\t\t\t\towner: value.refs.base.owner,\n\t\t\t\t\t\trepo: value.refs.base.repo,\n\t\t\t\t\t\tsha: value.refs.base.sha,\n\t\t\t\t\t\tbranch: value.refs.base.branch,\n\t\t\t\t\t\turl: value.refs.base.url,\n\t\t\t\t\t\tcloneHttps: value.refs.base.cloneHttps,\n\t\t\t\t\t\tcloneSsh: value.refs.base.cloneSsh,\n\t\t\t\t\t\tisFork: value.refs.base.isFork,\n\t\t\t\t\t},\n\t\t\t\t\tisCrossRepository: value.refs.isCrossRepository,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tisDraft: value.isDraft,\n\t\tadditions: value.additions,\n\t\tdeletions: value.deletions,\n\t\tcommentsCount: value.commentsCount,\n\t\tthumbsUpCount: value.thumbsUpCount,\n\t\treviewDecision: value.reviewDecision,\n\t\treviewRequests: value.reviewRequests,\n\t\tlatestReviews: value.latestReviews,\n\t\tassignees: value.assignees,\n\t\tauthoredByMe: value.authoredByMe,\n\t\tviewer: value.viewer != null ? { id: value.viewer.id, username: value.viewer.username } : undefined,\n\t\tviewerUnresolved: value.viewerUnresolved,\n\t\tmilestone: serializeMilestone(value.milestone),\n\t\tproject: value.project\n\t\t\t? {\n\t\t\t\t\tid: value.project.id,\n\t\t\t\t\tname: value.project.name,\n\t\t\t\t\tresourceId: value.project.resourceId,\n\t\t\t\t\tresourceName: value.project.resourceName,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tstack: value.stack\n\t\t\t? {\n\t\t\t\t\tid: value.stack.id,\n\t\t\t\t\tnumber: value.stack.number,\n\t\t\t\t\tsize: value.stack.size,\n\t\t\t\t\tposition: value.stack.position,\n\t\t\t\t\tbaseRef: value.stack.baseRef,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tmergeQueue: value.mergeQueue\n\t\t\t? {\n\t\t\t\t\tstate: value.mergeQueue.state,\n\t\t\t\t\tenqueuedAt: value.mergeQueue.enqueuedAt,\n\t\t\t\t\testimatedMergeAt: value.mergeQueue.estimatedMergeAt,\n\t\t\t\t\turl: value.mergeQueue.url,\n\t\t\t\t\tposition: value.mergeQueue.position,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tmergeQueueRequired: value.mergeQueueRequired,\n\t\tmergeQueueRemoval: value.mergeQueueRemoval\n\t\t\t? { reason: value.mergeQueueRemoval.reason, removedAt: value.mergeQueueRemoval.removedAt }\n\t\t\t: undefined,\n\t\tcheckRuns: value.checkRuns?.map(run => ({ ...run })),\n\t\tcheckRunsTruncated: value.checkRunsTruncated,\n\t};\n\treturn serialized;\n}\n"],"mappings":";;;;;;;;;;;AAsBA,SAAgB,qBACf,OACA,SACS;CACT,IAAI,SAAS,MAAM,OAAO;CAC1B,OAAO,SAAS,aAAa,MAAM,OAAO,MAAM;AACjD;;;;;AAMA,SAAgB,0BACf,IAGC;CACD,OAAO,GAAG,UAAU,YAAY,GAAG,cAAc;AAClD;;AAGA,SAAgB,2BAAyD,IAGxD;CAChB,OAAO,0BAA0B,EAAE,IAAI,WAAW,GAAG;AACtD;;;;AAKA,SAAgB,4BAA0D,IAGZ;CAC7D,OAAO,0BAA0B,EAAE,IAChC;EAAE,QAAQ;EAAU,aAAa,kCAAkC,GAAG,UAAU;CAAE,IAClF;EAAE,QAAQ,GAAG;EAAO,aAAa,KAAA;CAAU;AAC/C;;;;;;;AAQA,SAAgB,kCAAkC,OAIvC;CACV,MAAM,WAAW,MAAM;CAEvB,IAAI;CACJ,QAAQ,MAAM,OAAd;EACC,KAAA;GACC,SACC,YAAY,OACT,KAAK,EAAE,kDAAkD,EAAY,SAAS,CAAC,IAC/E,KAAK,EAAE,iCAAiC;GAC5C;EACD,KAAA;GACC,SACC,YAAY,OACT,KAAK,EAAE,2CAA2C,EAAY,SAAS,CAAC,IACxE,KAAK,EAAE,0BAA0B;GACrC;EACD,KAAA,UAEC,OAAO,KAAK,EAAE,SAAS;EACxB,KAAA,eACC,OAAO,KAAK,EAAE,4BAA4B;EAC3C,SACC,SACC,YAAY,OACT,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;EACH,YAAY,MAAM,aACf;GACA,OAAO,MAAM,WAAW;GACxB,YAAY,MAAM,WAAW;GAC7B,kBAAkB,MAAM,WAAW;GACnC,KAAK,MAAM,WAAW;GACtB,UAAU,MAAM,WAAW;EAC5B,IACC,KAAA;EACH,oBAAoB,MAAM;EAC1B,mBAAmB,MAAM,oBACtB;GAAE,QAAQ,MAAM,kBAAkB;GAAQ,WAAW,MAAM,kBAAkB;EAAU,IACvF,KAAA;EACH,WAAW,MAAM,WAAW,KAAI,SAAQ,EAAE,GAAG,IAAI,EAAE;EACnD,oBAAoB,MAAM;CAEX;AACjB"}
|
|
@@ -34,6 +34,7 @@ const maxConcurrentReadsPerRepository = 4;
|
|
|
34
34
|
const maxConcurrentReads = 8;
|
|
35
35
|
const maxUnwatchedReads = 256;
|
|
36
36
|
const maxDeferredDirtyMs = 1e4;
|
|
37
|
+
const untrackedDirtyRecheckMs = 1e3;
|
|
37
38
|
const minBaseRetryDelayMs = 5e3;
|
|
38
39
|
const maxBaseRetryDelayMs = 3e5;
|
|
39
40
|
const maxCarriedBaseAgeMs = 3e5;
|
|
@@ -747,6 +748,7 @@ var WorktreeSummaryService = class {
|
|
|
747
748
|
entry.baseRetry = getBaseRetry(entry.baseRetry, result);
|
|
748
749
|
const dirtyConfirmed = result.dirtyReadAt != null && entry.dirtyReadAt != null;
|
|
749
750
|
if (dirtyConfirmed) clearDeferredDirty(entry);
|
|
751
|
+
if (result.dirtyUntrackedOnly != null) this.recheckUntrackedDirty(entry, result.dirtyUntrackedOnly);
|
|
750
752
|
if (value != null && summariesEqual(value, result.summary)) {
|
|
751
753
|
if (dirtyConfirmed) this.fireChange(entry, value);
|
|
752
754
|
return;
|
|
@@ -755,7 +757,22 @@ var WorktreeSummaryService = class {
|
|
|
755
757
|
entry.value = summary;
|
|
756
758
|
this.fireChange(entry, summary);
|
|
757
759
|
}
|
|
760
|
+
recheckUntrackedDirty(entry, untrackedOnly) {
|
|
761
|
+
const isRecheck = entry.untrackedDirtyRecheckDue;
|
|
762
|
+
entry.untrackedDirtyRecheckDue = false;
|
|
763
|
+
clearTimeout(entry.untrackedDirtyRecheckTimer);
|
|
764
|
+
entry.untrackedDirtyRecheckTimer = void 0;
|
|
765
|
+
if (!untrackedOnly || isRecheck) return;
|
|
766
|
+
const timer = setTimeout(() => {
|
|
767
|
+
entry.untrackedDirtyRecheckTimer = void 0;
|
|
768
|
+
entry.untrackedDirtyRecheckDue = true;
|
|
769
|
+
this.queue(entry, dirtyField);
|
|
770
|
+
}, untrackedDirtyRecheckMs);
|
|
771
|
+
if (typeof timer !== "number") timer.unref();
|
|
772
|
+
entry.untrackedDirtyRecheckTimer = timer;
|
|
773
|
+
}
|
|
758
774
|
fail(entry, ex) {
|
|
775
|
+
entry.untrackedDirtyRecheckDue = false;
|
|
759
776
|
const previous = entry.value;
|
|
760
777
|
if (previous == null) {
|
|
761
778
|
if (entry.seed != null) {
|
|
@@ -799,6 +816,9 @@ var WorktreeSummaryService = class {
|
|
|
799
816
|
entry.value = void 0;
|
|
800
817
|
entry.seed = void 0;
|
|
801
818
|
clearDeferredDirty(entry);
|
|
819
|
+
clearTimeout(entry.untrackedDirtyRecheckTimer);
|
|
820
|
+
entry.untrackedDirtyRecheckTimer = void 0;
|
|
821
|
+
entry.untrackedDirtyRecheckDue = false;
|
|
802
822
|
entry.baseKeys = void 0;
|
|
803
823
|
entry.baseConfigKey = void 0;
|
|
804
824
|
entry.baseDefaultBranch = void 0;
|
|
@@ -850,6 +870,8 @@ function createEntry(key) {
|
|
|
850
870
|
seed: void 0,
|
|
851
871
|
dirtyReadAt: void 0,
|
|
852
872
|
dirtyReadTimer: void 0,
|
|
873
|
+
untrackedDirtyRecheckDue: false,
|
|
874
|
+
untrackedDirtyRecheckTimer: void 0,
|
|
853
875
|
baseKeys: void 0,
|
|
854
876
|
baseConfigKey: void 0,
|
|
855
877
|
baseDefaultBranch: void 0,
|
|
@@ -1015,7 +1037,8 @@ async function readSummary(repo, key, fields, previous, previousBaseKeys, previo
|
|
|
1015
1037
|
}
|
|
1016
1038
|
}
|
|
1017
1039
|
}
|
|
1018
|
-
const
|
|
1040
|
+
const dirtyAnswer = dirtyRead != null ? await dirtyRead : void 0;
|
|
1041
|
+
const dirty = dirtyAnswer != null ? dirtyAnswer !== false : previous?.dirty ?? false;
|
|
1019
1042
|
const summary = {
|
|
1020
1043
|
repoPath: key,
|
|
1021
1044
|
branch,
|
|
@@ -1038,6 +1061,7 @@ async function readSummary(repo, key, fields, previous, previousBaseKeys, previo
|
|
|
1038
1061
|
baseFullRead,
|
|
1039
1062
|
baseError,
|
|
1040
1063
|
dirtyReadAt,
|
|
1064
|
+
dirtyUntrackedOnly: dirtyAnswer != null ? dirtyAnswer === "untracked" : void 0,
|
|
1041
1065
|
fields
|
|
1042
1066
|
};
|
|
1043
1067
|
}
|
|
@@ -1336,10 +1360,18 @@ function baseKeysEqual(a, b) {
|
|
|
1336
1360
|
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
|
|
1337
1361
|
}
|
|
1338
1362
|
function readDirty(repo, signal) {
|
|
1339
|
-
const read = repo
|
|
1363
|
+
const read = readWorkingChanges(repo, signal);
|
|
1340
1364
|
read.catch(noop);
|
|
1341
1365
|
return read;
|
|
1342
1366
|
}
|
|
1367
|
+
async function readWorkingChanges(repo, signal) {
|
|
1368
|
+
if (await repo.status.hasWorkingChanges({ untracked: false }, signal)) return true;
|
|
1369
|
+
return await repo.status.hasWorkingChanges({
|
|
1370
|
+
staged: false,
|
|
1371
|
+
unstaged: false,
|
|
1372
|
+
untracked: true
|
|
1373
|
+
}, signal) ? "untracked" : false;
|
|
1374
|
+
}
|
|
1343
1375
|
function noop() {}
|
|
1344
1376
|
/**
|
|
1345
1377
|
* Uses the remote and branch git reported for the upstream; only when it reported neither does this split the name
|