@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
@@ -13,8 +13,10 @@ import { IssueCountResult, IssueCountScope, PullRequestCountResult, PullRequestC
13
13
  import { CurrentAccountResult } from "./reads/currentAccount.js";
14
14
  import { SupportedFilters } from "./reads/filters.js";
15
15
  import { IssueBatchResult, IssueBatchTarget } from "./reads/issueBatch.js";
16
+ import { PullRequestActivityResult, PullRequestActivityTarget } from "./reads/pullRequestActivity.js";
16
17
  import { PullRequestBatchResult, PullRequestBatchTarget } from "./reads/pullRequestBatch.js";
17
18
  import { PullRequestBranchResult, PullRequestBranchTarget } from "./reads/pullRequestBranches.js";
19
+ import { PullRequestCheckLogResult, PullRequestCheckLogTarget } from "./reads/pullRequestCheckLogs.js";
18
20
  //#region ../plus/integrations/src/manager.d.ts
19
21
  type IssueWriteConnection = {
20
22
  providerId: IntegrationIds;
@@ -853,6 +855,15 @@ export interface IntegrationManager {
853
855
  * rate-limit request per row, in the cheap check as well as the full read.
854
856
  */
855
857
  mergeQueue?: boolean;
858
+ /**
859
+ * GitHub and GitHub Enterprise: `true` reads each row's head check results (`checkRuns`, `checkRunsTruncated`),
860
+ * in the cheap check and the full read alike. Off by default; every other provider ignores it. Each check's
861
+ * id, kind, name, status and conclusion become etag inputs, hashed into one fixed-length term, and a read that
862
+ * selects them adds a marker to every etag it computes, so changing this reads each held target in full once.
863
+ * `required` is read on GitHub.com only. A head with more than 100 checks costs both reads a request per
864
+ * further 100, up to 500.
865
+ */
866
+ checkRuns?: boolean;
856
867
  }): Promise<ProviderResult<PullRequestBatchResult>>;
857
868
  /**
858
869
  * Finds, for each branch, every pull request whose head is that branch — in any state (open, closed or merged),
@@ -905,7 +916,73 @@ export interface IntegrationManager {
905
916
  * Selecting it costs a rate-limit request per row (a 25-branch chunk 13 points instead of 10 without).
906
917
  */
907
918
  mergeQueue?: boolean;
919
+ /**
920
+ * GitHub and GitHub Enterprise: `true` reads each row's head check results (`checkRuns`, `checkRunsTruncated`).
921
+ * Off by default; every other provider ignores it. This read never sets `required`, since the by-name query
922
+ * can't ask for it. A head with more than 100 checks costs a request per further 100, up to 500.
923
+ */
924
+ checkRuns?: boolean;
908
925
  }): Promise<ProviderResult<PullRequestBranchResult>>;
