@gitkraken/core-gitlens 0.40.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/dist/git/models/pullRequest.d.ts +55 -1
  3. package/dist/git/models/pullRequest.js +5 -1
  4. package/dist/git/models/pullRequest.js.map +1 -1
  5. package/dist/git/models/pullRequestActivity.d.ts +55 -0
  6. package/dist/git/models/pullRequestActivity.js +0 -0
  7. package/dist/git/utils/pullRequest.utils.js +3 -1
  8. package/dist/git/utils/pullRequest.utils.js.map +1 -1
  9. package/dist/git/watching/worktreeSummary.d.ts +1 -0
  10. package/dist/git/watching/worktreeSummary.js +34 -2
  11. package/dist/git/watching/worktreeSummary.js.map +1 -1
  12. package/dist/plus/git-github/api/aliasedQuery.d.ts +19 -0
  13. package/dist/plus/git-github/api/aliasedQuery.js +21 -0
  14. package/dist/plus/git-github/api/aliasedQuery.js.map +1 -0
  15. package/dist/plus/git-github/api/cancellation.d.ts +4 -0
  16. package/dist/plus/git-github/api/cancellation.js +9 -0
  17. package/dist/plus/git-github/api/cancellation.js.map +1 -0
  18. package/dist/plus/git-github/api/checkRunLogs.d.ts +31 -0
  19. package/dist/plus/git-github/api/checkRunLogs.js +252 -0
  20. package/dist/plus/git-github/api/checkRunLogs.js.map +1 -0
  21. package/dist/plus/git-github/api/checkRuns.d.ts +26 -0
  22. package/dist/plus/git-github/api/checkRuns.js +191 -0
  23. package/dist/plus/git-github/api/checkRuns.js.map +1 -0
  24. package/dist/plus/git-github/api/github.d.ts +21 -2
  25. package/dist/plus/git-github/api/github.js +162 -37
  26. package/dist/plus/git-github/api/github.js.map +1 -1
  27. package/dist/plus/git-github/api/pullRequestActivity.d.ts +19 -0
  28. package/dist/plus/git-github/api/pullRequestActivity.js +355 -0
  29. package/dist/plus/git-github/api/pullRequestActivity.js.map +1 -0
  30. package/dist/plus/git-github/models.d.ts +100 -4
  31. package/dist/plus/git-github/models.js +135 -3
  32. package/dist/plus/git-github/models.js.map +1 -1
  33. package/dist/plus/integrations/fieldPresence.d.ts +10 -5
  34. package/dist/plus/integrations/fieldPresence.js +46 -25
  35. package/dist/plus/integrations/fieldPresence.js.map +1 -1
  36. package/dist/plus/integrations/index.d.ts +4 -1
  37. package/dist/plus/integrations/index.js.map +1 -1
  38. package/dist/plus/integrations/integrationService.d.ts +24 -0
  39. package/dist/plus/integrations/integrationService.js +8 -0
  40. package/dist/plus/integrations/integrationService.js.map +1 -1
  41. package/dist/plus/integrations/manager.d.ts +77 -0
  42. package/dist/plus/integrations/models/gitHostIntegration.d.ts +31 -1
  43. package/dist/plus/integrations/models/gitHostIntegration.js +68 -0
  44. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  45. package/dist/plus/integrations/models/integration.d.ts +21 -2
  46. package/dist/plus/integrations/models/integration.js +20 -1
  47. package/dist/plus/integrations/models/integration.js.map +1 -1
  48. package/dist/plus/integrations/providers/github.d.ts +13 -2
  49. package/dist/plus/integrations/providers/github.js +65 -5
  50. package/dist/plus/integrations/providers/github.js.map +1 -1
  51. package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
  52. package/dist/plus/integrations/reads/drains.d.ts +1 -0
  53. package/dist/plus/integrations/reads/etag.js +20 -5
  54. package/dist/plus/integrations/reads/etag.js.map +1 -1
  55. package/dist/plus/integrations/reads/pullRequestActivity.d.ts +36 -0
  56. package/dist/plus/integrations/reads/pullRequestActivity.js +103 -0
  57. package/dist/plus/integrations/reads/pullRequestActivity.js.map +1 -0
  58. package/dist/plus/integrations/reads/pullRequestBatch.d.ts +4 -1
  59. package/dist/plus/integrations/reads/pullRequestBatch.js +5 -2
  60. package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
  61. package/dist/plus/integrations/reads/pullRequestBranches.d.ts +2 -0
  62. package/dist/plus/integrations/reads/pullRequestBranches.js +2 -1
  63. package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
  64. package/dist/plus/integrations/reads/pullRequestCheckLogs.d.ts +27 -0
  65. package/dist/plus/integrations/reads/pullRequestCheckLogs.js +92 -0
  66. package/dist/plus/integrations/reads/pullRequestCheckLogs.js.map +1 -0
  67. package/docs/integrations.md +96 -5
  68. package/package.json +1 -1
