@@ -16,7 +16,14 @@ import { ServiceConfigurationOptions } from 'aws-sdk/lib/service'
1616import { CancellationError , Timeout , waitTimeout , waitUntil } from '../utilities/timeoutUtils'
1717import { isUserCancelledError } from '../../shared/errors'
1818import { 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'
2027import { AsyncCollection , toCollection } from '../utilities/asyncCollection'
2128import { joinAll , pageableToCollection } from '../utilities/collectionUtils'
2229import { CodeCatalyst } from 'aws-sdk'
@@ -58,6 +65,7 @@ import {
5865 ListSpacesCommand ,
5966 ListSpacesRequest ,
6067 ListSpacesResponse ,
68+ ProjectSummary ,
6169 SpaceSummary ,
6270} from '@aws-sdk/client-codecatalyst'
6371import { truncateProps } from '../utilities/textUtilities'
@@ -525,9 +533,7 @@ class CodeCatalystClientInternal extends ClientWrapper<CodeCatalystSDKClient> {
525533 public listSpaces ( request : ListSpacesRequest = { } ) : AsyncCollection < CodeCatalystOrg [ ] > {
526534 const requester : ( request : ListSpacesRequest ) => Promise < ListSpacesResponse > = async ( request ) =>
527535 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 )
531537 return collection . map ( ( summaries ) =>
532538 summaries . filter ( ( s ) => hasProps ( s , 'name' ) ) . map ( ( s ) => ( { type : 'org' , ...s } ) )
533539 )
@@ -551,9 +557,7 @@ class CodeCatalystClientInternal extends ClientWrapper<CodeCatalystSDKClient> {
551557 const requester : ( request : ListProjectsRequest ) => Promise < ListProjectsResponse > = ( request ) =>
552558 this . callV3 ( ListProjectsCommand , request , true , { items : [ ] } )
553559
554- const collection = pageableToCollection ( requester , request , 'nextToken' , 'items' ) . filter (
555- ( summaries ) => summaries !== undefined
556- )
560+ const collection = pageableToCollection ( requester , request , 'nextToken' , 'items' ) . filter ( isDefined )
557561
558562 return collection . map ( ( summaries ) =>
559563 summaries
@@ -569,16 +573,18 @@ class CodeCatalystClientInternal extends ClientWrapper<CodeCatalystSDKClient> {
569573 /**
570574 * Gets a flat list of all devenvs for the given CodeCatalyst project.
571575 */
572- public listDevEnvironments ( proj : CodeCatalystProject ) : AsyncCollection < DevEnvironment [ ] > {
576+ public listDevEnvironments (
577+ proj : CodeCatalystProject
578+ ) : AsyncCollection < RequiredProps < DevEnvironment , 'id' | 'status' | 'lastUpdatedTime' > [ ] > {
573579 const initRequest = { spaceName : proj . org . name , projectName : proj . name }
574580 const requester : ( request : ListDevEnvironmentsRequest ) => Promise < ListDevEnvironmentsResponse > = ( request ) =>
575581 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 )
579583
580584 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 ) )
582588 )
583589 }
584590
0 commit comments