@gitkraken/core-gitlens 0.34.0 → 0.36.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/dist/git/models/branch.d.ts +9 -0
  3. package/dist/git/models/branch.js.map +1 -1
  4. package/dist/git/providers/branches.d.ts +11 -1
  5. package/dist/git/providers/revision.d.ts +6 -0
  6. package/dist/git-cli/exec/git.js +2 -2
  7. package/dist/git-cli/exec/git.js.map +1 -1
  8. package/dist/git-cli/providers/branches.d.ts +6 -1
  9. package/dist/git-cli/providers/branches.js +58 -0
  10. package/dist/git-cli/providers/branches.js.map +1 -1
  11. package/dist/git-cli/providers/revision.d.ts +1 -0
  12. package/dist/git-cli/providers/revision.js +9 -0
  13. package/dist/git-cli/providers/revision.js.map +1 -1
  14. package/dist/plus/git-github/api/config.d.ts +11 -0
  15. package/dist/plus/git-github/api/config.js.map +1 -1
  16. package/dist/plus/git-github/api/github.d.ts +31 -0
  17. package/dist/plus/git-github/api/github.js +48 -24
  18. package/dist/plus/git-github/api/github.js.map +1 -1
  19. package/dist/plus/git-github/models.d.ts +15 -8
  20. package/dist/plus/git-github/models.js +4 -3
  21. package/dist/plus/git-github/models.js.map +1 -1
  22. package/dist/plus/integrations/context.d.ts +12 -0
  23. package/dist/plus/integrations/fieldPresence.d.ts +11 -1
  24. package/dist/plus/integrations/fieldPresence.js +18 -1
  25. package/dist/plus/integrations/fieldPresence.js.map +1 -1
  26. package/dist/plus/integrations/integrationService.d.ts +15 -1
  27. package/dist/plus/integrations/integrationService.js +8 -2
  28. package/dist/plus/integrations/integrationService.js.map +1 -1
  29. package/dist/plus/integrations/manager.d.ts +38 -0
  30. package/dist/plus/integrations/models/gitHostIntegration.d.ts +15 -0
  31. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  32. package/dist/plus/integrations/models/integration.d.ts +20 -0
  33. package/dist/plus/integrations/models/integration.js +15 -1
  34. package/dist/plus/integrations/models/integration.js.map +1 -1
  35. package/dist/plus/integrations/providers/github/github.js +2 -1
  36. package/dist/plus/integrations/providers/github/github.js.map +1 -1
  37. package/dist/plus/integrations/providers/github.d.ts +5 -0
  38. package/dist/plus/integrations/providers/github.js +18 -5
  39. package/dist/plus/integrations/providers/github.js.map +1 -1
  40. package/dist/plus/integrations/reads/autolinks.js.map +1 -1
  41. package/dist/plus/integrations/reads/context.d.ts +7 -0
  42. package/dist/plus/integrations/reads/drains.d.ts +1 -1
  43. package/dist/plus/integrations/reads/drains.js +2 -1
  44. package/dist/plus/integrations/reads/drains.js.map +1 -1
  45. package/dist/plus/integrations/reads/etag.js +2 -0
  46. package/dist/plus/integrations/reads/etag.js.map +1 -1
  47. package/dist/plus/integrations/reads/pullRequestBatch.d.ts +6 -2
  48. package/dist/plus/integrations/reads/pullRequestBatch.js +9 -2
  49. package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
  50. package/dist/plus/integrations/reads/pullRequestBranches.d.ts +2 -0
  51. package/dist/plus/integrations/reads/pullRequestBranches.js +3 -1
  52. package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
  53. package/dist/plus/integrations/reads/pullRequests.d.ts +2 -0
  54. package/dist/plus/integrations/reads/pullRequests.js +2 -1
  55. package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
  56. package/dist/plus/integrations/reads/searchPullRequests.d.ts +2 -0
  57. package/dist/plus/integrations/reads/searchPullRequests.js +2 -1
  58. package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
  59. package/docs/integrations.md +46 -17
  60. package/package.json +1 -1
@@ -149,12 +149,14 @@ export interface GitHubPullRequestLite extends Omit<GitHubIssueOrPullRequest, '_
149
149
  stackEntry?: {
150
150
  position: number;
151
151
  } | null;
152
- /** Only selected against github.com — see `stack`. `null` when the pull request isn't queued. */
152
+ /** Only selected against github.com, for a read that asks for it (`mergeQueue`) or, when it doesn't say, a host
153
+ * that opts in (`GitHubApiConfig.getPullRequestReadOptions`) — see `stack`. `null` when the pull request isn't
154
+ * queued. */
153
155
  mergeQueueEntry?: GitHubMergeQueueEntry | null;
154
- /** Only selected against github.com — see `stack`. True whenever the base branch requires a merge queue, whatever
155
- * the pull request's state. */
156
+ /** Selected with `mergeQueueEntry`. True whenever the base branch requires a merge queue, whatever the pull
157
+ * request's state. */
156
158
  isMergeQueueEnabled?: boolean;
157
- /** Only selected against github.com — see `stack`. The latest merge-queue event only (`timelineItems(last: 1)`). */
159
+ /** Selected with `mergeQueueEntry`. The latest merge-queue event only (`timelineItems(last: 1)`). */
158
160
  mergeQueueEvents?: GitHubMergeQueueEvents | null;
159
161
  }
160
162
  /** The `timelineItems` of a pull request filtered to its merge-queue events, as GitLens selects them. */
@@ -294,10 +296,15 @@ export interface GitHubPullRequestEtagNode extends Pick<GitHubPullRequest, 'id'
294
296
  };
295
297
  }[];
296
298
  };
297
- /** Always selected, but only against github.com, like the full read's. `null` when the pull request isn't queued. */
299
+ /** Selected when the read selects merge-queue data, like the full read's. `null` when the pull request isn't queued. */
298
300
  mergeQueueEntry?: Pick<GitHubMergeQueueEntry, 'state' | 'enqueuedAt'> | null;
299
- /** Always selected, but only against github.com, exactly as the full read selects it. */
301
+ /** Selected when the read selects merge-queue data, exactly as the full read selects it. */
300
302
  mergeQueueEvents?: GitHubMergeQueueEvents | null;
303
+ /**
304
+ * Selected with the merge-queue data and nothing else, so its presence says the read selected it. Its value is
305
+ * never an etag input: only a change to the base branch's rules moves it.
306
+ */
307
+ isMergeQueueEnabled?: boolean;
301
308
  }
302
309
  /**
303
310
  * An input beyond an issue's lifecycle fields that `GitHubApi.getIssuesEtagFieldsBatch` can select. Mirrors the
@@ -325,8 +332,8 @@ export declare function fromGitHubMergeQueueEntry(entry: GitHubMergeQueueEntry):
325
332
  /**
326
333
  * The pull request's latest removal from its merge queue, from its latest merge-queue event: set only when that
327
334
  * event is a removal (so it hasn't rejoined since) whose reason isn't `merged` (GitHub removes every merged entry
328
- * with that reason). Absent on GitHub Enterprise Server (never selected). Shared by the full read and the etag's
329
- * cheap check, so both derive the same removal.
335
+ * with that reason). Absent where never selected (GitHub Enterprise Server, or a host that didn't opt in). Shared by
336
+ * the full read and the etag's cheap check, so both derive the same removal.
330
337
  */
331
338
  export declare function fromGitHubMergeQueueRemoval(events: GitHubMergeQueueEvents | null | undefined): PullRequestMergeQueueRemoval | undefined;
332
339
  /** A state GitHub adds later still means the pull request is in the queue, so it reads as Queued rather than
@@ -80,7 +80,8 @@ function fromGitHubPullRequestStack(pr) {
80
80
  baseRef: pr.stack.baseRefName
81
81
  };
82
82
  }
83
- /** Absent on GitHub Enterprise Server (never selected) and `null` when the pull request isn't queued. */
83
+ /** Absent where never selected (GitHub Enterprise Server, or a host that didn't opt in) and `null` when the pull
84
+ * request isn't queued. */
84
85
  function fromGitHubPullRequestMergeQueueEntry(pr) {
85
86
  return pr.mergeQueueEntry != null ? fromGitHubMergeQueueEntry(pr.mergeQueueEntry) : void 0;
86
87
  }
