@@ -16,7 +16,14 @@ import { ServiceConfigurationOptions } from 'aws-sdk/lib/service'
16
16
import { CancellationError , Timeout , waitTimeout , waitUntil } from '../utilities/timeoutUtils'
17
17
import { isUserCancelledError } from '../../shared/errors'
18
18
import { showMessageWithCancel } from '../utilities/messages'
19
- import { assertHasProps , ClassToInterfaceType , hasProps , isNonNullable , RequiredProps } from '../utilities/tsUtils'
19
+ import {
20
+ assertHasProps ,
21
+ ClassToInterfaceType ,
22
+ hasProps ,
23
+ isDefined ,
24
+ isNonNullable ,
25
+ RequiredProps ,
26
+ } from '../utilities/tsUtils'
20
27
import { AsyncCollection , toCollection } from '../utilities/asyncCollection'
21
28
import { joinAll , pageableToCollection } from '../utilities/collectionUtils'
22
29
import { CodeCatalyst } from 'aws-sdk'
@@ -58,6 +65,7 @@ import {
58
65
ListSpacesCommand ,
59
66
ListSpacesRequest ,
60
67
ListSpacesResponse ,
68
+ ProjectSummary ,
61
69
SpaceSummary ,
62
70
} from '@aws-sdk/client-codecatalyst'
63
71
import { truncateProps } from '../utilities/textUtilities'
@@ -525,9 +533,7 @@ class CodeCatalystClientInternal extends ClientWrapper<CodeCatalystSDKClient> {
525
533
public listSpaces ( request : ListSpacesRequest = { } ) : AsyncCollection < CodeCatalystOrg [ ] > {
526
534
const requester : ( request : ListSpacesRequest ) => Promise < ListSpacesResponse > = async ( request ) =>
527
535
this . callV3 ( ListSpacesCommand , request , true , { items : [ ] } )
528
- const collection = pageableToCollection ( requester , request , 'nextToken' , 'items' ) . filter (
529
- ( summaries ) => summaries !== undefined
530
- )
536
+ const collection = pageableToCollection ( requester , request , 'nextToken' , 'items' ) . filter ( isDefined )
531
537
return collection . map ( ( summaries ) =>
532
538
summaries . filter ( ( s ) => hasProps ( s , 'name' ) ) . map ( ( s ) => ( { type : 'org' , ...s } ) )
533
539
)
@@ -551,9 +557,7 @@ class CodeCatalystClientInternal extends ClientWrapper<CodeCatalystSDKClient> {
551
557
const requester : ( request : ListProjectsRequest ) => Promise < ListProjectsResponse > = ( request ) =>
552
558
this . callV3 ( ListProjectsCommand , request , true , { items : [ ] } )
553
559
554
- const collection = pageableToCollection ( requester , request , 'nextToken' , 'items' ) . filter (
555
- ( summaries ) => summaries !== undefined
556
- )
560
+ const collection = pageableToCollection ( requester , request , 'nextToken' , 'items' ) . filter ( isDefined )
557
561
558
562
return collection . map ( ( summaries ) =>
559
563
summaries
@@ -569,16 +573,18 @@ class CodeCatalystClientInternal extends ClientWrapper<CodeCatalystSDKClient> {
569
573
/**
570
574
* Gets a flat list of all devenvs for the given CodeCatalyst project.
571
575
*/
572
- public listDevEnvironments ( proj : CodeCatalystProject ) : AsyncCollection < DevEnvironment [ ] > {
576
+ public listDevEnvironments (
577
+ proj : CodeCatalystProject
578
+ ) : AsyncCollection < RequiredProps < DevEnvironment , 'id' | 'status' | 'lastUpdatedTime' > [ ] > {
573
579
const initRequest = { spaceName : proj . org . name , projectName : proj . name }
574
580
const requester : ( request : ListDevEnvironmentsRequest ) => Promise < ListDevEnvironmentsResponse > = ( request ) =>
575
581
this . callV3 ( ListDevEnvironmentsCommand , request , true , { items : [ ] } )
576
- const collection = pageableToCollection ( requester , initRequest , 'nextToken' , 'items' ) . filter (
577
- ( c ) => c !== undefined
578
- )
582
+ const collection = pageableToCollection ( requester , initRequest , 'nextToken' , 'items' ) . filter ( isDefined )
579
583
580
584
return collection . map ( ( envs ) =>
581
- envs . filter ( ( s ) => hasProps ( s , 'id' , 'status' ) ) . map ( ( s ) => toDevEnv ( proj . org . name , proj . name , s ) )
585
+ envs
586
+ . filter ( ( s ) => hasProps ( s , 'id' , 'status' , 'lastUpdatedTime' ) )
587
+ . map ( ( s ) => toDevEnv ( proj . org . name , proj . name , s ) )
582
588
)
583
589
}
584
590
0 commit comments