@gitkraken/core-gitlens 0.41.0 → 0.44.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 (106) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/dist/git/errors.d.ts +1 -0
  3. package/dist/git/errors.js +7 -1
  4. package/dist/git/errors.js.map +1 -1
  5. package/dist/git/models/issue.d.ts +2 -0
  6. package/dist/git/models/issue.js.map +1 -1
  7. package/dist/git/models/issueOrPullRequest.d.ts +4 -0
  8. package/dist/git/models/pullRequest.d.ts +2 -0
  9. package/dist/git/models/pullRequest.js.map +1 -1
  10. package/dist/git-cli/providers/config.js +2 -2
  11. package/dist/git-cli/providers/pausedOperations.js +2 -2
  12. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  13. package/dist/git-cli/providers/staging.js +1 -1
  14. package/dist/ipc/discovery.js +1 -1
  15. package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
  16. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
  17. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
  18. package/dist/plus/git-github/api/aliasedQuery.d.ts +3 -2
  19. package/dist/plus/git-github/api/aliasedQuery.js +7 -3
  20. package/dist/plus/git-github/api/aliasedQuery.js.map +1 -1
  21. package/dist/plus/git-github/api/github.d.ts +7 -4
  22. package/dist/plus/git-github/api/github.js +112 -14
  23. package/dist/plus/git-github/api/github.js.map +1 -1
  24. package/dist/plus/git-github/api/issueWrites.d.ts +5 -1
  25. package/dist/plus/git-github/api/issueWrites.js +15 -5
  26. package/dist/plus/git-github/api/issueWrites.js.map +1 -1
  27. package/dist/plus/git-github/models.js +7 -3
  28. package/dist/plus/git-github/models.js.map +1 -1
  29. package/dist/plus/integrations/collectionMetadata.js +2 -1
  30. package/dist/plus/integrations/collectionMetadata.js.map +1 -1
  31. package/dist/plus/integrations/context.d.ts +3 -3
  32. package/dist/plus/integrations/errors.d.ts +4 -0
  33. package/dist/plus/integrations/errors.js +8 -1
  34. package/dist/plus/integrations/errors.js.map +1 -1
  35. package/dist/plus/integrations/index.d.ts +3 -2
  36. package/dist/plus/integrations/index.js.map +1 -1
  37. package/dist/plus/integrations/integrationService.d.ts +18 -1
  38. package/dist/plus/integrations/integrationService.js +19 -0
  39. package/dist/plus/integrations/integrationService.js.map +1 -1
  40. package/dist/plus/integrations/lite.js +11 -1
  41. package/dist/plus/integrations/lite.js.map +1 -1
  42. package/dist/plus/integrations/manager.d.ts +93 -0
  43. package/dist/plus/integrations/models/gitHostIntegration.d.ts +21 -2
  44. package/dist/plus/integrations/models/gitHostIntegration.js +182 -14
  45. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  46. package/dist/plus/integrations/models/integration.d.ts +9 -1
  47. package/dist/plus/integrations/models/integration.js +43 -3
  48. package/dist/plus/integrations/models/integration.js.map +1 -1
  49. package/dist/plus/integrations/providers/apiClients.d.ts +1 -0
  50. package/dist/plus/integrations/providers/apiClients.js +3 -0
  51. package/dist/plus/integrations/providers/apiClients.js.map +1 -1
  52. package/dist/plus/integrations/providers/azure/azure.d.ts +3 -0
  53. package/dist/plus/integrations/providers/azure/azure.js +130 -33
  54. package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
  55. package/dist/plus/integrations/providers/azure/models.js +7 -3
  56. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  57. package/dist/plus/integrations/providers/azureDevOps.d.ts +12 -0
  58. package/dist/plus/integrations/providers/azureDevOps.js +22 -0
  59. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  60. package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +21 -2
  61. package/dist/plus/integrations/providers/bitbucket/bitbucket.js +77 -32
  62. package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
  63. package/dist/plus/integrations/providers/bitbucket/models.js +5 -2
  64. package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
  65. package/dist/plus/integrations/providers/bitbucket-server/models.js +3 -1
  66. package/dist/plus/integrations/providers/bitbucket-server/models.js.map +1 -1
  67. package/dist/plus/integrations/providers/bitbucket-server.d.ts +2 -0
  68. package/dist/plus/integrations/providers/bitbucket-server.js +11 -3
  69. package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
  70. package/dist/plus/integrations/providers/bitbucket.d.ts +14 -0
  71. package/dist/plus/integrations/providers/bitbucket.js +30 -2
  72. package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
  73. package/dist/plus/integrations/providers/github.d.ts +9 -4
  74. package/dist/plus/integrations/providers/github.js +12 -1
  75. package/dist/plus/integrations/providers/github.js.map +1 -1
  76. package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +19 -1
  77. package/dist/plus/integrations/providers/gitlab/gitlab.js +128 -23
  78. package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
  79. package/dist/plus/integrations/providers/gitlab/models.js +5 -2
  80. package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
  81. package/dist/plus/integrations/providers/gitlab.d.ts +15 -2
  82. package/dist/plus/integrations/providers/gitlab.js +34 -4
  83. package/dist/plus/integrations/providers/gitlab.js.map +1 -1
  84. package/dist/plus/integrations/providers/jiraIssueByKey.js +3 -1
  85. package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
  86. package/dist/plus/integrations/providers/models.js +9 -4
  87. package/dist/plus/integrations/providers/models.js.map +1 -1
  88. package/dist/plus/integrations/providers/providerApiClient.js +10 -7
  89. package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
  90. package/dist/plus/integrations/providers/providerErrors.d.ts +8 -0
  91. package/dist/plus/integrations/providers/providerErrors.js +15 -2
  92. package/dist/plus/integrations/providers/providerErrors.js.map +1 -1
  93. package/dist/plus/integrations/providers/providersApi.js +3 -1
  94. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  95. package/dist/plus/integrations/reads/pullRequestsForCommits.d.ts +45 -0
  96. package/dist/plus/integrations/reads/pullRequestsForCommits.js +97 -0
  97. package/dist/plus/integrations/reads/pullRequestsForCommits.js.map +1 -0
  98. package/dist/plus/integrations/utils/domain.utils.d.ts +1 -0
  99. package/dist/plus/integrations/utils/domain.utils.js +5 -1
  100. package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
  101. package/dist/plus/integrations/utils/failureBackoff.d.ts +13 -0
  102. package/dist/plus/integrations/utils/failureBackoff.js +47 -0
  103. package/dist/plus/integrations/utils/failureBackoff.js.map +1 -0
  104. package/dist/utils/env/node/exec.js +2 -2
  105. package/docs/integrations.md +105 -15
  106. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import { CancellationError, isCancellationError } from "../../../../utils/cancellation.js";
