@gitkraken/core-gitlens 0.7.0 → 0.7.1

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 (115) hide show
  1. package/CHANGELOG.md +21 -2
  2. package/dist/git/remotes/azure-devops.js +3 -3
  3. package/dist/git/remotes/azure-devops.js.map +1 -1
  4. package/dist/git-cli/exec/git.js +1 -1
  5. package/dist/git-cli/providers/config.js +2 -2
  6. package/dist/git-cli/providers/pausedOperations.js +2 -2
  7. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  8. package/dist/git-cli/providers/staging.js +1 -1
  9. package/dist/ipc/discovery.js +1 -1
  10. package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
  11. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
  12. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
  13. package/dist/plus/integrations/authentication/configuredIntegrationService.js +9 -2
  14. package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
  15. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +1 -1
  16. package/dist/plus/integrations/index.d.ts +2 -2
  17. package/dist/plus/integrations/index.js.map +1 -1
  18. package/dist/plus/integrations/integrationService.d.ts +34 -0
  19. package/dist/plus/integrations/integrationService.js +90 -43
  20. package/dist/plus/integrations/integrationService.js.map +1 -1
  21. package/dist/plus/integrations/lite.js +5 -4
  22. package/dist/plus/integrations/lite.js.map +1 -1
  23. package/dist/plus/integrations/manager.d.ts +68 -23
  24. package/dist/plus/integrations/models/gitHostIntegration.d.ts +30 -14
  25. package/dist/plus/integrations/models/gitHostIntegration.js +59 -21
  26. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  27. package/dist/plus/integrations/models/integration.d.ts +3 -3
  28. package/dist/plus/integrations/models/integration.js +1 -1
  29. package/dist/plus/integrations/models/integration.js.map +1 -1
  30. package/dist/plus/integrations/models/issueReads.d.ts +17 -0
  31. package/dist/plus/integrations/models/pullRequestReads.d.ts +26 -0
  32. package/dist/plus/integrations/providers/azure/azure.d.ts +66 -1
  33. package/dist/plus/integrations/providers/azure/azure.js +192 -12
  34. package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
  35. package/dist/plus/integrations/providers/azure/search.d.ts +144 -0
  36. package/dist/plus/integrations/providers/azure/search.js +250 -0
  37. package/dist/plus/integrations/providers/azure/search.js.map +1 -0
  38. package/dist/plus/integrations/providers/azureDevOps.d.ts +54 -35
  39. package/dist/plus/integrations/providers/azureDevOps.js +154 -121
  40. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  41. package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +176 -0
  42. package/dist/plus/integrations/providers/azureDevOpsServer.js +560 -0
  43. package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -0
  44. package/dist/plus/integrations/providers/bitbucket-server/discovery.d.ts +12 -0
  45. package/dist/plus/integrations/providers/bitbucket-server/discovery.js +128 -0
  46. package/dist/plus/integrations/providers/bitbucket-server/discovery.js.map +1 -0
  47. package/dist/plus/integrations/providers/bitbucket-server/models.d.ts +10 -1
  48. package/dist/plus/integrations/providers/bitbucket-server/models.js +3 -2
  49. package/dist/plus/integrations/providers/bitbucket-server/models.js.map +1 -1
  50. package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.d.ts +58 -0
  51. package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js +485 -0
  52. package/dist/plus/integrations/providers/bitbucket-server/pullRequestSearch.js.map +1 -0
  53. package/dist/plus/integrations/providers/bitbucket-server.d.ts +52 -3
  54. package/dist/plus/integrations/providers/bitbucket-server.js +96 -20
  55. package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
  56. package/dist/plus/integrations/providers/bitbucket.js +1 -1
  57. package/dist/plus/integrations/providers/github.d.ts +5 -5
  58. package/dist/plus/integrations/providers/github.js +34 -33
  59. package/dist/plus/integrations/providers/github.js.map +1 -1
  60. package/dist/plus/integrations/providers/gitlab.d.ts +5 -3
  61. package/dist/plus/integrations/providers/gitlab.js +31 -27
  62. package/dist/plus/integrations/providers/gitlab.js.map +1 -1
  63. package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
  64. package/dist/plus/integrations/providers/jira-server.d.ts +9 -0
  65. package/dist/plus/integrations/providers/jira-server.js +13 -2
  66. package/dist/plus/integrations/providers/jira-server.js.map +1 -1
  67. package/dist/plus/integrations/providers/jira.js +1 -1
  68. package/dist/plus/integrations/providers/linear.js +1 -1
  69. package/dist/plus/integrations/providers/models.d.ts +9 -0
  70. package/dist/plus/integrations/providers/models.js +86 -0
  71. package/dist/plus/integrations/providers/models.js.map +1 -1
  72. package/dist/plus/integrations/providers/providersApi.d.ts +10 -0
  73. package/dist/plus/integrations/providers/providersApi.js +16 -1
  74. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  75. package/dist/plus/integrations/providers/utils.d.ts +12 -1
  76. package/dist/plus/integrations/providers/utils.js +36 -6
  77. package/dist/plus/integrations/providers/utils.js.map +1 -1
  78. package/dist/plus/integrations/reads/broaden.js +5 -5
  79. package/dist/plus/integrations/reads/broaden.js.map +1 -1
  80. package/dist/plus/integrations/reads/counts.d.ts +18 -4
  81. package/dist/plus/integrations/reads/counts.js +66 -15
  82. package/dist/plus/integrations/reads/counts.js.map +1 -1
  83. package/dist/plus/integrations/reads/cursors.js +1 -1
  84. package/dist/plus/integrations/reads/drains.d.ts +1 -0
  85. package/dist/plus/integrations/reads/filters.d.ts +1 -1
  86. package/dist/plus/integrations/reads/filters.js +17 -12
  87. package/dist/plus/integrations/reads/filters.js.map +1 -1
  88. package/dist/plus/integrations/reads/hierarchy.js +1 -1
  89. package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
  90. package/dist/plus/integrations/reads/issueTracker.js +1 -1
  91. package/dist/plus/integrations/reads/issues.js +1 -1
  92. package/dist/plus/integrations/reads/paging.js +1 -1
  93. package/dist/plus/integrations/reads/resolveRepository.d.ts +12 -11
  94. package/dist/plus/integrations/reads/resolveRepository.js +109 -18
  95. package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
  96. package/dist/plus/integrations/reads/searchIssues.js +4 -2
  97. package/dist/plus/integrations/reads/searchIssues.js.map +1 -1
  98. package/dist/plus/integrations/reads/searchPullRequests.js +9 -3
  99. package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
  100. package/dist/plus/integrations/reads/trackerIssue.d.ts +9 -5
  101. package/dist/plus/integrations/reads/trackerIssue.js +15 -9
  102. package/dist/plus/integrations/reads/trackerIssue.js.map +1 -1
  103. package/dist/plus/integrations/reads/warnings.d.ts +6 -2
  104. package/dist/plus/integrations/reads/warnings.js +15 -19
  105. package/dist/plus/integrations/reads/warnings.js.map +1 -1
  106. package/dist/plus/integrations/utils/domain.utils.d.ts +19 -0
  107. package/dist/plus/integrations/utils/domain.utils.js +36 -1
  108. package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
  109. package/dist/plus/integrations/utils/integration.utils.d.ts +1 -0
  110. package/dist/plus/integrations/utils/integration.utils.js +12 -1
  111. package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
  112. package/dist/utils/env/node/exec.js +2 -2
  113. package/docs/integrations.md +176 -73
  114. package/docs/kepler-read-api-parity.md +19 -6
  115. package/package.json +1 -1
@@ -44,13 +44,13 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
44
44
  async getProviderAccountForCommit(session, repo, rev, options) {
45
45
  return (await this.authenticationService.apis.github)?.getAccountForCommit(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, rev, {
46
46
  ...options,
47
- baseUrl: this.apiBaseUrl
47
+ baseUrl: this.apiBaseUrlFor(session)
48
48
  });
49
49
  }
50
50
  async getProviderAccountForEmail(session, repo, email, options) {
51
51
  return (await this.authenticationService.apis.github)?.getAccountForEmail(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, email, {
52
52
  ...options,
53
- baseUrl: this.apiBaseUrl
53
+ baseUrl: this.apiBaseUrlFor(session)
54
54
  });
55
55
  }
56
56
  async getProviderSshSigningKeysForEmails(session, repo, emails) {
@@ -66,31 +66,31 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
66
66
  else toResolve.push(email);
67
67
  }
68
68
  if (toResolve.length) {
69
- const resolved = await api.getAccountsForEmails(this, token, toResolve, { baseUrl: this.apiBaseUrl });
69
+ const resolved = await api.getAccountsForEmails(this, token, toResolve, { baseUrl: this.apiBaseUrlFor(session) });
70
70
  for (const [emailLower, login] of resolved) loginByEmail.set(emailLower, login);
71
71
  }
72
72
  const keysByLogin = /* @__PURE__ */ new Map();
73
73
  await batch([...new Set(loginByEmail.values())], sshSigningKeyResolveBatchSize, async (login) => {
74
- const keys = await api.getUserSshSigningKeys(this, token, login, { baseUrl: this.apiBaseUrl });
74
+ const keys = await api.getUserSshSigningKeys(this, token, login, { baseUrl: this.apiBaseUrlFor(session) });
75
75
  keysByLogin.set(login, keys.map((k) => k.key));
76
76
  });
77
77
  for (const [emailLower, login] of loginByEmail) result.set(emailLower, keysByLogin.get(login) ?? []);
78
78
  return result;
79
79
  }
80
80
  async getProviderDefaultBranch(session, repo) {
81
- return (await this.authenticationService.apis.github)?.getDefaultBranch(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, { baseUrl: this.apiBaseUrl });
81
+ return (await this.authenticationService.apis.github)?.getDefaultBranch(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, { baseUrl: this.apiBaseUrlFor(session) });
82
82
  }
83
83
  async getProviderLinkedIssueOrPullRequest(session, repo, { id }) {
84
- return (await this.authenticationService.apis.github)?.getIssueOrPullRequest(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, Number(id), { baseUrl: this.apiBaseUrl });
84
+ return (await this.authenticationService.apis.github)?.getIssueOrPullRequest(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, Number(id), { baseUrl: this.apiBaseUrlFor(session) });
85
85
  }
86
86
  async getProviderIssue(session, repo, id) {
87
87
  return (await this.authenticationService.apis.github)?.getIssue(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, Number(id), {
88
- baseUrl: this.apiBaseUrl,
88
+ baseUrl: this.apiBaseUrlFor(session),
89
89
  includeBody: true
90
90
  });
91
91
  }
92
92
  async getProviderPullRequest(session, repo, id) {
93
- return (await this.authenticationService.apis.github)?.getPullRequest(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, parseInt(id, 10), { baseUrl: this.apiBaseUrl });
93
+ return (await this.authenticationService.apis.github)?.getPullRequest(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, parseInt(id, 10), { baseUrl: this.apiBaseUrlFor(session) });
94
94
  }
95
95
  async getProviderPullRequestForBranch(session, repo, branch, options) {
96
96
  const { include, ...opts } = options ?? {};
@@ -101,23 +101,24 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
101
101
  return (await this.authenticationService.apis.github)?.getPullRequestForBranch(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, branch, {
102
102
  ...opts,
103
103
  include: include?.map((s) => toGitHubPullRequestState(s)),
104
- baseUrl: this.apiBaseUrl
104
+ baseUrl: this.apiBaseUrlFor(session)
105
105
  });
106
106
  }
107
107
  async getProviderPullRequestForCommit(session, repo, rev) {
108
- return (await this.authenticationService.apis.github)?.getPullRequestForCommit(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, rev, { baseUrl: this.apiBaseUrl });
108
+ return (await this.authenticationService.apis.github)?.getPullRequestForCommit(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, rev, { baseUrl: this.apiBaseUrlFor(session) });
109
109
  }
110
110
  async getProviderRepositoryMetadata(session, repo, cancellation) {
111
- return (await this.authenticationService.apis.github)?.getRepositoryMetadata(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, { baseUrl: this.apiBaseUrl }, cancellation);
111
+ return (await this.authenticationService.apis.github)?.getRepositoryMetadata(this, toTokenWithInfo(this.id, session), repo.owner, repo.name, { baseUrl: this.apiBaseUrlFor(session) }, cancellation);
112
112
  }
