@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
@@ -8,8 +8,9 @@ import __decorate from "../../../_virtual/@oxc-project+runtime/helpers/esm/decor
8
8
  import { gate } from "../../../utils/decorators/gate.js";
9
9
  import "../../../git/models/pullRequest.js";
10
10
  import { toError } from "../errors.js";
11
- import { throwIfCallerContractError, toCollectionFailureError, toCollectionScopeFailure } from "../collectionMetadata.js";
12
11
  import "../constants.js";
12
+ import { isAzureProviderId } from "../providers/providerErrors.js";
13
+ import { throwIfCallerContractError, toCollectionFailureError, toCollectionScopeFailure } from "../collectionMetadata.js";
13
14
  import { toTokenWithInfo } from "../authentication/models.js";
14
15
  import "../providerFilters.js";
15
16
  import { mergeCollectionMetadata, throwIfAllSettledFailed } from "../providers/utils/providerPaging.js";
@@ -26,10 +27,7 @@ import { IntegrationBase } from "./integration.js";
26
27
  * reads here are shared by every host, so they have to ask; every other provider keeps the SDK's default.
27
28
  */
28
29
  function sendsBasicCredential(providerId, session) {
29
- return isAzureDevOpsProvider(providerId) ? session.type !== "oauth" : void 0;
30
- }
31
- function isAzureDevOpsProvider(providerId) {
32
- return providerId === "azureDevOps" || providerId === "azure-devops-server";
30
+ return isAzureProviderId(providerId) ? session.type !== "oauth" : void 0;
33
31
  }
34
32
  /**
35
33
  * Rejects a read the provider can't serve as asked: logs the reason and returns it as the `{ error }` half of an
@@ -210,6 +208,7 @@ var GitHostIntegration = class extends IntegrationBase {
210
208
  const start = performance.now();
211
209
  try {
212
210
  const result = await this.getProviderOrganizationsForUser?.(session);
211
+ await this.confirmScopedAuthFailures(session, result?.metadata);
213
212
  const authFailure = result?.metadata?.failures?.find((failure) => failure.kind === "authentication" && failure.scope != null && failure.scope.providerId === this.id && Object.keys(failure.scope).length === 1);
214
213
  if (authFailure != null) this.handleProviderException("getOrganizationsForUser", toCollectionFailureError(authFailure, toTokenWithInfo(this.id, session)), {
215
214
  scope,
@@ -246,6 +245,7 @@ var GitHostIntegration = class extends IntegrationBase {
246
245
  const start = performance.now();
247
246
  try {
248
247
  const result = await this.getProviderProjectsForOrg(session, org);
248
+ await this.confirmScopedAuthFailures(session, result?.metadata);
249
249
  this.resetRequestExceptionCount("getProjectsForOrg");
250
250
  return {
251
251
  value: result,
@@ -280,6 +280,7 @@ var GitHostIntegration = class extends IntegrationBase {
280
280
  const start = performance.now();
281
281
  try {
282
282
  const result = await this.getProviderRepositoriesForOrg?.(session, org, options);
283
+ await this.confirmScopedAuthFailures(session, result?.metadata);
283
284
  this.resetRequestExceptionCount("getRepositoriesForOrg");
284
285
  return {
285
286
  value: result,
@@ -311,6 +312,7 @@ var GitHostIntegration = class extends IntegrationBase {
311
312
  const start = performance.now();
312
313
  try {
313
314
  const result = await this.getProviderRepositoriesForUser(session, options);
315
+ await this.confirmScopedAuthFailures(session, result?.metadata);
314
316
  this.resetRequestExceptionCount("getRepositoriesForUser");
315
317
  return {
316
318
  value: result,
@@ -452,9 +454,9 @@ var GitHostIntegration = class extends IntegrationBase {
452
454
  };
453
455
  }
454
456
  const repoIdsInput = api.isRepoIdsInput(reposOrRepoIds);
455
- if (providerId !== "gitlab" && (repoIdsInput || isAzureDevOpsProvider(providerId) && !reposOrRepoIds.every((repo) => repo.project != null && repo.namespace != null))) return unsupportedRead(`Unsupported input for provider ${providerId}`, start, "getIssuesForRepos");
457
+ if (providerId !== "gitlab" && (repoIdsInput || isAzureProviderId(providerId) && !reposOrRepoIds.every((repo) => repo.project != null && repo.namespace != null))) return unsupportedRead(`Unsupported input for provider ${providerId}`, start, "getIssuesForRepos");
456
458
  let getIssuesOptions;
457
- if (isAzureDevOpsProvider(providerId)) {
459
+ if (isAzureProviderId(providerId)) {
458
460
  const organizations = /* @__PURE__ */ new Set();