1
+ import { AbortAggregate, CancellationError, isCancellationError, raceWithSignal } from "../../../../utils/cancellation.js";
2
2
  import { equalsIgnoreCase } from "../../../../utils/string.js";
3
3
  import { Logger as _logger } from "../../../../utils/logger.js";
4
4
  import { getScopedLogger } from "../../../../utils/logger.scoped.js";
@@ -6,16 +6,19 @@ import { mapSettledBounded } from "../../../../utils/promise.js";
6
6
  import { trace } from "../../../../utils/decorators/log.js";
7
7
  import { joinUriPath, parseUri } from "../../../../utils/uri.js";
8
8
  import __decorate from "../../../../_virtual/@oxc-project+runtime/helpers/esm/decorate.js";
9
- import { AuthenticationError, RequestClientError, RequestNotFoundError, reportRequestFailure } from "../../../../git/errors.js";
9
+ import { AuthenticationError, RequestClientError, RequestNotFoundError, RequestRateLimitError, reportRequestFailure, takeDeferredRequestFailure } from "../../../../git/errors.js";
10
10
  import { maybeStopWatch } from "../../../../utils/stopwatch.js";
11
11
  import { PullRequest } from "../../../../git/models/pullRequest.js";
12
- import { ProviderFetchError, isRateLimitResponse, toRateLimitError } from "../../errors.js";
12
+ import { LookupBackedOffError, ProviderFetchError, isRateLimitResponse, toRateLimitError } from "../../errors.js";
13
13
  import "../../constants.js";
14
+ import { isNotFoundResponse } from "../providerErrors.js";
14
15
  import { selectBranchPullRequests } from "../utils/providerPaging.js";
