@@ -35,6 +35,7 @@ import {
3535 updateRecentResponse ,
3636} from './utils'
3737import { runInTerminal } from './processTerminal'
38+ import { DEPLOY_MEMENTO_ROOT_KEY } from './constants'
3839
3940export interface DeployParams {
4041 readonly paramsSource : ParamsSource
@@ -48,10 +49,8 @@ export interface DeployParams {
4849 [ key : string ] : any
4950}
5051
51- const deployMementoRootKey = 'samcli.deploy.params'
52-
5352function getRecentDeployParams ( identifier : string , key : string ) : string | undefined {
54- return getRecentResponse ( deployMementoRootKey , identifier , key )
53+ return getRecentResponse ( DEPLOY_MEMENTO_ROOT_KEY , identifier , key )
5554}
5655
5756function createParamPromptProvider ( name : string , defaultValue : string | undefined , templateFsPath : string = 'default' ) {
@@ -106,7 +105,11 @@ export class DeployWizard extends Wizard<DeployParams> {
106105 } )
107106 this . form . stackName . bindPrompter (
108107 ( { region } ) =>
109- createStackPrompter ( new DefaultCloudFormationClient ( region ! ) , deployMementoRootKey , samDeployUrl ) ,
108+ createStackPrompter (
109+ new DefaultCloudFormationClient ( region ! ) ,
110+ DEPLOY_MEMENTO_ROOT_KEY ,
111+ samDeployUrl
112+ ) ,
110113 {
111114 showWhen : ( { paramsSource } ) =>
112115 paramsSource === ParamsSource . Specify || paramsSource === ParamsSource . SpecifyAndSave ,
@@ -118,15 +121,15 @@ export class DeployWizard extends Wizard<DeployParams> {
118121 } )
119122 this . form . bucketName . bindPrompter (
120123 ( { region } ) =>
121- createBucketNamePrompter ( new DefaultS3Client ( region ! ) , deployMementoRootKey , samDeployUrl ) ,
124+ createBucketNamePrompter ( new DefaultS3Client ( region ! ) , DEPLOY_MEMENTO_ROOT_KEY , samDeployUrl ) ,
122125 {
123126 showWhen : ( { bucketSource } ) => bucketSource === BucketSource . UserProvided ,
124127 }
125128 )
126129 } else if ( this . arg && this . arg . regionCode ) {
127130 // "Deploy" command was invoked on a regionNode.
128131 this . form . template . bindPrompter ( ( ) =>
129- createTemplatePrompter ( this . registry , deployMementoRootKey , samDeployUrl )
132+ createTemplatePrompter ( this . registry , DEPLOY_MEMENTO_ROOT_KEY , samDeployUrl )
130133 )
131134 this . form . projectRoot . setDefault ( ( { template } ) => getProjectRoot ( template ) )
132135 this . form . paramsSource . bindPrompter ( async ( { projectRoot } ) => {
@@ -136,7 +139,11 @@ export class DeployWizard extends Wizard<DeployParams> {
136139 this . form . region . setDefault ( ( ) => this . arg . regionCode )
137140 this . form . stackName . bindPrompter (
138141 ( { region } ) =>
139- createStackPrompter ( new DefaultCloudFormationClient ( region ! ) , deployMementoRootKey , samDeployUrl ) ,
142+ createStackPrompter (
143+ new DefaultCloudFormationClient ( region ! ) ,
144+ DEPLOY_MEMENTO_ROOT_KEY ,
145+ samDeployUrl
146+ ) ,
140147 {
141148 showWhen : ( { paramsSource } ) =>
142149 paramsSource === ParamsSource . Specify || paramsSource === ParamsSource . SpecifyAndSave ,
@@ -148,7 +155,7 @@ export class DeployWizard extends Wizard<DeployParams> {
148155 } )
149156 this . form . bucketName . bindPrompter (
150157 ( { region } ) =>
151- createBucketNamePrompter ( new DefaultS3Client ( region ! ) , deployMementoRootKey , samDeployUrl ) ,
158+ createBucketNamePrompter ( new DefaultS3Client ( region ! ) , DEPLOY_MEMENTO_ROOT_KEY , samDeployUrl ) ,
152159 {
153160 showWhen : ( { bucketSource } ) => bucketSource === BucketSource . UserProvided ,
154161 }
@@ -171,7 +178,11 @@ export class DeployWizard extends Wizard<DeployParams> {
171178 } )
172179 this . form . stackName . bindPrompter (
173180 ( { region } ) =>
174- createStackPrompter ( new DefaultCloudFormationClient ( region ! ) , deployMementoRootKey , samDeployUrl ) ,
181+ createStackPrompter (
182+ new DefaultCloudFormationClient ( region ! ) ,
183+ DEPLOY_MEMENTO_ROOT_KEY ,
184+ samDeployUrl
185+ ) ,
175186 {
176187 showWhen : ( { paramsSource } ) =>
177188 paramsSource === ParamsSource . Specify || paramsSource === ParamsSource . SpecifyAndSave ,
@@ -183,7 +194,7 @@ export class DeployWizard extends Wizard<DeployParams> {
183194 } )
184195 this . form . bucketName . bindPrompter (
185196 ( { region } ) =>
186- createBucketNamePrompter ( new DefaultS3Client ( region ! ) , deployMementoRootKey , samDeployUrl ) ,
197+ createBucketNamePrompter ( new DefaultS3Client ( region ! ) , DEPLOY_MEMENTO_ROOT_KEY , samDeployUrl ) ,
187198 {
188199 showWhen : ( { bucketSource } ) => bucketSource === BucketSource . UserProvided ,
189200 }
@@ -192,7 +203,7 @@ export class DeployWizard extends Wizard<DeployParams> {
192203 } else {
193204 // "Deploy" command was invoked on the command palette.
194205 this . form . template . bindPrompter ( ( ) =>
195- createTemplatePrompter ( this . registry , deployMementoRootKey , samDeployUrl )
206+ createTemplatePrompter ( this . registry , DEPLOY_MEMENTO_ROOT_KEY , samDeployUrl )
196207 )
197208 this . form . projectRoot . setDefault ( ( { template } ) => getProjectRoot ( template ) )
198209 this . form . paramsSource . bindPrompter ( async ( { projectRoot } ) => {
@@ -205,7 +216,11 @@ export class DeployWizard extends Wizard<DeployParams> {
205216 } )
206217 this . form . stackName . bindPrompter (
207218 ( { region } ) =>
208- createStackPrompter ( new DefaultCloudFormationClient ( region ! ) , deployMementoRootKey , samDeployUrl ) ,
219+ createStackPrompter (
220+ new DefaultCloudFormationClient ( region ! ) ,
221+ DEPLOY_MEMENTO_ROOT_KEY ,
222+ samDeployUrl
223+ ) ,
209224 {
210225 showWhen : ( { paramsSource } ) =>
211226 paramsSource === ParamsSource . Specify || paramsSource === ParamsSource . SpecifyAndSave ,
@@ -217,7 +232,7 @@ export class DeployWizard extends Wizard<DeployParams> {
217232 } )
218233 this . form . bucketName . bindPrompter (
219234 ( { region } ) =>
220- createBucketNamePrompter ( new DefaultS3Client ( region ! ) , deployMementoRootKey , samDeployUrl ) ,
235+ createBucketNamePrompter ( new DefaultS3Client ( region ! ) , DEPLOY_MEMENTO_ROOT_KEY , samDeployUrl ) ,
221236 {
222237 showWhen : ( { bucketSource } ) => bucketSource === BucketSource . UserProvided ,
223238 }
@@ -314,14 +329,14 @@ export async function runDeploy(arg: any, wizardParams?: DeployParams): Promise<
314329 const paramsToSet : string [ ] = [ ]
315330 for ( const name of parameterNames ) {
316331 if ( params [ name ] ) {
317- await updateRecentResponse ( deployMementoRootKey , params . template . uri . fsPath , name , params [ name ] )
332+ await updateRecentResponse ( DEPLOY_MEMENTO_ROOT_KEY , params . template . uri . fsPath , name , params [ name ] )
318333 paramsToSet . push ( `ParameterKey=${ name } ,ParameterValue=${ params [ name ] } ` )
319334 }
320335 }
321336 paramsToSet . length > 0 && deployFlags . push ( '--parameter-overrides' , paramsToSet . join ( ' ' ) )
322337 }
323338
324- await updateRecentResponse ( deployMementoRootKey , 'global' , 'templatePath' , params . template . uri . fsPath )
339+ await updateRecentResponse ( DEPLOY_MEMENTO_ROOT_KEY , 'global' , 'templatePath' , params . template . uri . fsPath )
325340
326341 try {
327342 const { path : samCliPath } = await getSamCliPathAndVersion ( )
0 commit comments