459
461
  const projects = /* @__PURE__ */ new Set();
460
462
  for (const repo of reposOrRepoIds) {
@@ -546,6 +548,7 @@ var GitHostIntegration = class extends IntegrationBase {
546
548
  }
547
549
  }
548
550
  if (options?.page != null) cursor.page = options.page;
551
+ await this.confirmScopedAuthFailures(session, metadata);
549
552
  this.resetRequestExceptionCount("getIssuesForRepos");
550
553
  return {
551
554
  value: {
@@ -650,6 +653,7 @@ var GitHostIntegration = class extends IntegrationBase {
650
653
  }
651
654
  }
652
655
  if (options?.page != null) cursor.page = options.page;
656
+ await this.confirmScopedAuthFailures(session, metadata);
653
657
  this.resetRequestExceptionCount("getIssuesForRepos");
654
658
  return {
655
659
  value: {
@@ -699,6 +703,7 @@ var GitHostIntegration = class extends IntegrationBase {
699
703
  duration: performance.now() - start
700
704
  };
701
705
  }
706
+ await this.confirmScopedAuthFailures(session, result.metadata);
702
707
  this.resetRequestExceptionCount("getIssuesForRepos");
703
708
  return {
704
709
  value: result,
@@ -776,12 +781,12 @@ var GitHostIntegration = class extends IntegrationBase {
776
781
  duration: performance.now() - start
777
782
  };
778
783
  }
779
- if (providerId !== "gitlab" && (api.isRepoIdsInput(reposOrRepoIds) || isAzureDevOpsProvider(providerId) && !reposOrRepoIds.every((repo) => repo.project != null && repo.namespace != null))) return unsupportedRead(`Unsupported input for provider ${providerId}`, start);
784
+ if (providerId !== "gitlab" && (api.isRepoIdsInput(reposOrRepoIds) || isAzureProviderId(providerId) && !reposOrRepoIds.every((repo) => repo.project != null && repo.namespace != null))) return unsupportedRead(`Unsupported input for provider ${providerId}`, start);
780
785
  let getPullRequestsOptions;
781
786
  if (options?.filters != null) {
782
787
  if (!api.providerSupportsPullRequestFilters(providerId, options.filters)) return unsupportedRead(`Unsupported filters for provider ${providerId}`, start, "getPullRequestsForRepos");
783
788
  let userAccount;
784
- if (isAzureDevOpsProvider(providerId)) {
789
+ if (isAzureProviderId(providerId)) {
785
790
  const organizations = /* @__PURE__ */ new Set();
786
791
  for (const repo of reposOrRepoIds) organizations.add(repo.namespace);
787
792
  if (organizations.size > 1) {
@@ -875,7 +880,7 @@ var GitHostIntegration = class extends IntegrationBase {
875
880
  page: repoInput.cursor == null ? options?.page : void 0,
876
881
  pageSize: options?.pageSize,
877
882
  states,
878
- includeRemoteInfo: isAzureDevOpsProvider(providerId) ? true : void 0
883
+ includeRemoteInfo: isAzureProviderId(providerId) ? true : void 0
879
884
  })
880
885
  };
881
886
  }));
@@ -906,6 +911,7 @@ var GitHostIntegration = class extends IntegrationBase {
906
911
  failures
907
912
  });
908
913
  if (options?.page != null) cursor.page = options.page;
914
+ await this.confirmScopedAuthFailures(session, metadata);
909
915
  this.resetRequestExceptionCount("getPullRequestsForRepos");
