@@ -180,7 +180,7 @@ export default class CreateSandbox extends SandboxCommandBase<SandboxCommandResp
180180 if ( nameOrId ) {
181181 const sourceFeatures = await this . getSandboxFeatures ( nameOrId ) ;
182182 if ( sourceFeatures ) {
183- ( sandboxReq as SandboxRequest & { Features ?: string [ ] } ) . Features = sourceFeatures ;
183+ sandboxReq . Features = sourceFeatures ;
184184 }
185185 }
186186
@@ -195,25 +195,25 @@ export default class CreateSandbox extends SandboxCommandBase<SandboxCommandResp
195195 } ;
196196 }
197197
198- private async getSandboxFeatures ( sandboxName : string ) : Promise < string [ ] | undefined > {
198+ private async getSandboxFeatures ( sandboxNameOrId : string ) : Promise < string [ ] | undefined > {
199199 const prodOrg = this . flags [ 'target-org' ] ;
200200
201201 try {
202- if ( sandboxName ?. startsWith ( '0GQ' ) ) {
203- const sbxId = await prodOrg . querySandboxInfo ( { id : sandboxName , name : undefined } ) ;
204- if ( sbxId ?. Features ) {
205- return sbxId . Features ;
202+ if ( sandboxNameOrId ?. startsWith ( '0GQ' ) ) {
203+ const sbxInfo = await prodOrg . querySandboxInfo ( { id : sandboxNameOrId } ) ;
204+ if ( sbxInfo ?. Features ) {
205+ return sbxInfo . Features ;
206206 }
207207
208- return ( await prodOrg . querySandboxProcessBySandboxInfoId ( sandboxName ) ) . Features ;
208+ return ( await prodOrg . querySandboxProcessBySandboxInfoId ( sandboxNameOrId ) ) . Features ;
209209 }
210210
211- const sbxName = await prodOrg . querySandboxInfo ( { id : undefined , name : sandboxName } ) ;
212- if ( sbxName ?. Features ) {
213- return sbxName . Features ;
211+ const sbxInfo = await prodOrg . querySandboxInfo ( { name : sandboxNameOrId } ) ;
212+ if ( sbxInfo ?. Features ) {
213+ return sbxInfo . Features ;
214214 }
215215
216- return ( await prodOrg . querySandboxProcessBySandboxName ( sandboxName ) ) . Features ;
216+ return ( await prodOrg . querySandboxProcessBySandboxName ( sandboxNameOrId ) ) . Features ;
217217 } catch ( err ) {
218218 if ( err instanceof SfError && ( err . name . includes ( 'AUTH' ) ?? err . name . includes ( 'CONNECTION' ) ) ) {
219219 this . warn ( `Warning: Could not retrieve sandbox features due to ${ err . name } .` ) ;
0 commit comments