@@ -33,8 +33,6 @@ import { GlobalAutoNumberMigrationTool } from '../../../migration/globalautonumb
3333// Initialize Messages with the current plugin directory
3434Messages . importMessagesDirectory ( __dirname ) ;
3535
36- const authEnvKey = 'OMA_AUTH_KEY' ;
37-
3836// Load the specific messages for this file. Messages from @salesforce /command, @salesforce/core,
3937// or any library that is using the messages framework can also be loaded this way.
4038const messages = Messages . loadMessages ( '@salesforce/plugin-omnistudio-migration-tool' , 'migrate' ) ;
@@ -260,7 +258,7 @@ export default class Migrate extends OmniStudioBaseCommand {
260258 }
261259 }
262260
263- const deploymentConfig = await this . getAutoDeployConsent ( objectsToProcess . includes ( Constants . LWC ) ) ;
261+ let deploymentConfig = { autoDeploy : false , authKey : undefined } ;
264262 let projectPath : string ;
265263 let targetApexNamespace : string ;
266264 // Check for general consent to make modifications with OMT
@@ -274,6 +272,7 @@ export default class Migrate extends OmniStudioBaseCommand {
274272 conn ,
275273 isExperienceBundleMetadataAPIProgramaticallyEnabled
276274 ) ;
275+ deploymentConfig = await preMigrate . getAutoDeployConsent ( objectsToProcess . includes ( Constants . LWC ) ) ;
277276 Logger . logVerbose (
278277 'The objects to process after handleExpSitePrerequisite are ' + JSON . stringify ( objectsToProcess )
279278 ) ;
@@ -282,47 +281,6 @@ export default class Migrate extends OmniStudioBaseCommand {
282281 return { objectsToProcess, projectPath, targetApexNamespace, deploymentConfig } ;
283282 }
284283
285- private async getAutoDeployConsent (
286- includeLwc : boolean
287- ) : Promise < { autoDeploy : boolean ; authKey : string | undefined } > {
288- const askWithTimeOut = PromptUtil . askWithTimeOut ( messages ) ;
289- let validResponse = false ;
290- let consent = false ;
291-
292- while ( ! validResponse ) {
293- try {
294- const resp = await askWithTimeOut ( Logger . prompt . bind ( Logger ) , messages . getMessage ( 'autoDeployConsentMessage' ) ) ;
295- const response = typeof resp === 'string' ? resp . trim ( ) . toLowerCase ( ) : '' ;
296-
297- if ( response === YES_SHORT || response === YES_LONG ) {
298- consent = true ;
299- validResponse = true ;
300- } else if ( response === NO_SHORT || response === NO_LONG ) {
301- consent = false ;
302- validResponse = true ;
303- } else {
304- Logger . error ( messages . getMessage ( 'invalidYesNoResponse' ) ) ;
305- }
306- } catch ( err ) {
307- Logger . error ( messages . getMessage ( 'requestTimedOut' ) ) ;
308- process . exit ( 1 ) ;
309- }
310- }
311-
312- const deploymentConfig = {
313- autoDeploy : consent ,
314- authKey : undefined ,
315- } ;
316- if ( consent && includeLwc ) {
317- deploymentConfig . authKey = process . env [ authEnvKey ] ;
318- if ( ! deploymentConfig . authKey ) {
319- Logger . warn ( messages . getMessage ( 'authKeyEnvVarNotSet' ) ) ;
320- }
321- }
322-
323- return deploymentConfig ;
324- }
325-
326284 private async getMigrationConsent ( ) : Promise < boolean > {
327285 const askWithTimeOut = PromptUtil . askWithTimeOut ( messages ) ;
328286 let validResponse = false ;
0 commit comments