Skip to content

Commit dde566d

Browse files
Merge pull request #256 from salesforcecli/u/abhinavkumar2/W-16276171
U/abhinavkumar2/w 16276171
2 parents e3a0d23 + 5a6baab commit dde566d

File tree

8 files changed

+429
-393
lines changed

8 files changed

+429
-393
lines changed

src/migration/dataraptor.ts

Lines changed: 351 additions & 333 deletions
Large diffs are not rendered by default.

src/migration/flexcard.ts

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
9595
const flexCards = await this.getAllActiveCards();
9696
const flexCardsAssessmentInfos = this.processCardComponents(flexCards);
9797
this.ux.log('flexCardsAssessmentInfos');
98-
this.ux.log((flexCardsAssessmentInfos).toString());
98+
// this.ux.log(flexCardsAssessmentInfos.toString());
9999
return flexCardsAssessmentInfos;
100100
} catch (err) {
101101
this.ux.log(err);
@@ -110,22 +110,34 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
110110

111111
// Now process each OmniScript and its elements
112112
for (const flexCard of limitedFlexCards) {
113-
// Await here since processOSComponents is now async
114-
//this.ux.log(flexCard['Name']);
115-
const flexCardAssessmentInfo: FlexCardAssessmentInfo = {
116-
name: flexCard['Name'],
117-
id: '',
118-
dependenciesIP: null,
119-
dependenciesDR: [],
120-
dependenciesOS: [],
121-
infos: [],
122-
warnings: [],
123-
};
124-
flexCardAssessmentInfos.push(flexCardAssessmentInfo);
113+
// Await here since processOSComponents is now async
114+
//this.ux.log(flexCard['Name']);
115+
const flexCardAssessmentInfo: FlexCardAssessmentInfo = {
116+
name: flexCard['Name'],
117+
id: flexCard['Id'],
118+
dependenciesIP: [],
119+
dependenciesDR: [],
120+
dependenciesOS: [],
121+
infos: [],
122+
warnings: [],
123+
};
124+
this.updateDependencies(flexCard, flexCardAssessmentInfo);
125+
flexCardAssessmentInfos.push(flexCardAssessmentInfo);
125126
}
126127
return flexCardAssessmentInfos;
127-
}
128+
}
128129

