1- /* eslint-disable */
2-
31import { Connection , Messages } from '@salesforce/core' ;
42import { UX } from '@salesforce/command' ;
53import { Logger } from '../utils/logger' ;
64import { Constants } from '../utils/constants/stringContants' ;
75import { OrgPreferences } from '../utils/orgPreferences' ;
8- import { BaseMigrationTool } from './base' ;
96import { askStringWithTimeout } from '../utils/promptUtil' ;
7+ import { YES_SHORT , YES_LONG , NO_SHORT , NO_LONG } from '../utils/projectPathUtil' ;
8+ import { BaseMigrationTool } from './base' ;
109
1110export class PreMigrate extends BaseMigrationTool {
1211 // Source Custom Object Names
13- constructor ( namespace : string , connection : Connection , logger : Logger , messages : Messages , ux : UX ) {
12+ public constructor ( namespace : string , connection : Connection , logger : Logger , messages : Messages , ux : UX ) {
1413 super ( namespace , connection , logger , messages , ux ) ;
1514 }
1615
@@ -55,8 +54,9 @@ export class PreMigrate extends BaseMigrationTool {
5554 // This needs to be behind timeout
5655 private async getExpSiteMetadataEnableConsent ( ) : Promise < boolean > {
5756 const question = this . messages . getMessage ( 'consentForExperienceSites' ) ;
57+ const validResponse = false ;
5858
59- while ( true ) {
59+ while ( ! validResponse ) {
6060 try {
6161 // Get string input from user with timeout
6262 const userInput = await askStringWithTimeout (
@@ -68,19 +68,18 @@ export class PreMigrate extends BaseMigrationTool {
6868 // Validate and convert the input
6969 const normalizedInput = userInput . trim ( ) . toLowerCase ( ) ;
7070
71- if ( normalizedInput === 'y' || normalizedInput === 'yes' ) {
71+ if ( normalizedInput === YES_SHORT || normalizedInput === YES_LONG ) {
7272 return true ;
73- } else if ( normalizedInput === 'n' || normalizedInput === 'no' ) {
73+ } else if ( normalizedInput === NO_SHORT || normalizedInput === NO_LONG ) {
7474 return false ;
7575 } else {
7676 // Invalid input - show error and continue loop to re-prompt
7777 Logger . error ( this . messages . getMessage ( 'invalidYesNoResponse' ) ) ;
78- Logger . log ( 'Please enter "y" or "yes" to consent, "n" or "no" to decline.' ) ;
7978 }
8079 } catch ( error ) {
8180 // Handle timeout or other errors
82- Logger . error ( this . messages . getMessage ( 'failedToGetConsentError' , [ error . message ] ) ) ;
83- throw error ; // Re-throw to let caller handle timeout
81+ Logger . error ( this . messages . getMessage ( 'requestTimedOut' ) ) ;
82+ process . exit ( 1 ) ;
8483 }
8584 }
8685 }
0 commit comments