@@ -0,0 +1,19 @@
1
+ import { ScopedLogger } from "../../../utils/logger.scoped.js";
2
+ import { PullRequestActivityPage } from "../../../git/models/pullRequestActivity.js";
3
+ import { AliasedGraphql } from "./aliasedQuery.js";
4
+ //#region ../plus/git-github/src/api/pullRequestActivity.d.ts
5
+ export interface GitHubPullRequestActivityCursor {
6
+ readonly t: string;
7
+ readonly ids: readonly string[];
8
+ }
9
+ export interface GitHubPullRequestActivityTarget {
10
+ readonly owner: string;
11
+ readonly repo: string;
12
+ readonly number: number;
13
+ readonly cursor?: GitHubPullRequestActivityCursor;
14
+ }
15
+ export declare function readGitHubPullRequestActivity(graphql: AliasedGraphql, targets: readonly GitHubPullRequestActivityTarget[], limit: number, scope: ScopedLogger | undefined): Promise<PromiseSettledResult<PullRequestActivityPage | undefined>[]>;
16
+ export declare function encodePullRequestActivityCursor(cursor: GitHubPullRequestActivityCursor): string;
17
+ export declare function decodePullRequestActivityCursor(cursor: string): GitHubPullRequestActivityCursor | undefined;
18
+ //#endregion
19
+ //# sourceMappingURL=pullRequestActivity.d.ts.map
@@ -0,0 +1,355 @@
1
+ import { isCancellationError } from "../../../utils/cancellation.js";
2
+ import { base64, fromBase64ToString } from "../../../utils/base64.js";
3
+ import { getAliasErrorVerdict } from "./aliasedQuery.js";
4
+ //#region ../plus/git-github/src/api/pullRequestActivity.ts
5
+ const maxPageSize = 100;
6
+ const maxFollowPages = 4;
7
+ const reviewCommentsPageSize = 20;
8
+ const activityItemTypes = "PULL_REQUEST_REVIEW, ISSUE_COMMENT";
9
+ const actorFields = "author { __typename login url }";
10
+ const timelineNodeFields = `pageInfo { hasNextPage endCursor }
11
+ nodes { __typename
12
+ ... on IssueComment { id url body publishedAt createdAt viewerDidAuthor isMinimized ${actorFields} }
13
+ ... on PullRequestReview { id url body state publishedAt submittedAt createdAt viewerDidAuthor isMinimized commit { oid }
14
+ ${actorFields}
15
+ comments(first: ${reviewCommentsPageSize}) { totalCount nodes { ${`id url body path line startLine originalLine outdated publishedAt createdAt viewerDidAuthor isMinimized replyTo { id } commit { oid } ${actorFields}`} } } }
16
+ }`;
17
+ async function readGitHubPullRequestActivity(graphql, targets, limit, scope) {
18
+ let timelines;
19
+ try {
20
+ timelines = await readTimelines(graphql, targets, limit, scope);
21
+ } catch (ex) {
22
+ if (isCancellationError(ex)) throw ex;
23
+ scope?.warn(`failed to read pull request activity; ex=${ex}`);
24
+ return targets.map(() => ({
25
+ status: "rejected",
26
+ reason: ex
27
+ }));
28
+ }
29
+ return targets.map((target, i) => {
30
+ const slot = timelines[i];
31
+ if (slot.status === "rejected") return slot;
32
+ if (slot.value == null) return {
33
+ status: "fulfilled",
34
+ value: void 0
35
+ };
36
+ try {
37
+ return {
38
+ status: "fulfilled",
39
+ value: toActivityPage(slot.value, target.cursor, limit)
40
+ };
41
+ } catch (ex) {
42
+ scope?.warn(`failed to map pull request activity; ${describeTarget(target)}, ex=${ex}`);
43
+ return {
44
+ status: "rejected",
45
+ reason: ex
46
+ };
47
+ }
48
+ });
49
+ }
50
+ async function readTimelines(graphql, targets, limit, scope) {
51
+ const { data, errors } = await queryActivity(graphql, targets, limit);
52
+ const timelines = targets.map((target, i) => {
53
+ const alias = `p${i}`;
54
+ const node = data[alias]?.pullRequest;
55
+ const verdict = getAliasErrorVerdict(errors, alias, node);
56
+ if (verdict != null && verdict !== "absent") return verdict;
57
+ if (node == null) return {
58
+ status: "fulfilled",
59
+ value: void 0
60
+ };
61
+ try {
62
+ return {
63
+ status: "fulfilled",
64
+ value: {
65
+ createdAt: node.createdAt,
66
+ entries: toTimelineEntries(node.timelineItems),
67
+ pageInfo: node.timelineItems.pageInfo
68
+ }
69
+ };
70
+ } catch (ex) {
71
+ scope?.warn(`failed to map pull request activity; ${describeTarget(target)}, ex=${ex}`);
72
+ return {
73
+ status: "rejected",
74
+ reason: ex
75
+ };
76
+ }
77
+ });
78
+ const stale = targets.flatMap((target, i) => {
79
+ const slot = timelines[i];
80
+ const cursor = target.cursor;
81
+ return cursor != null && slot.status === "fulfilled" && slot.value != null ? [{
82
+ index: i,
83
+ target: {
84
+ ...target,
85
+ cursor
86
+ },
87
+ timeline: slot.value
88
+ }] : [];
89
+ });
90
+ const followed = await readPastStalePages(graphql, stale, limit, scope);
91
+ stale.forEach((s, i) => {
92
+ timelines[s.index] = {
93
+ status: "fulfilled",
94
+ value: followed[i]
95
+ };
96
+ });
97
+ return timelines;
98
+ }
99
+ async function queryActivity(graphql, targets, limit) {
100
+ const variables = {};
101
+ targets.forEach((target, i) => {
102
+ variables[`o${i}`] = target.owner;
103
+ variables[`n${i}`] = target.repo;
104
+ variables[`k${i}`] = target.number;
105
+ if (target.cursor != null) {
106
+ variables[`s${i}`] = activitySince(target.cursor);
107
+ if (target.after != null) variables[`a${i}`] = target.after;
108
+ }
109
+ });
110
+ const rsp = await graphql(activityQuery(targets, limit), variables);
111
+ if (rsp?.data == null) throw new Error("GitHub returned no data for the pull request activity");
112
+ return rsp;
113
+ }
114
+ async function readPastStalePages(graphql, stale, limit, scope) {
115
+ const timelines = stale.map((s) => s.timeline);
116
+ let due = stale.flatMap((s, index) => followFrom(index, s.timeline, s.target.cursor));
117
+ for (let round = 0; round < maxFollowPages && due.length !== 0; round++) {
118
+ let answer;
119
+ try {
120
+ answer = await queryActivity(graphql, due.map((d) => ({
121
+ ...stale[d.index].target,
122
+ after: d.after
123
+ })), limit);
124
+ } catch (ex) {
125
+ if (isCancellationError(ex)) throw ex;
126
+ scope?.warn(`failed to read past pull request activity pages; ex=${ex}`);
127
+ break;
128
+ }
129
+ const { data, errors } = answer;
130
+ due = due.flatMap(({ index }, i) => {
131
+ const alias = `p${i}`;
132
+ const next = data[alias]?.pullRequest?.timelineItems;
133
+ if (next == null || errors.some((e) => e.path?.[0] === alias)) {
134
+ scope?.warn(`failed to read past a pull request activity page; ${describeTarget(stale[index].target)}`);
135
+ return [];
136
+ }
137
+ const timeline = {
138
+ createdAt: timelines[index].createdAt,
139
+ entries: [...timelines[index].entries, ...toTimelineEntries(next)],
140
+ pageInfo: next.pageInfo
141
+ };
142
+ timelines[index] = timeline;
143
+ return followFrom(index, timeline, stale[index].target.cursor);
144
+ });
145
+ }
146
+ return timelines;
147
+ }
148
+ function followFrom(index, timeline, cursor) {
149
+ const { hasNextPage, endCursor } = timeline.pageInfo;
150
+ if (!hasNextPage || endCursor == null) return [];
151
+ const since = toEpochSecond(cursor.t);
152
+ const seen = new Set(cursor.ids);
153
+ return timeline.entries.some((i) => i.second >= since && !seen.has(i.node.id)) ? [] : [{
154
+ index,
155
+ after: endCursor
156
+ }];
157
+ }
158
+ function activityQuery(targets, limit) {
159
+ const params = [];
160
+ const fields = [];
161
+ targets.forEach((target, i) => {
162
+ params.push(`$o${i}: String!`, `$n${i}: String!`, `$k${i}: Int!`);
163
+ if (target.cursor != null) params.push(`$s${i}: DateTime!`);
164
+ const after = target.cursor != null && target.after != null;
165
+ if (after) params.push(`$a${i}: String!`);
166
+ const timeline = target.cursor != null ? `timelineItems(first: ${activityPageSize(limit, target.cursor)}, since: $s${i}, ${after ? `after: $a${i}, ` : ""}itemTypes: [${activityItemTypes}])` : `timelineItems(last: ${limit}, itemTypes: [${activityItemTypes}])`;
167
+ fields.push(`p${i}: repository(owner: $o${i}, name: $n${i}) {
168
+ pullRequest(number: $k${i}) {
169
+ createdAt
170
+ ${timeline} {
171
+ ${timelineNodeFields}
172
+ }
173
+ }
174
+ }`);
175
+ });
176
+ return `query getPullRequestActivity(
177
+ ${params.join("\n ")}
178
+ ) {
179
+ ${fields.join("\n ")}
180
+ }`;
181
+ }
182
+ function activityPageSize(limit, cursor) {
183
+ return Math.min(maxPageSize, limit + cursor.ids.length);
184
+ }
185
+ function activitySince(cursor) {
186
+ return (/* @__PURE__ */ new Date(toEpochSecond(cursor.t) * 1e3 - 1e3)).toISOString();
187
+ }
188
+ function describeTarget(target) {
189
+ return `${target.owner}/${target.repo}#${target.number}`;
190
+ }
191
+ function encodePullRequestActivityCursor(cursor) {
192
+ return base64(JSON.stringify({
193
+ v: 1,
194
+ t: cursor.t,
195
+ ids: cursor.ids
196
+ })).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
197
+ }
198
+ function decodePullRequestActivityCursor(cursor) {
199
+ if (!/^[A-Za-z0-9_-]+$/.test(cursor)) return void 0;
200
+ let parsed;
201
+ try {
202
+ const padded = cursor.replace(/-/g, "+").replace(/_/g, "/").padEnd(Math.ceil(cursor.length / 4) * 4, "=");
203
+ parsed = JSON.parse(fromBase64ToString(padded));
204
+ } catch {
205
+ return;
206
+ }
207
+ if (parsed == null || typeof parsed !== "object") return void 0;
208
+ const { v, t, ids } = parsed;
209
+ if (v !== 1 || typeof t !== "string" || Number.isNaN(Date.parse(t))) return void 0;
210
+ if (!Array.isArray(ids) || !ids.every((id) => typeof id === "string")) return void 0;
211
+ return {
212
+ t,
213
+ ids
214
+ };
215
+ }
216
+ function toTimelineEntries(items) {
217
+ const entries = [];
218
+ for (const item of items.nodes ?? []) {
219
+ if (item?.id == null || !isActivityNode(item)) continue;
220
+ if (item.__typename === "PullRequestReview" && item.state === "PENDING") continue;
221
+ const publishedAt = new Date(activityTime(item));
222
+ entries.push({
223
+ node: item,
224
+ publishedAt,
225
+ second: toEpochSecond(publishedAt),
226
+ createdSecond: toEpochSecond(item.createdAt)
227
+ });
228
+ }
229
+ return entries;
230
+ }
231
+ function toActivityPage(timeline, cursor, limit) {
232
+ const returned = timeline.entries;
233
+ if (cursor == null) return {
234
+ items: returned.flatMap((i) => toActivityItems(i.node, i.publishedAt)),
235
+ cursor: encodePullRequestActivityCursor(baselineCursor(returned, timeline.createdAt)),
236
+ hasMore: false
237
+ };
238
+ const since = toEpochSecond(cursor.t);
239
+ const seen = new Set(cursor.ids);
240
+ const inWindow = returned.filter((i) => i.second >= since);
241
+ const fresh = inWindow.filter((i) => !seen.has(i.node.id));
242
+ const kept = fresh.slice(0, limit);
243
+ const lastKept = kept.at(-1);
244
+ const cut = fresh.length > kept.length || timeline.pageInfo.hasNextPage;
245
+ return {
246
+ items: kept.flatMap((i) => toActivityItems(i.node, i.publishedAt)),
247
+ cursor: encodePullRequestActivityCursor(lastKept != null ? resumeCursor(cursor, returned, inWindow, kept, lastKept, fresh.slice(limit), cut) : cursor),
248
+ hasMore: cut
249
+ };
250
+ }
251
+ function activityTime(node) {
252
+ return node.__typename === "PullRequestReview" ? node.submittedAt ?? node.publishedAt ?? node.createdAt : node.publishedAt ?? node.createdAt;
253
+ }
254
+ function baselineCursor(timeline, createdAt) {
255
+ if (timeline.length === 0) return {
256
+ t: toIsoSecond(toEpochSecond(createdAt)),
257
+ ids: []
258
+ };
259
+ const t = Math.max(...timeline.map((i) => i.second));
260
+ return {
261
+ t: toIsoSecond(t),
262
+ ids: timeline.filter((i) => i.second === t).map((i) => i.node.id)
263
+ };
264
+ }
265
+ function resumeCursor(cursor, returned, inWindow, kept, lastKept, trimmed, cut) {
266
+ let t;
267
+ if (cut) t = Math.max(toEpochSecond(cursor.t), Math.min(lastKept.second, lastKept.createdSecond, ...trimmed.map((i) => i.second)));
268
+ else t = Math.max(...kept.map((i) => i.second));
269
+ const delivered = /* @__PURE__ */ new Set([...cursor.ids, ...kept.map((i) => i.node.id)]);
270
+ const ids = inWindow.filter((i) => i.second >= t && delivered.has(i.node.id)).map((i) => i.node.id);
271
+ if (cut) {
272
+ const present = new Set(returned.map((i) => i.node.id));
273
+ ids.push(...cursor.ids.filter((id) => !present.has(id)));
274
+ }
275
+ return {
276
+ t: toIsoSecond(t),
277
+ ids: [...new Set(ids)]
278
+ };
279
+ }
280
+ function isActivityNode(node) {
281
+ return node.__typename === "IssueComment" || node.__typename === "PullRequestReview";
282
+ }
283
+ function toActivityItems(node, publishedAt) {
284
+ const base = {
285
+ id: node.id,
286
+ url: node.url,
287
+ ...authorOf(node.author),
288
+ publishedAt,
289
+ byViewer: node.viewerDidAuthor === true,
290
+ isMinimized: node.isMinimized === true
291
+ };
292
+ if (node.__typename === "IssueComment") return [{
293
+ kind: "comment",
294
+ ...base,
295
+ body: node.body ?? ""
296
+ }];
297
+ const comments = (node.comments?.nodes ?? []).filter((c) => c != null);
298
+ const items = [{
299
+ kind: "review",
300
+ ...base,
301
+ state: fromGitHubReviewState(node.state),
302
+ body: node.body ?? "",
303
+ ...node.commit?.oid != null ? { commitSha: node.commit.oid } : {},
304
+ ...(node.comments?.totalCount ?? 0) > comments.length ? { commentsTruncated: true } : {}
305
+ }];
306
+ const ordered = comments.map((c) => ({
307
+ comment: c,
308
+ createdAt: Date.parse(c.createdAt)
309
+ })).sort((a, b) => a.createdAt - b.createdAt);
310
+ for (const { comment } of ordered) items.push({
311
+ kind: "review-comment",
312
+ id: comment.id,
313
+ url: comment.url,
314
+ ...authorOf(comment.author),
315
+ publishedAt,
316
+ byViewer: comment.viewerDidAuthor === true,
317
+ isMinimized: comment.isMinimized === true,
318
+ reviewId: node.id,
319
+ body: comment.body ?? "",
320
+ path: comment.path,
321
+ ...comment.line != null ? { line: comment.line } : {},
322
+ ...comment.startLine != null ? { startLine: comment.startLine } : {},
323
+ ...comment.originalLine != null ? { originalLine: comment.originalLine } : {},
324
+ outdated: comment.outdated === true,
325
+ ...comment.replyTo?.id != null ? { inReplyTo: comment.replyTo.id } : {},
326
+ ...comment.commit?.oid != null ? { commitSha: comment.commit.oid } : {}
327
+ });
328
+ return items;
329
+ }
330
+ function authorOf(actor) {
331
+ if (actor?.login == null) return {};
332
+ return { author: {
333
+ login: actor.login,
334
+ ...actor.url != null ? { url: actor.url } : {},
335
+ isBot: actor.__typename === "Bot"
336
+ } };
337
+ }
338
+ function fromGitHubReviewState(state) {
339
+ switch (state) {
340
+ case "APPROVED": return "approved";
341
+ case "CHANGES_REQUESTED": return "changes-requested";
342
+ case "DISMISSED": return "dismissed";
343
+ default: return "commented";
344
+ }
345
+ }
346
+ function toIsoSecond(second) {
347
+ return (/* @__PURE__ */ new Date(second * 1e3)).toISOString();
348
+ }
349
+ function toEpochSecond(time) {
350
+ return Math.floor((typeof time === "string" ? Date.parse(time) : time.getTime()) / 1e3);
351
+ }
352
+ //#endregion
353
+ export { decodePullRequestActivityCursor, encodePullRequestActivityCursor, readGitHubPullRequestActivity };
354
+
355
+ //# sourceMappingURL=pullRequestActivity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pullRequestActivity.js","names":[],"sources":["../../../../../plus/git-github/src/api/pullRequestActivity.ts"],"sourcesContent":["import type {\n\tPullRequestActivityAuthor,\n\tPullRequestActivityItem,\n\tPullRequestActivityPage,\n} from '@gitlens/git/models/pullRequestActivity.js';\nimport { base64, fromBase64ToString } from '@gitlens/utils/base64.js';\nimport { isCancellationError } from '@gitlens/utils/cancellation.js';\nimport type { ScopedLogger } from '@gitlens/utils/logger.scoped.js';\nimport type { AliasedGraphql, GraphqlAliasError } from './aliasedQuery.js';\nimport { getAliasErrorVerdict } from './aliasedQuery.js';\n\nexport interface GitHubPullRequestActivityCursor {\n\treadonly t: string;\n\treadonly ids: readonly string[];\n}\n\nexport interface GitHubPullRequestActivityTarget {\n\treadonly owner: string;\n\treadonly repo: string;\n\treadonly number: number;\n\treadonly cursor?: GitHubPullRequestActivityCursor;\n}\n\ntype ActivityActorNode = { __typename?: string; login?: string | null; url?: string | null } | null;\n\ntype ActivityCommentFields = {\n\tid: string;\n\turl: string;\n\tbody?: string | null;\n\tpublishedAt?: string | null;\n\tcreatedAt: string;\n\tviewerDidAuthor?: boolean | null;\n\tisMinimized?: boolean | null;\n\tauthor?: ActivityActorNode;\n};\n\ntype ActivityReviewCommentNode = ActivityCommentFields & {\n\tpath: string;\n\tline?: number | null;\n\tstartLine?: number | null;\n\toriginalLine?: number | null;\n\toutdated?: boolean | null;\n\treplyTo?: { id: string } | null;\n\tcommit?: { oid: string } | null;\n};\n\ntype ActivityTimelineNode =\n\t| (ActivityCommentFields & { __typename: 'IssueComment' })\n\t| (ActivityCommentFields & {\n\t\t\t__typename: 'PullRequestReview';\n\t\t\tstate: string;\n\t\t\tsubmittedAt?: string | null;\n\t\t\tcommit?: { oid: string } | null;\n\t\t\tcomments?: { totalCount: number; nodes?: (ActivityReviewCommentNode | null)[] | null } | null;\n\t })\n\t| { __typename: string; id?: string };\n\ntype ActivityNode = Extract<ActivityTimelineNode, { __typename: 'IssueComment' | 'PullRequestReview' }>;\n\ntype ActivityTimelineItems = {\n\tpageInfo: ActivityPageInfo;\n\tnodes?: (ActivityTimelineNode | null)[] | null;\n};\n\ntype ActivityPageInfo = { hasNextPage: boolean; endCursor?: string | null };\n\ntype PullRequestActivityResponse = Record<\n\tstring,\n\t{ pullRequest?: { createdAt: string; timelineItems: ActivityTimelineItems } | null } | null | undefined\n>;\n\ntype ActivityQueryTarget = GitHubPullRequestActivityTarget & { readonly after?: string };\n\ntype TimelineEntry = { node: ActivityNode; publishedAt: Date; second: number; createdSecond: number };\n\ntype Timeline = { createdAt: string; entries: readonly TimelineEntry[]; pageInfo: ActivityPageInfo };\n\ntype StaleTimeline = {\n\tindex: number;\n\ttarget: GitHubPullRequestActivityTarget & { readonly cursor: GitHubPullRequestActivityCursor };\n\ttimeline: Timeline;\n};\n\nconst maxPageSize = 100;\nconst maxFollowPages = 4;\nconst reviewCommentsPageSize = 20;\n\nconst activityItemTypes = 'PULL_REQUEST_REVIEW, ISSUE_COMMENT';\nconst actorFields = 'author { __typename login url }';\nconst reviewCommentFields = `id url body path line startLine originalLine outdated publishedAt createdAt viewerDidAuthor isMinimized replyTo { id } commit { oid } ${actorFields}`;\nconst timelineNodeFields = `pageInfo { hasNextPage endCursor }\n\t\t\t\t\t\tnodes { __typename\n\t\t\t\t\t\t\t... on IssueComment { id url body publishedAt createdAt viewerDidAuthor isMinimized ${actorFields} }\n\t\t\t\t\t\t\t... on PullRequestReview { id url body state publishedAt submittedAt createdAt viewerDidAuthor isMinimized commit { oid }\n\t\t\t\t\t\t\t\t${actorFields}\n\t\t\t\t\t\t\t\tcomments(first: ${reviewCommentsPageSize}) { totalCount nodes { ${reviewCommentFields} } } }\n\t\t\t\t\t\t}`;\n\nexport async function readGitHubPullRequestActivity(\n\tgraphql: AliasedGraphql,\n\ttargets: readonly GitHubPullRequestActivityTarget[],\n\tlimit: number,\n\tscope: ScopedLogger | undefined,\n): Promise<PromiseSettledResult<PullRequestActivityPage | undefined>[]> {\n\tlet timelines: PromiseSettledResult<Timeline | undefined>[];\n\ttry {\n\t\ttimelines = await readTimelines(graphql, targets, limit, scope);\n\t} catch (ex) {\n\t\tif (isCancellationError(ex)) throw ex;\n\n\t\tscope?.warn(`failed to read pull request activity; ex=${ex}`);\n\t\treturn targets.map((): PromiseRejectedResult => ({ status: 'rejected', reason: ex }));\n\t}\n\n\treturn targets.map((target, i): PromiseSettledResult<PullRequestActivityPage | undefined> => {\n\t\tconst slot = timelines[i];\n\t\tif (slot.status === 'rejected') return slot;\n\t\tif (slot.value == null) return { status: 'fulfilled', value: undefined };\n\n\t\ttry {\n\t\t\treturn { status: 'fulfilled', value: toActivityPage(slot.value, target.cursor, limit) };\n\t\t} catch (ex) {\n\t\t\tscope?.warn(`failed to map pull request activity; ${describeTarget(target)}, ex=${ex}`);\n\t\t\treturn { status: 'rejected', reason: ex };\n\t\t}\n\t});\n}\n\nasync function readTimelines(\n\tgraphql: AliasedGraphql,\n\ttargets: readonly GitHubPullRequestActivityTarget[],\n\tlimit: number,\n\tscope: ScopedLogger | undefined,\n): Promise<PromiseSettledResult<Timeline | undefined>[]> {\n\tconst { data, errors } = await queryActivity(graphql, targets, limit);\n\tconst timelines = targets.map((target, i): PromiseSettledResult<Timeline | undefined> => {\n\t\tconst alias = `p${i}`;\n\t\tconst node = data[alias]?.pullRequest;\n\t\tconst verdict = getAliasErrorVerdict(errors, alias, node);\n\t\tif (verdict != null && verdict !== 'absent') return verdict;\n\t\tif (node == null) return { status: 'fulfilled', value: undefined };\n\n\t\ttry {\n\t\t\treturn {\n\t\t\t\tstatus: 'fulfilled',\n\t\t\t\tvalue: {\n\t\t\t\t\tcreatedAt: node.createdAt,\n\t\t\t\t\tentries: toTimelineEntries(node.timelineItems),\n\t\t\t\t\tpageInfo: node.timelineItems.pageInfo,\n\t\t\t\t},\n\t\t\t};\n\t\t} catch (ex) {\n\t\t\tscope?.warn(`failed to map pull request activity; ${describeTarget(target)}, ex=${ex}`);\n\t\t\treturn { status: 'rejected', reason: ex };\n\t\t}\n\t});\n\n\tconst stale = targets.flatMap((target, i): StaleTimeline[] => {\n\t\tconst slot = timelines[i];\n\t\tconst cursor = target.cursor;\n\t\treturn cursor != null && slot.status === 'fulfilled' && slot.value != null\n\t\t\t? [{ index: i, target: { ...target, cursor: cursor }, timeline: slot.value }]\n\t\t\t: [];\n\t});\n\tconst followed = await readPastStalePages(graphql, stale, limit, scope);\n\tstale.forEach((s, i) => {\n\t\ttimelines[s.index] = { status: 'fulfilled', value: followed[i] };\n\t});\n\treturn timelines;\n}\n\nasync function queryActivity(\n\tgraphql: AliasedGraphql,\n\ttargets: readonly ActivityQueryTarget[],\n\tlimit: number,\n): Promise<{ readonly data: PullRequestActivityResponse; readonly errors: readonly GraphqlAliasError[] }> {\n\tconst variables: Record<string, unknown> = {};\n\ttargets.forEach((target, i) => {\n\t\tvariables[`o${i}`] = target.owner;\n\t\tvariables[`n${i}`] = target.repo;\n\t\tvariables[`k${i}`] = target.number;\n\t\tif (target.cursor != null) {\n\t\t\tvariables[`s${i}`] = activitySince(target.cursor);\n\t\t\tif (target.after != null) {\n\t\t\t\tvariables[`a${i}`] = target.after;\n\t\t\t}\n\t\t}\n\t});\n\n\tconst rsp = await graphql<PullRequestActivityResponse>(activityQuery(targets, limit), variables);\n\tif (rsp?.data == null) throw new Error('GitHub returned no data for the pull request activity');\n\n\treturn rsp;\n}\n\nasync function readPastStalePages(\n\tgraphql: AliasedGraphql,\n\tstale: readonly StaleTimeline[],\n\tlimit: number,\n\tscope: ScopedLogger | undefined,\n): Promise<Timeline[]> {\n\tconst timelines = stale.map(s => s.timeline);\n\tlet due = stale.flatMap((s, index) => followFrom(index, s.timeline, s.target.cursor));\n\tfor (let round = 0; round < maxFollowPages && due.length !== 0; round++) {\n\t\tlet answer: { readonly data: PullRequestActivityResponse; readonly errors: readonly GraphqlAliasError[] };\n\t\ttry {\n\t\t\tanswer = await queryActivity(\n\t\t\t\tgraphql,\n\t\t\t\tdue.map(d => ({ ...stale[d.index].target, after: d.after })),\n\t\t\t\tlimit,\n\t\t\t);\n\t\t} catch (ex) {\n\t\t\tif (isCancellationError(ex)) throw ex;\n\n\t\t\tscope?.warn(`failed to read past pull request activity pages; ex=${ex}`);\n\t\t\tbreak;\n\t\t}\n\n\t\tconst { data, errors } = answer;\n\t\tdue = due.flatMap(({ index }, i) => {\n\t\t\tconst alias = `p${i}`;\n\t\t\tconst next = data[alias]?.pullRequest?.timelineItems;\n\t\t\tif (next == null || errors.some(e => e.path?.[0] === alias)) {\n\t\t\t\tscope?.warn(`failed to read past a pull request activity page; ${describeTarget(stale[index].target)}`);\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst timeline: Timeline = {\n\t\t\t\tcreatedAt: timelines[index].createdAt,\n\t\t\t\tentries: [...timelines[index].entries, ...toTimelineEntries(next)],\n\t\t\t\tpageInfo: next.pageInfo,\n\t\t\t};\n\t\t\ttimelines[index] = timeline;\n\t\t\treturn followFrom(index, timeline, stale[index].target.cursor);\n\t\t});\n\t}\n\treturn timelines;\n}\n\nfunction followFrom(\n\tindex: number,\n\ttimeline: Timeline,\n\tcursor: GitHubPullRequestActivityCursor,\n): { index: number; after: string }[] {\n\tconst { hasNextPage, endCursor } = timeline.pageInfo;\n\tif (!hasNextPage || endCursor == null) return [];\n\n\tconst since = toEpochSecond(cursor.t);\n\tconst seen = new Set(cursor.ids);\n\treturn timeline.entries.some(i => i.second >= since && !seen.has(i.node.id))\n\t\t? []\n\t\t: [{ index: index, after: endCursor }];\n}\n\nfunction activityQuery(targets: readonly ActivityQueryTarget[], limit: number): string {\n\tconst params: string[] = [];\n\tconst fields: string[] = [];\n\ttargets.forEach((target, i) => {\n\t\tparams.push(`$o${i}: String!`, `$n${i}: String!`, `$k${i}: Int!`);\n\t\tif (target.cursor != null) {\n\t\t\tparams.push(`$s${i}: DateTime!`);\n\t\t}\n\n\t\tconst after = target.cursor != null && target.after != null;\n\t\tif (after) {\n\t\t\tparams.push(`$a${i}: String!`);\n\t\t}\n\n\t\tconst timeline =\n\t\t\ttarget.cursor != null\n\t\t\t\t? `timelineItems(first: ${activityPageSize(limit, target.cursor)}, since: $s${i}, ${after ? `after: $a${i}, ` : ''}itemTypes: [${activityItemTypes}])`\n\t\t\t\t: `timelineItems(last: ${limit}, itemTypes: [${activityItemTypes}])`;\n\t\tfields.push(`p${i}: repository(owner: $o${i}, name: $n${i}) {\n\t\t\t\tpullRequest(number: $k${i}) {\n\t\t\t\t\tcreatedAt\n\t\t\t\t\t${timeline} {\n\t\t\t\t\t\t${timelineNodeFields}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}`);\n\t});\n\treturn `query getPullRequestActivity(\n\t\t\t${params.join('\\n\\t\\t\\t')}\n\t\t) {\n\t\t\t${fields.join('\\n\\t\\t\\t')}\n\t\t}`;\n}\n\nfunction activityPageSize(limit: number, cursor: GitHubPullRequestActivityCursor): number {\n\treturn Math.min(maxPageSize, limit + cursor.ids.length);\n}\n\nfunction activitySince(cursor: GitHubPullRequestActivityCursor): string {\n\treturn new Date(toEpochSecond(cursor.t) * 1000 - 1000).toISOString();\n}\n\nfunction describeTarget(target: GitHubPullRequestActivityTarget): string {\n\treturn `${target.owner}/${target.repo}#${target.number}`;\n}\n\nexport function encodePullRequestActivityCursor(cursor: GitHubPullRequestActivityCursor): string {\n\treturn base64(JSON.stringify({ v: 1, t: cursor.t, ids: cursor.ids }))\n\t\t.replace(/\\+/g, '-')\n\t\t.replace(/\\//g, '_')\n\t\t.replace(/=+$/, '');\n}\n\nexport function decodePullRequestActivityCursor(cursor: string): GitHubPullRequestActivityCursor | undefined {\n\tif (!/^[A-Za-z0-9_-]+$/.test(cursor)) return undefined;\n\n\tlet parsed: unknown;\n\ttry {\n\t\tconst padded = cursor\n\t\t\t.replace(/-/g, '+')\n\t\t\t.replace(/_/g, '/')\n\t\t\t.padEnd(Math.ceil(cursor.length / 4) * 4, '=');\n\t\tparsed = JSON.parse(fromBase64ToString(padded));\n\t} catch {\n\t\treturn undefined;\n\t}\n\tif (parsed == null || typeof parsed !== 'object') return undefined;\n\n\tconst { v, t, ids } = parsed as { v?: unknown; t?: unknown; ids?: unknown };\n\tif (v !== 1 || typeof t !== 'string' || Number.isNaN(Date.parse(t))) return undefined;\n\tif (!Array.isArray(ids) || !ids.every((id): id is string => typeof id === 'string')) return undefined;\n\n\treturn { t: t, ids: ids };\n}\n\nfunction toTimelineEntries(items: ActivityTimelineItems): TimelineEntry[] {\n\tconst entries: TimelineEntry[] = [];\n\tfor (const item of items.nodes ?? []) {\n\t\tif (item?.id == null || !isActivityNode(item)) continue;\n\t\tif (item.__typename === 'PullRequestReview' && item.state === 'PENDING') continue;\n\n\t\tconst publishedAt = new Date(activityTime(item));\n\t\tentries.push({\n\t\t\tnode: item,\n\t\t\tpublishedAt: publishedAt,\n\t\t\tsecond: toEpochSecond(publishedAt),\n\t\t\tcreatedSecond: toEpochSecond(item.createdAt),\n\t\t});\n\t}\n\treturn entries;\n}\n\nfunction toActivityPage(\n\ttimeline: Timeline,\n\tcursor: GitHubPullRequestActivityCursor | undefined,\n\tlimit: number,\n): PullRequestActivityPage {\n\tconst returned = timeline.entries;\n\n\tif (cursor == null) {\n\t\treturn {\n\t\t\titems: returned.flatMap(i => toActivityItems(i.node, i.publishedAt)),\n\t\t\tcursor: encodePullRequestActivityCursor(baselineCursor(returned, timeline.createdAt)),\n\t\t\thasMore: false,\n\t\t};\n\t}\n\n\tconst since = toEpochSecond(cursor.t);\n\tconst seen = new Set(cursor.ids);\n\tconst inWindow = returned.filter(i => i.second >= since);\n\tconst fresh = inWindow.filter(i => !seen.has(i.node.id));\n\tconst kept = fresh.slice(0, limit);\n\tconst lastKept = kept.at(-1);\n\tconst cut = fresh.length > kept.length || timeline.pageInfo.hasNextPage;\n\treturn {\n\t\titems: kept.flatMap(i => toActivityItems(i.node, i.publishedAt)),\n\t\tcursor: encodePullRequestActivityCursor(\n\t\t\tlastKept != null\n\t\t\t\t? resumeCursor(cursor, returned, inWindow, kept, lastKept, fresh.slice(limit), cut)\n\t\t\t\t: cursor,\n\t\t),\n\t\thasMore: cut,\n\t};\n}\n\nfunction activityTime(node: ActivityNode): string {\n\treturn node.__typename === 'PullRequestReview'\n\t\t? (node.submittedAt ?? node.publishedAt ?? node.createdAt)\n\t\t: (node.publishedAt ?? node.createdAt);\n}\n\nfunction baselineCursor(timeline: readonly TimelineEntry[], createdAt: string): GitHubPullRequestActivityCursor {\n\tif (timeline.length === 0) return { t: toIsoSecond(toEpochSecond(createdAt)), ids: [] };\n\n\tconst t = Math.max(...timeline.map(i => i.second));\n\treturn { t: toIsoSecond(t), ids: timeline.filter(i => i.second === t).map(i => i.node.id) };\n}\n\nfunction resumeCursor(\n\tcursor: GitHubPullRequestActivityCursor,\n\treturned: readonly TimelineEntry[],\n\tinWindow: readonly TimelineEntry[],\n\tkept: readonly TimelineEntry[],\n\tlastKept: TimelineEntry,\n\ttrimmed: readonly TimelineEntry[],\n\tcut: boolean,\n): GitHubPullRequestActivityCursor {\n\tlet t: number;\n\tif (cut) {\n\t\tt = Math.max(\n\t\t\ttoEpochSecond(cursor.t),\n\t\t\tMath.min(lastKept.second, lastKept.createdSecond, ...trimmed.map(i => i.second)),\n\t\t);\n\t} else {\n\t\tt = Math.max(...kept.map(i => i.second));\n\t}\n\n\tconst delivered = new Set([...cursor.ids, ...kept.map(i => i.node.id)]);\n\tconst ids = inWindow.filter(i => i.second >= t && delivered.has(i.node.id)).map(i => i.node.id);\n\tif (cut) {\n\t\tconst present = new Set(returned.map(i => i.node.id));\n\t\tids.push(...cursor.ids.filter(id => !present.has(id)));\n\t}\n\treturn { t: toIsoSecond(t), ids: [...new Set(ids)] };\n}\n\nfunction isActivityNode(node: ActivityTimelineNode): node is ActivityNode {\n\treturn node.__typename === 'IssueComment' || node.__typename === 'PullRequestReview';\n}\n\nfunction toActivityItems(node: ActivityNode, publishedAt: Date): PullRequestActivityItem[] {\n\tconst base = {\n\t\tid: node.id,\n\t\turl: node.url,\n\t\t...authorOf(node.author),\n\t\tpublishedAt: publishedAt,\n\t\tbyViewer: node.viewerDidAuthor === true,\n\t\tisMinimized: node.isMinimized === true,\n\t};\n\tif (node.__typename === 'IssueComment') return [{ kind: 'comment', ...base, body: node.body ?? '' }];\n\n\tconst comments = (node.comments?.nodes ?? []).filter((c): c is ActivityReviewCommentNode => c != null);\n\tconst items: PullRequestActivityItem[] = [\n\t\t{\n\t\t\tkind: 'review',\n\t\t\t...base,\n\t\t\tstate: fromGitHubReviewState(node.state),\n\t\t\tbody: node.body ?? '',\n\t\t\t...(node.commit?.oid != null ? { commitSha: node.commit.oid } : {}),\n\t\t\t...((node.comments?.totalCount ?? 0) > comments.length ? { commentsTruncated: true as const } : {}),\n\t\t},\n\t];\n\n\tconst ordered = comments\n\t\t.map(c => ({ comment: c, createdAt: Date.parse(c.createdAt) }))\n\t\t.sort((a, b) => a.createdAt - b.createdAt);\n\tfor (const { comment } of ordered) {\n\t\titems.push({\n\t\t\tkind: 'review-comment',\n\t\t\tid: comment.id,\n\t\t\turl: comment.url,\n\t\t\t...authorOf(comment.author),\n\t\t\tpublishedAt: publishedAt,\n\t\t\tbyViewer: comment.viewerDidAuthor === true,\n\t\t\tisMinimized: comment.isMinimized === true,\n\t\t\treviewId: node.id,\n\t\t\tbody: comment.body ?? '',\n\t\t\tpath: comment.path,\n\t\t\t...(comment.line != null ? { line: comment.line } : {}),\n\t\t\t...(comment.startLine != null ? { startLine: comment.startLine } : {}),\n\t\t\t...(comment.originalLine != null ? { originalLine: comment.originalLine } : {}),\n\t\t\toutdated: comment.outdated === true,\n\t\t\t...(comment.replyTo?.id != null ? { inReplyTo: comment.replyTo.id } : {}),\n\t\t\t...(comment.commit?.oid != null ? { commitSha: comment.commit.oid } : {}),\n\t\t});\n\t}\n\treturn items;\n}\n\nfunction authorOf(actor: ActivityActorNode | undefined): { author?: PullRequestActivityAuthor } {\n\tif (actor?.login == null) return {};\n\n\treturn {\n\t\tauthor: {\n\t\t\tlogin: actor.login,\n\t\t\t...(actor.url != null ? { url: actor.url } : {}),\n\t\t\tisBot: actor.__typename === 'Bot',\n\t\t},\n\t};\n}\n\nfunction fromGitHubReviewState(state: string): 'approved' | 'changes-requested' | 'commented' | 'dismissed' {\n\tswitch (state) {\n\t\tcase 'APPROVED':\n\t\t\treturn 'approved';\n\t\tcase 'CHANGES_REQUESTED':\n\t\t\treturn 'changes-requested';\n\t\tcase 'DISMISSED':\n\t\t\treturn 'dismissed';\n\t\tdefault:\n\t\t\treturn 'commented';\n\t}\n}\n\nfunction toIsoSecond(second: number): string {\n\treturn new Date(second * 1000).toISOString();\n}\n\nfunction toEpochSecond(time: string | Date): number {\n\treturn Math.floor((typeof time === 'string' ? Date.parse(time) : time.getTime()) / 1000);\n}\n"],"mappings":";;;;AAmFA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AACvB,MAAM,yBAAyB;AAE/B,MAAM,oBAAoB;AAC1B,MAAM,cAAc;AAEpB,MAAM,qBAAqB;;6FAEkE,YAAY;;UAE/F,YAAY;0BACI,uBAAuB,yBAAyB,yIAN2F,cAMvE;;AAG9F,eAAsB,8BACrB,SACA,SACA,OACA,OACuE;CACvE,IAAI;CACJ,IAAI;EACH,YAAY,MAAM,cAAc,SAAS,SAAS,OAAO,KAAK;CAC/D,SAAS,IAAI;EACZ,IAAI,oBAAoB,EAAE,GAAG,MAAM;EAEnC,OAAO,KAAK,4CAA4C,IAAI;EAC5D,OAAO,QAAQ,WAAkC;GAAE,QAAQ;GAAY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 @@ import { GitFileIndexStatus } from "../../git/models/fileStatus.js";
2
2
  import { Provider } from "../../git/models/remoteProvider.js";
