@gitkraken/core-gitlens 0.4.100 → 0.4.101

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 (65) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/dist/plus/integrations/errors.d.ts.map +1 -1
  3. package/dist/plus/integrations/errors.js +6 -2
  4. package/dist/plus/integrations/errors.js.map +1 -1
  5. package/dist/plus/integrations/integrationService.d.ts +8 -5
  6. package/dist/plus/integrations/integrationService.d.ts.map +1 -1
  7. package/dist/plus/integrations/integrationService.js +20 -652
  8. package/dist/plus/integrations/integrationService.js.map +1 -1
  9. package/dist/plus/integrations/models/gitHostIntegration.d.ts +10 -17
  10. package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
  11. package/dist/plus/integrations/models/gitHostIntegration.js +38 -88
  12. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  13. package/dist/plus/integrations/models/issuesIntegration.d.ts +4 -21
  14. package/dist/plus/integrations/models/issuesIntegration.d.ts.map +1 -1
  15. package/dist/plus/integrations/models/issuesIntegration.js +5 -47
  16. package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
  17. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  18. package/dist/plus/integrations/reads/broaden.d.ts +20 -0
  19. package/dist/plus/integrations/reads/broaden.d.ts.map +1 -0
  20. package/dist/plus/integrations/reads/broaden.js +326 -0
  21. package/dist/plus/integrations/reads/broaden.js.map +1 -0
  22. package/dist/plus/integrations/reads/context.d.ts +22 -0
  23. package/dist/plus/integrations/reads/context.d.ts.map +1 -1
  24. package/dist/plus/integrations/reads/hierarchy.d.ts +1 -1
  25. package/dist/plus/integrations/reads/hierarchy.d.ts.map +1 -1
  26. package/dist/plus/integrations/reads/hierarchy.js +109 -137
  27. package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
  28. package/dist/plus/integrations/reads/hierarchy.utils.d.ts +25 -1
  29. package/dist/plus/integrations/reads/hierarchy.utils.d.ts.map +1 -1
  30. package/dist/plus/integrations/reads/hierarchy.utils.js +43 -0
  31. package/dist/plus/integrations/reads/hierarchy.utils.js.map +1 -1
  32. package/dist/plus/integrations/reads/issueTracker.d.ts +1 -1
  33. package/dist/plus/integrations/reads/issueTracker.d.ts.map +1 -1
  34. package/dist/plus/integrations/reads/issueTracker.js +13 -25
  35. package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
  36. package/dist/plus/integrations/reads/issues.d.ts +2 -2
  37. package/dist/plus/integrations/reads/issues.d.ts.map +1 -1
  38. package/dist/plus/integrations/reads/issues.js.map +1 -1
  39. package/dist/plus/integrations/reads/pullRequests.d.ts +1 -1
  40. package/dist/plus/integrations/reads/pullRequests.d.ts.map +1 -1
  41. package/dist/plus/integrations/reads/pullRequests.js +1 -1
  42. package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
  43. package/dist/plus/integrations/reads/resolveRepository.d.ts +25 -0
  44. package/dist/plus/integrations/reads/resolveRepository.d.ts.map +1 -0
  45. package/dist/plus/integrations/reads/resolveRepository.js +235 -0
  46. package/dist/plus/integrations/reads/resolveRepository.js.map +1 -0
  47. package/dist/plus/integrations/reads/sweeps.d.ts +11 -0
  48. package/dist/plus/integrations/reads/sweeps.d.ts.map +1 -0
  49. package/dist/plus/integrations/reads/sweeps.js +125 -0
  50. package/dist/plus/integrations/reads/sweeps.js.map +1 -0
  51. package/package.json +1 -1
  52. package/src/plus/integrations/errors.ts +6 -2
  53. package/src/plus/integrations/integrationService.ts +27 -801
  54. package/src/plus/integrations/models/gitHostIntegration.ts +71 -93
  55. package/src/plus/integrations/models/issuesIntegration.ts +5 -52
  56. package/src/plus/integrations/providers/azureDevOps.ts +1 -1
  57. package/src/plus/integrations/reads/broaden.ts +452 -0
  58. package/src/plus/integrations/reads/context.ts +24 -0
  59. package/src/plus/integrations/reads/hierarchy.ts +133 -153
  60. package/src/plus/integrations/reads/hierarchy.utils.ts +50 -1
  61. package/src/plus/integrations/reads/issueTracker.ts +15 -27
  62. package/src/plus/integrations/reads/issues.ts +4 -2
  63. package/src/plus/integrations/reads/pullRequests.ts +2 -9
  64. package/src/plus/integrations/reads/resolveRepository.ts +272 -0
  65. package/src/plus/integrations/reads/sweeps.ts +185 -0
@@ -1,13 +1,9 @@
1
- import type { CollectionMetadata } from '@gitkraken/provider-apis';
2
1
  import type { Account } from '../../git/models/author.js';
3
2
  import type { IssueShape } from '../../git/models/issue.js';
4
3
  import type { PullRequest, PullRequestShape, PullRequestStateFilter } from '../../git/models/pullRequest.js';
5
4
  import type { GitRemote } from '../../git/models/remote.js';
6
5
  import type { RemoteProviderId } from '../../git/models/remoteProvider.js';
7
- import type { IssueResourceDescriptor, ResourceDescriptor } from '../../git/models/resourceDescriptor.js';
8
- import type { RemoteProviderConfig } from '../../git/remotes/matcher.js';
9
- import { createRemoteProviderMatcher } from '../../git/remotes/matcher.js';
10
- import { parseGitRemoteUrl } from '../../git/utils/remote.utils.js';
6
+ import type { ResourceDescriptor } from '../../git/models/resourceDescriptor.js';
11
7
  import { gate } from '../../utils/decorators/gate.js';
12
8
  import { debug, trace } from '../../utils/decorators/log.js';
13
9
  import type { Disposable } from '../../utils/disposable.js';
@@ -16,8 +12,6 @@ import type { Event } from '../../utils/event.js';
16
12
  import { Emitter } from '../../utils/event.js';
17
13
  import { filterMap, flatten } from '../../utils/iterable.js';
18
14
  import { getScopedLogger } from '../../utils/logger.scoped.js';
19
- import type { PagedResult } from '../../utils/paging.js';
20
- import { mapBounded } from '../../utils/promise.js';
21
15
  import { CloudIntegrationService } from './authentication/cloudIntegrationService.js';
