@gitkraken/core-gitlens 0.39.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 (82) hide show
  1. package/CHANGELOG.md +29 -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 +25 -2
  25. package/dist/plus/git-github/api/github.js +169 -37
  26. package/dist/plus/git-github/api/github.js.map +1 -1
  27. package/dist/plus/git-github/api/issueWrites.d.ts +51 -0
  28. package/dist/plus/git-github/api/issueWrites.js +192 -0
  29. package/dist/plus/git-github/api/issueWrites.js.map +1 -0
  30. package/dist/plus/git-github/api/pullRequestActivity.d.ts +19 -0
  31. package/dist/plus/git-github/api/pullRequestActivity.js +355 -0
  32. package/dist/plus/git-github/api/pullRequestActivity.js.map +1 -0
  33. package/dist/plus/git-github/models.d.ts +100 -4
  34. package/dist/plus/git-github/models.js +135 -3
  35. package/dist/plus/git-github/models.js.map +1 -1
  36. package/dist/plus/integrations/authentication/rejectedTokenTracker.d.ts +7 -8
  37. package/dist/plus/integrations/authentication/rejectedTokenTracker.js +7 -8
  38. package/dist/plus/integrations/authentication/rejectedTokenTracker.js.map +1 -1
  39. package/dist/plus/integrations/fieldPresence.d.ts +10 -5
  40. package/dist/plus/integrations/fieldPresence.js +46 -25
  41. package/dist/plus/integrations/fieldPresence.js.map +1 -1
  42. package/dist/plus/integrations/index.d.ts +6 -2
  43. package/dist/plus/integrations/index.js.map +1 -1
  44. package/dist/plus/integrations/integrationService.d.ts +31 -1
  45. package/dist/plus/integrations/integrationService.js +45 -0
  46. package/dist/plus/integrations/integrationService.js.map +1 -1
  47. package/dist/plus/integrations/manager.d.ts +86 -0
  48. package/dist/plus/integrations/models/gitHostIntegration.d.ts +31 -1
  49. package/dist/plus/integrations/models/gitHostIntegration.js +68 -0
  50. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  51. package/dist/plus/integrations/models/integration.d.ts +26 -5
  52. package/dist/plus/integrations/models/integration.js +35 -10
  53. package/dist/plus/integrations/models/integration.js.map +1 -1
  54. package/dist/plus/integrations/providers/asana.d.ts +4 -5
  55. package/dist/plus/integrations/providers/asana.js +53 -12
  56. package/dist/plus/integrations/providers/asana.js.map +1 -1
  57. package/dist/plus/integrations/providers/github.d.ts +18 -3
  58. package/dist/plus/integrations/providers/github.js +90 -5
  59. package/dist/plus/integrations/providers/github.js.map +1 -1
  60. package/dist/plus/integrations/providers/linear.js +6 -6
  61. package/dist/plus/integrations/providers/linear.js.map +1 -1
  62. package/dist/plus/integrations/providers/models.d.ts +6 -15
  63. package/dist/plus/integrations/providers/models.js +1 -1
  64. package/dist/plus/integrations/providers/models.js.map +1 -1
  65. package/dist/plus/integrations/providers/providersApi.d.ts +1 -6
  66. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  67. package/dist/plus/integrations/reads/etag.js +20 -5
  68. package/dist/plus/integrations/reads/etag.js.map +1 -1
  69. package/dist/plus/integrations/reads/pullRequestActivity.d.ts +36 -0
  70. package/dist/plus/integrations/reads/pullRequestActivity.js +103 -0
  71. package/dist/plus/integrations/reads/pullRequestActivity.js.map +1 -0
  72. package/dist/plus/integrations/reads/pullRequestBatch.d.ts +4 -1
  73. package/dist/plus/integrations/reads/pullRequestBatch.js +5 -2
  74. package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
  75. package/dist/plus/integrations/reads/pullRequestBranches.d.ts +2 -0
  76. package/dist/plus/integrations/reads/pullRequestBranches.js +2 -1
  77. package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
  78. package/dist/plus/integrations/reads/pullRequestCheckLogs.d.ts +27 -0
  79. package/dist/plus/integrations/reads/pullRequestCheckLogs.js +92 -0
  80. package/dist/plus/integrations/reads/pullRequestCheckLogs.js.map +1 -0
  81. package/docs/integrations.md +115 -5
  82. package/package.json +2 -2
