@gitkraken/core-gitlens 0.45.0 → 0.47.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 (261) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/dist/git/models/remote.js +2 -2
  3. package/dist/git/models/remote.js.map +1 -1
  4. package/dist/git/remotes/matcher.js +25 -3
  5. package/dist/git/remotes/matcher.js.map +1 -1
  6. package/dist/git/utils/branchLanded.utils.d.ts +7 -0
  7. package/dist/git/utils/branchLanded.utils.js +10 -1
  8. package/dist/git/utils/branchLanded.utils.js.map +1 -1
  9. package/dist/git/utils/remote.utils.d.ts +1 -0
  10. package/dist/git/utils/remote.utils.js +14 -5
  11. package/dist/git/utils/remote.utils.js.map +1 -1
  12. package/dist/git-cli/parsers/logParser.js +227 -468
  13. package/dist/git-cli/parsers/logParser.js.map +1 -1
  14. package/dist/git-cli/parsers/refParser.js +4 -4
  15. package/dist/git-cli/parsers/refParser.js.map +1 -1
  16. package/dist/git-cli/providers/branches.d.ts +5 -0
  17. package/dist/git-cli/providers/branches.js +25 -21
  18. package/dist/git-cli/providers/branches.js.map +1 -1
  19. package/dist/git-cli/providers/config.js +2 -2
  20. package/dist/git-cli/providers/pausedOperations.js +2 -2
  21. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  22. package/dist/git-cli/providers/staging.js +1 -1
  23. package/dist/ipc/discovery.js +1 -1
  24. package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
  25. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
  26. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
  27. package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.d.ts +31 -0
  28. package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js +166 -0
  29. package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js.map +1 -0
  30. package/dist/plus/git-github/api/github.d.ts +13 -5
  31. package/dist/plus/git-github/api/github.js +53 -13
  32. package/dist/plus/git-github/api/github.js.map +1 -1
  33. package/dist/plus/git-github/api/issueWrites.d.ts +7 -1
  34. package/dist/plus/git-github/api/issueWrites.js +62 -32
  35. package/dist/plus/git-github/api/issueWrites.js.map +1 -1
  36. package/dist/plus/git-github/api/pullRequestWrites.d.ts +7 -3
  37. package/dist/plus/git-github/api/pullRequestWrites.js +120 -67
  38. package/dist/plus/git-github/api/pullRequestWrites.js.map +1 -1
  39. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.d.ts +44 -0
  40. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js +199 -0
  41. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js.map +1 -0
  42. package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +7 -0
  43. package/dist/plus/integrations/authentication/configuredIntegrationService.js +53 -7
  44. package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
  45. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +2 -38
  46. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +0 -199
  47. package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +4 -2
  48. package/dist/plus/integrations/authentication/integrationAuthenticationService.js +12 -1
  49. package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
  50. package/dist/plus/integrations/authentication/models.d.ts +0 -1
  51. package/dist/plus/integrations/authentication/models.js +1 -2
  52. package/dist/plus/integrations/authentication/models.js.map +1 -1
  53. package/dist/plus/integrations/constants.d.ts +0 -10
  54. package/dist/plus/integrations/constants.js +1 -95
  55. package/dist/plus/integrations/constants.js.map +1 -1
  56. package/dist/plus/integrations/context.d.ts +17 -17
  57. package/dist/plus/integrations/index.d.ts +44 -25
  58. package/dist/plus/integrations/index.js +41 -8
  59. package/dist/plus/integrations/index.js.map +1 -1
  60. package/dist/plus/integrations/integrationService.d.ts +24 -24
  61. package/dist/plus/integrations/integrationService.js +125 -34
  62. package/dist/plus/integrations/integrationService.js.map +1 -1
  63. package/dist/plus/integrations/lite.js +1 -1
  64. package/dist/plus/integrations/lite.js.map +1 -1
  65. package/dist/plus/integrations/manager.d.ts +81 -21
  66. package/dist/plus/integrations/models/actionablePullRequest.d.ts +213 -0
  67. package/dist/plus/integrations/models/actionablePullRequest.js +25 -0
  68. package/dist/plus/integrations/models/actionablePullRequest.js.map +1 -0
  69. package/dist/plus/integrations/models/gitHostIntegration.d.ts +13 -46
  70. package/dist/plus/integrations/models/gitHostIntegration.js +22 -8
  71. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  72. package/dist/plus/integrations/models/integration.d.ts +11 -175
  73. package/dist/plus/integrations/models/integration.js +22 -76
  74. package/dist/plus/integrations/models/integration.js.map +1 -1
  75. package/dist/plus/integrations/models/issueTrackerWrites.d.ts +128 -0
  76. package/dist/plus/integrations/models/issueTrackerWrites.js +0 -0
  77. package/dist/plus/integrations/models/issuesIntegration.d.ts +9 -5
  78. package/dist/plus/integrations/models/issuesIntegration.js +5 -3
  79. package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
  80. package/dist/plus/integrations/models/publicIntegration.d.ts +257 -0
  81. package/dist/plus/integrations/models/publicIntegration.js +21 -0
  82. package/dist/plus/integrations/models/publicIntegration.js.map +1 -0
  83. package/dist/plus/integrations/providerFilters.d.ts +58 -0
  84. package/dist/plus/integrations/providerFilters.js.map +1 -1
  85. package/dist/plus/integrations/providers/actionablePullRequests.d.ts +19 -0
  86. package/dist/plus/integrations/providers/actionablePullRequests.js +32 -0
  87. package/dist/plus/integrations/providers/actionablePullRequests.js.map +1 -0
  88. package/dist/plus/integrations/providers/apiClients.d.ts +1 -2
  89. package/dist/plus/integrations/providers/apiClients.js.map +1 -1
  90. package/dist/plus/integrations/providers/asana.d.ts +3 -2
  91. package/dist/plus/integrations/providers/asana.js +2 -1
  92. package/dist/plus/integrations/providers/asana.js.map +1 -1
  93. package/dist/plus/integrations/providers/azure/azure.d.ts +1 -1
  94. package/dist/plus/integrations/providers/azure/azure.js +1 -1
  95. package/dist/plus/integrations/providers/azure/azure.utils.d.ts +10 -3
  96. package/dist/plus/integrations/providers/azure/azure.utils.js +5 -1
  97. package/dist/plus/integrations/providers/azure/azure.utils.js.map +1 -1
  98. package/dist/plus/integrations/providers/azure/models.d.ts +1 -5
  99. package/dist/plus/integrations/providers/azure/models.js +1 -1
  100. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  101. package/dist/plus/integrations/providers/azureDevOps.d.ts +8 -5
  102. package/dist/plus/integrations/providers/azureDevOps.js +2 -1
  103. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  104. package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +5 -4
  105. package/dist/plus/integrations/providers/azureDevOpsServer.js +3 -1
  106. package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
  107. package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +2 -2
  108. package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
  109. package/dist/plus/integrations/providers/bitbucket/models.d.ts +1 -1
  110. package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
  111. package/dist/plus/integrations/providers/bitbucket-server.d.ts +5 -4
  112. package/dist/plus/integrations/providers/bitbucket-server.js +2 -1
  113. package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
  114. package/dist/plus/integrations/providers/bitbucket.d.ts +4 -3
  115. package/dist/plus/integrations/providers/bitbucket.js +2 -1
  116. package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
  117. package/dist/plus/integrations/providers/github/github.d.ts +0 -1
  118. package/dist/plus/integrations/providers/github/github.js +1 -1
  119. package/dist/plus/integrations/providers/github/github.js.map +1 -1
  120. package/dist/plus/integrations/providers/github.d.ts +29 -11
  121. package/dist/plus/integrations/providers/github.js +195 -78
  122. package/dist/plus/integrations/providers/github.js.map +1 -1
  123. package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +2 -2
  124. package/dist/plus/integrations/providers/gitlab/gitlab.js +1 -2
  125. package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
  126. package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts +14 -1
  127. package/dist/plus/integrations/providers/gitlab/gitlab.utils.js.map +1 -1
  128. package/dist/plus/integrations/providers/gitlab/models.d.ts +2 -10
  129. package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
  130. package/dist/plus/integrations/providers/gitlab.d.ts +7 -5
  131. package/dist/plus/integrations/providers/gitlab.js +2 -1
  132. package/dist/plus/integrations/providers/gitlab.js.map +1 -1
  133. package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
  134. package/dist/plus/integrations/providers/jira-server.d.ts +4 -4
  135. package/dist/plus/integrations/providers/jira-server.js +3 -2
  136. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  137. package/dist/plus/integrations/providers/jira.d.ts +3 -3
  138. package/dist/plus/integrations/providers/jira.js +4 -3
  139. package/dist/plus/integrations/providers/jira.js.map +1 -1
  140. package/dist/plus/integrations/providers/jiraIssueByKey.d.ts +3 -1
  141. package/dist/plus/integrations/providers/jiraIssueByKey.js +1 -1
  142. package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
  143. package/dist/plus/integrations/providers/jiraIssueWriteErrors.d.ts +10 -0
  144. package/dist/plus/integrations/providers/jiraIssueWriteErrors.js +68 -0
  145. package/dist/plus/integrations/providers/jiraIssueWriteErrors.js.map +1 -0
  146. package/dist/plus/integrations/providers/jiraIssueWrites.d.ts +40 -0
  147. package/dist/plus/integrations/providers/jiraIssueWrites.js +397 -0
  148. package/dist/plus/integrations/providers/jiraIssueWrites.js.map +1 -0
  149. package/dist/plus/integrations/providers/linear.d.ts +4 -3
  150. package/dist/plus/integrations/providers/linear.js +3 -2
  151. package/dist/plus/integrations/providers/linear.js.map +1 -1
  152. package/dist/plus/integrations/providers/linearIssuesEtag.d.ts +1 -1
  153. package/dist/plus/integrations/providers/linearIssuesEtag.js +1 -1
  154. package/dist/plus/integrations/providers/linearIssuesEtag.js.map +1 -1
  155. package/dist/plus/integrations/providers/metadata.d.ts +136 -0
  156. package/dist/plus/integrations/providers/metadata.js +513 -0
  157. package/dist/plus/integrations/providers/metadata.js.map +1 -0
  158. package/dist/plus/integrations/providers/models.d.ts +10 -206
  159. package/dist/plus/integrations/providers/models.js +8 -539
  160. package/dist/plus/integrations/providers/models.js.map +1 -1
  161. package/dist/plus/integrations/providers/providersApi.d.ts +7 -3
  162. package/dist/plus/integrations/providers/providersApi.js +23 -11
  163. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  164. package/dist/plus/integrations/providers/trello.d.ts +1 -1
  165. package/dist/plus/integrations/providers/trello.js +2 -1
  166. package/dist/plus/integrations/providers/trello.js.map +1 -1
  167. package/dist/plus/integrations/providers/utils/providerPaging.d.ts +2 -0
  168. package/dist/plus/integrations/providers/utils/providerPaging.js +3 -2
  169. package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
  170. package/dist/plus/integrations/providers/utils.d.ts +119 -10
  171. package/dist/plus/integrations/providers/utils.js +57 -3
  172. package/dist/plus/integrations/providers/utils.js.map +1 -1
  173. package/dist/plus/integrations/reads/autolinks.d.ts +1 -1
  174. package/dist/plus/integrations/reads/autolinks.js +1 -1
  175. package/dist/plus/integrations/reads/autolinks.js.map +1 -1
  176. package/dist/plus/integrations/reads/broaden.d.ts +1 -1
  177. package/dist/plus/integrations/reads/broaden.js +3 -2
  178. package/dist/plus/integrations/reads/broaden.js.map +1 -1
  179. package/dist/plus/integrations/reads/context.d.ts +1 -1
  180. package/dist/plus/integrations/reads/counts.d.ts +1 -88
  181. package/dist/plus/integrations/reads/counts.js +4 -2
  182. package/dist/plus/integrations/reads/counts.js.map +1 -1
  183. package/dist/plus/integrations/reads/currentAccount.d.ts +1 -18
  184. package/dist/plus/integrations/reads/currentAccount.js.map +1 -1
  185. package/dist/plus/integrations/reads/drains.d.ts +4 -3
  186. package/dist/plus/integrations/reads/drains.js +1 -1
  187. package/dist/plus/integrations/reads/drains.js.map +1 -1
  188. package/dist/plus/integrations/reads/etag.d.ts +174 -3
  189. package/dist/plus/integrations/reads/etag.js +69 -14
  190. package/dist/plus/integrations/reads/etag.js.map +1 -1
  191. package/dist/plus/integrations/reads/filters.d.ts +3 -61
  192. package/dist/plus/integrations/reads/filters.js +1 -1
  193. package/dist/plus/integrations/reads/filters.js.map +1 -1
  194. package/dist/plus/integrations/reads/hierarchy.d.ts +1 -1
  195. package/dist/plus/integrations/reads/hierarchy.js +4 -2
  196. package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
  197. package/dist/plus/integrations/reads/issueBatch.d.ts +2 -102
  198. package/dist/plus/integrations/reads/issueBatch.js +3 -4
  199. package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
  200. package/dist/plus/integrations/reads/issueTracker.d.ts +1 -1
  201. package/dist/plus/integrations/reads/issueTracker.js +4 -3
  202. package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
  203. package/dist/plus/integrations/reads/issues.d.ts +1 -1
  204. package/dist/plus/integrations/reads/issues.js +4 -2
  205. package/dist/plus/integrations/reads/issues.js.map +1 -1
  206. package/dist/plus/integrations/reads/paging.d.ts +1 -1
  207. package/dist/plus/integrations/reads/paging.js +1 -1
  208. package/dist/plus/integrations/reads/paging.js.map +1 -1
  209. package/dist/plus/integrations/reads/pullRequestActivity.d.ts +1 -24
  210. package/dist/plus/integrations/reads/pullRequestActivity.js +2 -1
  211. package/dist/plus/integrations/reads/pullRequestActivity.js.map +1 -1
  212. package/dist/plus/integrations/reads/pullRequestBatch.d.ts +2 -56
  213. package/dist/plus/integrations/reads/pullRequestBatch.js +23 -3
  214. package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
  215. package/dist/plus/integrations/reads/pullRequestBranches.d.ts +1 -47
  216. package/dist/plus/integrations/reads/pullRequestBranches.js +2 -1
  217. package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
  218. package/dist/plus/integrations/reads/pullRequestCheckLogs.d.ts +1 -15
  219. package/dist/plus/integrations/reads/pullRequestCheckLogs.js +2 -1
  220. package/dist/plus/integrations/reads/pullRequestCheckLogs.js.map +1 -1
  221. package/dist/plus/integrations/reads/pullRequests.js +4 -2
  222. package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
  223. package/dist/plus/integrations/reads/pullRequestsForCommits.d.ts +1 -16
  224. package/dist/plus/integrations/reads/pullRequestsForCommits.js +2 -1
  225. package/dist/plus/integrations/reads/pullRequestsForCommits.js.map +1 -1
  226. package/dist/plus/integrations/reads/resolveRepository.js +10 -5
  227. package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
  228. package/dist/plus/integrations/reads/searchIssues.js +2 -1
  229. package/dist/plus/integrations/reads/searchIssues.js.map +1 -1
  230. package/dist/plus/integrations/reads/searchPullRequests.js +2 -1
  231. package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
  232. package/dist/plus/integrations/reads/sweeps.d.ts +1 -1
  233. package/dist/plus/integrations/reads/sweeps.js +3 -2
  234. package/dist/plus/integrations/reads/sweeps.js.map +1 -1
  235. package/dist/plus/integrations/reads/warnings.d.ts +1 -1
  236. package/dist/plus/integrations/reads/warnings.js +1 -1
  237. package/dist/plus/integrations/reads/warnings.js.map +1 -1
  238. package/dist/plus/integrations/results.d.ts +324 -2
  239. package/dist/plus/integrations/results.js.map +1 -1
  240. package/dist/plus/integrations/telemetry.d.ts +0 -10
  241. package/dist/plus/integrations/telemetry.js +0 -11
  242. package/dist/plus/integrations/utils/domain.utils.d.ts +1 -0
  243. package/dist/plus/integrations/utils/domain.utils.js +10 -2
  244. package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
  245. package/dist/plus/integrations/utils/integration.utils.d.ts +2 -6
  246. package/dist/plus/integrations/utils/integration.utils.js +8 -9
  247. package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
  248. package/dist/utils/env/node/exec.js +2 -2
  249. package/dist/utils/keys/chord.d.ts +13 -2
  250. package/dist/utils/keys/chord.js +76 -17
  251. package/dist/utils/keys/chord.js.map +1 -1
  252. package/dist/utils/keys/keybinding.d.ts +12 -0
  253. package/dist/utils/keys/keybinding.js +52 -2
  254. package/dist/utils/keys/keybinding.js.map +1 -1
  255. package/dist/utils/markdown.d.ts +21 -0
  256. package/dist/utils/markdown.js +33 -1
  257. package/dist/utils/markdown.js.map +1 -1
  258. package/docs/integrations.md +174 -19
  259. package/package.json +5 -1
  260. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +0 -1
  261. package/dist/plus/integrations/telemetry.js.map +0 -1
