@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.
- package/CHANGELOG.md +14 -1
- package/dist/git/models/pullRequest.d.ts +55 -1
- package/dist/git/models/pullRequest.js +5 -1
- package/dist/git/models/pullRequest.js.map +1 -1
- package/dist/git/models/pullRequestActivity.d.ts +55 -0
- package/dist/git/models/pullRequestActivity.js +0 -0
- package/dist/git/utils/pullRequest.utils.js +3 -1
- package/dist/git/utils/pullRequest.utils.js.map +1 -1
- package/dist/git/watching/worktreeSummary.d.ts +1 -0
- package/dist/git/watching/worktreeSummary.js +34 -2
- package/dist/git/watching/worktreeSummary.js.map +1 -1
- package/dist/plus/git-github/api/aliasedQuery.d.ts +19 -0
- package/dist/plus/git-github/api/aliasedQuery.js +21 -0
- package/dist/plus/git-github/api/aliasedQuery.js.map +1 -0
- package/dist/plus/git-github/api/cancellation.d.ts +4 -0
- package/dist/plus/git-github/api/cancellation.js +9 -0
- package/dist/plus/git-github/api/cancellation.js.map +1 -0
- package/dist/plus/git-github/api/checkRunLogs.d.ts +31 -0
- package/dist/plus/git-github/api/checkRunLogs.js +252 -0
- package/dist/plus/git-github/api/checkRunLogs.js.map +1 -0
- package/dist/plus/git-github/api/checkRuns.d.ts +26 -0
- package/dist/plus/git-github/api/checkRuns.js +191 -0
- package/dist/plus/git-github/api/checkRuns.js.map +1 -0
- package/dist/plus/git-github/api/github.d.ts +21 -2
- package/dist/plus/git-github/api/github.js +162 -37
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/pullRequestActivity.d.ts +19 -0
- package/dist/plus/git-github/api/pullRequestActivity.js +355 -0
- package/dist/plus/git-github/api/pullRequestActivity.js.map +1 -0
- package/dist/plus/git-github/models.d.ts +100 -4
- package/dist/plus/git-github/models.js +135 -3
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/integrations/fieldPresence.d.ts +10 -5
- package/dist/plus/integrations/fieldPresence.js +46 -25
- package/dist/plus/integrations/fieldPresence.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +4 -1
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +24 -0
- package/dist/plus/integrations/integrationService.js +8 -0
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +77 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +31 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +68 -0
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +21 -2
- package/dist/plus/integrations/models/integration.js +20 -1
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +13 -2
- package/dist/plus/integrations/providers/github.js +65 -5
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
- package/dist/plus/integrations/reads/drains.d.ts +1 -0
- package/dist/plus/integrations/reads/etag.js +20 -5
- package/dist/plus/integrations/reads/etag.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestActivity.d.ts +36 -0
- package/dist/plus/integrations/reads/pullRequestActivity.js +103 -0
- package/dist/plus/integrations/reads/pullRequestActivity.js.map +1 -0
- package/dist/plus/integrations/reads/pullRequestBatch.d.ts +4 -1
- package/dist/plus/integrations/reads/pullRequestBatch.js +5 -2
- package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBranches.d.ts +2 -0
- package/dist/plus/integrations/reads/pullRequestBranches.js +2 -1
- package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestCheckLogs.d.ts +27 -0
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js +92 -0
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js.map +1 -0
- package/docs/integrations.md +96 -5
- package/package.json +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { isGitHubProviderId } from "../providers/providerErrors.js";
|
|
2
|
+
import { appendDedupedWarning } from "../results.js";
|
|
3
|
+
import { isGitHostIntegration, isIssuesHostIntegrationId } from "../utils/integration.utils.js";
|
|
4
|
+
import { gitHostOnlySurfaceWarning, otherWarning, unsupportedWarning } from "./warnings.js";
|
|
5
|
+
import { runCaptured } from "./drains.js";
|
|
6
|
+
import { appendBatchSlotWarning } from "./batchEtags.js";
|
|
7
|
+
import { findDuplicateKey, unresolvedIntegration } from "./issueBatch.js";
|
|
8
|
+
//#region ../plus/integrations/src/reads/pullRequestCheckLogs.ts
|
|
9
|
+
const defaultTailLines = 200;
|
|
10
|
+
const maxTailLines = 2e3;
|
|
11
|
+
async function getPullRequestCheckLogs(ctx, options) {
|
|
12
|
+
const { providerId, connectionId } = options;
|
|
13
|
+
const refused = (warning) => ({
|
|
14
|
+
items: [],
|
|
15
|
+
warnings: [warning],
|
|
16
|
+
fetchFailed: true
|
|
17
|
+
});
|
|
18
|
+
const surface = "Reading pull request check logs";
|
|
19
|
+
if (isIssuesHostIntegrationId(providerId)) return refused(gitHostOnlySurfaceWarning(providerId, void 0, connectionId, surface));
|
|
20
|
+
if (!isGitHubProviderId(providerId)) return refused(unsupportedWarning(providerId, void 0, connectionId, `${surface} is not supported by '${providerId}'; only GitHub and GitHub Enterprise serve check logs.`));
|
|
21
|
+
const tailLines = options.tailLines ?? defaultTailLines;
|
|
22
|
+
if (!Number.isInteger(tailLines) || tailLines < 1 || tailLines > maxTailLines) return refused(otherWarning(providerId, void 0, connectionId, `Check log tailLines ${tailLines} is invalid; expected an integer from 1 to ${maxTailLines}.`));
|
|
23
|
+
if (options.targets.length === 0) return {
|
|
24
|
+
items: [],
|
|
25
|
+
warnings: []
|
|
26
|
+
};
|
|
27
|
+
const duplicateKey = findDuplicateKey(options.targets);
|
|
28
|
+
if (duplicateKey != null) return refused(otherWarning(providerId, void 0, connectionId, `Duplicate check log target key '${duplicateKey}'; keys identify results, so each must be unique.`));
|
|
29
|
+
const targets = options.targets.map((t) => ({
|
|
30
|
+
...t,
|
|
31
|
+
owner: t.owner.trim(),
|
|
32
|
+
repo: t.repo.trim()
|
|
33
|
+
}));
|
|
34
|
+
const invalid = findInvalidTarget(targets);
|
|
35
|
+
if (invalid != null) return refused(otherWarning(providerId, void 0, connectionId, invalid));
|
|
36
|
+
const integration = await ctx.getIntegrationForRead(providerId, connectionId, options.domain);
|
|
37
|
+
if (integration == null) return unresolvedIntegration(ctx, providerId, connectionId, options.domain);
|
|
38
|
+
if (!isGitHostIntegration(integration)) return refused(gitHostOnlySurfaceWarning(providerId, void 0, connectionId, surface));
|
|
39
|
+
const domain = ctx.domainForRead(integration, providerId, connectionId, options.domain);
|
|
40
|
+
const { value: slots, warning } = await runCaptured(providerId, domain, connectionId, () => integration.getPullRequestCheckLogsResult(targets.map((t) => ({
|
|
41
|
+
owner: t.owner,
|
|
42
|
+
repo: t.repo,
|
|
43
|
+
checkRunId: t.checkRunId
|
|
44
|
+
})), { tailLines }, void 0, connectionId), { warnOnMissingSession: true });
|
|
45
|
+
const warnings = [];
|
|
46
|
+
const keys = targets.map((t) => t.key);
|
|
47
|
+
if (warning != null) appendDedupedWarning(warnings, {
|
|
48
|
+
...warning,
|
|
49
|
+
targetKeys: keys
|
|
50
|
+
});
|
|
51
|
+
if (slots == null) {
|
|
52
|
+
if (warning == null) appendDedupedWarning(warnings, {
|
|
53
|
+
...unsupportedWarning(providerId, domain, connectionId, `${surface} is not supported by '${providerId}'.`),
|
|
54
|
+
targetKeys: keys
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
items: [],
|
|
58
|
+
warnings,
|
|
59
|
+
fetchFailed: true
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const items = [];
|
|
63
|
+
let fetchFailed = false;
|
|
64
|
+
for (let i = 0; i < targets.length; i++) {
|
|
65
|
+
const slot = slots[i];
|
|
66
|
+
const key = targets[i].key;
|
|
67
|
+
if (slot.status === "rejected") {
|
|
68
|
+
appendBatchSlotWarning(warnings, providerId, domain, connectionId, slot, key);
|
|
69
|
+
fetchFailed = true;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
items.push(slot.value.log != null ? {
|
|
73
|
+
key,
|
|
74
|
+
log: slot.value.log
|
|
75
|
+
} : {
|
|
76
|
+
key,
|
|
77
|
+
unavailable: slot.value.unavailable
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
items,
|
|
82
|
+
warnings,
|
|
83
|
+
fetchFailed: fetchFailed || void 0
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function findInvalidTarget(targets) {
|
|
87
|
+
for (const target of targets) if (target.owner.length === 0 || target.repo.length === 0) return `Check log target '${target.key}' requires a non-empty owner and repo.`;
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { getPullRequestCheckLogs };
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=pullRequestCheckLogs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pullRequestCheckLogs.js","names":[],"sources":["../../../../../plus/integrations/src/reads/pullRequestCheckLogs.ts"],"sourcesContent":["import type { PullRequestCheckLog } from '@gitlens/git/models/pullRequest.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { isGitHubProviderId } from '../providers/providerErrors.js';\nimport type { ProviderResult, ProviderWarning } from '../results.js';\nimport { appendDedupedWarning } from '../results.js';\nimport { isGitHostIntegration, isIssuesHostIntegrationId } from '../utils/integration.utils.js';\nimport { appendBatchSlotWarning } from './batchEtags.js';\nimport type { ProviderReadContext } from './context.js';\nimport { runCaptured } from './drains.js';\nimport { findDuplicateKey, unresolvedIntegration } from './issueBatch.js';\nimport { gitHostOnlySurfaceWarning, otherWarning, unsupportedWarning } from './warnings.js';\n\n/** One check whose log to read, echoed back under the caller's own `key`. */\nexport interface PullRequestCheckLogTarget {\n\t/** Caller-owned identifier, echoed on the result. Must be unique. */\n\tkey: string;\n\towner: string;\n\trepo: string;\n\t/** A `PullRequestCheckRun.id` from a batch pull request read, as it came. */\n\tcheckRunId: string;\n}\n\n/** The answer for one {@link PullRequestCheckLogTarget}: exactly one of `log` and `unavailable` is set. */\nexport type PullRequestCheckLogResult = PullRequestCheckLog & { readonly key: string };\n\nconst defaultTailLines = 200;\nconst maxTailLines = 2000;\n\nexport async function getPullRequestCheckLogs(\n\tctx: ProviderReadContext,\n\toptions: {\n\t\tproviderId: IntegrationIds;\n\t\tconnectionId?: string;\n\t\tdomain?: string;\n\t\ttargets: readonly PullRequestCheckLogTarget[];\n\t\ttailLines?: number;\n\t},\n): Promise<ProviderResult<PullRequestCheckLogResult>> {\n\tconst { providerId, connectionId } = options;\n\tconst refused = (warning: ProviderWarning): ProviderResult<PullRequestCheckLogResult> => ({\n\t\titems: [],\n\t\twarnings: [warning],\n\t\tfetchFailed: true,\n\t});\n\tconst surface = 'Reading pull request check logs';\n\n\tif (isIssuesHostIntegrationId(providerId)) {\n\t\treturn refused(gitHostOnlySurfaceWarning(providerId, undefined, connectionId, surface));\n\t}\n\tif (!isGitHubProviderId(providerId)) {\n\t\treturn refused(\n\t\t\tunsupportedWarning(\n\t\t\t\tproviderId,\n\t\t\t\tundefined,\n\t\t\t\tconnectionId,\n\t\t\t\t`${surface} is not supported by '${providerId}'; only GitHub and GitHub Enterprise serve check logs.`,\n\t\t\t),\n\t\t);\n\t}\n\n\tconst tailLines = options.tailLines ?? defaultTailLines;\n\tif (!Number.isInteger(tailLines) || tailLines < 1 || tailLines > maxTailLines) {\n\t\treturn refused(\n\t\t\totherWarning(\n\t\t\t\tproviderId,\n\t\t\t\tundefined,\n\t\t\t\tconnectionId,\n\t\t\t\t`Check log tailLines ${tailLines} is invalid; expected an integer from 1 to ${maxTailLines}.`,\n\t\t\t),\n\t\t);\n\t}\n\n\tif (options.targets.length === 0) return { items: [], warnings: [] };\n\n\tconst duplicateKey = findDuplicateKey(options.targets);\n\tif (duplicateKey != null) {\n\t\treturn refused(\n\t\t\totherWarning(\n\t\t\t\tproviderId,\n\t\t\t\tundefined,\n\t\t\t\tconnectionId,\n\t\t\t\t`Duplicate check log target key '${duplicateKey}'; keys identify results, so each must be unique.`,\n\t\t\t),\n\t\t);\n\t}\n\n\tconst targets = options.targets.map(t => ({ ...t, owner: t.owner.trim(), repo: t.repo.trim() }));\n\tconst invalid = findInvalidTarget(targets);\n\tif (invalid != null) return refused(otherWarning(providerId, undefined, connectionId, invalid));\n\n\tconst integration = await ctx.getIntegrationForRead(providerId, connectionId, options.domain);\n\tif (integration == null) return unresolvedIntegration(ctx, providerId, connectionId, options.domain);\n\tif (!isGitHostIntegration(integration)) {\n\t\treturn refused(gitHostOnlySurfaceWarning(providerId, undefined, connectionId, surface));\n\t}\n\n\tconst domain = ctx.domainForRead(integration, providerId, connectionId, options.domain);\n\tconst { value: slots, warning } = await runCaptured(\n\t\tproviderId,\n\t\tdomain,\n\t\tconnectionId,\n\t\t() =>\n\t\t\tintegration.getPullRequestCheckLogsResult(\n\t\t\t\ttargets.map(t => ({ owner: t.owner, repo: t.repo, checkRunId: t.checkRunId })),\n\t\t\t\t{ tailLines: tailLines },\n\t\t\t\tundefined,\n\t\t\t\tconnectionId,\n\t\t\t),\n\t\t{ warnOnMissingSession: true },\n\t);\n\n\tconst warnings: ProviderWarning[] = [];\n\tconst keys = targets.map(t => t.key);\n\tif (warning != null) {\n\t\tappendDedupedWarning(warnings, { ...warning, targetKeys: keys });\n\t}\n\tif (slots == null) {\n\t\tif (warning == null) {\n\t\t\tappendDedupedWarning(warnings, {\n\t\t\t\t...unsupportedWarning(\n\t\t\t\t\tproviderId,\n\t\t\t\t\tdomain,\n\t\t\t\t\tconnectionId,\n\t\t\t\t\t`${surface} is not supported by '${providerId}'.`,\n\t\t\t\t),\n\t\t\t\ttargetKeys: keys,\n\t\t\t});\n\t\t}\n\t\treturn { items: [], warnings: warnings, fetchFailed: true };\n\t}\n\n\tconst items: PullRequestCheckLogResult[] = [];\n\tlet fetchFailed = false;\n\tfor (let i = 0; i < targets.length; i++) {\n\t\tconst slot = slots[i];\n\t\tconst key = targets[i].key;\n\t\tif (slot.status === 'rejected') {\n\t\t\tappendBatchSlotWarning(warnings, providerId, domain, connectionId, slot, key);\n\t\t\tfetchFailed = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\titems.push(\n\t\t\tslot.value.log != null\n\t\t\t\t? { key: key, log: slot.value.log }\n\t\t\t\t: { key: key, unavailable: slot.value.unavailable },\n\t\t);\n\t}\n\n\treturn { items: items, warnings: warnings, fetchFailed: fetchFailed || undefined };\n}\n\nfunction findInvalidTarget(targets: readonly PullRequestCheckLogTarget[]): string | undefined {\n\tfor (const target of targets) {\n\t\tif (target.owner.length === 0 || target.repo.length === 0) {\n\t\t\treturn `Check log target '${target.key}' requires a non-empty owner and repo.`;\n\t\t}\n\t}\n\treturn undefined;\n}\n"],"mappings":"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"}
|
package/docs/integrations.md
CHANGED
|
@@ -128,6 +128,8 @@ it with `page` + `hasMore` + `cursor?`. **No read throws for a provider-side fai
|
|
|
128
128
|
| `getIssuesBatch` | `IssueBatchResult` | Resolves N issues by coordinate or tracker identifier; an absence is proven. |
|
|
129
129
|
| `getPullRequestsBatch` | `PullRequestBatchResult` | Resolves N PRs by `(owner, repo, number)`, in any state; an absence is proven. |
|
|
130
130
|
| `getPullRequestsForBranches` | `PullRequestBranchResult` | Each branch's PRs, in any state and fork-aware; an empty list is a proven none. |
|
|
131
|
+
| `getPullRequestCheckLogs` | `PullRequestCheckLogResult` | The tail of each check's log, by the `PullRequestCheckRun.id` a batch read returned. |
|
|
132
|
+
| `getPullRequestActivity` | `PullRequestActivityResult` | New reviews, inline review comments and conversation comments after a caller-held cursor. |
|
|
131
133
|
| `listIssueTrackerIssuesPage` | `IssueShape` | Jira (Cloud + Data Center) / Linear / Trello / Asana (issues live under resource → project). |
|
|
132
134
|
| `sweepPullRequests` | `ProviderSweepResult` | Drains **every** page across providers (`maxPages`, default 100). |
|
|
133
135
|
| `sweepClosedPullRequests` | `ProviderSweepResult` | Same, pinned to `['closed','merged']`. |
|
|
@@ -179,9 +181,9 @@ host's `IntegrationCacheProvider.getPullRequest`, so the caller owns caching the
|
|
|
179
181
|
Both batch reads detect change with **etags**. Every fully read row carries an opaque `etag`, whether or not the
|
|
180
182
|
caller sent one; send it back as the target's `etag` on the next call. Compare etags for equality only and never
|
|
181
183
|
parse one: core computes it from the item's change state — a pull request's state, draft flag, update time and head
|
|
182
|
-
commit (plus, on Azure DevOps, a fingerprint of the fields it changes without an update time,
|
|
183
|
-
queued pull request's merge-queue state; see below);
|
|
184
|
-
state and update time — and it is not the provider's HTTP ETag. A field the host changes without moving the update
|
|
184
|
+
commit (plus, on Azure DevOps, a fingerprint of the fields it changes without an update time, on github.com a
|
|
185
|
+
queued pull request's merge-queue state, and on GitHub with `checkRuns` a fingerprint of the head's checks; see below);
|
|
186
|
+
an issue's state and update time — and it is not the provider's HTTP ETag. A field the host changes without moving the update
|
|
185
187
|
time is not an input unless `etagIncludes` names it. Reactions are such a field: GitHub adds a reaction without
|
|
186
188
|
touching the update time, so an `unchanged` issue's `thumbsUpCount` can be stale unless the call listed `'reactions'`,
|
|
187
189
|
and an `unchanged` pull request's always can. A row is in one of four states:
|
|
@@ -312,6 +314,85 @@ pull request that was never queued. Changing either the per-read option or the h
|
|
|
312
314
|
full read per held target, and a row held without the data is read in full again to gain it. A read that doesn't
|
|
313
315
|
select it computes the etag it did before merge-queue data existed.
|
|
314
316
|
|
|
317
|
+
`getPullRequestsBatch` and `getPullRequestsForBranches` also take `checkRuns`, off by default, which reads the head
|
|
318
|
+
commit's individual checks onto each row on GitHub and GitHub Enterprise: `checkRuns`, one `PullRequestCheckRun` per
|
|
319
|
+
check run or commit status (`kind`, `name`, `workflowName`, `status`, `conclusion`, `url`, `required`, `startedAt`,
|
|
320
|
+
`completedAt`, `hasLog`, and an opaque `id`), empty when the head has no checks. Every other provider ignores it, and the
|
|
321
|
+
host can't turn it on for every read. `required` is read on github.com only, and only by `getPullRequestsBatch`: the
|
|
322
|
+
branch read's query doesn't know the pull request numbers it needs, so its rows, including those it settles through the
|
|
323
|
+
batch read, leave it `undefined`. The first 100 checks come with the row; a head with more costs one more request per
|
|
324
|
+
further 100, up to 500, read through the head commit itself, so every page belongs to the same commit. Past 500, or
|
|
325
|
+
when a further page fails, the row is set `checkRunsTruncated` with the checks read so far. A field-level error under
|
|
326
|
+
the checks keeps the row rather than failing the pull request. One that loses only a check's detail (say, its workflow
|
|
327
|
+
refused to a token without Actions read access, which leaves `workflowName` unset) leaves the row complete; one that
|
|
328
|
+
loses a whole check sets it `checkRunsTruncated`, with the checks that arrived and paging on. An error on the checks'
|
|
329
|
+
connection itself still fails the pull request, since it nulls the whole rollup. `isRequired` can't be
|
|
330
|
+
null, so an error there loses its check. None of these is verified live, as GitHub hasn't been seen to raise one there.
|
|
331
|
+
Measured on github.com, 8 aliased pull requests with 70 checks cost 1
|
|
332
|
+
point and 808 nodes, about 200 ms more than a rollup-only read. By GitHub's rate-limit formula a 25-target batch goes
|
|
333
|
+
from 100 requests to 125 (1 point either way), and the cheap check adds one connection per pull request. `isRequired`
|
|
334
|
+
showed no measurable cost, though it was measured only on a repository without required checks. With `checkRuns` the
|
|
335
|
+
batch read's cheap check selects each check's kind, name, status, conclusion and what its `id` is built from, and both
|
|
336
|
+
reads make them etag inputs, so a check that fails or finishes while the rollup and update time stay the same still
|
|
337
|
+
reads as changed, and so does a check re-run to the same result, which is a new check run with a new `id`. The cheap
|
|
338
|
+
check pages through the same checks as the full read, up to the same 500, at the same one request per further 100.
|
|
339
|
+
Both fold them into one 64-bit hash with their count, plus a mark when the row is `checkRunsTruncated`, so the etag
|
|
340
|
+
stays the same length at any number of checks, and a hash collision (about 2^-64) is the only way a change can hide.
|
|
341
|
+
Only a check lost to an error the cheap check can't hit (an `isRequired` error) makes the two disagree, so such a pull
|
|
342
|
+
request is read in full on every check while the error lasts. Like merge-queue data, the option adds a marker to every
|
|
343
|
+
etag it computes, so switching it costs each held target one full read.
|
|
344
|
+
|
|
345
|
+
`getPullRequestCheckLogs` reads the tail of each check's log on GitHub and GitHub Enterprise. A target is
|
|
346
|
+
`{ key, owner, repo, checkRunId }`, where `checkRunId` is a `PullRequestCheckRun.id` exactly as a `checkRuns` read
|
|
347
|
+
returned it; any other provider refuses (`unsupported` + `fetchFailed`). It has the batch reads' result contract: rows
|
|
348
|
+
echo the caller's `key`; a duplicate key, an id no read returned, or a `tailLines` that isn't an integer from 1 to
|
|
349
|
+
2000 (default 200) refuses the whole call; and a target whose read fails (auth, rate limit, network, an unmappable
|
|
350
|
+
answer) is dropped with a warning naming it in `targetKeys` and `fetchFailed`. Every returned row carries exactly one
|
|
351
|
+
of `log` (`text`, `lineCount`, `truncated`, `source`) or `unavailable`. An Actions job returns its job log
|
|
352
|
+
(`source: 'actions-job-log'`), its last `tailLines` lines with `\r\n` read as `\n`; when the log is longer than the
|
|
353
|
+
256 KiB read, the partial first line is dropped and `truncated` is set. Any other check run returns its output
|
|
354
|
+
(`source: 'check-run-output'`): its title, summary and text, joined by blank lines and tailed the same way. A commit
|
|
355
|
+
status, a check run without output, and an Actions job whose log storage has nothing (a skipped job) answer
|
|
356
|
+
`unavailable: 'no-log'`. When the API has no log for a job, the job itself is read once more: still running answers
|
|
357
|
+
`'log-not-ready'`, finished answers `'log-expired'`, and a job the API doesn't know answers `'no-log'`. Those two
|
|
358
|
+
reasons were not verified live. On Node, an Actions log costs one REST request (the REST budget, not GraphQL points),
|
|
359
|
+
whose redirect isn't followed, then two requests to the log storage, which carry no token, aren't rate-limited, and
|
|
360
|
+
download at most 256 KiB. A web host (`isWeb`) can't read a redirect's target, so it follows it and streams the whole
|
|
361
|
+
log, keeping the last 256 KiB; that path was not verified live either, and there a skipped job's missing log reads as
|
|
362
|
+
`'log-expired'`. A storage that answers a ranged request with the whole log is streamed the same way. Either stream
|
|
363
|
+
stops past 20 MiB and answers `unavailable: 'log-too-large'`, since the bytes it read are the log's middle, not its
|
|
364
|
+
end. Targets are read in chunks of 25, up to 6 chunks at once. Within a chunk at most 4 Actions logs are read at a
|
|
365
|
+
time, and the output of its other check runs takes one GraphQL request (1 point). A status costs no request. Log text is returned raw (an Actions log keeps its
|
|
366
|
+
timestamps and `##[group]` markers) and is untrusted: it is whatever the workflow printed.
|
|
367
|
+
|
|
368
|
+
`getPullRequestActivity` reads the new reviews, inline review comments and conversation comments on each pull request
|
|
369
|
+
on GitHub and GitHub Enterprise. A target is `{ key, owner, repo, number, cursor? }`; any other provider refuses
|
|
370
|
+
(`unsupported` + `fetchFailed`). It has the batch reads' result contract: rows echo the caller's `key`; a duplicate
|
|
371
|
+
key, an empty owner or repo, a non-positive `number`, a cursor no read returned, or a `limit` that isn't an integer
|
|
372
|
+
from 1 to 100 (default 30) refuses the whole call; and a target whose read fails is dropped with a warning naming it in
|
|
373
|
+
`targetKeys` and `fetchFailed`. A pull request (or repository) that doesn't exist answers `{ key, notFound: true }` with
|
|
374
|
+
no items and the cursor sent (or `''`). Every other row carries `items` in GitHub's timeline order, an opaque
|
|
375
|
+
`cursor` to send back as the target's `cursor`, and `hasMore`. `limit` counts timeline items, reviews and
|
|
376
|
+
conversation comments; each review is followed by its inline comments (`review-comment`, the first 20, with
|
|
377
|
+
`commentsTruncated` set on the review when it has more). A reply in an existing inline thread arrives as a review of its own, usually with an empty body, whose
|
|
378
|
+
comment names the comment it answers in `inReplyTo`. Without a cursor the read is a baseline: the newest `limit` items,
|
|
379
|
+
`hasMore` false, and a cursor after them (after the pull request's creation when it has none). With one, it returns
|
|
380
|
+
what was published after it, `limit` at a time in GitHub's timeline order; on `hasMore`, read again with the returned
|
|
381
|
+
cursor. An item's time, its `publishedAt`, is when it was published: a review's submission (a review drafted earlier
|
|
382
|
+
and submitted later counts from its submission, which is what GitHub's `since` filters on), a conversation comment's
|
|
383
|
+
publication, and for an inline comment its review's. The cursor records a time and the items at or after it already
|
|
384
|
+
returned, so an item is never returned twice and one published in the same second later is still seen: the newest
|
|
385
|
+
item's time when the page is complete; when it is cut, the last item's time, or for a review drafted earlier when it
|
|
386
|
+
was drafted, never before the cursor sent, since GitHub orders the timeline by creation rather than publication. A page
|
|
387
|
+
with nothing new on it is read past in the same call, up to 4 more pages; only past those does `hasMore` come back with
|
|
388
|
+
the cursor sent. Edits are not seen: an item edited after it was returned never comes back. Pending reviews (the viewer's own
|
|
389
|
+
drafts) are skipped. `byViewer` says the connection's own account wrote the item; `author` is absent for a deleted
|
|
390
|
+
account. It takes one GraphQL request per 25 targets, up to 6 at once, plus one per page read past, which follow their
|
|
391
|
+
request one after another; GitHub
|
|
392
|
+
charges for the page size asked for rather than the items returned, which at the defaults is estimated at about 1
|
|
393
|
+
point per pull request. A new comment or review moves the pull request's update time, so a caller
|
|
394
|
+
can gate this read on a batch read's `etag` or `updatedDate`; that was not verified for every kind of activity.
|
|
395
|
+
|
|
315
396
|
`getCurrentAccount` answers who a connection is signed in as. It returns a single `account?` rather than
|
|
316
397
|
`items`, and `account` is never absent without a warning: no session, a failed request, or a provider that refuses
|
|
317
398
|
(see §8). Jira Cloud answers with the first site's account, since an Atlassian account id is the same on every site. It goes through the host-supplied
|
|
@@ -373,7 +454,8 @@ A group is `fetched` only if every field in it is. Pull request groups: `descrip
|
|
|
373
454
|
reads, and is `undefined` elsewhere), `reviewDecision`, `assignees`, `checks` (`statusCheckRollupState`), `mergeable`
|
|
374
455
|
(`mergeableState`), `diffStats` (`additions`, `deletions`, `filesChanged`), `commitCount`, `comments` (`commentsCount`),
|
|
375
456
|
`reactions` (`thumbsUpCount`), `access` (`viewerCanUpdate` and `repository.accessLevel`), `authoredByMe` (with `viewer`,
|
|
376
|
-
the identity it was matched against), `stack`, `milestone` and `
|
|
457
|
+
the identity it was matched against), `stack`, `milestone`, `mergeQueue` and `checkRuns` (`checkRuns` and
|
|
458
|
+
`checkRunsTruncated`). `statusCheckRollupState`, `commitCount`
|
|
377
459
|
and `viewerCanUpdate` live on the `PullRequest` class every row is, not on the `PullRequestShape` type. Issue groups:
|
|
378
460
|
`description` (`body`, and `bodyField` where the provider sets it, so take both from the same row), `assignees`,
|
|
379
461
|
`labels`, `comments` (`commentsCount`), `reactions` (`thumbsUpCount`), `access` (`repository.accessLevel`) and
|
|
@@ -404,6 +486,7 @@ differ, and `—` means that host never produces the tag.
|
|
|
404
486
|
| stack | fetched / unavailable | fetched / unavailable | fetched / unavailable | fetched / unavailable | fetched / unavailable | fetched / unavailable | not-requested | not-requested | fetched / unavailable |
|
|
405
487
|
| milestone | fetched | fetched | fetched | fetched | fetched | fetched | fetched | fetched | fetched |
|
|
406
488
|
| mergeQueue | fetched / unavailable | fetched / unavailable | fetched / unavailable | fetched / unavailable | fetched / unavailable | fetched / unavailable | not-requested | not-requested | fetched / unavailable |
|
|
489
|
+
| checkRuns | not-requested | not-requested | not-requested | not-requested | not-requested | not-requested | not-requested | not-requested | fetched |
|
|
407
490
|
|
|
408
491
|
<!-- field-presence: issues -->
|
|
409
492
|
|
|
@@ -445,6 +528,9 @@ The cells that aren't obvious from the projection names:
|
|
|
445
528
|
not queued, and not updated since. Any later update clears it — a comment or a label as well as a push — because
|
|
446
529
|
GitHub's timeline orders commits by commit date, not push time, so it can't say whether a push followed the
|
|
447
530
|
removal; GitHub's removal itself doesn't move the update time.
|
|
531
|
+
- `checkRuns` is read only by the batch reads, and only for a read that asks for it (`checkRuns: true`; see §4). The
|
|
532
|
+
`batch` cells read `fetched` for such a read; a `batch` row without `checkRuns` answers `not-requested`, which
|
|
533
|
+
`getPullRequestFieldPresence` derives from the row, since a read that selected check runs always sets it.
|
|
448
534
|
- Cost, which only a read that selects merge-queue data pays (any other pays nothing; see the per-read `mergeQueue`
|
|
449
535
|
option in §4): the merge-queue selection adds one connection per
|
|
450
536
|
pull request (`timelineItems(last: 1)`). By GitHub's rate-limit formula (a request per connection per parent node,
|
|
@@ -467,7 +553,7 @@ What holds for all of them:
|
|
|
467
553
|
DevOps' branch policies, Bitbucket's merge checks), so derive one from `reviews` and `reviewRequests` instead.
|
|
468
554
|
- **`access` and `authoredByMe` are never `fetched`**: no other host's read sets `repository.accessLevel`, and the
|
|
469
555
|
current account may not resolve. No other host has stacks, and no other host's merge queue (GitLab's merge trains
|
|
470
|
-
included) is read yet, so `mergeQueue` is `unavailable` everywhere else
|
|
556
|
+
included) is read yet, so `mergeQueue` is `unavailable` everywhere else, and so is `checkRuns`.
|
|
471
557
|
- **Substitutions.** Azure DevOps has no pull request assignees: both of its converters fill `assignees` with the
|
|
472
558
|
reviewers, which `reviews` and `reviewRequests` already hold, so `assignees` is `unavailable` there. Votes are not
|
|
473
559
|
reactions: a Jira issue's or Trello card's votes, and a Bitbucket issue's, land in `thumbsUpCount` (and read 0
|
|
@@ -499,6 +585,7 @@ What holds for all of them:
|
|
|
499
585
|
| stack | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable |
|
|
500
586
|
| milestone | not-requested | fetched | not-requested | fetched | fetched | fetched | fetched | fetched |
|
|
501
587
|
| mergeQueue | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable |
|
|
588
|
+
| checkRuns | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable |
|
|
502
589
|
|
|
503
590
|
<!-- field-presence: gitlab-issues -->
|
|
504
591
|
|
|
@@ -542,6 +629,7 @@ What holds for all of them:
|
|
|
542
629
|
| stack | unavailable | unavailable | — / unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable |
|
|
543
630
|
| milestone | unavailable | unavailable | — / unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable |
|
|
544
631
|
| mergeQueue | unavailable | unavailable | — / unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable |
|
|
632
|
+
| checkRuns | unavailable | unavailable | — / unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable |
|
|
545
633
|
|
|
546
634
|
<!-- field-presence: azure-issues -->
|
|
547
635
|
|
|
@@ -580,6 +668,7 @@ What holds for all of them:
|
|
|
580
668
|
| stack | unavailable | unavailable | — / unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable |
|
|
581
669
|
| milestone | unavailable | unavailable | — / unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable |
|
|
582
670
|
| mergeQueue | unavailable | unavailable | — / unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable |
|
|
671
|
+
| checkRuns | unavailable | unavailable | — / unavailable | unavailable | unavailable | unavailable | unavailable | unavailable | unavailable |
|
|
583
672
|
|
|
584
673
|
<!-- field-presence: bitbucket-issues -->
|
|
585
674
|
|
|
@@ -1375,6 +1464,8 @@ footnote says otherwise.
|
|
|
1375
1464
|
| `getIssuesBatch` | ✓ | ✓ | ✗ | ✗ | ✓ | ✓ | ✓ | ✗ | ✗ |
|
|
1376
1465
|
| `getPullRequestsBatch` | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ |
|
|
1377
1466
|
| `getPullRequestsForBranches` | ✓ | ✓ | ✓ | ✓¹ | ✓¹ | ✗ | ✗ | ✗ | ✗ |
|
|
1467
|
+
| `getPullRequestCheckLogs` | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
1468
|
+
| `getPullRequestActivity` | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
1378
1469
|
| Issues by `org`/`project` | ✗ | ✗ | ✗ | ✗ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
1379
1470
|
| `listIssueTrackerIssuesPage` | — | — | — | — | — | ✓ | ✓ | ✓ | ✓ |
|
|
1380
1471
|
| `broadenIssues` | ✓ | ✓ | ✗ | ✗ | ✓ | ✗ | ✗ | ✗ | ✗ |
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitkraken/core-gitlens",
|
|
3
3
|
"description": "GitLens core — shared Git / AI / GitHub primitives for internal GitKraken consumption",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.41.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "GitKraken",
|