@gitkraken/core-gitlens 0.7.1 → 0.8.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 (188) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/dist/git/cache.d.ts +18 -5
  3. package/dist/git/cache.js +26 -8
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/context.d.ts +5 -1
  6. package/dist/git/context.js.map +1 -1
  7. package/dist/git/errors.d.ts +28 -1
  8. package/dist/git/errors.js +45 -1
  9. package/dist/git/errors.js.map +1 -1
  10. package/dist/git/providers/branches.d.ts +5 -1
  11. package/dist/git/providers/commits.d.ts +24 -1
  12. package/dist/git/providers/config.d.ts +7 -1
  13. package/dist/git/providers/operations.d.ts +6 -0
  14. package/dist/git/providers/provider.d.ts +17 -0
  15. package/dist/git/providers/refs.d.ts +38 -3
  16. package/dist/git/providers/revision.d.ts +5 -1
  17. package/dist/git/providers/staging.d.ts +12 -0
  18. package/dist/git/providers/worktrees.d.ts +23 -3
  19. package/dist/git/run.types.d.ts +6 -0
  20. package/dist/git-cli/cliGitProvider.d.ts +17 -1
  21. package/dist/git-cli/cliGitProvider.js +37 -1
  22. package/dist/git-cli/cliGitProvider.js.map +1 -1
  23. package/dist/git-cli/exec/git.d.ts +12 -2
  24. package/dist/git-cli/exec/git.js +48 -17
  25. package/dist/git-cli/exec/git.js.map +1 -1
  26. package/dist/git-cli/exec/gitQueue.d.ts +4 -1
  27. package/dist/git-cli/exec/gitQueue.js +1 -1
  28. package/dist/git-cli/exec/gitQueue.js.map +1 -1
  29. package/dist/git-cli/providers/branches.d.ts +10 -1
  30. package/dist/git-cli/providers/branches.js +15 -8
  31. package/dist/git-cli/providers/branches.js.map +1 -1
  32. package/dist/git-cli/providers/commits.d.ts +23 -1
  33. package/dist/git-cli/providers/commits.js +57 -8
  34. package/dist/git-cli/providers/commits.js.map +1 -1
  35. package/dist/git-cli/providers/config.js +4 -3
  36. package/dist/git-cli/providers/config.js.map +1 -1
  37. package/dist/git-cli/providers/operations.d.ts +1 -0
  38. package/dist/git-cli/providers/operations.js +39 -3
  39. package/dist/git-cli/providers/operations.js.map +1 -1
  40. package/dist/git-cli/providers/patch.js +20 -41
  41. package/dist/git-cli/providers/patch.js.map +1 -1
  42. package/dist/git-cli/providers/pausedOperations.js +2 -2
  43. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  44. package/dist/git-cli/providers/refs.d.ts +15 -3
  45. package/dist/git-cli/providers/refs.js +115 -10
  46. package/dist/git-cli/providers/refs.js.map +1 -1
  47. package/dist/git-cli/providers/revision.d.ts +3 -1
  48. package/dist/git-cli/providers/revision.js +9 -5
  49. package/dist/git-cli/providers/revision.js.map +1 -1
  50. package/dist/git-cli/providers/staging.d.ts +8 -0
  51. package/dist/git-cli/providers/staging.js +59 -7
  52. package/dist/git-cli/providers/staging.js.map +1 -1
  53. package/dist/git-cli/providers/worktrees.d.ts +31 -2
  54. package/dist/git-cli/providers/worktrees.js +75 -7
  55. package/dist/git-cli/providers/worktrees.js.map +1 -1
  56. package/dist/ipc/discovery.js +1 -1
  57. package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
  58. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
  59. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
  60. package/dist/plus/git-github/api/github.d.ts +64 -3
  61. package/dist/plus/git-github/api/github.js +237 -24
  62. package/dist/plus/git-github/api/github.js.map +1 -1
  63. package/dist/plus/git-github/providers/github/branches.d.ts +3 -1
  64. package/dist/plus/git-github/providers/github/branches.js +2 -1
  65. package/dist/plus/git-github/providers/github/branches.js.map +1 -1
  66. package/dist/plus/git-github/providers/github/refs.d.ts +10 -3
  67. package/dist/plus/git-github/providers/github/refs.js +4 -4
  68. package/dist/plus/git-github/providers/github/refs.js.map +1 -1
  69. package/dist/plus/git-github/providers/github/revision.d.ts +3 -1
  70. package/dist/plus/git-github/providers/github/revision.js +1 -1
  71. package/dist/plus/git-github/providers/github/revision.js.map +1 -1
  72. package/dist/plus/integrations/collectionMetadata.d.ts +48 -3
  73. package/dist/plus/integrations/collectionMetadata.js +138 -8
  74. package/dist/plus/integrations/collectionMetadata.js.map +1 -1
  75. package/dist/plus/integrations/errors.d.ts +3 -1
  76. package/dist/plus/integrations/errors.js +7 -3
  77. package/dist/plus/integrations/errors.js.map +1 -1
  78. package/dist/plus/integrations/index.d.ts +6 -3
  79. package/dist/plus/integrations/index.js.map +1 -1
  80. package/dist/plus/integrations/integrationService.d.ts +36 -10
  81. package/dist/plus/integrations/integrationService.js +16 -3
  82. package/dist/plus/integrations/integrationService.js.map +1 -1
  83. package/dist/plus/integrations/manager.d.ts +107 -37
  84. package/dist/plus/integrations/models/gitHostIntegration.d.ts +129 -14
  85. package/dist/plus/integrations/models/gitHostIntegration.js +142 -18
  86. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  87. package/dist/plus/integrations/models/integration.d.ts +117 -11
  88. package/dist/plus/integrations/models/integration.js +175 -13
  89. package/dist/plus/integrations/models/integration.js.map +1 -1
  90. package/dist/plus/integrations/models/issuesIntegration.d.ts +18 -5
  91. package/dist/plus/integrations/models/issuesIntegration.js +42 -10
  92. package/dist/plus/integrations/models/issuesIntegration.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 +14 -18
  95. package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
  96. package/dist/plus/integrations/providers/azure/models.d.ts +29 -0
  97. package/dist/plus/integrations/providers/azure/models.js +112 -1
  98. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  99. package/dist/plus/integrations/providers/azureDevOps.d.ts +73 -3
  100. package/dist/plus/integrations/providers/azureDevOps.js +117 -3
  101. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  102. package/dist/plus/integrations/providers/azureDevOpsServer.js +2 -1
  103. package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
  104. package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +61 -0
  105. package/dist/plus/integrations/providers/bitbucket/bitbucket.js +165 -23
  106. package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
  107. package/dist/plus/integrations/providers/bitbucket/models.d.ts +6 -1
  108. package/dist/plus/integrations/providers/bitbucket/models.js +4 -3
  109. package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
  110. package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js +2 -2
  111. package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js.map +1 -1
  112. package/dist/plus/integrations/providers/bitbucket-server.d.ts +48 -2
  113. package/dist/plus/integrations/providers/bitbucket-server.js +51 -1
  114. package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
  115. package/dist/plus/integrations/providers/bitbucket.d.ts +45 -2
  116. package/dist/plus/integrations/providers/bitbucket.js +41 -2
  117. package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
  118. package/dist/plus/integrations/providers/github.d.ts +49 -5
  119. package/dist/plus/integrations/providers/github.js +102 -7
  120. package/dist/plus/integrations/providers/github.js.map +1 -1
  121. package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +35 -0
  122. package/dist/plus/integrations/providers/gitlab/gitlab.js +132 -15
  123. package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
  124. package/dist/plus/integrations/providers/gitlab/models.d.ts +1 -0
  125. package/dist/plus/integrations/providers/gitlab/models.js +1 -1
  126. package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
  127. package/dist/plus/integrations/providers/gitlab.d.ts +49 -2
  128. package/dist/plus/integrations/providers/gitlab.js +80 -4
  129. package/dist/plus/integrations/providers/gitlab.js.map +1 -1
  130. package/dist/plus/integrations/providers/jira-server.d.ts +3 -3
  131. package/dist/plus/integrations/providers/jira-server.js +5 -8
  132. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  133. package/dist/plus/integrations/providers/jira.d.ts +9 -0
  134. package/dist/plus/integrations/providers/jira.js +13 -1
  135. package/dist/plus/integrations/providers/jira.js.map +1 -1
  136. package/dist/plus/integrations/providers/linear.js +1 -1
  137. package/dist/plus/integrations/providers/models.d.ts +13 -2
  138. package/dist/plus/integrations/providers/models.js +11 -1
  139. package/dist/plus/integrations/providers/models.js.map +1 -1
  140. package/dist/plus/integrations/providers/providerErrors.d.ts +9 -1
  141. package/dist/plus/integrations/providers/providerErrors.js +10 -1
  142. package/dist/plus/integrations/providers/providerErrors.js.map +1 -1
  143. package/dist/plus/integrations/providers/providersApi.d.ts +60 -1
  144. package/dist/plus/integrations/providers/providersApi.js +137 -2
  145. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  146. package/dist/plus/integrations/providers/utils/providerPaging.d.ts +42 -0
  147. package/dist/plus/integrations/providers/utils/providerPaging.js +58 -1
  148. package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
  149. package/dist/plus/integrations/providers/utils.d.ts +1 -1
  150. package/dist/plus/integrations/reads/broaden.js +1 -1
  151. package/dist/plus/integrations/reads/context.d.ts +1 -1
  152. package/dist/plus/integrations/reads/counts.js +1 -1
  153. package/dist/plus/integrations/reads/currentAccount.d.ts +35 -0
  154. package/dist/plus/integrations/reads/currentAccount.js +46 -0
  155. package/dist/plus/integrations/reads/currentAccount.js.map +1 -0
  156. package/dist/plus/integrations/reads/drains.d.ts +5 -2
  157. package/dist/plus/integrations/reads/drains.js +8 -4
  158. package/dist/plus/integrations/reads/drains.js.map +1 -1
  159. package/dist/plus/integrations/reads/hierarchy.js +1 -1
  160. package/dist/plus/integrations/reads/hierarchy.utils.js +1 -1
  161. package/dist/plus/integrations/reads/issueBatch.d.ts +72 -12
  162. package/dist/plus/integrations/reads/issueBatch.js +193 -48
  163. package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
  164. package/dist/plus/integrations/reads/issueTracker.js +1 -1
  165. package/dist/plus/integrations/reads/issues.js +1 -1
  166. package/dist/plus/integrations/reads/pullRequestBatch.d.ts +57 -0
  167. package/dist/plus/integrations/reads/pullRequestBatch.js +80 -0
  168. package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -0
  169. package/dist/plus/integrations/reads/pullRequestBranches.d.ts +58 -0
  170. package/dist/plus/integrations/reads/pullRequestBranches.js +111 -0
  171. package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -0
  172. package/dist/plus/integrations/reads/pullRequests.js +3 -3
  173. package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
  174. package/dist/plus/integrations/reads/resolveRepository.js +1 -1
  175. package/dist/plus/integrations/reads/sweeps.js +4 -4
  176. package/dist/plus/integrations/reads/sweeps.js.map +1 -1
  177. package/dist/plus/integrations/results.d.ts +87 -6
  178. package/dist/plus/integrations/results.js +9 -2
  179. package/dist/plus/integrations/results.js.map +1 -1
  180. package/dist/utils/env/node/exec.js +3 -3
  181. package/dist/utils/env/node/exec.js.map +1 -1
  182. package/docs/integrations.md +175 -35
  183. package/docs/kepler-git-write-api-parity.md +239 -0
  184. package/docs/kepler-read-api-parity.md +75 -28
  185. package/package.json +1 -1
  186. package/dist/plus/integrations/reads/trackerIssue.d.ts +0 -33
  187. package/dist/plus/integrations/reads/trackerIssue.js +0 -60
  188. package/dist/plus/integrations/reads/trackerIssue.js.map +0 -1