@@ -2,42 +2,31 @@ import { Disposable } from "../../../utils/disposable.js";
2
2
  import { Emitter, Event } from "../../../utils/event.js";
3
3
  import { ResourceDescriptor } from "../../../git/models/resourceDescriptor.js";
4
4
  import { AutolinkReference, DynamicAutolinkReference } from "../../../git/models/autolink.js";
5
- import { IssueOrPullRequest, IssueOrPullRequestState, IssueOrPullRequestType } from "../../../git/models/issueOrPullRequest.js";
6
- import { Issue as Issue$1, IssueShape, IssueSyncedWith } from "../../../git/models/issue.js";
7
- import { PullRequest, PullRequestCheckRun, PullRequestMergeQueueEntry, PullRequestMergeableState, PullRequestReviewDecision, PullRequestReviewState, PullRequestStatusCheckRollupState } from "../../../git/models/pullRequest.js";
5
+ import { IssueOrPullRequest, IssueOrPullRequestType } from "../../../git/models/issueOrPullRequest.js";
6
+ import { Issue as Issue$1, IssueShape } from "../../../git/models/issue.js";
7
+ import { PullRequest } 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";
11
- import { GitCloudHostIntegrationId, IntegrationIds, IssuesCloudHostIntegrationId, IssuesHostIntegrationIds } from "../constants.js";
11
+ import { IntegrationIds, IssuesHostIntegrationIds } from "../constants.js";
12
12
  import { Sources } from "../telemetry.js";