910
916
  return {
911
917
  value: {
@@ -940,9 +946,10 @@ var GitHostIntegration = class extends IntegrationBase {
940
946
  page: options?.page,
941
947
  pageSize: options?.pageSize,
942
948
  states,
943
- includeRemoteInfo: isAzureDevOpsProvider(providerId) ? true : void 0,
949
+ includeRemoteInfo: isAzureProviderId(providerId) ? true : void 0,
944
950
  fields: options?.summary ? summaryPullRequestFields : void 0
945
951
  });
952
+ await this.confirmScopedAuthFailures(session, result.metadata);
946
953
  this.resetRequestExceptionCount("getPullRequestsForRepos");
947
954
  return {
948
955
  value: result,
@@ -1000,6 +1007,7 @@ var GitHostIntegration = class extends IntegrationBase {
1000
1007
  const start = performance.now();
1001
1008
  try {
1002
1009
  const result = await this.getProviderMyPullRequestsForUser(session, options);
1010
+ await this.confirmScopedAuthFailures(session, result?.metadata);
1003
1011
  this.resetRequestExceptionCount("getMyPullRequestsForUser");
1004
1012
  return {
1005
1013
  value: result,
@@ -1042,6 +1050,7 @@ var GitHostIntegration = class extends IntegrationBase {
1042
1050
  const start = performance.now();
1043
1051
  try {
1044
1052
  const result = await this.searchProviderPullRequestsPage?.(session, options, cancellation);
1053
+ await this.confirmScopedAuthFailures(session, result?.metadata);
1045
1054
  this.resetRequestExceptionCount("searchPullRequestsPage");
1046
1055
  return {
1047
1056
  value: result,
@@ -1141,8 +1150,10 @@ var GitHostIntegration = class extends IntegrationBase {
1141
1150
  }
1142
1151
  }
1143
1152
  /**
1144
- * Result-returning wrapper for the BATCH issue read: resolves several `(owner, repo, number)` coordinates in
1145
- * one request. Recovers thrown errors into `{ error }` like the reads around it.
1153
+ * Result-returning wrapper for the BATCH issue read: resolves several `(owner, repo, number)` coordinates, plus
1154
+ * `project` on Azure DevOps, in ONE call to {@link getProviderIssuesBatch}. One settled slot per input
1155
+ * coordinate: `fulfilled` with `undefined` means the issue does not exist or is not visible to this token;
1156
+ * `rejected` means that target could not be checked, never that it is absent.
1146
1157
  *
1147
1158
  * Distinct from every search on this class, and deliberately so. A search answers "what matches"; this answers
1148
1159
  * "does this exact issue exist", which is the question a caller correlating a branch name to an issue is
@@ -1151,26 +1162,139 @@ var GitHostIntegration = class extends IntegrationBase {
1151
1162
  * miss instead of re-walking for it forever.
1152
1163
  *
1153
1164
  * Results come back POSITIONALLY — one per input coordinate, in order — for the same reason
1154
- * {@link countIssuesResult} does: a caller's key must never reach the provider query. `undefined` in a slot
1155
- * means the issue does not exist or is not visible to this token, never that the read failed.
1165
+ * {@link countIssuesResult} does: a caller's key must never reach the provider query.
1166
+ *
1167
+ * Failure isolation happens PER TARGET, mirroring {@link getPullRequestsBatchResult}: the whole call counts
1168
+ * as a failure against the integration's request-exception budget only when EVERY slot rejected, and not even
1169
+ * then when a credential that checks out was refused by each target's own scope (`settleBatchRefusals`).
1170
+ * Server errors and timeouts on the targets show one notice however many hit one, and cost a strike only as
1171
+ * part of that whole-call failure (`reportDeferredRequestFailures`), so a call never spends more than one.
1156
1172
  */
1157
1173
  async getIssuesBatchResult(coordinates, cancellation, connectionId) {
1158
1174
  const scope = getScopedLogger();
1159
1175
  const session = await this.resolveReadSession(connectionId, scope);
1160
1176
  if (session == null) return void 0;
1161
1177
  const start = performance.now();
1178
+ let slots;
1162
1179
  try {
1163
- const issues = await this.getProviderIssuesBatch?.(session, coordinates, cancellation);
1180
+ slots = await this.getProviderIssuesBatch?.(session, coordinates, cancellation);
1181
+ if (slots == null) {
1182
+ this.resetRequestExceptionCount("getIssuesBatch");
1183
+ return {
1184
+ value: void 0,
1185
+ duration: performance.now() - start
1186
+ };
1187
+ }
1188
+ const settled = await this.settleBatchRefusals(session, coordinates, slots);
1164
1189
  this.resetRequestExceptionCount("getIssuesBatch");
1190
+ this.reportDeferredRequestFailures(slots, false);
1191
+ return {
1192
+ value: settled,
1193
+ duration: performance.now() - start
1194
+ };
1195
+ } catch (ex) {
1196
+ const struck = this.handleProviderException("getIssuesBatch", ex, {
1197
+ scope,
1198
+ connectionId
1199
+ });
1200
+ this.reportDeferredRequestFailures(slots, !struck);
1201
+ return {
1202
+ error: toError(ex),
1203
+ duration: performance.now() - start
1204
+ };
1205
+ }
1206
+ }
1207
+ /**
1208
+ * Result-returning wrapper for the BATCH pull request read: resolves several coordinates, in any state, BY
1209
+ * IDENTITY, in ONE call to {@link getProviderPullRequestsBatch}. One settled slot per input coordinate:
1210
+ * `fulfilled` with `undefined` means the pull request does not exist or is not visible to this token;
1211
+ * `rejected` means that target could not be checked, never that it is absent.
1212
+ *
1213
+ * Failure isolation happens PER TARGET, not per call: a hook that reads one pull request per request (every
1214
+ * host but GitHub/GHE) fans its coordinates out itself and settles each independently, so one bad target
1215
+ * rejects only its own slot. Mirrors {@link getMyPullRequestsForReposResult}'s per-repo fan-out — the whole
1216
+ * call counts as a failure against the integration's request-exception budget only when EVERY slot rejected,
1217
+ * and not even then when a credential that checks out was refused by each target's own scope
1218
+ * (`settleBatchRefusals`). Server errors and timeouts on the targets show one notice however many hit one, and
1219
+ * cost a strike only as part of that whole-call failure (`reportDeferredRequestFailures`).
1220
+ */
1221
+ async getPullRequestsBatchResult(coordinates, options, cancellation, connectionId) {
1222
+ const scope = getScopedLogger();
1223
+ const session = await this.resolveReadSession(connectionId, scope);
1224
+ if (session == null) return void 0;
1225
+ const start = performance.now();
1226
+ let slots;
1227
+ try {
1228
+ slots = await this.getProviderPullRequestsBatch?.(session, coordinates, options, cancellation);
1229
+ if (slots == null) {
1230
+ this.resetRequestExceptionCount("getPullRequestsBatch");
1231
+ return {
1232
+ value: void 0,
1233
+ duration: performance.now() - start
1234
+ };
1235
+ }
1236
+ const settled = await this.settleBatchRefusals(session, coordinates, slots);
1237
+ this.resetRequestExceptionCount("getPullRequestsBatch");
1238
+ this.reportDeferredRequestFailures(slots, false);
1239
+ return {
1240
+ value: settled,
1241
+ duration: performance.now() - start
1242
+ };
1243
+ } catch (ex) {
1244
+ const struck = this.handleProviderException("getPullRequestsBatch", ex, {
1245
+ scope,
1246
+ connectionId
1247
+ });
1248
+ this.reportDeferredRequestFailures(slots, !struck);
1249
+ return {
1250
+ error: toError(ex),
1251
+ duration: performance.now() - start
1252
+ };
1253
+ }
1254
+ }
1255
+ /**
1256
+ * Result-returning wrapper for the pull-requests-by-branch read: for each target, every pull request whose head
1257
+ * is that branch, in any state, in ONE call to {@link getProviderPullRequestsForBranches}. One settled slot
1258
+ * per target: `fulfilled` with an empty list means the host answered and nothing matched; `rejected` means
1259
+ * that target could not be checked, never that it has no pull requests.
1260
+ *
1261
+ * Uncached, and deliberately not built on {@link getPullRequestForBranch}: that read caches through
1262
+ * `IntegrationCacheProvider.getPullRequestForBranch`, answers one pull request, and on several hosts looks the
1263
+ * branch ref up, which answers "none" once a merged pull request's branch is deleted.
1264
+ *
1265
+ * Failure isolation is per target, as in {@link getPullRequestsBatchResult}: the whole call counts against the
1266
+ * request-exception budget only when EVERY slot rejected, and not when each target's own scope refused a
1267
+ * credential that checks out. Server errors and timeouts on the targets show one notice however many hit one, and
1268
+ * cost a strike only as part of that whole-call failure.
1269
+ */
1270
+ async getPullRequestsForBranchesResult(targets, options, cancellation, connectionId) {
1271
+ const scope = getScopedLogger();
1272
+ const session = await this.resolveReadSession(connectionId, scope);
1273
+ if (session == null) return void 0;
1274
+ const start = performance.now();
1275
+ let slots;
1276
+ try {
1277
+ slots = await this.getProviderPullRequestsForBranches?.(session, targets, options, cancellation);
1278
+ if (slots == null) {
1279
+ this.resetRequestExceptionCount("getPullRequestsForBranches");
1280
+ return {
1281
+ value: void 0,
1282
+ duration: performance.now() - start
1283
+ };
1284
+ }
1285
+ const settled = await this.settleBatchRefusals(session, targets, slots);
1286
+ this.resetRequestExceptionCount("getPullRequestsForBranches");
1287
+ this.reportDeferredRequestFailures(slots, false);
1165
1288
  return {
1166
- value: issues,
1289
+ value: settled,
1167
1290
  duration: performance.now() - start
1168
1291
  };
1169
1292
  } catch (ex) {
1170
- this.handleProviderException("getIssuesBatch", ex, {
1293
+ const struck = this.handleProviderException("getPullRequestsForBranches", ex, {
1171
1294
  scope,
1172
1295
  connectionId
1173
1296
  });
1297
+ this.reportDeferredRequestFailures(slots, !struck);
1174
1298
  return {
1175
1299
  error: toError(ex),
1176
1300
  duration: performance.now() - start