This repository was archived by the owner on May 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,10 +54,14 @@ function getEnvInfo(envId) {
5454 } ) ;
5555}
5656exports . getEnvInfo = getEnvInfo ;
57- function listEnvs ( ) {
57+ function listEnvs ( options = { } ) {
5858 return __awaiter ( this , void 0 , void 0 , function * ( ) {
59+ const { source } = options ;
5960 const res = yield tcbService . request ( 'DescribeEnvs' ) ;
60- const { EnvList = [ ] } = res ;
61+ let { EnvList = [ ] } = res ;
62+ if ( source && Array . isArray ( source ) ) {
63+ EnvList = EnvList . filter ( item => source . includes ( item . Source ) ) ;
64+ }
6165 return EnvList ;
6266 } ) ;
6367}
Original file line number Diff line number Diff line change @@ -45,9 +45,14 @@ export async function getEnvInfo(envId: string) {
4545}
4646
4747// 列出所有环境
48- export async function listEnvs ( ) {
48+ export async function listEnvs ( options : { source ?: string [ ] } = { } ) {
49+ const { source } = options
4950 const res : any = await tcbService . request ( 'DescribeEnvs' )
50- const { EnvList = [ ] } = res
51+ let { EnvList = [ ] } = res
52+ // 过滤为指定 source 环境
53+ if ( source && Array . isArray ( source ) ) {
54+ EnvList = EnvList . filter ( item => source . includes ( item . Source ) )
55+ }
5156 return EnvList
5257}
5358
Original file line number Diff line number Diff line change @@ -5,7 +5,9 @@ export declare function createEnv({ alias }: {
55 alias : any ;
66} ) : Promise < any > ;
77export declare function getEnvInfo ( envId : string ) : Promise < any > ;
8- export declare function listEnvs ( ) : Promise < any > ;
8+ export declare function listEnvs ( options ?: {
9+ source ?: string [ ] ;
10+ } ) : Promise < any > ;
911export declare function updateEnvInfo ( { envId, alias } : {
1012 envId : any ;
1113 alias : any ;
You can’t perform that action at this time.
0 commit comments