13
+ import { IntegrationAuthenticationProviderDescriptor, IntegrationAuthenticationSessionDescriptor } from "../authentication/integrationAuthenticationProvider.js";
13
14
  import { ProviderWarningCause, ProviderWarningScope } from "../results.js";
15
+ import { IntegrationCacheDescriptor, IntegrationCredential, IntegrationKey, IntegrationResult, IntegrationType } from "./publicIntegration.js";
16
+ import { IntegrationServiceContext } from "../context.js";
14
17
  import { ProviderRefusal, ProviderScopeFailure } from "../collectionMetadata.js";
15
18
  import { ProviderPullRequestCount, ProviderPullRequestSearchPage } from "./pullRequestReads.js";
16
19
  import { ProvidersApi } from "../providers/providersApi.js";
17
20
  import { FailureBackoff } from "../utils/failureBackoff.js";
18
21
  import { AccountWideIssuesResult, ProviderIssueSearchPage, ProviderSearchCount, SearchMyIssuesOptions } from "./issueReads.js";
19
- import { GitHostIntegration } from "./gitHostIntegration.js";
20
22
  import { IssuesIntegration } from "./issuesIntegration.js";
23
+ import { GitHostIntegration } from "./gitHostIntegration.js";
21
24
  import { IntegrationConnectionChangeEvent } from "../integrationService.js";