113
113
  async getProviderOrganizationsForUser(session) {
114
- const result = await (await this.getProvidersApi()).getGitHubOrgsForCurrentUser(toTokenWithInfo(this.id, session), { baseUrl: this.apiBaseUrl });
114
+ const result = await (await this.getProvidersApi()).getGitHubOrgsForCurrentUser(toTokenWithInfo(this.id, session), { baseUrl: this.apiBaseUrlFor(session) });
115
+ const webUrl = this.id === "cloud-github-enterprise" ? this.getSelfManagedInstallationUrl(session) : `https://${this.domain}`;
115
116
  return {
116
117
  values: result.values.map((o) => ({
117
118
  id: o.id,
118
119
  providerId: this.id,
119
120
  name: o.username,
120
- url: `https://${this.domain}/${o.username}`
121
+ url: `${webUrl}/${o.username}`
121
122
  })),
122
123
  ...result.truncated ? { truncated: true } : {},
123
124
  ...result.metadata != null ? { metadata: result.metadata } : {}
@@ -125,7 +126,7 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
125
126
  }
126
127
  async getProviderRepositoriesForOrg(session, org, options) {
127
128
  return (await this.getProvidersApi()).getReposForOrg(toTokenWithInfo(this.id, session), org, {
128
- baseUrl: this.apiBaseUrl,
129
+ baseUrl: this.apiBaseUrlFor(session),
129
130
  cursor: options?.cursor
130
131
  });
131
132
  }
@@ -136,7 +137,7 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
136
137
  "collaborator",
137
138
  "organization_member"
138
139
  ],
139
- baseUrl: this.apiBaseUrl,
140
+ baseUrl: this.apiBaseUrlFor(session),
140
141
  cursor: options?.cursor
141
142
  });
142
143
  }
@@ -144,12 +145,12 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
144
145
  const api = await this.getProvidersApi();
145
146
  const session = await this.resolveReadSession(repo.connectionId, void 0);
146
147
  if (session == null) return void 0;
147
- return api.getRepo(toTokenWithInfo(this.id, session), repo.owner, repo.name, repo.project, { baseUrl: this.apiBaseUrl });
148
+ return api.getRepo(toTokenWithInfo(this.id, session), repo.owner, repo.name, repo.project, { baseUrl: this.apiBaseUrlFor(session) });
148
149
  }
149
150
  async searchProviderMyPullRequests(session, repos, cancellation, options) {
150
151
  return (await this.authenticationService.apis.github)?.searchMyPullRequests(this, toTokenWithInfo(this.id, session), {
151
152
  repos: repos?.map((r) => `${r.owner}/${r.name}`),
152
- baseUrl: this.apiBaseUrl,
153
+ baseUrl: this.apiBaseUrlFor(session),
153
154
  silent: options?.silent,
154
155
  state: options?.state
155
156
  }, cancellation);
@@ -179,7 +180,7 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
179
180
  const results = await Promise.allSettled(facetsToQuery.map(async (facet) => ({
180
181
  key: facet.key,
181
182
  result: await github.searchMyPullRequestsPage(this, toTokenWithInfo(this.id, session), {
182
- baseUrl: this.apiBaseUrl,
183
+ baseUrl: this.apiBaseUrlFor(session),
183
184
  state: facet.state,
184
185
  cursor: cursors[facet.key],
185
186
  summary: options?.summary,
@@ -253,7 +254,7 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
253
254
  if ((repos == null || repos.length === 0) && options?.includeAllAssignees) throw new IntegrationReadUnavailableError(this.name, "`includeAllAssignees` is not supported for account-wide issue reads; scope the read to repositories instead.");
254
255
  return (await this.authenticationService.apis.github)?.searchMyIssues(this, toTokenWithInfo(this.id, session), {
255
256
  repos: repos?.map((r) => `${r.owner}/${r.name}`),
256
- baseUrl: this.apiBaseUrl,
257
+ baseUrl: this.apiBaseUrlFor(session),
257
258
  includeBody: true,
258
259
  includeAllAssignees: options?.includeAllAssignees,
259
260
  cursor: options?.cursor,
@@ -276,7 +277,7 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
276
277
  repos: options.repos?.map((r) => `${r.namespace}/${r.name}`),
277
278
  org: options.org,
278
279
  criteria: options.criteria,
279
- baseUrl: this.apiBaseUrl,
280
+ baseUrl: this.apiBaseUrlFor(session),
280
281
  cursor: options.cursor,
281
282
  pageSize: options.pageSize,
282
283
  summary: options.summary
@@ -294,7 +295,7 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
294
295
  repos: options.repos?.map((r) => `${r.namespace}/${r.name}`),
295
296
  org: options.org,
296
297
  criteria: options.criteria,
297
- baseUrl: this.apiBaseUrl,
298
+ baseUrl: this.apiBaseUrlFor(session),
298
299
  includeBody: true,
299
300
  cursor: options.cursor,
300
301
  pageSize: options.pageSize
@@ -309,7 +310,7 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
309
310
  repos: s.repos?.map((r) => `${r.namespace}/${r.name}`),
310
311
  org: s.org,
311
312
  criteria: s.criteria
312
- })), { baseUrl: this.apiBaseUrl }, cancellation);
313
+ })), { baseUrl: this.apiBaseUrlFor(session) }, cancellation);
313
314
  }
314
315
  /**
315
316
  * Resolves several issues by `(owner, repo, number)` in ONE request, by aliasing the point read rather than a
@@ -317,7 +318,7 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
317
318
  */
318
319
  async getProviderIssuesBatch(session, coordinates, cancellation) {
319
320
  return (await this.authenticationService.apis.github)?.getIssuesBatch(this, toTokenWithInfo(this.id, session), coordinates, {
320
- baseUrl: this.apiBaseUrl,
321
+ baseUrl: this.apiBaseUrlFor(session),
321
322
  includeBody: true
322
323
  }, cancellation);
323
324
  }
@@ -326,17 +327,17 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
326
327
  * reports `issueCount` on a zero-node selection, so a count preview costs no pull-request transfer.
327
328
  */
328
329
  async countProviderPullRequests(session, scopes, cancellation) {
329
- return (await this.authenticationService.apis.github)?.countPullRequests(this, toTokenWithInfo(this.id, session), scopes.map((s) => ({
330
+ return (await (await this.authenticationService.apis.github)?.countPullRequests(this, toTokenWithInfo(this.id, session), scopes.map((s) => ({
330
331
  repos: s.repos?.map((r) => `${r.namespace}/${r.name}`),
331
332
  org: s.org,
332
333
  criteria: s.criteria
333
- })), { baseUrl: this.apiBaseUrl }, cancellation);
334
+ })), { baseUrl: this.apiBaseUrlFor(session) }, cancellation))?.map((count) => ({ count }));
334
335
  }
335
336
  async searchProviderPullRequests(session, searchQuery, repos, cancellation, options) {
336
337
  return (await this.authenticationService.apis.github)?.searchPullRequests(this, toTokenWithInfo(this.id, session), {
337
338
  search: searchQuery,
338
339
  repos: repos?.map((r) => `${r.owner}/${r.name}`),
339
- baseUrl: this.apiBaseUrl,
340
+ baseUrl: this.apiBaseUrlFor(session),
340
341
  ...options
341
342
  }, cancellation);
342
343
  }