16
+ import { FailureBackoff } from "../../utils/failureBackoff.js";
15
17
  import { baseProviderApiConfig } from "../apiConfig.js";
16
18
  import { selectGitLabUserForCommit } from "./gitlab.utils.js";
17
19
  import { fromGitLabMergeRequest, fromGitLabMergeRequestREST, fromGitLabMergeRequestState, getRepoName, getRepoNamespace, toGitLabMergeRequestState } from "./models.js";
18
20
  import * as l10n from "@vscode/l10n";
21
+ import { captureReadNodes, copyReadProvenance, createReadCapture } from "@gitkraken/provider-apis/read-provenance";
19
22
  //#region ../plus/integrations/src/providers/gitlab/gitlab.ts
20
23
  const gitlabUserIdPrefix = "gid://gitlab/User/";
21
24
  const gitlabMergeRequestIdPrefix = "gid://gitlab/MergeRequest/";
@@ -41,10 +44,17 @@ function interleaveByRank(lists, limit) {
41
44
  }
42
45
  return merged;
43
46
  }
47
+ function isRefusedProjectLookup(ex) {
48
+ return ex instanceof AuthenticationError && ex.reason !== 3;
49
+ }
44
50
  var GitLabApi = class {
45
51
  config;
46
52
  _disposable;
47
53
  _projectIds = /* @__PURE__ */ new Map();
54
+ _projectLookupCallers = /* @__PURE__ */ new WeakMap();
55
+ _projectLookupAborts = /* @__PURE__ */ new WeakMap();
56
+ _projectLookupBackoffs = /* @__PURE__ */ new WeakMap();
57
+ _reauthenticationPrompted = /* @__PURE__ */ new Set();
48
58
  constructor(config) {
49
59
  this.config = config;
50
60
  this._disposable = config.onConfigChanged?.(() => this.resetCaches());
@@ -52,8 +62,24 @@ var GitLabApi = class {
52
62
  dispose() {
53
63
  this._disposable?.dispose();
54
64
  }
65
+ clearProjectLookupBackoff(provider) {
66
+ this._projectLookupBackoffs.delete(provider);
67
+ }
55
68
  resetCaches() {
56
69
  this._projectIds.clear();
70
+ this._projectLookupBackoffs = /* @__PURE__ */ new WeakMap();
71
+ this._reauthenticationPrompted.clear();
72
+ }
73
+ getProjectLookupBackoffs(provider) {
74
+ let backoffs = this._projectLookupBackoffs.get(provider);
75
+ if (backoffs == null) {
76
+ backoffs = {
77
+ failed: new FailureBackoff(),
78
+ refused: new FailureBackoff()
79
+ };
80
+ this._projectLookupBackoffs.set(provider, backoffs);
81
+ }
82
+ return backoffs;
57
83
  }
58
84
  async getAccountForCommit(provider, token, owner, repo, rev, options, cancellation) {
59
85
  const scope = getScopedLogger();
@@ -180,7 +206,7 @@ var GitLabApi = class {
180
206
  }, cancellation, scope);
181
207
  if (rsp?.data?.project?.issue != null) {
182
208
  const issue = rsp.data.project.issue;
183
- return {
209
+ const result = {
184
210
  provider,
185
211
  type: "issue",
186
212
  id: issue.iid,
@@ -193,10 +219,11 @@ var GitLabApi = class {
193
219
  url: issue.webUrl,
194
220
  state: issue.state === "locked" ? "closed" : issue.state
195
221
  };
222
+ return copyReadProvenance(result, issue);
196
223
  }
197
224
  if (rsp?.data?.project?.mergeRequest != null) {
198
225
  const mergeRequest = rsp.data.project.mergeRequest;
199
- return {
226
+ const result = {
200
227
  provider,
201
228
  type: "pullrequest",
202
229
  id: mergeRequest.iid,
@@ -209,6 +236,7 @@ var GitLabApi = class {
209
236
  url: mergeRequest.webUrl,
210
237
  state: mergeRequest.state === "locked" ? "closed" : mergeRequest.state
211
238
  };
239
+ return copyReadProvenance(result, mergeRequest);
212
240
  }
213
241
  return;
214
242
  } catch (ex) {
@@ -298,7 +326,7 @@ var GitLabApi = class {
298
326
  }
299
327
  if (pr == null) return void 0;
300
328
  const fullPath = `${owner}/${repo}`;
301
- return new PullRequest(provider, {
329
+ const result = new PullRequest(provider, {
302
330
  id: buildGitLabUserId(pr.author?.id) ?? "",
303
331
  name: pr.author?.name ?? void 0,
304
332
  avatarUrl: pr.author?.avatarUrl ?? void 0,
@@ -307,6 +335,7 @@ var GitLabApi = class {
307
335
  owner: getRepoNamespace(fullPath),
308
336
  repo: getRepoName(fullPath)
309
337
  }, fromGitLabMergeRequestState(pr.state), new Date(pr.createdAt), new Date(pr.updatedAt), pr.state !== "closed" ? void 0 : new Date(pr.updatedAt), pr.mergedAt == null ? void 0 : new Date(pr.mergedAt), void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, void 0, "point");
338
+ return copyReadProvenance(result, pr);
310
339
  } catch (ex) {
311
340
  if (ex instanceof RequestNotFoundError) return void 0;
312
341
  throw this.handleException(ex, provider, scope);
@@ -314,10 +343,14 @@ var GitLabApi = class {
314
343
  }
315
344
  async getPullRequestForCommit(provider, token, owner, repo, rev, options, cancellation) {
316
345
  const scope = getScopedLogger();
317
- const projectId = await this.getProjectId(provider, token, owner, repo, options?.baseUrl, cancellation);
346
+ const projectId = await this.getProjectId(provider, token, owner, repo, options?.baseUrl, cancellation, {
347
+ strict: true,
348
+ backoff: options?.backoff ?? !options?.deferFailure,
349
+ deferFailure: options?.deferFailure
350
+ });
318
351
  if (!projectId) return void 0;
319
352
  try {
320
- const mrs = await this.request(provider, token, options?.baseUrl, `v4/projects/${projectId}/repository/commits/${rev}/merge_requests`, { method: "GET" }, cancellation, scope);
353
+ const mrs = await this.request(provider, token, options?.baseUrl, `v4/projects/${projectId}/repository/commits/${rev}/merge_requests`, { method: "GET" }, cancellation, scope, options?.deferFailure);
321
354
  if (mrs == null || mrs.length === 0) return void 0;
322
355
  if (mrs.length > 1) mrs.sort((a, b) => (a.state === "opened" ? -1 : 1) - (b.state === "opened" ? -1 : 1) || new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime());
323
356
  const fullPath = `${owner}/${repo}`;
@@ -326,6 +359,11 @@ var GitLabApi = class {
326
359
  repo: getRepoName(fullPath)
327
360
  }, "point");
328
361
  } catch (ex) {
362
+ if (options?.deferFailure) {
363
+ if (isNotFoundResponse(ex)) return void 0;
364
+ scope?.error(ex);
365
+ throw ex;
366
+ }
329
367
  if (ex instanceof RequestNotFoundError) return void 0;
330
368
  throw this.handleException(ex, provider, scope);
331
369
  }
@@ -567,7 +605,12 @@ var GitLabApi = class {
567
605
  }
568
606
  async getRepositoryMetadata(provider, token, owner, repo, options, cancellation) {
569
607
  const scope = getScopedLogger();
570
- const projectId = await this.getProjectId(provider, token, owner, repo, options?.baseUrl, cancellation);
608
+ const projectId = await this.getProjectId(provider, token, owner, repo, options?.baseUrl, cancellation, {
609
+ strict: true,
610
+ backoff: options?.backoff
611
+ }).catch((ex) => {
612
+ throw ex instanceof RequestNotFoundError ? ex.original : ex;
613
+ });
571
614
  if (!projectId) return void 0;
572
615
  try {
573
616
  const proj = await this.request(provider, token, options?.baseUrl, `v4/projects/${projectId}`, { method: "GET" }, cancellation, scope);
@@ -658,7 +701,7 @@ var GitLabApi = class {
658
701
  sourceBranch: restPR.source_branch,
659
702
  targetBranch: restPR.target_branch
660
703
  };
661
- accum.push(fromGitLabMergeRequest(fullPr, provider, "text-search"));
704
+ accum.push(copyReadProvenance(fromGitLabMergeRequest(fullPr, provider, "text-search"), restPR));
662
705
  return accum;
663
706
  }, []);
664
707
  return [];
@@ -731,17 +774,65 @@ $search: String!
731
774
  return [];
732
775
  }
733
776
  }
734
- getProjectId(provider, token, group, repo, baseUrl, cancellation) {
777
+ getProjectId(provider, token, group, repo, baseUrl, cancellation, options) {
735
778
  const { accessToken } = token;
736
779
  const key = `${accessToken}|${group}/${repo}`;
780
+ const backoff = options?.backoff ?? true;
781
+ const strict = options?.strict ?? false;
782
+ const reportFailure = !options?.deferFailure;
783
+ if (cancellation?.aborted) return strict ? Promise.reject(new CancellationError()) : Promise.resolve(void 0);
737
784
  let projectId = this._projectIds.get(key);
785
+ if (projectId != null && this._projectLookupAborts.get(projectId)?.signal.aborted) projectId = void 0;
786
+ if (projectId == null && backoff) {
787
+ const backoffs = this.getProjectLookupBackoffs(provider);
788
+ const now = Date.now();
789
+ const until = backoffs.failed.backedOffUntil(key, now) ?? (strict ? void 0 : backoffs.refused.backedOffUntil(key, now));
790
+ if (until != null) {
791
+ if (!strict) return Promise.resolve(void 0);
792
+ return Promise.reject(new LookupBackedOffError(until, `The GitLab project lookup of ${group}/${repo}`));
793
+ }
794
+ }
738
795
  if (projectId == null) {
739
- projectId = this.getProjectIdCore(provider, token, group, repo, baseUrl, cancellation);
740
- this._projectIds.set(key, projectId);
796
+ const callers = {
797
+ backoff,
798
+ reportFailure
799
+ };
800
+ const aborts = new AbortAggregate();
801
+ const lookup = this.getProjectIdCore(provider, token, group, repo, baseUrl, callers, aborts.signal);
802
+ this._projectIds.set(key, lookup);
803
+ this._projectLookupCallers.set(lookup, callers);
804
+ this._projectLookupAborts.set(lookup, aborts);
805
+ const settle = () => {
806
+ aborts.dispose();
807
+ this._projectLookupAborts.delete(lookup);
808
+ };
809
+ lookup.then(() => {
810
+ settle();
811
+ const backoffs = this._projectLookupBackoffs.get(provider);
812
+ backoffs?.failed.clear(key);
813
+ backoffs?.refused.clear(key);
814
+ }, (ex) => {
815
+ settle();
816
+ if (this._projectIds.get(key) === lookup) this._projectIds.delete(key);
817
+ if (callers.backoff && (!isCancellationError(ex) || ex.reason === "timeout")) {
818
+ const backoffs = this.getProjectLookupBackoffs(provider);
819
+ (isRefusedProjectLookup(ex) ? backoffs.refused : backoffs.failed).fail(key, Date.now(), ex instanceof RequestRateLimitError && ex.resetAt != null ? ex.resetAt * 1e3 : void 0);
820
+ }
821
+ });
822
+ projectId = lookup;
823
+ } else {
824
+ const callers = this._projectLookupCallers.get(projectId);
825
+ if (callers != null) {
826
+ callers.backoff ||= backoff;
827
+ callers.reportFailure ||= reportFailure;
828
+ }
741
829
  }
742
- return projectId;
830
+ const lookup = projectId;
831
+ this._projectLookupAborts.get(lookup)?.add(cancellation);
832
+ const awaited = cancellation != null ? raceWithSignal(lookup, cancellation) : lookup;
833
+ return strict ? awaited : awaited.catch(() => void 0);
743
834
  }
744
- async getProjectIdCore(provider, token, group, repo, baseUrl, cancellation) {
835
+ async getProjectIdCore(provider, token, group, repo, baseUrl, callers, cancellation) {
745
836
  const scope = getScopedLogger();
746
837
  try {
747
838
  const gid = (await this.graphql(provider, token, baseUrl, `query getProjectId(
@@ -750,7 +841,7 @@ $search: String!
750
841
  project(fullPath: $fullPath) {
751
842
  id
752
843
  }
753
- }`, { fullPath: `${group}/${repo}` }, cancellation, scope))?.data?.project?.id;
844
+ }`, { fullPath: `${group}/${repo}` }, cancellation, scope, true))?.data?.project?.id;
754
845
  if (gid == null) return void 0;
755
846
  const match = /gid:\/\/gitlab\/Project\/([0-9]+)\b/.exec(gid);
756
847
  if (match == null) return void 0;
@@ -758,9 +849,21 @@ $search: String!
758
849
  scope?.addExitInfo(`projectId=${projectId}`);
759
850
  return projectId;
760
851
  } catch (ex) {
761
- if (ex instanceof RequestNotFoundError) return void 0;
762
- this.handleException(ex, provider, scope);
763
- return;
852
+ if (isCancellationError(ex) && ex.reason !== "timeout") throw ex;
853
+ if (ex instanceof AuthenticationError) {
854
+ if (!callers.reportFailure || this._reauthenticationPrompted.has(token.accessToken)) {
855
+ scope?.error(ex);
856
+ throw ex;
857
+ }
858
+ this._reauthenticationPrompted.add(token.accessToken);
859
+ } else if (callers.reportFailure) {
860
+ const notify = takeDeferredRequestFailure(ex);
861
+ if (notify != null) {
862
+ provider.trackRequestException({ connectionId: token.connectionId });
863
+ notify();
864
+ }
865
+ }
866
+ throw this.handleException(ex, provider, scope);
764
867
  }
765
868
  }
766
869
  async graphql(provider, token, baseUrl, query, variables, cancellation, scope, deferFailure) {
@@ -770,6 +873,7 @@ $search: String!
770
873
  const sw = maybeStopWatch(`[GITLAB] POST ${baseUrl}`, { log: { onlyExit: true } });
771
874
  try {
772
875
  if (cancellation?.aborted) throw new CancellationError();
876
+ const capture = createReadCapture();
773
877
  rsp = await this.config.wrapForForcedInsecureSSL(provider.getIgnoreSSLErrors(), () => this.config.fetch(`${baseUrl ?? "https://gitlab.com/api"}/graphql`, {
774
878
  method: "POST",
775
879
  headers: {
@@ -783,7 +887,7 @@ $search: String!
783
887
  })
784
888
  }));
785
889
  if (rsp.ok) {
786
- const data = await rsp.json();
890
+ const data = captureReadNodes(await rsp.json(), capture);
787
891
  if ("errors" in data) throw new ProviderFetchError("GitLab", rsp, data.errors);
788
892
  return data;
789
893
  }
@@ -798,7 +902,7 @@ $search: String!
798
902
  throw ex;
799
903
  }
800
904
  }
801
- async request(provider, token, baseUrl, route, options, cancellation, scope) {
905
+ async request(provider, token, baseUrl, route, options, cancellation, scope, deferFailure) {
802
906
  const { accessToken } = token;
803
907
  const url = `${baseUrl ?? "https://gitlab.com/api"}/${route}`;
804
908
  let rsp;
@@ -806,6 +910,7 @@ $search: String!
806
910
  const sw = maybeStopWatch(`[GITLAB] ${options?.method ?? "GET"} ${url}`, { log: { onlyExit: true } });
807
911
  try {
808
912
  if (cancellation?.aborted) throw new CancellationError();
913
+ const capture = createReadCapture();
809
914
  rsp = await this.config.wrapForForcedInsecureSSL(provider.getIgnoreSSLErrors(), () => this.config.fetch(url, {
810
915
  headers: {
811
916
  Authorization: `Bearer ${accessToken}`,
@@ -814,13 +919,13 @@ $search: String!
814
919
  signal: cancellation,
815
920
  ...options
816
921
  }));
817
- if (rsp.ok) return await rsp.json();
922
+ if (rsp.ok) return captureReadNodes(await rsp.json(), capture);
818
923
  throw await ProviderFetchError.fromResponse("GitLab", rsp);
819
924
  } finally {
820
925
  sw?.stop();
821
926
  }
822
927
  } catch (ex) {
823
- if (ex instanceof ProviderFetchError || ex.name === "AbortError") this.handleRequestError(provider, token, ex, scope, void 0);
928
+ if (ex instanceof ProviderFetchError || ex.name === "AbortError") this.handleRequestError(provider, token, ex, scope, deferFailure);
824
929
  else if (_logger.isDebugging) this.config.onError?.(`GitLab request failed: ${ex.message}`);
825
930
  throw ex;
826
931
  }