Skip to content

Commit 6016ea2

Browse files
Blitz finding fixed
1 parent 86810cc commit 6016ea2

File tree

6 files changed

+27
-22
lines changed

6 files changed

+27
-22
lines changed

messages/assess.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@
2929
"allVersionsDescription": "Migrate all versions of a component",
3030
"changeMessage": " %s will be changed from %s to %s",
3131
"angularOSWarning": " Angular OmniScript will not be migrated, please convert this to LWC based Omniscript",
32-
"apexLwc": "Please select the type of components to assess: 'apex' for Apex classes, 'lwc' for Lightning Web Components, or 'apex,lwc' if you want to include both types.",
32+
"apexLwcGA": "Please select the type of component to assess: 'apex' for Apex classes, 'lwc' for Lightning Web Components, or 'apex,lwc' if you want to include both types.",
33+
"apexLwc": "Please select the type of component to assess: 'apex' for Apex classes.",
3334
"invalidNamespace": "The namespace you have passed is not valid namespace, the valid namespace of your org is ",
3435
"noPackageInstalled": "No package installed on given org.",
3536
"alreadyStandardModel": "The org is already on standard data model.",
36-
"invalidRelatedObjectsOption": "Invalid option provided for -r: %s. Valid options are apex, lwc.",
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.",
3739
"formulaSyntaxError": "There was some problem while updating the formula syntax, please check the all the formula's syntax once : %s",
3840
"errorDuringFlexCardAssessment": "Error during FlexCard assessment",
3941
"errorDuringOmniScriptAssessment": "Error during OmniScript assessment",
@@ -81,9 +83,9 @@
8183
"errorProcessingFiles": "Error in processing files: %s",
8284
"startingProcessRelatedObjects": "Starting processRelatedObjects for %s in project path: %s",
8385
"errorProcessingApexFile": "Error processing Apex file: %s",
84-
"fileUpdatedToAllowRemoteCalls": "File updated to allow remote calls",
85-
"fileUpdatedToAllowCalls": "File updated to allow calls",
86-
"fileImplementsVlocityOpenInterface": "file %s implements VlocityOpenInterface no changes will be applied",
86+
"fileUpdatedToAllowRemoteCalls": "File will be updated to allow remote calls",
87+
"fileUpdatedToAllowCalls": "File will be updated to allow calls",
88+
"fileImplementsVlocityOpenInterface": "File %s implements VlocityOpenInterface no changes will be applied",
8789
"methodCallBundleNameUpdated": "Method call bundle name will be updated in %s for class %s method %s",
8890
"cardNameChangeMessage": "Card name will be changed from {0} to {1} to follow API naming standards",
8991
"authordNameChangeMessage": "Author name will be changed from {0} to {1} to follow API naming standards",

messages/migrate.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@
2929
"errorWhileUploadingCard": "An error ocurred while uploading Card: ",
3030
"errorWhileCreatingElements": "An error ocurred while saving OmniScript elements: ",
3131
"allVersionsDescription": "Migrate all versions of a component",
32-
"apexLwc": "Please select the type of components to migrate: 'apex' for Apex classes, 'lwc' for Lightning Web Components, or 'apex,lwc' if you want to include both types.",
32+
"apexLwcGA": "Please select the type of components to migrate: 'apex' for Apex classes, 'lwc' for Lightning Web Components, or 'apex,lwc' if you want to include both types.",
33+
"apexLwc": "Please select the type of components to migrate: 'apex' for Apex classes.",
3334
"invalidNamespace": "The namespace you have passed is not valid namespace, the valid namespace of your org is ",
3435
"noPackageInstalled": "No package installed on given org.",
3536
"alreadyStandardModel": "The org is already on standard data model.",
36-
"invalidRelatedObjectsOption": "Invalid option provided for -r: %s. Valid options are apex, lwc.",
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.",
3739
"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]",
3840
"userDeclinedConsent": "User declined consent, will not process %s .",
3941
"userConsentedToProceed": "User consented to proceed",

src/commands/omnistudio/migration/assess.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default class Assess extends OmniStudioBaseCommand {
100100
}
101101
const orgs: OmnistudioOrgDetails = await OrgUtils.getOrgDetails(conn, this.flags.namespace);
102102

