Skip to content

Commit 48e180b

Browse files
chore: corrected all versions assessment
1 parent 070a70f commit 48e180b

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

messages/assess.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,5 +209,8 @@
209209
"validatingDrVersioningDisabled": "Checking the Data Mapper versioning setting in your org.",
210210
"drVersioningDisabled": "Proceeding with the assessment as the Data Mapper versioning setting is disabled.",
211211
"drVersioningEnabled": "We cannot proceed with the assessment as the Data Mapper versioning setting is enabled in your org.",
212-
"errorValidatingDrVersioning": "Failed to verify the status of the Data Mapper versioning setting. Try again later."
212+
"errorValidatingDrVersioning": "Failed to verify the status of the Data Mapper versioning setting. Try again later.",
213+
"omniStudioAllVersionsProcessingConsent": "Org uses the standard data model. All versions of Omnistudio components such as Omniscripts, Data Mappers, Integration Procedures, and Flexcards must be assessed. But you’ve not specified -a or allversions flag in the command. Proceed to assess all versions of the Omnistudio components? [y/n]",
214+
"omniStudioAllVersionsProcessingConsentNotGiven": "You've not consented to assess all versions of the Omnistudio components. We cannot proceed with the assessment.",
215+
"omniStudioAllVersionsProcessingConsentGiven": "You've consented to assess all versions of the Omnistudio components."
213216
}

messages/migrate.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,9 @@
305305
"manuallyEnableOmniStudioSettingsMetadata": "Manually enable the Omnistudio Metadata setting in your org’s Omnistudio Settings page. Refer <a href='https://help.salesforce.com/s/articleView?id=xcloud.os_enable_omnistudio_metadata_api_support.htm&type=5' target='_blank'>this documentation</a> for more details.",
306306
"omniStudioMetadataEnableConsentNotGiven": "You’ve not consented to proceed with enabling the Omnistudio Metadata setting. We’ll not be able to proceed with the migration.",
307307
"enablingOmniStudioSettingsMetadataStatus": "Enabling Omnistudio Metadata setting…",
308-
"omniStudioAllVersionsMigrationConsent": "Org uses the standard data model. All versions of Omnistudio components such as Omniscripts, Data Mappers, Integration Procedures, and Flexcards must be migrated to enable the Omnistudio Metadata API setting. But you’ve not specified -a or allversions flag in the command. Proceed to migrate all versions of the Omnistudio components? [y/n]",
309-
"omniStudioAllVersionsMigrationConsentNotGiven": "You've not consented to migrate all versions of the Omnistudio components. We cannot proceed with the migration.",
310-
"omniStudioAllVersionsMigrationConsentGiven": "You've consented to migrate all versions of the Omnistudio components.",
308+
"omniStudioAllVersionsProcessingConsent": "Org uses the standard data model. All versions of Omnistudio components such as Omniscripts, Data Mappers, Integration Procedures, and Flexcards must be migrated to enable the Omnistudio Metadata API setting. But you’ve not specified -a or allversions flag in the command. Proceed to migrate all versions of the Omnistudio components? [y/n]",
309+
"omniStudioAllVersionsProcessingConsentNotGiven": "You've not consented to migrate all versions of the Omnistudio components. We cannot proceed with the migration.",
310+
"omniStudioAllVersionsProcessingConsentGiven": "You've consented to migrate all versions of the Omnistudio components.",
311311
"customLWCFlexCardReferenceUpdated": "Updated Custom LWC FlexCard reference: %s -> cf%s",
312312
"validatingDrVersioningDisabled": "Checking the Data Mapper versioning setting in your org.",
313313
"drVersioningDisabled": "Proceeding with the migration as the Data Mapper versioning setting is disabled.",

src/commands/omnistudio/migration/assess.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { ProjectPathUtil } from '../../../utils/projectPathUtil';
2020
import { PreMigrate } from '../../../migration/premigrate';
2121
import { PostMigrate } from '../../../migration/postMigrate';
2222
import { CustomLabelsUtil } from '../../../utils/customLabels';
23-
import { initializeDataModelService } from '../../../utils/dataModelService';
23+
import { initializeDataModelService, isStandardDataModel } from '../../../utils/dataModelService';
2424
import { ValidatorService } from '../../../utils/validatorService';
2525