3
3
  import { IssueOrPullRequestState } from "../../git/models/issueOrPullRequest.js";
4
4
  import { Issue, IssueLabel, IssueProjection } from "../../git/models/issue.js";
5
- import { PullRequest, PullRequestMergeQueueEntry, PullRequestMergeQueueRemoval, PullRequestMergeQueueState, PullRequestMergeableState, PullRequestProjection, PullRequestReviewDecision, PullRequestReviewState, PullRequestStatusCheckRollupState } from "../../git/models/pullRequest.js";
5
+ import { PullRequest, PullRequestCheckRun, PullRequestCheckRunConclusion, PullRequestCheckRunStatus, PullRequestMergeQueueEntry, PullRequestMergeQueueRemoval, PullRequestMergeQueueState, PullRequestMergeableState, PullRequestProjection, PullRequestReviewDecision, PullRequestReviewState, PullRequestStatusCheckRollupState } from "../../git/models/pullRequest.js";
6
6
  import { Endpoints } from "@octokit/types";
7
7
  //#region ../plus/git-github/src/models.d.ts
8
8
  export interface GitHubBlame {
@@ -262,8 +262,10 @@ export interface GitHubPullRequest extends GitHubPullRequestLite {
262
262
  totalCount: number;
263
263
  nodes: {
264
264
  commit: {
265
+ id?: string;
265
266
  statusCheckRollup: {
266
267
  state: 'SUCCESS' | 'FAILURE' | 'PENDING' | 'EXPECTED' | 'ERROR';
268
+ contexts?: GitHubCheckContexts;
267
269
  } | null;
268
270
  };
269
271
  }[];
@@ -286,16 +288,19 @@ export interface GitHubPullRequestEtagNode extends Pick<GitHubPullRequest, 'id'
286
288
  mergeable?: GitHubPullRequestMergeableState | null;
287
289
  /** Only with `reviewDecision`. `null` on a repository that requires no review. */
288
290
  reviewDecision?: GitHubPullRequestReviewDecision | null;
289
- /** Only with `checks`. */
290
291
  commits?: {
291
292
  nodes: {
292
293
  commit: {
294
+ id?: string;
293
295
  statusCheckRollup: {
294
- state: GitHubPullRequestStatusCheckRollupState;
296
+ state?: GitHubPullRequestStatusCheckRollupState;
297
+ contexts?: GitHubCheckContexts<GitHubCheckContextEtagNode>;
295
298
  } | null;
296
299
  };
297
300
  }[];
298
301
  };
302
+ /** Every page of the head's checks, set by `GitHubApi.getPullRequestsEtagFieldsBatch` when it reads them. */
303
+ checkRuns?: GitHubCheckContextsRead<GitHubCheckContextEtagNode>;
299
304
  /** Selected when the read selects merge-queue data, like the full read's. `null` when the pull request isn't queued. */
300
305
  mergeQueueEntry?: Pick<GitHubMergeQueueEntry, 'state' | 'enqueuedAt'> | null;
301
306
  /** Selected when the read selects merge-queue data, exactly as the full read selects it. */
@@ -306,6 +311,62 @@ export interface GitHubPullRequestEtagNode extends Pick<GitHubPullRequest, 'id'
306
311
  */
307
312
  isMergeQueueEnabled?: boolean;
308
313
  }
314
+ export type GitHubCheckStatusState = 'REQUESTED' | 'QUEUED' | 'IN_PROGRESS' | 'COMPLETED' | 'WAITING' | 'PENDING';
315
+ export type GitHubCheckConclusionState = 'ACTION_REQUIRED' | 'TIMED_OUT' | 'CANCELLED' | 'FAILURE' | 'SUCCESS' | 'NEUTRAL' | 'SKIPPED' | 'STARTUP_FAILURE' | 'STALE';
316
+ export type GitHubStatusState = 'EXPECTED' | 'ERROR' | 'FAILURE' | 'PENDING' | 'SUCCESS';
317
+ export interface GitHubCheckRunContext {
318
+ __typename: 'CheckRun';
319
+ id: string;
320
+ databaseId: number | null;
321
+ name: string;
322
+ status: GitHubCheckStatusState;
323
+ conclusion: GitHubCheckConclusionState | null;
324
+ detailsUrl: string | null;
325
+ url: string | null;
326
+ title: string | null;
327
+ startedAt: string | null;
328
+ completedAt: string | null;
329
+ isRequired?: boolean;
330
+ checkSuite: {
331
+ app: {
332
+ slug: string;
333
+ } | null;
334
+ workflowRun: {
335
+ workflow: {
336
+ name: string;
337
+ } | null;
338
+ } | null;
339
+ } | null;
340
+ }
341
+ export interface GitHubStatusContext {
342
+ __typename: 'StatusContext';
343
+ id: string;
344
+ context: string;
345
+ state: GitHubStatusState;
346
+ targetUrl: string | null;
347
+ createdAt: string;
348
+ isRequired?: boolean;
349
+ }
350
+ export type GitHubCheckContext = GitHubCheckRunContext | GitHubStatusContext;
351
+ export interface GitHubCheckContexts<N extends GitHubCheckContextEtagNode = GitHubCheckContext> {
352
+ pageInfo: {
353
+ hasNextPage: boolean;
354
+ endCursor: string | null;
355
+ };
356
+ nodes: (N | null)[] | null;
357
+ }
358
+ /** A head's checks, read across every page. `truncated` means the head has checks `contexts` lacks. */
359
+ export interface GitHubCheckContextsRead<N extends GitHubCheckContextEtagNode = GitHubCheckContext> {
360
+ readonly contexts: readonly (N | null)[];
361
+ readonly truncated: boolean;
362
+ }
363
+ export type GitHubCheckContextEtagNode = (Pick<GitHubCheckRunContext, '__typename' | 'id' | 'databaseId' | 'name' | 'status' | 'conclusion'> & {
364
+ checkSuite: {
365
+ app: {
366
+ slug: string;
367
+ } | null;
368
+ } | null;
369
+ }) | Pick<GitHubStatusContext, '__typename' | 'id' | 'context' | 'state'>;
309
370
  /**
310
371
  * An input beyond an issue's lifecycle fields that `GitHubApi.getIssuesEtagFieldsBatch` can select. Mirrors the
311
372
  * integrations package's `IssueEtagInclude`, which this package cannot import.
@@ -347,7 +408,42 @@ export declare function toGitHubPullRequestReviewDecision(reviewDecision: PullRe
347
408
  export declare function fromGitHubPullRequestMergeableState(mergeableState: GitHubPullRequestMergeableState): PullRequestMergeableState;
348
409
  export declare function toGitHubPullRequestMergeableState(mergeableState: PullRequestMergeableState): GitHubPullRequestMergeableState;
349
410
  export declare function fromGitHubPullRequestStatusCheckRollupState(state: GitHubPullRequestStatusCheckRollupState | null | undefined): PullRequestStatusCheckRollupState | undefined;
350
- export declare function fromGitHubPullRequest(pr: GitHubPullRequest, provider: Provider, projection?: PullRequestProjection): PullRequest;
411
+ export declare function fromGitHubPullRequest(pr: GitHubPullRequest, provider: Provider, projection?: PullRequestProjection, checkRuns?: GitHubCheckContextsRead): PullRequest;
412
+ /** What a check run's opaque {@link PullRequestCheckRun.id} names. */
413
+ export type GitHubCheckRunRef =
414
+ /** A GitHub Actions job, by its job id (the check run's `databaseId`). */
415
+ {
416
+ readonly kind: 'actions-job';
417
+ readonly jobId: number;
418
+ } |
419
+ /** Any other check run, by its node id. */
420
+ {
421
+ readonly kind: 'check-run';
422
+ readonly nodeId: string;
423
+ } |
424
+ /** A commit status, by its node id. */
425
+ {
426
+ readonly kind: 'status';
427
+ readonly nodeId: string;
428
+ };
429
+ export declare function encodeGitHubCheckRunId(ref: GitHubCheckRunRef): string;
430
+ /** `undefined` for an id {@link encodeGitHubCheckRunId} didn't make. */
431
+ export declare function decodeGitHubCheckRunId(id: string): GitHubCheckRunRef | undefined;
432
+ /** An unknown status reads as `pending`, so a state GitHub adds later never fails the row. */
433
+ export declare function fromGitHubCheckStatusState(status: GitHubCheckStatusState): PullRequestCheckRunStatus;
434
+ /** An unknown conclusion reads as none, so a value GitHub adds later never fails the row. */
435
+ export declare function fromGitHubCheckConclusionState(conclusion: GitHubCheckConclusionState | null | undefined): PullRequestCheckRunConclusion | undefined;
436
+ export declare function fromGitHubStatusState(state: GitHubStatusState): {
437
+ status: PullRequestCheckRunStatus;
438
+ conclusion?: PullRequestCheckRunConclusion;
439
+ };
440
+ /**
441
+ * A check context's kind, name and normalized state: what both a full row's {@link PullRequestCheckRun} and the etag's
442
+ * cheap check read, so the two agree. `undefined` for a context type this doesn't know.
443
+ */
444
+ export declare function fromGitHubCheckContextState(context: GitHubCheckContextEtagNode | null): Pick<PullRequestCheckRun, 'kind' | 'name' | 'status' | 'conclusion'> | undefined;
445
+ export declare function toGitHubCheckRunId(context: GitHubCheckContextEtagNode): string;
446
+ export declare function fromGitHubCheckContext(context: GitHubCheckContext | null): PullRequestCheckRun | undefined;
351
447
  export declare function fromGitHubIssue(value: GitHubIssue, provider: Provider, projection?: IssueProjection): Issue;
352
448
  //#endregion
353
449
  //# sourceMappingURL=models.d.ts.map