22
16
  import type { ConfiguredIntegrationsChangeEvent } from './authentication/configuredIntegrationService.js';
23
17
  import { ConfiguredIntegrationService } from './authentication/configuredIntegrationService.js';
@@ -32,7 +26,6 @@ import {
32
26
  isSupportedCloudIntegrationId,
33
27
  toIntegrationId,
34
28
  } from './authentication/models.js';
35
- import { mergeAssessmentInto } from './collectionMetadata.js';
36
29
  import type {
37
30
  CloudGitSelfManagedHostIntegrationIds,
38
31
  IntegrationIds,
@@ -42,16 +35,17 @@ import {
42
35
  GitCloudHostIntegrationId,
43
36
  GitSelfManagedHostIntegrationId,
44
37
  IssuesCloudHostIntegrationId,
45
- providerFanOutConcurrency,
46
38
  } from './constants.js';
47
- import type { AuthenticationSessionsChangeEvent, IntegrationServiceContext } from './context.js';
48
- import { AuthenticationError, RequestNotFoundError } from './errors.js';
39
+ import type {
40
+ AuthenticationSessionsChangeEvent,
41
+ IntegrationServiceContext,
42
+ IntegrationsRemoteConfig,
43
+ } from './context.js';
49
44
  import type {
50
45
  ClosedPullRequestSweepOptions,
51
46
  ListOrgsOptions,
52
47
  ListProjectsOptions,
53
48
  ProviderBroadenOrg,
54
- ProviderSweepTarget,
55
49
  PullRequestSweepOptions,
56
50
  } from './manager.js';
57
51
  import type { GitHostIntegration, SearchMyPullRequestsOptions } from './models/gitHostIntegration.js';
@@ -63,79 +57,37 @@ import type {
63
57
  IntegrationResult,
64
58
  } from './models/integration.js';
65
59
  import type { IssuesIntegration } from './models/issuesIntegration.js';
66
- import { isIssuesIntegration } from './models/issuesIntegration.js';
67
60
  import type { ApiClients } from './providers/apiClients.js';
68
61
  import { createApiClients } from './providers/apiClients.js';
69
62
  import type { GitHubApi } from './providers/github/github.js';
70
63
  import type {
64
+ IssueFilter,
71
65
  ProviderOrganization,
72
- ProviderPullRequest,
73
66
  ProviderReposInput,
74
- ProviderRepository,
75
67
  ProviderRepositoryShape,
76
68
  PullRequestFilter,
77
69
  } from './providers/models.js';
78
- import {
79
- fromProviderPullRequest,
80
- getProviderPullRequestIdentity,
81
- isAzureCloudDomain,
82
- isBitbucketCloudDomain,
83
- isGitHubDotCom,
84
- isGitLabDotCom,
85
- IssueFilter,
86
- PagingMode,
87
- providersMetadata,
88
- toProviderRepositoryShape,
89
- } from './providers/models.js';
70
+ import { providersMetadata } from './providers/models.js';
90
71
  import type { ProvidersApi } from './providers/providersApi.js';
91
- import { mergeCollectionMetadata, parsePageCursor } from './providers/utils/providerPaging.js';
92
- import { type ProviderReadContext } from './reads/context.js';
93
- import {
94
- getBroadenIssuesCursor,
95
- isBroadenIssuesOrgExhausted,
96
- parseIssueTrackerPageCursor,
97
- toBroadenIssuesCursor,
98
- toIssueTrackerPageCursor,
99
- } from './reads/cursors.js';
100
- import {
101
- drainPullRequests,
102
- drainRepositories,
103
- getCurrentAccountId,
104
- resolvePullRequestSweepTargets,
105
- runCaptured,
106
- } from './reads/drains.js';
107
- import {
108
- getSupportedFilters,
109
- resolveAccountWidePullRequestFilters,
110
- resolvePullRequestFilters,
111
- } from './reads/filters.js';
72
+ import { broadenIssues } from './reads/broaden.js';
73
+ import type { RepositoryResolutionContext } from './reads/context.js';
74
+ import { getSupportedFilters } from './reads/filters.js';
112
75
  import { listOrgs, listProjects, listRepos } from './reads/hierarchy.js';
113
- import { resourceMatchesOrg } from './reads/hierarchy.utils.js';
114
76
  import { listIssuesPage } from './reads/issues.js';
115
77
  import { listIssueTrackerIssuesPage } from './reads/issueTracker.js';
116
- import { resolveContinuation, toProviderPageInfo } from './reads/paging.js';
117
78
  import { listPullRequestsPage } from './reads/pullRequests.js';
118
- import {
119
- gitHostOnlySurfaceWarning,
120
- issuesUnsupportedWarning,
121
- noConnectionWarning,
122
- otherWarning,
123
- unsupportedAccountWidePullRequestFiltersWarning,
124
- unsupportedFiltersWarning,
125
- } from './reads/warnings.js';
79
+ import { resolveRepository } from './reads/resolveRepository.js';
80
+ import { sweepClosedPullRequests, sweepPullRequests } from './reads/sweeps.js';
81
+ import { noConnectionWarning } from './reads/warnings.js';
126
82
  import type {
127
83
  ConnectionStateChangeEvent,
128
84
  ProviderBroadenResult,
129
85
  ProviderPagedResult,
130
- ProviderPageInfo,
131
86
  ProviderResult,
132
87
  ProviderSweepResult,
133
88
  ProviderWarning,
134
- RepositoryIdentity,
135
- RepositoryResolution,
136
89
  ResolveRepositoryResult,
137
90
  } from './results.js';
138
- import { appendDedupedWarning, toProviderWarning } from './results.js';
139
91
  import type { Source } from './telemetry.js';
140
92
  import { hostFromDomain } from './utils/domain.utils.js';
141
93
  import {
@@ -143,13 +95,10 @@ import {
143
95
  getIntegrationIdForRemote,
144
96
  isCloudGitSelfManagedHostIntegrationId,
145
97
  isGitCloudHostIntegrationId,
146
- isGitHostIntegration,
147
98
  isGitSelfManagedHostIntegrationId,
148
- isIssuesHostIntegrationId,
149
99
  isNonExpiringZeroTokenIntegrationId,
150
100
  remoteProviderTypeForConfig,
151
101
  remoteProviderTypeForIntegration,
152
- warnOnMissingSessionForDomain,
153
102
  } from './utils/integration.utils.js';
154
103
 
155
104
  /** @internal Event emitted when an integration connection state changes */
@@ -159,7 +108,7 @@ export interface IntegrationConnectionChangeEvent extends ConnectionStateChangeE
159
108
 
160
109
  const maxSmallIntegerV8 = 2 ** 30 - 1; // Max number that can be stored in V8's smis (small integers)
161
110
 
162
- export class IntegrationService implements Disposable, ProviderReadContext {
111
+ export class IntegrationService implements Disposable, RepositoryResolutionContext {
163
112
  get onDidChange(): Event<ConfiguredIntegrationsChangeEvent> {
164
113
  return this.configuredIntegrationService.onDidChange;
165
114
  }
@@ -1143,156 +1092,7 @@ export class IntegrationService implements Disposable, ProviderReadContext {
1143
1092
  * honored only when `providerIds` resolves to a single provider (otherwise ambiguous).
1144
1093
  */
1145
1094
  async sweepPullRequests(options?: PullRequestSweepOptions): Promise<ProviderSweepResult<PullRequestShape>> {
1146
- const { targets, attributeUnavailableProviders } = resolvePullRequestSweepTargets(options);
1147
- const maxPages = options?.maxPages ?? 100;
1148
- const repos = options?.repos ?? [];
1149
-
1150
- const results = await mapBounded(targets, providerFanOutConcurrency, async target => {
1151
- const { providerId: id, connectionId, domain: requestedDomain } = target;
1152
- if (isIssuesHostIntegrationId(id)) {
1153
- return {
1154
- items: [] as PullRequestShape[],
1155
- warnings: [gitHostOnlySurfaceWarning(id, requestedDomain, connectionId, 'pull request sweeps')],
1156
- fetchFailed: true,
1157
- truncated: false,
1158
- providerId: id,
1159
- failedProvider: true,
1160
- };
1161
- }
1162
-
1163
- const integration = await this.getIntegrationForRead(id, connectionId, requestedDomain);
1164
- if (integration == null) {
1165
- // A requested connection that can't be resolved is a broken connection — surface it as a
1166
- // warning + fetchFailed rather than dropping the provider's slice silently.
1167
- const early = this.earlyReturnConnectionWarnings(id, connectionId, requestedDomain);
1168
- if (early.warnings.length === 0 && !attributeUnavailableProviders) return undefined;
1169
- return {
1170
- items: [] as PullRequestShape[],
1171
- warnings:
1172
- early.warnings.length !== 0
1173
- ? early.warnings
1174
- : [noConnectionWarning(id, requestedDomain, connectionId)],
1175
- fetchFailed: true,
1176
- truncated: false,
1177
- providerId: id,
1178
- failedProvider: true,
1179
- };
1180
- }
1181
-
1182
- if (!isGitHostIntegration(integration)) {
1183
- return {
1184
- items: [] as PullRequestShape[],
1185
- warnings: [gitHostOnlySurfaceWarning(id, requestedDomain, connectionId, 'pull request sweeps')],
1186
- fetchFailed: true,
1187
- truncated: false,
1188
- providerId: id,
1189
- failedProvider: true,
1190
- };
1191
- }
1192
-
1193
- await this.forceRefreshIfRequested(integration, options?.forceSync, connectionId);
1194
-
1195
- const domain = this.domainForRead(integration, id, connectionId, requestedDomain);
1196
- const accountWide = repos.length === 0;
1197
- const requestedFilters = target.filters ?? options?.filters;
1198
- const resolved = accountWide
1199
- ? resolveAccountWidePullRequestFilters(id, requestedFilters)
1200
- : resolvePullRequestFilters(id, requestedFilters);
1201
- if (resolved.unsupported) {
1202
- return {
1203
- items: [] as PullRequestShape[],
1204
- warnings: [
1205
- accountWide
1206
- ? unsupportedAccountWidePullRequestFiltersWarning(
1207
- id,
1208
- domain,
1209
- connectionId,
1210
- requestedFilters ?? [],
1211
- )
1212
- : unsupportedFiltersWarning(id, domain, connectionId),
1213
- ],
1214
- fetchFailed: true,
1215
- truncated: false,
1216
- providerId: id,
1217
- failedProvider: true,
1218
- };
1219
- }
1220
-
1221
- const drain = await drainPullRequests(
1222
- integration,
1223
- id,
1224
- domain,
1225
- repos,
1226
- options?.states,
1227
- resolved.filters,
1228
- accountWide ? (options?.includeReviewRequested ?? false) : false,
1229
- connectionId,
1230
- maxPages,
1231
- attributeUnavailableProviders,
1232
- );
1233
- const currentAccountId = drain.items.some(pr => pr.author != null)
1234
- ? await getCurrentAccountId(integration, connectionId)
1235
- : undefined;
1236
- // Normalize the raw provider-apis PRs to the GitLens-owned shape here, where the per-provider
1237
- // `integration` (the mapper's provider reference) is in scope; the aggregation below only sees drains.
1238
- return {
1239
- ...drain,
1240
- items: drain.items.map(pr =>
1241
- fromProviderPullRequest(pr, integration, { currentAccountId: currentAccountId }),
1242
- ),
1243
- providerId: id,
1244
- };
1245
- });
1246
-
1247
- const items: PullRequestShape[] = [];
1248
- const warnings: ProviderWarning[] = [];
1249
- const failedProviderIds = new Set<IntegrationIds>();
1250
- const incompleteProviderIds = new Set<IntegrationIds>();
1251
- let fetchFailed = false;
1252
- let truncated = false;
1253
- for (const drain of results) {
1254
- if (drain == null) {
1255
- continue;
1256
- }
1257
-
1258
- items.push(...drain.items);
1259
- for (const w of drain.warnings) {
1260
- appendDedupedWarning(warnings, w);
1261
- }
1262
- if (drain.fetchFailed) {
1263
- fetchFailed = true;
1264
- }
1265
- if (drain.failedProvider) {
1266
- failedProviderIds.add(drain.providerId);
1267
- } else if (drain.fetchFailed || drain.truncated) {
1268
- incompleteProviderIds.add(drain.providerId);
1269
- }
1270
- if (drain.truncated) {
1271
- truncated = true;
1272
- }
1273
- }
1274
-
1275
- return {
1276
- items: items,
1277
- warnings: warnings,
1278
- // `allPages` asserts completeness — it must be false when any provider truncated (a single-page
1279
- // account-wide read that couldn't confirm it drained everything) OR a drain aborted on a read
1280
- // failure (its slice is incomplete). Either way the sweep did not read every page.
1281
- page: {
1282
- currentPage: 1,
1283
- itemsPerPage: items.length,
1284
- allPages: !truncated && !fetchFailed,
1285
- truncated: truncated || undefined,
1286
- },
1287
- // A sweep drains every page itself and exposes no cursor to resume — so `hasMore` must be false even
1288
- // when the read was incomplete. Terminal incompleteness is expressed through `page.truncated` +
1289
- // `allPages: false` + warnings; setting `hasMore: true` here would make a consumer that drains while
1290
- // `hasMore` re-run the identical sweep forever with no cursor to advance.
1291
- hasMore: false,
1292
- fetchFailed: fetchFailed || undefined,
1293
- failedProviderIds: [...failedProviderIds],
1294
- incompleteProviderIds: [...incompleteProviderIds],
1295
- };
1095
+ return sweepPullRequests(this, options);
1296
1096
  }
1297
1097
 
1298
1098
  /**
@@ -1302,10 +1102,7 @@ export class IntegrationService implements Disposable, ProviderReadContext {
1302
1102
  async sweepClosedPullRequests(
1303
1103
  options?: ClosedPullRequestSweepOptions,
1304
1104
  ): Promise<ProviderSweepResult<PullRequestShape>> {
1305
- return this.sweepPullRequests({
1306
- ...options,
1307
- states: ['closed', 'merged'],
1308
- });
1105
+ return sweepClosedPullRequests(this, options);
1309
1106
  }
1310
1107
 
1311
1108
  /**
@@ -1325,371 +1122,7 @@ export class IntegrationService implements Disposable, ProviderReadContext {
1325
1122
  cursor?: string;
1326
1123
  forceSync?: boolean;
1327
1124
  }): Promise<ProviderBroadenResult<IssueShape>> {
1328
- const page = Math.max(1, Math.trunc(options.page ?? 1));
1329
-
1330
- // Kepler's existing contract persists only a page number. When no opaque continuation was supplied,
1331
- // advance through prior pages internally so cursor-only providers still return the requested page.
1332
- // Each recursive call below carries a cursor, so it bypasses this block and performs exactly one round.
1333
- if (options.cursor == null && page > 1) {
1334
- let cursor: string | undefined;
1335
- let previous: ProviderBroadenResult<IssueShape> | undefined;
1336
- const traversalWarnings: ProviderWarning[] = [];
1337
- const broadenedProviderIds = new Set<IntegrationIds>();
1338
- const failedProviderIds = new Set<IntegrationIds>();
1339
- const incompleteProviderIds = new Set<IntegrationIds>();
1340
- const mergeProviderAttribution = (result: ProviderBroadenResult<IssueShape>): void => {
1341
- for (const providerId of result.failedProviderIds) {
1342
- if (broadenedProviderIds.has(providerId) || result.broadenedProviderIds.includes(providerId)) {
1343
- incompleteProviderIds.add(providerId);
1344
- } else {
1345
- failedProviderIds.add(providerId);
1346
- }
1347
- }
1348
- for (const providerId of result.incompleteProviderIds) {
1349
- failedProviderIds.delete(providerId);
1350
- incompleteProviderIds.add(providerId);
1351
- }
1352
- for (const providerId of result.broadenedProviderIds) {
1353
- broadenedProviderIds.add(providerId);
1354
- if (failedProviderIds.delete(providerId)) {
1355
- incompleteProviderIds.add(providerId);
1356
- }
1357
- }
1358
- };
1359
- let traversalFetchFailed = false;
1360
- let traversalTruncated = false;
1361
- for (let currentPage = 1; currentPage < page; currentPage++) {
1362
- previous = await this.broadenIssues({
1363
- ...options,
1364
- page: currentPage,
1365
- cursor: cursor,
1366
- // A forced refresh belongs to the logical read, not every cursor-advancement round.
1367
- forceSync: currentPage === 1 ? options.forceSync : false,
1368
- });
1369
- for (const warning of previous.warnings) {
1370
- appendDedupedWarning(traversalWarnings, warning);
1371
- }
1372
- mergeProviderAttribution(previous);
1373
- traversalFetchFailed ||= previous.fetchFailed === true;
1374
- traversalTruncated ||= previous.page.truncated === true;
1375
- if (!previous.hasMore || previous.cursor == null) {
1376
- return {
1377
- items: [],
1378
- warnings: traversalWarnings,
1379
- page: {
1380
- currentPage: page,
1381
- itemsPerPage: 0,
1382
- truncated: traversalTruncated || undefined,
1383
- },
1384
- hasMore: false,
1385
- fetchFailed: traversalFetchFailed || undefined,
1386
- broadenedProviderIds: [...broadenedProviderIds],
1387
- failedProviderIds: [...failedProviderIds],
1388
- incompleteProviderIds: [...incompleteProviderIds],
1389
- fanOutCount: options.orgs.length,
1390
- };
1391
- }
1392
-
1393
- cursor = previous.cursor;
1394
- }
1395
-
1396
- const requested = await this.broadenIssues({ ...options, page: page, cursor: cursor, forceSync: false });
1397
- for (const warning of requested.warnings) {
1398
- appendDedupedWarning(traversalWarnings, warning);
1399
- }
1400
- mergeProviderAttribution(requested);
1401
- return {
1402
- ...requested,
1403
- warnings: traversalWarnings,
1404
- page: {
1405
- ...requested.page,
1406
- truncated: traversalTruncated || requested.page.truncated === true || undefined,
1407
- },
1408
- fetchFailed: traversalFetchFailed || requested.fetchFailed === true || undefined,
1409
- broadenedProviderIds: [...broadenedProviderIds],
1410
- failedProviderIds: [...failedProviderIds],
1411
- incompleteProviderIds: [...incompleteProviderIds],
1412
- };
1413
- }
1414
-
1415
- const results = await mapBounded(options.orgs, providerFanOutConcurrency, async org => {
1416
- const connectionId = org.connectionId;
1417
- const requestedDomain = org.domain;
1418
- const cursorDomain = hostFromDomain(requestedDomain) ?? requestedDomain;
1419
- // An org slice that yielded no issues and has nothing to continue: the org's identity (which the
1420
- // aggregation below keys the per-org cursor bundle by) plus why it produced nothing. `exhausted` marks
1421
- // an org a prior round already drained, so it stays skipped rather than being re-read from page 1.
1422
- const barrenSlice = (
1423
- warnings: ProviderWarning[],
1424
- flags?: { exhausted?: boolean; fetchFailed?: boolean; truncated?: boolean },
1425
- ) => ({
1426
- items: [] as IssueShape[],
1427
- warnings: warnings,
1428
- broadenedProviderIds: [] as IntegrationIds[],
1429
- providerId: org.providerId,
1430
- org: org.name,
1431
- connectionId: connectionId,
1432
- domain: cursorDomain,
1433
- nextCursor: undefined as string | undefined,
1434
- hasMore: false,
1435
- exhausted: flags?.exhausted ?? false,
1436
- fetchFailed: flags?.fetchFailed ?? false,
1437
- truncated: flags?.truncated ?? false,
1438
- });
1439
-
1440
- if (isIssuesHostIntegrationId(org.providerId)) {
1441
- return barrenSlice(
1442
- [gitHostOnlySurfaceWarning(org.providerId, requestedDomain, connectionId, 'issue broadening')],
1443
- { fetchFailed: true },
1444
- );
1445
- }
1446
-
1447
- const integration = await this.getIntegrationForRead(org.providerId, connectionId, requestedDomain);
1448
- if (integration == null) {
1449
- // A requested connection or domain that can't be resolved is a broken target — surface it as a
1450
- // warning + fetchFailed rather than dropping the org silently.
1451
- const early = this.earlyReturnConnectionWarnings(org.providerId, connectionId, requestedDomain);
1452
- return barrenSlice(
1453
- early.warnings.length > 0
1454
- ? early.warnings
1455
- : [noConnectionWarning(org.providerId, requestedDomain, connectionId)],
1456
- { fetchFailed: true },
1457
- );
1458
- }
1459
- if (!isGitHostIntegration(integration)) {
1460
- return barrenSlice(
1461
- [gitHostOnlySurfaceWarning(org.providerId, requestedDomain, connectionId, 'issue broadening')],
1462
- { fetchFailed: true },
1463
- );
1464
- }
1465
- // A git host whose issue tracker is deprecated (Bitbucket) exposes no issues here — surface a
1466
- // warning + fetchFailed and skip it (no repo drain), so broadening never serves a legacy source.
1467
- if (!integration.supportsIssues) {
1468
- return barrenSlice(
1469
- [
1470
- issuesUnsupportedWarning(
1471
- org.providerId,
1472
- this.domainForRead(integration, org.providerId, connectionId, requestedDomain),
1473
- connectionId,
1474
- ),
1475
- ],
1476
- { fetchFailed: true },
1477
- );
1478
- }
1479
-
1480
- // An org a prior round already drained must not be re-read: cursor-only providers would answer a
1481
- // fresh page-1 request with their first page again, duplicating issues across rounds. Skip it
1482
- // before any work (including the repo drain) and keep it marked exhausted so it stays skipped
1483
- // for the rest of the fan-out.
1484
- if (isBroadenIssuesOrgExhausted(options.cursor, org, options.orgs.length)) {
1485
- return barrenSlice([], { exhausted: true });
1486
- }
1487
-
1488
- await this.forceRefreshIfRequested(integration, options.forceSync, connectionId);
1489
-
1490
- const domain = this.domainForRead(integration, org.providerId, connectionId, requestedDomain);
1491
- const reposDrain = await drainRepositories(
1492
- integration,
1493
- org.providerId,
1494
- domain,
1495
- org.name,
1496
- undefined,
1497
- connectionId,
1498
- 100,
1499
- );
1500
- const warnings: ProviderWarning[] = [...reposDrain.warnings];
1501
- const fetchFailed = reposDrain.fetchFailed;
1502
- const truncated = reposDrain.truncated;
1503
-
1504
- const repos: ProviderReposInput = reposDrain.repos.map(r => ({ ...r }));
1505
- if (repos.length === 0) {
1506
- return barrenSlice(warnings, { fetchFailed: fetchFailed, truncated: truncated });
1507
- }
1508
-
1509
- // Broaden = "all visible": drop the assigned-to-me filter so unassigned issues are included.
1510
- const cursor = getBroadenIssuesCursor(options.cursor, org, page, options.orgs.length);
1511
- const issuesCaptured = await runCaptured(
1512
- org.providerId,
1513
- domain,
1514
- connectionId,
1515
- () =>
1516
- // Normalized shapes seam, uniform with listIssuesPage.
1517
- integration.getMyIssuesForReposAsShapesResult(
1518
- repos,
1519
- {
1520
- includeAllAssignees: true,
1521
- cursor: cursor,
1522
- },
1523
- connectionId,
1524
- ),
1525
- { warnOnMissingSession: true },
1526
- );
1527
- if (issuesCaptured.warning != null) {
1528
- warnings.push(issuesCaptured.warning);
1529
- }
1530
- const issuesAssessment = mergeAssessmentInto(
1531
- warnings,
1532
- org.providerId,
1533
- domain,
1534
- connectionId,
1535
- issuesCaptured.value?.metadata,
1536
- );
1537
- let issuesFetchFailed =
1538
- issuesAssessment.fetchFailed || (issuesCaptured.warning != null && issuesCaptured.value == null);
1539
- const items: IssueShape[] = [];
1540
- let hasMore = false;
1541
- let nextCursor: string | undefined;
1542
- let retryPage: number | undefined;
1543
- // Carry a truncation signal from the issue read too: a provider that couldn't confirm it drained
1544
- // a repo (`paging.truncated`) means this org's issues may be incomplete, on top of any repo-drain
1545
- // truncation already captured above.
1546
- let issuesTruncated = false;
1547
- if (issuesCaptured.value != null) {
1548
- items.push(...issuesCaptured.value.values);
1549
- const paged = toProviderPageInfo(issuesCaptured.value.values.length, issuesCaptured.value.paging);
1550
- // An org that reports another page but no usable cursor can't be resumed: it would neither be
1551
- // recorded in the composite cursor nor marked exhausted, so the next round would re-read its
1552
- // page 1 and repeat every issue. Treat it as terminal-but-incomplete (which also marks the org
1553
- // exhausted below, since `exhausted` keys off `!hasMore`).
1554
- const continuation = resolveContinuation(paged, undefined);
1555
- hasMore = continuation.hasMore;
1556
- nextCursor = continuation.cursor;
1557
- issuesTruncated = continuation.truncated || issuesAssessment.truncated;
1558
- } else if (issuesCaptured.warning != null || cursor != null) {
1559
- // Keep the exact position that failed. Without this retry cursor a multi-org continuation would
1560
- // omit this org from the bundle, then synthesize the next numbered page and silently skip the
1561
- // failed page. The synthesized page cursor is also actionable for a first-page cursor-only read:
1562
- // that provider ignores the page marker and retries its first page. A retry slot alone is NOT
1563
- // forward progress, though: advertising `hasMore` for a persistent failure would make an infinite
1564
- // query request it forever. Healthy sibling continuations set `hasMore` independently.
1565
- if (cursor != null) {
1566
- nextCursor = cursor;
1567
- if (issuesCaptured.warning == null) {
1568
- appendDedupedWarning(
1569
- warnings,
1570
- otherWarning(
1571
- org.providerId,
1572
- domain,
1573
- connectionId,
1574
- 'Issue continuation returned no result and must be retried',
1575
- ),
1576
- );
1577
- issuesFetchFailed = true;
1578
- issuesTruncated = true;
1579
- }
1580
- } else {
1581
- retryPage = page;
1582
- }
1583
- }
1584
-
1585
- return {
1586
- items: items,
1587
- warnings: warnings,
1588
- broadenedProviderIds: issuesCaptured.value != null ? [org.providerId] : ([] as IntegrationIds[]),
1589
- providerId: org.providerId,
1590
- org: org.name,
1591
- connectionId: connectionId,
1592
- domain: cursorDomain,
1593
- nextCursor: nextCursor,
1594
- retryPage: retryPage,
1595
- hasMore: hasMore,
1596
- // Exhausted once a successful read reports no more pages — recorded in the cursor so later
1597
- // rounds skip it while other orgs keep paging.
1598
- exhausted: issuesCaptured.value != null && !hasMore,
1599
- fetchFailed: fetchFailed || issuesFetchFailed,
1600
- truncated: truncated || issuesTruncated,
1601
- };
1602
- });
1603
-
1604
- const items: IssueShape[] = [];
1605
- const warnings: ProviderWarning[] = [];
1606
- const broadenedProviderIds = new Set<IntegrationIds>();
1607
- const problemProviderIds = new Set<IntegrationIds>();
1608
- const cursors: {
1609
- providerId: IntegrationIds;
1610
- org: string;
1611
- connectionId?: string;
1612
- domain?: string;
1613
- cursor?: string;
1614
- retryPage?: number;
1615
- }[] = [];
1616
- const exhausted: { providerId: IntegrationIds; org: string; connectionId?: string; domain?: string }[] = [];
1617
- let hasMore = false;
1618
- let fetchFailed = false;
1619
- let truncated = false;
1620
- for (const result of results) {
1621
- if (result == null) {
1622
- continue;
1623
- }
1624
-
1625
- items.push(...result.items);
1626
- warnings.push(...result.warnings);
1627
- for (const id of result.broadenedProviderIds) {
1628
- broadenedProviderIds.add(id);
1629
- }
1630
- const retryPage = 'retryPage' in result ? result.retryPage : undefined;
1631
- if (result.nextCursor != null || retryPage != null) {
1632
- cursors.push({
1633
- providerId: result.providerId,
1634
- org: result.org,
1635
- connectionId: result.connectionId,
1636
- domain: result.domain,
1637
- cursor: result.nextCursor,
1638
- retryPage: retryPage,
1639
- });
1640
- }
1641
- if (result.exhausted) {
1642
- exhausted.push({
1643
- providerId: result.providerId,
1644
- org: result.org,
1645
- connectionId: result.connectionId,
1646
- domain: result.domain,
1647
- });
1648
- }
1649
- if (result.hasMore) {
1650
- hasMore = true;
1651
- }
1652
- if (result.fetchFailed) {
1653
- fetchFailed = true;
1654
- }
1655
- if (result.truncated) {
1656
- truncated = true;
1657
- }
1658
- if (result.fetchFailed || result.truncated) {
1659
- problemProviderIds.add(result.providerId);
1660
- }
1661
- }
1662
-
1663
- const cursor = toBroadenIssuesCursor(cursors, exhausted, options.orgs.length);
1664
- const failedProviderIds: IntegrationIds[] = [];
1665
- const incompleteProviderIds: IntegrationIds[] = [];
1666
- for (const providerId of problemProviderIds) {
1667
- if (broadenedProviderIds.has(providerId)) {
1668
- incompleteProviderIds.push(providerId);
1669
- } else {
1670
- failedProviderIds.push(providerId);
1671
- }
1672
- }
1673
- return {
1674
- items: items,
1675
- warnings: warnings,
1676
- // `currentPage` is positional, per ProviderPageInfo.currentPage: this fan-out has no provider-reported
1677
- // page of its own (its cursor is a per-org bundle, not a page), so the position is the one the caller
1678
- // addressed — the `page` it supplied, or the page the internal traversal advanced to.
1679
- page: { currentPage: page, itemsPerPage: items.length, truncated: truncated || undefined },
1680
- // `hasMore` promises a resumable continuation, so it must be true ONLY when a real cursor was
1681
- // produced. Repo-drain truncation (a backstop hit with no persisted repo cursor) can't be resumed —
1682
- // re-invoking would re-drain the same repos and repeat issues — so it is surfaced as the terminal
1683
- // `page.truncated` incompleteness signal instead of `hasMore`, matching listRepos. Guard `hasMore`
1684
- // against a missing cursor so we never advertise a continuation the caller can't make.
1685
- hasMore: hasMore && cursor != null,
1686
- cursor: cursor,
1687
- fetchFailed: fetchFailed || undefined,
1688
- broadenedProviderIds: [...broadenedProviderIds],
1689
- failedProviderIds: failedProviderIds,
1690
- incompleteProviderIds: incompleteProviderIds,
1691
- fanOutCount: options.orgs.length,
1692
- };
1125
+ return broadenIssues(this, options);
1693
1126
  }
1694
1127
 
1695
1128
  /**
@@ -1710,224 +1143,17 @@ export class IntegrationService implements Disposable, ProviderReadContext {
1710
1143
  */
1711
1144
  domain?: string;
1712
1145
  }): Promise<ResolveRepositoryResult> {
1713
- const result = (status: RepositoryResolution['status']): ResolveRepositoryResult => ({
1714
- resolution: { status: status },
1715
- });
1716
-
1717
- const [scheme, parsedDomain, path] = parseGitRemoteUrl(options.remoteUrl);
1718
- const parsedHost = hostFromDomain(parsedDomain);
1719
- const explicitHost = hostFromDomain(options.host);
1720
- if (parsedHost != null && explicitHost != null && parsedHost !== explicitHost) {
1721
- return result('host-mismatch');
1722
- }
1723
-
1724
- const matcherDomain = parsedDomain || options.host || '';
1725
-
1726
- // An explicit cloud provider must agree with the remote's canonical cloud host. Without this guard the
1727
- // synthetic matcher below can reinterpret, for example, a gitlab.com URL as GitHub and then resolve a
1728
- // homonymous owner/repo through the wrong account. Match once without caller configs/synthetic entries;
1729
- // Azure's matcher also normalizes ssh.dev.azure.com and vs-ssh.visualstudio.com to their web host.
1730
- if (options.providerId != null && isGitCloudHostIntegrationId(options.providerId)) {
1731
- const nativeProvider = createRemoteProviderMatcher([])(options.remoteUrl, matcherDomain, path, scheme);
1732
- const nativeId = nativeProvider != null ? getIntegrationIdForRemote(nativeProvider) : undefined;
1733
- const nativeDomain = nativeProvider?.domain ?? matcherDomain;
1734
- const canonicalHost =
1735
- options.providerId === GitCloudHostIntegrationId.GitHub
1736
- ? isGitHubDotCom(nativeDomain)
1737
- : options.providerId === GitCloudHostIntegrationId.GitLab
1738
- ? isGitLabDotCom(nativeDomain)
1739
- : options.providerId === GitCloudHostIntegrationId.Bitbucket
1740
- ? isBitbucketCloudDomain(nativeDomain)
1741
- : isAzureCloudDomain(nativeDomain);
1742
- if (nativeId !== options.providerId || !canonicalHost) return result('host-mismatch');
1743
- }
1744
-
1745
- // Matcher configs: host remote configs (self-managed/custom domains) plus a synthetic entry for an
1746
- // explicit providerId + host, so a custom domain still maps to the right provider for path parsing.
1747
- const configs: RemoteProviderConfig[] = [];
1748
- for (const cfg of this.ctx.config.getRemoteConfigs()) {
1749
- const type = remoteProviderTypeForConfig(cfg.type);
1750
- if (type == null) continue;
1751
-
1752
- // Forward both domain- and regex-based custom remotes (carrying any protocol override), so a
1753
- // regex-configured host resolves instead of falling through to `unsupported`.
1754
- if (cfg.domain) {
1755
- configs.push({ type: type, domain: cfg.domain, protocol: cfg.protocol });
1756
- } else if (cfg.regex) {
1757
- configs.push({ type: type, regex: cfg.regex, protocol: cfg.protocol });
1758
- }
1759
- }
1760
- if (options.providerId != null) {
1761
- const type = remoteProviderTypeForIntegration(options.providerId);
1762
- const domain = parsedDomain || options.host;
1763
- if (type != null && domain) {
1764
- // The synthetic exact-domain entry is unshifted to the front, so it wins the match over the
1765
- // user's own config for the same host. Carry that config's protocol override across (matched by
1766
- // domain or regex, mirroring `ignoreSSLErrors`) so a self-managed host configured for a custom
1767
- // protocol — e.g. plain `http` — isn't silently downgraded to the provider default here.
1768
- const lowerDomain = domain.toLowerCase();
1769
- const protocol = configs.find(c => {
1770
- if (c.type !== type) return false;
1771
- if (c.domain != null) return c.domain.toLowerCase() === lowerDomain;
1772
-
1773
- // Truthy (not just non-null): an empty regex would compile to a match-everything pattern.
1774
- if (c.regex) {
1775
- try {
1776
- return new RegExp(c.regex, 'i').test(lowerDomain);
1777
- } catch {
1778
- return false;
1779
- }
1780
- }
1781
-
1782
- return false;
1783
- })?.protocol;
1784
- configs.unshift({ type: type, domain: domain, protocol: protocol });
1785
- }
1786
- }
1787
-
1788
- const provider = createRemoteProviderMatcher(configs)(options.remoteUrl, matcherDomain, path, scheme);
1789
- if (provider == null) return result('invalid-remote-url');
1790
-
1791
- let id = options.providerId ?? getIntegrationIdForRemote(provider);
1792
- // Custom Azure DevOps Server domains matched via getRemoteConfigs return undefined from
1793
- // getIntegrationIdForRemote because the provider is marked custom; map them to the server id so the
1794
- // project-scoped lookup uses that host's configured connection and API base URL.
1795
- if (id == null && provider.id === 'azure-devops' && provider.custom) {
1796
- id = GitSelfManagedHostIntegrationId.AzureDevOpsServer;
1797
- }
1798
- if (id == null) return result('unsupported-provider');
1799
-
1800
- const owner = provider.owner;
1801
- const name = provider.repoName;
1802
- if (owner == null || name == null) return result('invalid-remote-url');
1803
-
1804
- // On a self-managed host, resolve only against a TRUSTED host: the pinned connection's configured
1805
- // domain, the explicit `domain`, or — when neither was supplied — a configured host matching the
1806
- // remote's. That last case keeps `remoteUrl` (repository-supplied) out of the trusted path: it selects
1807
- // among hosts the user already authenticated and can never introduce a new one. Resolving `owner/repo`
1808
- // against some other host's account would, if that host has the same owner/repo, return a confidently
1809
- // wrong identity — and would seed the domain-keyed integration cache (never evicted before dispose) with
1810
- // an entry derived from repository data.
1811
- const urlHost = hostFromDomain(provider.domain);
1812
- // Normalize BOTH sides before comparing: a stored connection domain is usually a full URL
1813
- // (`https://git.example.com`) while `urlHost` is already a bare host, so a raw compare would fail on
1814
- // scheme/trailing-slash alone and wrongly reject a correctly-configured connection.
1815
- let trustedHost =
1816
- options.connectionId != null || options.domain != null
1817
- ? hostFromDomain(this.resolveDomainForRead(id, options.connectionId, options.domain))
1818
- : undefined;
1819
- if (isGitSelfManagedHostIntegrationId(id)) {
1820
- const configuredHosts = this.getConfigured(id).map(c => hostFromDomain(c.domain));
1821
- if (trustedHost == null && urlHost != null) {
1822
- trustedHost = configuredHosts.find(host => host === urlHost);
1823
- }
1824
- // A configured host that doesn't match the remote's is a genuine mismatch. With nothing configured
1825
- // there is no host to mismatch against — it's simply not connected, so fall through to the
1826
- // `unauthorized` path below (still WITHOUT resolving by the URL domain, so repo data can't seed the
1827
- // cache).
1828
- if (trustedHost == null && configuredHosts.length !== 0) return result('host-mismatch');
1829
- if (trustedHost != null && urlHost != null && trustedHost !== urlHost) return result('host-mismatch');
1830
- }
1831
-
1832
- let integration: Integration | undefined;
1833
- try {
1834
- // Resolve the instance through the trusted target (as `getIntegrationForRead` does):
1835
- // `resolveReadSession` looks the session up against the instance's domain-scoped descriptor, so
1836
- // selecting the instance by the URL domain could miss the session and degrade to `no-connection`.
1837
- integration = isGitSelfManagedHostIntegrationId(id)
1838
- ? trustedHost != null
1839
- ? await this.getIntegrationForRead(id, options.connectionId, trustedHost)
1840
- : undefined
1841
- : await this.get(id, provider.domain);
1842
- } catch {
1843
- integration = undefined;
1844
- }
1845
- if (integration == null) {
1846
- // Attach a warning, as the thrown-AuthenticationError branch below does: a consumer driving auth
1847
- // recovery off `warning.kind` would otherwise get nothing for an unresolvable target.
1848
- return {
1849
- resolution: {
1850
- status: 'unauthorized',
1851
- warning: noConnectionWarning(id, provider.domain, options.connectionId),
1852
- },
1853
- };
1854
- }
1855
- // Issue trackers have no `getRepo` client; a git host without `getRepoFn` leaves `getRepoInfo`
1856
- // undefined. Either way this provider can't resolve repositories.
1857
- if (isIssuesIntegration(integration) || integration.getRepoInfo == null) {
1858
- return result('unsupported-provider');
1859
- }
1860
-
1861
- // Azure repos are org + project scoped; the remote provider exposes project as `providerDesc.repoDomain`.
1862
- const project = provider.id === 'azure-devops' ? provider.providerDesc?.repoDomain : undefined;
1863
- const domain = provider.domain;
1864
-
1865
- // Azure's lookup is project-scoped and returns `undefined` without one, which the connection-gap branch
1866
- // below would misreport as `unauthorized` (driving a pointless reconnect). A remote URL that carries no
1867
- // project simply can't address an Azure repo.
1868
- if (provider.id === 'azure-devops' && project == null) return result('invalid-remote-url');
1146
+ return resolveRepository(this, options);
1147
+ }
1869
1148
 
1870
- try {
1871
- const repo = await integration.getRepoInfo({
1872
- owner: owner,
1873
- name: name,
1874
- project: project,
1875
- connectionId: options.connectionId,
1876
- });
1877
- if (repo == null) {
1878
- // `getRepoInfo` returns undefined only when no session could be resolved (not connected, or the
1879
- // requested connection is gone) — a real 404 throws below. So this is a connection gap. Attach a
1880
- // warning so a consumer driving auth recovery off `warning.kind` sees the same signal it gets from
1881
- // the thrown-AuthenticationError branch below; without it, the most common unauthorized case is
1882
- // silent.
1883
- return {
1884
- resolution: {
1885
- status: 'unauthorized',
1886
- warning: noConnectionWarning(id, domain, options.connectionId),
1887
- },
1888
- };
1889
- }
1149
+ /** {@link RepositoryResolutionContext} seam: the user's `remotes` configs, for the remote matcher. */
1150
+ getRemoteConfigs(): readonly IntegrationsRemoteConfig[] {
1151
+ return this.ctx.config.getRemoteConfigs();
1152
+ }
1890
1153
 
1891
- // Prefer the provider's canonical namespace/name (GitHub's REST/GraphQL lookup follows the 301
1892
- // rename redirect, so a stale old name resolves to the new canonical identity), falling back to the
1893
- // parsed remote when the response omits them. `renamed` is a case-insensitive compare of input vs
1894
- // canonical, mirroring gkcli's `EqualFold`, so hosts that merely echo the input casing (e.g.
1895
- // Bitbucket Server/Azure) don't get spuriously flagged.
1896
- const canonicalOwner = repo.namespace || owner;
1897
- const canonicalName = repo.name || name;
1898
- const renamed =
1899
- canonicalOwner.toLowerCase() !== owner.toLowerCase() ||
1900
- canonicalName.toLowerCase() !== name.toLowerCase();
1901
-
1902
- const identity: RepositoryIdentity = {
1903
- providerId: id,
1904
- domain: domain,
1905
- owner: canonicalOwner,
1906
- name: canonicalName,
1907
- project: project,
1908
- remoteUrl: options.remoteUrl,
1909
- renamed: renamed,
1910
- };
1911
- return { resolution: { status: 'resolved', identity: identity } };
1912
- } catch (ex) {
1913
- // Order matters: 404 throws RequestNotFoundError (not `undefined`), so check not-found before auth
1914
- // and before the generic 5xx/unknown bucket — never classify a 401/403 as not-found.
1915
- let resolution: RepositoryResolution;
1916
- if (ex instanceof RequestNotFoundError) {
1917
- resolution = { status: 'not-found' };
1918
- } else if (ex instanceof AuthenticationError) {
1919
- resolution = {
1920
- status: 'unauthorized',
1921
- warning: toProviderWarning(id, domain, options.connectionId, ex),
1922
- };
1923
- } else {
1924
- resolution = {
1925
- status: 'undetermined',
1926
- warning: toProviderWarning(id, domain, options.connectionId, ex),
1927
- };
1928
- }
1929
- return { resolution: resolution };
1930
- }
1154
+ /** {@link RepositoryResolutionContext} seam: instance lookup by host, for the cloud-host resolution branch. */
1155
+ getIntegrationForDomain(id: IntegrationIds, domain: string | undefined): Promise<Integration | undefined> {
1156
+ return this.get(id, domain);
1931
1157
  }
1932
1158
 
1933
1159
  // #endregion ProviderBackend surface (#5438)