2626
Messages.importMessagesDirectory(__dirname);
@@ -69,7 +69,7 @@ export default class Assess extends OmniStudioBaseCommand {
6969
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7070
public async runAssess(): Promise<any> {
7171
DebugTimer.getInstance().start();
72-
const allVersions = (this.flags.allversions || false) as boolean;
72+
let allVersions = (this.flags.allversions || false) as boolean;
7373
const assessOnly = (this.flags.only || '') as string;
7474
const relatedObjects = (this.flags.relatedobjects || '') as string;
7575
const isExperienceBundleMetadataAPIProgramaticallyEnabled: { value: boolean } = { value: false };
@@ -94,6 +94,11 @@ export default class Assess extends OmniStudioBaseCommand {
9494
const namespace = orgs.packageDetails.namespace;
9595
let projectPath = '';
9696
const preMigrate: PreMigrate = new PreMigrate(namespace, conn, this.logger, messages, this.ux);
97+
98+
// Handle all versions prerequisite for standard data model
99+
if (isStandardDataModel()) {
100+
allVersions = await preMigrate.handleAllVersionsPrerequisites(allVersions);
101+
}
97102
if (relatedObjects) {
98103
objectsToProcess = relatedObjects.split(',').map((obj) => obj.trim());
99104
projectPath = await ProjectPathUtil.getProjectPath(messages, true);

src/migration/premigrate.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ export class PreMigrate extends BaseMigrationTool {
1818
}
1919

2020
/**
21-
* Ensures all versions are migrated when on standard data model.
21+
* Ensures all versions are processed when on standard data model.
2222
* If the -a flag was not provided, prompts user for consent.
2323
*
2424
* @param allVersionsFlagFromCLI - The allVersions flag value from CLI (-a flag)
25-
* @returns true if all versions should be migrated, false otherwise
25+
* @returns true if all versions should be processed, false otherwise
2626
*/
2727
public async handleAllVersionsPrerequisites(allVersionsFlagFromCLI: boolean): Promise<boolean> {
2828
if (allVersionsFlagFromCLI === false) {
29-
// Get user consent to migrate allversions of OmniStudio components for standard data model migration
30-
const omniStudioAllVersionsMigrationConsent = await this.getOmnistudioAllVersionsMigrationConsent();
31-
if (!omniStudioAllVersionsMigrationConsent) {
32-
Logger.error(this.messages.getMessage('omniStudioAllVersionsMigrationConsentNotGiven'));
29+
// Get user consent to process allversions of OmniStudio components for standard data model migration
30+
const omniStudioProcessAllVersionsConsent = await this.getOmnistudioProcessAllVersionsConsent();
31+
if (!omniStudioProcessAllVersionsConsent) {
32+
Logger.error(this.messages.getMessage('omniStudioAllVersionsProcessingConsentNotGiven'));
3333
process.exit(1);
3434
}
3535

36-
Logger.logVerbose(this.messages.getMessage('omniStudioAllVersionsMigrationConsentGiven'));
36+
Logger.logVerbose(this.messages.getMessage('omniStudioAllVersionsProcessingConsentGiven'));
3737
return true;
3838
}
3939
return allVersionsFlagFromCLI;
@@ -288,7 +288,7 @@ export class PreMigrate extends BaseMigrationTool {
288288
*
289289
* @returns Promise<boolean> - true if user consents, false otherwise
290290
*/
291-
private async getOmnistudioAllVersionsMigrationConsent(): Promise<boolean> {
291+
private async getOmnistudioProcessAllVersionsConsent(): Promise<boolean> {
292292
const askWithTimeOut = PromptUtil.askWithTimeOut(this.messages);
293293
let validResponse = false;
294294
let consent = false;
@@ -297,7 +297,7 @@ export class PreMigrate extends BaseMigrationTool {
297297
try {
298298
const resp = await askWithTimeOut(
299299
Logger.prompt.bind(Logger),
300-
this.messages.getMessage('omniStudioAllVersionsMigrationConsent')
300+
this.messages.getMessage('omniStudioAllVersionsProcessingConsent')
301301
);
302302
const response = typeof resp === 'string' ? resp.trim().toLowerCase() : '';
303303

0 commit comments

Comments
 (0)