926
+ /**
927
+ * The tail of each check's log, by the opaque `PullRequestCheckRun.id` a batch pull request read returned
928
+ * (`checkRuns: true`). GitHub and GitHub Enterprise only; every other provider refuses (`unsupported` warning +
929
+ * `fetchFailed`).
930
+ *
931
+ * Same result contract as {@link getPullRequestsBatch}, echoed under the caller's own `key`:
932
+ * - `{ key, log }` — the log's last `tailLines` lines. `source` says whether it is an Actions job's log or another
933
+ * check run's output (its title, summary and text). Raw and untrusted: an Actions log keeps its timestamps and
934
+ * `##[group]` markers.
935
+ * - `{ key, unavailable }` — the check has no log to read: `'no-log'` (a commit status, a check run without
936
+ * output, a job that never ran), `'log-not-ready'` (the job is still running), `'log-expired'` (the job finished
937
+ * and its log is gone) or `'log-too-large'` (the host would only serve the whole log, and it is over 20 MiB).
938
+ * - No item for a key, with `fetchFailed` and a warning naming it in `targetKeys` — the read could not check (auth,
939
+ * rate limit, network, an unmappable response).
940
+ *
941
+ * A duplicate key, an id no pull request read returned, an empty owner or repo, or a `tailLines` outside 1..2000
942
+ * refuses the whole call. Targets are read in chunks of 25, up to 6 at once. Request cost: a commit status costs
943
+ * nothing; a chunk's other check runs cost one GraphQL request; an Actions job costs one REST request plus two
944
+ * unauthenticated storage requests downloading at most 256 KiB (a web host streams the whole log instead), at most
945
+ * 4 at a time in a chunk.
946
+ */
947
+ getPullRequestCheckLogs(options: {
948
+ providerId: IntegrationIds;
949
+ connectionId?: string;
950
+ /** Self-managed host domain fallback; see {@link ProviderSweepTarget.domain}. */
951
+ domain?: string;
952
+ /** Each `key` must be unique — a duplicate refuses the whole call, since keys identify results. */
953
+ targets: readonly PullRequestCheckLogTarget[];
954
+ /** How many lines to keep from the end of each log: an integer from 1 to 2000. Defaults to 200. */
955
+ tailLines?: number;
956
+ }): Promise<ProviderResult<PullRequestCheckLogResult>>;
957
+ /**
958
+ * New reviews, inline review comments and conversation comments on each pull request after the target's
959
+ * `cursor`, in GitHub's timeline order. GitHub and GitHub Enterprise only; every other provider refuses
960
+ * (`unsupported` warning + `fetchFailed`).
961
+ *
962
+ * Same result contract as {@link getPullRequestsBatch}, echoed under the caller's own `key`:
963
+ * - `{ key, items, cursor, hasMore }` — the activity published after the cursor; with no cursor, the newest
964
+ * `limit` items as a baseline (`hasMore` false). Each review is followed by its inline comments. `cursor` is
965
+ * always set; send it back on the next read. `hasMore` means more items already follow; read again with
966
+ * `cursor`.
967
+ * - `{ key, notFound: true, items: [], cursor }` — the pull request or its repository does not exist or is not
968
+ * visible to this connection; `cursor` is the one sent, or `''`.
969
+ * - No item for a key, with `fetchFailed` and a warning naming it in `targetKeys` — the read could not check.
970
+ *
971
+ * Edits are not seen: an item is returned once, when it is published. Pending reviews (the viewer's own drafts)
972
+ * are skipped. A duplicate key, an empty owner or repo, a non-positive `number`, a cursor no read returned, or a
973
+ * `limit` outside 1..100 refuses the whole call. Request cost: one GraphQL request per 25 targets, up to 6 at once,
974
+ * estimated at about 1 point per pull request at the defaults.
975
+ */
976
+ getPullRequestActivity(options: {
977
+ providerId: IntegrationIds;
978
+ connectionId?: string;
979
+ /** Self-managed host domain fallback; see {@link ProviderSweepTarget.domain}. */
980
+ domain?: string;
981
+ /** Each `key` must be unique — a duplicate refuses the whole call, since keys identify results. */
982
+ targets: readonly PullRequestActivityTarget[];
983
+ /** Timeline items (reviews and conversation comments) per target: an integer from 1 to 100. Defaults to 30. */
984
+ limit?: number;
985
+ }): Promise<ProviderResult<PullRequestActivityResult>>;
909
986
  /**
910
987
  * How many pull requests match each scope — the PR twin of {@link countIssues}, behind a "this will fetch ~N pull
911
988
  * requests" preview and a live count next to an unapplied filter. Same per-scope isolation, `key`-echo, and
@@ -2,9 +2,10 @@ import { PagedResult } from "../../../utils/paging.js";
2
2
  import { ResourceDescriptor } from "../../../git/models/resourceDescriptor.js";
3
3
  import { IssueOrPullRequestState } from "../../../git/models/issueOrPullRequest.js";
4
4
  import { IssueSearchCriteria, IssueShape } from "../../../git/models/issue.js";
5
- import { PullRequest, PullRequestFilter, PullRequestMergeMethod, PullRequestMergeQueueActionResult, PullRequestMergeQueueEntry, PullRequestSearchCriteria, PullRequestShape, PullRequestStackInfo, PullRequestStackLayers, PullRequestStateFilter } from "../../../git/models/pullRequest.js";
5
+ import { PullRequest, PullRequestCheckLog, PullRequestFilter, PullRequestMergeMethod, PullRequestMergeQueueActionResult, PullRequestMergeQueueEntry, PullRequestSearchCriteria, PullRequestShape, PullRequestStackInfo, PullRequestStackLayers, PullRequestStateFilter } from "../../../git/models/pullRequest.js";
6
6
  import { Account as Account$1, UnidentifiedAuthor } from "../../../git/models/author.js";
7
7
  import { DefaultBranch } from "../../../git/models/defaultBranch.js";
8
+ import { PullRequestActivityPage } from "../../../git/models/pullRequestActivity.js";
8
9
  import { RepositoryMetadata } from "../../../git/models/repositoryMetadata.js";
9
10
  import { PullRequestUrlIdentity } from "../../../git/utils/pullRequest.utils.js";
10
11
  import { ProviderAuthenticationSession } from "../authentication/models.js";
@@ -64,6 +65,17 @@ export type RepositoryCoordinate = {
64
65
  repo: string;
65
66
  project?: string;
66
67
  };
68
+ export type PullRequestCheckLogCoordinate = {
69
+ owner: string;
70
+ repo: string;
71
+ checkRunId: string;
72
+ };
73
+ export type PullRequestActivityCoordinate = {
74
+ owner: string;
75
+ repo: string;
76
+ number: number;
77
+ cursor?: string;
78
+ };
67
79
  /**
68
80
  * Repository scopes as the host settled them ({@link GitHostIntegration.resolveRepositoryScopes}), with the `unsettled`
69
81
  * flag of each, in order. A repo-scoped read given these reads them as given rather than settling them again.
@@ -628,6 +640,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
628
640
  username?: string;
629
641
  };
630
642
  mergeQueue?: boolean;
643
+ checkRuns?: boolean;
631
644
  }, cancellation?: AbortSignal, connectionId?: string): Promise<IntegrationResult<BatchSlot<PullRequestShape | undefined>[] | undefined>>;
632
645
  /**
633
646
  * OPTIONAL: resolves several coordinates, returning one settled slot per input coordinate, in order, in the
@@ -650,7 +663,20 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
650
663
  username?: string;
651
664
  };
652
665
  mergeQueue?: boolean;
666
+ checkRuns?: boolean;
653
667
  } | undefined, cancellation?: AbortSignal): Promise<PromiseSettledResult<PullRequestShape | undefined>[] | undefined>;
668
+ getPullRequestCheckLogsResult(targets: readonly PullRequestCheckLogCoordinate[], options: {
669
+ tailLines: number;
670
+ }, cancellation?: AbortSignal, connectionId?: string): Promise<IntegrationResult<BatchSlot<PullRequestCheckLog>[] | undefined>>;
671
+ protected getProviderPullRequestCheckLogs?(session: ProviderAuthenticationSession, targets: readonly PullRequestCheckLogCoordinate[], options: {
672
+ tailLines: number;
673
+ }, cancellation?: AbortSignal): Promise<PromiseSettledResult<PullRequestCheckLog>[] | undefined>;
674
+ getPullRequestActivityResult(targets: readonly PullRequestActivityCoordinate[], options: {
675
+ limit: number;
676
+ }, cancellation?: AbortSignal, connectionId?: string): Promise<IntegrationResult<BatchSlot<PullRequestActivityPage | undefined>[] | undefined>>;
677
+ protected getProviderPullRequestActivity?(session: ProviderAuthenticationSession, targets: readonly PullRequestActivityCoordinate[], options: {
678
+ limit: number;
679
+ }, cancellation?: AbortSignal): Promise<PromiseSettledResult<PullRequestActivityPage | undefined>[] | undefined>;
654
680
  /**
655
681
  * Result-returning wrapper for the cheap check behind the batch issue read's etags: each coordinate's change
656
682
  * state ({@link IssueEtagFields}), plus the inputs of each of `options.etagIncludes`, in ONE call to
@@ -704,6 +730,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
704
730
  }[], options: {
705
731
  etagIncludes?: readonly PullRequestEtagInclude[];
706
732
  mergeQueue?: boolean;
733
+ checkRuns?: boolean;
707
734
  }, cancellation?: AbortSignal, connectionId?: string): Promise<IntegrationResult<BatchSlot<PullRequestEtagFields | undefined>[] | undefined>>;
708
735
  /**
709
736
  * OPTIONAL: the cheap check behind the batch pull request read's etags — one settled slot per input coordinate,
@@ -720,6 +747,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
720
747
  }[], options: {
721
748
  etagIncludes?: readonly PullRequestEtagInclude[];
722
749
  mergeQueue?: boolean;
750
+ checkRuns?: boolean;
723
751
  }, cancellation?: AbortSignal): Promise<PromiseSettledResult<PullRequestEtagFields | undefined>[] | undefined>;
724
752
  /**
725
753
  * Result-returning wrapper for the pull-requests-by-branch read: for each target, every pull request whose head
@@ -749,6 +777,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
749
777
  };
750
778
  limit: number;
751
779
  mergeQueue?: boolean;
780
+ checkRuns?: boolean;
752
781
  }, cancellation?: AbortSignal, connectionId?: string): Promise<IntegrationResult<BatchSlot<{
753
782
  pullRequests: PullRequestShape[];
754
783
  truncated: boolean;
@@ -778,6 +807,7 @@ export declare abstract class GitHostIntegration<ID extends IntegrationIds = Int
778
807
  };
779
808
  limit: number;
780
809
  mergeQueue?: boolean;
810
+ checkRuns?: boolean;
781
811
  }, cancellation?: AbortSignal): Promise<PromiseSettledResult<{
782
812
  pullRequests: PullRequestShape[];
783
813
  truncated: boolean;
@@ -1510,6 +1510,74 @@ var GitHostIntegration = class extends IntegrationBase {
1510
1510
  };
1511
1511
  }
1512
1512
  }
1513
+ async getPullRequestCheckLogsResult(targets, options, cancellation, connectionId) {
1514
+ const scope = getScopedLogger();
1515
+ const session = await this.resolveReadSession(connectionId, scope);
1516
+ if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
1517
+ const start = performance.now();
1518
+ let slots;
1519
+ try {
1520
+ slots = await this.getProviderPullRequestCheckLogs?.(session, targets, options, cancellation);
1521
+ if (slots == null) {
1522
+ this.resetRequestExceptionCount("getPullRequestCheckLogs", connectionId);
1523
+ return {
1524
+ value: void 0,
1525
+ duration: performance.now() - start
1526
+ };
1527
+ }
1528
+ const settled = await this.settleBatchRefusals(session, targets, slots);
1529
+ this.resetRequestExceptionCount("getPullRequestCheckLogs", connectionId);
1530
+ this.reportDeferredRequestFailures(settled, false, connectionId);
1531
+ return {
1532
+ value: settled,
1533
+ duration: performance.now() - start
1534
+ };
1535
+ } catch (ex) {
1536
+ const struck = this.handleProviderException("getPullRequestCheckLogs", ex, {
1537
+ scope,
1538
+ connectionId
1539
+ });
1540
+ this.reportDeferredRequestFailures(slots, !struck, connectionId);
1541
+ return {
1542
+ error: toError(ex),
1543
+ duration: performance.now() - start
1544
+ };
1545
+ }
1546
+ }
1547
+ async getPullRequestActivityResult(targets, options, cancellation, connectionId) {
1548
+ const scope = getScopedLogger();
1549
+ const session = await this.resolveReadSession(connectionId, scope);
1550
+ if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
1551
+ const start = performance.now();
1552
+ let slots;
1553
+ try {
1554
+ slots = await this.getProviderPullRequestActivity?.(session, targets, options, cancellation);
1555
+ if (slots == null) {
1556
+ this.resetRequestExceptionCount("getPullRequestActivity", connectionId);
1557
+ return {
1558
+ value: void 0,
1559
+ duration: performance.now() - start
1560
+ };
1561
+ }
1562
+ const settled = await this.settleBatchRefusals(session, targets, slots);
1563
+ this.resetRequestExceptionCount("getPullRequestActivity", connectionId);
1564
+ this.reportDeferredRequestFailures(settled, false, connectionId);
1565
+ return {
1566
+ value: settled,
1567
+ duration: performance.now() - start
1568
+ };
1569
+ } catch (ex) {
1570
+ const struck = this.handleProviderException("getPullRequestActivity", ex, {
1571
+ scope,
1572
+ connectionId
1573
+ });
1574
+ this.reportDeferredRequestFailures(slots, !struck, connectionId);
1575
+ return {
1576
+ error: toError(ex),
1577
+ duration: performance.now() - start
1578
+ };
1579
+ }
1580
+ }
1513
1581
  /**
1514
1582
  * Result-returning wrapper for the cheap check behind the batch issue read's etags: each coordinate's change
1515
1583
  * state ({@link IssueEtagFields}), plus the inputs of each of `options.etagIncludes`, in ONE call to