@gitkraken/core-gitlens 0.30.0 → 0.31.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 (36) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/dist/git/models/issue.d.ts +3 -2
  3. package/dist/git/models/issue.js +3 -1
  4. package/dist/git/models/issue.js.map +1 -1
  5. package/dist/git/models/issueOrPullRequest.d.ts +21 -0
  6. package/dist/git/models/pullRequest.d.ts +7 -3
  7. package/dist/git/models/pullRequest.js +3 -1
  8. package/dist/git/models/pullRequest.js.map +1 -1
  9. package/dist/git/utils/issue.utils.js +3 -1
  10. package/dist/git/utils/issue.utils.js.map +1 -1
  11. package/dist/git/utils/issueOrPullRequest.utils.d.ts +3 -1
  12. package/dist/git/utils/issueOrPullRequest.utils.js +12 -1
  13. package/dist/git/utils/issueOrPullRequest.utils.js.map +1 -1
  14. package/dist/git/utils/pullRequest.utils.js +2 -0
  15. package/dist/git/utils/pullRequest.utils.js.map +1 -1
  16. package/dist/plus/git-github/api/github.js +16 -0
  17. package/dist/plus/git-github/api/github.js.map +1 -1
  18. package/dist/plus/git-github/models.d.ts +12 -0
  19. package/dist/plus/git-github/models.js +14 -3
  20. package/dist/plus/git-github/models.js.map +1 -1
  21. package/dist/plus/integrations/fieldPresence.d.ts +6 -2
  22. package/dist/plus/integrations/fieldPresence.js +47 -16
  23. package/dist/plus/integrations/fieldPresence.js.map +1 -1
  24. package/dist/plus/integrations/providers/gitlab/gitlab.js +7 -5
  25. package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
  26. package/dist/plus/integrations/providers/gitlab/models.d.ts +1 -0
  27. package/dist/plus/integrations/providers/gitlab/models.js +8 -6
  28. package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
  29. package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
  30. package/dist/plus/integrations/providers/models.js +18 -3
  31. package/dist/plus/integrations/providers/models.js.map +1 -1
  32. package/dist/plus/integrations/reads/drains.d.ts +1 -0
  33. package/dist/plus/integrations/reads/pullRequestBranches.d.ts +2 -1
  34. package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
  35. package/docs/integrations.md +25 -6
  36. package/package.json +1 -1
@@ -102,6 +102,14 @@ export interface GitHubIssueOrPullRequest {
102
102
  export type GitHubIssueState = 'OPEN' | 'CLOSED';
103
103
  export type GitHubPullRequestState = 'OPEN' | 'CLOSED' | 'MERGED';
104
104
  export type GitHubIssueOrPullRequestState = GitHubIssueState | GitHubPullRequestState;
105
+ /** GitHub's `Milestone`, as `gqlMilestoneFragment` selects it. */
106
+ export interface GitHubMilestone {
107
+ id: string;
108
+ title: string;
109
+ state: 'OPEN' | 'CLOSED';
110
+ dueOn: string | null;
111
+ url: string;
112
+ }
105
113
  export interface GitHubPullRequestLite extends Omit<GitHubIssueOrPullRequest, '__typename'> {
106
114
  /** `Actor` is nullable in GitHub's schema — `null` once the author's account is deleted */
107
115
  author: GitHubMember | null;
@@ -122,6 +130,8 @@ export interface GitHubPullRequestLite extends Omit<GitHubIssueOrPullRequest, '_
122
130
  isCrossRepository: boolean;
123
131
  isDraft: boolean;
124
132
  mergedAt: string | null;
133
+ /** `null` when the pull request has none. */
134
+ milestone: GitHubMilestone | null;
125
135
  permalink: string;
126
136
  repository: {
127
137
  isFork: boolean;
@@ -160,6 +170,8 @@ export interface GitHubIssue extends Omit<GitHubIssueOrPullRequest, '__typename'
160
170
  labels?: {
161
171
  nodes: IssueLabel[];
162
172
  };
173
+ /** `null` when the issue has none. */
174
+ milestone: GitHubMilestone | null;
163
175
  reactions?: {
164
176
  totalCount: number;
165
177
  };
@@ -56,7 +56,18 @@ function fromGitHubPullRequestLite(pr, provider, projection) {
56
56
  isFork: pr.repository?.isFork
57
57
  },
58
58
  isCrossRepository: pr.isCrossRepository
59
- }, pr.isDraft, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, fromGitHubPullRequestStack(pr), void 0, pr.body ?? void 0, pr.number, void 0, projection);
59
+ }, pr.isDraft, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, fromGitHubPullRequestStack(pr), void 0, pr.body ?? void 0, pr.number, void 0, projection, void 0, void 0, fromGitHubMilestone(pr.milestone));
60
+ }
61
+ /** `undefined` only for a node from a selection that left the milestone out, which no fragment does today. */
62
+ function fromGitHubMilestone(milestone) {
63
+ if (milestone == null) return milestone;
64
+ return {
65
+ id: milestone.id,
66
+ title: milestone.title,
67
+ state: milestone.state === "CLOSED" ? "closed" : "open",
68
+ ...milestone.dueOn != null ? { dueDate: new Date(milestone.dueOn) } : {},
69
+ ...milestone.url ? { url: milestone.url } : {}
70
+ };
60
71
  }