@@ -101,8 +102,8 @@ function fromGitHubMergeQueueEntry(entry) {
101
102
  /**
102
103
  * The pull request's latest removal from its merge queue, from its latest merge-queue event: set only when that
103
104
  * event is a removal (so it hasn't rejoined since) whose reason isn't `merged` (GitHub removes every merged entry
104
- * with that reason). Absent on GitHub Enterprise Server (never selected). Shared by the full read and the etag's
105
- * cheap check, so both derive the same removal.
105
+ * with that reason). Absent where never selected (GitHub Enterprise Server, or a host that didn't opt in). Shared by
106
+ * the full read and the etag's cheap check, so both derive the same removal.
106
107
  */
107
108
  function fromGitHubMergeQueueRemoval(events) {
108
109
  const latest = events?.nodes?.at(-1);
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","names":[],"sources":["../../../../plus/git-github/src/models.ts"],"sourcesContent":["import type { Endpoints } from '@octokit/types';\nimport { GitFileIndexStatus } from '@gitlens/git/models/fileStatus.js';\nimport type { IssueLabel, IssueProjection } from '@gitlens/git/models/issue.js';\nimport { Issue, RepositoryAccessLevel } from '@gitlens/git/models/issue.js';\nimport type { IssueMilestone } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type {\n\tPullRequestMember,\n\tPullRequestMergeQueueEntry,\n\tPullRequestMergeQueueRemoval,\n\tPullRequestProjection,\n\tPullRequestStackInfo,\n\tPullRequestState,\n} from '@gitlens/git/models/pullRequest.js';\nimport {\n\tPullRequest,\n\tPullRequestMergeableState,\n\tPullRequestMergeQueueState,\n\tPullRequestReviewDecision,\n\tPullRequestReviewState,\n\tPullRequestStatusCheckRollupState,\n} from '@gitlens/git/models/pullRequest.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\n\nexport interface GitHubBlame {\n\tranges: GitHubBlameRange[];\n\tviewer?: string;\n}\n\nexport interface GitHubBlameRange {\n\tstartingLine: number;\n\tendingLine: number;\n\tcommit: GitHubCommit;\n}\n\nexport interface GitHubBranch {\n\tname: string;\n\ttarget: {\n\t\toid: string;\n\t\tauthoredDate: string;\n\t\tcommittedDate: string;\n\t};\n}\n\nexport interface GitHubCommit {\n\toid: string;\n\tparents: { nodes: { oid: string }[] };\n\tmessage: string;\n\tadditions?: number | undefined;\n\tchangedFiles?: number | undefined;\n\tdeletions?: number | undefined;\n\tauthor: { avatarUrl: string | undefined; date: string; email: string | undefined; name: string };\n\tcommitter: { date: string; email: string | undefined; name: string };\n\n\tfiles?: Endpoints['GET /repos/{owner}/{repo}/commits/{ref}']['response']['data']['files'];\n}\n\nexport interface GitHubCommitRef {\n\toid: string;\n}\n\nexport type GitHubContributor = Endpoints['GET /repos/{owner}/{repo}/contributors']['response']['data'][0];\n\nexport type GitHubSshSigningKey = Endpoints['GET /users/{username}/ssh_signing_keys']['response']['data'][0];\n\nexport interface GitHubMember {\n\tlogin: string;\n\tavatarUrl: string;\n\turl: string;\n}\n\nexport interface GitHubPagedResult<T> {\n\tpageInfo: GitHubPageInfo;\n\ttotalCount: number;\n\tvalues: T[];\n}\nexport interface GitHubPageInfo {\n\tstartCursor?: string | null;\n\tendCursor?: string | null;\n\thasNextPage: boolean;\n\thasPreviousPage: boolean;\n}\n\nexport interface GitHubTag {\n\tname: string;\n\ttarget: {\n\t\toid: string;\n\t\tauthoredDate?: string;\n\t\tcommittedDate?: string;\n\t\tmessage?: string | null;\n\t\ttagger?: {\n\t\t\tdate: string;\n\t\t} | null;\n\n\t\ttarget?: {\n\t\t\toid?: string;\n\t\t\tauthoredDate?: string;\n\t\t\tcommittedDate?: string;\n\t\t\tmessage?: string | null;\n\t\t};\n\t};\n}\n\nexport type GitHubCommitFileStatus = NonNullable<\n\tEndpoints['GET /repos/{owner}/{repo}/commits/{ref}']['response']['data']['files']\n>[0]['status'];\n\nexport function fromCommitFileStatus(status: GitHubCommitFileStatus): GitFileIndexStatus | undefined {\n\tswitch (status) {\n\t\tcase 'added':\n\t\t\treturn GitFileIndexStatus.Added;\n\t\tcase 'changed':\n\t\tcase 'modified':\n\t\t\treturn GitFileIndexStatus.Modified;\n\t\tcase 'removed':\n\t\t\treturn GitFileIndexStatus.Deleted;\n\t\tcase 'renamed':\n\t\t\treturn GitFileIndexStatus.Renamed;\n\t\tcase 'copied':\n\t\t\treturn GitFileIndexStatus.Copied;\n\t}\n\treturn undefined;\n}\n\nexport interface GitHubIssueOrPullRequest {\n\t__typename: 'Issue' | 'PullRequest';\n\n\tclosed: boolean;\n\tclosedAt: string | null;\n\tcreatedAt: string;\n\tid: string;\n\tnumber: number;\n\tstate: GitHubIssueOrPullRequestState;\n\ttitle: string;\n\tupdatedAt: string;\n\turl: string;\n}\n\nexport type GitHubIssueState = 'OPEN' | 'CLOSED';\nexport type GitHubPullRequestState = 'OPEN' | 'CLOSED' | 'MERGED';\nexport type GitHubIssueOrPullRequestState = GitHubIssueState | GitHubPullRequestState;\n\n/** GitHub's `Milestone`, as `gqlMilestoneFragment` selects it. */\nexport interface GitHubMilestone {\n\tid: string;\n\ttitle: string;\n\tstate: 'OPEN' | 'CLOSED';\n\tdueOn: string | null;\n\turl: string;\n}\n\nexport interface GitHubPullRequestLite extends Omit<GitHubIssueOrPullRequest, '__typename'> {\n\t/** `Actor` is nullable in GitHub's schema — `null` once the author's account is deleted */\n\tauthor: GitHubMember | null;\n\tbody: string | null;\n\n\tbaseRefName: string;\n\tbaseRefOid: string;\n\n\theadRefName: string;\n\theadRefOid: string;\n\theadRepository: {\n\t\tisFork: boolean;\n\t\tname: string;\n\t\towner: {\n\t\t\tlogin: string;\n\t\t};\n\t\tsshUrl: string;\n\t\turl: string;\n\t};\n\n\tisCrossRepository: boolean;\n\tisDraft: boolean;\n\tmergedAt: string | null;\n\t/** `null` when the pull request has none. */\n\tmilestone: GitHubMilestone | null;\n\tpermalink: string;\n\n\trepository: {\n\t\tisFork: boolean;\n\t\tname: string;\n\t\towner: {\n\t\t\tlogin: string;\n\t\t};\n\t\tsshUrl: string;\n\t\turl: string;\n\t\tviewerPermission: GitHubViewerPermission;\n\t};\n\n\t/** Only selected against github.com — GitHub Enterprise Server schemas lag and reject the field. */\n\tstack?: GitHubPullRequestStack | null;\n\t/** Only selected against github.com — see `stack`. */\n\tstackEntry?: { position: number } | null;\n\t/** Only selected against github.com — see `stack`. `null` when the pull request isn't queued. */\n\tmergeQueueEntry?: GitHubMergeQueueEntry | null;\n\t/** Only selected against github.com — see `stack`. True whenever the base branch requires a merge queue, whatever\n\t * the pull request's state. */\n\tisMergeQueueEnabled?: boolean;\n\t/** Only selected against github.com — see `stack`. The latest merge-queue event only (`timelineItems(last: 1)`). */\n\tmergeQueueEvents?: GitHubMergeQueueEvents | null;\n}\n\n/** The `timelineItems` of a pull request filtered to its merge-queue events, as GitLens selects them. */\nexport interface GitHubMergeQueueEvents {\n\tnodes: (GitHubMergeQueueEvent | null)[] | null;\n}\n\n/** A merge-queue timeline event. Only a removal's fields are selected: the latest event being an addition is all an\n * addition says. */\nexport type GitHubMergeQueueEvent =\n\t| { __typename: 'AddedToMergeQueueEvent' }\n\t| {\n\t\t\t__typename: 'RemovedFromMergeQueueEvent';\n\t\t\tcreatedAt: string;\n\t\t\treason: string | null;\n\t };\n\nexport type GitHubMergeQueueEntryState = 'QUEUED' | 'AWAITING_CHECKS' | 'MERGEABLE' | 'UNMERGEABLE' | 'LOCKED';\n\n/** GitHub's `MergeQueueEntry`, as GitLens selects it. */\nexport interface GitHubMergeQueueEntry {\n\tstate: GitHubMergeQueueEntryState;\n\tenqueuedAt: string;\n\t/** Seconds from when it was read. */\n\testimatedTimeToMerge: number | null;\n\tmergeQueue: { url: string } | null;\n\t/** 1-based, in enqueue order. */\n\tposition: number | null;\n}\n\n/** GitHub's stacked-pull-request object. Read-only; all stack mutations are REST-only. */\nexport interface GitHubPullRequestStack {\n\tid: string;\n\tnumber: number;\n\tsize: number;\n\t/** The branch the bottom of the stack targets — the stack's trunk. */\n\tbaseRefName: string;\n}\n\nexport interface GitHubIssue extends Omit<GitHubIssueOrPullRequest, '__typename'> {\n\t/** `Actor` is nullable in GitHub's schema — `null` once the author's account is deleted */\n\tauthor: GitHubMember | null;\n\tassignees: { nodes: GitHubMember[] };\n\tcomments?: {\n\t\ttotalCount: number;\n\t};\n\tlabels?: { nodes: IssueLabel[] };\n\t/** `null` when the issue has none. */\n\tmilestone: GitHubMilestone | null;\n\treactions?: {\n\t\ttotalCount: number;\n\t};\n\trepository: {\n\t\tname: string;\n\t\towner: {\n\t\t\tlogin: string;\n\t\t};\n\t\tviewerPermission: GitHubViewerPermission;\n\t\turl: string;\n\t};\n\tbody: string;\n}\n\nexport type GitHubPullRequestReviewDecision = 'CHANGES_REQUESTED' | 'APPROVED' | 'REVIEW_REQUIRED';\nexport type GitHubPullRequestMergeableState = 'MERGEABLE' | 'CONFLICTING' | 'UNKNOWN';\nexport type GitHubPullRequestStatusCheckRollupState = 'SUCCESS' | 'FAILURE' | 'PENDING' | 'EXPECTED' | 'ERROR';\nexport type GitHubPullRequestReviewState = 'APPROVED' | 'CHANGES_REQUESTED' | 'COMMENTED' | 'DISMISSED' | 'PENDING';\n\ntype GitHubPullRequestReview = {\n\tid: string;\n\tauthor: GitHubMember | null;\n\tstate: GitHubPullRequestReviewState;\n\tcommit?: { oid: string } | null;\n};\n\nexport interface GitHubPullRequest extends GitHubPullRequestLite {\n\tadditions: number;\n\tassignees: {\n\t\tnodes: GitHubMember[];\n\t};\n\tchangedFiles: number;\n\tchecksUrl: string;\n\tdeletions: number;\n\tmergeable: GitHubPullRequestMergeableState;\n\treviewDecision: GitHubPullRequestReviewDecision;\n\tlatestReviews: {\n\t\tnodes: GitHubPullRequestReview[];\n\t};\n\t/**\n\t * The current user's own latest review. `latestReviews` is capped, so on a heavily-reviewed pull request\n\t * the viewer's own review can fall outside that window — which is exactly the row a \"needs my review\"\n\t * surface is asking about.\n\t */\n\tviewerLatestReview: GitHubPullRequestReview | null;\n\treviewRequests: {\n\t\tnodes: {\n\t\t\tasCodeOwner: boolean;\n\t\t\t/** Empty for a team (or anything else that isn't a user), which the `... on User` selection doesn't match. */\n\t\t\trequestedReviewer: Partial<GitHubMember> | null;\n\t\t}[];\n\t};\n\tcommits: {\n\t\ttotalCount: number;\n\t\tnodes: {\n\t\t\tcommit: {\n\t\t\t\tstatusCheckRollup: {\n\t\t\t\t\tstate: 'SUCCESS' | 'FAILURE' | 'PENDING' | 'EXPECTED' | 'ERROR';\n\t\t\t\t} | null;\n\t\t\t};\n\t\t}[];\n\t};\n\ttotalCommentsCount: number;\n\tviewerCanUpdate: boolean;\n}\n\n/**\n * An input beyond a pull request's lifecycle fields that `GitHubApi.getPullRequestsEtagFieldsBatch` can select.\n * Mirrors the integrations package's `PullRequestEtagInclude`, which this package cannot import.\n */\nexport type GitHubPullRequestEtagInclude = 'mergeable' | 'reviewDecision' | 'checks';\n\n/**\n * The change state `GitHubApi.getPullRequestsEtagFieldsBatch` selects: a pull request's lifecycle fields, plus,\n * for each requested {@link GitHubPullRequestEtagInclude}, what its etag reads. Each selection is the full\n * fragment's own, so a value here is the one a full read would have mapped.\n */\nexport interface GitHubPullRequestEtagNode extends Pick<\n\tGitHubPullRequest,\n\t'id' | 'number' | 'state' | 'isDraft' | 'updatedAt' | 'headRefOid'\n> {\n\t/** Only with `mergeable`. */\n\tmergeable?: GitHubPullRequestMergeableState | null;\n\t/** Only with `reviewDecision`. `null` on a repository that requires no review. */\n\treviewDecision?: GitHubPullRequestReviewDecision | null;\n\t/** Only with `checks`. */\n\tcommits?: {\n\t\tnodes: { commit: { statusCheckRollup: { state: GitHubPullRequestStatusCheckRollupState } | null } }[];\n\t};\n\t/** Always selected, but only against github.com, like the full read's. `null` when the pull request isn't queued. */\n\tmergeQueueEntry?: Pick<GitHubMergeQueueEntry, 'state' | 'enqueuedAt'> | null;\n\t/** Always selected, but only against github.com, exactly as the full read selects it. */\n\tmergeQueueEvents?: GitHubMergeQueueEvents | null;\n}\n\n/**\n * An input beyond an issue's lifecycle fields that `GitHubApi.getIssuesEtagFieldsBatch` can select. Mirrors the\n * integrations package's `IssueEtagInclude`, which this package cannot import.\n */\nexport type GitHubIssueEtagInclude = 'reactions';\n\n/**\n * The change state `GitHubApi.getIssuesEtagFieldsBatch` selects, plus, for each requested\n * {@link GitHubIssueEtagInclude}, the full fragment's own selection of it.\n */\nexport interface GitHubIssueEtagNode extends Pick<GitHubIssue, 'id' | 'number' | 'state' | 'updatedAt'> {\n\t/** Only with `reactions`: the thumbs-up reactions, as the full fragment selects them. */\n\treactions?: { totalCount: number };\n}\n\nexport type GitHubViewerPermission =\n\t| 'ADMIN' // Can read, clone, and push to this repository. Can also manage issues, pull requests, and repository settings, including adding collaborators\n\t| 'MAINTAIN' // Can read, clone, and push to this repository. They can also manage issues, pull requests, and some repository settings\n\t| 'WRITE' // Can read, clone, and push to this repository. Can also manage issues and pull requests\n\t| 'TRIAGE' // Can read and clone this repository. Can also manage issues and pull requests\n\t| 'READ' // Can read and clone this repository. Can also open and comment on issues and pull requests\n\t| 'NONE';\n\n/** `ghost` is how github.com renders an actor whose account was deleted, under the handle `ghost` */\nfunction fromGitHubMemberOrGhost(member: GitHubMember | null | undefined): PullRequestMember {\n\tif (member == null) return { id: 'ghost', name: 'ghost', username: 'ghost' };\n\n\treturn {\n\t\tid: member.login,\n\t\tname: member.login,\n\t\tusername: member.login,\n\t\tavatarUrl: member.avatarUrl,\n\t\turl: member.url,\n\t};\n}\n\nexport function fromGitHubPullRequestLite(\n\tpr: GitHubPullRequestLite,\n\tprovider: Provider,\n\tprojection?: PullRequestProjection,\n): PullRequest {\n\treturn new PullRequest(\n\t\tprovider,\n\t\tfromGitHubMemberOrGhost(pr.author),\n\t\tString(pr.number),\n\t\tpr.id,\n\t\tpr.title,\n\t\tpr.permalink,\n\t\t{\n\t\t\towner: pr.repository.owner.login,\n\t\t\trepo: pr.repository.name,\n\t\t\taccessLevel: fromGitHubViewerPermissionToAccessLevel(pr.repository.viewerPermission),\n\t\t},\n\t\tfromGitHubIssueOrPullRequestState(pr.state),\n\t\tnew Date(pr.createdAt),\n\t\tnew Date(pr.updatedAt),\n\t\tpr.closedAt == null ? undefined : new Date(pr.closedAt),\n\t\tpr.mergedAt == null ? undefined : new Date(pr.mergedAt),\n\t\tundefined,\n\t\tundefined,\n\t\t{\n\t\t\thead: {\n\t\t\t\texists: pr.headRepository != null,\n\t\t\t\towner: pr.headRepository?.owner.login,\n\t\t\t\trepo: pr.headRepository?.name,\n\t\t\t\tsha: pr.headRefOid,\n\t\t\t\tbranch: pr.headRefName,\n\t\t\t\turl: pr.headRepository?.url,\n\t\t\t\tcloneHttps: pr.headRepository != null ? `${pr.headRepository.url}.git` : undefined,\n\t\t\t\tcloneSsh: pr.headRepository?.sshUrl,\n\t\t\t\tisFork: pr.headRepository?.isFork,\n\t\t\t},\n\t\t\tbase: {\n\t\t\t\texists: pr.repository != null,\n\t\t\t\towner: pr.repository?.owner.login,\n\t\t\t\trepo: pr.repository?.name,\n\t\t\t\tsha: pr.baseRefOid,\n\t\t\t\tbranch: pr.baseRefName,\n\t\t\t\turl: pr.repository?.url,\n\t\t\t\tcloneHttps: pr.repository != null ? `${pr.repository.url}.git` : undefined,\n\t\t\t\tcloneSsh: pr.repository?.sshUrl,\n\t\t\t\tisFork: pr.repository?.isFork,\n\t\t\t},\n\t\t\tisCrossRepository: pr.isCrossRepository,\n\t\t},\n\t\tpr.isDraft,\n\t\t// The lite fragment selects nothing between `isDraft` and `stack`.\n\t\tundefined, // additions\n\t\tundefined, // deletions\n\t\tundefined, // commentsCount\n\t\tundefined, // thumbsUpCount\n\t\tundefined, // reviewDecision\n\t\tundefined, // reviewRequests\n\t\tundefined, // latestReviews\n\t\tundefined, // assignees\n\t\tundefined, // statusCheckRollupState\n\t\tundefined, // project\n\t\tundefined, // version\n\t\tundefined, // commitCount\n\t\tfromGitHubPullRequestStack(pr),\n\t\tundefined, // filesChanged\n\t\tpr.body ?? undefined,\n\t\tpr.number,\n\t\tundefined, // authoredByMe\n\t\tprojection,\n\t\tundefined, // viewer\n\t\tundefined, // viewerUnresolved\n\t\tfromGitHubMilestone(pr.milestone),\n\t\tfromGitHubPullRequestMergeQueueEntry(pr),\n\t\tpr.isMergeQueueEnabled,\n\t\tfromGitHubMergeQueueRemoval(pr.mergeQueueEvents),\n\t);\n}\n\n/** `undefined` only for a node from a selection that left the milestone out, which no fragment does today. */\nfunction fromGitHubMilestone(milestone: GitHubMilestone | null | undefined): IssueMilestone | null | undefined {\n\tif (milestone == null) return milestone;\n\n\treturn {\n\t\tid: milestone.id,\n\t\ttitle: milestone.title,\n\t\tstate: milestone.state === 'CLOSED' ? 'closed' : 'open',\n\t\t...(milestone.dueOn != null ? { dueDate: new Date(milestone.dueOn) } : {}),\n\t\t...(milestone.url ? { url: milestone.url } : {}),\n\t};\n}\n\n/** Both fields are absent on GitHub Enterprise Server (never selected) and `null` when unstacked. */\nfunction fromGitHubPullRequestStack(pr: GitHubPullRequestLite): PullRequestStackInfo | undefined {\n\tif (pr.stack == null || pr.stackEntry == null) return undefined;\n\n\treturn {\n\t\tid: pr.stack.id,\n\t\tnumber: pr.stack.number,\n\t\tsize: pr.stack.size,\n\t\tposition: pr.stackEntry.position,\n\t\tbaseRef: pr.stack.baseRefName,\n\t};\n}\n\n/** Absent on GitHub Enterprise Server (never selected) and `null` when the pull request isn't queued. */\nfunction fromGitHubPullRequestMergeQueueEntry(pr: GitHubPullRequestLite): PullRequestMergeQueueEntry | undefined {\n\treturn pr.mergeQueueEntry != null ? fromGitHubMergeQueueEntry(pr.mergeQueueEntry) : undefined;\n}\n\n/**\n * The one place a GitHub `MergeQueueEntry` becomes a {@link PullRequestMergeQueueEntry}, whichever read selected it.\n * GitHub's estimate is a duration from the moment it answered, so it's fixed to a date here, at read time, rather\n * than added to the clock at each render, where a held entry would never count down.\n */\nexport function fromGitHubMergeQueueEntry(entry: GitHubMergeQueueEntry): PullRequestMergeQueueEntry {\n\treturn {\n\t\tstate: fromGitHubMergeQueueEntryState(entry.state),\n\t\tenqueuedAt: new Date(entry.enqueuedAt),\n\t\testimatedMergeAt:\n\t\t\tentry.estimatedTimeToMerge != null ? new Date(Date.now() + entry.estimatedTimeToMerge * 1000) : undefined,\n\t\turl: entry.mergeQueue?.url,\n\t\tposition: entry.position ?? undefined,\n\t};\n}\n\n/**\n * The pull request's latest removal from its merge queue, from its latest merge-queue event: set only when that\n * event is a removal (so it hasn't rejoined since) whose reason isn't `merged` (GitHub removes every merged entry\n * with that reason). Absent on GitHub Enterprise Server (never selected). Shared by the full read and the etag's\n * cheap check, so both derive the same removal.\n */\nexport function fromGitHubMergeQueueRemoval(\n\tevents: GitHubMergeQueueEvents | null | undefined,\n): PullRequestMergeQueueRemoval | undefined {\n\tconst latest = events?.nodes?.at(-1);\n\tif (latest?.__typename !== 'RemovedFromMergeQueueEvent') return undefined;\n\n\tconst reason = latest.reason ?? '';\n\tif (reason.toLowerCase() === 'merged') return undefined;\n\n\treturn { reason: reason, removedAt: new Date(latest.createdAt) };\n}\n\n/** A state GitHub adds later still means the pull request is in the queue, so it reads as Queued rather than\n * dropping the entry, which would report a queued pull request as not queued. */\nexport function fromGitHubMergeQueueEntryState(state: GitHubMergeQueueEntryState): PullRequestMergeQueueState {\n\tswitch (state) {\n\t\tcase 'AWAITING_CHECKS':\n\t\t\treturn PullRequestMergeQueueState.AwaitingChecks;\n\t\tcase 'MERGEABLE':\n\t\t\treturn PullRequestMergeQueueState.Mergeable;\n\t\tcase 'UNMERGEABLE':\n\t\t\treturn PullRequestMergeQueueState.Unmergeable;\n\t\tcase 'LOCKED':\n\t\t\treturn PullRequestMergeQueueState.Locked;\n\t\tdefault:\n\t\t\treturn PullRequestMergeQueueState.Queued;\n\t}\n}\n\nexport function fromGitHubIssueOrPullRequestState(state: GitHubPullRequestState): PullRequestState {\n\treturn state === 'MERGED' ? 'merged' : state === 'CLOSED' ? 'closed' : 'opened';\n}\n\nexport function toGitHubPullRequestState(state: PullRequestState): GitHubPullRequestState {\n\treturn state === 'merged' ? 'MERGED' : state === 'closed' ? 'CLOSED' : 'OPEN';\n}\n\nexport function fromGitHubPullRequestReviewDecision(\n\treviewDecision: GitHubPullRequestReviewDecision,\n): PullRequestReviewDecision {\n\tswitch (reviewDecision) {\n\t\tcase 'APPROVED':\n\t\t\treturn PullRequestReviewDecision.Approved;\n\t\tcase 'CHANGES_REQUESTED':\n\t\t\treturn PullRequestReviewDecision.ChangesRequested;\n\t\tcase 'REVIEW_REQUIRED':\n\t\t\treturn PullRequestReviewDecision.ReviewRequired;\n\t}\n}\n\nexport function fromGitHubPullRequestReviewState(state: GitHubPullRequestReviewState): PullRequestReviewState {\n\tswitch (state) {\n\t\tcase 'APPROVED':\n\t\t\treturn PullRequestReviewState.Approved;\n\t\tcase 'CHANGES_REQUESTED':\n\t\t\treturn PullRequestReviewState.ChangesRequested;\n\t\tcase 'COMMENTED':\n\t\t\treturn PullRequestReviewState.Commented;\n\t\tcase 'DISMISSED':\n\t\t\treturn PullRequestReviewState.Dismissed;\n\t\tcase 'PENDING':\n\t\t\treturn PullRequestReviewState.Pending;\n\t}\n}\n\nexport function toGitHubPullRequestReviewDecision(\n\treviewDecision: PullRequestReviewDecision,\n): GitHubPullRequestReviewDecision {\n\tswitch (reviewDecision) {\n\t\tcase PullRequestReviewDecision.Approved:\n\t\t\treturn 'APPROVED';\n\t\tcase PullRequestReviewDecision.ChangesRequested:\n\t\t\treturn 'CHANGES_REQUESTED';\n\t\tcase PullRequestReviewDecision.ReviewRequired:\n\t\t\treturn 'REVIEW_REQUIRED';\n\t}\n}\n\nexport function fromGitHubPullRequestMergeableState(\n\tmergeableState: GitHubPullRequestMergeableState,\n): PullRequestMergeableState {\n\tswitch (mergeableState) {\n\t\tcase 'MERGEABLE':\n\t\t\treturn PullRequestMergeableState.Mergeable;\n\t\tcase 'CONFLICTING':\n\t\t\treturn PullRequestMergeableState.Conflicting;\n\t\tcase 'UNKNOWN':\n\t\t\treturn PullRequestMergeableState.Unknown;\n\t}\n}\n\nexport function toGitHubPullRequestMergeableState(\n\tmergeableState: PullRequestMergeableState,\n): GitHubPullRequestMergeableState {\n\tswitch (mergeableState) {\n\t\tcase PullRequestMergeableState.Mergeable:\n\t\t\treturn 'MERGEABLE';\n\t\tcase PullRequestMergeableState.Conflicting:\n\t\t\treturn 'CONFLICTING';\n\t\tcase PullRequestMergeableState.FailingChecks:\n\t\t\treturn 'UNKNOWN';\n\t\tcase PullRequestMergeableState.BlockedByPolicy:\n\t\t\treturn 'UNKNOWN';\n\t\tcase PullRequestMergeableState.Unknown:\n\t\t\treturn 'UNKNOWN';\n\t}\n}\n\nexport function fromGitHubPullRequestStatusCheckRollupState(\n\tstate: GitHubPullRequestStatusCheckRollupState | null | undefined,\n): PullRequestStatusCheckRollupState | undefined {\n\tswitch (state) {\n\t\tcase 'SUCCESS':\n\t\tcase 'EXPECTED':\n\t\t\treturn PullRequestStatusCheckRollupState.Success;\n\t\tcase 'FAILURE':\n\t\tcase 'ERROR':\n\t\t\treturn PullRequestStatusCheckRollupState.Failed;\n\t\tcase 'PENDING':\n\t\t\treturn PullRequestStatusCheckRollupState.Pending;\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\nexport function fromGitHubPullRequest(\n\tpr: GitHubPullRequest,\n\tprovider: Provider,\n\tprojection?: PullRequestProjection,\n): PullRequest {\n\t// `latestReviews` is capped, so keep the viewer's own review even when it falls outside that window, deduped\n\t// by review id since the two selections overlap. Unsubmitted drafts are dropped from the union rather than\n\t// from the viewer's side alone: `PENDING` is in GitHub's review-state enum on both selections, and the field\n\t// this feeds is documented as reviews already SUBMITTED — a draft there tells a \"needs my review\" consumer\n\t// the review is done, and a reviewer with a submitted review plus a draft would get two conflicting rows.\n\tconst viewerLatestReview = pr.viewerLatestReview;\n\tconst latestReviews = [\n\t\t...pr.latestReviews.nodes,\n\t\t...(viewerLatestReview != null && !pr.latestReviews.nodes.some(r => r.id === viewerLatestReview.id)\n\t\t\t? [viewerLatestReview]\n\t\t\t: []),\n\t].filter(review => review.state !== 'PENDING');\n\n\treturn new PullRequest(\n\t\tprovider,\n\t\tfromGitHubMemberOrGhost(pr.author),\n\t\tString(pr.number),\n\t\tpr.id,\n\t\tpr.title,\n\t\tpr.permalink,\n\t\t{\n\t\t\towner: pr.repository.owner.login,\n\t\t\trepo: pr.repository.name,\n\t\t\taccessLevel: fromGitHubViewerPermissionToAccessLevel(pr.repository.viewerPermission),\n\t\t},\n\t\tfromGitHubIssueOrPullRequestState(pr.state),\n\t\tnew Date(pr.createdAt),\n\t\tnew Date(pr.updatedAt),\n\t\tpr.closedAt == null ? undefined : new Date(pr.closedAt),\n\t\tpr.mergedAt == null ? undefined : new Date(pr.mergedAt),\n\t\tfromGitHubPullRequestMergeableState(pr.mergeable),\n\t\tpr.viewerCanUpdate,\n\t\t{\n\t\t\thead: {\n\t\t\t\texists: pr.headRepository != null,\n\t\t\t\towner: pr.headRepository?.owner.login,\n\t\t\t\trepo: pr.headRepository?.name,\n\t\t\t\tsha: pr.headRefOid,\n\t\t\t\tbranch: pr.headRefName,\n\t\t\t\turl: pr.headRepository?.url,\n\t\t\t\tcloneHttps: pr.headRepository != null ? `${pr.headRepository.url}.git` : undefined,\n\t\t\t\tcloneSsh: pr.headRepository?.sshUrl,\n\t\t\t\tisFork: pr.headRepository?.isFork,\n\t\t\t},\n\t\t\tbase: {\n\t\t\t\texists: pr.repository != null,\n\t\t\t\towner: pr.repository?.owner.login,\n\t\t\t\trepo: pr.repository?.name,\n\t\t\t\tsha: pr.baseRefOid,\n\t\t\t\tbranch: pr.baseRefName,\n\t\t\t\turl: pr.repository?.url,\n\t\t\t\tcloneHttps: pr.repository != null ? `${pr.repository.url}.git` : undefined,\n\t\t\t\tcloneSsh: pr.repository?.sshUrl,\n\t\t\t\tisFork: pr.repository?.isFork,\n\t\t\t},\n\t\t\tisCrossRepository: pr.isCrossRepository,\n\t\t},\n\t\tpr.isDraft,\n\t\tpr.additions,\n\t\tpr.deletions,\n\t\tpr.totalCommentsCount,\n\t\tundefined, // thumbsUpCount: the fragment selects no reactions\n\t\tfromGitHubPullRequestReviewDecision(pr.reviewDecision),\n\t\tpr.reviewRequests.nodes\n\t\t\t.map(r =>\n\t\t\t\tr.requestedReviewer != null\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tisCodeOwner: r.asCodeOwner,\n\t\t\t\t\t\t\treviewer: {\n\t\t\t\t\t\t\t\t// A team has no login: an empty id, which matches no one, rather than a missing one.\n\t\t\t\t\t\t\t\tid: r.requestedReviewer.login ?? '',\n\t\t\t\t\t\t\t\tname: r.requestedReviewer.login,\n\t\t\t\t\t\t\t\tusername: r.requestedReviewer.login,\n\t\t\t\t\t\t\t\tavatarUrl: r.requestedReviewer.avatarUrl,\n\t\t\t\t\t\t\t\turl: r.requestedReviewer.url,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tstate: PullRequestReviewState.ReviewRequested,\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t)\n\t\t\t.filter(<T>(r?: T): r is T => Boolean(r)),\n\t\tlatestReviews.map(r => ({\n\t\t\treviewer: fromGitHubMemberOrGhost(r.author),\n\t\t\tstate: fromGitHubPullRequestReviewState(r.state),\n\t\t\tcommitOid: r.commit?.oid,\n\t\t})),\n\t\tpr.assignees.nodes.map(r => ({\n\t\t\tid: r.login,\n\t\t\tname: r.login,\n\t\t\tusername: r.login,\n\t\t\tavatarUrl: r.avatarUrl,\n\t\t\turl: r.url,\n\t\t})),\n\t\tfromGitHubPullRequestStatusCheckRollupState(pr.commits.nodes?.[0]?.commit.statusCheckRollup?.state),\n\t\tundefined, // project\n\t\tundefined, // version\n\t\tpr.commits.totalCount,\n\t\tfromGitHubPullRequestStack(pr),\n\t\tpr.changedFiles,\n\t\tpr.body ?? undefined,\n\t\tpr.number,\n\t\tundefined, // authoredByMe\n\t\tprojection,\n\t\tundefined, // viewer\n\t\tundefined, // viewerUnresolved\n\t\tfromGitHubMilestone(pr.milestone),\n\t\tfromGitHubPullRequestMergeQueueEntry(pr),\n\t\tpr.isMergeQueueEnabled,\n\t\tfromGitHubMergeQueueRemoval(pr.mergeQueueEvents),\n\t);\n}\n\nexport function fromGitHubIssue(value: GitHubIssue, provider: Provider, projection?: IssueProjection): Issue {\n\treturn new Issue(\n\t\t{\n\t\t\tid: provider.id,\n\t\t\tname: provider.name,\n\t\t\tdomain: provider.domain,\n\t\t\ticon: provider.icon,\n\t\t},\n\t\tString(value.number),\n\t\tvalue.id,\n\t\tvalue.title,\n\t\tvalue.url,\n\t\tnew Date(value.createdAt),\n\t\tnew Date(value.updatedAt),\n\t\tvalue.closed,\n\t\tfromGitHubIssueOrPullRequestState(value.state),\n\t\tvalue.author == null\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tid: value.author.login,\n\t\t\t\t\tname: value.author.login,\n\t\t\t\t\tusername: value.author.login,\n\t\t\t\t\tavatarUrl: value.author.avatarUrl,\n\t\t\t\t\turl: value.author.url,\n\t\t\t\t},\n\t\tvalue.assignees.nodes.map(assignee => ({\n\t\t\tid: assignee.login,\n\t\t\tname: assignee.login,\n\t\t\tusername: assignee.login,\n\t\t\tavatarUrl: assignee.avatarUrl,\n\t\t\turl: assignee.url,\n\t\t})),\n\t\t{\n\t\t\towner: value.repository.owner.login,\n\t\t\trepo: value.repository.name,\n\t\t\taccessLevel: fromGitHubViewerPermissionToAccessLevel(value.repository.viewerPermission),\n\t\t\turl: value.repository.url,\n\t\t},\n\t\tvalue.closedAt == null ? undefined : new Date(value.closedAt),\n\t\tvalue.labels?.nodes == null\n\t\t\t? undefined\n\t\t\t: value.labels.nodes.map(label => ({\n\t\t\t\t\tcolor: label.color,\n\t\t\t\t\tname: label.name,\n\t\t\t\t})),\n\t\tvalue.comments?.totalCount,\n\t\tvalue.reactions?.totalCount,\n\t\tvalue.body,\n\t\tundefined, // project\n\t\tundefined, // number\n\t\tundefined, // issueType\n\t\tundefined, // providerState\n\t\tundefined, // bodyFormat\n\t\tundefined, // iterations\n\t\tprojection,\n\t\tundefined, // bodyField\n\t\tundefined, // viewer\n\t\tundefined, // viewerUnresolved\n\t\tundefined, // syncedWith\n\t\tfromGitHubMilestone(value.milestone),\n\t);\n}\n\nfunction fromGitHubViewerPermissionToAccessLevel(\n\tpermission: GitHubViewerPermission | null | undefined,\n): RepositoryAccessLevel {\n\tswitch (permission) {\n\t\tcase 'ADMIN':\n\t\t\treturn RepositoryAccessLevel.Admin;\n\t\tcase 'MAINTAIN':\n\t\t\treturn RepositoryAccessLevel.Maintain;\n\t\tcase 'WRITE':\n\t\t\treturn RepositoryAccessLevel.Write;\n\t\tcase 'TRIAGE':\n\t\t\treturn RepositoryAccessLevel.Triage;\n\t\tcase 'READ':\n\t\t\treturn RepositoryAccessLevel.Read;\n\t\tdefault:\n\t\t\treturn RepositoryAccessLevel.None;\n\t}\n}\n"],"mappings":";;;;AA0GA,SAAgB,qBAAqB,QAAgE;CACpG,QAAQ,QAAR;EACC,KAAK,SACJ,OAAO,mBAAmB;EAC3B,KAAK;EACL,KAAK,YACJ,OAAO,mBAAmB;EAC3B,KAAK,WACJ,OAAO,mBAAmB;EAC3B,KAAK,WACJ,OAAO,mBAAmB;EAC3B,KAAK,UACJ,OAAO,mBAAmB;CAC5B;AAED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SAAS,CACpC;AACD;AAEA,SAAS,wCACR,YACwB;CACxB,QAAQ,YAAR;EACC,KAAK,SACJ,OAAA;EACD,KAAK,YACJ,OAAA;EACD,KAAK,SACJ,OAAA;EACD,KAAK,UACJ,OAAA;EACD,KAAK,QACJ,OAAA;EACD,SACC,OAAA;CACF;AACD"}
1
+ {"version":3,"file":"models.js","names":[],"sources":["../../../../plus/git-github/src/models.ts"],"sourcesContent":["import type { Endpoints } from '@octokit/types';\nimport { GitFileIndexStatus } from '@gitlens/git/models/fileStatus.js';\nimport type { IssueLabel, IssueProjection } from '@gitlens/git/models/issue.js';\nimport { Issue, RepositoryAccessLevel } from '@gitlens/git/models/issue.js';\nimport type { IssueMilestone } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type {\n\tPullRequestMember,\n\tPullRequestMergeQueueEntry,\n\tPullRequestMergeQueueRemoval,\n\tPullRequestProjection,\n\tPullRequestStackInfo,\n\tPullRequestState,\n} from '@gitlens/git/models/pullRequest.js';\nimport {\n\tPullRequest,\n\tPullRequestMergeableState,\n\tPullRequestMergeQueueState,\n\tPullRequestReviewDecision,\n\tPullRequestReviewState,\n\tPullRequestStatusCheckRollupState,\n} from '@gitlens/git/models/pullRequest.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\n\nexport interface GitHubBlame {\n\tranges: GitHubBlameRange[];\n\tviewer?: string;\n}\n\nexport interface GitHubBlameRange {\n\tstartingLine: number;\n\tendingLine: number;\n\tcommit: GitHubCommit;\n}\n\nexport interface GitHubBranch {\n\tname: string;\n\ttarget: {\n\t\toid: string;\n\t\tauthoredDate: string;\n\t\tcommittedDate: string;\n\t};\n}\n\nexport interface GitHubCommit {\n\toid: string;\n\tparents: { nodes: { oid: string }[] };\n\tmessage: string;\n\tadditions?: number | undefined;\n\tchangedFiles?: number | undefined;\n\tdeletions?: number | undefined;\n\tauthor: { avatarUrl: string | undefined; date: string; email: string | undefined; name: string };\n\tcommitter: { date: string; email: string | undefined; name: string };\n\n\tfiles?: Endpoints['GET /repos/{owner}/{repo}/commits/{ref}']['response']['data']['files'];\n}\n\nexport interface GitHubCommitRef {\n\toid: string;\n}\n\nexport type GitHubContributor = Endpoints['GET /repos/{owner}/{repo}/contributors']['response']['data'][0];\n\nexport type GitHubSshSigningKey = Endpoints['GET /users/{username}/ssh_signing_keys']['response']['data'][0];\n\nexport interface GitHubMember {\n\tlogin: string;\n\tavatarUrl: string;\n\turl: string;\n}\n\nexport interface GitHubPagedResult<T> {\n\tpageInfo: GitHubPageInfo;\n\ttotalCount: number;\n\tvalues: T[];\n}\nexport interface GitHubPageInfo {\n\tstartCursor?: string | null;\n\tendCursor?: string | null;\n\thasNextPage: boolean;\n\thasPreviousPage: boolean;\n}\n\nexport interface GitHubTag {\n\tname: string;\n\ttarget: {\n\t\toid: string;\n\t\tauthoredDate?: string;\n\t\tcommittedDate?: string;\n\t\tmessage?: string | null;\n\t\ttagger?: {\n\t\t\tdate: string;\n\t\t} | null;\n\n\t\ttarget?: {\n\t\t\toid?: string;\n\t\t\tauthoredDate?: string;\n\t\t\tcommittedDate?: string;\n\t\t\tmessage?: string | null;\n\t\t};\n\t};\n}\n\nexport type GitHubCommitFileStatus = NonNullable<\n\tEndpoints['GET /repos/{owner}/{repo}/commits/{ref}']['response']['data']['files']\n>[0]['status'];\n\nexport function fromCommitFileStatus(status: GitHubCommitFileStatus): GitFileIndexStatus | undefined {\n\tswitch (status) {\n\t\tcase 'added':\n\t\t\treturn GitFileIndexStatus.Added;\n\t\tcase 'changed':\n\t\tcase 'modified':\n\t\t\treturn GitFileIndexStatus.Modified;\n\t\tcase 'removed':\n\t\t\treturn GitFileIndexStatus.Deleted;\n\t\tcase 'renamed':\n\t\t\treturn GitFileIndexStatus.Renamed;\n\t\tcase 'copied':\n\t\t\treturn GitFileIndexStatus.Copied;\n\t}\n\treturn undefined;\n}\n\nexport interface GitHubIssueOrPullRequest {\n\t__typename: 'Issue' | 'PullRequest';\n\n\tclosed: boolean;\n\tclosedAt: string | null;\n\tcreatedAt: string;\n\tid: string;\n\tnumber: number;\n\tstate: GitHubIssueOrPullRequestState;\n\ttitle: string;\n\tupdatedAt: string;\n\turl: string;\n}\n\nexport type GitHubIssueState = 'OPEN' | 'CLOSED';\nexport type GitHubPullRequestState = 'OPEN' | 'CLOSED' | 'MERGED';\nexport type GitHubIssueOrPullRequestState = GitHubIssueState | GitHubPullRequestState;\n\n/** GitHub's `Milestone`, as `gqlMilestoneFragment` selects it. */\nexport interface GitHubMilestone {\n\tid: string;\n\ttitle: string;\n\tstate: 'OPEN' | 'CLOSED';\n\tdueOn: string | null;\n\turl: string;\n}\n\nexport interface GitHubPullRequestLite extends Omit<GitHubIssueOrPullRequest, '__typename'> {\n\t/** `Actor` is nullable in GitHub's schema — `null` once the author's account is deleted */\n\tauthor: GitHubMember | null;\n\tbody: string | null;\n\n\tbaseRefName: string;\n\tbaseRefOid: string;\n\n\theadRefName: string;\n\theadRefOid: string;\n\theadRepository: {\n\t\tisFork: boolean;\n\t\tname: string;\n\t\towner: {\n\t\t\tlogin: string;\n\t\t};\n\t\tsshUrl: string;\n\t\turl: string;\n\t};\n\n\tisCrossRepository: boolean;\n\tisDraft: boolean;\n\tmergedAt: string | null;\n\t/** `null` when the pull request has none. */\n\tmilestone: GitHubMilestone | null;\n\tpermalink: string;\n\n\trepository: {\n\t\tisFork: boolean;\n\t\tname: string;\n\t\towner: {\n\t\t\tlogin: string;\n\t\t};\n\t\tsshUrl: string;\n\t\turl: string;\n\t\tviewerPermission: GitHubViewerPermission;\n\t};\n\n\t/** Only selected against github.com — GitHub Enterprise Server schemas lag and reject the field. */\n\tstack?: GitHubPullRequestStack | null;\n\t/** Only selected against github.com — see `stack`. */\n\tstackEntry?: { position: number } | null;\n\t/** Only selected against github.com, for a read that asks for it (`mergeQueue`) or, when it doesn't say, a host\n\t * that opts in (`GitHubApiConfig.getPullRequestReadOptions`) — see `stack`. `null` when the pull request isn't\n\t * queued. */\n\tmergeQueueEntry?: GitHubMergeQueueEntry | null;\n\t/** Selected with `mergeQueueEntry`. True whenever the base branch requires a merge queue, whatever the pull\n\t * request's state. */\n\tisMergeQueueEnabled?: boolean;\n\t/** Selected with `mergeQueueEntry`. The latest merge-queue event only (`timelineItems(last: 1)`). */\n\tmergeQueueEvents?: GitHubMergeQueueEvents | null;\n}\n\n/** The `timelineItems` of a pull request filtered to its merge-queue events, as GitLens selects them. */\nexport interface GitHubMergeQueueEvents {\n\tnodes: (GitHubMergeQueueEvent | null)[] | null;\n}\n\n/** A merge-queue timeline event. Only a removal's fields are selected: the latest event being an addition is all an\n * addition says. */\nexport type GitHubMergeQueueEvent =\n\t| { __typename: 'AddedToMergeQueueEvent' }\n\t| {\n\t\t\t__typename: 'RemovedFromMergeQueueEvent';\n\t\t\tcreatedAt: string;\n\t\t\treason: string | null;\n\t };\n\nexport type GitHubMergeQueueEntryState = 'QUEUED' | 'AWAITING_CHECKS' | 'MERGEABLE' | 'UNMERGEABLE' | 'LOCKED';\n\n/** GitHub's `MergeQueueEntry`, as GitLens selects it. */\nexport interface GitHubMergeQueueEntry {\n\tstate: GitHubMergeQueueEntryState;\n\tenqueuedAt: string;\n\t/** Seconds from when it was read. */\n\testimatedTimeToMerge: number | null;\n\tmergeQueue: { url: string } | null;\n\t/** 1-based, in enqueue order. */\n\tposition: number | null;\n}\n\n/** GitHub's stacked-pull-request object. Read-only; all stack mutations are REST-only. */\nexport interface GitHubPullRequestStack {\n\tid: string;\n\tnumber: number;\n\tsize: number;\n\t/** The branch the bottom of the stack targets — the stack's trunk. */\n\tbaseRefName: string;\n}\n\nexport interface GitHubIssue extends Omit<GitHubIssueOrPullRequest, '__typename'> {\n\t/** `Actor` is nullable in GitHub's schema — `null` once the author's account is deleted */\n\tauthor: GitHubMember | null;\n\tassignees: { nodes: GitHubMember[] };\n\tcomments?: {\n\t\ttotalCount: number;\n\t};\n\tlabels?: { nodes: IssueLabel[] };\n\t/** `null` when the issue has none. */\n\tmilestone: GitHubMilestone | null;\n\treactions?: {\n\t\ttotalCount: number;\n\t};\n\trepository: {\n\t\tname: string;\n\t\towner: {\n\t\t\tlogin: string;\n\t\t};\n\t\tviewerPermission: GitHubViewerPermission;\n\t\turl: string;\n\t};\n\tbody: string;\n}\n\nexport type GitHubPullRequestReviewDecision = 'CHANGES_REQUESTED' | 'APPROVED' | 'REVIEW_REQUIRED';\nexport type GitHubPullRequestMergeableState = 'MERGEABLE' | 'CONFLICTING' | 'UNKNOWN';\nexport type GitHubPullRequestStatusCheckRollupState = 'SUCCESS' | 'FAILURE' | 'PENDING' | 'EXPECTED' | 'ERROR';\nexport type GitHubPullRequestReviewState = 'APPROVED' | 'CHANGES_REQUESTED' | 'COMMENTED' | 'DISMISSED' | 'PENDING';\n\ntype GitHubPullRequestReview = {\n\tid: string;\n\tauthor: GitHubMember | null;\n\tstate: GitHubPullRequestReviewState;\n\tcommit?: { oid: string } | null;\n};\n\nexport interface GitHubPullRequest extends GitHubPullRequestLite {\n\tadditions: number;\n\tassignees: {\n\t\tnodes: GitHubMember[];\n\t};\n\tchangedFiles: number;\n\tchecksUrl: string;\n\tdeletions: number;\n\tmergeable: GitHubPullRequestMergeableState;\n\treviewDecision: GitHubPullRequestReviewDecision;\n\tlatestReviews: {\n\t\tnodes: GitHubPullRequestReview[];\n\t};\n\t/**\n\t * The current user's own latest review. `latestReviews` is capped, so on a heavily-reviewed pull request\n\t * the viewer's own review can fall outside that window — which is exactly the row a \"needs my review\"\n\t * surface is asking about.\n\t */\n\tviewerLatestReview: GitHubPullRequestReview | null;\n\treviewRequests: {\n\t\tnodes: {\n\t\t\tasCodeOwner: boolean;\n\t\t\t/** Empty for a team (or anything else that isn't a user), which the `... on User` selection doesn't match. */\n\t\t\trequestedReviewer: Partial<GitHubMember> | null;\n\t\t}[];\n\t};\n\tcommits: {\n\t\ttotalCount: number;\n\t\tnodes: {\n\t\t\tcommit: {\n\t\t\t\tstatusCheckRollup: {\n\t\t\t\t\tstate: 'SUCCESS' | 'FAILURE' | 'PENDING' | 'EXPECTED' | 'ERROR';\n\t\t\t\t} | null;\n\t\t\t};\n\t\t}[];\n\t};\n\ttotalCommentsCount: number;\n\tviewerCanUpdate: boolean;\n}\n\n/**\n * An input beyond a pull request's lifecycle fields that `GitHubApi.getPullRequestsEtagFieldsBatch` can select.\n * Mirrors the integrations package's `PullRequestEtagInclude`, which this package cannot import.\n */\nexport type GitHubPullRequestEtagInclude = 'mergeable' | 'reviewDecision' | 'checks';\n\n/**\n * The change state `GitHubApi.getPullRequestsEtagFieldsBatch` selects: a pull request's lifecycle fields, plus,\n * for each requested {@link GitHubPullRequestEtagInclude}, what its etag reads. Each selection is the full\n * fragment's own, so a value here is the one a full read would have mapped.\n */\nexport interface GitHubPullRequestEtagNode extends Pick<\n\tGitHubPullRequest,\n\t'id' | 'number' | 'state' | 'isDraft' | 'updatedAt' | 'headRefOid'\n> {\n\t/** Only with `mergeable`. */\n\tmergeable?: GitHubPullRequestMergeableState | null;\n\t/** Only with `reviewDecision`. `null` on a repository that requires no review. */\n\treviewDecision?: GitHubPullRequestReviewDecision | null;\n\t/** Only with `checks`. */\n\tcommits?: {\n\t\tnodes: { commit: { statusCheckRollup: { state: GitHubPullRequestStatusCheckRollupState } | null } }[];\n\t};\n\t/** Selected when the read selects merge-queue data, like the full read's. `null` when the pull request isn't queued. */\n\tmergeQueueEntry?: Pick<GitHubMergeQueueEntry, 'state' | 'enqueuedAt'> | null;\n\t/** Selected when the read selects merge-queue data, exactly as the full read selects it. */\n\tmergeQueueEvents?: GitHubMergeQueueEvents | null;\n\t/**\n\t * Selected with the merge-queue data and nothing else, so its presence says the read selected it. Its value is\n\t * never an etag input: only a change to the base branch's rules moves it.\n\t */\n\tisMergeQueueEnabled?: boolean;\n}\n\n/**\n * An input beyond an issue's lifecycle fields that `GitHubApi.getIssuesEtagFieldsBatch` can select. Mirrors the\n * integrations package's `IssueEtagInclude`, which this package cannot import.\n */\nexport type GitHubIssueEtagInclude = 'reactions';\n\n/**\n * The change state `GitHubApi.getIssuesEtagFieldsBatch` selects, plus, for each requested\n * {@link GitHubIssueEtagInclude}, the full fragment's own selection of it.\n */\nexport interface GitHubIssueEtagNode extends Pick<GitHubIssue, 'id' | 'number' | 'state' | 'updatedAt'> {\n\t/** Only with `reactions`: the thumbs-up reactions, as the full fragment selects them. */\n\treactions?: { totalCount: number };\n}\n\nexport type GitHubViewerPermission =\n\t| 'ADMIN' // Can read, clone, and push to this repository. Can also manage issues, pull requests, and repository settings, including adding collaborators\n\t| 'MAINTAIN' // Can read, clone, and push to this repository. They can also manage issues, pull requests, and some repository settings\n\t| 'WRITE' // Can read, clone, and push to this repository. Can also manage issues and pull requests\n\t| 'TRIAGE' // Can read and clone this repository. Can also manage issues and pull requests\n\t| 'READ' // Can read and clone this repository. Can also open and comment on issues and pull requests\n\t| 'NONE';\n\n/** `ghost` is how github.com renders an actor whose account was deleted, under the handle `ghost` */\nfunction fromGitHubMemberOrGhost(member: GitHubMember | null | undefined): PullRequestMember {\n\tif (member == null) return { id: 'ghost', name: 'ghost', username: 'ghost' };\n\n\treturn {\n\t\tid: member.login,\n\t\tname: member.login,\n\t\tusername: member.login,\n\t\tavatarUrl: member.avatarUrl,\n\t\turl: member.url,\n\t};\n}\n\nexport function fromGitHubPullRequestLite(\n\tpr: GitHubPullRequestLite,\n\tprovider: Provider,\n\tprojection?: PullRequestProjection,\n): PullRequest {\n\treturn new PullRequest(\n\t\tprovider,\n\t\tfromGitHubMemberOrGhost(pr.author),\n\t\tString(pr.number),\n\t\tpr.id,\n\t\tpr.title,\n\t\tpr.permalink,\n\t\t{\n\t\t\towner: pr.repository.owner.login,\n\t\t\trepo: pr.repository.name,\n\t\t\taccessLevel: fromGitHubViewerPermissionToAccessLevel(pr.repository.viewerPermission),\n\t\t},\n\t\tfromGitHubIssueOrPullRequestState(pr.state),\n\t\tnew Date(pr.createdAt),\n\t\tnew Date(pr.updatedAt),\n\t\tpr.closedAt == null ? undefined : new Date(pr.closedAt),\n\t\tpr.mergedAt == null ? undefined : new Date(pr.mergedAt),\n\t\tundefined,\n\t\tundefined,\n\t\t{\n\t\t\thead: {\n\t\t\t\texists: pr.headRepository != null,\n\t\t\t\towner: pr.headRepository?.owner.login,\n\t\t\t\trepo: pr.headRepository?.name,\n\t\t\t\tsha: pr.headRefOid,\n\t\t\t\tbranch: pr.headRefName,\n\t\t\t\turl: pr.headRepository?.url,\n\t\t\t\tcloneHttps: pr.headRepository != null ? `${pr.headRepository.url}.git` : undefined,\n\t\t\t\tcloneSsh: pr.headRepository?.sshUrl,\n\t\t\t\tisFork: pr.headRepository?.isFork,\n\t\t\t},\n\t\t\tbase: {\n\t\t\t\texists: pr.repository != null,\n\t\t\t\towner: pr.repository?.owner.login,\n\t\t\t\trepo: pr.repository?.name,\n\t\t\t\tsha: pr.baseRefOid,\n\t\t\t\tbranch: pr.baseRefName,\n\t\t\t\turl: pr.repository?.url,\n\t\t\t\tcloneHttps: pr.repository != null ? `${pr.repository.url}.git` : undefined,\n\t\t\t\tcloneSsh: pr.repository?.sshUrl,\n\t\t\t\tisFork: pr.repository?.isFork,\n\t\t\t},\n\t\t\tisCrossRepository: pr.isCrossRepository,\n\t\t},\n\t\tpr.isDraft,\n\t\t// The lite fragment selects nothing between `isDraft` and `stack`.\n\t\tundefined, // additions\n\t\tundefined, // deletions\n\t\tundefined, // commentsCount\n\t\tundefined, // thumbsUpCount\n\t\tundefined, // reviewDecision\n\t\tundefined, // reviewRequests\n\t\tundefined, // latestReviews\n\t\tundefined, // assignees\n\t\tundefined, // statusCheckRollupState\n\t\tundefined, // project\n\t\tundefined, // version\n\t\tundefined, // commitCount\n\t\tfromGitHubPullRequestStack(pr),\n\t\tundefined, // filesChanged\n\t\tpr.body ?? undefined,\n\t\tpr.number,\n\t\tundefined, // authoredByMe\n\t\tprojection,\n\t\tundefined, // viewer\n\t\tundefined, // viewerUnresolved\n\t\tfromGitHubMilestone(pr.milestone),\n\t\tfromGitHubPullRequestMergeQueueEntry(pr),\n\t\tpr.isMergeQueueEnabled,\n\t\tfromGitHubMergeQueueRemoval(pr.mergeQueueEvents),\n\t);\n}\n\n/** `undefined` only for a node from a selection that left the milestone out, which no fragment does today. */\nfunction fromGitHubMilestone(milestone: GitHubMilestone | null | undefined): IssueMilestone | null | undefined {\n\tif (milestone == null) return milestone;\n\n\treturn {\n\t\tid: milestone.id,\n\t\ttitle: milestone.title,\n\t\tstate: milestone.state === 'CLOSED' ? 'closed' : 'open',\n\t\t...(milestone.dueOn != null ? { dueDate: new Date(milestone.dueOn) } : {}),\n\t\t...(milestone.url ? { url: milestone.url } : {}),\n\t};\n}\n\n/** Both fields are absent on GitHub Enterprise Server (never selected) and `null` when unstacked. */\nfunction fromGitHubPullRequestStack(pr: GitHubPullRequestLite): PullRequestStackInfo | undefined {\n\tif (pr.stack == null || pr.stackEntry == null) return undefined;\n\n\treturn {\n\t\tid: pr.stack.id,\n\t\tnumber: pr.stack.number,\n\t\tsize: pr.stack.size,\n\t\tposition: pr.stackEntry.position,\n\t\tbaseRef: pr.stack.baseRefName,\n\t};\n}\n\n/** Absent where never selected (GitHub Enterprise Server, or a host that didn't opt in) and `null` when the pull\n * request isn't queued. */\nfunction fromGitHubPullRequestMergeQueueEntry(pr: GitHubPullRequestLite): PullRequestMergeQueueEntry | undefined {\n\treturn pr.mergeQueueEntry != null ? fromGitHubMergeQueueEntry(pr.mergeQueueEntry) : undefined;\n}\n\n/**\n * The one place a GitHub `MergeQueueEntry` becomes a {@link PullRequestMergeQueueEntry}, whichever read selected it.\n * GitHub's estimate is a duration from the moment it answered, so it's fixed to a date here, at read time, rather\n * than added to the clock at each render, where a held entry would never count down.\n */\nexport function fromGitHubMergeQueueEntry(entry: GitHubMergeQueueEntry): PullRequestMergeQueueEntry {\n\treturn {\n\t\tstate: fromGitHubMergeQueueEntryState(entry.state),\n\t\tenqueuedAt: new Date(entry.enqueuedAt),\n\t\testimatedMergeAt:\n\t\t\tentry.estimatedTimeToMerge != null ? new Date(Date.now() + entry.estimatedTimeToMerge * 1000) : undefined,\n\t\turl: entry.mergeQueue?.url,\n\t\tposition: entry.position ?? undefined,\n\t};\n}\n\n/**\n * The pull request's latest removal from its merge queue, from its latest merge-queue event: set only when that\n * event is a removal (so it hasn't rejoined since) whose reason isn't `merged` (GitHub removes every merged entry\n * with that reason). Absent where never selected (GitHub Enterprise Server, or a host that didn't opt in). Shared by\n * the full read and the etag's cheap check, so both derive the same removal.\n */\nexport function fromGitHubMergeQueueRemoval(\n\tevents: GitHubMergeQueueEvents | null | undefined,\n): PullRequestMergeQueueRemoval | undefined {\n\tconst latest = events?.nodes?.at(-1);\n\tif (latest?.__typename !== 'RemovedFromMergeQueueEvent') return undefined;\n\n\tconst reason = latest.reason ?? '';\n\tif (reason.toLowerCase() === 'merged') return undefined;\n\n\treturn { reason: reason, removedAt: new Date(latest.createdAt) };\n}\n\n/** A state GitHub adds later still means the pull request is in the queue, so it reads as Queued rather than\n * dropping the entry, which would report a queued pull request as not queued. */\nexport function fromGitHubMergeQueueEntryState(state: GitHubMergeQueueEntryState): PullRequestMergeQueueState {\n\tswitch (state) {\n\t\tcase 'AWAITING_CHECKS':\n\t\t\treturn PullRequestMergeQueueState.AwaitingChecks;\n\t\tcase 'MERGEABLE':\n\t\t\treturn PullRequestMergeQueueState.Mergeable;\n\t\tcase 'UNMERGEABLE':\n\t\t\treturn PullRequestMergeQueueState.Unmergeable;\n\t\tcase 'LOCKED':\n\t\t\treturn PullRequestMergeQueueState.Locked;\n\t\tdefault:\n\t\t\treturn PullRequestMergeQueueState.Queued;\n\t}\n}\n\nexport function fromGitHubIssueOrPullRequestState(state: GitHubPullRequestState): PullRequestState {\n\treturn state === 'MERGED' ? 'merged' : state === 'CLOSED' ? 'closed' : 'opened';\n}\n\nexport function toGitHubPullRequestState(state: PullRequestState): GitHubPullRequestState {\n\treturn state === 'merged' ? 'MERGED' : state === 'closed' ? 'CLOSED' : 'OPEN';\n}\n\nexport function fromGitHubPullRequestReviewDecision(\n\treviewDecision: GitHubPullRequestReviewDecision,\n): PullRequestReviewDecision {\n\tswitch (reviewDecision) {\n\t\tcase 'APPROVED':\n\t\t\treturn PullRequestReviewDecision.Approved;\n\t\tcase 'CHANGES_REQUESTED':\n\t\t\treturn PullRequestReviewDecision.ChangesRequested;\n\t\tcase 'REVIEW_REQUIRED':\n\t\t\treturn PullRequestReviewDecision.ReviewRequired;\n\t}\n}\n\nexport function fromGitHubPullRequestReviewState(state: GitHubPullRequestReviewState): PullRequestReviewState {\n\tswitch (state) {\n\t\tcase 'APPROVED':\n\t\t\treturn PullRequestReviewState.Approved;\n\t\tcase 'CHANGES_REQUESTED':\n\t\t\treturn PullRequestReviewState.ChangesRequested;\n\t\tcase 'COMMENTED':\n\t\t\treturn PullRequestReviewState.Commented;\n\t\tcase 'DISMISSED':\n\t\t\treturn PullRequestReviewState.Dismissed;\n\t\tcase 'PENDING':\n\t\t\treturn PullRequestReviewState.Pending;\n\t}\n}\n\nexport function toGitHubPullRequestReviewDecision(\n\treviewDecision: PullRequestReviewDecision,\n): GitHubPullRequestReviewDecision {\n\tswitch (reviewDecision) {\n\t\tcase PullRequestReviewDecision.Approved:\n\t\t\treturn 'APPROVED';\n\t\tcase PullRequestReviewDecision.ChangesRequested:\n\t\t\treturn 'CHANGES_REQUESTED';\n\t\tcase PullRequestReviewDecision.ReviewRequired:\n\t\t\treturn 'REVIEW_REQUIRED';\n\t}\n}\n\nexport function fromGitHubPullRequestMergeableState(\n\tmergeableState: GitHubPullRequestMergeableState,\n): PullRequestMergeableState {\n\tswitch (mergeableState) {\n\t\tcase 'MERGEABLE':\n\t\t\treturn PullRequestMergeableState.Mergeable;\n\t\tcase 'CONFLICTING':\n\t\t\treturn PullRequestMergeableState.Conflicting;\n\t\tcase 'UNKNOWN':\n\t\t\treturn PullRequestMergeableState.Unknown;\n\t}\n}\n\nexport function toGitHubPullRequestMergeableState(\n\tmergeableState: PullRequestMergeableState,\n): GitHubPullRequestMergeableState {\n\tswitch (mergeableState) {\n\t\tcase PullRequestMergeableState.Mergeable:\n\t\t\treturn 'MERGEABLE';\n\t\tcase PullRequestMergeableState.Conflicting:\n\t\t\treturn 'CONFLICTING';\n\t\tcase PullRequestMergeableState.FailingChecks:\n\t\t\treturn 'UNKNOWN';\n\t\tcase PullRequestMergeableState.BlockedByPolicy:\n\t\t\treturn 'UNKNOWN';\n\t\tcase PullRequestMergeableState.Unknown:\n\t\t\treturn 'UNKNOWN';\n\t}\n}\n\nexport function fromGitHubPullRequestStatusCheckRollupState(\n\tstate: GitHubPullRequestStatusCheckRollupState | null | undefined,\n): PullRequestStatusCheckRollupState | undefined {\n\tswitch (state) {\n\t\tcase 'SUCCESS':\n\t\tcase 'EXPECTED':\n\t\t\treturn PullRequestStatusCheckRollupState.Success;\n\t\tcase 'FAILURE':\n\t\tcase 'ERROR':\n\t\t\treturn PullRequestStatusCheckRollupState.Failed;\n\t\tcase 'PENDING':\n\t\t\treturn PullRequestStatusCheckRollupState.Pending;\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\nexport function fromGitHubPullRequest(\n\tpr: GitHubPullRequest,\n\tprovider: Provider,\n\tprojection?: PullRequestProjection,\n): PullRequest {\n\t// `latestReviews` is capped, so keep the viewer's own review even when it falls outside that window, deduped\n\t// by review id since the two selections overlap. Unsubmitted drafts are dropped from the union rather than\n\t// from the viewer's side alone: `PENDING` is in GitHub's review-state enum on both selections, and the field\n\t// this feeds is documented as reviews already SUBMITTED — a draft there tells a \"needs my review\" consumer\n\t// the review is done, and a reviewer with a submitted review plus a draft would get two conflicting rows.\n\tconst viewerLatestReview = pr.viewerLatestReview;\n\tconst latestReviews = [\n\t\t...pr.latestReviews.nodes,\n\t\t...(viewerLatestReview != null && !pr.latestReviews.nodes.some(r => r.id === viewerLatestReview.id)\n\t\t\t? [viewerLatestReview]\n\t\t\t: []),\n\t].filter(review => review.state !== 'PENDING');\n\n\treturn new PullRequest(\n\t\tprovider,\n\t\tfromGitHubMemberOrGhost(pr.author),\n\t\tString(pr.number),\n\t\tpr.id,\n\t\tpr.title,\n\t\tpr.permalink,\n\t\t{\n\t\t\towner: pr.repository.owner.login,\n\t\t\trepo: pr.repository.name,\n\t\t\taccessLevel: fromGitHubViewerPermissionToAccessLevel(pr.repository.viewerPermission),\n\t\t},\n\t\tfromGitHubIssueOrPullRequestState(pr.state),\n\t\tnew Date(pr.createdAt),\n\t\tnew Date(pr.updatedAt),\n\t\tpr.closedAt == null ? undefined : new Date(pr.closedAt),\n\t\tpr.mergedAt == null ? undefined : new Date(pr.mergedAt),\n\t\tfromGitHubPullRequestMergeableState(pr.mergeable),\n\t\tpr.viewerCanUpdate,\n\t\t{\n\t\t\thead: {\n\t\t\t\texists: pr.headRepository != null,\n\t\t\t\towner: pr.headRepository?.owner.login,\n\t\t\t\trepo: pr.headRepository?.name,\n\t\t\t\tsha: pr.headRefOid,\n\t\t\t\tbranch: pr.headRefName,\n\t\t\t\turl: pr.headRepository?.url,\n\t\t\t\tcloneHttps: pr.headRepository != null ? `${pr.headRepository.url}.git` : undefined,\n\t\t\t\tcloneSsh: pr.headRepository?.sshUrl,\n\t\t\t\tisFork: pr.headRepository?.isFork,\n\t\t\t},\n\t\t\tbase: {\n\t\t\t\texists: pr.repository != null,\n\t\t\t\towner: pr.repository?.owner.login,\n\t\t\t\trepo: pr.repository?.name,\n\t\t\t\tsha: pr.baseRefOid,\n\t\t\t\tbranch: pr.baseRefName,\n\t\t\t\turl: pr.repository?.url,\n\t\t\t\tcloneHttps: pr.repository != null ? `${pr.repository.url}.git` : undefined,\n\t\t\t\tcloneSsh: pr.repository?.sshUrl,\n\t\t\t\tisFork: pr.repository?.isFork,\n\t\t\t},\n\t\t\tisCrossRepository: pr.isCrossRepository,\n\t\t},\n\t\tpr.isDraft,\n\t\tpr.additions,\n\t\tpr.deletions,\n\t\tpr.totalCommentsCount,\n\t\tundefined, // thumbsUpCount: the fragment selects no reactions\n\t\tfromGitHubPullRequestReviewDecision(pr.reviewDecision),\n\t\tpr.reviewRequests.nodes\n\t\t\t.map(r =>\n\t\t\t\tr.requestedReviewer != null\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tisCodeOwner: r.asCodeOwner,\n\t\t\t\t\t\t\treviewer: {\n\t\t\t\t\t\t\t\t// A team has no login: an empty id, which matches no one, rather than a missing one.\n\t\t\t\t\t\t\t\tid: r.requestedReviewer.login ?? '',\n\t\t\t\t\t\t\t\tname: r.requestedReviewer.login,\n\t\t\t\t\t\t\t\tusername: r.requestedReviewer.login,\n\t\t\t\t\t\t\t\tavatarUrl: r.requestedReviewer.avatarUrl,\n\t\t\t\t\t\t\t\turl: r.requestedReviewer.url,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tstate: PullRequestReviewState.ReviewRequested,\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t)\n\t\t\t.filter(<T>(r?: T): r is T => Boolean(r)),\n\t\tlatestReviews.map(r => ({\n\t\t\treviewer: fromGitHubMemberOrGhost(r.author),\n\t\t\tstate: fromGitHubPullRequestReviewState(r.state),\n\t\t\tcommitOid: r.commit?.oid,\n\t\t})),\n\t\tpr.assignees.nodes.map(r => ({\n\t\t\tid: r.login,\n\t\t\tname: r.login,\n\t\t\tusername: r.login,\n\t\t\tavatarUrl: r.avatarUrl,\n\t\t\turl: r.url,\n\t\t})),\n\t\tfromGitHubPullRequestStatusCheckRollupState(pr.commits.nodes?.[0]?.commit.statusCheckRollup?.state),\n\t\tundefined, // project\n\t\tundefined, // version\n\t\tpr.commits.totalCount,\n\t\tfromGitHubPullRequestStack(pr),\n\t\tpr.changedFiles,\n\t\tpr.body ?? undefined,\n\t\tpr.number,\n\t\tundefined, // authoredByMe\n\t\tprojection,\n\t\tundefined, // viewer\n\t\tundefined, // viewerUnresolved\n\t\tfromGitHubMilestone(pr.milestone),\n\t\tfromGitHubPullRequestMergeQueueEntry(pr),\n\t\tpr.isMergeQueueEnabled,\n\t\tfromGitHubMergeQueueRemoval(pr.mergeQueueEvents),\n\t);\n}\n\nexport function fromGitHubIssue(value: GitHubIssue, provider: Provider, projection?: IssueProjection): Issue {\n\treturn new Issue(\n\t\t{\n\t\t\tid: provider.id,\n\t\t\tname: provider.name,\n\t\t\tdomain: provider.domain,\n\t\t\ticon: provider.icon,\n\t\t},\n\t\tString(value.number),\n\t\tvalue.id,\n\t\tvalue.title,\n\t\tvalue.url,\n\t\tnew Date(value.createdAt),\n\t\tnew Date(value.updatedAt),\n\t\tvalue.closed,\n\t\tfromGitHubIssueOrPullRequestState(value.state),\n\t\tvalue.author == null\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tid: value.author.login,\n\t\t\t\t\tname: value.author.login,\n\t\t\t\t\tusername: value.author.login,\n\t\t\t\t\tavatarUrl: value.author.avatarUrl,\n\t\t\t\t\turl: value.author.url,\n\t\t\t\t},\n\t\tvalue.assignees.nodes.map(assignee => ({\n\t\t\tid: assignee.login,\n\t\t\tname: assignee.login,\n\t\t\tusername: assignee.login,\n\t\t\tavatarUrl: assignee.avatarUrl,\n\t\t\turl: assignee.url,\n\t\t})),\n\t\t{\n\t\t\towner: value.repository.owner.login,\n\t\t\trepo: value.repository.name,\n\t\t\taccessLevel: fromGitHubViewerPermissionToAccessLevel(value.repository.viewerPermission),\n\t\t\turl: value.repository.url,\n\t\t},\n\t\tvalue.closedAt == null ? undefined : new Date(value.closedAt),\n\t\tvalue.labels?.nodes == null\n\t\t\t? undefined\n\t\t\t: value.labels.nodes.map(label => ({\n\t\t\t\t\tcolor: label.color,\n\t\t\t\t\tname: label.name,\n\t\t\t\t})),\n\t\tvalue.comments?.totalCount,\n\t\tvalue.reactions?.totalCount,\n\t\tvalue.body,\n\t\tundefined, // project\n\t\tundefined, // number\n\t\tundefined, // issueType\n\t\tundefined, // providerState\n\t\tundefined, // bodyFormat\n\t\tundefined, // iterations\n\t\tprojection,\n\t\tundefined, // bodyField\n\t\tundefined, // viewer\n\t\tundefined, // viewerUnresolved\n\t\tundefined, // syncedWith\n\t\tfromGitHubMilestone(value.milestone),\n\t);\n}\n\nfunction fromGitHubViewerPermissionToAccessLevel(\n\tpermission: GitHubViewerPermission | null | undefined,\n): RepositoryAccessLevel {\n\tswitch (permission) {\n\t\tcase 'ADMIN':\n\t\t\treturn RepositoryAccessLevel.Admin;\n\t\tcase 'MAINTAIN':\n\t\t\treturn RepositoryAccessLevel.Maintain;\n\t\tcase 'WRITE':\n\t\t\treturn RepositoryAccessLevel.Write;\n\t\tcase 'TRIAGE':\n\t\t\treturn RepositoryAccessLevel.Triage;\n\t\tcase 'READ':\n\t\t\treturn RepositoryAccessLevel.Read;\n\t\tdefault:\n\t\t\treturn RepositoryAccessLevel.None;\n\t}\n}\n"],"mappings":";;;;AA0GA,SAAgB,qBAAqB,QAAgE;CACpG,QAAQ,QAAR;EACC,KAAK,SACJ,OAAO,mBAAmB;EAC3B,KAAK;EACL,KAAK,YACJ,OAAO,mBAAmB;EAC3B,KAAK,WACJ,OAAO,mBAAmB;EAC3B,KAAK,WACJ,OAAO,mBAAmB;EAC3B,KAAK,UACJ,OAAO,mBAAmB;CAC5B;AAED;;AA6PA,SAAS,wBAAwB,QAA4D;CAC5F,IAAI,UAAU,MAAM,OAAO;EAAE,IAAI;EAAS,MAAM;EAAS,UAAU;CAAQ;CAE3E,OAAO;EACN,IAAI,OAAO;EACX,MAAM,OAAO;EACb,UAAU,OAAO;EACjB,WAAW,OAAO;EAClB,KAAK,OAAO;CACb;AACD;AAEA,SAAgB,0BACf,IACA,UACA,YACc;CACd,OAAO,IAAI,YACV,UACA,wBAAwB,GAAG,MAAM,GACjC,OAAO,GAAG,MAAM,GAChB,GAAG,IACH,GAAG,OACH,GAAG,WACH;EACC,OAAO,GAAG,WAAW,MAAM;EAC3B,MAAM,GAAG,WAAW;EACpB,aAAa,wCAAwC,GAAG,WAAW,gBAAgB;CACpF,GACA,kCAAkC,GAAG,KAAK,GAC1C,IAAI,KAAK,GAAG,SAAS,GACrB,IAAI,KAAK,GAAG,SAAS,GACrB,GAAG,YAAY,OAAO,KAAA,IAAY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ACxB,KAAK,MAAM,OAAO;CACnB,GACF,MAAM,UAAU,MAAM,KAAI,cAAa;EACtC,IAAI,SAAS;EACb,MAAM,SAAS;EACf,UAAU,SAAS;EACnB,WAAW,SAAS;EACpB,KAAK,SAAS;CACf,EAAE,GACF;EACC,OAAO,MAAM,WAAW,MAAM;EAC9B,MAAM,MAAM,WAAW;EACvB,aAAa,wCAAwC,MAAM,WAAW,gBAAgB;EACtF,KAAK,MAAM,WAAW;CACvB,GACA,MAAM,YAAY,OAAO,KAAA,IAAY,IAAI,KAAK,MAAM,QAAQ,GAC5D,MAAM,QAAQ,SAAS,OACpB,KAAA,IACA,MAAM,OAAO,MAAM,KAAI,WAAU;EACjC,OAAO,MAAM;EACb,MAAM,MAAM;CACb,EAAE,GACJ,MAAM,UAAU,YAChB,MAAM,WAAW,YACjB,MAAM,MACN,KAAA,GACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,YACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,KAAA,GACA,oBAAoB,MAAM,SAAS,CACpC;AACD;AAEA,SAAS,wCACR,YACwB;CACxB,QAAQ,YAAR;EACC,KAAK,SACJ,OAAA;EACD,KAAK,YACJ,OAAA;EACD,KAAK,SACJ,OAAA;EACD,KAAK,UACJ,OAAA;EACD,KAAK,QACJ,OAAA;EACD,SACC,OAAA;CACF;AACD"}
@@ -236,6 +236,18 @@ export interface ConfigProvider {
236
236
  includedOrganizations?: readonly string[];
237
237
  ignoredOrganizations?: readonly string[];
238
238
  };
239
+ /**
240
+ * Pull request read knobs. `mergeQueue: true` makes GitHub.com pull request reads select merge-queue data
241
+ * (`mergeQueue`, `mergeQueueRequired`, `mergeQueueRemoval`) and the etag cheap check select its queue state.
242
+ * Off (omitted) by default: the selection costs a GitHub rate-limit request per pull request read, and makes a
243
+ * queued pull request's etag change with every queue state change. The manager's `listPullRequestsPage`,
244
+ * `searchPullRequestsPage`, `getPullRequestsBatch`, `getPullRequestsForBranches` and sweeps take their own
245
+ * `mergeQueue`, which overrides this for that read. Read on every query build, so a change applies from the next
246
+ * read.
247
+ */
248
+ getPullRequestReadOptions?(): {
249
+ readonly mergeQueue?: boolean;
250
+ };
239
251
  /** Per-remote-host configurations from `remotes`. */
240
252
  getRemoteConfigs(): readonly IntegrationsRemoteConfig[];
241
253
  /** Fires when any integration-relevant config changes. */
@@ -51,7 +51,12 @@ export type PullRequestFieldGroup =
51
51
  'milestone' |
52
52
  /**
53
53
  * `mergeQueue`, `mergeQueueRequired` and `mergeQueueRemoval`: the merge-queue data was read, so an absent entry
54
- * means not queued and an absent removal means none since the pull request last joined. Only GitHub.com's is read.
54
+ * means not queued and an absent removal means none since the pull request last joined. Only GitHub.com's is read,
55
+ * and only for a read that asks for it or, when it doesn't say, a host that opts in
56
+ * (`ConfigProvider.getPullRequestReadOptions`). The tables describe what a read that selects it gets;
57
+ * {@link getPullRequestFieldPresence} answers `not-requested` for a row that carries no `mergeQueueRequired`,
58
+ * since GitHub's `isMergeQueueEnabled` is non-null, so every row whose read selected the merge-queue data has it
59
+ * defined.
55
60
  */
56
61
  'mergeQueue';
57
62
  /** A group is `fetched` only when every field in it is. */
@@ -73,6 +78,11 @@ export type IssueFieldGroup =
73
78
  /**
74
79
  * Which field groups the read that produced `pr` fetched, keyed by its provider and {@link PullRequestShape.projection}.
75
80
  * `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.
81
+ *
82
+ * `mergeQueue` is derived from the row: a table says `fetched` for a read that selects the merge-queue data (by its
83
+ * own `mergeQueue`, else by the host's `ConfigProvider.getPullRequestReadOptions`). GitHub's `isMergeQueueEnabled` is
84
+ * non-null, so `mergeQueueRequired` is defined on every row whose read selected it, and a row without it was read
85
+ * without the selection.
76
86
  */
77
87
  export declare function getPullRequestFieldPresence(pr: PullRequestShape): Readonly<Record<PullRequestFieldGroup, FieldPresence>> | undefined;
78
88
  /**
@@ -418,12 +418,29 @@ function lookup(tables, providerId, projection) {
418
418
  const table = tables.get(providerId);
419
419
  return table != null && Object.hasOwn(table, projection) ? table[projection] : void 0;
420
420
  }
421
+ /** The table entries with `mergeQueue` downgraded to `not-requested`, made once per entry rather than per call. */
422
+ const withoutMergeQueue = /* @__PURE__ */ new WeakMap();
421
423
  /**
422
424
  * Which field groups the read that produced `pr` fetched, keyed by its provider and {@link PullRequestShape.projection}.
423
425
  * `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.
426
+ *
427
+ * `mergeQueue` is derived from the row: a table says `fetched` for a read that selects the merge-queue data (by its
428
+ * own `mergeQueue`, else by the host's `ConfigProvider.getPullRequestReadOptions`). GitHub's `isMergeQueueEnabled` is
429
+ * non-null, so `mergeQueueRequired` is defined on every row whose read selected it, and a row without it was read
430
+ * without the selection.
424
431
  */
425
432
  function getPullRequestFieldPresence(pr) {
426
- return lookup(pullRequestPresence, pr.provider.id, pr.projection);
433
+ const presence = lookup(pullRequestPresence, pr.provider.id, pr.projection);
434
+ if (presence?.mergeQueue !== "fetched" || pr.mergeQueueRequired != null) return presence;
435
+ let downgraded = withoutMergeQueue.get(presence);
436
+ if (downgraded == null) {
437
+ downgraded = Object.freeze({
438
+ ...presence,
439
+ mergeQueue: "not-requested"
440
+ });
441
+ withoutMergeQueue.set(presence, downgraded);
442
+ }
443
+ return downgraded;
427
444
  }
428
445
  /**
429
446
  * Which field groups the read that produced `issue` fetched, keyed by its provider and {@link IssueShape.projection}.
@@ -1 +1 @@
1
- {"version":3,"file":"fieldPresence.js","names":[],"sources":["../../../../plus/integrations/src/fieldPresence.ts"],"sourcesContent":["import type { IssueProjection, IssueShape } from '@gitlens/git/models/issue.js';\nimport type { PullRequestProjection, PullRequestShape } from '@gitlens/git/models/pullRequest.js';\nimport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n} from './constants.js';\n\n/**\n * Whether a row's read fetched a field group.\n *\n * - `fetched`: the read asked for it and surfaces it, so an empty value means \"none\".\n * - `not-requested`: this read didn't ask for it, or asked but doesn't surface it faithfully. Ignore the value even\n * when one is present (some reads fill placeholders); another read may supply it.\n * - `unavailable`: this provider or host can't supply it on this read.\n */\nexport type FieldPresence = 'fetched' | 'not-requested' | 'unavailable';\n\n/** A group is `fetched` only when every field in it is. */\nexport type PullRequestFieldGroup =\n\t/** `body`. */\n\t| 'description'\n\t/** `latestReviews`. */\n\t| 'reviews'\n\t/**\n\t * `reviewRequests`: who is requested. Not each request's `isCodeOwner`, which only GitLens' own GitHub reads\n\t * report; every other row leaves it undefined.\n\t */\n\t| 'reviewRequests'\n\t/**\n\t * `reviewDecision`. Only GitHub reports one; elsewhere it is derived from the reviewers' states on the row, which\n\t * ignores the host's own approval rules, so it is never `fetched` there — derive it from `reviews` and\n\t * `reviewRequests` instead.\n\t */\n\t| 'reviewDecision'\n\t/** `assignees`. */\n\t| 'assignees'\n\t/** `statusCheckRollupState`, on the `PullRequest` class. */\n\t| 'checks'\n\t/** `mergeableState`. */\n\t| 'mergeable'\n\t/** `additions`, `deletions` and `filesChanged`. */\n\t| 'diffStats'\n\t/** `commitCount`, on the `PullRequest` class. */\n\t| 'commitCount'\n\t/** `commentsCount`. */\n\t| 'comments'\n\t/** `thumbsUpCount`. */\n\t| 'reactions'\n\t/** `viewerCanUpdate`, on the `PullRequest` class, and `repository.accessLevel`. */\n\t| 'access'\n\t/** `authoredByMe`, and the `viewer` it was matched against. */\n\t| 'authoredByMe'\n\t/** `stack`. */\n\t| 'stack'\n\t/** `milestone`. */\n\t| 'milestone'\n\t/**\n\t * `mergeQueue`, `mergeQueueRequired` and `mergeQueueRemoval`: the merge-queue data was read, so an absent entry\n\t * means not queued and an absent removal means none since the pull request last joined. Only GitHub.com's is read.\n\t */\n\t| 'mergeQueue';\n\n/** A group is `fetched` only when every field in it is. */\nexport type IssueFieldGroup =\n\t/** `body`, and `bodyField` where the provider sets it. */\n\t| 'description'\n\t/** `assignees`. */\n\t| 'assignees'\n\t/** `labels`. */\n\t| 'labels'\n\t/** `commentsCount`. */\n\t| 'comments'\n\t/** `thumbsUpCount`. */\n\t| 'reactions'\n\t/** `repository.accessLevel`. */\n\t| 'access'\n\t/** `milestone`: a Linear issue's is its project milestone. */\n\t| 'milestone';\n\ntype Presence<G extends string> = Readonly<Record<G, FieldPresence>>;\ntype PresenceTable<P extends string, G extends string> = Readonly<Partial<Record<P, Presence<G>>>>;\n\nconst pullRequestFieldGroups: readonly PullRequestFieldGroup[] = [\n\t'description',\n\t'reviews',\n\t'reviewRequests',\n\t'reviewDecision',\n\t'assignees',\n\t'checks',\n\t'mergeable',\n\t'diffStats',\n\t'commitCount',\n\t'comments',\n\t'reactions',\n\t'access',\n\t'authoredByMe',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n];\n\nconst issueFieldGroups: readonly IssueFieldGroup[] = [\n\t'description',\n\t'assignees',\n\t'labels',\n\t'comments',\n\t'reactions',\n\t'access',\n\t'milestone',\n];\n\n/** Every group in `groups` listed as neither `fetched` nor `unavailable` is `not-requested`. */\nfunction presenceOf<G extends string>(\n\tgroups: readonly G[],\n\tfetched: readonly G[],\n\tunavailable: readonly G[] = [],\n): Presence<G> {\n\treturn Object.freeze(\n\t\tObject.fromEntries(\n\t\t\tgroups.map(\n\t\t\t\tgroup =>\n\t\t\t\t\t[\n\t\t\t\t\t\tgroup,\n\t\t\t\t\t\tfetched.includes(group)\n\t\t\t\t\t\t\t? 'fetched'\n\t\t\t\t\t\t\t: unavailable.includes(group)\n\t\t\t\t\t\t\t\t? 'unavailable'\n\t\t\t\t\t\t\t\t: 'not-requested',\n\t\t\t\t\t] as const,\n\t\t\t),\n\t\t) as Record<G, FieldPresence>,\n\t);\n}\n\nfunction pullRequestPresenceOf(\n\tfetched: readonly PullRequestFieldGroup[],\n\tunavailable?: readonly PullRequestFieldGroup[],\n): Presence<PullRequestFieldGroup> {\n\treturn presenceOf(pullRequestFieldGroups, fetched, unavailable);\n}\n\nfunction issuePresenceOf(\n\tfetched: readonly IssueFieldGroup[],\n\tunavailable?: readonly IssueFieldGroup[],\n): Presence<IssueFieldGroup> {\n\treturn presenceOf(issueFieldGroups, fetched, unavailable);\n}\n\n/**\n * GitLens' own lite fragment (`fromGitHubPullRequestLite`). `stack` and `mergeQueue` are only selected against\n * github.com.\n */\nconst gitHubLite = pullRequestPresenceOf(['description', 'stack', 'milestone', 'mergeQueue']);\n\n/**\n * GitLens' own full fragment, which selects no reactions. The account-wide and batch reads return its rows as they\n * are, GitHub's own review decision included: none stays none, even while a review is requested.\n * `authoredByMe` needs the current account, which a read may fail to resolve, and the other reads never set it.\n */\nconst gitHubFull = pullRequestPresenceOf([\n\t'description',\n\t'reviews',\n\t'reviewRequests',\n\t'reviewDecision',\n\t'assignees',\n\t'checks',\n\t'mergeable',\n\t'diffStats',\n\t'commitCount',\n\t'comments',\n\t'access',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n]);\n\nconst gitHubPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\tpoint: gitHubLite,\n\tsearch: gitHubFull,\n\t'search-summary': gitHubLite,\n\t'text-search': gitHubFull,\n\taccount: gitHubFull,\n\t// The lite fragment's own rows.\n\t'account-summary': gitHubLite,\n\t// provider-apis' own fragment and normalizer. Its review-state map has no DISMISSED, so a dismissed review is\n\t// dropped (and none carries a `commitOid`); it removes code-owner requests; it derives the review decision from\n\t// that list rather than reading GitHub's; and it doesn't read `repository.accessLevel`.\n\trepos: pullRequestPresenceOf([\n\t\t'description',\n\t\t'assignees',\n\t\t'checks',\n\t\t'mergeable',\n\t\t'diffStats',\n\t\t'commitCount',\n\t\t'comments',\n\t\t'reactions',\n\t\t'milestone',\n\t]),\n\t// `summary` drops the `commits` subtree that carries both the check rollup and the commit count.\n\t'repos-summary': pullRequestPresenceOf([\n\t\t'description',\n\t\t'assignees',\n\t\t'mergeable',\n\t\t'diffStats',\n\t\t'comments',\n\t\t'reactions',\n\t\t'milestone',\n\t]),\n\tbatch: gitHubFull,\n};\n\n/**\n * GitHub Enterprise Server rejects the stack selection, and the merge-queue one isn't verified there, so neither is\n * selected: a read that carries `stack` or `mergeQueue` on github.com can't here.\n * provider-apis also gates check runs on the server version, which this table can't see, so its rollup on the\n * repository-scoped read may come from commit statuses alone.\n */\nconst gitHubEnterprisePullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = Object.fromEntries(\n\tObject.entries(gitHubPullRequests).map(([projection, presence]) => {\n\t\tconst enterprise: Record<PullRequestFieldGroup, FieldPresence> = { ...presence };\n\t\tif (enterprise.stack === 'fetched') {\n\t\t\tenterprise.stack = 'unavailable';\n\t\t}\n\t\tif (enterprise.mergeQueue === 'fetched') {\n\t\t\tenterprise.mergeQueue = 'unavailable';\n\t\t}\n\t\tif (projection === 'repos') {\n\t\t\tenterprise.checks = 'not-requested';\n\t\t}\n\t\treturn [projection, Object.freeze(enterprise)];\n\t}),\n);\n\n/** GitLens' own issue fragment, which every native read selects with the body. */\nconst gitHubNativeIssue = presenceOf(issueFieldGroups, issueFieldGroups);\n\nconst gitHubIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: gitHubNativeIssue,\n\tsearch: gitHubNativeIssue,\n\taccount: gitHubNativeIssue,\n\t// provider-apis' own fragment selects neither the body nor the repository's `viewerPermission`.\n\trepos: presenceOf(issueFieldGroups, ['assignees', 'labels', 'comments', 'reactions', 'milestone']),\n\tbatch: gitHubNativeIssue,\n};\n\n/*\n * Every other provider. None of them reads the viewer's access (`repository.accessLevel` is absent on every row),\n * resolves `authoredByMe` reliably, or has stacks, and only GitLab and Linear have milestones; none's merge queue\n * (GitLab's merge trains included) is read yet. provider-apis honors neither `summary` nor `includeReviews` for them,\n * so each `-summary` tag reads like its full one.\n */\n\n/**\n * GitLens' own GitLab reads: the point reads, and the free-text search. They select the description but leave it,\n * and everything else beyond the merge request's identity and refs, off the row.\n */\nconst gitLabOwn = pullRequestPresenceOf([], ['stack', 'mergeQueue']);\n\n/**\n * provider-apis' merge request fragment and normalizer, which every other GitLab read goes through. It turns a null\n * count into 0: GitLab's schema makes `diffStatsSummary`, `commitCount` and `userNotesCount` nullable, so none is\n * promised — except that GitLab.com's comment count resolver answers 0 rather than null, which a self-managed\n * version may not.\n */\nfunction gitLabProviderApis(comments: boolean): Presence<PullRequestFieldGroup> {\n\treturn pullRequestPresenceOf(\n\t\t[\n\t\t\t'description',\n\t\t\t'reviews',\n\t\t\t'reviewRequests',\n\t\t\t'assignees',\n\t\t\t'checks',\n\t\t\t'mergeable',\n\t\t\t'reactions',\n\t\t\t'milestone',\n\t\t\t...(comments ? (['comments'] as const) : []),\n\t\t],\n\t\t['stack', 'mergeQueue'],\n\t);\n}\n\nfunction gitLabPullRequestsFor(\n\tproviderApis: Presence<PullRequestFieldGroup>,\n): PresenceTable<PullRequestProjection, PullRequestFieldGroup> {\n\treturn {\n\t\tpoint: gitLabOwn,\n\t\tsearch: providerApis,\n\t\t'text-search': gitLabOwn,\n\t\taccount: providerApis,\n\t\t'account-summary': providerApis,\n\t\trepos: providerApis,\n\t\t'repos-summary': providerApis,\n\t\tbatch: providerApis,\n\t};\n}\n\n/**\n * Azure DevOps pull requests have no assignees (both converters fill `assignees` with the reviewers, which `reviews` and\n * `reviewRequests` already hold) and no reactions. Neither converter reads checks or counts.\n */\nconst azureUnavailable: readonly PullRequestFieldGroup[] = [\n\t'assignees',\n\t'reactions',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n];\n/** Every list read: Azure truncates a listed pull request's description (to 400 characters). */\nconst azureListed = pullRequestPresenceOf(['reviews', 'reviewRequests', 'mergeable'], azureUnavailable);\n/** The batch reads fetch each pull request by id, which returns the whole description. */\nconst azureById = pullRequestPresenceOf(['description', 'reviews', 'reviewRequests', 'mergeable'], azureUnavailable);\n\nconst azurePullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\t// GitLens' own converter, which leaves the description off the row.\n\tpoint: azureListed,\n\tsearch: azureListed,\n\t'text-search': azureListed,\n\taccount: azureListed,\n\t'account-summary': azureListed,\n\trepos: azureListed,\n\t'repos-summary': azureListed,\n\tbatch: azureById,\n};\n\nconst azureServerPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\t...azurePullRequests,\n\t'search-summary': azureListed,\n};\n\n/**\n * Bitbucket pull requests have no assignees or reactions. Neither provider-apis nor GitLens reads their build\n * statuses or mergeability: provider-apis fills a literal Mergeable, and GitLens' own converters leave it unset.\n */\nconst bitbucketUnavailable: readonly PullRequestFieldGroup[] = [\n\t'assignees',\n\t'reactions',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n];\nconst bitbucketProviderApis = pullRequestPresenceOf(\n\t['description', 'reviews', 'reviewRequests', 'comments'],\n\tbitbucketUnavailable,\n);\n\nconst bitbucketPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\t// GitLens' own converter, which drops the comment count. The commit read selects `+values.*`, which isn't\n\t// known to bring the participants the reviews come from, as the other two point reads do.\n\tpoint: pullRequestPresenceOf(['description'], bitbucketUnavailable),\n\tsearch: bitbucketProviderApis,\n\t'text-search': bitbucketProviderApis,\n\taccount: bitbucketProviderApis,\n\t'account-summary': bitbucketProviderApis,\n\trepos: bitbucketProviderApis,\n\t'repos-summary': bitbucketProviderApis,\n\t// GitLens' own converter over reads that do select the participants.\n\tbatch: pullRequestPresenceOf(['description', 'reviews', 'reviewRequests'], bitbucketUnavailable),\n};\n\n/** provider-apis' and GitLens' own Data Center converters read the same fields. */\nconst bitbucketServerAll = pullRequestPresenceOf(\n\t['description', 'reviews', 'reviewRequests', 'comments'],\n\tbitbucketUnavailable,\n);\nconst bitbucketServerPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\tpoint: bitbucketServerAll,\n\tsearch: bitbucketServerAll,\n\t'search-summary': bitbucketServerAll,\n\t'text-search': bitbucketServerAll,\n\taccount: bitbucketServerAll,\n\t'account-summary': bitbucketServerAll,\n\trepos: bitbucketServerAll,\n\t'repos-summary': bitbucketServerAll,\n\tbatch: bitbucketServerAll,\n};\n\n/**\n * provider-apis' GitLab issue reads (GraphQL, and REST for the account-wide one). The repository's access isn't read.\n * The GraphQL comment count is nullable like the merge request's, and passed through, so only GitLab.com's is\n * promised; the REST one is always a number. The REST normalizer drops the milestone the response carries.\n */\nfunction gitLabIssuesFor(comments: boolean): PresenceTable<IssueProjection, IssueFieldGroup> {\n\tconst graphQL = issuePresenceOf([\n\t\t'description',\n\t\t'assignees',\n\t\t'labels',\n\t\t'reactions',\n\t\t'milestone',\n\t\t...(comments ? (['comments'] as const) : []),\n\t]);\n\treturn {\n\t\tpoint: graphQL,\n\t\taccount: issuePresenceOf(['description', 'assignees', 'labels', 'comments', 'reactions']),\n\t\trepos: graphQL,\n\t\tbatch: graphQL,\n\t};\n}\n\n/**\n * Azure DevOps work items have no reactions (provider-apis' converter fills 0; GitLens' leaves it unset) and belong to\n * a project, not a repository.\n */\nconst azureWorkItemUnavailable: readonly IssueFieldGroup[] = ['reactions', 'access', 'milestone'];\n/** provider-apis' work item converter, and GitLens' copy of it for the batch read. */\nconst azureWorkItem = issuePresenceOf(['description', 'assignees', 'labels', 'comments'], azureWorkItemUnavailable);\n/** GitLens' own work item converter, which drops the tags. */\nconst azureOwnWorkItem = issuePresenceOf(['description', 'assignees', 'comments'], azureWorkItemUnavailable);\n\nconst azureIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: azureOwnWorkItem,\n\taccount: azureWorkItem,\n\trepos: azureWorkItem,\n\tbatch: azureWorkItem,\n};\n\nconst azureServerIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\t...azureIssues,\n\tsearch: azureOwnWorkItem,\n};\n\n/**\n * Bitbucket Cloud's legacy issues, which only the host's own `getIssue` and `searchMyIssues` read. They have no\n * labels, their votes aren't reactions, and neither a comment count nor the repository's access is read.\n */\nconst bitbucketIssue = issuePresenceOf(['description', 'assignees'], ['labels', 'reactions', 'milestone']);\nconst bitbucketIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: bitbucketIssue,\n\taccount: bitbucketIssue,\n};\n\n/**\n * Tracker issues belong to no repository, and a tracker's votes aren't reactions (and read 0 where voting is off), so\n * neither group can be supplied. Nor a milestone: Trello has none, and Jira's fix versions and sprints are many per\n * issue, not one.\n */\nconst trackerUnavailable: readonly IssueFieldGroup[] = ['reactions', 'access', 'milestone'];\n/**\n * provider-apis' Jira converter counts the comments embedded in the issue, which Jira may cap, rather than reading\n * their total.\n */\nconst jiraProviderApis = issuePresenceOf(['description', 'assignees', 'labels'], trackerUnavailable);\n\nconst jiraIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: jiraProviderApis,\n\taccount: jiraProviderApis,\n\tproject: jiraProviderApis,\n\t// GitLens' own by-key read, which reads the comment total.\n\tbatch: issuePresenceOf(['description', 'assignees', 'labels', 'comments'], trackerUnavailable),\n};\n\nconst jiraServerIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\t...jiraIssues,\n\tbatch: jiraProviderApis,\n};\n\n/** provider-apis' Linear fragment selects no labels (it fills an empty list), comments or reactions. */\nconst linearIssue = issuePresenceOf(['description', 'assignees', 'milestone'], ['access']);\nconst linearIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: linearIssue,\n\taccount: linearIssue,\n\tproject: linearIssue,\n\tbatch: linearIssue,\n};\n\n/** A Trello card's description is never read; its members are its assignees. */\nconst trelloCard = issuePresenceOf(['assignees', 'labels', 'comments'], trackerUnavailable);\nconst trelloIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: trelloCard,\n\tproject: trelloCard,\n};\n\n/**\n * provider-apis' Asana task fields: its notes, its single assignee, its tags as labels and its likes as reactions.\n * Comments are stories, which a task doesn't count, so reading them would cost a request per task.\n */\nconst asanaTask = issuePresenceOf(['description', 'assignees', 'labels', 'reactions'], ['access', 'milestone']);\nconst asanaIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: asanaTask,\n\taccount: asanaTask,\n\tproject: asanaTask,\n};\n\nconst pullRequestPresence = new Map<string, PresenceTable<PullRequestProjection, PullRequestFieldGroup>>([\n\t[GitCloudHostIntegrationId.GitHub, gitHubPullRequests],\n\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise, gitHubEnterprisePullRequests],\n\t[GitCloudHostIntegrationId.GitLab, gitLabPullRequestsFor(gitLabProviderApis(true))],\n\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted, gitLabPullRequestsFor(gitLabProviderApis(false))],\n\t[GitCloudHostIntegrationId.AzureDevOps, azurePullRequests],\n\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer, azureServerPullRequests],\n\t[GitCloudHostIntegrationId.Bitbucket, bitbucketPullRequests],\n\t[GitSelfManagedHostIntegrationId.BitbucketServer, bitbucketServerPullRequests],\n]);\n\nconst issuePresence = new Map<string, PresenceTable<IssueProjection, IssueFieldGroup>>([\n\t[GitCloudHostIntegrationId.GitHub, gitHubIssues],\n\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise, gitHubIssues],\n\t[GitCloudHostIntegrationId.GitLab, gitLabIssuesFor(true)],\n\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted, gitLabIssuesFor(false)],\n\t[GitCloudHostIntegrationId.AzureDevOps, azureIssues],\n\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer, azureServerIssues],\n\t[GitCloudHostIntegrationId.Bitbucket, bitbucketIssues],\n\t[IssuesCloudHostIntegrationId.Jira, jiraIssues],\n\t[IssuesSelfManagedHostIntegrationId.JiraServer, jiraServerIssues],\n\t[IssuesCloudHostIntegrationId.Linear, linearIssues],\n\t[IssuesCloudHostIntegrationId.Trello, trelloIssues],\n\t[IssuesCloudHostIntegrationId.Asana, asanaIssues],\n]);\n\nfunction lookup<P extends string, G extends string>(\n\ttables: ReadonlyMap<string, PresenceTable<P, G>>,\n\tproviderId: string,\n\tprojection: P | undefined,\n): Presence<G> | undefined {\n\tif (projection == null) return undefined;\n\n\tconst table = tables.get(providerId);\n\t// `hasOwn` so a projection read off an untrusted row can't resolve to an `Object.prototype` member.\n\treturn table != null && Object.hasOwn(table, projection) ? table[projection] : undefined;\n}\n\n/**\n * Which field groups the read that produced `pr` fetched, keyed by its provider and {@link PullRequestShape.projection}.\n * `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.\n */\nexport function getPullRequestFieldPresence(\n\tpr: PullRequestShape,\n): Readonly<Record<PullRequestFieldGroup, FieldPresence>> | undefined {\n\treturn lookup(pullRequestPresence, pr.provider.id, pr.projection);\n}\n\n/**\n * Which field groups the read that produced `issue` fetched, keyed by its provider and {@link IssueShape.projection}.\n * `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.\n */\nexport function getIssueFieldPresence(issue: IssueShape): Readonly<Record<IssueFieldGroup, FieldPresence>> | undefined {\n\treturn lookup(issuePresence, issue.provider.id, issue.projection);\n}\n"],"mappings":";;AAoFA,MAAM,yBAA2D;CAChE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AAEA,MAAM,mBAA+C;CACpD;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAGA,SAAS,WACR,QACA,SACA,cAA4B,CAAC,GACf;CACd,OAAO,OAAO,OACb,OAAO,YACN,OAAO,KACN,UACC,CACC,OACA,QAAQ,SAAS,KAAK,IACnB,YACA,YAAY,SAAS,KAAK,IACzB,gBACA,eACL,CACF,CACD,CACD;AACD;AAEA,SAAS,sBACR,SACA,aACkC;CAClC,OAAO,WAAW,wBAAwB,SAAS,WAAW;AAC/D;AAEA,SAAS,gBACR,SACA,aAC4B;CAC5B,OAAO,WAAW,kBAAkB,SAAS,WAAW;AACzD;;;;;AAMA,MAAM,aAAa,sBAAsB;CAAC;CAAe;CAAS;CAAa;AAAY,CAAC;;;;;;AAO5F,MAAM,aAAa,sBAAsB;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA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CAAC,CAAC;CACxG,CAAA,eAAwC,iBAAiB;CACzD,CAAA,uBAAoD,uBAAuB;CAC3E,CAAA,aAAsC,qBAAqB;CAC3D,CAAA,oBAAkD,2BAA2B;AAC9E,CAAC;AAED,MAAM,gCAAgB,IAAI,IAA6D;CACtF,CAAA,UAAmC,YAAY;CAC/C,CAAA,2BAAwD,YAAY;CACpE,CAAA,UAAmC,gBAAgB,IAAI,CAAC;CACxD,CAAA,4BAAwD,gBAAgB,KAAK,CAAC;CAC9E,CAAA,eAAwC,WAAW;CACnD,CAAA,uBAAoD,iBAAiB;CACrE,CAAA,aAAsC,eAAe;CACrD,CAAA,QAAoC,UAAU;CAC9C,CAAA,eAAgD,gBAAgB;CAChE,CAAA,UAAsC,YAAY;CAClD,CAAA,UAAsC,YAAY;CAClD,CAAA,SAAqC,WAAW;AACjD,CAAC;AAED,SAAS,OACR,QACA,YACA,YAC0B;CAC1B,IAAI,cAAc,MAAM,OAAO,KAAA;CAE/B,MAAM,QAAQ,OAAO,IAAI,UAAU;CAEnC,OAAO,SAAS,QAAQ,OAAO,OAAO,OAAO,UAAU,IAAI,MAAM,cAAc,KAAA;AAChF;;;;;AAMA,SAAgB,4BACf,IACqE;CACrE,OAAO,OAAO,qBAAqB,GAAG,SAAS,IAAI,GAAG,UAAU;AACjE;;;;;AAMA,SAAgB,sBAAsB,OAAiF;CACtH,OAAO,OAAO,eAAe,MAAM,SAAS,IAAI,MAAM,UAAU;AACjE"}
1
+ {"version":3,"file":"fieldPresence.js","names":[],"sources":["../../../../plus/integrations/src/fieldPresence.ts"],"sourcesContent":["import type { IssueProjection, IssueShape } from '@gitlens/git/models/issue.js';\nimport type { PullRequestProjection, PullRequestShape } from '@gitlens/git/models/pullRequest.js';\nimport {\n\tGitCloudHostIntegrationId,\n\tGitSelfManagedHostIntegrationId,\n\tIssuesCloudHostIntegrationId,\n\tIssuesSelfManagedHostIntegrationId,\n} from './constants.js';\n\n/**\n * Whether a row's read fetched a field group.\n *\n * - `fetched`: the read asked for it and surfaces it, so an empty value means \"none\".\n * - `not-requested`: this read didn't ask for it, or asked but doesn't surface it faithfully. Ignore the value even\n * when one is present (some reads fill placeholders); another read may supply it.\n * - `unavailable`: this provider or host can't supply it on this read.\n */\nexport type FieldPresence = 'fetched' | 'not-requested' | 'unavailable';\n\n/** A group is `fetched` only when every field in it is. */\nexport type PullRequestFieldGroup =\n\t/** `body`. */\n\t| 'description'\n\t/** `latestReviews`. */\n\t| 'reviews'\n\t/**\n\t * `reviewRequests`: who is requested. Not each request's `isCodeOwner`, which only GitLens' own GitHub reads\n\t * report; every other row leaves it undefined.\n\t */\n\t| 'reviewRequests'\n\t/**\n\t * `reviewDecision`. Only GitHub reports one; elsewhere it is derived from the reviewers' states on the row, which\n\t * ignores the host's own approval rules, so it is never `fetched` there — derive it from `reviews` and\n\t * `reviewRequests` instead.\n\t */\n\t| 'reviewDecision'\n\t/** `assignees`. */\n\t| 'assignees'\n\t/** `statusCheckRollupState`, on the `PullRequest` class. */\n\t| 'checks'\n\t/** `mergeableState`. */\n\t| 'mergeable'\n\t/** `additions`, `deletions` and `filesChanged`. */\n\t| 'diffStats'\n\t/** `commitCount`, on the `PullRequest` class. */\n\t| 'commitCount'\n\t/** `commentsCount`. */\n\t| 'comments'\n\t/** `thumbsUpCount`. */\n\t| 'reactions'\n\t/** `viewerCanUpdate`, on the `PullRequest` class, and `repository.accessLevel`. */\n\t| 'access'\n\t/** `authoredByMe`, and the `viewer` it was matched against. */\n\t| 'authoredByMe'\n\t/** `stack`. */\n\t| 'stack'\n\t/** `milestone`. */\n\t| 'milestone'\n\t/**\n\t * `mergeQueue`, `mergeQueueRequired` and `mergeQueueRemoval`: the merge-queue data was read, so an absent entry\n\t * means not queued and an absent removal means none since the pull request last joined. Only GitHub.com's is read,\n\t * and only for a read that asks for it or, when it doesn't say, a host that opts in\n\t * (`ConfigProvider.getPullRequestReadOptions`). The tables describe what a read that selects it gets;\n\t * {@link getPullRequestFieldPresence} answers `not-requested` for a row that carries no `mergeQueueRequired`,\n\t * since GitHub's `isMergeQueueEnabled` is non-null, so every row whose read selected the merge-queue data has it\n\t * defined.\n\t */\n\t| 'mergeQueue';\n\n/** A group is `fetched` only when every field in it is. */\nexport type IssueFieldGroup =\n\t/** `body`, and `bodyField` where the provider sets it. */\n\t| 'description'\n\t/** `assignees`. */\n\t| 'assignees'\n\t/** `labels`. */\n\t| 'labels'\n\t/** `commentsCount`. */\n\t| 'comments'\n\t/** `thumbsUpCount`. */\n\t| 'reactions'\n\t/** `repository.accessLevel`. */\n\t| 'access'\n\t/** `milestone`: a Linear issue's is its project milestone. */\n\t| 'milestone';\n\ntype Presence<G extends string> = Readonly<Record<G, FieldPresence>>;\ntype PresenceTable<P extends string, G extends string> = Readonly<Partial<Record<P, Presence<G>>>>;\n\nconst pullRequestFieldGroups: readonly PullRequestFieldGroup[] = [\n\t'description',\n\t'reviews',\n\t'reviewRequests',\n\t'reviewDecision',\n\t'assignees',\n\t'checks',\n\t'mergeable',\n\t'diffStats',\n\t'commitCount',\n\t'comments',\n\t'reactions',\n\t'access',\n\t'authoredByMe',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n];\n\nconst issueFieldGroups: readonly IssueFieldGroup[] = [\n\t'description',\n\t'assignees',\n\t'labels',\n\t'comments',\n\t'reactions',\n\t'access',\n\t'milestone',\n];\n\n/** Every group in `groups` listed as neither `fetched` nor `unavailable` is `not-requested`. */\nfunction presenceOf<G extends string>(\n\tgroups: readonly G[],\n\tfetched: readonly G[],\n\tunavailable: readonly G[] = [],\n): Presence<G> {\n\treturn Object.freeze(\n\t\tObject.fromEntries(\n\t\t\tgroups.map(\n\t\t\t\tgroup =>\n\t\t\t\t\t[\n\t\t\t\t\t\tgroup,\n\t\t\t\t\t\tfetched.includes(group)\n\t\t\t\t\t\t\t? 'fetched'\n\t\t\t\t\t\t\t: unavailable.includes(group)\n\t\t\t\t\t\t\t\t? 'unavailable'\n\t\t\t\t\t\t\t\t: 'not-requested',\n\t\t\t\t\t] as const,\n\t\t\t),\n\t\t) as Record<G, FieldPresence>,\n\t);\n}\n\nfunction pullRequestPresenceOf(\n\tfetched: readonly PullRequestFieldGroup[],\n\tunavailable?: readonly PullRequestFieldGroup[],\n): Presence<PullRequestFieldGroup> {\n\treturn presenceOf(pullRequestFieldGroups, fetched, unavailable);\n}\n\nfunction issuePresenceOf(\n\tfetched: readonly IssueFieldGroup[],\n\tunavailable?: readonly IssueFieldGroup[],\n): Presence<IssueFieldGroup> {\n\treturn presenceOf(issueFieldGroups, fetched, unavailable);\n}\n\n/**\n * GitLens' own lite fragment (`fromGitHubPullRequestLite`). `stack` and `mergeQueue` are only selected against\n * github.com.\n */\nconst gitHubLite = pullRequestPresenceOf(['description', 'stack', 'milestone', 'mergeQueue']);\n\n/**\n * GitLens' own full fragment, which selects no reactions. The account-wide and batch reads return its rows as they\n * are, GitHub's own review decision included: none stays none, even while a review is requested.\n * `authoredByMe` needs the current account, which a read may fail to resolve, and the other reads never set it.\n */\nconst gitHubFull = pullRequestPresenceOf([\n\t'description',\n\t'reviews',\n\t'reviewRequests',\n\t'reviewDecision',\n\t'assignees',\n\t'checks',\n\t'mergeable',\n\t'diffStats',\n\t'commitCount',\n\t'comments',\n\t'access',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n]);\n\nconst gitHubPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\tpoint: gitHubLite,\n\tsearch: gitHubFull,\n\t'search-summary': gitHubLite,\n\t'text-search': gitHubFull,\n\taccount: gitHubFull,\n\t// The lite fragment's own rows.\n\t'account-summary': gitHubLite,\n\t// provider-apis' own fragment and normalizer. Its review-state map has no DISMISSED, so a dismissed review is\n\t// dropped (and none carries a `commitOid`); it removes code-owner requests; it derives the review decision from\n\t// that list rather than reading GitHub's; and it doesn't read `repository.accessLevel`.\n\trepos: pullRequestPresenceOf([\n\t\t'description',\n\t\t'assignees',\n\t\t'checks',\n\t\t'mergeable',\n\t\t'diffStats',\n\t\t'commitCount',\n\t\t'comments',\n\t\t'reactions',\n\t\t'milestone',\n\t]),\n\t// `summary` drops the `commits` subtree that carries both the check rollup and the commit count.\n\t'repos-summary': pullRequestPresenceOf([\n\t\t'description',\n\t\t'assignees',\n\t\t'mergeable',\n\t\t'diffStats',\n\t\t'comments',\n\t\t'reactions',\n\t\t'milestone',\n\t]),\n\tbatch: gitHubFull,\n};\n\n/**\n * GitHub Enterprise Server rejects the stack selection, and the merge-queue one isn't verified there, so neither is\n * selected: a read that carries `stack` or `mergeQueue` on github.com can't here.\n * provider-apis also gates check runs on the server version, which this table can't see, so its rollup on the\n * repository-scoped read may come from commit statuses alone.\n */\nconst gitHubEnterprisePullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = Object.fromEntries(\n\tObject.entries(gitHubPullRequests).map(([projection, presence]) => {\n\t\tconst enterprise: Record<PullRequestFieldGroup, FieldPresence> = { ...presence };\n\t\tif (enterprise.stack === 'fetched') {\n\t\t\tenterprise.stack = 'unavailable';\n\t\t}\n\t\tif (enterprise.mergeQueue === 'fetched') {\n\t\t\tenterprise.mergeQueue = 'unavailable';\n\t\t}\n\t\tif (projection === 'repos') {\n\t\t\tenterprise.checks = 'not-requested';\n\t\t}\n\t\treturn [projection, Object.freeze(enterprise)];\n\t}),\n);\n\n/** GitLens' own issue fragment, which every native read selects with the body. */\nconst gitHubNativeIssue = presenceOf(issueFieldGroups, issueFieldGroups);\n\nconst gitHubIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: gitHubNativeIssue,\n\tsearch: gitHubNativeIssue,\n\taccount: gitHubNativeIssue,\n\t// provider-apis' own fragment selects neither the body nor the repository's `viewerPermission`.\n\trepos: presenceOf(issueFieldGroups, ['assignees', 'labels', 'comments', 'reactions', 'milestone']),\n\tbatch: gitHubNativeIssue,\n};\n\n/*\n * Every other provider. None of them reads the viewer's access (`repository.accessLevel` is absent on every row),\n * resolves `authoredByMe` reliably, or has stacks, and only GitLab and Linear have milestones; none's merge queue\n * (GitLab's merge trains included) is read yet. provider-apis honors neither `summary` nor `includeReviews` for them,\n * so each `-summary` tag reads like its full one.\n */\n\n/**\n * GitLens' own GitLab reads: the point reads, and the free-text search. They select the description but leave it,\n * and everything else beyond the merge request's identity and refs, off the row.\n */\nconst gitLabOwn = pullRequestPresenceOf([], ['stack', 'mergeQueue']);\n\n/**\n * provider-apis' merge request fragment and normalizer, which every other GitLab read goes through. It turns a null\n * count into 0: GitLab's schema makes `diffStatsSummary`, `commitCount` and `userNotesCount` nullable, so none is\n * promised — except that GitLab.com's comment count resolver answers 0 rather than null, which a self-managed\n * version may not.\n */\nfunction gitLabProviderApis(comments: boolean): Presence<PullRequestFieldGroup> {\n\treturn pullRequestPresenceOf(\n\t\t[\n\t\t\t'description',\n\t\t\t'reviews',\n\t\t\t'reviewRequests',\n\t\t\t'assignees',\n\t\t\t'checks',\n\t\t\t'mergeable',\n\t\t\t'reactions',\n\t\t\t'milestone',\n\t\t\t...(comments ? (['comments'] as const) : []),\n\t\t],\n\t\t['stack', 'mergeQueue'],\n\t);\n}\n\nfunction gitLabPullRequestsFor(\n\tproviderApis: Presence<PullRequestFieldGroup>,\n): PresenceTable<PullRequestProjection, PullRequestFieldGroup> {\n\treturn {\n\t\tpoint: gitLabOwn,\n\t\tsearch: providerApis,\n\t\t'text-search': gitLabOwn,\n\t\taccount: providerApis,\n\t\t'account-summary': providerApis,\n\t\trepos: providerApis,\n\t\t'repos-summary': providerApis,\n\t\tbatch: providerApis,\n\t};\n}\n\n/**\n * Azure DevOps pull requests have no assignees (both converters fill `assignees` with the reviewers, which `reviews` and\n * `reviewRequests` already hold) and no reactions. Neither converter reads checks or counts.\n */\nconst azureUnavailable: readonly PullRequestFieldGroup[] = [\n\t'assignees',\n\t'reactions',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n];\n/** Every list read: Azure truncates a listed pull request's description (to 400 characters). */\nconst azureListed = pullRequestPresenceOf(['reviews', 'reviewRequests', 'mergeable'], azureUnavailable);\n/** The batch reads fetch each pull request by id, which returns the whole description. */\nconst azureById = pullRequestPresenceOf(['description', 'reviews', 'reviewRequests', 'mergeable'], azureUnavailable);\n\nconst azurePullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\t// GitLens' own converter, which leaves the description off the row.\n\tpoint: azureListed,\n\tsearch: azureListed,\n\t'text-search': azureListed,\n\taccount: azureListed,\n\t'account-summary': azureListed,\n\trepos: azureListed,\n\t'repos-summary': azureListed,\n\tbatch: azureById,\n};\n\nconst azureServerPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\t...azurePullRequests,\n\t'search-summary': azureListed,\n};\n\n/**\n * Bitbucket pull requests have no assignees or reactions. Neither provider-apis nor GitLens reads their build\n * statuses or mergeability: provider-apis fills a literal Mergeable, and GitLens' own converters leave it unset.\n */\nconst bitbucketUnavailable: readonly PullRequestFieldGroup[] = [\n\t'assignees',\n\t'reactions',\n\t'stack',\n\t'milestone',\n\t'mergeQueue',\n];\nconst bitbucketProviderApis = pullRequestPresenceOf(\n\t['description', 'reviews', 'reviewRequests', 'comments'],\n\tbitbucketUnavailable,\n);\n\nconst bitbucketPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\t// GitLens' own converter, which drops the comment count. The commit read selects `+values.*`, which isn't\n\t// known to bring the participants the reviews come from, as the other two point reads do.\n\tpoint: pullRequestPresenceOf(['description'], bitbucketUnavailable),\n\tsearch: bitbucketProviderApis,\n\t'text-search': bitbucketProviderApis,\n\taccount: bitbucketProviderApis,\n\t'account-summary': bitbucketProviderApis,\n\trepos: bitbucketProviderApis,\n\t'repos-summary': bitbucketProviderApis,\n\t// GitLens' own converter over reads that do select the participants.\n\tbatch: pullRequestPresenceOf(['description', 'reviews', 'reviewRequests'], bitbucketUnavailable),\n};\n\n/** provider-apis' and GitLens' own Data Center converters read the same fields. */\nconst bitbucketServerAll = pullRequestPresenceOf(\n\t['description', 'reviews', 'reviewRequests', 'comments'],\n\tbitbucketUnavailable,\n);\nconst bitbucketServerPullRequests: PresenceTable<PullRequestProjection, PullRequestFieldGroup> = {\n\tpoint: bitbucketServerAll,\n\tsearch: bitbucketServerAll,\n\t'search-summary': bitbucketServerAll,\n\t'text-search': bitbucketServerAll,\n\taccount: bitbucketServerAll,\n\t'account-summary': bitbucketServerAll,\n\trepos: bitbucketServerAll,\n\t'repos-summary': bitbucketServerAll,\n\tbatch: bitbucketServerAll,\n};\n\n/**\n * provider-apis' GitLab issue reads (GraphQL, and REST for the account-wide one). The repository's access isn't read.\n * The GraphQL comment count is nullable like the merge request's, and passed through, so only GitLab.com's is\n * promised; the REST one is always a number. The REST normalizer drops the milestone the response carries.\n */\nfunction gitLabIssuesFor(comments: boolean): PresenceTable<IssueProjection, IssueFieldGroup> {\n\tconst graphQL = issuePresenceOf([\n\t\t'description',\n\t\t'assignees',\n\t\t'labels',\n\t\t'reactions',\n\t\t'milestone',\n\t\t...(comments ? (['comments'] as const) : []),\n\t]);\n\treturn {\n\t\tpoint: graphQL,\n\t\taccount: issuePresenceOf(['description', 'assignees', 'labels', 'comments', 'reactions']),\n\t\trepos: graphQL,\n\t\tbatch: graphQL,\n\t};\n}\n\n/**\n * Azure DevOps work items have no reactions (provider-apis' converter fills 0; GitLens' leaves it unset) and belong to\n * a project, not a repository.\n */\nconst azureWorkItemUnavailable: readonly IssueFieldGroup[] = ['reactions', 'access', 'milestone'];\n/** provider-apis' work item converter, and GitLens' copy of it for the batch read. */\nconst azureWorkItem = issuePresenceOf(['description', 'assignees', 'labels', 'comments'], azureWorkItemUnavailable);\n/** GitLens' own work item converter, which drops the tags. */\nconst azureOwnWorkItem = issuePresenceOf(['description', 'assignees', 'comments'], azureWorkItemUnavailable);\n\nconst azureIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: azureOwnWorkItem,\n\taccount: azureWorkItem,\n\trepos: azureWorkItem,\n\tbatch: azureWorkItem,\n};\n\nconst azureServerIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\t...azureIssues,\n\tsearch: azureOwnWorkItem,\n};\n\n/**\n * Bitbucket Cloud's legacy issues, which only the host's own `getIssue` and `searchMyIssues` read. They have no\n * labels, their votes aren't reactions, and neither a comment count nor the repository's access is read.\n */\nconst bitbucketIssue = issuePresenceOf(['description', 'assignees'], ['labels', 'reactions', 'milestone']);\nconst bitbucketIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: bitbucketIssue,\n\taccount: bitbucketIssue,\n};\n\n/**\n * Tracker issues belong to no repository, and a tracker's votes aren't reactions (and read 0 where voting is off), so\n * neither group can be supplied. Nor a milestone: Trello has none, and Jira's fix versions and sprints are many per\n * issue, not one.\n */\nconst trackerUnavailable: readonly IssueFieldGroup[] = ['reactions', 'access', 'milestone'];\n/**\n * provider-apis' Jira converter counts the comments embedded in the issue, which Jira may cap, rather than reading\n * their total.\n */\nconst jiraProviderApis = issuePresenceOf(['description', 'assignees', 'labels'], trackerUnavailable);\n\nconst jiraIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: jiraProviderApis,\n\taccount: jiraProviderApis,\n\tproject: jiraProviderApis,\n\t// GitLens' own by-key read, which reads the comment total.\n\tbatch: issuePresenceOf(['description', 'assignees', 'labels', 'comments'], trackerUnavailable),\n};\n\nconst jiraServerIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\t...jiraIssues,\n\tbatch: jiraProviderApis,\n};\n\n/** provider-apis' Linear fragment selects no labels (it fills an empty list), comments or reactions. */\nconst linearIssue = issuePresenceOf(['description', 'assignees', 'milestone'], ['access']);\nconst linearIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: linearIssue,\n\taccount: linearIssue,\n\tproject: linearIssue,\n\tbatch: linearIssue,\n};\n\n/** A Trello card's description is never read; its members are its assignees. */\nconst trelloCard = issuePresenceOf(['assignees', 'labels', 'comments'], trackerUnavailable);\nconst trelloIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: trelloCard,\n\tproject: trelloCard,\n};\n\n/**\n * provider-apis' Asana task fields: its notes, its single assignee, its tags as labels and its likes as reactions.\n * Comments are stories, which a task doesn't count, so reading them would cost a request per task.\n */\nconst asanaTask = issuePresenceOf(['description', 'assignees', 'labels', 'reactions'], ['access', 'milestone']);\nconst asanaIssues: PresenceTable<IssueProjection, IssueFieldGroup> = {\n\tpoint: asanaTask,\n\taccount: asanaTask,\n\tproject: asanaTask,\n};\n\nconst pullRequestPresence = new Map<string, PresenceTable<PullRequestProjection, PullRequestFieldGroup>>([\n\t[GitCloudHostIntegrationId.GitHub, gitHubPullRequests],\n\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise, gitHubEnterprisePullRequests],\n\t[GitCloudHostIntegrationId.GitLab, gitLabPullRequestsFor(gitLabProviderApis(true))],\n\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted, gitLabPullRequestsFor(gitLabProviderApis(false))],\n\t[GitCloudHostIntegrationId.AzureDevOps, azurePullRequests],\n\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer, azureServerPullRequests],\n\t[GitCloudHostIntegrationId.Bitbucket, bitbucketPullRequests],\n\t[GitSelfManagedHostIntegrationId.BitbucketServer, bitbucketServerPullRequests],\n]);\n\nconst issuePresence = new Map<string, PresenceTable<IssueProjection, IssueFieldGroup>>([\n\t[GitCloudHostIntegrationId.GitHub, gitHubIssues],\n\t[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise, gitHubIssues],\n\t[GitCloudHostIntegrationId.GitLab, gitLabIssuesFor(true)],\n\t[GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted, gitLabIssuesFor(false)],\n\t[GitCloudHostIntegrationId.AzureDevOps, azureIssues],\n\t[GitSelfManagedHostIntegrationId.AzureDevOpsServer, azureServerIssues],\n\t[GitCloudHostIntegrationId.Bitbucket, bitbucketIssues],\n\t[IssuesCloudHostIntegrationId.Jira, jiraIssues],\n\t[IssuesSelfManagedHostIntegrationId.JiraServer, jiraServerIssues],\n\t[IssuesCloudHostIntegrationId.Linear, linearIssues],\n\t[IssuesCloudHostIntegrationId.Trello, trelloIssues],\n\t[IssuesCloudHostIntegrationId.Asana, asanaIssues],\n]);\n\nfunction lookup<P extends string, G extends string>(\n\ttables: ReadonlyMap<string, PresenceTable<P, G>>,\n\tproviderId: string,\n\tprojection: P | undefined,\n): Presence<G> | undefined {\n\tif (projection == null) return undefined;\n\n\tconst table = tables.get(providerId);\n\t// `hasOwn` so a projection read off an untrusted row can't resolve to an `Object.prototype` member.\n\treturn table != null && Object.hasOwn(table, projection) ? table[projection] : undefined;\n}\n\n/** The table entries with `mergeQueue` downgraded to `not-requested`, made once per entry rather than per call. */\nconst withoutMergeQueue = new WeakMap<Presence<PullRequestFieldGroup>, Presence<PullRequestFieldGroup>>();\n\n/**\n * Which field groups the read that produced `pr` fetched, keyed by its provider and {@link PullRequestShape.projection}.\n * `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.\n *\n * `mergeQueue` is derived from the row: a table says `fetched` for a read that selects the merge-queue data (by its\n * own `mergeQueue`, else by the host's `ConfigProvider.getPullRequestReadOptions`). GitHub's `isMergeQueueEnabled` is\n * non-null, so `mergeQueueRequired` is defined on every row whose read selected it, and a row without it was read\n * without the selection.\n */\nexport function getPullRequestFieldPresence(\n\tpr: PullRequestShape,\n): Readonly<Record<PullRequestFieldGroup, FieldPresence>> | undefined {\n\tconst presence = lookup(pullRequestPresence, pr.provider.id, pr.projection);\n\tif (presence?.mergeQueue !== 'fetched' || pr.mergeQueueRequired != null) return presence;\n\n\tlet downgraded = withoutMergeQueue.get(presence);\n\tif (downgraded == null) {\n\t\tdowngraded = Object.freeze({ ...presence, mergeQueue: 'not-requested' });\n\t\twithoutMergeQueue.set(presence, downgraded);\n\t}\n\treturn downgraded;\n}\n\n/**\n * Which field groups the read that produced `issue` fetched, keyed by its provider and {@link IssueShape.projection}.\n * `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.\n */\nexport function getIssueFieldPresence(issue: IssueShape): Readonly<Record<IssueFieldGroup, FieldPresence>> | undefined {\n\treturn lookup(issuePresence, issue.provider.id, issue.projection);\n}\n"],"mappings":";;AAyFA,MAAM,yBAA2D;CAChE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AAEA,MAAM,mBAA+C;CACpD;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAGA,SAAS,WACR,QACA,SACA,cAA4B,CAAC,GACf;CACd,OAAO,OAAO,OACb,OAAO,YACN,OAAO,KACN,UACC,CACC,OACA,QAAQ,SAAS,KAAK,IACnB,YACA,YAAY,SAAS,KAAK,IACzB,gBACA,eACL,CACF,CACD,CACD;AACD;AAEA,SAAS,sBACR,SACA,aACkC;CAClC,OAAO,WAAW,wBAAwB,SAAS,WAAW;AAC/D;AAEA,SAAS,gBACR,SACA,aAC4B;CAC5B,OAAO,WAAW,kBAAkB,SAAS,WAAW;AACzD;;;;;AAMA,MAAM,aAAa,sBAAsB;CAAC;CAAe;CAAS;CAAa;AAAY,CAAC;;;;;;AAO5F,MAAM,aAAa,sBAAsB;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AAED,MAAM,qBAAkF;CACvF,OAAO;CACP,QAAQ;CACR,kBAAkB;CAClB,eAAe;CACf,SAAS;CAET,mBAAmB;CAInB,OAAO,sBAAsB;EAC5B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CAED,iBAAiB,sBAAsB;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,OAAO;AACR;;;;;;;AAQA,MAAM,+BAA4F,OAAO,YACxG,OAAO,QAAQ,kBAAkB,CAAC,CAAC,KAAK,CAAC,YAAY,cAAc;CAClE,MAAM,aAA2D,EAAE,GAAG,SAAS;CAC/E,IAAI,WAAW,UAAU,WACxB,WAAW,QAAQ;CAEpB,IAAI,W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AAY;CAClD,CAAA,SAAqC,WAAW;AACjD,CAAC;AAED,SAAS,OACR,QACA,YACA,YAC0B;CAC1B,IAAI,cAAc,MAAM,OAAO,KAAA;CAE/B,MAAM,QAAQ,OAAO,IAAI,UAAU;CAEnC,OAAO,SAAS,QAAQ,OAAO,OAAO,OAAO,UAAU,IAAI,MAAM,cAAc,KAAA;AAChF;;AAGA,MAAM,oCAAoB,IAAI,QAA0E;;;;;;;;;;AAWxG,SAAgB,4BACf,IACqE;CACrE,MAAM,WAAW,OAAO,qBAAqB,GAAG,SAAS,IAAI,GAAG,UAAU;CAC1E,IAAI,UAAU,eAAe,aAAa,GAAG,sBAAsB,MAAM,OAAO;CAEhF,IAAI,aAAa,kBAAkB,IAAI,QAAQ;CAC/C,IAAI,cAAc,MAAM;EACvB,aAAa,OAAO,OAAO;GAAE,GAAG;GAAU,YAAY;EAAgB,CAAC;EACvE,kBAAkB,IAAI,UAAU,UAAU;CAC3C;CACA,OAAO;AACR;;;;;AAMA,SAAgB,sBAAsB,OAAiF;CACtH,OAAO,OAAO,eAAe,MAAM,SAAS,IAAI,MAAM,UAAU;AACjE"}
@@ -99,6 +99,10 @@ export declare class IntegrationService implements Disposable, RepositoryResolut
99
99
  private getMyPullRequestsCore;
100
100
  getMyPullRequestsForRemotes(remote: GitRemote): Promise<IntegrationResult<PullRequest[] | undefined>>;
101
101
  getMyPullRequestsForRemotes(remotes: GitRemote[]): Promise<IntegrationResult<PullRequest[] | undefined>>;
102
+ /** The host's pull request read defaults (`ConfigProvider.getPullRequestReadOptions`), `{}` for a host with none. */
103
+ getPullRequestReadOptions(): {
104
+ readonly mergeQueue?: boolean;
105
+ };
102
106
  /**
103
107
  * Warnings for an early-returning read where the integration couldn't be resolved. When a specific
104
108
  * `connectionId` or self-managed `domain` was requested, a missing integration means that target is
@@ -156,7 +160,9 @@ export declare class IntegrationService implements Disposable, RepositoryResolut
156
160
  * per-connection (`connectionId`) read syncs that specific connection's session directly through the auth
157
161
  * provider (the integration's primary-only sync path would never reach a secondary account), while a
158
162
  * primary read syncs via the integration's own cloud-connection machinery. Either way the integration's cached
159
- * discovery (a tracker's project list) is dropped, so the read sees projects created or deleted since.
163
+ * discovery (a tracker's project list) is dropped as the sync starts (see `Integration.beginForcedRefresh`; on the
164
+ * primary path, inside its session transition), so the read sees projects created or deleted since, even when the
165
+ * sync fails.
160
166
  * Best-effort by default; strict discovery can require refresh success before trusting the resolved identity.
161
167
  */
162
168
  forceRefreshIfRequested(integration: Integration, forceSync: boolean | undefined, connectionId: string | undefined, options?: {
@@ -245,6 +251,8 @@ export declare class IntegrationService implements Disposable, RepositoryResolut
245
251
  scopeConcurrency?: number;
246
252
  /** See {@link IntegrationManager.listPullRequestsPage}. */
247
253
  includeRemoteInfo?: boolean;
254
+ /** See {@link IntegrationManager.listPullRequestsPage}. */
255
+ mergeQueue?: boolean;
248
256
  }): Promise<ProviderPagedResult<PullRequestShape>>;
249
257
  /** See {@link IntegrationManager.searchPullRequestsPage}. */
250
258
  searchPullRequestsPage(options: {
@@ -260,6 +268,8 @@ export declare class IntegrationService implements Disposable, RepositoryResolut
260
268
  domain?: string;
261
269
  /** See {@link IntegrationManager.searchPullRequestsPage}. */
262
270
  summary?: boolean;
271
+ /** See {@link IntegrationManager.searchPullRequestsPage}. */
272
+ mergeQueue?: boolean;
263
273
  }): Promise<ProviderPagedResult<PullRequestShape>>;
264
274
  listIssuesPage(options: {
265
275
  state?: IssueStateFilter;
@@ -359,6 +369,8 @@ export declare class IntegrationService implements Disposable, RepositoryResolut
359
369
  domain?: string;
360
370
  /** Widens every etag to the listed inputs; see {@link IntegrationManager.getPullRequestsBatch}. */
361
371
  etagIncludes?: readonly PullRequestEtagInclude[];
372
+ /** See {@link IntegrationManager.getPullRequestsBatch}. */
373
+ mergeQueue?: boolean;
362
374
  }): Promise<ProviderResult<PullRequestBatchResult>>;
363
375
  getPullRequestsForBranches(options: {
364
376
  providerId: IntegrationIds;
@@ -369,6 +381,8 @@ export declare class IntegrationService implements Disposable, RepositoryResolut
369
381
  * it must come from the trusted authentication configuration, not repository or remote data.
370
382
  */
371
383
  domain?: string;
384
+ /** See {@link IntegrationManager.getPullRequestsForBranches}. */
385
+ mergeQueue?: boolean;
372
386
  }): Promise<ProviderResult<PullRequestBranchResult>>;
373
387
  /**
374
388
  * How many pull requests match each scope, without fetching any — the PR twin of {@link countIssues}. See
@@ -449,6 +449,10 @@ var IntegrationService = class {
449
449
  }
450
450
  return this.getMyPullRequestsCore(integrations);
451
451
  }
452
+ /** The host's pull request read defaults (`ConfigProvider.getPullRequestReadOptions`), `{}` for a host with none. */
453
+ getPullRequestReadOptions() {
454
+ return this.ctx.config.getPullRequestReadOptions?.() ?? {};
455
+ }
452
456
  /**
453
457
  * Warnings for an early-returning read where the integration couldn't be resolved. When a specific
454
458
  * `connectionId` or self-managed `domain` was requested, a missing integration means that target is
@@ -559,14 +563,16 @@ var IntegrationService = class {
559
563
  * per-connection (`connectionId`) read syncs that specific connection's session directly through the auth
560
564
  * provider (the integration's primary-only sync path would never reach a secondary account), while a
561
565
  * primary read syncs via the integration's own cloud-connection machinery. Either way the integration's cached
562
- * discovery (a tracker's project list) is dropped, so the read sees projects created or deleted since.
566
+ * discovery (a tracker's project list) is dropped as the sync starts (see `Integration.beginForcedRefresh`; on the
567
+ * primary path, inside its session transition), so the read sees projects created or deleted since, even when the
568
+ * sync fails.
563
569
  * Best-effort by default; strict discovery can require refresh success before trusting the resolved identity.
564
570
  */
565
571
  async forceRefreshIfRequested(integration, forceSync, connectionId, options) {
566
572
  if (forceSync !== true) return;
567
- integration.invalidateDiscoveryForConnection(connectionId);
568
573
  try {
569
574
  if (connectionId != null) {
575
+ integration.beginForcedRefresh(connectionId);
570
576
  const authProvider = await this.authenticationService.get(integration.authProvider.id);
571
577
  const descriptor = {
572
578
  ...integration.authProviderDescriptor,