22
25
  import { IntegrationAuthenticationService } from "../authentication/integrationAuthenticationService.js";
23
- import { IntegrationAuthenticationProviderDescriptor, IntegrationAuthenticationSessionDescriptor } from "../authentication/integrationAuthenticationProvider.js";
24
- import { IntegrationServiceContext } from "../context.js";
25
26
  import { CollectionMetadata } from "@gitkraken/provider-apis";
26
27
  //#region ../plus/integrations/src/models/integration.d.ts
27
28
  export type Integration = GitHostIntegration | IssuesIntegration;
28
29
  export type IntegrationById<T extends IntegrationIds> = T extends IssuesHostIntegrationIds ? IssuesIntegration : GitHostIntegration;
29
- export type IntegrationType = 'git' | 'issues';
30
- export type IntegrationKey<T extends IntegrationIds = IntegrationIds> = T extends GitCloudHostIntegrationId | IssuesCloudHostIntegrationId ? `${T}` : `${T}:${string}`;
31
- export type IntegrationConnectedKey<T extends IntegrationIds = IntegrationIds> = `connected:${IntegrationKey<T>}`;
32
- export type IntegrationResult<T> = {
33
- value: T;
34
- duration?: number;
35
- error?: Error;
36
- } | {
37
- error: Error;
38
- duration?: number;
39
- value?: never;
40
- } | undefined;
41
30
  /** A per-connection read's session that could not be resolved for a retryable reason (see `resolveReadSession`). */