@@ -182,34 +182,81 @@ which excludes unassigned issues. A provider that declares no filtered search ke
182
182
  See the note in `reads/broaden.ts` and
183
183
  [`integrations.md` §9](./integrations.md#9-per-provider-behavior-worth-designing-around).
184
184
 
185
- **Batch issue resolution (#5802).** `getIssuesBatch` resolves N `(owner, repo, number)` coordinates in one
186
- request, for the identity question a search cannot answer: "which issue does this branch name reference".
187
- It aliases the point read rather than a search, so there is no result ceiling and no ordering — and an
188
- absent slot is a PROVEN absence rather than "not found within a page budget", which is what lets a consumer
189
- CACHE a miss. A target whose chunk failed is not returned at all, so the two stay distinguishable; caching a
190
- failure as an absence is the bug that distinction prevents. GitHub/GHE only, matching `countIssues`.
191
-
192
- **Tracker issue resolution by key (#5810).** `getTrackerIssue` is the same identity read for an issue TRACKER,
193
- which `getIssuesBatch` cannot serve: its target is `(owner, repo, number)`, and a tracker issue is addressed by
194
- `(resourceId, ABC-123)` — no owner, no repo, and an identifier that is not a number. It answers in one request
195
- where the only published tracker surface (`listIssueTrackerIssuesPage`) needs a scoped page-walk that cannot
196
- prove absence without draining the whole scope. Same absence/failure contract as the batch read, and the same
197
- reason it matters: a tracker miss is the common outcome and was never cacheable.
198
-
199
- `resourceId` is required and trusted, so the read performs no resource discovery. Jira also requires
200
- `resourceUrl`, obtained alongside the resource ID, because the issue response's `self` is an API endpoint rather
201
- than a browser link; supplying both retains the one-request contract. Linear needs only the resource ID. Jira and
202
- Linear only; Trello refuses because its single-issue read can fall back to a capped board scan for a numeric
203
- identifier, where a "not found" result cannot be distinguished from a card beyond the cap.
204
-
205
- **Jira Data Center point reads (#5872).** The same read serves a self-hosted Jira instance once it carries the host:
206
- `getTrackerIssue` takes the `domain` its paged siblings already took, and `resourceId` is the host itself (the
207
- instance's single resource; one naming another host than the read resolves to is refused). It does NOT fall back to the primary connection the way the paged reads do — a
208
- self-managed tracker requires a `domain` or a `connectionId` with a configured host and is refused otherwise —
209
- because its proven absence is cacheable and two self-hosted instances routinely issue the same keys, so an answer
210
- from whichever host is primary would be cached under a key naming a different instance. The branch-association
211
- resolver (`getIssueFromGitConfigEntityIdentifier`) follows the same rule from the other side: its resolver receives
212
- the identifier's `domain`, and a Jira Data Center identifier without one is dropped rather than resolved.
185
+ **Batch issue resolution (#5802, #5810).** `getIssuesBatch` resolves N issues by identity in one call, for the
186
+ identity question a search cannot answer: "which issue does this branch name reference". It uses the point read
187
+ rather than a search, so there is no result ceiling and no ordering — and an absent slot is a PROVEN absence
188
+ rather than "not found within a page budget", which is what lets a consumer CACHE a miss. A target that failed —
189
+ its whole request, or just that target, e.g. in an org enforcing SAML SSO the token isn't authorized for — is not
190
+ returned at all, so the two stay distinguishable; caching a failure as an absence is the bug that distinction
191
+ prevents.
192
+
193
+ A target takes the form its provider addresses an issue by. GitHub/GHE take `(owner, repo, number)` coordinates,
194
+ aliased up to 25 per request. A tracker issue is addressed by `(resourceId, ABC-123)` — no owner, no repo, and an
195
+ identifier that is not a number — so Jira (Cloud and Data Center) and Linear take
196
+ `{ key, resourceId, resourceUrl?, identifier }` targets, each answered by the single-issue read the tracker already
197
+ implements. That replaces a scoped page-walk over `listIssueTrackerIssuesPage`, which cannot prove absence without
198
+ draining the whole scope, where a miss is the common outcome. A key asked of several resources is one call with one
199
+ target per resource. `resourceId` is trusted, so the read performs no resource discovery; Jira Cloud also requires
200
+ `resourceUrl`, because the issue response's `self` is an API endpoint rather than a browser link. Trello refuses:
201
+ its single-issue read can fall back to a capped board scan for a numeric identifier, where a "not found" cannot be
202
+ told from a card beyond the cap. Bitbucket and Bitbucket DC, which have no issues, refuse too.
203
+
204
+ GitLab and Azure DevOps take the same coordinates as GitHub, plus `project` on Azure DevOps, whose work items belong to
205
+ the project rather than to a repository, so `repo` is ignored there. They cost one request per target and replace a
206
+ scoped page-walk over `listIssuesPage`, which could not prove absence either. Neither host's existing single-issue
207
+ read could, so each has a strict one. A GitLab miss costs a second request, because provider-apis reports a reply
208
+ carrying only GraphQL errors the same way as a missing issue. An Azure DevOps miss is trusted only on Azure's own
209
+ not-found body: `WorkItemUnauthorizedAccessException` (TF401232, "does not exist, or you do not have permissions to
210
+ read it", so absent means not visible to this connection) or `ProjectDoesNotExistWithNameException`. An HTML 404, a
211
+ 410 or any other failure fails the target. Rows match the repository-scoped `listIssuesPage` rows, except that an
212
+ Azure DevOps row has no `project`.
213
+
214
+ A self-hosted Jira (Data Center, #5872) is served by the same tracker targets once the call carries the host:
215
+ `getIssuesBatch` takes the `domain` its paged siblings take, and a target's `resourceId` is the host itself (the
216
+ instance's single resource; a call with any target naming another host than the read resolves to is refused whole).
217
+ It does NOT fall back to the primary connection the way the paged reads do — a self-managed tracker requires a
218
+ `domain` or a `connectionId` with a configured host and the call is refused otherwise — because its proven absence
219
+ is cacheable and two self-hosted instances routinely issue the same keys, so an answer from whichever host is
220
+ primary would be cached under a key naming a different instance. The branch-association resolver
221
+ (`getIssueFromGitConfigEntityIdentifier`) follows the same rule from the other side: its resolver receives the
222
+ identifier's `domain`, and a Jira Data Center identifier without one is dropped rather than resolved.
223
+
224
+ **Batch pull request resolution.** `getPullRequestsBatch` is the identity read for pull requests: N
225
+ `(owner, repo, number)` coordinates, plus `project` on Azure DevOps, in any state. Before it the facade had only
226
+ list, search, count and sweep reads for pull requests, so a consumer found one by scanning its repository's most
227
+ recently updated pull requests per state and matching the URL — and an older merged pull request could be neither
228
+ found nor proven gone. Same absence/failure contract as `getIssuesBatch`. It serves every git host, Bitbucket and
229
+ Bitbucket DC included: GitHub/GHE alias up to 25 point reads into one document, while GitLab, Bitbucket, Bitbucket
230
+ DC and Azure DevOps have no batch form and cost one request per target. A GitLab miss costs a second request, because
231
+ provider-apis' GitLab read reports a reply that carries only GraphQL errors the same way as a missing merge
232
+ request, so its `null` alone does not prove absence; an Azure DevOps miss is trusted only when Azure's own error
233
+ body names the pull request, repository or project as not found, not on any other 404 or a 410. Rows take the
234
+ list reads' conversion on every host but Bitbucket Cloud, which has no single pull request read in provider-apis
235
+ and so answers from GitLens' own REST read instead, missing `commentsCount`, `isDraft` and the clone URLs. On
236
+ GitLab, a miss the confirming read then contradicts fails the target rather than answering with the confirming
237
+ read's own, differently-identified row. The read is uncached and does not go through
238
+ `IntegrationCacheProvider.getPullRequest`, whose key carries no connection, so the consumer's cache is the only
239
+ one holding the answer.
240
+
241
+ **Pull requests by branch.** `getPullRequestsForBranches` answers "which pull requests have this branch as their
242
+ head, in this repository" with no relationship to the user. Before it, Kepler correlated a local branch by matching
243
+ the account-wide sweep, which holds only pull requests the user authored, is assigned or reviews — so a teammate's
244
+ pull request from the user's branch never correlated — and a cold card paid for that whole sweep before showing
245
+ anything. It matches on the head branch name in every state, so a merged pull request whose branch was deleted is
246
+ still found, and on the head repository, the base one or the `headOwner` fork, so a same-named branch in another
247
+ fork never correlates; a `headOwner` equal to the owner means the base repository, so Kepler can pass the owner of
248
+ the remote the branch was pushed to. Up to 10 per branch; an empty list without `truncated` is a proven none a
249
+ consumer can cache, and a failed target is dropped with `fetchFailed`. GitHub/GHE answer up to 25 branches per
250
+ request, and every other host costs one request per branch. GitLab and Azure DevOps resolve each match (typically
251
+ 0–1 per branch) through `getPullRequestsBatch`'s own read, so a pull request's `url`, and so its identity, is the
252
+ same whichever read found it. Bitbucket DC and Azure DevOps serve base-repository branches only and refuse a
253
+ `headOwner` naming another owner.
254
+
255
+ **Current account resolution.** `getCurrentAccount` answers who a git host connection is signed in as, on
256
+ demand. Before it, Kepler learned the viewer's account only when its `IntegrationManagerCacheProvider`
257
+ `getCurrentAccount` hook fired during some other read, so "is this pull request mine" could stay unanswered until
258
+ something else resolved the account. The read goes through that same hook, so there is still one cache. `account`
259
+ is never absent without a warning. Jira, Linear and Trello refuse: they have only a per-resource account.
213
260
 
214
261
  **Kepler-side follow-up:** `ProviderScopeFilter` carries a single `repo?: string` today and needs the criteria
215
262
  set; the `provider-data` adapter then routes "All visible" to `searchIssuesPage` + `countIssues`.
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.7.1",
4
+ "version": "0.8.0",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": {
7
7
  "name": "GitKraken",
@@ -1,33 +0,0 @@
1
- import { IssueShape } from "../../../git/models/issue.js";
2
- import { IntegrationIds } from "../constants.js";
3
- import { ProviderResult } from "../results.js";
4
- import { ProviderReadContext } from "./context.js";
5
- //#region ../plus/integrations/src/reads/trackerIssue.d.ts
6
- export interface TrackerIssueResult {
7
- key: string;
8
- /**
9
- * The resolved issue, or `undefined` when it provably does not exist or is not visible to this connection.
10
- * A failed read returns no item and sets `fetchFailed`.
11
- */
12
- issue?: IssueShape;
13
- }
14
- /**
15
- * `domain` selects the host of a self-managed tracker (Jira Data Center), as it does for
16
- * `listIssueTrackerIssuesPage`, and is ignored for the cloud trackers, which have a single canonical host.
17
- *
18
- * Unlike its siblings, this read never falls back to the primary connection for a self-managed tracker: it
19
- * requires a `domain` or a `connectionId` with a configured host and refuses otherwise. Two self-hosted
20
- * instances routinely issue the same project and issue keys, and this read's `issue: undefined` is a proven
21
- * absence a caller may cache — an answer from whichever host happens to be primary would be cached under a key
22
- * that names a different instance (#5872).
23
- */
24
- export declare function getTrackerIssue(ctx: ProviderReadContext, options: {
25
- providerId: IntegrationIds;
26
- resourceId: string;
27
- resourceUrl?: string;
28
- key: string;
29
- connectionId?: string;
30
- domain?: string;
31
- }): Promise<ProviderResult<TrackerIssueResult>>;
32
- //#endregion
33
- //# sourceMappingURL=trackerIssue.d.ts.map
@@ -1,60 +0,0 @@
1
- import "../constants.js";
2
- import { areDomainsOnSameHost, hostFromDomain } from "../utils/domain.utils.js";
3
- import { isIssuesHostIntegrationId, isIssuesSelfManagedHostIntegrationId } from "../utils/integration.utils.js";
4
- import { issueTrackerOnlySurfaceWarning, otherWarning } from "./warnings.js";
5
- import { runCaptured } from "./drains.js";
6
- import { isIssuesIntegration } from "../models/issuesIntegration.js";
7
- //#region ../plus/integrations/src/reads/trackerIssue.ts
8
- /**
9
- * `domain` selects the host of a self-managed tracker (Jira Data Center), as it does for
10
- * `listIssueTrackerIssuesPage`, and is ignored for the cloud trackers, which have a single canonical host.
11
- *
12
- * Unlike its siblings, this read never falls back to the primary connection for a self-managed tracker: it
13
- * requires a `domain` or a `connectionId` with a configured host and refuses otherwise. Two self-hosted
14
- * instances routinely issue the same project and issue keys, and this read's `issue: undefined` is a proven
15
- * absence a caller may cache — an answer from whichever host happens to be primary would be cached under a key
16
- * that names a different instance (#5872).
17
- */
18
- async function getTrackerIssue(ctx, options) {
19
- const refused = (warning) => ({
20
- items: [],
21
- warnings: [warning],
22
- fetchFailed: true
23
- });
24
- const surface = "Issue resolution by key";
25
- if (!isIssuesHostIntegrationId(options.providerId)) return refused(issueTrackerOnlySurfaceWarning(options.providerId, options.connectionId, surface));
26
- if (options.resourceId.trim().length === 0) return refused(otherWarning(options.providerId, void 0, options.connectionId, `${surface} requires a resource id.`));
27
- if (options.key.trim().length === 0) return refused(otherWarning(options.providerId, void 0, options.connectionId, `${surface} requires an issue key.`));
28
- const resourceUrl = options.resourceUrl?.trim() || void 0;
29
- if (options.providerId === "jira" && resourceUrl == null) return refused(otherWarning(options.providerId, void 0, options.connectionId, `${surface} requires the Jira resource URL so the result contains a browser link without resource discovery.`));
30
- if (isIssuesSelfManagedHostIntegrationId(options.providerId) && (options.domain != null ? hostFromDomain(options.domain) == null : options.connectionId == null || !ctx.getConfigured(options.providerId).some((c) => c.id === options.connectionId && hostFromDomain(c.domain) != null))) return refused(otherWarning(options.providerId, void 0, options.connectionId, `${surface} requires a domain or a configured connection id for '${options.providerId}': every configured host can hold a different issue under the same key, so the read does not answer from the primary connection.`));
31
- const integration = await ctx.getIntegrationForRead(options.providerId, options.connectionId, options.domain);
32
- if (integration == null) {
33
- const early = ctx.earlyReturnConnectionWarnings(options.providerId, options.connectionId, options.domain);
34
- return {
35
- items: [],
36
- warnings: early.warnings,
37
- fetchFailed: early.fetchFailed || void 0
38
- };
39
- }
40
- if (!isIssuesIntegration(integration)) return refused(issueTrackerOnlySurfaceWarning(options.providerId, options.connectionId, surface));
41
- if (!integration.supportsIssueLookupByResourceId) return refused(otherWarning(options.providerId, void 0, options.connectionId, `${surface} is not supported by '${options.providerId}'; its single-issue read cannot prove an absence, so a miss would not be safe to cache.`));
42
- if (isIssuesSelfManagedHostIntegrationId(options.providerId) && !areDomainsOnSameHost(options.resourceId, integration.domain)) return refused(otherWarning(options.providerId, void 0, options.connectionId, `${surface} requires the resource id of '${options.providerId}' to name the host the read resolved to.`));
43
- const domain = ctx.domainForRead(integration, options.providerId, options.connectionId, options.domain);
44
- const issue = await runCaptured(options.providerId, domain, options.connectionId, () => integration.getIssueByResourceIdResult(options.resourceId, options.key, {
45
- connectionId: options.connectionId,
46
- resourceUrl
47
- }), { warnOnMissingSession: true });
48
- if (issue.warning != null) return refused(issue.warning);
49
- return {
50
- items: [{
51
- key: options.key,
52
- ...issue.value != null ? { issue: issue.value } : {}
53
- }],
54
- warnings: []
55
- };
56
- }
57
- //#endregion
58
- export { getTrackerIssue };
59
-
60
- //# sourceMappingURL=trackerIssue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trackerIssue.js","names":[],"sources":["../../../../../plus/integrations/src/reads/trackerIssue.ts"],"sourcesContent":["import type { IssueShape } from '@gitlens/git/models/issue.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { IssuesCloudHostIntegrationId } from '../constants.js';\nimport { isIssuesIntegration } from '../models/issuesIntegration.js';\nimport type { ProviderResult, ProviderWarning } from '../results.js';\nimport { areDomainsOnSameHost, hostFromDomain } from '../utils/domain.utils.js';\nimport { isIssuesHostIntegrationId, isIssuesSelfManagedHostIntegrationId } from '../utils/integration.utils.js';\nimport type { ProviderReadContext } from './context.js';\nimport { runCaptured } from './drains.js';\nimport { issueTrackerOnlySurfaceWarning, otherWarning } from './warnings.js';\n\nexport interface TrackerIssueResult {\n\tkey: string;\n\t/**\n\t * The resolved issue, or `undefined` when it provably does not exist or is not visible to this connection.\n\t * A failed read returns no item and sets `fetchFailed`.\n\t */\n\tissue?: IssueShape;\n}\n\n/**\n * `domain` selects the host of a self-managed tracker (Jira Data Center), as it does for\n * `listIssueTrackerIssuesPage`, and is ignored for the cloud trackers, which have a single canonical host.\n *\n * Unlike its siblings, this read never falls back to the primary connection for a self-managed tracker: it\n * requires a `domain` or a `connectionId` with a configured host and refuses otherwise. Two self-hosted\n * instances routinely issue the same project and issue keys, and this read's `issue: undefined` is a proven\n * absence a caller may cache — an answer from whichever host happens to be primary would be cached under a key\n * that names a different instance (#5872).\n */\nexport async function getTrackerIssue(\n\tctx: ProviderReadContext,\n\toptions: {\n\t\tproviderId: IntegrationIds;\n\t\tresourceId: string;\n\t\tresourceUrl?: string;\n\t\tkey: string;\n\t\tconnectionId?: string;\n\t\tdomain?: string;\n\t},\n): Promise<ProviderResult<TrackerIssueResult>> {\n\tconst refused = (warning: ProviderWarning): ProviderResult<TrackerIssueResult> => ({\n\t\titems: [],\n\t\twarnings: [warning],\n\t\tfetchFailed: true,\n\t});\n\tconst surface = 'Issue resolution by key';\n\n\tif (!isIssuesHostIntegrationId(options.providerId)) {\n\t\treturn refused(issueTrackerOnlySurfaceWarning(options.providerId, options.connectionId, surface));\n\t}\n\n\tif (options.resourceId.trim().length === 0) {\n\t\treturn refused(\n\t\t\totherWarning(options.providerId, undefined, options.connectionId, `${surface} requires a resource id.`),\n\t\t);\n\t}\n\n\tif (options.key.trim().length === 0) {\n\t\treturn refused(\n\t\t\totherWarning(options.providerId, undefined, options.connectionId, `${surface} requires an issue key.`),\n\t\t);\n\t}\n\n\tconst resourceUrl = options.resourceUrl?.trim() || undefined;\n\tif (options.providerId === IssuesCloudHostIntegrationId.Jira && resourceUrl == null) {\n\t\treturn refused(\n\t\t\totherWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tundefined,\n\t\t\t\toptions.connectionId,\n\t\t\t\t`${surface} requires the Jira resource URL so the result contains a browser link without resource discovery.`,\n\t\t\t),\n\t\t);\n\t}\n\n\t// A `domain` only selects a host when it parses to one, and a `connectionId` only when it names a configured\n\t// connection that has one; anything else would resolve the primary host instead, which is the fallback this\n\t// read refuses.\n\tif (\n\t\tisIssuesSelfManagedHostIntegrationId(options.providerId) &&\n\t\t(options.domain != null\n\t\t\t? hostFromDomain(options.domain) == null\n\t\t\t: options.connectionId == null ||\n\t\t\t\t!ctx\n\t\t\t\t\t.getConfigured(options.providerId)\n\t\t\t\t\t.some(c => c.id === options.connectionId && hostFromDomain(c.domain) != null))\n\t) {\n\t\treturn refused(\n\t\t\totherWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tundefined,\n\t\t\t\toptions.connectionId,\n\t\t\t\t`${surface} requires a domain or a configured connection id for '${options.providerId}': every configured host can hold a different issue under the same key, so the read does not answer from the primary connection.`,\n\t\t\t),\n\t\t);\n\t}\n\n\tconst integration = await ctx.getIntegrationForRead(options.providerId, options.connectionId, options.domain);\n\tif (integration == null) {\n\t\t// A supplied connectionId or domain that no longer resolves is a broken target, not an empty account.\n\t\tconst early = ctx.earlyReturnConnectionWarnings(options.providerId, options.connectionId, options.domain);\n\t\treturn { items: [], warnings: early.warnings, fetchFailed: early.fetchFailed || undefined };\n\t}\n\tif (!isIssuesIntegration(integration)) {\n\t\treturn refused(issueTrackerOnlySurfaceWarning(options.providerId, options.connectionId, surface));\n\t}\n\tif (!integration.supportsIssueLookupByResourceId) {\n\t\treturn refused(\n\t\t\totherWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tundefined,\n\t\t\t\toptions.connectionId,\n\t\t\t\t`${surface} is not supported by '${options.providerId}'; its single-issue read cannot prove an absence, so a miss would not be safe to cache.`,\n\t\t\t),\n\t\t);\n\t}\n\n\t// A self-managed tracker's single resource is its host, and the read is keyed (and cached) by `resourceId`\n\t// while it is addressed to the host `domain`/`connectionId` resolved. When they disagree, host B's answer —\n\t// including a cacheable absence — would be stored under host A's key.\n\tif (\n\t\tisIssuesSelfManagedHostIntegrationId(options.providerId) &&\n\t\t!areDomainsOnSameHost(options.resourceId, integration.domain)\n\t) {\n\t\treturn refused(\n\t\t\totherWarning(\n\t\t\t\toptions.providerId,\n\t\t\t\tundefined,\n\t\t\t\toptions.connectionId,\n\t\t\t\t`${surface} requires the resource id of '${options.providerId}' to name the host the read resolved to.`,\n\t\t\t),\n\t\t);\n\t}\n\n\tconst domain = ctx.domainForRead(integration, options.providerId, options.connectionId, options.domain);\n\tconst issue = await runCaptured(\n\t\toptions.providerId,\n\t\tdomain,\n\t\toptions.connectionId,\n\t\t() =>\n\t\t\tintegration.getIssueByResourceIdResult(options.resourceId, options.key, {\n\t\t\t\tconnectionId: options.connectionId,\n\t\t\t\tresourceUrl: resourceUrl,\n\t\t\t}),\n\t\t{ warnOnMissingSession: true },\n\t);\n\tif (issue.warning != null) {\n\t\treturn refused(issue.warning);\n\t}\n\n\treturn {\n\t\titems: [{ key: options.key, ...(issue.value != null ? { issue: issue.value } : {}) }],\n\t\twarnings: [],\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA8BA,eAAsB,gBACrB,KACA,SAQ8C;CAC9C,MAAM,WAAW,aAAkE;EAClF,OAAO,CAAC;EACR,UAAU,CAAC,OAAO;EAClB,aAAa;CACd;CACA,MAAM,UAAU;CAEhB,IAAI,CAAC,0BAA0B,QAAQ,UAAU,GAChD,OAAO,QAAQ,+BAA+B,QAAQ,YAAY,QAAQ,cAAc,OAAO,CAAC;CAGjG,IAAI,QAAQ,WAAW,KAAK,CAAC,CAAC,WAAW,GACxC,OAAO,QACN,aAAa,QAAQ,YAAY,KAAA,GAAW,QAAQ,cAAc,GAAG,QAAQ,yBAAyB,CACvG;CAGD,IAAI,QAAQ,IAAI,KAAK,CAAC,CAAC,WAAW,GACjC,OAAO,QACN,aAAa,QAAQ,YAAY,KAAA,GAAW,QAAQ,cAAc,GAAG,QAAQ,wBAAwB,CACtG;CAGD,MAAM,cAAc,QAAQ,aAAa,KAAK,KAAK,KAAA;CACnD,IAAI,QAAQ,eAAA,UAAoD,eAAe,MAC9E,OAAO,QACN,aACC,QAAQ,YACR,KAAA,GACA,QAAQ,cACR,GAAG,QAAQ,kGACZ,CACD;CAMD,IACC,qCAAqC,QAAQ,UAAU,MACtD,QAAQ,UAAU,OAChB,eAAe,QAAQ,MAAM,KAAK,OAClC,QAAQ,gBAAgB,QACzB,CAAC,IACC,cAAc,QAAQ,UAAU,CAAC,CACjC,MAAK,MAAK,EAAE,OAAO,QAAQ,gBAAgB,eAAe,EAAE,MAAM,KAAK,IAAI,IAE/E,OAAO,QACN,aACC,QAAQ,YACR,KAAA,GACA,QAAQ,cACR,GAAG,QAAQ,wDAAwD,QAAQ,WAAW,iIACvF,CACD;CAGD,MAAM,cAAc,MAAM,IAAI,sBAAsB,QAAQ,YAAY,QAAQ,cAAc,QAAQ,MAAM;CAC5G,IAAI,eAAe,MAAM;EAExB,MAAM,QAAQ,IAAI,8BAA8B,QAAQ,YAAY,QAAQ,cAAc,QAAQ,MAAM;EACxG,OAAO;GAAE,OAAO,CAAC;GAAG,UAAU,MAAM;GAAU,aAAa,MAAM,eAAe,KAAA;EAAU;CAC3F;CACA,IAAI,CAAC,oBAAoB,WAAW,GACnC,OAAO,QAAQ,+BAA+B,QAAQ,YAAY,QAAQ,cAAc,OAAO,CAAC;CAEjG,IAAI,CAAC,YAAY,iCAChB,OAAO,QACN,aACC,QAAQ,YACR,KAAA,GACA,QAAQ,cACR,GAAG,QAAQ,wBAAwB,QAAQ,WAAW,wFACvD,CACD;CAMD,IACC,qCAAqC,QAAQ,UAAU,KACvD,CAAC,qBAAqB,QAAQ,YAAY,YAAY,MAAM,GAE5D,OAAO,QACN,aACC,QAAQ,YACR,KAAA,GACA,QAAQ,cACR,GAAG,QAAQ,gCAAgC,QAAQ,WAAW,yCAC/D,CACD;CAGD,MAAM,SAAS,IAAI,cAAc,aAAa,QAAQ,YAAY,QAAQ,cAAc,QAAQ,MAAM;CACtG,MAAM,QAAQ,MAAM,YACnB,QAAQ,YACR,QACA,QAAQ,oBAEP,YAAY,2BAA2B,QAAQ,YAAY,QAAQ,KAAK;EACvE,cAAc,QAAQ;EACT;CACd,CAAC,GACF,EAAE,sBAAsB,KAAK,CAC9B;CACA,IAAI,MAAM,WAAW,MACpB,OAAO,QAAQ,MAAM,OAAO;CAG7B,OAAO;EACN,OAAO,CAAC;GAAE,KAAK,QAAQ;GAAK,GAAI,MAAM,SAAS,OAAO,EAAE,OAAO,MAAM,MAAM,IAAI,CAAC;EAAG,CAAC;EACpF,UAAU,CAAC;CACZ;AACD"}