@@ -4,7 +4,7 @@ import { ResourceDescriptor } from "../../../git/models/resourceDescriptor.js";
4
4
  import { AutolinkReference, DynamicAutolinkReference } from "../../../git/models/autolink.js";
5
5
  import { IssueOrPullRequest, IssueOrPullRequestState, IssueOrPullRequestType } from "../../../git/models/issueOrPullRequest.js";
6
6
  import { Issue as Issue$1, IssueShape, IssueSyncedWith } from "../../../git/models/issue.js";
7
- import { PullRequest, PullRequestMergeQueueEntry, PullRequestMergeableState, PullRequestReviewDecision, PullRequestReviewState, PullRequestStatusCheckRollupState } from "../../../git/models/pullRequest.js";
7
+ import { PullRequest, PullRequestCheckRun, PullRequestMergeQueueEntry, PullRequestMergeableState, PullRequestReviewDecision, PullRequestReviewState, PullRequestStatusCheckRollupState } from "../../../git/models/pullRequest.js";
8
8
  import { ScopedLogger } from "../../../utils/logger.scoped.js";
9
9
  import { Account as Account$1 } from "../../../git/models/author.js";
10
10
  import { ConnectionResource, ProviderAuthenticationSession, SessionPublication } from "../authentication/models.js";
@@ -103,7 +103,26 @@ export interface PullRequestEtagFields {
103
103
  * selected the data carries; a cheap check sets it from the same selection.
104
104
  */
105
105
  mergeQueueRead?: true;
106
+ /**
107
+ * The head's checks, from {@link pullRequestCheckRunsEtag}, set whenever the read selected check runs (a count of 0
108
+ * when the head has none), so it also marks such a read, as {@link mergeQueueRead} does.
109
+ */
110
+ checkRuns?: PullRequestCheckRunsEtag;
111
+ }
112
+ /** A head's checks, as a pull request's etag reads them. */
113
+ export interface PullRequestCheckRunsEtag {
114
+ /** A 64-bit hash of each check's id, kind, name, status and conclusion, in id order. */
115
+ readonly hash: string;
116
+ readonly count: number;
117
+ /** The head has checks the read lacks (the row's `checkRunsTruncated`). */
118
+ readonly truncated: boolean;
106
119
  }
120
+ /**
121
+ * {@link PullRequestEtagFields.checkRuns}, which the cheap check and the full read build alike from the same fields.
122
+ * Hashed to keep the etag short at any number of checks, so a collision is the only way a change can hide, at about
123
+ * 2^-64.
124
+ */
125
+ export declare function pullRequestCheckRunsEtag(runs: readonly Pick<PullRequestCheckRun, 'id' | 'kind' | 'name' | 'status' | 'conclusion'>[], truncated: boolean): PullRequestCheckRunsEtag;
107
126
  /**
108
127
  * The fields of a pull request {@link pullRequestRevision} reads, as a full row carries them. A `PullRequestShape`
109
128
  * is one, so a full read passes its row as is and a cheap check builds one from the same mapped values.
@@ -195,7 +214,7 @@ type BatchTarget = {
195
214
  } | {
196
215
  resourceId: string;
197
216
  };
198
- type SyncReqUsecase = Exclude<'getAccountForCommit' | 'getAccountForEmail' | 'getAccountForResource' | 'getCurrentAccount' | 'getDefaultBranch' | 'getIssue' | 'getIssueOrPullRequest' | 'getIssuesBatch' | 'getIssuesEtagFields' | 'getIssuesForProject' | 'getIssuesForRepos' | 'getMyPullRequestsForUser' | 'getOrganizationsForUser' | 'getProjectsForOrg' | 'getProjectsForResources' | 'getPullRequest' | 'getPullRequestsBatch' | 'getPullRequestsEtagFields' | 'getPullRequestsForBranches' | 'getRepositoriesForOrg' | 'getRepositoriesForUser' | 'getPullRequestForBranch' | 'getPullRequestForCommit' | 'getPullRequestsForRepos' | 'getRepositoryMetadata' | 'getResourcesForUser' | 'getSshSigningKeysForEmails' | 'countIssues' | 'countPullRequests' | 'dequeuePullRequest' | 'enqueuePullRequest' | 'mergePullRequest' | 'searchIssuesPage' | 'searchPullRequestsPage' | 'searchMyIssues' | 'searchMyPullRequests' | 'searchPullRequests', 'all'>;
217
+ type SyncReqUsecase = Exclude<'getAccountForCommit' | 'getAccountForEmail' | 'getAccountForResource' | 'getCurrentAccount' | 'getDefaultBranch' | 'getIssue' | 'getIssueOrPullRequest' | 'getIssuesBatch' | 'getIssuesEtagFields' | 'getIssuesForProject' | 'getIssuesForRepos' | 'getMyPullRequestsForUser' | 'getOrganizationsForUser' | 'getProjectsForOrg' | 'getProjectsForResources' | 'getPullRequest' | 'getPullRequestActivity' | 'getPullRequestCheckLogs' | 'getPullRequestsBatch' | 'getPullRequestsEtagFields' | 'getPullRequestsForBranches' | 'getRepositoriesForOrg' | 'getRepositoriesForUser' | 'getPullRequestForBranch' | 'getPullRequestForCommit' | 'getPullRequestsForRepos' | 'getRepositoryMetadata' | 'getResourcesForUser' | 'getSshSigningKeysForEmails' | 'countIssues' | 'countPullRequests' | 'dequeuePullRequest' | 'enqueuePullRequest' | 'mergePullRequest' | 'mutateIssue' | 'searchIssuesPage' | 'searchPullRequestsPage' | 'searchMyIssues' | 'searchMyPullRequests' | 'searchPullRequests', 'all'>;
199
218
  export declare abstract class IntegrationBase<ID extends IntegrationIds = IntegrationIds, T extends ResourceDescriptor = ResourceDescriptor> implements Disposable {
200
219
  protected readonly ctx: IntegrationServiceContext;
201
220
  protected readonly authenticationService: IntegrationAuthenticationService;
@@ -297,7 +316,7 @@ export declare abstract class IntegrationBase<ID extends IntegrationIds = Integr
297
316
  /**
298
317
  * The per-connection counterpart of the primary session's expire-and-resync recovery: a token the
299
318
  * provider refused is refreshed once through the GK cloud, which exchanges the refresh token server-side
300
- * (the client never holds one). Armed by {@link handleProviderException} and consumed by
319
+ * (the client never holds one). Armed by {@link handleConnectionAuthenticationRejection} and consumed by
301
320
  * {@link resolveReadSession}; a rejection it declines belongs to {@link trackRequestException} instead.
302
321
  */