103-
if (!orgs.hasValidNamespace) {
103+
if (!orgs.hasValidNamespace && this.flags.namespace) {
104104
Logger.warn(messages.getMessage('invalidNamespace') + orgs.packageDetails.namespace);
105105
}
106106

@@ -131,7 +131,7 @@ export default class Assess extends OmniStudioBaseCommand {
131131
};
132132

133133
Logger.log(messages.getMessage('assessmentInitialization', [String(namespace)]));
134-
Logger.logVerbose(messages.getMessage('apiVersionInfo', [String(apiVersion)]));
134+
Logger.log(messages.getMessage('apiVersionInfo', [String(apiVersion)]));
135135
Logger.logVerbose(messages.getMessage('assessmentTargets', [String(this.flags.only || 'all')]));
136136
Logger.logVerbose(messages.getMessage('relatedObjectsInfo', [relatedObjects || 'none']));
137137
Logger.logVerbose(messages.getMessage('allVersionsFlagInfo', [String(allVersions)]));
@@ -141,13 +141,15 @@ export default class Assess extends OmniStudioBaseCommand {
141141
let objectsToProcess: string[];
142142
// Assess related objects if specified
143143
if (relatedObjects) {
144-
const validOptions = [Constants.Apex, Constants.LWC];
144+
// To-Do: Add LWC to valid options when GA is released
145+
const validOptions = [Constants.Apex];
145146
objectsToProcess = relatedObjects.split(',').map((obj) => obj.trim());
146147

147148
// Validate input
148149
for (const obj of objectsToProcess) {
149150
if (!validOptions.includes(obj)) {
150-
Logger.warn(messages.getMessage('invalidRelatedObjectsOption', [String(obj)]));
151+
Logger.error(messages.getMessage('invalidRelatedObjectsOption', [String(obj)]));
152+
process.exit(1);
151153
}
152154
}
153155

src/commands/omnistudio/migration/migrate.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export default class Migrate extends OmniStudioBaseCommand {
9696

9797
const orgs: OmnistudioOrgDetails = await OrgUtils.getOrgDetails(conn, this.flags.namespace);
9898

99-
if (!orgs.hasValidNamespace) {
99+
if (!orgs.hasValidNamespace && this.flags.namespace) {
100100
Logger.warn(messages.getMessage('invalidNamespace') + orgs.packageDetails.namespace);
101101
}
102102

@@ -125,12 +125,14 @@ export default class Migrate extends OmniStudioBaseCommand {
125125
let objectsToProcess: string[] = [];
126126
let targetApexNamespace: string;
127127
if (relatedObjects) {
128-
const validOptions = [Constants.Apex, Constants.LWC];
128+
// To-Do: Add LWC to valid options when GA is released
129+
const validOptions = [Constants.Apex];
129130
objectsToProcess = relatedObjects.split(',').map((obj) => obj.trim());
130131
// Validate input
131132
for (const obj of objectsToProcess) {
132133
if (!validOptions.includes(obj)) {
133-
Logger.warn(messages.getMessage('invalidRelatedObjectsOption', [obj]));
134+
Logger.error(messages.getMessage('invalidRelatedObjectsOption', [obj]));
135+
process.exit(1);
134136
}
135137
}
136138
// Ask for user consent
@@ -145,7 +147,7 @@ export default class Migrate extends OmniStudioBaseCommand {
145147
}
146148

147149
Logger.log(messages.getMessage('migrationInitialization', [String(namespace)]));
148-
Logger.logVerbose(messages.getMessage('apiVersionInfo', [apiVersion]));
150+
Logger.log(messages.getMessage('apiVersionInfo', [apiVersion]));
149151
Logger.logVerbose(messages.getMessage('migrationTargets', [migrateOnly || 'all']));
150152
Logger.logVerbose(messages.getMessage('relatedObjectsInfo', [relatedObjects || 'none']));
151153
Logger.logVerbose(messages.getMessage('allVersionsFlagInfo', [String(allVersions)]));

src/migration/flexcard.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,8 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
117117
progressBar.start(flexCards.length, progressCounter);
118118
const uniqueNames = new Set<string>();
119119

120-
const limitedFlexCards = flexCards.slice(0, 200);
121-
122120
// Now process each OmniScript and its elements
123-
for (const flexCard of limitedFlexCards) {
121+
for (const flexCard of flexCards) {
124122
try {
125123
const flexCardAssessmentInfo = await this.processFlexCard(flexCard, uniqueNames);
126124
flexCardAssessmentInfos.push(flexCardAssessmentInfo);
@@ -143,6 +141,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
143141
}
144142
progressBar.update(++progressCounter);
145143
}
144+
progressBar.stop();
146145
return flexCardAssessmentInfos;
147146
}
148147

@@ -242,7 +241,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
242241
} else if (dataSource.type === Constants.ApexRemoteComponentName) {
243242
const remoteClass = dataSource.value?.remoteClass;
244243
const remoteMethod = dataSource.value?.remoteMethod;
245-
Logger.logVerbose(`Remote Action name: ${remoteClass}.${remoteMethod}`);
244+
Logger.info(`Remote Action name: ${remoteClass}.${remoteMethod}`);
246245

247246
// Avoid duplicates
248247
if (!flexCardAssessmentInfo.dependenciesApexRemoteAction.includes(`${remoteClass}.${remoteMethod}`)) {
@@ -367,7 +366,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
367366
// Check customlwcname property first
368367
if (component.property.customlwcname) {
369368
const customLwcName = component.property.customlwcname;
370-
Logger.logVerbose(`Custom LWC name: ${customLwcName}`);
369+
Logger.info(`Custom LWC name: ${customLwcName}`);
371370

372371
// Avoid duplicates
373372
if (!flexCardAssessmentInfo.dependenciesLWC.includes(customLwcName)) {

src/utils/orgUtils/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,13 @@ export class OrgUtils {
353353
const selectedPackage = installedOmniPackages[selectedIndex];
354354
packageDetails.version = `${selectedPackage.MajorVersion}.${selectedPackage.MinorVersion}`;
355355
packageDetails.namespace = selectedPackage.NamespacePrefix;
356-
hasValidNamespace = true;
357356

358357
Logger.log(messages.getMessage('selectedPackage', [selectedPackage.NamespacePrefix, packageDetails.version]));
359358
} else if (installedOmniPackages.length === 1) {
360359
// Only one package found, use it automatically
361360
const pkg = installedOmniPackages[0];
362361
packageDetails.version = `${pkg.MajorVersion}.${pkg.MinorVersion}`;
363362
packageDetails.namespace = pkg.NamespacePrefix;
364-
hasValidNamespace = true;
365363
}
366364

367365
//Execute apex rest resource to get omnistudio org permission

0 commit comments

Comments
 (0)