@@ -8,7 +8,7 @@ import type { Issue, IssueShape } from '../../../git/models/issue';
8
8
import type { IssueOrPullRequest , IssueOrPullRequestType } from '../../../git/models/issueOrPullRequest' ;
9
9
import type { PullRequest , PullRequestMergeMethod , PullRequestState } from '../../../git/models/pullRequest' ;
10
10
import type { RepositoryMetadata } from '../../../git/models/repositoryMetadata' ;
11
- import { getSettledValue } from '../../../system/promise' ;
11
+ import { flatSettled } from '../../../system/promise' ;
12
12
import { base64 } from '../../../system/string' ;
13
13
import type { IntegrationAuthenticationProviderDescriptor } from '../authentication/integrationAuthenticationProvider' ;
14
14
import type { IntegrationAuthenticationService } from '../authentication/integrationAuthenticationService' ;
@@ -119,16 +119,13 @@ export abstract class AzureDevOpsIntegrationBase<
119
119
120
120
if ( resourcesWithoutProjects . length > 0 ) {
121
121
const api = await this . getProvidersApi ( ) ;
122
- const azureProjects = (
123
- await Promise . allSettled (
124
- resourcesWithoutProjects . map ( resource =>
125
- api . getAzureProjectsForResource ( resource . name , this . id , this . getApiOptions ( accessToken ) ) ,
126
- ) ,
127
- )
128
- )
129
- . map ( r => getSettledValue ( r ) ?. values )
130
- . flat ( )
131
- . filter ( p => p != null ) ;
122
+ const azureProjects = await flatSettled (
123
+ resourcesWithoutProjects . map (
124
+ async resource =>
125
+ ( await api . getAzureProjectsForResource ( resource . name , this . id , this . getApiOptions ( accessToken ) ) )
126
+ . values ,
127
+ ) ,
128
+ ) ;
132
129
133
130
for ( const resource of resourcesWithoutProjects ) {
134
131
const projects = azureProjects ?. filter ( p => p . namespace === resource . name ) ;
@@ -412,32 +409,28 @@ export abstract class AzureDevOpsIntegrationBase<
412
409
const projects = await this . getProviderProjectsForResources ( session , orgs ) ;
413
410
if ( projects == null || projects . length === 0 ) return undefined ;
414
411
415
- const assignedIssues = (
416
- await Promise . all (
417
- projects . map ( async p => {
418
- const issuesResponse = (
419
- await api . getIssuesForAzureProject ( this . id , p . resourceName , p . name , {
420
- ...this . getApiOptions ( session . accessToken ) ,
421
- assigneeLogins : [ user . username ! ] ,
422
- } )
423
- ) . values ;
424
- return issuesResponse . map ( i => fromProviderIssue ( i , this as any , { project : p } ) ) ;
425
- } ) ,
426
- )
427
- ) . flat ( ) ;
428
- const authoredIssues = (
429
- await Promise . all (
430
- projects . map ( async p => {
431
- const issuesResponse = (
432
- await api . getIssuesForAzureProject ( this . id , p . resourceName , p . name , {
433
- ...this . getApiOptions ( session . accessToken ) ,
434
- authorLogin : user . username ! ,
435
- } )
436
- ) . values ;
437
- return issuesResponse . map ( i => fromProviderIssue ( i , this as any , { project : p } ) ) ;
438
- } ) ,
439
- )
440
- ) . flat ( ) ;
412
+ const assignedIssues = await flatSettled (
413
+ projects . map ( async p => {
414
+ const issuesResponse = (
415
+ await api . getIssuesForAzureProject ( this . id , p . resourceName , p . name , {
416
+ ...this . getApiOptions ( session . accessToken ) ,
417
+ assigneeLogins : [ user . username ! ] ,
418
+ } )
419
+ ) . values ;
420
+ return issuesResponse . map ( i => fromProviderIssue ( i , this as any , { project : p } ) ) ;
421
+ } ) ,
422
+ ) ;
423
+ const authoredIssues = await flatSettled (
424
+ projects . map ( async p => {
425
+ const issuesResponse = (
426
+ await api . getIssuesForAzureProject ( this . id , p . resourceName , p . name , {
427
+ ...this . getApiOptions ( session . accessToken ) ,
428
+ authorLogin : user . username ! ,
429
+ } )
430
+ ) . values ;
431
+ return issuesResponse . map ( i => fromProviderIssue ( i , this as any , { project : p } ) ) ;
432
+ } ) ,
433
+ ) ;
441
434
// TODO: Add mentioned issues
442
435
const issuesById = new Map < string , IssueShape > ( ) ;
443
436
0 commit comments