61
72
  /** Both fields are absent on GitHub Enterprise Server (never selected) and `null` when unstacked. */
62
73
  function fromGitHubPullRequestStack(pr) {
@@ -175,7 +186,7 @@ function fromGitHubPullRequest(pr, provider, projection) {
175
186
  username: r.login,
176
187
  avatarUrl: r.avatarUrl,
177
188
  url: r.url
178
- })), fromGitHubPullRequestStatusCheckRollupState(pr.commits.nodes?.[0]?.commit.statusCheckRollup?.state), void 0, void 0, pr.commits.totalCount, fromGitHubPullRequestStack(pr), pr.changedFiles, pr.body ?? void 0, pr.number, void 0, projection);
189
+ })), fromGitHubPullRequestStatusCheckRollupState(pr.commits.nodes?.[0]?.commit.statusCheckRollup?.state), void 0, void 0, pr.commits.totalCount, fromGitHubPullRequestStack(pr), pr.changedFiles, pr.body ?? void 0, pr.number, void 0, projection, void 0, void 0, fromGitHubMilestone(pr.milestone));
179
190
  }
180
191
  function fromGitHubIssue(value, provider, projection) {
181
192
  return new Issue({
@@ -203,7 +214,7 @@ function fromGitHubIssue(value, provider, projection) {
203
214
  }, value.closedAt == null ? void 0 : new Date(value.closedAt), value.labels?.nodes == null ? void 0 : value.labels.nodes.map((label) => ({
204
215
  color: label.color,
205
216
  name: label.name
206
- })), value.comments?.totalCount, value.reactions?.totalCount, value.body, void 0, void 0, void 0, void 0, void 0, void 0, projection);
217
+ })), value.comments?.totalCount, value.reactions?.totalCount, value.body, void 0, void 0, void 0, void 0, void 0, void 0, projection, void 0, void 0, void 0, void 0, fromGitHubMilestone(value.milestone));
207
218
  }
208
219
  function fromGitHubViewerPermissionToAccessLevel(permission) {
209
220
  switch (permission) {
@@ -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 {\n\tPullRequestMember,\n\tPullRequestProjection,\n\tPullRequestStackInfo,\n\tPullRequestState,\n} from '@gitlens/git/models/pullRequest.js';\nimport {\n\tPullRequest,\n\tPullRequestMergeableState,\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\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\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}\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\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}\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);\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\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);\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);\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":";;;;AAsGA,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;;AAkMA,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,IAAI,KAAK,GAAG,QAAQ,GACtD,GAAG,YAAY,OAAO,KAAA,IAAY,IAAI,KAAK,GAAG,QAAQ,GACtD,KAAA,GACA,KAAA,GACA;EACC,MAAM;GACL,QAAQ,GAAG,kBAAkB;GAC7B,OAAO,GAAG,gBAAgB,MAAM;GAChC,MAAM,GAA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Y,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,UACD;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\tPullRequestProjection,\n\tPullRequestStackInfo,\n\tPullRequestState,\n} from '@gitlens/git/models/pullRequest.js';\nimport {\n\tPullRequest,\n\tPullRequestMergeableState,\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}\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}\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);\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\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);\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\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Aa;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"}
@@ -46,7 +46,9 @@ export type PullRequestFieldGroup =
46
46
  /** `authoredByMe`, and the `viewer` it was matched against. */
47
47
  'authoredByMe' |
48
48
  /** `stack`. */
49
- 'stack';
49
+ 'stack' |
50
+ /** `milestone`. */
51
+ 'milestone';
50
52
  /** A group is `fetched` only when every field in it is. */
51
53
  export type IssueFieldGroup =
52
54
  /** `body`, and `bodyField` where the provider sets it. */