130+
private updateDependencies(flexCard, flexCardAssessmentInfo): void {
131+
let dataSource = JSON.parse(flexCard[this.namespacePrefix + 'Datasource__c']);
132+
if (dataSource?.datasource) {
133+
dataSource = dataSource.dataSource;
134+
}
135+
if (dataSource['type'] === 'DataRaptor') {
136+
flexCardAssessmentInfo.dependenciesDR.push(dataSource['value']['bundle']);
137+
} else if (dataSource.type === 'IntegrationProcedures') {
138+
flexCardAssessmentInfo.dependenciesIP.push(dataSource['value']['ipMethod']);
139+
}
140+
}
129141
// Query all cards that are active
130142
private async getAllActiveCards(): Promise<AnyJson[]> {
131143
//DebugTimer.getInstance().lap('Query Vlocity Cards');

src/migration/omniscript.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,16 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
219219
for (const elem of elements) {
220220
const type = elem[this.namespacePrefix + 'Type__c'];
221221
const elemName = `${elem['Name']}`;
222+
const propertySet = JSON.parse(elem[this.namespacePrefix + 'PropertySet__c'] || '{}');
222223

223224
// Check for OmniScript dependencies
224225
if (type === 'OmniScript') {
225226
const nameVal = `${elemName}_OmniScript`;
226-
dependencyOS.push(nameVal);
227+
const type = propertySet['Type'];
228+
const subtype = propertySet['Sub Type'];
229+
const language = propertySet['Language'];
230+
const osName = type + '_' + subtype + '_' + language;
231+
dependencyOS.push(osName + ' ( ' + nameVal + ' ) <br>');
227232
if (!existingOmniscriptNames.has(nameVal)) {
228233
missingOS.push(nameVal);
229234
}
@@ -232,24 +237,26 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
232237
// Check for Integration Procedure Action dependencies
233238
if (type === 'Integration Procedure Action') {
234239
const nameVal = `${elemName}_Integration Procedure Action`;
240+
dependencyIP.push(propertySet['integrationProcedureKey'] + ' (' + nameVal + ') <br>');
235241
if (!existingOmniscriptNames.has(nameVal) && !existingFlexCardNames.has(nameVal)) {
236-
dependencyIP.push(nameVal);
237242
missingIP.push(nameVal);
238243
}
239244
}
240245

241246
// Check for DataRaptor dependencies
242247
if (['DataRaptor Extract Action', 'DataRaptor Turbo Action', 'DataRaptor Post Action'].includes(type)) {
243248
const nameVal = `${elemName}_${type}`;
249+
dependencyDR.push(propertySet['bundle'] + ' ( ' + nameVal + ' ) <br>');
244250
if (!existingOmniscriptNames.has(nameVal) && !existingDataRaptorNames.has(nameVal)) {
245-
dependencyDR.push(nameVal);
246251
missingDR.push(nameVal);
247252
}
248253
}
249254

250255
if (type === 'Remote Action') {
251256
const nameVal = `${elemName}_${type}`;
252-
dependenciesRA.push(nameVal);
257+
const className = propertySet['remoteClass'];
258+
const methodName = propertySet['remoteMethod'];
259+
dependenciesRA.push(className + '.' + methodName + ' (' + nameVal + ') <br>');
253260
}
254261
}
255262

@@ -266,10 +273,10 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
266273
const osAssessmentInfo: OSAssessmentInfo = {
267274
name: omniscript['Name'],
268275
id: omniscript['Id'],
269-
dependenciesIP: [],
270-
missingIP: dependencyIP,
271-
dependenciesDR: [],
272-
missingDR: dependencyDR,
276+
dependenciesIP: dependencyIP,
277+
missingIP: [],
278+
dependenciesDR: dependencyDR,
279+
missingDR: [],
273280
dependenciesOS: dependencyOS,
274281
missingOS: missingOS,
275282
dependenciesRemoteAction: dependenciesRA,

src/migration/related/ApexMigration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class ApexMigration extends BaseRelatedObjectMigration implements Related
3030
private readonly callableInterface: InterfaceImplements;
3131
private readonly vlocityOpenInterface2: InterfaceImplements;
3232
private readonly vlocityOpenInterface: InterfaceImplements;
33-
private updatedNamespace = this.namespace;
33+
private updatedNamespace = 'omnistudio';
3434
public constructor(projectPath: string, namespace: string, org: Org) {
3535
super(projectPath, namespace, org);
3636
this.callableInterface = new InterfaceImplements(CALLABLE, this.namespace);
@@ -71,7 +71,7 @@ export class ApexMigration extends BaseRelatedObjectMigration implements Related
7171
if (file.ext !== '.cls') continue;
7272
try {
7373
const apexAssementInfo = this.processApexFile(file);
74-
if (apexAssementInfo && apexAssementInfo.diff && apexAssementInfo.diff.length === 0) continue;
74+
if (apexAssementInfo && apexAssementInfo.diff.length === 0) continue;
7575
fileAssessmentInfo.push(apexAssementInfo);
7676
} catch (err) {
7777
Logger.logger.error(`Error processing ${file.name}`);

src/migration/related/LwcMigration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class LwcMigration extends BaseRelatedObjectMigration {
2525
const type = 'assessment';
2626
const pwd = shell.pwd();
2727
shell.cd(this.projectPath);
28-
// sfProject.retrieve(LWCTYPE, this.org.getUsername());
28+
sfProject.retrieve(LWCTYPE, this.org.getUsername());
2929
const filesMap = this.processLwcFiles(this.projectPath);
3030
shell.cd(pwd);
3131
return this.processFiles(filesMap, type);
@@ -59,7 +59,7 @@ export class LwcMigration extends BaseRelatedObjectMigration {
5959
const jsonData: LWCAssessmentInfo[] = [];
6060
fileMap.forEach((fileList, dir) => {
6161
const changeInfos: FileChangeInfo[] = [];
62-
if (dir !== 'lwc') {
62+
if (dir !== 'lwc' && !dir.endsWith('English') && !dir.includes('_') && !dir.includes('cf')) {
6363
for (const file of fileList) {
6464
if (this.isValideFile(file.name)) {
6565
const processor = FileProcessorFactory.getFileProcessor(file.ext);

src/utils/query/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class QueryTools {
7171
let allrecords = [];
7272

7373
const query = QueryTools.buildCustomObjectQuery(namespace, objectName, fields, filters);
74-
74+
7575
// Execute the query
7676
let results = await connection.query<AnyJson>(query);
7777

src/utils/resultsbuilder/assessmentReporter.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ export class AssessmentReporter {
1717
public static async generate(result: AssessmentInfo, instanceUrl: string): Promise<void> {
1818
let htmlBody = '';
1919

20-
htmlBody += '<br />' + this.generateLwcAssesment(result.lwcAssessmentInfos);
20+
htmlBody += '<br />' + this.generateOmniAssesment(result.omniAssessmentInfo, instanceUrl);
21+
htmlBody += '<br />' + this.generateCardAssesment(result.flexCardAssessmentInfos, instanceUrl);
22+
htmlBody += '<br />' + this.generateDRAssesment(result.dataRaptorAssessmentInfos, instanceUrl);
2123
htmlBody += '<br />' + this.generateApexAssesment(result.apexAssessmentInfos);
22-
htmlBody += '<br />' + this.generateOmniAssesment(result.omniAssessmentInfo);
23-
htmlBody += '<br />' + this.generateCardAssesment(result.flexCardAssessmentInfos);
24-
htmlBody += '<br />' + this.generateDRAssesment(result.dataRaptorAssessmentInfos);
24+
htmlBody += '<br />' + this.generateLwcAssesment(result.lwcAssessmentInfos);
2525

2626
const doc = this.generateDocument(htmlBody);
2727
const fileUrl = process.cwd() + '/assessmentresults.html';
@@ -35,12 +35,12 @@ export class AssessmentReporter {
3535
tableBody += `
3636
<html>
3737
<head>
38-
<title>OmniStudio Migration Results</title>
38+
<title>OmniStudio Migration Assessment</title>
3939
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/design-system/2.17.5/styles/salesforce-lightning-design-system.min.css" />
4040
</head>
4141
<body>
4242
<div style="margin: 20px;">
43-
<div class="slds-text-heading_large">OmniStudio Migration Results</div>`;
43+
<div class="slds-text-heading_large">OmniStudio Migration Assessment</div>`;
4444
tableBody += '<div class="slds-text-heading_large">LWC Assessment</div>';
4545
for (const lwcAssessmentInfo of lwcAssessmentInfos) {
4646
let changeInfoRows = '';
@@ -87,16 +87,16 @@ export class AssessmentReporter {
8787
return this.getApexAssessmentReport(tableBody);
8888
}
8989

90-
private static generateOmniAssesment(omniAssessmentInfo: OmniAssessmentInfo): string {
90+
private static generateOmniAssesment(omniAssessmentInfo: OmniAssessmentInfo, instanceUrl: string): string {
9191
let htmlBody = '';
9292

9393
// htmlBody += '<br />' + this.generateLwcAssesment(result.lwcAssessmentInfos);
94-
htmlBody += '<br />' + this.generateOSAssesment(omniAssessmentInfo.osAssessmentInfos);
95-
htmlBody += '<br />' + this.generateIPAssesment(omniAssessmentInfo.ipAssessmentInfos);
94+
htmlBody += '<br />' + this.generateOSAssesment(omniAssessmentInfo.osAssessmentInfos, instanceUrl);
95+
htmlBody += '<br />' + this.generateIPAssesment(omniAssessmentInfo.ipAssessmentInfos, instanceUrl);
9696
return htmlBody;
9797
}
9898

99-
private static generateOSAssesment(osAssessmentInfos: OSAssessmentInfo[]): string {
99+
private static generateOSAssesment(osAssessmentInfos: OSAssessmentInfo[], instanceUrl: string): string {
100100
let tableBody = '';
101101
tableBody += '<div class="slds-text-heading_large">Omniscript Components Assessment</div>';
102102

@@ -107,26 +107,26 @@ export class AssessmentReporter {
107107
<div class="slds-truncate" title="${osAssessmentInfo.name}">${osAssessmentInfo.name}</div>
108108
</td>
109109
<td style="word-wrap: break-word; white-space: normal; max-width: 100px;">
110-
<div class="slds-truncate" title="${osAssessmentInfo.id}">${osAssessmentInfo.id}</div>
110+
<div class="slds-truncate" title="${osAssessmentInfo.id}"><a href="${instanceUrl}/${osAssessmentInfo.id}">${osAssessmentInfo.id}</div>
111111
</td>
112112
<td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
113113
<div title="${osAssessmentInfo.dependenciesOS}">${osAssessmentInfo.dependenciesOS}</div>
114114
</td>
115-
<td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
115+
<!-- <td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
116116
<div title="${osAssessmentInfo.missingOS}">${osAssessmentInfo.missingOS}</div>
117-
</td>
117+
</td> -->
118118
<td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
119119
<div title="${osAssessmentInfo.dependenciesIP}">${osAssessmentInfo.dependenciesIP}</div>
120120
</td>
121-
<td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
121+
<!-- <td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
122122
<div title="${osAssessmentInfo.missingIP}">${osAssessmentInfo.missingIP}</div>
123-
</td>
123+
</td> -->
124124
<td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
125125
<div title="${osAssessmentInfo.dependenciesDR}">${osAssessmentInfo.dependenciesDR}</div>
126126
</td>
127-
<td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
127+
<!-- <td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
128128
<div title="${osAssessmentInfo.missingDR}">${osAssessmentInfo.missingDR}</div>
129-
</td>
129+
</td> -->
130130
<td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
131131
<div title="${osAssessmentInfo.dependenciesRemoteAction}">${osAssessmentInfo.dependenciesRemoteAction}</div>
132132
</td>
@@ -137,7 +137,7 @@ export class AssessmentReporter {
137137
return this.getOSAssessmentReport(tableBody);
138138
}
139139

140-
private static generateIPAssesment(ipAssessmentInfos: IPAssessmentInfo[]): string {
140+
private static generateIPAssesment(ipAssessmentInfos: IPAssessmentInfo[], instanceUrl: string): string {
141141
let tableBody = '';
142142
tableBody += '<div class="slds-text-heading_large">Integration Procedure Components Assessment</div>';
143143

@@ -148,11 +148,11 @@ export class AssessmentReporter {
148148
<div class="slds-truncate" title="${ipAssessmentInfo.name}">${ipAssessmentInfo.name}</div>
149149
</td>
150150
<td style="word-wrap: break-word; white-space: normal; max-width: 100px;">
151-
<div class="slds-truncate" title="${ipAssessmentInfo.id}">${ipAssessmentInfo.id}</div>
151+
<div class="slds-truncate" title="${ipAssessmentInfo.id}"><a href="${instanceUrl}/${ipAssessmentInfo.id}">${ipAssessmentInfo.id}</div>
152152
</td>
153-
<td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
153+
<!-- <td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
154154
<div title="${ipAssessmentInfo.dependenciesOS}">${ipAssessmentInfo.dependenciesOS}</div>
155-
</td>
155+
</td> -->
156156
<td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
157157
<div title="${ipAssessmentInfo.dependenciesIP}">${ipAssessmentInfo.dependenciesIP}</div>
158158
</td>
@@ -169,7 +169,7 @@ export class AssessmentReporter {
169169
return this.getIPAssessmentReport(tableBody);
170170
}
171171

172-
private static generateCardAssesment(flexCardAssessmentInfos: FlexCardAssessmentInfo[]): string {
172+
private static generateCardAssesment(flexCardAssessmentInfos: FlexCardAssessmentInfo[], instanceUrl: string): string {
173173
let tableBody = '';
174174
tableBody += '<div class="slds-text-heading_large">Flexcard Components Assessment</div>';
175175
for (const card of flexCardAssessmentInfos) {
@@ -179,7 +179,7 @@ export class AssessmentReporter {
179179
<div class="slds-truncate" title="${card.name}">${card.name}</div>
180180
</td>
181181
<td style="word-wrap: break-word; white-space: normal; max-width: 100px;">
182-
<div class="slds-truncate" title="${card.id}">${card.id}</div>
182+
<div class="slds-truncate" title="${card.id}"><a href="${instanceUrl}/${card.id}">${card.id}</div>
183183
</td>
184184
<td style="word-wrap: break-word; white-space: normal; max-width: 60%; overflow: hidden;">
185185
<div title="${card.dependenciesOS}">${card.dependenciesOS}</div>
@@ -197,7 +197,7 @@ export class AssessmentReporter {
197197
return this.getCardAssessmentReport(tableBody);
198198
}
199199

200-
private static generateDRAssesment(dataRaptorAssessmentInfos: DataRaptorAssessmentInfo[]): string {
200+
private static generateDRAssesment(dataRaptorAssessmentInfos: DataRaptorAssessmentInfo[], instanceUrl): string {
201201
let tableBody = '';
202202
tableBody += '<div class="slds-text-heading_large">Data Raptor Components Assessment</div>';
203203
for (const dr of dataRaptorAssessmentInfos) {
@@ -287,21 +287,21 @@ export class AssessmentReporter {
287287
<th class="" scope="col" style="width: 20%; word-wrap: break-word; white-space: normal; text-align: left;">
288288
<div title="Dependencies">Omniscript Dependencies</div>
289289
</th>
290-
<th class="" scope="col" style="width: 20%; word-wrap: break-word; white-space: normal; text-align: left;">
290+
<!-- <th class="" scope="col" style="width: 20%; word-wrap: break-word; white-space: normal; text-align: left;">
291291
<div title="Dependencies">Omniscript Missing Dependencies</div>
292-
</th>
292+
</th> -->
293293
<th class="" scope="col" style="width: 20%; word-wrap: break-word; white-space: normal; text-align: left;">
294294
<div title="Dependencies">Integration Procedures Dependencies</div>
295295
</th>
296-
<th class="" scope="col" style="width: 20%; word-wrap: break-word; white-space: normal; text-align: left;">
296+
<!-- <th class="" scope="col" style="width: 20%; word-wrap: break-word; white-space: normal; text-align: left;">
297297
<div title="Dependencies">Integration Procedures Missing Dependencies</div>
298-
</th>
298+
</th> -->
299299
<th class="" scope="col" style="width: 20%; word-wrap: break-word; white-space: normal; text-align: left;">
300300
<div title="Dependencies">Data Raptor dependencies</div>
301301
</th>
302-
<th class="" scope="col" style="width: 20%; word-wrap: break-word; white-space: normal; text-align: left;">
302+
<!-- <th class="" scope="col" style="width: 20%; word-wrap: break-word; white-space: normal; text-align: left;">
303303
<div title="Dependencies">Data Raptor Missing dependencies</div>
304-
</th>
304+
</th> -->
305305
<th class="" scope="col" style="width: 20%; word-wrap: break-word; white-space: normal; text-align: left;">
306306
<div title="Dependencies">Remote Action dependencies</div>
307307
</th>
@@ -327,9 +327,9 @@ export class AssessmentReporter {
327327
<th class="" scope="col" style="width: 10%; word-wrap: break-word; white-space: normal; text-align: left;">
328328
<div class="slds-truncate" title="ID">ID</div>
329329
</th>
330-
<th class="" scope="col" style="width: 20%; word-wrap: break-word; white-space: normal; text-align: left;">
330+
<!-- <th class="" scope="col" style="width: 20%; word-wrap: break-word; white-space: normal; text-align: left;">
331331
<div title="Dependencies">Omniscript Dependencies</div>
332-
</th>
332+
</th> -->
333333
<th class="" scope="col" style="width: 20%; word-wrap: break-word; white-space: normal; text-align: left;">
334334
<div title="Dependencies">Integration Procedures Dependencies</div>
335335
</th>

src/utils/resultsbuilder/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export class ResultsBuilder {
1313
const doc = this.generateDocument(htmlBody);
1414
const fileUrl = process.cwd() + '/migrationresults.html';
1515
fs.writeFileSync(fileUrl, doc);
16-
1716
await open('file://' + fileUrl);
1817
}
1918

0 commit comments

Comments
 (0)