42
31
  export declare class ReadSessionFailure {
43
32
  readonly error: Error;
@@ -51,162 +40,6 @@ export declare function isReadSessionFailure(session: ProviderAuthenticationSess
51
40
  export type BatchSlot<T> = PromiseFulfilledResult<T> | (PromiseRejectedResult & {
52
41
  failure?: ProviderScopeFailure;
53
42
  });
54
- /**
55
- * An input a pull request's etag can be widened to, each of which a host changes without moving `updatedAt`. Every
56
- * entry costs its own fields in the cheap check, so a caller picks only the ones it needs. `'checks'` is the check
57
- * rollup.
58
- */
59
- export type PullRequestEtagInclude = 'mergeable' | 'reviewDecision' | 'checks';
60
- /** Every {@link PullRequestEtagInclude}, in the canonical order an etag lists them in. */
61
- export declare const pullRequestEtagIncludes: readonly PullRequestEtagInclude[];
62
- /**
63
- * The change state a batch read's etag is computed from (see `reads/etag.ts`), in the NORMALIZED vocabulary of
64
- * `PullRequestShape` — the values a full row carries after its provider's whole conversion chain, so a cheap
65
- * check and a full read of the same pull request yield the same fields. Each of `mergeableState`, `reviewDecision`
66
- * and `statusCheckRollupState` counts only when its {@link PullRequestEtagInclude} is requested.
67
- */
68
- export interface PullRequestEtagFields {
69
- state: IssueOrPullRequestState;
70
- isDraft?: boolean;
71
- updatedDate: Date;
72
- headSha?: string;
73
- mergeableState?: PullRequestMergeableState;
74
- reviewDecision?: PullRequestReviewDecision;
75
- statusCheckRollupState?: PullRequestStatusCheckRollupState;
76
- /**
77
- * A fingerprint of the fields a host changes without moving an update time ({@link pullRequestRevision}); set
78
- * only for hosts that keep none (Azure DevOps and Server). Part of the etag whenever it is set, not an include.
79
- */
80
- revision?: string;
81
- /**
82
- * A full row marked `viewerUnresolved`, which no cheap check ever sets: such a row never compares unchanged, so it
83
- * is read in full again rather than kept without a viewer until the pull request changes.
84
- */
85
- viewerUnresolved?: true;
86
- /**
87
- * The pull request's merge-queue entry, as far as the etag reads it: whether it's queued, in which state and since
88
- * when, none of which moves `updatedDate`. Part of the etag whenever it is set, not an include, and set only on a
89
- * queued pull request, so every other pull request's etag is unchanged by it. Read only where the queue is
90
- * (github.com).
91
- */
92
- mergeQueue?: Pick<PullRequestMergeQueueEntry, 'state' | 'enqueuedAt'>;
93
- /**
94
- * When the pull request's `mergeQueueRemoval` happened, set only while it has one. Like `mergeQueue`, part of the
95
- * etag whenever it is set, not an include: a pull request that joins its queue and is removed between two checks
96
- * moves neither its update time nor, at either check, `mergeQueue`.
97
- */
98
- mergeQueueRemovedAt?: Date;
99
- /**
100
- * The read selected merge-queue data (GitHub.com, for a read that asks for it or a host that opts in), whatever
101
- * that data says. Part of the etag whenever it is set, as a marker: without it a pull request that isn't queued and
102
- * has no removal computes the etag it has without the data, so a host that starts asking for the data would keep a
103
- * held row lacking it as `unchanged`. A full row sets it from its `mergeQueueRequired`, which only a read that
104
- * selected the data carries; a cheap check sets it from the same selection.
105
- */
106
- mergeQueueRead?: true;
107
- /**
108
- * The head's checks, from {@link pullRequestCheckRunsEtag}, set whenever the read selected check runs (a count of 0
109
- * when the head has none), so it also marks such a read, as {@link mergeQueueRead} does.
110
- */
111
- checkRuns?: PullRequestCheckRunsEtag;
112
- }
113
- /** A head's checks, as a pull request's etag reads them. */
114
- export interface PullRequestCheckRunsEtag {
115
- /** A 64-bit hash of each check's id, kind, name, status and conclusion, in id order. */
116
- readonly hash: string;
117
- readonly count: number;
118
- /** The head has checks the read lacks (the row's `checkRunsTruncated`). */
119
- readonly truncated: boolean;
120
- }
121
- /**
122
- * {@link PullRequestEtagFields.checkRuns}, which the cheap check and the full read build alike from the same fields.
123
- * Hashed to keep the etag short at any number of checks, so a collision is the only way a change can hide, at about
124
- * 2^-64.
125
- */
126
- export declare function pullRequestCheckRunsEtag(runs: readonly Pick<PullRequestCheckRun, 'id' | 'kind' | 'name' | 'status' | 'conclusion'>[], truncated: boolean): PullRequestCheckRunsEtag;
127
- /**
128
- * The fields of a pull request {@link pullRequestRevision} reads, as a full row carries them. A `PullRequestShape`
129
- * is one, so a full read passes its row as is and a cheap check builds one from the same mapped values.
130
- */
131
- export interface PullRequestRevisionSource {
132
- readonly title: string;
133
- readonly body?: string;
134
- readonly refs?: {
135
- readonly base: {
136
- readonly branch: string;
137
- };
138
- };
139
- readonly reviewRequests?: readonly PullRequestRevisionReviewer[];
140
- readonly latestReviews?: readonly PullRequestRevisionReviewer[];
141
- }
142
- interface PullRequestRevisionReviewer {
143
- readonly reviewer: {
144
- readonly id: string;
145
- };
146
- readonly state: PullRequestReviewState;
147
- }
148
- /**
149
- * {@link PullRequestEtagFields.revision}: a 64-bit hash of a pull request's title, description, target branch and
150
- * reviewers (each one's id and review state, in a canonical order). Hashed to keep the etag short, so a collision is
151
- * the only way a change can hide, at about 2^-64.
152
- */
153
- export declare function pullRequestRevision(pr: PullRequestRevisionSource): string;
154
- /**
155
- * An input an issue's etag can be widened to, which a host changes without moving `updatedAt`. `'reactions'` is the
156
- * thumbs-up count, and widens the etag only on hosts whose rows really fetch one (GitHub/GHE and GitLab).
157
- */
158
- export type IssueEtagInclude = 'reactions';
159
- /** Every {@link IssueEtagInclude}, in the canonical order an etag lists them in. */
160
- export declare const issueEtagIncludes: readonly IssueEtagInclude[];
161
- /** The issue twin of {@link PullRequestEtagFields}, in {@link IssueShape}'s normalized vocabulary. */
162
- export interface IssueEtagFields {
163
- state: IssueOrPullRequestState | undefined;
164
- updatedDate: Date;
165
- /** Counts only when `'reactions'` is requested, and only from a row whose read fetched reactions. */
166
- thumbsUpCount?: number;
167
- /**
168
- * Azure DevOps only: the version of the rule a work item's body is read by ({@link azureWorkItemDescriptionRule}).
169
- * A change of rule changes the body without moving `updatedDate`, so a row read under an earlier one must not
170
- * compare unchanged.
171
- */
172
- descriptionRule?: number;
173
- /**
174
- * Azure DevOps only: the version of the rule a work item's `viewer` is set by ({@link azureWorkItemViewerRule}).
175
- * A full row that names someone but got no viewer (its organization's identity couldn't be read) leaves it out, so
176
- * it never compares unchanged and is read in full again rather than kept without one.
177
- */
178
- viewerRule?: number;
179
- /**
180
- * Linear only: the row's `syncedWith` links as {@link linearSyncedWithEtagKeys} spells them, so a link added, removed
181
- * or moved to other coordinates changes the etag whether or not the issue's update time moves. `null` on a
182
- * full row without `syncedWith` (held from before it existed, or read while Linear failed to resolve it), which
183
- * never compares unchanged with a cheap check's list.
184
- */
185
- syncedWithKeys?: readonly string[] | null;
186
- }
187
- /**
188
- * {@link IssueEtagFields.descriptionRule}: the version of the rule an Azure DevOps work item's body is read by, stamped
189
- * on both sides of its etag. Bumped whenever the rule changes which field a work item's body comes from, so every row
190
- * a caller holds from before is read in full once. 1: the first rich text field with content (provider-apis'
191
- * `getAzureWorkItemDescription`), where it used to be only Description. The rule lives in provider-apis, so a bump of
192
- * that package that changes it must bump this too; the etag tests pin the rule to catch one.
193
- *
194
- * It can't cover a row whose read found the organization's field catalog unavailable: that row's body falls back to
195
- * the built-in fields, and a cheap check, which reads no body, can't tell it from a complete one, so it stays as read
196
- * until the work item changes.
197
- */
198
- export declare const azureWorkItemDescriptionRule = 1;
199
- /**
200
- * {@link IssueEtagFields.viewerRule}: the version of the rule an Azure DevOps work item's `viewer` is set by, stamped
201
- * on both sides of its etag, so every row a caller holds from before it was set is read in full once. 1: the user's
202
- * identity in the work item's organization (gitkraken/kepler#4291).
203
- */
204
- export declare const azureWorkItemViewerRule = 1;
205
- /**
206
- * A Linear row's sync links in its etag, sorted: each as its GitHub id and, when known, the coordinates a host matches
207
- * the GitHub row by, so a link whose coordinates Linear fills in or changes later compares changed.
208
- */
209
- export declare function linearSyncedWithEtagKeys(links: readonly IssueSyncedWith[]): string[];
210
43
  /** A batch read's target, in the form its provider addresses it by: a repository coordinate, or a tracker's resource. */
211
44
  type BatchTarget = {
212
45
  owner: string;
@@ -250,6 +83,7 @@ export declare abstract class IntegrationBase<ID extends IntegrationIds = Integr
250
83
  private _sessionFingerprint;
251
84
  get sessionFingerprint(): string | undefined;
252
85
  protected getSessionFingerprint(session: ProviderAuthenticationSession): string;
86
+ protected getPullRequestCacheDescriptor(_session: ProviderAuthenticationSession): IntegrationCacheDescriptor;
253
87
  get connectionExpired(): boolean | undefined;
254
88
  protected _session: ProviderAuthenticationSession | null | undefined;
255
89
  /**
@@ -266,6 +100,8 @@ export declare abstract class IntegrationBase<ID extends IntegrationIds = Integr
266
100
  protected runSessionTransition<T>(fn: () => Promise<T>): Promise<T>;
267
101
  /** An expired session is refreshed first; when that fails, nothing is returned rather than a token the provider refuses. */
268
102
  getSession(source: Sources): ProviderAuthenticationSession | Promise<ProviderAuthenticationSession | undefined> | undefined;
103
+ /** {@link getSession}'s token, for a consumer of the public view, which never sees the session itself. */
104
+ getCredential(source: Sources): Promise<IntegrationCredential | undefined>;
269
105
  private getRefreshedSession;
270
106
  private isSessionForIntegrationHost;
271
107
  /**
@@ -13,8 +13,8 @@ import "../constants.js";
13
13
  import { isAzureProviderId } from "../providers/providerErrors.js";
14
14
  import { attributeScopedAuthFailures, hasOnlyScopedAuthFailures, markCredentialRefusals, toCollectionScopeFailure } from "../collectionMetadata.js";
15
15
  import { throwIfAllSettledFailed } from "../providers/utils/providerPaging.js";
16
+ import { providersMetadata } from "../providers/metadata.js";
16
17
  import { areDomainsOnSameHost } from "../utils/domain.utils.js";
17
- import { providersMetadata } from "../providers/models.js";
18
18
  import { isSelfManagedHostIntegrationId } from "../utils/integration.utils.js";
19
19
  import { getSessionIdentity } from "../authentication/models.js";
20
20
  import { RejectedTokenTracker } from "../authentication/rejectedTokenTracker.js";
@@ -31,76 +31,6 @@ var ReadSessionFailure = class {
31
31
  function isReadSessionFailure(session) {
32
32
  return session instanceof ReadSessionFailure;
33
33
  }
34
- /** Every {@link PullRequestEtagInclude}, in the canonical order an etag lists them in. */
35
- const pullRequestEtagIncludes = [
36
- "mergeable",
37
- "reviewDecision",
38
- "checks"
39
- ];
40
- /**
41
- * {@link PullRequestEtagFields.checkRuns}, which the cheap check and the full read build alike from the same fields.
42
- * Hashed to keep the etag short at any number of checks, so a collision is the only way a change can hide, at about
43
- * 2^-64.
44
- */
45
- function pullRequestCheckRunsEtag(runs, truncated) {
46
- const entries = runs.map((run) => [
47
- run.id,
48
- run.kind,
49
- run.name,
50
- run.status,
51
- run.conclusion ?? null
52
- ]).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
53
- return {
54
- hash: fnv1aHash64(JSON.stringify(entries)),
55
- count: entries.length,
56
- truncated
57
- };
58
- }
59
- /**
60
- * {@link PullRequestEtagFields.revision}: a 64-bit hash of a pull request's title, description, target branch and
61
- * reviewers (each one's id and review state, in a canonical order). Hashed to keep the etag short, so a collision is
62
- * the only way a change can hide, at about 2^-64.
63
- */
64
- function pullRequestRevision(pr) {
65
- return fnv1aHash64(JSON.stringify([
66
- pr.title,
67
- pr.body ?? null,
68
- pr.refs?.base.branch ?? null,
69
- toRevisionReviewers(pr.reviewRequests),
70
- toRevisionReviewers(pr.latestReviews)
71
- ]));
72
- }
73
- /** Each reviewer as its serialized `[id, state]`, sorted, so the host's order never moves the revision. */
74
- function toRevisionReviewers(reviewers) {
75
- return reviewers?.map((r) => JSON.stringify([r.reviewer.id, r.state])).sort() ?? null;
76
- }
77
- /** Every {@link IssueEtagInclude}, in the canonical order an etag lists them in. */
78
- const issueEtagIncludes = ["reactions"];
79
- /**
80
- * {@link IssueEtagFields.descriptionRule}: the version of the rule an Azure DevOps work item's body is read by, stamped
81
- * on both sides of its etag. Bumped whenever the rule changes which field a work item's body comes from, so every row
82
- * a caller holds from before is read in full once. 1: the first rich text field with content (provider-apis'
83
- * `getAzureWorkItemDescription`), where it used to be only Description. The rule lives in provider-apis, so a bump of
84
- * that package that changes it must bump this too; the etag tests pin the rule to catch one.
85
- *
86
- * It can't cover a row whose read found the organization's field catalog unavailable: that row's body falls back to
87
- * the built-in fields, and a cheap check, which reads no body, can't tell it from a complete one, so it stays as read
88
- * until the work item changes.
89
- */
90
- const azureWorkItemDescriptionRule = 1;
91
- /**
92
- * {@link IssueEtagFields.viewerRule}: the version of the rule an Azure DevOps work item's `viewer` is set by, stamped
93
- * on both sides of its etag, so every row a caller holds from before it was set is read in full once. 1: the user's
94
- * identity in the work item's organization (gitkraken/kepler#4291).
95
- */
96
- const azureWorkItemViewerRule = 1;
97
- /**
98
- * A Linear row's sync links in its etag, sorted: each as its GitHub id and, when known, the coordinates a host matches
99
- * the GitHub row by, so a link whose coordinates Linear fills in or changes later compares changed.
100
- */
101
- function linearSyncedWithEtagKeys(links) {
102
- return links.map((link) => link.owner != null ? `${link.id}:${link.owner}/${link.repo}#${link.number}` : `${link.id}:`).sort();
103
- }
104
34
  function batchTargetRepository(target) {
105
35
  if ("resourceId" in target) return void 0;
106
36
  return [
@@ -199,6 +129,9 @@ var IntegrationBase = class IntegrationBase {
199
129
  getSessionFingerprint(session) {
200
130
  return fnv1aHash64(session.accessToken);
201
131
  }
132
+ getPullRequestCacheDescriptor(_session) {
133
+ return this;
134
+ }
202
135
  get connectionExpired() {
203
136
  if (this._session?.expiresAt == null) return void 0;
204
137
  return new Date(this._session.expiresAt) < /* @__PURE__ */ new Date();
@@ -230,6 +163,15 @@ var IntegrationBase = class IntegrationBase {
230
163
  if (this.connectionExpired) return this.getRefreshedSession();
231
164
  return this._session;
232
165
  }
166
+ /** {@link getSession}'s token, for a consumer of the public view, which never sees the session itself. */
167
+ async getCredential(source) {
168
+ const session = await this.getSession(source);
169
+ if (session == null) return void 0;
170
+ return {
171
+ providerId: this.authProvider.id,
172
+ accessToken: session.accessToken
173
+ };
174
+ }
233
175
  async getRefreshedSession() {
234
176
  if (await this.refreshSessionIfExpired() != null) return void 0;
235
177
  return this._session != null && this.connectionExpired !== true && this.isSessionForIntegrationHost(this._session) ? this._session : void 0;
@@ -1038,10 +980,12 @@ var IntegrationBase = class IntegrationBase {
1038
980
  async getLinkedIssueOrPullRequest(resource, link, options) {
1039
981
  const scope = getScopedLogger();
1040
982
  if (await this.prepareSessionLookup() != null) return void 0;
983
+ const session = this._session;
984
+ if (session == null) return void 0;
1041
985
  const { throwOnError, ...cacheOptions } = options ?? {};
1042
- return this.ctx.cache.getIssueOrPullRequest(link.key, options?.type, resource, this, (cacheable) => ({ value: (async () => {
986
+ return this.ctx.cache.getIssueOrPullRequest(link.key, options?.type, resource, this.getPullRequestCacheDescriptor(session), (cacheable) => ({ value: (async () => {
1043
987
  try {
1044
- const result = await this.getProviderLinkedIssueOrPullRequest(this._session, resource, link, options?.type);
988
+ const result = await this.getProviderLinkedIssueOrPullRequest(session, resource, link, options?.type);
1045
989
  this.resetRequestExceptionCount("getIssueOrPullRequest");
1046
990
  return result;
1047
991
  } catch (ex) {
@@ -1151,9 +1095,11 @@ var IntegrationBase = class IntegrationBase {
1151
1095
  if (options?.throwOnError) throw refreshFailure;
1152
1096
  return;
1153
1097
  }
1154
- return await this.ctx.cache.getPullRequest(id, resource, this, (cacheable) => ({ value: (async () => {
1098
+ const session = this._session;
1099
+ if (session == null) return void 0;
1100
+ return await this.ctx.cache.getPullRequest(id, resource, this.getPullRequestCacheDescriptor(session), (cacheable) => ({ value: (async () => {
1155
1101
  try {
1156
- const result = await this.getProviderPullRequest?.(this._session, resource, id);
1102
+ const result = await this.getProviderPullRequest?.(session, resource, id);
1157
1103
  this.resetRequestExceptionCount("getPullRequest");
1158
1104
  return result;
1159
1105
  } catch (ex) {
@@ -1178,6 +1124,6 @@ __decorate([trace()], IntegrationBase.prototype, "getLinkedIssueOrPullRequest",
1178
1124
  __decorate([trace()], IntegrationBase.prototype, "getIssueResultCore", null);
1179
1125
  __decorate([trace()], IntegrationBase.prototype, "getPullRequest", null);
1180
1126
  //#endregion
1181
- export { IntegrationBase, ReadSessionFailure, azureWorkItemDescriptionRule, azureWorkItemViewerRule, isReadSessionFailure, issueEtagIncludes, linearSyncedWithEtagKeys, pullRequestCheckRunsEtag, pullRequestEtagIncludes, pullRequestRevision };
1127
+ export { IntegrationBase, ReadSessionFailure, isReadSessionFailure };
1182
1128
 
1183
1129
  //# sourceMappingURL=integration.js.map