303
322
  private readonly _rejectedTokens;
@@ -353,8 +372,8 @@ export declare abstract class IntegrationBase<ID extends IntegrationIds = Integr
353
372
  private getSecondaryConnectionId;
354
373
  private resetRecoveryAccounting;
355
374
  /**
356
- * Clears the strikes of the connection `connectionId` names (the primary when omitted) after a read of it
357
- * succeeded, or of every connection for `'all'`.
375
+ * Clears the strikes of the selected connection (the primary when omitted) after a successful request,
376
+ * or of every connection for `'all'`.
358
377
  */
359
378
  resetRequestExceptionCount(syncReqUsecase: SyncReqUsecase | 'all', connectionId?: string): void;
360
379
  /**
@@ -480,6 +499,8 @@ export declare abstract class IntegrationBase<ID extends IntegrationIds = Integr
480
499
  /** Names each scoped refusal's cause (see {@link describeRefusal}); only once the credential is proven. */
481
500
  private nameRefusalCauses;
482
501
  /** Returns whether it spent a strike (see {@link trackRequestException}). */
502
+ protected handleConnectionAuthenticationRejection(connectionId: string, silent?: boolean): boolean;
503
+ /** Returns whether it spent a strike (see {@link trackRequestException}). */
483
504
  protected handleProviderException(syncReqUsecase: SyncReqUsecase, ex: Error, options?: {
484
505
  scope?: ScopedLogger | undefined;
485
506
  silent?: boolean;
@@ -37,6 +37,25 @@ const pullRequestEtagIncludes = [
37
37
  "checks"
38
38
  ];
39
39
  /**
40
+ * {@link PullRequestEtagFields.checkRuns}, which the cheap check and the full read build alike from the same fields.
41
+ * Hashed to keep the etag short at any number of checks, so a collision is the only way a change can hide, at about
42
+ * 2^-64.
43
+ */
44
+ function pullRequestCheckRunsEtag(runs, truncated) {
45
+ const entries = runs.map((run) => [
46
+ run.id,
47
+ run.kind,
48
+ run.name,
49
+ run.status,
50
+ run.conclusion ?? null
51
+ ]).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
52
+ return {
53
+ hash: fnv1aHash64(JSON.stringify(entries)),
54
+ count: entries.length,
55
+ truncated
56
+ };
57
+ }
58
+ /**
40
59
  * {@link PullRequestEtagFields.revision}: a 64-bit hash of a pull request's title, description, target branch and
41
60
  * reviewers (each one's id and review state, in a canonical order). Hashed to keep the etag short, so a collision is
42
61
  * the only way a change can hide, at about 2^-64.
@@ -340,7 +359,7 @@ var IntegrationBase = class IntegrationBase {
340
359
  /**
341
360
  * The per-connection counterpart of the primary session's expire-and-resync recovery: a token the
342
361
  * provider refused is refreshed once through the GK cloud, which exchanges the refresh token server-side
343
- * (the client never holds one). Armed by {@link handleProviderException} and consumed by
362
+ * (the client never holds one). Armed by {@link handleConnectionAuthenticationRejection} and consumed by
344
363
  * {@link resolveReadSession}; a rejection it declines belongs to {@link trackRequestException} instead.
345
364
  */
346
365
  _rejectedTokens = new RejectedTokenTracker();
@@ -434,8 +453,8 @@ var IntegrationBase = class IntegrationBase {
434
453
  this._rejectedTokens.clear();
435
454
  }
436
455
  /**
437
- * Clears the strikes of the connection `connectionId` names (the primary when omitted) after a read of it
438
- * succeeded, or of every connection for `'all'`.
456
+ * Clears the strikes of the selected connection (the primary when omitted) after a successful request,
457
+ * or of every connection for `'all'`.
439
458
  */
440
459
  resetRequestExceptionCount(syncReqUsecase, connectionId) {
441
460
  if (syncReqUsecase === "all") {
@@ -697,16 +716,22 @@ var IntegrationBase = class IntegrationBase {
697
716
  attributeScopedAuthFailures(metadata, (refusal, scope) => describeRefusal(session, refusal, scope));
698
717
  }
699
718
  /** Returns whether it spent a strike (see {@link trackRequestException}). */
719
+ handleConnectionAuthenticationRejection(connectionId, silent) {
720
+ this._validatedCredentials.clear();
721
+ if (this._rejectedTokens.recordRejection(connectionId)) return false;
722
+ this.trackRequestException({
723
+ connectionId,
724
+ silent
725
+ });
726
+ return true;
727
+ }
728
+ /** Returns whether it spent a strike (see {@link trackRequestException}). */
700
729
  handleProviderException(syncReqUsecase, ex, options) {
701
730
  if (isCancellationError(ex)) return false;
702
- if (ex instanceof AuthenticationError) this._validatedCredentials.clear();
731
+ if (ex instanceof AuthenticationError && !options?.connectionId) this._validatedCredentials.clear();
703
732
  if (options?.scope != null) options.scope.error(ex);
704
733
  else _logger.error(ex);
705
- if (ex instanceof AuthenticationError && options?.connectionId) {
706
- if (this._rejectedTokens.recordRejection(options.connectionId)) return false;
707
- this.trackRequestException(options);
708
- return true;
709
- }
734
+ if (ex instanceof AuthenticationError && options?.connectionId) return this.handleConnectionAuthenticationRejection(options.connectionId, options.silent);
710
735
  if (ex instanceof AuthenticationError && this._session?.cloud && !this.hasSessionSyncRequests()) {
711
736
  this.requestSessionSyncForUsecase(syncReqUsecase);
712
737
  const refused = this._session.accessToken;
@@ -1108,6 +1133,6 @@ __decorate([trace()], IntegrationBase.prototype, "getLinkedIssueOrPullRequest",
1108
1133
  __decorate([trace()], IntegrationBase.prototype, "getIssueResultCore", null);
1109
1134
  __decorate([trace()], IntegrationBase.prototype, "getPullRequest", null);
1110
1135
  //#endregion
1111
- export { IntegrationBase, ReadSessionFailure, azureWorkItemDescriptionRule, azureWorkItemViewerRule, isReadSessionFailure, issueEtagIncludes, linearSyncedWithEtagKeys, pullRequestEtagIncludes, pullRequestRevision };
1136
+ export { IntegrationBase, ReadSessionFailure, azureWorkItemDescriptionRule, azureWorkItemViewerRule, isReadSessionFailure, issueEtagIncludes, linearSyncedWithEtagKeys, pullRequestCheckRunsEtag, pullRequestEtagIncludes, pullRequestRevision };
1112
1137
 
1113
1138
  //# sourceMappingURL=integration.js.map