Skip to content

Commit 7d3bf90

Browse files
authored
Merge pull request #368 from snehaljha-sf/alpha-merge
Alpha merge
2 parents 6467cea + a06f522 commit 7d3bf90

23 files changed

+213
-171
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ You can also authenticate using a consumer key (client ID) and secret key throug
3030
3. In a new terminal session, Install the Omnistudio Migration Assistant by running the `sf plugins install` command. For example
3131

3232
```
33-
sf plugins install @salesforce/[email protected]beta.13
33+
sf plugins install @salesforce/[email protected]rc.16
3434
```
3535

3636
4. Run the Omnistudio Migration Assistant from the Salesforce CLI:

messages/assess.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@
3333
"invalidNamespace": "The namespace you have passed is not valid namespace, the valid namespace of your org is ",
3434
"noPackageInstalled": "No package installed on given org.",
3535
"alreadyStandardModel": "The org is already on standard data model.",
36-
"invalidRelatedObjectsOptionGA": "Invalid option provided for -r: %s. Valid options are apex, lwc.",
37-
"invalidRelatedObjectsOption": "Invalid option provided for -r: %s. Valid option is apex.",
36+
"invalidRelatedObjectsOption": "Invalid option provided for -r: %s. Valid options are apex, lwc, expsites, flexipage.",
3837
"formulaSyntaxError": "There was some problem while updating the formula syntax, please check the all the formula's syntax once : %s",
3938
"errorDuringFlexCardAssessment": "Error during FlexCard assessment",
4039
"errorDuringOmniScriptAssessment": "Error during OmniScript assessment",
4140
"errorDuringGlobalAutoNumberAssessment": "Error during GlobalAutoNumber assessment",
4241
"processingFlexCard": "Processing FlexCard: %s",
43-
"processingDataRaptor": "Processing DataRaptor: %s",
42+
"processingDataRaptor": "Processing DataMapper: %s",
4443
"processingOmniScript": "Processing OmniScript: %s",
4544
"processingGlobalAutoNumber": "Processing GlobalAutoNumber: %s",
4645
"foundDataRaptorsToAssess": "Found %s DataRaptors to assess",
@@ -55,8 +54,8 @@
5554
"assessmentTargets": "Assessment targets: %s",
5655
"relatedObjectsInfo": "Related objects: %s",
5756
"allVersionsFlagInfo": "All versions: %s",
58-
"assessedDataRaptorsCount": "Assessed %s DataRaptors",
59-
"dataRaptorAssessmentCompleted": "DataRaptor assessment completed",
57+
"assessedDataRaptorsCount": "Assessed %s DataMappers",
58+
"dataRaptorAssessmentCompleted": "DataMappers assessment completed",
6059
"flexCardAssessment": "FlexCard Assessment",
6160
"assessedFlexCardsCount": "Assessed %s FlexCards",
6261
"flexCardAssessmentCompleted": "FlexCard assessment completed",
@@ -96,23 +95,23 @@
9695
"cardNameChangeMessage": "Card name will be changed from %s to %s to follow API naming standards",
9796
"authordNameChangeMessage": "Author name will be changed from %s to %s to follow API naming standards",
9897
"omniScriptNameChangeMessage": "OmniScript reference part %s will be changed to %s during migration.",
99-
"dataRaptorNameChangeMessage": "DataRaptor reference %s will be changed to %s during migration.",
98+
"dataRaptorNameChangeMessage": "DataMapper reference %s will be changed to %s during migration.",
10099
"integrationProcedureNameChangeMessage": "Integration Procedure reference %s will be changed to %s during migration.",
101100
"integrationProcedureManualUpdateMessage": "Integration Procedure reference %s may need manual updates after migration.",
102101
"duplicateCardNameMessage": "Potential duplicate: Another card has the same name %s after name cleaning. This may cause conflicts during migration",
103102
"duplicateGlobalAutoNumberNameMessage": "Potential duplicate: Another Global Auto Number has the same name %s after name cleaning. This may cause conflicts during migration",
104103
"existingApexPrompt": "Do you have a sfdc project that already contains the APEX classes retrieved from your org? [y/n]",
105-
"enterExistingProjectPath": "Enter the path to the project folder that contains the retrieved APEX classes:",
104+
"enterExistingProjectPath": "Enter the path to the project folder that contains the retrieved APEX classes",
106105
"invalidProjectFolderPath": "Provided project folder does not exist. Please provide a valid project folder path",
107106
"requestTimedOut": "Request timed out",
108107
"retrieveApexPrompt": "Omnistudio Migration Assistant can connect to your org and retrieve the APEX classes. Provide an empty project folder to store the retrieved APEX classes. Would you like to proceed with the retrieval? [y/n]",
109-
"enterEmptyProjectPath": "Enter the path to an empty project folder to retrieve to and process the APEX classes:",
108+
"enterEmptyProjectPath": "Enter the path to an empty project folder to retrieve to and process the APEX classes",
110109
"notEmptyProjectFolderPath": "Provided project folder is not empty. Please provide a valid empty project folder name and path",
111110
"operationCancelled": "Operation cancelled.",
112111
"invalidYesNoResponse": "Invalid response. Please answer y or n.",
113112
"notSfdxProjectFolderPath": "Provided folder is not a valid Salesforce DX project. Please select a folder containing sfdx-project.json",
114113
"failedToGetValidProjectPath": "Failed to get valid project path",
115-
"errorRunningAssess": "Error running assess",
114+
"errorRunningAssess": "Assessment process failed reason : %s",
116115
"enableVerboseOutput": "Enable verbose output",
117116
"apexFileChangesIdentifiedNotApplied": "Changes identified for Apex class %s but not applied (assessment mode)",
118117
"apexFileHasMultipleInterfaces": "File %s has multiple interfaces including Callable, standardizing to System.Callable only",
@@ -141,7 +140,7 @@
141140
"enableExperienceBundleMetadataAPIProgramatically": "ExperienceBundle metadata api needs to be programatically enabled",
142141
"unableToEnableExperienceBundleMetadataAPI": "Since the api could not able enabled the experience sites would not be processed",
143142
"relatedObjectsToProcess": "Objects to process are",
144-
"consentForExperienceSites": "'By proceeding further, you hereby consent to enable digital experience metadata api(y/n). If y sites will be processed, if n expsites will not be processed';",
143+
"consentForExperienceSites": "By proceeding further, you hereby consent to enable digital experience metadata api(y/n). If y sites will be processed, if n expsites will not be processed",
145144
"failedToGetConsentError": "Failed to get user consent: %s",
146145
"settingDesignersToStandardModel": "Setting designers to use the standard data model",
147146
"errorSettingDesignersToStandardModel": "Error occurred while setting designers to use the standard data model",
@@ -182,5 +181,6 @@
182181
"errorMigrationMessage": "Error migrating object: %s",
183182
"nameMappingUndefined": "Name Mapping is undefined",
184183
"experienceSiteException": "Exception occurred while processing experience sites",
185-
"reservedKeysFoundInPropertySet": "Reserved keys found in any of output response transformation fields: %s."
184+
"reservedKeysFoundInPropertySet": "Reserved keys found in any of output response transformation fields: %s.",
185+
"invalidTypeAssessErrorMessage": "We couldn't assess your Omnistudio components in the %s namespace. Select the correct namespace and try again"
186186
}