@@ -60,7 +62,9 @@ export type IssueFieldGroup =
60
62
  /** `thumbsUpCount`. */
61
63
  'reactions' |
62
64
  /** `repository.accessLevel`. */
63
- 'access';
65
+ 'access' |
66
+ /** `milestone`: a Linear issue's is its project milestone. */
67
+ 'milestone';
64
68
  /**
65
69
  * Which field groups the read that produced `pr` fetched, keyed by its provider and {@link PullRequestShape.projection}.
66
70
  * `undefined` when either is unknown or the provider has no table yet — then nothing can be said about any field.
@@ -14,7 +14,8 @@ const pullRequestFieldGroups = [
14
14
  "reactions",
15
15
  "access",
16
16
  "authoredByMe",
17
- "stack"
17
+ "stack",
18
+ "milestone"
18
19
  ];
19
20
  const issueFieldGroups = [
20
21
  "description",
@@ -22,7 +23,8 @@ const issueFieldGroups = [
22
23
  "labels",
23
24
  "comments",
24
25
  "reactions",
25
- "access"
26
+ "access",
27
+ "milestone"
26
28
  ];
27
29
  /** Every group in `groups` listed as neither `fetched` nor `unavailable` is `not-requested`. */
28
30
  function presenceOf(groups, fetched, unavailable = []) {
@@ -35,7 +37,11 @@ function issuePresenceOf(fetched, unavailable) {
35
37
  return presenceOf(issueFieldGroups, fetched, unavailable);
36
38
  }
37
39
  /** GitLens' own lite fragment (`fromGitHubPullRequestLite`). `stack` is only selected against github.com. */
38
- const gitHubLite = pullRequestPresenceOf(["description", "stack"]);
40
+ const gitHubLite = pullRequestPresenceOf([
41
+ "description",
42
+ "stack",
43
+ "milestone"
44
+ ]);
39
45
  /**
40
46
  * GitLens' own full fragment, which selects no reactions. The account-wide and batch reads return its rows as they
41
47
  * are, GitHub's own review decision included: none stays none, even while a review is requested.
@@ -53,7 +59,8 @@ const gitHubFull = pullRequestPresenceOf([
53
59
  "commitCount",
54
60
  "comments",
55
61
  "access",
56
- "stack"
62
+ "stack",
63
+ "milestone"
57
64
  ]);
58
65
  const gitHubPullRequests = {
59
66
  point: gitHubLite,
@@ -70,7 +77,8 @@ const gitHubPullRequests = {
70
77
  "diffStats",
71
78
  "commitCount",
72
79
  "comments",
73
- "reactions"
80
+ "reactions",
81
+ "milestone"
74
82
  ]),
75
83
  "repos-summary": pullRequestPresenceOf([
76
84
  "description",
@@ -78,7 +86,8 @@ const gitHubPullRequests = {
78
86
  "mergeable",
79
87
  "diffStats",
80
88
  "comments",
81
- "reactions"
89
+ "reactions",
90
+ "milestone"
82
91
  ]),
83
92
  batch: gitHubFull
84
93
  };
@@ -103,7 +112,8 @@ const gitHubIssues = {
103
112
  "assignees",
104
113
  "labels",
105
114
  "comments",
106
- "reactions"
115
+ "reactions",
116
+ "milestone"
107
117
  ]),
108
118
  batch: gitHubNativeIssue
109
119
  };
@@ -127,6 +137,7 @@ function gitLabProviderApis(comments) {
127
137
  "checks",
128
138
  "mergeable",
129
139
  "reactions",
140
+ "milestone",
130
141
  ...comments ? ["comments"] : []
131
142
  ], ["stack"]);
132
143
  }
@@ -149,7 +160,8 @@ function gitLabPullRequestsFor(providerApis) {
149
160
  const azureUnavailable = [
150
161
  "assignees",
151
162
  "reactions",
152
- "stack"
163
+ "stack",
164
+ "milestone"
153
165
  ];
154
166
  /** Every list read: Azure truncates a listed pull request's description (to 400 characters). */
155
167
  const azureListed = pullRequestPresenceOf([
@@ -183,7 +195,8 @@ const azureServerPullRequests = {
183
195
  const bitbucketUnavailable = [
184
196
  "assignees",
185
197
  "reactions",
186
- "stack"
198
+ "stack",
199
+ "milestone"
187
200
  ];
188
201
  const bitbucketProviderApis = pullRequestPresenceOf([
189
202
  "description",
@@ -226,7 +239,7 @@ const bitbucketServerPullRequests = {
226
239
  /**
227
240
  * provider-apis' GitLab issue reads (GraphQL, and REST for the account-wide one). The repository's access isn't read.
228
241
  * The GraphQL comment count is nullable like the merge request's, and passed through, so only GitLab.com's is
229
- * promised; the REST one is always a number.
242
+ * promised; the REST one is always a number. The REST normalizer drops the milestone the response carries.
230
243
  */
231
244
  function gitLabIssuesFor(comments) {
232
245
  const graphQL = issuePresenceOf([
@@ -234,6 +247,7 @@ function gitLabIssuesFor(comments) {
234
247
  "assignees",
235
248
  "labels",
236
249
  "reactions",
250
+ "milestone",
237
251
  ...comments ? ["comments"] : []
238
252
  ]);
239
253
  return {
@@ -253,7 +267,11 @@ function gitLabIssuesFor(comments) {
253
267
  * Azure DevOps work items have no reactions (provider-apis' converter fills 0; GitLens' leaves it unset) and belong to
254
268
  * a project, not a repository.
255
269
  */
256
- const azureWorkItemUnavailable = ["reactions", "access"];
270
+ const azureWorkItemUnavailable = [
271
+ "reactions",
272
+ "access",
273
+ "milestone"
274
+ ];
257
275
  /** provider-apis' work item converter, and GitLens' copy of it for the batch read. */
258
276
  const azureWorkItem = issuePresenceOf([
259
277
  "description",
@@ -281,16 +299,25 @@ const azureServerIssues = {
281
299
  * Bitbucket Cloud's legacy issues, which only the host's own `getIssue` and `searchMyIssues` read. They have no
282
300
  * labels, their votes aren't reactions, and neither a comment count nor the repository's access is read.
283
301
  */
284
- const bitbucketIssue = issuePresenceOf(["description", "assignees"], ["labels", "reactions"]);
302
+ const bitbucketIssue = issuePresenceOf(["description", "assignees"], [
303
+ "labels",
304
+ "reactions",
305
+ "milestone"
306
+ ]);
285
307
  const bitbucketIssues = {
286
308
  point: bitbucketIssue,
287
309
  account: bitbucketIssue
288
310
  };
289
311
  /**
290
312
  * Tracker issues belong to no repository, and a tracker's votes aren't reactions (and read 0 where voting is off), so
291
- * neither group can be supplied.
313
+ * neither group can be supplied. Nor a milestone: Trello has none, and Jira's fix versions and sprints are many per
314
+ * issue, not one.
292
315
  */
293
- const trackerUnavailable = ["reactions", "access"];
316
+ const trackerUnavailable = [
317
+ "reactions",
318
+ "access",
319
+ "milestone"
320
+ ];
294
321
  /**
295
322
  * provider-apis' Jira converter counts the comments embedded in the issue, which Jira may cap, rather than reading
296
323
  * their total.
@@ -316,7 +343,11 @@ const jiraServerIssues = {
316
343
  batch: jiraProviderApis
317
344
  };
318
345
  /** provider-apis' Linear fragment selects no labels (it fills an empty list), comments or reactions. */
319
- const linearIssue = issuePresenceOf(["description", "assignees"], ["access"]);
346
+ const linearIssue = issuePresenceOf([
347
+ "description",
348
+ "assignees",
349
+ "milestone"
350
+ ], ["access"]);
320
351
  const linearIssues = {
321
352
  point: linearIssue,
322
353
  account: linearIssue,
@@ -342,7 +373,7 @@ const asanaTask = issuePresenceOf([
342
373
  "assignees",
343
374
  "labels",
344
375
  "reactions"
345
- ], ["access"]);
376
+ ], ["access", "milestone"]);
346
377
  const asanaIssues = {
347
378
  point: asanaTask,
348
379
  account: asanaTask,
@@ -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\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\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];\n\nconst issueFieldGroups: readonly IssueFieldGroup[] = [\n\t'description',\n\t'assignees',\n\t'labels',\n\t'comments',\n\t'reactions',\n\t'access',\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/** GitLens' own lite fragment (`fromGitHubPullRequestLite`). `stack` is only selected against github.com. */\nconst gitHubLite = pullRequestPresenceOf(['description', 'stack']);\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]);\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]),\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]),\n\tbatch: gitHubFull,\n};\n\n/**\n * GitHub Enterprise Server rejects the stack selection, so a read that carries `stack` 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 (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']),\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. provider-apis honors neither `summary` nor\n * `includeReviews` for them, 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']);\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...(comments ? (['comments'] as const) : []),\n\t\t],\n\t\t['stack'],\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[] = ['assignees', 'reactions', 'stack'];\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[] = ['assignees', 'reactions', 'stack'];\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.\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...(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'];\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']);\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.\n */\nconst trackerUnavailable: readonly IssueFieldGroup[] = ['reactions', 'access'];\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'], ['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']);\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":";;AA2EA,MAAM,yBAA2D;CAChE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AAEA,MAAM,mBAA+C;CACpD;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;;AAGA,MAAM,aAAa,sBAAsB,CAAC,eAAe,OAAO,CAAC;;;;;;AAOjE,MAAM,aAAa,sBAAsB;CACxC;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;CACD,CAAC;CAED,iBAAiB,sBAAsB;EACtC;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,OAAO;AACR;;;;;;AAOA,MAAM,+BAA4F,OAAO,YACxG,OA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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\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];\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/** GitLens' own lite fragment (`fromGitHubPullRequestLite`). `stack` is only selected against github.com. */\nconst gitHubLite = pullRequestPresenceOf(['description', 'stack', 'milestone']);\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]);\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, so a read that carries `stack` 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 (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. provider-apis honors\n * neither `summary` nor `includeReviews` for them, 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']);\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'],\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[] = ['assignees', 'reactions', 'stack', 'milestone'];\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[] = ['assignees', 'reactions', 'stack', 'milestone'];\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":";;AA+EA,MAAM,yBAA2D;CAChE;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,Q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viderFetchError, isRateLimitResponse, toRateLimitError } from "../..
12
12
  import { selectBranchPullRequests } from "../utils/providerPaging.js";
13
13
  import { baseProviderApiConfig } from "../apiConfig.js";
14
14
  import { selectGitLabUserForCommit } from "./gitlab.utils.js";
15
- import { fromGitLabMergeRequest, fromGitLabMergeRequestREST, fromGitLabMergeRequestState, getRepoNamespace, toGitLabMergeRequestState } from "./models.js";
15
+ import { fromGitLabMergeRequest, fromGitLabMergeRequestREST, fromGitLabMergeRequestState, getRepoName, getRepoNamespace, toGitLabMergeRequestState } from "./models.js";
16
16
  import * as l10n from "@vscode/l10n";
17
17
  //#region ../plus/integrations/src/providers/gitlab/gitlab.ts
18
18
  const gitlabUserIdPrefix = "gid://gitlab/User/";
@@ -276,14 +276,15 @@ var GitLabApi = class {
276
276
  if (mr != null && (pr == null || new Date(mr.updatedAt) > new Date(pr.updatedAt))) pr = mr;
277
277
  }
278
278
  if (pr == null) return void 0;
279
+ const fullPath = `${owner}/${repo}`;
279
280
  return new PullRequest(provider, {
280
281
  id: buildGitLabUserId(pr.author?.id) ?? "",
281
282
  name: pr.author?.name ?? void 0,
282
283
  avatarUrl: pr.author?.avatarUrl ?? void 0,
283
284
  url: pr.author?.webUrl ?? void 0
284
285
  }, String(pr.iid), void 0, pr.title, pr.webUrl, {
285
- owner,
286
- repo
286
+ owner: getRepoNamespace(fullPath),
287
+ repo: getRepoName(fullPath)
287
288
  }, fromGitLabMergeRequestState(pr.state), new Date(pr.createdAt), new Date(pr.updatedAt), pr.state !== "closed" ? void 0 : new Date(pr.updatedAt), pr.mergedAt == null ? void 0 : new Date(pr.mergedAt), void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, "point");
288
289
  } catch (ex) {
289
290
  if (ex instanceof RequestNotFoundError) return void 0;
@@ -298,9 +299,10 @@ var GitLabApi = class {
298
299
  const mrs = await this.request(provider, token, options?.baseUrl, `v4/projects/${projectId}/repository/commits/${rev}/merge_requests`, { method: "GET" }, cancellation, scope);
299
300
  if (mrs == null || mrs.length === 0) return void 0;
300
301
  if (mrs.length > 1) mrs.sort((a, b) => (a.state === "opened" ? -1 : 1) - (b.state === "opened" ? -1 : 1) || new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime());
302
+ const fullPath = `${owner}/${repo}`;
301
303
  return fromGitLabMergeRequestREST(mrs[0], provider, {
302
- owner,
303
- repo
304
+ owner: getRepoNamespace(fullPath),
305
+ repo: getRepoName(fullPath)
304
306
  }, "point");
305
307
  } catch (ex) {
306
308
  if (ex instanceof RequestNotFoundError) return void 0;