@@ -354,7 +355,7 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
354
355
  async getStacksByPullRequestNumber(owner, repo, cancellation) {
355
356
  const session = await this.resolveReadSession(void 0, void 0);
356
357
  if (session == null) return void 0;
357
- const stacks = await (await this.authenticationService.apis.github)?.getRepositoryStacks(this, toTokenWithInfo(this.id, session), owner, repo, { baseUrl: this.apiBaseUrl }, cancellation);
358
+ const stacks = await (await this.authenticationService.apis.github)?.getRepositoryStacks(this, toTokenWithInfo(this.id, session), owner, repo, { baseUrl: this.apiBaseUrlFor(session) }, cancellation);
358
359
  if (stacks == null) return void 0;
359
360
  const byNumber = /* @__PURE__ */ new Map();
360
361
  for (const stack of stacks) {
@@ -380,17 +381,17 @@ var GitHubIntegrationBase = class extends GitHostIntegration {
380
381
  const api = await this.authenticationService.apis.github;
381
382
  if (pr.stack != null) return await api?.mergeStackedPullRequest(this, toTokenWithInfo(this.id, session), pr.repository.owner, pr.repository.repo, Number(pr.id), headRefSha, {
382
383
  mergeMethod: options?.mergeMethod,
383
- baseUrl: this.apiBaseUrl
384
+ baseUrl: this.apiBaseUrlFor(session)
384
385
  }, cancellation) ?? false;
385
386
  return api?.mergePullRequest(this, toTokenWithInfo(this.id, session), id, headRefSha, {
386
387
  mergeMethod: options?.mergeMethod,
387
- baseUrl: this.apiBaseUrl
388
+ baseUrl: this.apiBaseUrlFor(session)
388
389
  }, cancellation) ?? false;
389
390
  }
390
391
  async getProviderCurrentAccount(session, options) {
391
392
  return (await this.authenticationService.apis.github)?.getCurrentAccount(this, toTokenWithInfo(this.id, session), {
392
393
  ...options,
393
- baseUrl: this.apiBaseUrl
394
+ baseUrl: this.apiBaseUrlFor(session)
394
395
  });
395
396
  }
396
397
  getProviderPullRequestIdentityFromMaybeUrl(search) {
@@ -405,7 +406,7 @@ var GitHubIntegration = class extends GitHubIntegrationBase {
405
406
  get domain() {
406
407
  return metadata.domain;
407
408
  }
408
- get apiBaseUrl() {}
409
+ apiBaseUrlFor(_session) {}
409
410
  access() {
410
411
  return Promise.resolve(true);
411
412
  }
@@ -427,8 +428,8 @@ var GitHubEnterpriseIntegration = class extends GitHubIntegrationBase {
427
428
  get domain() {
428
429
  return this._domain;
429
430
  }
430
- get apiBaseUrl() {
431
- return `https://${this._domain}/api/v3`;
431
+ apiBaseUrlFor(session) {
432
+ return this.getSelfManagedApiBaseUrl(session);
432
433
  }
433
434
  constructor(ctx, authenticationService, getProvidersApi, didChangeConnection, _domain) {
434
435
  super(ctx, authenticationService, getProvidersApi, didChangeConnection);
@@ -1 +1 @@
1
- {"version":3,"file":"github.js","names":[],"sources":["../../../../../plus/integrations/src/providers/github.ts"],"sourcesContent":["import { gitHubPullRequestRelationshipQualifiers } from '@gitlens/git-github/api/pullRequestSearchQuery.js';\nimport type { Account, UnidentifiedAuthor } from '@gitlens/git/models/author.js';\nimport type { DefaultBranch } from '@gitlens/git/models/defaultBranch.js';\nimport type { Issue, IssueSearchCriteria, IssueShape } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequest } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type {\n\tPullRequest,\n\tPullRequestMergeMethod,\n\tPullRequestSearchCriteria,\n\tPullRequestStackInfo,\n\tPullRequestState,\n\tPullRequestStateFilter,\n} from '@gitlens/git/models/pullRequest.js';\nimport type { RepositoryMetadata } from '@gitlens/git/models/repositoryMetadata.js';\nimport type { RepositoryDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport { getGitHubNoReplyAddressParts } from '@gitlens/git/remotes/github.js';\nimport type { PullRequestUrlIdentity } from '@gitlens/git/utils/pullRequest.utils.js';\nimport type { Emitter } from '@gitlens/utils/event.js';\nimport { batch } from '@gitlens/utils/promise.js';\nimport type { IntegrationAuthenticationProviderDescriptor } from '../authentication/integrationAuthenticationProvider.js';\nimport type { IntegrationAuthenticationService } from '../authentication/integrationAuthenticationService.js';\nimport type { ProviderAuthenticationSession } from '../authentication/models.js';\nimport { toTokenWithInfo } from '../authentication/models.js';\nimport { toCollectionScopeFailure } from '../collectionMetadata.js';\nimport { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId } from '../constants.js';\nimport type { IntegrationServiceContext } from '../context.js';\nimport { IntegrationReadUnavailableError } from '../errors.js';\nimport type { IntegrationConnectionChangeEvent } from '../integrationService.js';\nimport type { SearchMyPullRequestsOptions, SearchPullRequestsOptions } from '../models/gitHostIntegration.js';\nimport { GitHostIntegration } from '../models/gitHostIntegration.js';\nimport type {\n\tProviderIssueSearchPage,\n\tProviderPullRequestSearchPage,\n\tSearchMyIssuesOptions,\n} from '../models/integration.js';\nimport type { GitHubIntegrationIds } from './github/github.utils.js';\nimport { getGitHubPullRequestIdentityFromMaybeUrl } from './github/github.utils.js';\nimport type {\n\tProviderApiPagedResult,\n\tProviderHierarchyResult,\n\tProviderOrganization,\n\tProviderPullRequest,\n\tProviderRepoInput,\n\tProviderRepository,\n} from './models.js';\nimport {\n\tgetProviderPullRequestIdentity,\n\tIssueFilter,\n\tprovidersMetadata,\n\tPullRequestFilter,\n\ttoProviderPullRequest,\n} from './models.js';\nimport type { ProvidersApi } from './providersApi.js';\n\ntype GitHubPullRequestFacetCursor = Record<string, string>;\n\nfunction toPullRequestFacetCursor(value: unknown): GitHubPullRequestFacetCursor {\n\tif (value == null || typeof value !== 'object' || Array.isArray(value)) return {};\n\n\treturn Object.fromEntries(\n\t\tObject.entries(value).filter(\n\t\t\t([key, cursor]) => key.length !== 0 && typeof cursor === 'string' && cursor.length !== 0,\n\t\t),\n\t);\n}\n\nfunction parsePullRequestFacetCursor(cursor: string | undefined): GitHubPullRequestFacetCursor {\n\tif (!cursor) return {};\n\n\ttry {\n\t\tconst parsed = JSON.parse(cursor) as unknown;\n\t\tif (parsed != null && typeof parsed === 'object' && !Array.isArray(parsed) && 'cursors' in parsed) {\n\t\t\tconst wrapped = parsed as { type?: unknown; cursors?: unknown };\n\t\t\tif (wrapped.type === 'cursor') {\n\t\t\t\treturn toPullRequestFacetCursor(wrapped.cursors);\n\t\t\t}\n\t\t}\n\n\t\treturn toPullRequestFacetCursor(parsed);\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nconst metadata = providersMetadata[GitCloudHostIntegrationId.GitHub];\nconst authProvider: IntegrationAuthenticationProviderDescriptor = Object.freeze({\n\tid: metadata.id,\n\tscopes: metadata.scopes,\n});\n\nconst cloudEnterpriseMetadata = providersMetadata[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise];\nconst cloudEnterpriseAuthProvider: IntegrationAuthenticationProviderDescriptor = Object.freeze({\n\tid: cloudEnterpriseMetadata.id,\n\tscopes: cloudEnterpriseMetadata.scopes,\n});\n\nexport type GitHubRepositoryDescriptor = RepositoryDescriptor;\n\n/** How many per-login SSH signing-key lookups to run concurrently, to avoid a request burst that trips rate limiting. */\nconst sshSigningKeyResolveBatchSize = 10;\n\nabstract class GitHubIntegrationBase<ID extends GitHubIntegrationIds> extends GitHostIntegration<\n\tID,\n\tGitHubRepositoryDescriptor\n> {\n\t/**\n\t * Base URL handed to `@gitkraken/provider-apis`, which derives BOTH the REST and the GraphQL endpoint from it\n\t * by appending GitHub Enterprise's paths. Only a GHE instance base belongs here; cloud passes `undefined`,\n\t * the sole value that selects the cloud endpoints (see the cloud subclass).\n\t */\n\tprotected abstract get apiBaseUrl(): string | undefined;\n\n\tprotected override async getProviderAccountForCommit(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\trev: string,\n\t\toptions?: {\n\t\t\tavatarSize?: number;\n\t\t},\n\t): Promise<Account | UnidentifiedAuthor | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getAccountForCommit(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\trev,\n\t\t\t{\n\t\t\t\t...options,\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderAccountForEmail(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\temail: string,\n\t\toptions?: {\n\t\t\tavatarSize?: number;\n\t\t},\n\t): Promise<Account | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getAccountForEmail(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\temail,\n\t\t\t{\n\t\t\t\t...options,\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderSshSigningKeysForEmails(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\temails: string[],\n\t): Promise<Map<string, string[]>> {\n\t\tconst result = new Map<string, string[]>();\n\n\t\tconst api = await this.authenticationService.apis.github;\n\t\tif (api == null) return result;\n\n\t\tconst token = toTokenWithInfo(this.id, session);\n\n\t\t// Resolve each email to a login: GitHub noreply addresses encode it locally; the rest are resolved in a single\n\t\t// batched GraphQL request rather than one round-trip per email.\n\t\tconst loginByEmail = new Map<string, string>();\n\t\tconst toResolve: string[] = [];\n\t\tfor (const email of emails) {\n\t\t\tconst login = getGitHubNoReplyAddressParts(email)?.login;\n\t\t\tif (login != null) {\n\t\t\t\tloginByEmail.set(email.toLowerCase(), login);\n\t\t\t} else {\n\t\t\t\ttoResolve.push(email);\n\t\t\t}\n\t\t}\n\n\t\tif (toResolve.length) {\n\t\t\tconst resolved = await api.getAccountsForEmails(this, token, toResolve, { baseUrl: this.apiBaseUrl });\n\t\t\tfor (const [emailLower, login] of resolved) {\n\t\t\t\tloginByEmail.set(emailLower, login);\n\t\t\t}\n\t\t}\n\n\t\t// Fetch signing keys once per distinct login (REST has no batch endpoint), in bounded batches rather than firing\n\t\t// all lookups at once, to avoid a request burst that could trip secondary rate limiting. Then map keys to each email.\n\t\tconst keysByLogin = new Map<string, string[]>();\n\t\tawait batch([...new Set(loginByEmail.values())], sshSigningKeyResolveBatchSize, async login => {\n\t\t\tconst keys = await api.getUserSshSigningKeys(this, token, login, { baseUrl: this.apiBaseUrl });\n\t\t\tkeysByLogin.set(\n\t\t\t\tlogin,\n\t\t\t\tkeys.map(k => k.key),\n\t\t\t);\n\t\t});\n\n\t\tfor (const [emailLower, login] of loginByEmail) {\n\t\t\tresult.set(emailLower, keysByLogin.get(login) ?? []);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprotected override async getProviderDefaultBranch(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t): Promise<DefaultBranch | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getDefaultBranch(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderLinkedIssueOrPullRequest(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\t{ id }: { id: string; key: string },\n\t): Promise<IssueOrPullRequest | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getIssueOrPullRequest(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\tNumber(id),\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderIssue(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\tid: string,\n\t): Promise<Issue | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getIssue(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\tNumber(id),\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t\tincludeBody: true,\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderPullRequest(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\tid: string,\n\t): Promise<PullRequest | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getPullRequest(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\tparseInt(id, 10),\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderPullRequestForBranch(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\tbranch: string,\n\t\toptions?: {\n\t\t\tavatarSize?: number;\n\t\t\tinclude?: PullRequestState[];\n\t\t},\n\t): Promise<PullRequest | undefined> {\n\t\tconst { include, ...opts } = options ?? {};\n\n\t\tconst toGitHubPullRequestState = (await import(/* webpackChunkName: \"integrations\" */ './github/models.js'))\n\t\t\t.toGitHubPullRequestState;\n\t\treturn (await this.authenticationService.apis.github)?.getPullRequestForBranch(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\tbranch,\n\t\t\t{\n\t\t\t\t...opts,\n\t\t\t\tinclude: include?.map(s => toGitHubPullRequestState(s)),\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderPullRequestForCommit(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\trev: string,\n\t): Promise<PullRequest | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getPullRequestForCommit(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\trev,\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderRepositoryMetadata(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\tcancellation?: AbortSignal,\n\t): Promise<RepositoryMetadata | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getRepositoryMetadata(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\tprotected override async getProviderOrganizationsForUser(\n\t\tsession: ProviderAuthenticationSession,\n\t): Promise<ProviderHierarchyResult<ProviderOrganization> | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst result = await api.getGitHubOrgsForCurrentUser(toTokenWithInfo(this.id, session), {\n\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t});\n\t\treturn {\n\t\t\tvalues: result.values.map(o => ({\n\t\t\t\tid: o.id,\n\t\t\t\tproviderId: this.id,\n\t\t\t\tname: o.username,\n\t\t\t\turl: `https://${this.domain}/${o.username}`,\n\t\t\t})),\n\t\t\t...(result.truncated ? { truncated: true } : {}),\n\t\t\t...(result.metadata != null ? { metadata: result.metadata } : {}),\n\t\t};\n\t}\n\n\tprotected override async getProviderRepositoriesForOrg(\n\t\tsession: ProviderAuthenticationSession,\n\t\torg: string,\n\t\toptions?: { cursor?: string },\n\t): Promise<ProviderHierarchyResult<ProviderRepository> | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\treturn api.getReposForOrg(toTokenWithInfo(this.id, session), org, {\n\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\tcursor: options?.cursor,\n\t\t});\n\t}\n\n\tprotected override async getProviderRepositoriesForUser(\n\t\tsession: ProviderAuthenticationSession,\n\t\toptions?: { cursor?: string },\n\t): Promise<ProviderHierarchyResult<ProviderRepository> | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\t// `/user/repos` with the full affiliation set: the user's own repos, collaborations, and org-member\n\t\t// repos — matching gkcli's org-less `provider repos github` walk (not every repo of every org).\n\t\treturn api.getReposForCurrentUser(toTokenWithInfo(this.id, session), {\n\t\t\taffiliations: ['owner', 'collaborator', 'organization_member'],\n\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\tcursor: options?.cursor,\n\t\t});\n\t}\n\n\tpublic override async getRepoInfo(repo: {\n\t\towner: string;\n\t\tname: string;\n\t\tproject?: string;\n\t\tconnectionId?: string;\n\t}): Promise<ProviderRepository | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(repo.connectionId, undefined);\n\t\tif (session == null) return undefined;\n\n\t\t// `apiBaseUrl` is undefined for cloud (which is what selects the cloud endpoints) and the GHE instance base\n\t\t// for enterprise (inherited override).\n\t\treturn api.getRepo(toTokenWithInfo(this.id, session), repo.owner, repo.name, repo.project, {\n\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t});\n\t}\n\n\tprotected override async searchProviderMyPullRequests(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepos?: GitHubRepositoryDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t\toptions?: SearchMyPullRequestsOptions,\n\t): Promise<PullRequest[] | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.searchMyPullRequests(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t{\n\t\t\t\trepos: repos?.map(r => `${r.owner}/${r.name}`),\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t\tsilent: options?.silent,\n\t\t\t\tstate: options?.state,\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\tprotected override async getProviderMyPullRequestsForUser(\n\t\tsession: ProviderAuthenticationSession,\n\t\toptions?: {\n\t\t\tstate?: PullRequestStateFilter[];\n\t\t\tcursor?: string;\n\t\t\tincludeReviewRequested?: boolean;\n\t\t\tfilters?: PullRequestFilter[];\n\t\t\tsummary?: boolean;\n\t\t},\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest> | undefined> {\n\t\tconst explicitFilters = options?.filters?.length ? [...new Set(options.filters)] : undefined;\n\t\t// Every account-wide read goes through our own facet search — there is deliberately no SDK\n\t\t// `getPullRequestsForUser` fallback. It could express neither a state set, nor exact relationships (its\n\t\t// `involves:` is a different question), nor the full projection, so which reads it could serve depended on\n\t\t// the options, and the two routes disagreed on more than they had to: only this one applies the Launchpad\n\t\t// ignored/included repository and organization qualifiers, so the same read returned different pull\n\t\t// requests depending on options that were supposed to affect only projection or relationship. With no\n\t\t// state and no filters this emits a single facet with no relationship qualifier, which is GitHub's own\n\t\t// `involves:@me` and `is:open` default — the same question the fallback asked, now on one route.\n\t\tconst github = await this.authenticationService.apis.github;\n\t\tif (github == null) return undefined;\n\n\t\tconst requestedStates: PullRequestStateFilter[] =\n\t\t\toptions?.state != null && options.state.length > 0 ? [...new Set(options.state)] : ['open'];\n\t\tconst facets =\n\t\t\texplicitFilters?.length != null\n\t\t\t\t? requestedStates.flatMap(state =>\n\t\t\t\t\t\texplicitFilters.map(filter => ({\n\t\t\t\t\t\t\tkey: `${state}:${filter}`,\n\t\t\t\t\t\t\tstate: state,\n\t\t\t\t\t\t\tsearch: gitHubPullRequestRelationshipQualifiers[filter],\n\t\t\t\t\t\t})),\n\t\t\t\t\t)\n\t\t\t\t: requestedStates.flatMap(state => [\n\t\t\t\t\t\t{ key: state, state: state, search: undefined },\n\t\t\t\t\t\t...(options?.includeReviewRequested === true\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tkey: `${state}:${PullRequestFilter.ReviewRequested}`,\n\t\t\t\t\t\t\t\t\t\tstate: state,\n\t\t\t\t\t\t\t\t\t\tsearch: gitHubPullRequestRelationshipQualifiers[\n\t\t\t\t\t\t\t\t\t\t\tPullRequestFilter.ReviewRequested\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t: []),\n\t\t\t\t\t]);\n\t\tconst cursors = parsePullRequestFacetCursor(options?.cursor);\n\t\tconst hasResumableFacetCursor = Object.keys(cursors).length !== 0;\n\t\tconst facetsWithCursor = facets.filter(facet => cursors[facet.key] != null);\n\t\t// The first call has no cursor, so query every requested state. A continuation only happens after a\n\t\t// prior page reported `more:true`, whose bundle carries a cursor for each facet still in flight;\n\t\t// facets absent from the bundle are exhausted, so re-querying them from scratch would refetch the\n\t\t// same PRs (duplicated by the dedup-free sweep) and waste an API call per page. Query only the\n\t\t// states that still have a cursor, but degrade a malformed/empty cursor bundle, or one that doesn't\n\t\t// apply to the current requested states, to the first page rather than returning an empty page.\n\t\tconst facetsToQuery =\n\t\t\toptions?.cursor != null && hasResumableFacetCursor && facetsWithCursor.length !== 0\n\t\t\t\t? facetsWithCursor\n\t\t\t\t: facets;\n\t\tconst results = await Promise.allSettled(\n\t\t\tfacetsToQuery.map(async facet => ({\n\t\t\t\tkey: facet.key,\n\t\t\t\tresult: await github.searchMyPullRequestsPage(this, toTokenWithInfo(this.id, session), {\n\t\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t\t\tstate: facet.state,\n\t\t\t\t\tcursor: cursors[facet.key],\n\t\t\t\t\tsummary: options?.summary,\n\t\t\t\t\t...(facet.search != null ? { search: facet.search, includeDefaultInvolvement: false } : undefined),\n\t\t\t\t}),\n\t\t\t})),\n\t\t);\n\t\tif (results.every(result => result.status === 'rejected')) {\n\t\t\tconst first = results[0];\n\t\t\tif (first?.status === 'rejected') throw first.reason;\n\t\t}\n\n\t\tconst values = new Map<string, ProviderPullRequest>();\n\t\tconst nextCursors: GitHubPullRequestFacetCursor = {};\n\t\tconst failures = [];\n\t\tlet hasMore = false;\n\t\tlet truncated = false;\n\t\tlet structuralIncompleteness = false;\n\t\tlet unkeyedPullRequest = 0;\n\t\tfor (const outcome of results) {\n\t\t\tif (outcome.status === 'rejected') {\n\t\t\t\tfailures.push(toCollectionScopeFailure({ providerId: this.id }, outcome.reason));\n\t\t\t\ttruncated = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst { key, result } = outcome.value;\n\t\t\tfor (const pr of result.values) {\n\t\t\t\tconst mapped = toProviderPullRequest(pr);\n\t\t\t\tconst identity = getProviderPullRequestIdentity(mapped) ?? `unkeyed:${unkeyedPullRequest++}`;\n\t\t\t\tif (!values.has(identity)) {\n\t\t\t\t\tvalues.set(identity, mapped);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (result.hasMore) {\n\t\t\t\tif (result.cursor == null || result.cursor === '{}' || result.cursor === cursors[key]) {\n\t\t\t\t\ttruncated = true;\n\t\t\t\t\tstructuralIncompleteness = true;\n\t\t\t\t} else {\n\t\t\t\t\thasMore = true;\n\t\t\t\t\tnextCursors[key] = result.cursor;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (result.truncated) {\n\t\t\t\ttruncated = true;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tvalues: [...values.values()],\n\t\t\tpaging: {\n\t\t\t\tmore: hasMore,\n\t\t\t\tcursor: hasMore ? JSON.stringify({ type: 'cursor', cursors: nextCursors }) : '{}',\n\t\t\t\ttruncated: truncated || undefined,\n\t\t\t},\n\t\t\t...(failures.length || structuralIncompleteness\n\t\t\t\t? {\n\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\tcompleteness: 'partial' as const,\n\t\t\t\t\t\t\t...(failures.length ? { failures: failures } : {}),\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: undefined),\n\t\t};\n\t}\n\n\tprotected override async searchProviderMyIssues(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepos?: GitHubRepositoryDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<IssueShape[] | undefined> {\n\t\treturn (await this.searchProviderMyIssuesWithTruncation(session, repos, cancellation))?.values;\n\t}\n\n\t/**\n\t * GitHub's account-wide issue search pages authored/assigned/mentioned independently behind one composite\n\t * cursor. This variant preserves that cursor and the provider's 1,000-result search ceiling signal.\n\t *\n\t * `options.filters` selects which of those three searches run, so a caller can narrow the union to just its\n\t * own slice (e.g. `[Assignee]` ⇒ `assignee:@me`). Omitted keeps GitHub's own definition of \"mine\" (all three).\n\t */\n\tprotected override async searchProviderMyIssuesWithTruncation(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepos?: GitHubRepositoryDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t\toptions?: SearchMyIssuesOptions,\n\t): Promise<{ values: IssueShape[]; truncated: boolean } | undefined> {\n\t\t// `includeAllAssignees` becomes `assignee:*`, which needs a scope to mean anything — with none it matches\n\t\t// millions of issues across all of GitHub rather than \"assigned to anyone in the user's world\". ANY scope\n\t\t// works (one repo, several, or an org), so this refuses only the genuinely unscoped read; the scoped\n\t\t// \"assigned to anyone over these repos\" request is served by `searchIssuesPage`.\n\t\tif ((repos == null || repos.length === 0) && options?.includeAllAssignees) {\n\t\t\tthrow new IntegrationReadUnavailableError(\n\t\t\t\tthis.name,\n\t\t\t\t'`includeAllAssignees` is not supported for account-wide issue reads; scope the read to repositories instead.',\n\t\t\t);\n\t\t}\n\n\t\treturn (await this.authenticationService.apis.github)?.searchMyIssues(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t{\n\t\t\t\trepos: repos?.map(r => `${r.owner}/${r.name}`),\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t\tincludeBody: true,\n\t\t\t\tincludeAllAssignees: options?.includeAllAssignees,\n\t\t\t\tcursor: options?.cursor,\n\t\t\t\tpageSize: options?.pageSize,\n\t\t\t\tsort: options?.sort,\n\t\t\t\tcategories: options?.filters?.length\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tauthored: options.filters.includes(IssueFilter.Author),\n\t\t\t\t\t\t\tassigned: options.filters.includes(IssueFilter.Assignee),\n\t\t\t\t\t\t\tmentioned: options.filters.includes(IssueFilter.Mention),\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t/**\n\t * Filtered pull-request search over a repository/organization or explicit current-user relationship scope. The\n\t * API client owns criteria sanitizing, facet unioning, ordering, and the composite cursor that carries GitHub's\n\t * result-ceiling signal across pages.\n\t */\n\tprotected override async searchProviderPullRequestsPage(\n\t\tsession: ProviderAuthenticationSession,\n\t\toptions: {\n\t\t\trepos?: ProviderRepoInput[];\n\t\t\torg?: string;\n\t\t\tcriteria?: PullRequestSearchCriteria;\n\t\t\tcursor?: string;\n\t\t\tpageSize?: number;\n\t\t\tsummary?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<ProviderPullRequestSearchPage | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.searchPullRequestsPage(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t{\n\t\t\t\trepos: options.repos?.map(r => `${r.namespace}/${r.name}`),\n\t\t\t\torg: options.org,\n\t\t\t\tcriteria: options.criteria,\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t\tcursor: options.cursor,\n\t\t\t\tpageSize: options.pageSize,\n\t\t\t\tsummary: options.summary,\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t/**\n\t * The filtered issue search: one GraphQL request per page, no forced relationship to the current user, and no\n\t * route through the SDK's repo-scoped read (whose over-limit recovery walk can spend up to 128 requests).\n\t *\n\t * The criteria → qualifier translation and the ordering guarantee live in the API client\n\t * (`GitHubApi.searchIssuesPage`), which is also where user input is sanitized so it can't inject a qualifier.\n\t */\n\tprotected override async searchProviderIssuesPage(\n\t\tsession: ProviderAuthenticationSession,\n\t\toptions: {\n\t\t\trepos?: ProviderRepoInput[];\n\t\t\torg?: string;\n\t\t\tcriteria?: IssueSearchCriteria;\n\t\t\tcursor?: string;\n\t\t\tpageSize?: number;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<ProviderIssueSearchPage | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.searchIssuesPage(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t{\n\t\t\t\t// `namespace` is the owner for GitHub, which is how a `repo:` qualifier names a repository.\n\t\t\t\trepos: options.repos?.map(r => `${r.namespace}/${r.name}`),\n\t\t\t\torg: options.org,\n\t\t\t\tcriteria: options.criteria,\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t\tincludeBody: true,\n\t\t\t\tcursor: options.cursor,\n\t\t\t\tpageSize: options.pageSize,\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t/**\n\t * Counts several scopes in ONE request. GitHub's `search` reports `issueCount` on a zero-node selection, so a\n\t * count preview costs no issue transfer — measured, 30 aliased counts are a single rate-limit point.\n\t */\n\tprotected override async countProviderIssues(\n\t\tsession: ProviderAuthenticationSession,\n\t\tscopes: readonly { repos?: ProviderRepoInput[]; org?: string; criteria?: IssueSearchCriteria }[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<(number | undefined)[] | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.countIssues(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\tscopes.map(s => ({\n\t\t\t\trepos: s.repos?.map(r => `${r.namespace}/${r.name}`),\n\t\t\t\torg: s.org,\n\t\t\t\tcriteria: s.criteria,\n\t\t\t})),\n\t\t\t{ baseUrl: this.apiBaseUrl },\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t/**\n\t * Resolves several issues by `(owner, repo, number)` in ONE request, by aliasing the point read rather than a\n\t * search — see {@link GitHubApi.getIssuesBatch} for why that distinction is the whole design.\n\t */\n\tprotected override async getProviderIssuesBatch(\n\t\tsession: ProviderAuthenticationSession,\n\t\tcoordinates: readonly { owner: string; repo: string; number: number }[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<(IssueShape | undefined)[] | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getIssuesBatch(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\tcoordinates,\n\t\t\t{ baseUrl: this.apiBaseUrl, includeBody: true },\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t/**\n\t * Counts several pull-request scopes in ONE request. Like {@link countProviderIssues}, GitHub's `search`\n\t * reports `issueCount` on a zero-node selection, so a count preview costs no pull-request transfer.\n\t */\n\tprotected override async countProviderPullRequests(\n\t\tsession: ProviderAuthenticationSession,\n\t\tscopes: readonly { repos?: ProviderRepoInput[]; org?: string; criteria?: PullRequestSearchCriteria }[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<(number | undefined)[] | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.countPullRequests(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\tscopes.map(s => ({\n\t\t\t\trepos: s.repos?.map(r => `${r.namespace}/${r.name}`),\n\t\t\t\torg: s.org,\n\t\t\t\tcriteria: s.criteria,\n\t\t\t})),\n\t\t\t{ baseUrl: this.apiBaseUrl },\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\tprotected override async searchProviderPullRequests(\n\t\tsession: ProviderAuthenticationSession,\n\t\tsearchQuery: string,\n\t\trepos?: GitHubRepositoryDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t\toptions?: SearchPullRequestsOptions,\n\t): Promise<PullRequest[] | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.searchPullRequests(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t{\n\t\t\t\tsearch: searchQuery,\n\t\t\t\trepos: repos?.map(r => `${r.owner}/${r.name}`),\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t\t...options,\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t/**\n\t * Stack membership for every stacked pull request in the repository, keyed by pull request number.\n\t *\n\t * List surfaces get their pull requests from the shared providers API, whose type carries no stack\n\t * membership, so the `stack`/`stackEntry` fields selected on the native per-pull-request reads never\n\t * reach them. This fills that gap in a single request for the whole repository, rather than a\n\t * per-pull-request enrichment that would scale with the list.\n\t *\n\t * `undefined` means unavailable (not enrolled in the preview, or not connected) as distinct from an\n\t * empty map, which means the repository genuinely has no stacks.\n\t */\n\toverride async getStacksByPullRequestNumber(\n\t\towner: string,\n\t\trepo: string,\n\t\tcancellation?: AbortSignal,\n\t): Promise<Map<number, PullRequestStackInfo> | undefined> {\n\t\t// The shared read path — it refreshes an expired session before use, which a bare `getSession()`\n\t\t// does not (it returns the cached session verbatim once one exists, expired or not).\n\t\tconst session = await this.resolveReadSession(undefined, undefined);\n\t\tif (session == null) return undefined;\n\n\t\tconst stacks = await (\n\t\t\tawait this.authenticationService.apis.github\n\t\t)?.getRepositoryStacks(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\towner,\n\t\t\trepo,\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t\tif (stacks == null) return undefined;\n\n\t\tconst byNumber = new Map<number, PullRequestStackInfo>();\n\t\tfor (const stack of stacks) {\n\t\t\t// Defensive: this is a public-preview payload reaching us through an unvalidated cast, and a\n\t\t\t// malformed entry must cost its own stack's badges, not the whole panel.\n\t\t\tconst members = stack?.pull_requests;\n\t\t\tconst baseRef = stack?.base?.ref;\n\t\t\tif (members == null || baseRef == null) continue;\n\n\t\t\t// `pull_requests` is ordered bottom to top, and `position` is 1-based from the bottom.\n\t\t\tmembers.forEach((pr, i) => {\n\t\t\t\tbyNumber.set(pr.number, {\n\t\t\t\t\tid: stack.id,\n\t\t\t\t\tnumber: stack.number,\n\t\t\t\t\tsize: members.length,\n\t\t\t\t\tposition: i + 1,\n\t\t\t\t\tbaseRef: baseRef,\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\treturn byNumber;\n\t}\n\n\tprotected override async mergeProviderPullRequest(\n\t\tsession: ProviderAuthenticationSession,\n\t\tpr: PullRequest,\n\t\toptions?: {\n\t\t\tmergeMethod?: PullRequestMergeMethod;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<boolean> {\n\t\tconst id = pr.nodeId;\n\t\tconst headRefSha = pr.refs?.head?.sha;\n\t\tif (id == null || headRefSha == null) return false;\n\n\t\tconst api = await this.authenticationService.apis.github;\n\n\t\t// GitHub rejects stacked pull requests on the legacy merge mutation, so they take the\n\t\t// asynchronous merge instead — which also lands every layer below this one.\n\t\tif (pr.stack != null) {\n\t\t\treturn (\n\t\t\t\t(await api?.mergeStackedPullRequest(\n\t\t\t\t\tthis,\n\t\t\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t\t\tpr.repository.owner,\n\t\t\t\t\tpr.repository.repo,\n\t\t\t\t\tNumber(pr.id),\n\t\t\t\t\theadRefSha,\n\t\t\t\t\t{\n\t\t\t\t\t\tmergeMethod: options?.mergeMethod,\n\t\t\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t\t\t},\n\t\t\t\t\tcancellation,\n\t\t\t\t)) ?? false\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\tapi?.mergePullRequest(\n\t\t\t\tthis,\n\t\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t\tid,\n\t\t\t\theadRefSha,\n\t\t\t\t{\n\t\t\t\t\tmergeMethod: options?.mergeMethod,\n\t\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t) ?? false\n\t\t);\n\t}\n\n\tprotected override async getProviderCurrentAccount(\n\t\tsession: ProviderAuthenticationSession,\n\t\toptions?: { avatarSize?: number },\n\t): Promise<Account | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getCurrentAccount(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t{\n\t\t\t\t...options,\n\t\t\t\tbaseUrl: this.apiBaseUrl,\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override getProviderPullRequestIdentityFromMaybeUrl(search: string): PullRequestUrlIdentity | undefined {\n\t\treturn getGitHubPullRequestIdentityFromMaybeUrl(search, this.id);\n\t}\n}\n\nexport class GitHubIntegration extends GitHubIntegrationBase<GitCloudHostIntegrationId.GitHub> {\n\treadonly authProvider = authProvider;\n\treadonly id = GitCloudHostIntegrationId.GitHub;\n\tprotected readonly key = this.id;\n\treadonly name: string = 'GitHub';\n\tget domain(): string {\n\t\treturn metadata.domain;\n\t}\n\n\tprotected override get apiBaseUrl(): string | undefined {\n\t\t// Undefined on purpose, NOT 'https://api.github.com'. `@gitkraken/provider-apis` treats this value as an\n\t\t// *enterprise* base and derives both endpoints from it by appending GitHub Enterprise's paths:\n\t\t// `getRESTBaseUrl` appends `/api/v3` and `getGraphQLEndpoint` appends `/api/graphql` (githubHelpers.ts).\n\t\t// Handing it the cloud host therefore built `https://api.github.com/api/graphql`, which GitHub answers\n\t\t// 404 — every cloud GraphQL read (orgs, repos, PR/issue search) failed as `not-found`. Omitting it is\n\t\t// what selects the cloud endpoints (`GITHUB_API_URL` / `GITHUB_GRAPHQL_API_URL`), so cloud must pass\n\t\t// nothing and only GHE passes its instance base.\n\t\treturn undefined;\n\t}\n\n\toverride access(): Promise<boolean> {\n\t\t// Always allow GitHub cloud integration access\n\t\treturn Promise.resolve(true);\n\t}\n\n\t// This is a special case for GitHub because we use VSCode's GitHub session, and it can be disconnected\n\t// outside of the extension.\n\toverride async refresh(): Promise<void> {\n\t\tconst authProvider = await this.authenticationService.get(this.authProvider.id);\n\t\tconst session = await authProvider.getSession(this.authProviderDescriptor);\n\t\tif (session == null && this.maybeConnected) {\n\t\t\tvoid this.disconnect({ silent: true });\n\t\t} else {\n\t\t\tif (session?.accessToken !== this._session?.accessToken) {\n\t\t\t\tthis._session = undefined;\n\t\t\t}\n\t\t\tsuper.refresh();\n\t\t}\n\t}\n}\n\nexport class GitHubEnterpriseIntegration extends GitHubIntegrationBase<GitSelfManagedHostIntegrationId.CloudGitHubEnterprise> {\n\treadonly authProvider = cloudEnterpriseAuthProvider;\n\treadonly id = GitSelfManagedHostIntegrationId.CloudGitHubEnterprise;\n\tprotected readonly key;\n\treadonly name = 'GitHub Enterprise';\n\tget domain(): string {\n\t\treturn this._domain;\n\t}\n\n\tprotected override get apiBaseUrl(): string {\n\t\treturn `https://${this._domain}/api/v3`;\n\t}\n\n\tconstructor(\n\t\tctx: IntegrationServiceContext,\n\t\tauthenticationService: IntegrationAuthenticationService,\n\t\tgetProvidersApi: () => Promise<ProvidersApi>,\n\t\tdidChangeConnection: Emitter<IntegrationConnectionChangeEvent>,\n\t\tprivate readonly _domain: string,\n\t) {\n\t\tsuper(ctx, authenticationService, getProvidersApi, didChangeConnection);\n\t\tthis.key = `${this.id}:${this.domain}` as const;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAwDA,SAAS,yBAAyB,OAA8C;CAC/E,IAAI,SAAS,QAAQ,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG,OAAO,CAAC;CAEhF,OAAO,OAAO,YACb,OAAO,QAAQ,KAAK,CAAC,CAAC,QACpB,CAAC,KAAK,YAAY,IAAI,WAAW,KAAK,OAAO,WAAW,YAAY,OAAO,WAAW,CACxF,CACD;AACD;AAEA,SAAS,4BAA4B,QAA0D;CAC9F,IAAI,CAAC,QAAQ,OAAO,CAAC;CAErB,IAAI;EACH,MAAM,SAAS,KAAK,MAAM,MAAM;EAChC,IAAI,UAAU,QAAQ,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,MAAM,KAAK,aAAa,QAAQ;GAClG,MAAM,UAAU;GAChB,IAAI,QAAQ,SAAS,UACpB,OAAO,yBAAyB,QAAQ,OAAO;E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,QAAQ,KAAK,EAAE;CAChE;AACD;AAEA,IAAa,oBAAb,cAAuC,sBAAwD;CAC9F,eAAwB;CACxB,KAAS;CACT,MAAyB,KAAK;CAC9B,OAAwB;CACxB,IAAI,SAAiB;EACpB,OAAO,SAAS;CACjB;CAEA,IAAuB,aAAiC,CASxD;CAEA,SAAoC;EAEnC,OAAO,QAAQ,QAAQ,IAAI;CAC5B;CAIA,MAAe,UAAyB;EAEvC,MAAM,UAAU,OAAM,MADK,KAAK,sBAAsB,IAAI,KAAK,aAAa,EAAE,EAAA,CAC3C,WAAW,KAAK,sBAAsB;EACzE,IAAI,WAAW,QAAQ,KAAK,gBAC3B,KAAU,WAAW,EAAE,QAAQ,KAAK,CAAC;OAC/B;GACN,IAAI,SAAS,gBAAgB,KAAK,UAAU,aAC3C,KAAK,WAAW,KAAA;GAEjB,MAAM,QAAQ;EACf;CACD;AACD;AAEA,IAAa,8BAAb,cAAiD,sBAA6E;CAkB3G;CAjBlB,eAAwB;CACxB,KAAS;CACT;CACA,OAAgB;CAChB,IAAI,SAAiB;EACpB,OAAO,KAAK;CACb;CAEA,IAAuB,aAAqB;EAC3C,OAAO,WAAW,KAAK,QAAQ;CAChC;CAEA,YACC,KACA,uBACA,iBACA,qBACA,SACC;EACD,MAAM,KAAK,uBAAuB,iBAAiB,mBAAmB;EAFrD,KAAA,UAAA;EAGjB,KAAK,MAAM,GAAG,KAAK,GAAG,GAAG,KAAK;CAC/B;AACD"}
1
+ {"version":3,"file":"github.js","names":[],"sources":["../../../../../plus/integrations/src/providers/github.ts"],"sourcesContent":["import { gitHubPullRequestRelationshipQualifiers } from '@gitlens/git-github/api/pullRequestSearchQuery.js';\nimport type { Account, UnidentifiedAuthor } from '@gitlens/git/models/author.js';\nimport type { DefaultBranch } from '@gitlens/git/models/defaultBranch.js';\nimport type { Issue, IssueSearchCriteria, IssueShape } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequest } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type {\n\tPullRequest,\n\tPullRequestMergeMethod,\n\tPullRequestSearchCriteria,\n\tPullRequestStackInfo,\n\tPullRequestState,\n\tPullRequestStateFilter,\n} from '@gitlens/git/models/pullRequest.js';\nimport type { RepositoryMetadata } from '@gitlens/git/models/repositoryMetadata.js';\nimport type { RepositoryDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport { getGitHubNoReplyAddressParts } from '@gitlens/git/remotes/github.js';\nimport type { PullRequestUrlIdentity } from '@gitlens/git/utils/pullRequest.utils.js';\nimport type { Emitter } from '@gitlens/utils/event.js';\nimport { batch } from '@gitlens/utils/promise.js';\nimport type { IntegrationAuthenticationProviderDescriptor } from '../authentication/integrationAuthenticationProvider.js';\nimport type { IntegrationAuthenticationService } from '../authentication/integrationAuthenticationService.js';\nimport type { ProviderAuthenticationSession } from '../authentication/models.js';\nimport { toTokenWithInfo } from '../authentication/models.js';\nimport { toCollectionScopeFailure } from '../collectionMetadata.js';\nimport { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId } from '../constants.js';\nimport type { IntegrationServiceContext } from '../context.js';\nimport { IntegrationReadUnavailableError } from '../errors.js';\nimport type { IntegrationConnectionChangeEvent } from '../integrationService.js';\nimport type { SearchMyPullRequestsOptions, SearchPullRequestsOptions } from '../models/gitHostIntegration.js';\nimport { GitHostIntegration } from '../models/gitHostIntegration.js';\nimport type {\n\tProviderIssueSearchPage,\n\tProviderPullRequestCount,\n\tProviderPullRequestSearchPage,\n\tSearchMyIssuesOptions,\n} from '../models/integration.js';\nimport type { GitHubIntegrationIds } from './github/github.utils.js';\nimport { getGitHubPullRequestIdentityFromMaybeUrl } from './github/github.utils.js';\nimport type {\n\tProviderApiPagedResult,\n\tProviderHierarchyResult,\n\tProviderOrganization,\n\tProviderPullRequest,\n\tProviderRepoInput,\n\tProviderRepository,\n} from './models.js';\nimport {\n\tgetProviderPullRequestIdentity,\n\tIssueFilter,\n\tprovidersMetadata,\n\tPullRequestFilter,\n\ttoProviderPullRequest,\n} from './models.js';\nimport type { ProvidersApi } from './providersApi.js';\n\ntype GitHubPullRequestFacetCursor = Record<string, string>;\n\nfunction toPullRequestFacetCursor(value: unknown): GitHubPullRequestFacetCursor {\n\tif (value == null || typeof value !== 'object' || Array.isArray(value)) return {};\n\n\treturn Object.fromEntries(\n\t\tObject.entries(value).filter(\n\t\t\t([key, cursor]) => key.length !== 0 && typeof cursor === 'string' && cursor.length !== 0,\n\t\t),\n\t);\n}\n\nfunction parsePullRequestFacetCursor(cursor: string | undefined): GitHubPullRequestFacetCursor {\n\tif (!cursor) return {};\n\n\ttry {\n\t\tconst parsed = JSON.parse(cursor) as unknown;\n\t\tif (parsed != null && typeof parsed === 'object' && !Array.isArray(parsed) && 'cursors' in parsed) {\n\t\t\tconst wrapped = parsed as { type?: unknown; cursors?: unknown };\n\t\t\tif (wrapped.type === 'cursor') {\n\t\t\t\treturn toPullRequestFacetCursor(wrapped.cursors);\n\t\t\t}\n\t\t}\n\n\t\treturn toPullRequestFacetCursor(parsed);\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nconst metadata = providersMetadata[GitCloudHostIntegrationId.GitHub];\nconst authProvider: IntegrationAuthenticationProviderDescriptor = Object.freeze({\n\tid: metadata.id,\n\tscopes: metadata.scopes,\n});\n\nconst cloudEnterpriseMetadata = providersMetadata[GitSelfManagedHostIntegrationId.CloudGitHubEnterprise];\nconst cloudEnterpriseAuthProvider: IntegrationAuthenticationProviderDescriptor = Object.freeze({\n\tid: cloudEnterpriseMetadata.id,\n\tscopes: cloudEnterpriseMetadata.scopes,\n});\n\nexport type GitHubRepositoryDescriptor = RepositoryDescriptor;\n\n/** How many per-login SSH signing-key lookups to run concurrently, to avoid a request burst that trips rate limiting. */\nconst sshSigningKeyResolveBatchSize = 10;\n\nabstract class GitHubIntegrationBase<ID extends GitHubIntegrationIds> extends GitHostIntegration<\n\tID,\n\tGitHubRepositoryDescriptor\n> {\n\t/**\n\t * Base URL handed to `@gitkraken/provider-apis`, which derives BOTH the REST and the GraphQL endpoint from it\n\t * by appending GitHub Enterprise's paths. Only a GHE instance base belongs here; cloud passes `undefined`,\n\t * the sole value that selects the cloud endpoints (see the cloud subclass).\n\t */\n\tprotected abstract apiBaseUrlFor(session: ProviderAuthenticationSession): string | undefined;\n\n\tprotected override async getProviderAccountForCommit(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\trev: string,\n\t\toptions?: {\n\t\t\tavatarSize?: number;\n\t\t},\n\t): Promise<Account | UnidentifiedAuthor | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getAccountForCommit(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\trev,\n\t\t\t{\n\t\t\t\t...options,\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderAccountForEmail(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\temail: string,\n\t\toptions?: {\n\t\t\tavatarSize?: number;\n\t\t},\n\t): Promise<Account | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getAccountForEmail(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\temail,\n\t\t\t{\n\t\t\t\t...options,\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderSshSigningKeysForEmails(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\temails: string[],\n\t): Promise<Map<string, string[]>> {\n\t\tconst result = new Map<string, string[]>();\n\n\t\tconst api = await this.authenticationService.apis.github;\n\t\tif (api == null) return result;\n\n\t\tconst token = toTokenWithInfo(this.id, session);\n\n\t\t// Resolve each email to a login: GitHub noreply addresses encode it locally; the rest are resolved in a single\n\t\t// batched GraphQL request rather than one round-trip per email.\n\t\tconst loginByEmail = new Map<string, string>();\n\t\tconst toResolve: string[] = [];\n\t\tfor (const email of emails) {\n\t\t\tconst login = getGitHubNoReplyAddressParts(email)?.login;\n\t\t\tif (login != null) {\n\t\t\t\tloginByEmail.set(email.toLowerCase(), login);\n\t\t\t} else {\n\t\t\t\ttoResolve.push(email);\n\t\t\t}\n\t\t}\n\n\t\tif (toResolve.length) {\n\t\t\tconst resolved = await api.getAccountsForEmails(this, token, toResolve, {\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t});\n\t\t\tfor (const [emailLower, login] of resolved) {\n\t\t\t\tloginByEmail.set(emailLower, login);\n\t\t\t}\n\t\t}\n\n\t\t// Fetch signing keys once per distinct login (REST has no batch endpoint), in bounded batches rather than firing\n\t\t// all lookups at once, to avoid a request burst that could trip secondary rate limiting. Then map keys to each email.\n\t\tconst keysByLogin = new Map<string, string[]>();\n\t\tawait batch([...new Set(loginByEmail.values())], sshSigningKeyResolveBatchSize, async login => {\n\t\t\tconst keys = await api.getUserSshSigningKeys(this, token, login, { baseUrl: this.apiBaseUrlFor(session) });\n\t\t\tkeysByLogin.set(\n\t\t\t\tlogin,\n\t\t\t\tkeys.map(k => k.key),\n\t\t\t);\n\t\t});\n\n\t\tfor (const [emailLower, login] of loginByEmail) {\n\t\t\tresult.set(emailLower, keysByLogin.get(login) ?? []);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tprotected override async getProviderDefaultBranch(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t): Promise<DefaultBranch | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getDefaultBranch(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderLinkedIssueOrPullRequest(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\t{ id }: { id: string; key: string },\n\t): Promise<IssueOrPullRequest | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getIssueOrPullRequest(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\tNumber(id),\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderIssue(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\tid: string,\n\t): Promise<Issue | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getIssue(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\tNumber(id),\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t\tincludeBody: true,\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderPullRequest(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\tid: string,\n\t): Promise<PullRequest | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getPullRequest(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\tparseInt(id, 10),\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderPullRequestForBranch(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\tbranch: string,\n\t\toptions?: {\n\t\t\tavatarSize?: number;\n\t\t\tinclude?: PullRequestState[];\n\t\t},\n\t): Promise<PullRequest | undefined> {\n\t\tconst { include, ...opts } = options ?? {};\n\n\t\tconst toGitHubPullRequestState = (await import(/* webpackChunkName: \"integrations\" */ './github/models.js'))\n\t\t\t.toGitHubPullRequestState;\n\t\treturn (await this.authenticationService.apis.github)?.getPullRequestForBranch(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\tbranch,\n\t\t\t{\n\t\t\t\t...opts,\n\t\t\t\tinclude: include?.map(s => toGitHubPullRequestState(s)),\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderPullRequestForCommit(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\trev: string,\n\t): Promise<PullRequest | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getPullRequestForCommit(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\trev,\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override async getProviderRepositoryMetadata(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepo: GitHubRepositoryDescriptor,\n\t\tcancellation?: AbortSignal,\n\t): Promise<RepositoryMetadata | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getRepositoryMetadata(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\trepo.owner,\n\t\t\trepo.name,\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\tprotected override async getProviderOrganizationsForUser(\n\t\tsession: ProviderAuthenticationSession,\n\t): Promise<ProviderHierarchyResult<ProviderOrganization> | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\tconst result = await api.getGitHubOrgsForCurrentUser(toTokenWithInfo(this.id, session), {\n\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t});\n\t\tconst webUrl =\n\t\t\tthis.id === GitSelfManagedHostIntegrationId.CloudGitHubEnterprise\n\t\t\t\t? this.getSelfManagedInstallationUrl(session)\n\t\t\t\t: `https://${this.domain}`;\n\t\treturn {\n\t\t\tvalues: result.values.map(o => ({\n\t\t\t\tid: o.id,\n\t\t\t\tproviderId: this.id,\n\t\t\t\tname: o.username,\n\t\t\t\turl: `${webUrl}/${o.username}`,\n\t\t\t})),\n\t\t\t...(result.truncated ? { truncated: true } : {}),\n\t\t\t...(result.metadata != null ? { metadata: result.metadata } : {}),\n\t\t};\n\t}\n\n\tprotected override async getProviderRepositoriesForOrg(\n\t\tsession: ProviderAuthenticationSession,\n\t\torg: string,\n\t\toptions?: { cursor?: string },\n\t): Promise<ProviderHierarchyResult<ProviderRepository> | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\treturn api.getReposForOrg(toTokenWithInfo(this.id, session), org, {\n\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\tcursor: options?.cursor,\n\t\t});\n\t}\n\n\tprotected override async getProviderRepositoriesForUser(\n\t\tsession: ProviderAuthenticationSession,\n\t\toptions?: { cursor?: string },\n\t): Promise<ProviderHierarchyResult<ProviderRepository> | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\t// `/user/repos` with the full affiliation set: the user's own repos, collaborations, and org-member\n\t\t// repos — matching gkcli's org-less `provider repos github` walk (not every repo of every org).\n\t\treturn api.getReposForCurrentUser(toTokenWithInfo(this.id, session), {\n\t\t\taffiliations: ['owner', 'collaborator', 'organization_member'],\n\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\tcursor: options?.cursor,\n\t\t});\n\t}\n\n\tpublic override async getRepoInfo(repo: {\n\t\towner: string;\n\t\tname: string;\n\t\tproject?: string;\n\t\tconnectionId?: string;\n\t}): Promise<ProviderRepository | undefined> {\n\t\tconst api = await this.getProvidersApi();\n\t\t// `connectionId` targets a specific account (multi-account); omitted reads the primary.\n\t\tconst session = await this.resolveReadSession(repo.connectionId, undefined);\n\t\tif (session == null) return undefined;\n\n\t\t// `apiBaseUrlFor` is undefined for cloud (which is what selects the cloud endpoints) and the GHE instance base\n\t\t// for enterprise (inherited override).\n\t\treturn api.getRepo(toTokenWithInfo(this.id, session), repo.owner, repo.name, repo.project, {\n\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t});\n\t}\n\n\tprotected override async searchProviderMyPullRequests(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepos?: GitHubRepositoryDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t\toptions?: SearchMyPullRequestsOptions,\n\t): Promise<PullRequest[] | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.searchMyPullRequests(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t{\n\t\t\t\trepos: repos?.map(r => `${r.owner}/${r.name}`),\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t\tsilent: options?.silent,\n\t\t\t\tstate: options?.state,\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\tprotected override async getProviderMyPullRequestsForUser(\n\t\tsession: ProviderAuthenticationSession,\n\t\toptions?: {\n\t\t\tstate?: PullRequestStateFilter[];\n\t\t\tcursor?: string;\n\t\t\tincludeReviewRequested?: boolean;\n\t\t\tfilters?: PullRequestFilter[];\n\t\t\tsummary?: boolean;\n\t\t},\n\t): Promise<ProviderApiPagedResult<ProviderPullRequest> | undefined> {\n\t\tconst explicitFilters = options?.filters?.length ? [...new Set(options.filters)] : undefined;\n\t\t// Every account-wide read goes through our own facet search — there is deliberately no SDK\n\t\t// `getPullRequestsForUser` fallback. It could express neither a state set, nor exact relationships (its\n\t\t// `involves:` is a different question), nor the full projection, so which reads it could serve depended on\n\t\t// the options, and the two routes disagreed on more than they had to: only this one applies the Launchpad\n\t\t// ignored/included repository and organization qualifiers, so the same read returned different pull\n\t\t// requests depending on options that were supposed to affect only projection or relationship. With no\n\t\t// state and no filters this emits a single facet with no relationship qualifier, which is GitHub's own\n\t\t// `involves:@me` and `is:open` default — the same question the fallback asked, now on one route.\n\t\tconst github = await this.authenticationService.apis.github;\n\t\tif (github == null) return undefined;\n\n\t\tconst requestedStates: PullRequestStateFilter[] =\n\t\t\toptions?.state != null && options.state.length > 0 ? [...new Set(options.state)] : ['open'];\n\t\tconst facets =\n\t\t\texplicitFilters?.length != null\n\t\t\t\t? requestedStates.flatMap(state =>\n\t\t\t\t\t\texplicitFilters.map(filter => ({\n\t\t\t\t\t\t\tkey: `${state}:${filter}`,\n\t\t\t\t\t\t\tstate: state,\n\t\t\t\t\t\t\tsearch: gitHubPullRequestRelationshipQualifiers[filter],\n\t\t\t\t\t\t})),\n\t\t\t\t\t)\n\t\t\t\t: requestedStates.flatMap(state => [\n\t\t\t\t\t\t{ key: state, state: state, search: undefined },\n\t\t\t\t\t\t...(options?.includeReviewRequested === true\n\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tkey: `${state}:${PullRequestFilter.ReviewRequested}`,\n\t\t\t\t\t\t\t\t\t\tstate: state,\n\t\t\t\t\t\t\t\t\t\tsearch: gitHubPullRequestRelationshipQualifiers[\n\t\t\t\t\t\t\t\t\t\t\tPullRequestFilter.ReviewRequested\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t: []),\n\t\t\t\t\t]);\n\t\tconst cursors = parsePullRequestFacetCursor(options?.cursor);\n\t\tconst hasResumableFacetCursor = Object.keys(cursors).length !== 0;\n\t\tconst facetsWithCursor = facets.filter(facet => cursors[facet.key] != null);\n\t\t// The first call has no cursor, so query every requested state. A continuation only happens after a\n\t\t// prior page reported `more:true`, whose bundle carries a cursor for each facet still in flight;\n\t\t// facets absent from the bundle are exhausted, so re-querying them from scratch would refetch the\n\t\t// same PRs (duplicated by the dedup-free sweep) and waste an API call per page. Query only the\n\t\t// states that still have a cursor, but degrade a malformed/empty cursor bundle, or one that doesn't\n\t\t// apply to the current requested states, to the first page rather than returning an empty page.\n\t\tconst facetsToQuery =\n\t\t\toptions?.cursor != null && hasResumableFacetCursor && facetsWithCursor.length !== 0\n\t\t\t\t? facetsWithCursor\n\t\t\t\t: facets;\n\t\tconst results = await Promise.allSettled(\n\t\t\tfacetsToQuery.map(async facet => ({\n\t\t\t\tkey: facet.key,\n\t\t\t\tresult: await github.searchMyPullRequestsPage(this, toTokenWithInfo(this.id, session), {\n\t\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t\t\tstate: facet.state,\n\t\t\t\t\tcursor: cursors[facet.key],\n\t\t\t\t\tsummary: options?.summary,\n\t\t\t\t\t...(facet.search != null ? { search: facet.search, includeDefaultInvolvement: false } : undefined),\n\t\t\t\t}),\n\t\t\t})),\n\t\t);\n\t\tif (results.every(result => result.status === 'rejected')) {\n\t\t\tconst first = results[0];\n\t\t\tif (first?.status === 'rejected') throw first.reason;\n\t\t}\n\n\t\tconst values = new Map<string, ProviderPullRequest>();\n\t\tconst nextCursors: GitHubPullRequestFacetCursor = {};\n\t\tconst failures = [];\n\t\tlet hasMore = false;\n\t\tlet truncated = false;\n\t\tlet structuralIncompleteness = false;\n\t\tlet unkeyedPullRequest = 0;\n\t\tfor (const outcome of results) {\n\t\t\tif (outcome.status === 'rejected') {\n\t\t\t\tfailures.push(toCollectionScopeFailure({ providerId: this.id }, outcome.reason));\n\t\t\t\ttruncated = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst { key, result } = outcome.value;\n\t\t\tfor (const pr of result.values) {\n\t\t\t\tconst mapped = toProviderPullRequest(pr);\n\t\t\t\tconst identity = getProviderPullRequestIdentity(mapped) ?? `unkeyed:${unkeyedPullRequest++}`;\n\t\t\t\tif (!values.has(identity)) {\n\t\t\t\t\tvalues.set(identity, mapped);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (result.hasMore) {\n\t\t\t\tif (result.cursor == null || result.cursor === '{}' || result.cursor === cursors[key]) {\n\t\t\t\t\ttruncated = true;\n\t\t\t\t\tstructuralIncompleteness = true;\n\t\t\t\t} else {\n\t\t\t\t\thasMore = true;\n\t\t\t\t\tnextCursors[key] = result.cursor;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (result.truncated) {\n\t\t\t\ttruncated = true;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tvalues: [...values.values()],\n\t\t\tpaging: {\n\t\t\t\tmore: hasMore,\n\t\t\t\tcursor: hasMore ? JSON.stringify({ type: 'cursor', cursors: nextCursors }) : '{}',\n\t\t\t\ttruncated: truncated || undefined,\n\t\t\t},\n\t\t\t...(failures.length || structuralIncompleteness\n\t\t\t\t? {\n\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\tcompleteness: 'partial' as const,\n\t\t\t\t\t\t\t...(failures.length ? { failures: failures } : {}),\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: undefined),\n\t\t};\n\t}\n\n\tprotected override async searchProviderMyIssues(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepos?: GitHubRepositoryDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<IssueShape[] | undefined> {\n\t\treturn (await this.searchProviderMyIssuesWithTruncation(session, repos, cancellation))?.values;\n\t}\n\n\t/**\n\t * GitHub's account-wide issue search pages authored/assigned/mentioned independently behind one composite\n\t * cursor. This variant preserves that cursor and the provider's 1,000-result search ceiling signal.\n\t *\n\t * `options.filters` selects which of those three searches run, so a caller can narrow the union to just its\n\t * own slice (e.g. `[Assignee]` ⇒ `assignee:@me`). Omitted keeps GitHub's own definition of \"mine\" (all three).\n\t */\n\tprotected override async searchProviderMyIssuesWithTruncation(\n\t\tsession: ProviderAuthenticationSession,\n\t\trepos?: GitHubRepositoryDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t\toptions?: SearchMyIssuesOptions,\n\t): Promise<{ values: IssueShape[]; truncated: boolean } | undefined> {\n\t\t// `includeAllAssignees` becomes `assignee:*`, which needs a scope to mean anything — with none it matches\n\t\t// millions of issues across all of GitHub rather than \"assigned to anyone in the user's world\". ANY scope\n\t\t// works (one repo, several, or an org), so this refuses only the genuinely unscoped read; the scoped\n\t\t// \"assigned to anyone over these repos\" request is served by `searchIssuesPage`.\n\t\tif ((repos == null || repos.length === 0) && options?.includeAllAssignees) {\n\t\t\tthrow new IntegrationReadUnavailableError(\n\t\t\t\tthis.name,\n\t\t\t\t'`includeAllAssignees` is not supported for account-wide issue reads; scope the read to repositories instead.',\n\t\t\t);\n\t\t}\n\n\t\treturn (await this.authenticationService.apis.github)?.searchMyIssues(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t{\n\t\t\t\trepos: repos?.map(r => `${r.owner}/${r.name}`),\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t\tincludeBody: true,\n\t\t\t\tincludeAllAssignees: options?.includeAllAssignees,\n\t\t\t\tcursor: options?.cursor,\n\t\t\t\tpageSize: options?.pageSize,\n\t\t\t\tsort: options?.sort,\n\t\t\t\tcategories: options?.filters?.length\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tauthored: options.filters.includes(IssueFilter.Author),\n\t\t\t\t\t\t\tassigned: options.filters.includes(IssueFilter.Assignee),\n\t\t\t\t\t\t\tmentioned: options.filters.includes(IssueFilter.Mention),\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t/**\n\t * Filtered pull-request search over a repository/organization or explicit current-user relationship scope. The\n\t * API client owns criteria sanitizing, facet unioning, ordering, and the composite cursor that carries GitHub's\n\t * result-ceiling signal across pages.\n\t */\n\tprotected override async searchProviderPullRequestsPage(\n\t\tsession: ProviderAuthenticationSession,\n\t\toptions: {\n\t\t\trepos?: ProviderRepoInput[];\n\t\t\torg?: string;\n\t\t\tcriteria?: PullRequestSearchCriteria;\n\t\t\tcursor?: string;\n\t\t\tpageSize?: number;\n\t\t\tsummary?: boolean;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<ProviderPullRequestSearchPage | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.searchPullRequestsPage(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t{\n\t\t\t\trepos: options.repos?.map(r => `${r.namespace}/${r.name}`),\n\t\t\t\torg: options.org,\n\t\t\t\tcriteria: options.criteria,\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t\tcursor: options.cursor,\n\t\t\t\tpageSize: options.pageSize,\n\t\t\t\tsummary: options.summary,\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t/**\n\t * The filtered issue search: one GraphQL request per page, no forced relationship to the current user, and no\n\t * route through the SDK's repo-scoped read (whose over-limit recovery walk can spend up to 128 requests).\n\t *\n\t * The criteria → qualifier translation and the ordering guarantee live in the API client\n\t * (`GitHubApi.searchIssuesPage`), which is also where user input is sanitized so it can't inject a qualifier.\n\t */\n\tprotected override async searchProviderIssuesPage(\n\t\tsession: ProviderAuthenticationSession,\n\t\toptions: {\n\t\t\trepos?: ProviderRepoInput[];\n\t\t\torg?: string;\n\t\t\tcriteria?: IssueSearchCriteria;\n\t\t\tcursor?: string;\n\t\t\tpageSize?: number;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<ProviderIssueSearchPage | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.searchIssuesPage(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t{\n\t\t\t\t// `namespace` is the owner for GitHub, which is how a `repo:` qualifier names a repository.\n\t\t\t\trepos: options.repos?.map(r => `${r.namespace}/${r.name}`),\n\t\t\t\torg: options.org,\n\t\t\t\tcriteria: options.criteria,\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t\tincludeBody: true,\n\t\t\t\tcursor: options.cursor,\n\t\t\t\tpageSize: options.pageSize,\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t/**\n\t * Counts several scopes in ONE request. GitHub's `search` reports `issueCount` on a zero-node selection, so a\n\t * count preview costs no issue transfer — measured, 30 aliased counts are a single rate-limit point.\n\t */\n\tprotected override async countProviderIssues(\n\t\tsession: ProviderAuthenticationSession,\n\t\tscopes: readonly { repos?: ProviderRepoInput[]; org?: string; criteria?: IssueSearchCriteria }[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<(number | undefined)[] | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.countIssues(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\tscopes.map(s => ({\n\t\t\t\trepos: s.repos?.map(r => `${r.namespace}/${r.name}`),\n\t\t\t\torg: s.org,\n\t\t\t\tcriteria: s.criteria,\n\t\t\t})),\n\t\t\t{ baseUrl: this.apiBaseUrlFor(session) },\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t/**\n\t * Resolves several issues by `(owner, repo, number)` in ONE request, by aliasing the point read rather than a\n\t * search — see {@link GitHubApi.getIssuesBatch} for why that distinction is the whole design.\n\t */\n\tprotected override async getProviderIssuesBatch(\n\t\tsession: ProviderAuthenticationSession,\n\t\tcoordinates: readonly { owner: string; repo: string; number: number }[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<(IssueShape | undefined)[] | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getIssuesBatch(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\tcoordinates,\n\t\t\t{ baseUrl: this.apiBaseUrlFor(session), includeBody: true },\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t/**\n\t * Counts several pull-request scopes in ONE request. Like {@link countProviderIssues}, GitHub's `search`\n\t * reports `issueCount` on a zero-node selection, so a count preview costs no pull-request transfer.\n\t */\n\tprotected override async countProviderPullRequests(\n\t\tsession: ProviderAuthenticationSession,\n\t\tscopes: readonly { repos?: ProviderRepoInput[]; org?: string; criteria?: PullRequestSearchCriteria }[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<ProviderPullRequestCount[] | undefined> {\n\t\tconst counts = await (\n\t\t\tawait this.authenticationService.apis.github\n\t\t)?.countPullRequests(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\tscopes.map(s => ({\n\t\t\t\trepos: s.repos?.map(r => `${r.namespace}/${r.name}`),\n\t\t\t\torg: s.org,\n\t\t\t\tcriteria: s.criteria,\n\t\t\t})),\n\t\t\t{ baseUrl: this.apiBaseUrlFor(session) },\n\t\t\tcancellation,\n\t\t);\n\t\t// `issueCount` is the search's own total, never a floor, so no slot is a lower bound.\n\t\treturn counts?.map(count => ({ count: count }));\n\t}\n\n\tprotected override async searchProviderPullRequests(\n\t\tsession: ProviderAuthenticationSession,\n\t\tsearchQuery: string,\n\t\trepos?: GitHubRepositoryDescriptor[],\n\t\tcancellation?: AbortSignal,\n\t\toptions?: SearchPullRequestsOptions,\n\t): Promise<PullRequest[] | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.searchPullRequests(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t{\n\t\t\t\tsearch: searchQuery,\n\t\t\t\trepos: repos?.map(r => `${r.owner}/${r.name}`),\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t\t...options,\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t}\n\n\t/**\n\t * Stack membership for every stacked pull request in the repository, keyed by pull request number.\n\t *\n\t * List surfaces get their pull requests from the shared providers API, whose type carries no stack\n\t * membership, so the `stack`/`stackEntry` fields selected on the native per-pull-request reads never\n\t * reach them. This fills that gap in a single request for the whole repository, rather than a\n\t * per-pull-request enrichment that would scale with the list.\n\t *\n\t * `undefined` means unavailable (not enrolled in the preview, or not connected) as distinct from an\n\t * empty map, which means the repository genuinely has no stacks.\n\t */\n\toverride async getStacksByPullRequestNumber(\n\t\towner: string,\n\t\trepo: string,\n\t\tcancellation?: AbortSignal,\n\t): Promise<Map<number, PullRequestStackInfo> | undefined> {\n\t\t// The shared read path — it refreshes an expired session before use, which a bare `getSession()`\n\t\t// does not (it returns the cached session verbatim once one exists, expired or not).\n\t\tconst session = await this.resolveReadSession(undefined, undefined);\n\t\tif (session == null) return undefined;\n\n\t\tconst stacks = await (\n\t\t\tawait this.authenticationService.apis.github\n\t\t)?.getRepositoryStacks(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\towner,\n\t\t\trepo,\n\t\t\t{\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t},\n\t\t\tcancellation,\n\t\t);\n\t\tif (stacks == null) return undefined;\n\n\t\tconst byNumber = new Map<number, PullRequestStackInfo>();\n\t\tfor (const stack of stacks) {\n\t\t\t// Defensive: this is a public-preview payload reaching us through an unvalidated cast, and a\n\t\t\t// malformed entry must cost its own stack's badges, not the whole panel.\n\t\t\tconst members = stack?.pull_requests;\n\t\t\tconst baseRef = stack?.base?.ref;\n\t\t\tif (members == null || baseRef == null) continue;\n\n\t\t\t// `pull_requests` is ordered bottom to top, and `position` is 1-based from the bottom.\n\t\t\tmembers.forEach((pr, i) => {\n\t\t\t\tbyNumber.set(pr.number, {\n\t\t\t\t\tid: stack.id,\n\t\t\t\t\tnumber: stack.number,\n\t\t\t\t\tsize: members.length,\n\t\t\t\t\tposition: i + 1,\n\t\t\t\t\tbaseRef: baseRef,\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\treturn byNumber;\n\t}\n\n\tprotected override async mergeProviderPullRequest(\n\t\tsession: ProviderAuthenticationSession,\n\t\tpr: PullRequest,\n\t\toptions?: {\n\t\t\tmergeMethod?: PullRequestMergeMethod;\n\t\t},\n\t\tcancellation?: AbortSignal,\n\t): Promise<boolean> {\n\t\tconst id = pr.nodeId;\n\t\tconst headRefSha = pr.refs?.head?.sha;\n\t\tif (id == null || headRefSha == null) return false;\n\n\t\tconst api = await this.authenticationService.apis.github;\n\n\t\t// GitHub rejects stacked pull requests on the legacy merge mutation, so they take the\n\t\t// asynchronous merge instead — which also lands every layer below this one.\n\t\tif (pr.stack != null) {\n\t\t\treturn (\n\t\t\t\t(await api?.mergeStackedPullRequest(\n\t\t\t\t\tthis,\n\t\t\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t\t\tpr.repository.owner,\n\t\t\t\t\tpr.repository.repo,\n\t\t\t\t\tNumber(pr.id),\n\t\t\t\t\theadRefSha,\n\t\t\t\t\t{\n\t\t\t\t\t\tmergeMethod: options?.mergeMethod,\n\t\t\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t\t\t},\n\t\t\t\t\tcancellation,\n\t\t\t\t)) ?? false\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\tapi?.mergePullRequest(\n\t\t\t\tthis,\n\t\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t\tid,\n\t\t\t\theadRefSha,\n\t\t\t\t{\n\t\t\t\t\tmergeMethod: options?.mergeMethod,\n\t\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t\t},\n\t\t\t\tcancellation,\n\t\t\t) ?? false\n\t\t);\n\t}\n\n\tprotected override async getProviderCurrentAccount(\n\t\tsession: ProviderAuthenticationSession,\n\t\toptions?: { avatarSize?: number },\n\t): Promise<Account | undefined> {\n\t\treturn (await this.authenticationService.apis.github)?.getCurrentAccount(\n\t\t\tthis,\n\t\t\ttoTokenWithInfo(this.id, session),\n\t\t\t{\n\t\t\t\t...options,\n\t\t\t\tbaseUrl: this.apiBaseUrlFor(session),\n\t\t\t},\n\t\t);\n\t}\n\n\tprotected override getProviderPullRequestIdentityFromMaybeUrl(search: string): PullRequestUrlIdentity | undefined {\n\t\treturn getGitHubPullRequestIdentityFromMaybeUrl(search, this.id);\n\t}\n}\n\nexport class GitHubIntegration extends GitHubIntegrationBase<GitCloudHostIntegrationId.GitHub> {\n\treadonly authProvider = authProvider;\n\treadonly id = GitCloudHostIntegrationId.GitHub;\n\tprotected readonly key = this.id;\n\treadonly name: string = 'GitHub';\n\tget domain(): string {\n\t\treturn metadata.domain;\n\t}\n\n\tprotected override apiBaseUrlFor(_session: ProviderAuthenticationSession): string | undefined {\n\t\t// Undefined on purpose, NOT 'https://api.github.com'. `@gitkraken/provider-apis` treats this value as an\n\t\t// *enterprise* base and derives both endpoints from it by appending GitHub Enterprise's paths:\n\t\t// `getRESTBaseUrl` appends `/api/v3` and `getGraphQLEndpoint` appends `/api/graphql` (githubHelpers.ts).\n\t\t// Handing it the cloud host therefore built `https://api.github.com/api/graphql`, which GitHub answers\n\t\t// 404 — every cloud GraphQL read (orgs, repos, PR/issue search) failed as `not-found`. Omitting it is\n\t\t// what selects the cloud endpoints (`GITHUB_API_URL` / `GITHUB_GRAPHQL_API_URL`), so cloud must pass\n\t\t// nothing and only GHE passes its instance base.\n\t\treturn undefined;\n\t}\n\n\toverride access(): Promise<boolean> {\n\t\t// Always allow GitHub cloud integration access\n\t\treturn Promise.resolve(true);\n\t}\n\n\t// This is a special case for GitHub because we use VSCode's GitHub session, and it can be disconnected\n\t// outside of the extension.\n\toverride async refresh(): Promise<void> {\n\t\tconst authProvider = await this.authenticationService.get(this.authProvider.id);\n\t\tconst session = await authProvider.getSession(this.authProviderDescriptor);\n\t\tif (session == null && this.maybeConnected) {\n\t\t\tvoid this.disconnect({ silent: true });\n\t\t} else {\n\t\t\tif (session?.accessToken !== this._session?.accessToken) {\n\t\t\t\tthis._session = undefined;\n\t\t\t}\n\t\t\tsuper.refresh();\n\t\t}\n\t}\n}\n\nexport class GitHubEnterpriseIntegration extends GitHubIntegrationBase<GitSelfManagedHostIntegrationId.CloudGitHubEnterprise> {\n\treadonly authProvider = cloudEnterpriseAuthProvider;\n\treadonly id = GitSelfManagedHostIntegrationId.CloudGitHubEnterprise;\n\tprotected readonly key;\n\treadonly name = 'GitHub Enterprise';\n\tget domain(): string {\n\t\treturn this._domain;\n\t}\n\n\tprotected override apiBaseUrlFor(session: ProviderAuthenticationSession): string {\n\t\treturn this.getSelfManagedApiBaseUrl(session);\n\t}\n\n\tconstructor(\n\t\tctx: IntegrationServiceContext,\n\t\tauthenticationService: IntegrationAuthenticationService,\n\t\tgetProvidersApi: () => Promise<ProvidersApi>,\n\t\tdidChangeConnection: Emitter<IntegrationConnectionChangeEvent>,\n\t\tprivate readonly _domain: string,\n\t) {\n\t\tsuper(ctx, authenticationService, getProvidersApi, didChangeConnection);\n\t\tthis.key = `${this.id}:${this.domain}` as const;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAyDA,SAAS,yBAAyB,OAA8C;CAC/E,IAAI,SAAS,QAAQ,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG,OAAO,CAAC;CAEhF,OAAO,OAAO,YACb,OAAO,QAAQ,KAAK,CAAC,CAAC,QACpB,CAAC,KAAK,YAAY,IAAI,WAAW,KAAK,OAAO,WAAW,YAAY,OAAO,WAAW,CACxF,CACD;AACD;AAEA,SAAS,4BAA4B,QAA0D;CAC9F,IAAI,CAAC,QAAQ,OAAO,CAAC;CAErB,IAAI;EACH,MAAM,SAAS,KAAK,MAAM,MAAM;EAChC,IAAI,UAAU,QAAQ,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,MAAM,KAAK,aAAa,QAAQ;GAClG,MAAM,UAAU;GAChB,IAAI,QAAQ,SAAS,UACpB,OAAO,yBAAyB,QAAQ,OAAO;EAEjD;EAEA,OAAO,yBAAyB,MAAM;CACvC,QAAQ;EACP,OAAO,CAAC;CACT;AACD;AAEA,MAAM,WAAW,kBAAA;AACjB,MAAM,eAA4D,OAAO,OAAO;CAC/E,IAAI,SAAS;CACb,QAAQ,SAAS;AAClB,CAAC;AAED,MAAM,0BAA0B,kBAAA;AAChC,MAAM,8BAA2E,OAAO,OAAO;CAC9F,IAAI,wBAAwB;CAC5B,QAAQ,wBAAwB;AACjC,CAAC;;AAKD,MAAM,gCAAgC;AAEtC,IAAe,wBAAf,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ACtD,MACA,gBAAgB,KAAK,IAAI,OAAO,GAChC;GACC,GAAG;GACH,SAAS,KAAK,cAAc,OAAO;EACpC,CACD;CACD;CAEA,2CAA8D,QAAoD;EACjH,OAAO,yCAAyC,QAAQ,KAAK,EAAE;CAChE;AACD;AAEA,IAAa,oBAAb,cAAuC,sBAAwD;CAC9F,eAAwB;CACxB,KAAS;CACT,MAAyB,KAAK;CAC9B,OAAwB;CACxB,IAAI,SAAiB;EACpB,OAAO,SAAS;CACjB;CAEA,cAAiC,UAA6D,CAS9F;CAEA,SAAoC;EAEnC,OAAO,QAAQ,QAAQ,IAAI;CAC5B;CAIA,MAAe,UAAyB;EAEvC,MAAM,UAAU,OAAM,MADK,KAAK,sBAAsB,IAAI,KAAK,aAAa,EAAE,EAAA,CAC3C,WAAW,KAAK,sBAAsB;EACzE,IAAI,WAAW,QAAQ,KAAK,gBAC3B,KAAU,WAAW,EAAE,QAAQ,KAAK,CAAC;OAC/B;GACN,IAAI,SAAS,gBAAgB,KAAK,UAAU,aAC3C,KAAK,WAAW,KAAA;GAEjB,MAAM,QAAQ;EACf;CACD;AACD;AAEA,IAAa,8BAAb,cAAiD,sBAA6E;CAkB3G;CAjBlB,eAAwB;CACxB,KAAS;CACT;CACA,OAAgB;CAChB,IAAI,SAAiB;EACpB,OAAO,KAAK;CACb;CAEA,cAAiC,SAAgD;EAChF,OAAO,KAAK,yBAAyB,OAAO;CAC7C;CAEA,YACC,KACA,uBACA,iBACA,qBACA,SACC;EACD,MAAM,KAAK,uBAAuB,iBAAiB,mBAAmB;EAFrD,KAAA,UAAA;EAGjB,KAAK,MAAM,GAAG,KAAK,GAAG,GAAG,KAAK;CAC/B;AACD"}
@@ -32,7 +32,9 @@ type GitLabPullRequestAssociation = 'assigned' | 'authored' | 'reviewRequested';
32
32
  export declare const gitLabAssociationForFilter: Record<PullRequestFilter, GitLabPullRequestAssociation | undefined>;
33
33
  export type GitLabRepositoryDescriptor = RepositoryDescriptor;
34
34
  declare abstract class GitLabIntegrationBase<ID extends GitLabIntegrationIds> extends GitHostIntegration<ID, GitLabRepositoryDescriptor> {
35
- protected abstract get apiBaseUrl(): string;
35
+ protected abstract apiBaseUrlFor(session: ProviderAuthenticationSession): string;
36
+ /** The installation base the PAT-based reads take on self-hosted GitLab; gitlab.com passes none. */
37
+ protected enterpriseBaseUrlFor(session: ProviderAuthenticationSession): string | undefined;
36
38
  /** Self-hosted GitLab uses PAT semantics and a domain-based API base; gitlab.com does not. */
37
39
  protected get isEnterprise(): boolean;
38
40
  protected getProviderAccountForCommit(session: ProviderAuthenticationSession, repo: GitLabRepositoryDescriptor, rev: string, options?: {
@@ -115,7 +117,7 @@ export declare class GitLabIntegration extends GitLabIntegrationBase<GitCloudHos
115
117
  protected readonly key = GitCloudHostIntegrationId.GitLab;
116
118
  readonly name: string;
117
119
  get domain(): string;
118
- protected get apiBaseUrl(): string;
120
+ protected apiBaseUrlFor(_session: ProviderAuthenticationSession): string;
119
121
  access(): Promise<boolean>;
120
122
  }
121
123
  export declare class GitLabSelfHostedIntegration extends GitLabIntegrationBase<GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted> {
@@ -125,7 +127,7 @@ export declare class GitLabSelfHostedIntegration extends GitLabIntegrationBase<G
125
127
  protected readonly key: `cloud-gitlab-self-hosted:${string}`;
126
128
  readonly name = "GitLab Self-Hosted";
127
129
  get domain(): string;
128
- protected get apiBaseUrl(): string;
130
+ protected apiBaseUrlFor(session: ProviderAuthenticationSession): string;
129
131
  constructor(ctx: IntegrationServiceContext, authenticationService: IntegrationAuthenticationService, getProvidersApi: () => Promise<ProvidersApi>, didChangeConnection: Emitter<IntegrationConnectionChangeEvent>, _domain: string);
130
132
  }
131
133
  //#endregion