messages/migrate.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,22 @@
3434
"invalidNamespace": "The namespace you have passed is not valid namespace, the valid namespace of your org is ",
3535
"noPackageInstalled": "No package installed on given org.",
3636
"alreadyStandardModel": "The org is already on standard data model.",
37-
"invalidRelatedObjectsOptionGA": "Invalid option provided for -r: %s. Valid options are apex, lwc.",
38-
"invalidRelatedObjectsOption": "Invalid option provided for -r: %s. Valid option is apex.",
37+
"invalidRelatedObjectsOption": "Invalid option provided for -r: %s. Valid options are apex, lwc, expsites, flexipage.",
3938
"userConsentMessage": "By proceeding further, you hereby consent to the use, accept changes to your custom code and the accompanying terms and conditions associated with the use of the OmniStudio Migration Tool. Do you want to proceed? [y/n]",
4039
"userDeclinedConsent": "User declined consent, will not process %s .",
4140
"userConsentedToProceed": "User consented to proceed",
4241
"existingApexPrompt": "Do you have a sfdc project that already contains the APEX classes retrieved from your org? [y/n]",
43-
"enterExistingProjectPath": "Enter the path to the project folder that contains the retrieved APEX classes:",
42+
"enterExistingProjectPath": "Enter the path to the project folder that contains the retrieved APEX classes",
4443
"invalidProjectFolderPath": "Provided project folder does not exist. Please provide a valid project folder path",
4544
"requestTimedOut": "Request timed out",
4645
"retrieveApexPrompt": "Omnistudio Migration Tool can connect to your org and retrieve the APEX classes. Provide an empty project folder to store the retrieved APEX classes. Would you like to proceed with the retrieval? [y/n]",
47-
"enterEmptyProjectPath": "Enter the path to an empty project folder to retrieve to and process the APEX classes:",
46+
"enterEmptyProjectPath": "Enter the path to an empty project folder to retrieve to and process the APEX classes",
4847
"notEmptyProjectFolderPath": "Provided project folder is not empty. Please provide a valid empty project folder name and path",
4948
"invalidYesNoResponse": "Invalid response. Please answer y or n.",
5049
"notSfdxProjectFolderPath": "Provided folder is not a valid Salesforce DX project. Please select a folder containing sfdx-project.json",
5150
"operationCancelled": "Operation cancelled.",
5251
"failedToGetValidProjectPath": "Failed to get valid project path",
53-
"errorRunningMigrate": "Error running migrate %s",
52+
"errorRunningMigrate": "Migration process failed reason : %s",
5453
"couldNotEnableOmniPreferences": "Could not enable Omni preferences: %s",
5554
"errorSettingDesignersToStandardDataModel": "Error occurred while setting designers to use the standard data model %s",
5655
"exceptionSettingDesignersToStandardDataModel": "Exception occurred while setting designers to use the standard data model %s",
@@ -67,7 +66,7 @@
6766
"migrationCompleted": "Migration completed: %s",
6867
"migrationFailed": "Migration failed: %s",
6968
"formulaSyntaxError": "There was some problem while updating the formula syntax, please check the all the formula's syntax once : %s",
70-
"foundDataRaptorsToMigrate": "Found %s DataRaptors to migrate",
69+
"foundDataRaptorsToMigrate": "Found %s DataMappers to migrate",
7170
"foundFlexCardsToMigrate": "Found %s FlexCards to migrate",
7271
"foundOmniScriptsToMigrate": "Found %s %s to migrate",
7372
"foundGlobalAutoNumbersToMigrate": "Found %s GlobalAutoNumbers to migrate",
@@ -97,7 +96,7 @@
9796
"packageSelectionPrompt": "Enter the number of the package to use (1-%s):",
9897
"invalidPackageSelection": "Invalid selection. Please enter a number between 1 and %s.",
9998
"selectedPackage": "Selected package: %s (Version: %s)",
100-
"dataRaptorNameChangeMessage": "DataRaptor reference %s will be changed to %s during migration.",
99+
"dataRaptorNameChangeMessage": "DataMapper reference %s will be changed to %s during migration.",
101100
"integrationProcedureNameChangeMessage": "Integration Procedure reference %s will be changed to %s during migration.",
102101
"integrationProcedureManualUpdateMessage": "Integration Procedure reference %s may need manual updates after migration.",
103102
"cardAuthorNameChangeMessage": "Card author name has been modified to fit naming rules: %s",
@@ -117,7 +116,6 @@
117116
"labelStatusFailed": "Failed",
118117
"labelStatusComplete": "Complete",
119118
"migrationConsentNotGiven": "Couldn't confirm whether assessment errors are resolved",
120-
"migrationConsentMessage": "Ensure that all items in the assessment report are marked as Green before proceeding with the migration. Do you want to proceed?",
121119
"foundFlexiPages": "Found %s FlexiPages to migrate",
122120
"migratingFlexiPages": "Migrating FlexiPages",
123121
"completedProcessingAllFlexiPages": "Completed processing all flexipage files. Total processed: %s",
@@ -217,5 +215,8 @@
217215
"skipFlexcardAngularOmniScriptDependencyWarning": "Skipping FlexCard %s due to Angular OmniScript dependencies",
218216
"flexCardMigrationProcessingMessage": "Processing %s FlexCards for migration (%s skipped due to Angular dependencies)",
219217
"noMetadataToDeploy": "No metadata to deploy",
220-
"manifestDeployementStarted": "Manifest deployment started with id: %s"
218+
"manifestDeployementStarted": "Manifest deployment started with id: %s",
219+
"migrationConsentMessage": "Make sure that all records listed in the Assessment Status column in the Assessment Report are marked as Green before proceeding with the migration. Do you want to proceed? Yes or No?",
220+
"truncationFailed": "Truncation failed for %s: %s",
221+
"invalidTypeMigrateErrorMessage": "We couldn't migrate your Omnistudio components in the %s namespace. Select the correct namespace and try again"
221222
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
"@types/jsdom": "^21.1.7",
1616
"@types/lodash.chunk": "^4.2.9",
1717
"@types/shelljs": "^0.8.15",
18-
"jsdom": "^25.0.0",
19-
"lodash.chunk": "^4.2.0",
2018
"cli-progress": "^3.12.0",
2119
"diff": "^5.1.0",
20+
"jsdom": "^25.0.0",
21+
"lodash.chunk": "^4.2.0",
2222
"open": "^8.4.2",
2323
"shelljs": "^0.8.5",
2424
"tslib": "^2",

src/commands/omnistudio/migration/assess.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import OmniStudioBaseCommand from '../../basecommand';
55
import { AssessmentInfo } from '../../../utils/interfaces';
66
import { AssessmentReporter } from '../../../utils/resultsbuilder/assessmentReporter';
77
import { OmniScriptExportType, OmniScriptMigrationTool } from '../../../migration/omniscript';
8+
import { InvalidEntityTypeError } from '../../../migration/interfaces';
89
import { CardMigrationTool } from '../../../migration/flexcard';
910
import { DataRaptorMigrationTool } from '../../../migration/dataraptor';
1011
import { GlobalAutoNumberMigrationTool } from '../../../migration/globalautonumber';
@@ -54,8 +55,9 @@ export default class Assess extends OmniStudioBaseCommand {
5455
try {
5556
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
5657
return await this.runAssess();
57-
} catch (error) {
58-
Logger.error(messages.getMessage('errorRunningAssess'), error);
58+
} catch (e) {
59+
const error = e as Error;
60+
Logger.error(messages.getMessage('errorRunningAssess', [error.message]), error);
5961
process.exit(1);
6062
}
6163
}
@@ -71,12 +73,10 @@ export default class Assess extends OmniStudioBaseCommand {
7173
let objectsToProcess: string[];
7274
// To-Do: Add LWC to valid options when GA is released
7375
const validOptions = [Constants.Apex, Constants.ExpSites, Constants.FlexiPage, Constants.LWC];
74-
7576
const apiVersion = conn.getApiVersion();
77+
const orgs: OmnistudioOrgDetails = await OrgUtils.getOrgDetails(conn);
7678

77-
const orgs: OmnistudioOrgDetails = await OrgUtils.getOrgDetails(conn, this.flags.namespace);
78-
79-
if (!orgs.hasValidNamespace && this.flags.namespace) {
79+
if (!orgs.hasValidNamespace) {
8080
Logger.warn(messages.getMessage('invalidNamespace') + orgs.packageDetails.namespace);
8181
}
8282

@@ -126,9 +126,17 @@ export default class Assess extends OmniStudioBaseCommand {
126126
try {
127127
// Assess OmniStudio components
128128
await this.assessOmniStudioComponents(assesmentInfo, assessOnly, namespace, conn, allVersions);
129-
} catch (error) {
130-
Logger.error(`Cannot assess OmniStudio components within ${namespace}`);
131-
process.exit(1);
129+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
130+
} catch (ex: any) {
131+
if (ex instanceof InvalidEntityTypeError) {
132+
Logger.error(messages.getMessage('invalidTypeAssessErrorMessage', [namespace]));
133+
process.exit(1);
134+
}
135+
136+
if (ex instanceof Error) {
137+
Logger.error(messages.getMessage('errorRunningAssess', [ex.message]));
138+
process.exit(1);
139+
}
132140
}
133141

134142
// Assess related objects if specified

src/commands/omnistudio/migration/migrate.ts

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default class Migrate extends OmniStudioBaseCommand {
7373
return await this.runMigration();
7474
} catch (e) {
7575
const error = e as Error;
76-
Logger.error(messages.getMessage('errorRunningMigrate'), error);
76+
Logger.error(messages.getMessage('errorRunningMigrate', [error.message]));
7777
process.exit(1);
7878
}
7979
}
@@ -85,12 +85,11 @@ export default class Migrate extends OmniStudioBaseCommand {
8585
const relatedObjects = (this.flags.relatedobjects || '') as string;
8686
// this.org is guaranteed because requiresUsername=true, as opposed to supportsUsername
8787
const conn = this.org.getConnection();
88-
8988
const apiVersion = conn.getApiVersion();
9089

91-
const orgs: OmnistudioOrgDetails = await OrgUtils.getOrgDetails(conn, this.flags.namespace);
90+
const orgs: OmnistudioOrgDetails = await OrgUtils.getOrgDetails(conn);
9291

93-
if (!orgs.hasValidNamespace && this.flags.namespace) {
92+
if (!orgs.hasValidNamespace) {
9493
Logger.warn(messages.getMessage('invalidNamespace') + orgs.packageDetails.namespace);
9594
}
9695

@@ -174,9 +173,14 @@ export default class Migrate extends OmniStudioBaseCommand {
174173
let objectMigrationResults = await this.truncateObjects([...migrationObjects].reverse(), debugTimer);
175174
const allTruncateComplete = objectMigrationResults.length === 0;
176175

176+
// Log truncation errors if any exist
177+
if (!allTruncateComplete) {
178+
this.logTruncationErrors(objectMigrationResults);
179+
return;
180+
}
181+
177182
if (allTruncateComplete) {
178-
// Migrate in correct dependency order (NOT reversed)
179-
objectMigrationResults = await this.migrateObjects(migrationObjects, debugTimer);
183+
objectMigrationResults = await this.migrateObjects(migrationObjects, debugTimer, namespace);
180184
}
181185

182186
const omnistudioRelatedObjectsMigration = new OmnistudioRelatedObjectMigrationFacade(
@@ -351,7 +355,11 @@ export default class Migrate extends OmniStudioBaseCommand {
351355
return objectMigrationResults;
352356
}
353357

354-
private async migrateObjects(migrationObjects: MigrationTool[], debugTimer: DebugTimer): Promise<MigratedObject[]> {
358+
private async migrateObjects(
359+
migrationObjects: MigrationTool[],
360+
debugTimer: DebugTimer,
361+
namespace: string
362+
): Promise<MigratedObject[]> {
355363
let objectMigrationResults: MigratedObject[] = [];
356364
// Migrate in correct dependency order
357365
for (const cls of migrationObjects) {
@@ -375,7 +383,7 @@ export default class Migrate extends OmniStudioBaseCommand {
375383
);
376384
} catch (ex: any) {
377385
if (ex instanceof InvalidEntityTypeError) {
378-
Logger.error(ex.message);
386+
Logger.error(messages.getMessage('invalidTypeMigrateErrorMessage', [namespace]));
379387
process.exit(1);
380388
}
381389
const errMsg = ex instanceof Error ? ex.message : String(ex);
@@ -672,4 +680,12 @@ export default class Migrate extends OmniStudioBaseCommand {
672680

673681
return mergedResults;
674682
}
683+
684+
private logTruncationErrors(objectMigrationResults: MigratedObject[]): void {
685+
objectMigrationResults.forEach((result) => {
686+
if (result.errors && result.errors.length > 0) {
687+
Logger.error(messages.getMessage('truncationFailed', [result.name, result.errors.join(', ')]));
688+
}
689+
});
690+
}
675691
}

src/migration/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Logger } from '../utils/logger';
88
import { TransformData, UploadRecordResult } from './interfaces';
99
import { NameMappingRegistry } from './NameMappingRegistry';
1010

11-
export type ComponentType = 'Data Mapper' | 'Flexcard' | 'Omniscripts' | 'Integration Procedures' | 'GlobalAutoNumber';
11+
export type ComponentType = 'DataMappers' | 'Flexcards' | 'Omniscripts' | 'Integration Procedures' | 'GlobalAutoNumber';
1212
export type RelatedObjectType = 'Flexipage' | 'ExperienceSites' | 'Lightning Web Components' | 'Apex Classes';
1313

1414
/**

0 commit comments

Comments
 (0)