@salesforce/plugin-omnistudio-migration-tool 2.0.0-rc.4 → 2.0.0-rc.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -40
- package/lib/commands/omnistudio/migration/assess.d.ts +1 -1
- package/lib/commands/omnistudio/migration/assess.js +107 -37
- package/lib/commands/omnistudio/migration/assess.js.map +1 -1
- package/lib/commands/omnistudio/migration/info.js +1 -1
- package/lib/commands/omnistudio/migration/info.js.map +1 -1
- package/lib/commands/omnistudio/migration/migrate.d.ts +35 -5
- package/lib/commands/omnistudio/migration/migrate.js +262 -107
- package/lib/commands/omnistudio/migration/migrate.js.map +1 -1
- package/lib/javascripts/reportGeneratorUtility.js +100 -19
- package/lib/migration/NameMappingRegistry.d.ts +130 -0
- package/lib/migration/NameMappingRegistry.js +376 -0
- package/lib/migration/NameMappingRegistry.js.map +1 -0
- package/lib/migration/base.d.ts +4 -2
- package/lib/migration/base.js +8 -1
- package/lib/migration/base.js.map +1 -1
- package/lib/migration/customLabels.d.ts +49 -0
- package/lib/migration/customLabels.js +190 -0
- package/lib/migration/customLabels.js.map +1 -0
- package/lib/migration/dataraptor.js +63 -14
- package/lib/migration/dataraptor.js.map +1 -1
- package/lib/migration/deployer.d.ts +11 -0
- package/lib/migration/deployer.js +59 -0
- package/lib/migration/deployer.js.map +1 -0
- package/lib/migration/flexcard.d.ts +44 -2
- package/lib/migration/flexcard.js +707 -110
- package/lib/migration/flexcard.js.map +1 -1
- package/lib/migration/globalautonumber.d.ts +6 -6
- package/lib/migration/globalautonumber.js +27 -34
- package/lib/migration/globalautonumber.js.map +1 -1
- package/lib/migration/interfaces.d.ts +5 -0
- package/lib/migration/interfaces.js +7 -0
- package/lib/migration/interfaces.js.map +1 -1
- package/lib/migration/omniscript.d.ts +42 -2
- package/lib/migration/omniscript.js +724 -100
- package/lib/migration/omniscript.js.map +1 -1
- package/lib/migration/postMigrate.d.ts +22 -3
- package/lib/migration/postMigrate.js +147 -12
- package/lib/migration/postMigrate.js.map +1 -1
- package/lib/migration/premigrate.d.ts +16 -0
- package/lib/migration/premigrate.js +122 -0
- package/lib/migration/premigrate.js.map +1 -0
- package/lib/migration/related/ApexMigration.d.ts +1 -0
- package/lib/migration/related/ApexMigration.js +143 -22
- package/lib/migration/related/ApexMigration.js.map +1 -1
- package/lib/migration/related/ExperienceSiteMigration.d.ts +12 -4
- package/lib/migration/related/ExperienceSiteMigration.js +127 -59
- package/lib/migration/related/ExperienceSiteMigration.js.map +1 -1
- package/lib/migration/related/FlexipageMigration.d.ts +4 -4
- package/lib/migration/related/FlexipageMigration.js +31 -30
- package/lib/migration/related/FlexipageMigration.js.map +1 -1
- package/lib/migration/related/LwcMigration.js +27 -16
- package/lib/migration/related/LwcMigration.js.map +1 -1
- package/lib/migration/related/OmnistudioRelatedObjectMigrationFacade.js +30 -24
- package/lib/migration/related/OmnistudioRelatedObjectMigrationFacade.js.map +1 -1
- package/lib/styles/reportGenerator.css +9 -5
- package/lib/templates/assessmentReport.template +67 -6
- package/lib/templates/migrationReport.template +146 -4
- package/lib/utils/OmnistudioSettingsPrefManager.d.ts +12 -0
- package/lib/utils/OmnistudioSettingsPrefManager.js +82 -0
- package/lib/utils/OmnistudioSettingsPrefManager.js.map +1 -0
- package/lib/utils/XMLUtil.js +2 -1
- package/lib/utils/XMLUtil.js.map +1 -1
- package/lib/utils/apex/parser/apexparser.d.ts +8 -1
- package/lib/utils/apex/parser/apexparser.js +63 -10
- package/lib/utils/apex/parser/apexparser.js.map +1 -1
- package/lib/utils/constants/documentRegistry.d.ts +2 -1
- package/lib/utils/constants/documentRegistry.js +4 -3
- package/lib/utils/constants/documentRegistry.js.map +1 -1
- package/lib/utils/constants/stringContants.d.ts +7 -0
- package/lib/utils/constants/stringContants.js +10 -2
- package/lib/utils/constants/stringContants.js.map +1 -1
- package/lib/utils/customLabels.d.ts +34 -0
- package/lib/utils/customLabels.js +97 -0
- package/lib/utils/customLabels.js.map +1 -0
- package/lib/utils/file/fileUtil.d.ts +3 -1
- package/lib/utils/file/fileUtil.js +11 -4
- package/lib/utils/file/fileUtil.js.map +1 -1
- package/lib/utils/flexipage/flexiPageTransformer.js +14 -10
- package/lib/utils/flexipage/flexiPageTransformer.js.map +1 -1
- package/lib/utils/generatePackageXml.d.ts +4 -2
- package/lib/utils/generatePackageXml.js +17 -23
- package/lib/utils/generatePackageXml.js.map +1 -1
- package/lib/utils/interfaces.d.ts +36 -3
- package/lib/utils/logger.js +3 -1
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/lwcparser/fileutils/FileDiffUtil.js +20 -21
- package/lib/utils/lwcparser/fileutils/FileDiffUtil.js.map +1 -1
- package/lib/utils/lwcparser/xmlParser/XmlParser.js +2 -1
- package/lib/utils/lwcparser/xmlParser/XmlParser.js.map +1 -1
- package/lib/utils/orgPreferences.d.ts +1 -0
- package/lib/utils/orgPreferences.js +11 -8
- package/lib/utils/orgPreferences.js.map +1 -1
- package/lib/utils/orgUtils/index.d.ts +1 -1
- package/lib/utils/orgUtils/index.js +14 -14
- package/lib/utils/orgUtils/index.js.map +1 -1
- package/lib/utils/promptUtil.d.ts +2 -0
- package/lib/utils/promptUtil.js +26 -1
- package/lib/utils/promptUtil.js.map +1 -1
- package/lib/utils/reportGenerator/reportInterfaces.d.ts +9 -0
- package/lib/utils/reportGenerator/reportUtil.d.ts +1 -1
- package/lib/utils/reportGenerator/reportUtil.js +6 -3
- package/lib/utils/reportGenerator/reportUtil.js.map +1 -1
- package/lib/utils/resultsbuilder/ApexAssessmentReporter.d.ts +2 -0
- package/lib/utils/resultsbuilder/ApexAssessmentReporter.js +51 -15
- package/lib/utils/resultsbuilder/ApexAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/CustomLabelAssessmentReporter.d.ts +13 -0
- package/lib/utils/resultsbuilder/CustomLabelAssessmentReporter.js +178 -0
- package/lib/utils/resultsbuilder/CustomLabelAssessmentReporter.js.map +1 -0
- package/lib/utils/resultsbuilder/CustomLabelMigrationReporter.d.ts +19 -0
- package/lib/utils/resultsbuilder/CustomLabelMigrationReporter.js +239 -0
- package/lib/utils/resultsbuilder/CustomLabelMigrationReporter.js.map +1 -0
- package/lib/utils/resultsbuilder/DRAssessmentReporter.js +43 -11
- package/lib/utils/resultsbuilder/DRAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/ExperienceSiteAssessmentReporter.d.ts +13 -0
- package/lib/utils/resultsbuilder/ExperienceSiteAssessmentReporter.js +111 -0
- package/lib/utils/resultsbuilder/ExperienceSiteAssessmentReporter.js.map +1 -0
- package/lib/utils/resultsbuilder/FlexcardAssessmentReporter.js +51 -12
- package/lib/utils/resultsbuilder/FlexcardAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/FlexipageAssessmentReporter.d.ts +1 -0
- package/lib/utils/resultsbuilder/FlexipageAssessmentReporter.js +40 -18
- package/lib/utils/resultsbuilder/FlexipageAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/GlobalAutoNumberAssessmentReporter.js +21 -14
- package/lib/utils/resultsbuilder/GlobalAutoNumberAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/IPAssessmentReporter.js +47 -12
- package/lib/utils/resultsbuilder/IPAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/LWCAssessmentReporter.d.ts +14 -0
- package/lib/utils/resultsbuilder/LWCAssessmentReporter.js +143 -139
- package/lib/utils/resultsbuilder/LWCAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/OSAssessmentReporter.js +31 -18
- package/lib/utils/resultsbuilder/OSAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/assessmentReporter.d.ts +6 -1
- package/lib/utils/resultsbuilder/assessmentReporter.js +163 -66
- package/lib/utils/resultsbuilder/assessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/index.d.ts +12 -1
- package/lib/utils/resultsbuilder/index.js +343 -84
- package/lib/utils/resultsbuilder/index.js.map +1 -1
- package/lib/utils/resultsbuilder/reportingHelper.d.ts +2 -7
- package/lib/utils/resultsbuilder/reportingHelper.js +0 -43
- package/lib/utils/resultsbuilder/reportingHelper.js.map +1 -1
- package/lib/utils/sfcli/project/sfProject.d.ts +4 -0
- package/lib/utils/sfcli/project/sfProject.js +56 -1
- package/lib/utils/sfcli/project/sfProject.js.map +1 -1
- package/lib/utils/shell/cli.js +3 -7
- package/lib/utils/shell/cli.js.map +1 -1
- package/lib/utils/storageUtil.d.ts +1 -0
- package/lib/utils/storageUtil.js +3 -0
- package/lib/utils/storageUtil.js.map +1 -1
- package/lib/utils/stringUtils.d.ts +9 -0
- package/lib/utils/stringUtils.js +38 -7
- package/lib/utils/stringUtils.js.map +1 -1
- package/lib/utils/templateParser/model/elementNode.js +11 -2
- package/lib/utils/templateParser/model/elementNode.js.map +1 -1
- package/lib/utils/validatorService.d.ts +13 -0
- package/lib/utils/validatorService.js +69 -0
- package/lib/utils/validatorService.js.map +1 -0
- package/messages/assess.json +125 -55
- package/messages/migrate.json +172 -53
- package/oclif.manifest.json +1 -1
- package/package.json +40 -7
- package/lib/utils/OmniGlobalAutoNumberPrefManager.d.ts +0 -40
- package/lib/utils/OmniGlobalAutoNumberPrefManager.js +0 -65
- package/lib/utils/OmniGlobalAutoNumberPrefManager.js.map +0 -1
|
@@ -9,6 +9,7 @@ const Element_1 = __importDefault(require("../mappings/Element"));
|
|
|
9
9
|
const OmniScriptDefinition_1 = __importDefault(require("../mappings/OmniScriptDefinition"));
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
11
|
const base_1 = require("./base");
|
|
12
|
+
const interfaces_1 = require("./interfaces");
|
|
12
13
|
const net_1 = require("../utils/net");
|
|
13
14
|
const FormulaUtil_1 = require("../utils/formula/FormulaUtil");
|
|
14
15
|
const stringval_1 = require("../utils/StringValue/stringval");
|
|
@@ -19,11 +20,22 @@ const storageUtil_1 = require("../utils/storageUtil");
|
|
|
19
20
|
class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
20
21
|
constructor(exportType, namespace, connection, logger, messages, ux, allVersions) {
|
|
21
22
|
super(namespace, connection, logger, messages, ux);
|
|
23
|
+
// Reserved keys that should not be used for storing output
|
|
24
|
+
this.reservedKeys = new Set(['Request', 'Response', 'Condition']);
|
|
25
|
+
// Tags to validate in PropertySet for reserved key usage
|
|
26
|
+
this.tagsToValidate = new Set(['additionalOutput']);
|
|
27
|
+
// constants
|
|
28
|
+
this.OMNISCRIPT = 'OmniScript';
|
|
22
29
|
this.exportType = exportType;
|
|
23
30
|
this.allVersions = allVersions;
|
|
24
31
|
}
|
|
25
|
-
getName() {
|
|
26
|
-
|
|
32
|
+
getName(singular = false) {
|
|
33
|
+
if (this.exportType === OmniScriptExportType.IP) {
|
|
34
|
+
return singular ? 'Integration Procedure' : 'Integration Procedures';
|
|
35
|
+
}
|
|
36
|
+
else if (this.exportType === OmniScriptExportType.OS) {
|
|
37
|
+
return singular ? 'Omniscript' : 'Omniscripts';
|
|
38
|
+
}
|
|
27
39
|
}
|
|
28
40
|
getRecordName(record) {
|
|
29
41
|
return (record[this.namespacePrefix + 'Type__c'] +
|
|
@@ -116,13 +128,18 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
116
128
|
}
|
|
117
129
|
async assess(dataRaptorAssessmentInfos, flexCardAssessmentInfos) {
|
|
118
130
|
try {
|
|
119
|
-
|
|
131
|
+
const exportComponentType = this.getName();
|
|
132
|
+
logger_1.Logger.log(this.messages.getMessage('startingOmniScriptAssessment', [exportComponentType]));
|
|
120
133
|
const omniscripts = await this.getAllOmniScripts();
|
|
121
|
-
logger_1.Logger.log(this.messages.getMessage('foundOmniScriptsToAssess', [omniscripts.length]));
|
|
134
|
+
logger_1.Logger.log(this.messages.getMessage('foundOmniScriptsToAssess', [omniscripts.length, exportComponentType]));
|
|
122
135
|
const omniAssessmentInfos = await this.processOmniComponents(omniscripts, dataRaptorAssessmentInfos, flexCardAssessmentInfos);
|
|
136
|
+
await this.updateStorageForOmniscriptAssessment(omniAssessmentInfos === null || omniAssessmentInfos === void 0 ? void 0 : omniAssessmentInfos.osAssessmentInfos);
|
|
123
137
|
return omniAssessmentInfos;
|
|
124
138
|
}
|
|
125
139
|
catch (err) {
|
|
140
|
+
if (err instanceof interfaces_1.InvalidEntityTypeError) {
|
|
141
|
+
throw err;
|
|
142
|
+
}
|
|
126
143
|
logger_1.Logger.error(this.messages.getMessage('errorDuringOmniScriptAssessment'), err);
|
|
127
144
|
}
|
|
128
145
|
}
|
|
@@ -133,7 +150,8 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
133
150
|
const existingOmniscriptNames = new Set();
|
|
134
151
|
const existingDataRaptorNames = new Set(dataRaptorAssessmentInfos.map((info) => info.name));
|
|
135
152
|
const existingFlexCardNames = new Set(flexCardAssessmentInfos.map((info) => info.name));
|
|
136
|
-
const
|
|
153
|
+
const progressBarType = this.getName();
|
|
154
|
+
const progressBar = (0, base_2.createProgressBar)('Assessing', progressBarType);
|
|
137
155
|
let progressCounter = 0;
|
|
138
156
|
progressBar.start(omniscripts.length, progressCounter);
|
|
139
157
|
// First, collect all OmniScript names from the omniscripts array
|
|
@@ -161,7 +179,7 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
161
179
|
infos: [],
|
|
162
180
|
warnings: [],
|
|
163
181
|
errors: [this.messages.getMessage('unexpectedError')],
|
|
164
|
-
migrationStatus: '
|
|
182
|
+
migrationStatus: 'Failed',
|
|
165
183
|
type: 'OmniScript',
|
|
166
184
|
missingIP: [],
|
|
167
185
|
missingDR: [],
|
|
@@ -181,6 +199,7 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
181
199
|
warnings: [],
|
|
182
200
|
errors: [this.messages.getMessage('unexpectedError')],
|
|
183
201
|
path: '',
|
|
202
|
+
migrationStatus: 'Failed',
|
|
184
203
|
});
|
|
185
204
|
}
|
|
186
205
|
const error = e;
|
|
@@ -189,11 +208,6 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
189
208
|
}
|
|
190
209
|
if (omniAssessmentInfo.type === 'OmniScript') {
|
|
191
210
|
const type = omniscript[this.namespacePrefix + 'IsLwcEnabled__c'] ? 'LWC' : 'Angular';
|
|
192
|
-
let migrationStatus = 'Can be Automated';
|
|
193
|
-
if (type === 'Angular') {
|
|
194
|
-
omniAssessmentInfo.warnings.unshift(this.messages.getMessage('angularOSWarning'));
|
|
195
|
-
migrationStatus = 'Need Manual Intervention';
|
|
196
|
-
}
|
|
197
211
|
const osAssessmentInfo = {
|
|
198
212
|
name: omniAssessmentInfo.name,
|
|
199
213
|
type: type,
|
|
@@ -210,7 +224,8 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
210
224
|
infos: [],
|
|
211
225
|
warnings: omniAssessmentInfo.warnings,
|
|
212
226
|
errors: [],
|
|
213
|
-
migrationStatus: migrationStatus,
|
|
227
|
+
migrationStatus: omniAssessmentInfo.migrationStatus,
|
|
228
|
+
nameMapping: omniAssessmentInfo.nameMapping,
|
|
214
229
|
};
|
|
215
230
|
osAssessmentInfos.push(osAssessmentInfo);
|
|
216
231
|
}
|
|
@@ -225,6 +240,7 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
225
240
|
dependenciesRemoteAction: omniAssessmentInfo.dependenciesRemoteAction,
|
|
226
241
|
infos: [],
|
|
227
242
|
warnings: omniAssessmentInfo.warnings,
|
|
243
|
+
migrationStatus: omniAssessmentInfo.migrationStatus,
|
|
228
244
|
errors: [],
|
|
229
245
|
path: '',
|
|
230
246
|
};
|
|
@@ -250,10 +266,26 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
250
266
|
const dependenciesRA = [];
|
|
251
267
|
const dependenciesLWC = [];
|
|
252
268
|
//const missingRA: string[] = [];
|
|
269
|
+
// Check for duplicate element names within the same OmniScript
|
|
270
|
+
const elementNames = new Set();
|
|
271
|
+
const duplicateElementNames = new Set();
|
|
272
|
+
// Track reserved keys found in PropertySet
|
|
273
|
+
const foundReservedKeys = new Set();
|
|
274
|
+
for (const elem of elements) {
|
|
275
|
+
const elemName = elem['Name'];
|
|
276
|
+
if (elementNames.has(elemName)) {
|
|
277
|
+
duplicateElementNames.add(elemName);
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
elementNames.add(elemName);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
253
283
|
for (const elem of elements) {
|
|
254
284
|
const type = elem[this.namespacePrefix + 'Type__c'];
|
|
255
285
|
const elemName = `${elem['Name']}`;
|
|
256
286
|
const propertySet = JSON.parse(elem[this.namespacePrefix + 'PropertySet__c'] || '{}');
|
|
287
|
+
// Collect reserved keys from PropertySet
|
|
288
|
+
this.collectReservedKeys(propertySet, foundReservedKeys);
|
|
257
289
|
// Check for OmniScript dependencies
|
|
258
290
|
if (type === 'OmniScript') {
|
|
259
291
|
const nameVal = `${elemName}`;
|
|
@@ -278,7 +310,12 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
278
310
|
}
|
|
279
311
|
}
|
|
280
312
|
// Check for DataRaptor dependencies
|
|
281
|
-
if ([
|
|
313
|
+
if ([
|
|
314
|
+
'DataRaptor Extract Action',
|
|
315
|
+
'DataRaptor Turbo Action',
|
|
316
|
+
'DataRaptor Transform Action',
|
|
317
|
+
'DataRaptor Post Action',
|
|
318
|
+
].includes(type)) {
|
|
282
319
|
const nameVal = `${elemName}`;
|
|
283
320
|
dependencyDR.push({ name: propertySet['bundle'], location: nameVal });
|
|
284
321
|
if (!existingOmniscriptNames.has(nameVal) && !existingDataRaptorNames.has(nameVal)) {
|
|
@@ -318,12 +355,36 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
318
355
|
const existingSubTypeVal = new stringval_1.StringVal(existingSubType, 'sub type');
|
|
319
356
|
const omniScriptName = omniscript[this.namespacePrefix + 'Name'];
|
|
320
357
|
const existingOmniScriptNameVal = new stringval_1.StringVal(omniScriptName, 'name');
|
|
358
|
+
let assessmentStatus = 'Ready for migration';
|
|
321
359
|
const warnings = [];
|
|
322
|
-
|
|
323
|
-
|
|
360
|
+
const errors = [];
|
|
361
|
+
// Check for missing mandatory fields for Integration Procedures
|
|
362
|
+
if (omniProcessType === 'Integration Procedure') {
|
|
363
|
+
if (!existingType || existingType.trim() === '') {
|
|
364
|
+
errors.push(this.messages.getMessage('missingMandatoryField', ['Type', 'Integration Procedure']));
|
|
365
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
366
|
+
}
|
|
367
|
+
if (!existingSubType || existingSubType.trim() === '') {
|
|
368
|
+
errors.push(this.messages.getMessage('missingMandatoryField', ['SubType', 'Integration Procedure']));
|
|
369
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
// Check for Angular OmniScript dependencies
|
|
373
|
+
for (const osDep of dependencyOS) {
|
|
374
|
+
if (this.nameRegistry.isAngularOmniScript(osDep.name)) {
|
|
375
|
+
warnings.push(this.messages.getMessage('angularOmniScriptDependencyWarning', [osDep.location, osDep.name]));
|
|
376
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
377
|
+
}
|
|
324
378
|
}
|
|
325
|
-
|
|
326
|
-
|
|
379
|
+
// This we need broken down, better create an object and propagate it
|
|
380
|
+
// Here break it and then combine it
|
|
381
|
+
const newType = existingTypeVal.cleanName();
|
|
382
|
+
const newSubType = existingSubTypeVal.cleanName();
|
|
383
|
+
const newLanguage = omniscript[this.namespacePrefix + 'Language__c']
|
|
384
|
+
? `${omniscript[this.namespacePrefix + 'Language__c']}`
|
|
385
|
+
: '';
|
|
386
|
+
const recordName = `${newType}_` +
|
|
387
|
+
`${newSubType}` +
|
|
327
388
|
(omniscript[this.namespacePrefix + 'Language__c'] ? `_${omniscript[this.namespacePrefix + 'Language__c']}` : '') +
|
|
328
389
|
`_${omniscript[this.namespacePrefix + 'Version__c']}`;
|
|
329
390
|
const oldName = `${existingTypeVal.val}_` +
|
|
@@ -331,18 +392,32 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
331
392
|
(omniscript[this.namespacePrefix + 'Language__c'] ? `_${omniscript[this.namespacePrefix + 'Language__c']}` : '') +
|
|
332
393
|
`_${omniscript[this.namespacePrefix + 'Version__c']}`;
|
|
333
394
|
if (!existingTypeVal.isNameCleaned()) {
|
|
334
|
-
|
|
335
|
-
existingTypeVal.
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
395
|
+
if (omniProcessType === 'Integration Procedure' && (!newType || newType.trim() === '')) {
|
|
396
|
+
warnings.push(this.messages.getMessage('integrationProcedureTypeEmptyAfterCleaning', [existingTypeVal.val]));
|
|
397
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
warnings.push(this.messages.getMessage('changeMessage', [
|
|
401
|
+
existingTypeVal.type,
|
|
402
|
+
existingTypeVal.val,
|
|
403
|
+
existingTypeVal.cleanName(),
|
|
404
|
+
]));
|
|
405
|
+
assessmentStatus = 'Warnings';
|
|
406
|
+
}
|
|
339
407
|
}
|
|
340
408
|
if (!existingSubTypeVal.isNameCleaned()) {
|
|
341
|
-
|
|
342
|
-
existingSubTypeVal.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
409
|
+
if (omniProcessType === 'Integration Procedure' && (!newSubType || newSubType.trim() === '')) {
|
|
410
|
+
warnings.push(this.messages.getMessage('integrationProcedureSubtypeEmptyAfterCleaning', [existingSubTypeVal.val]));
|
|
411
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
warnings.push(this.messages.getMessage('changeMessage', [
|
|
415
|
+
existingSubTypeVal.type,
|
|
416
|
+
existingSubTypeVal.val,
|
|
417
|
+
existingSubTypeVal.cleanName(),
|
|
418
|
+
]));
|
|
419
|
+
assessmentStatus = 'Warnings';
|
|
420
|
+
}
|
|
346
421
|
}
|
|
347
422
|
if (!existingOmniScriptNameVal.isNameCleaned()) {
|
|
348
423
|
warnings.push(this.messages.getMessage('changeMessage', [
|
|
@@ -350,14 +425,35 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
350
425
|
existingOmniScriptNameVal.val,
|
|
351
426
|
existingOmniScriptNameVal.cleanName(),
|
|
352
427
|
]));
|
|
428
|
+
assessmentStatus = 'Warnings';
|
|
353
429
|
}
|
|
354
430
|
if (existingOmniscriptNames.has(recordName)) {
|
|
355
431
|
warnings.push(this.messages.getMessage('duplicatedName') + ' ' + recordName);
|
|
432
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
356
433
|
}
|
|
357
434
|
else {
|
|
358
435
|
existingOmniscriptNames.add(recordName);
|
|
359
436
|
}
|
|
360
|
-
|
|
437
|
+
// Add warning for duplicate element names within the same OmniScript
|
|
438
|
+
if (duplicateElementNames.size > 0) {
|
|
439
|
+
const duplicateNamesList = Array.from(duplicateElementNames).join(', ');
|
|
440
|
+
warnings.unshift(this.messages.getMessage('invalidOrRepeatingOmniscriptElementNames', [duplicateNamesList]));
|
|
441
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
442
|
+
}
|
|
443
|
+
// Add warning for reserved keys found in PropertySet
|
|
444
|
+
if (foundReservedKeys.size > 0) {
|
|
445
|
+
const reservedKeysList = Array.from(foundReservedKeys).join(', ');
|
|
446
|
+
warnings.unshift(this.messages.getMessage('reservedKeysFoundInPropertySet', [reservedKeysList]));
|
|
447
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
448
|
+
}
|
|
449
|
+
if (omniProcessType === this.OMNISCRIPT) {
|
|
450
|
+
const type = omniscript[this.namespacePrefix + 'IsLwcEnabled__c'] ? 'LWC' : 'Angular';
|
|
451
|
+
if (type === 'Angular') {
|
|
452
|
+
warnings.unshift(this.messages.getMessage('angularOSWarning'));
|
|
453
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
const result = {
|
|
361
457
|
name: recordName,
|
|
362
458
|
id: omniscript['Id'],
|
|
363
459
|
oldName: oldName,
|
|
@@ -369,12 +465,74 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
369
465
|
infos: [],
|
|
370
466
|
warnings: warnings,
|
|
371
467
|
errors: [],
|
|
372
|
-
migrationStatus:
|
|
468
|
+
migrationStatus: assessmentStatus,
|
|
373
469
|
type: omniProcessType,
|
|
374
470
|
missingDR: missingDR,
|
|
375
471
|
missingIP: missingIP,
|
|
376
472
|
missingOS: missingOS,
|
|
377
473
|
};
|
|
474
|
+
if (omniProcessType === this.OMNISCRIPT) {
|
|
475
|
+
const nameMapping = {
|
|
476
|
+
oldType: existingType,
|
|
477
|
+
oldSubtype: existingSubType,
|
|
478
|
+
oldLanguage: omniscript[this.namespacePrefix + 'Language__c'],
|
|
479
|
+
newType: newType,
|
|
480
|
+
newSubType: newSubType,
|
|
481
|
+
newLanguage: newLanguage,
|
|
482
|
+
};
|
|
483
|
+
result.nameMapping = nameMapping;
|
|
484
|
+
}
|
|
485
|
+
return result;
|
|
486
|
+
}
|
|
487
|
+
updateStorageForOmniscriptAssessment(osAssessmentInfo) {
|
|
488
|
+
if (osAssessmentInfo === undefined || osAssessmentInfo === null) {
|
|
489
|
+
logger_1.Logger.error(this.messages.getMessage('missingInfo'));
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
let storage = storageUtil_1.StorageUtil.getOmnistudioAssessmentStorage();
|
|
493
|
+
logger_1.Logger.logVerbose(this.messages.getMessage('updatingStorageForOmniscipt', ['Assessment']));
|
|
494
|
+
for (let currentOsRecordInfo of osAssessmentInfo) {
|
|
495
|
+
try {
|
|
496
|
+
let nameMapping = currentOsRecordInfo.nameMapping;
|
|
497
|
+
if (nameMapping === undefined) {
|
|
498
|
+
logger_1.Logger.logVerbose(this.messages.getMessage('nameMappingUndefined'));
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
501
|
+
let value = {
|
|
502
|
+
type: nameMapping.newType,
|
|
503
|
+
subtype: nameMapping.newSubType,
|
|
504
|
+
language: nameMapping.newLanguage,
|
|
505
|
+
isDuplicate: false,
|
|
506
|
+
};
|
|
507
|
+
if (currentOsRecordInfo.errors && currentOsRecordInfo.errors.length > 0) {
|
|
508
|
+
value.error = currentOsRecordInfo.errors;
|
|
509
|
+
value.migrationSuccess = false;
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
value.migrationSuccess = true;
|
|
513
|
+
}
|
|
514
|
+
let finalKey = `${nameMapping.oldType}${nameMapping.oldSubtype}${this.cleanLanguageName(nameMapping.oldLanguage)}`;
|
|
515
|
+
finalKey = finalKey.toLowerCase();
|
|
516
|
+
if (storage.osStorage.has(finalKey)) {
|
|
517
|
+
// Key already exists - handle accordingly
|
|
518
|
+
logger_1.Logger.logVerbose(this.messages.getMessage('keyAlreadyInStorage', [finalKey]));
|
|
519
|
+
value.isDuplicate = true;
|
|
520
|
+
storage.osStorage.set(finalKey, value);
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
// Key doesn't exist - safe to set
|
|
524
|
+
storage.osStorage.set(finalKey, value);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
catch (error) {
|
|
528
|
+
logger_1.Logger.error(error);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
storageUtil_1.StorageUtil.printAssessmentStorage();
|
|
532
|
+
}
|
|
533
|
+
cleanLanguageName(language) {
|
|
534
|
+
// replace -, ( and ) and space with ''
|
|
535
|
+
return language.replace(/[-() ]/g, '');
|
|
378
536
|
}
|
|
379
537
|
async migrate() {
|
|
380
538
|
// Get All Records from OmniScript__c (IP & OS Parent Records)
|
|
@@ -385,10 +543,14 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
385
543
|
// Variables to be returned After Migration
|
|
386
544
|
let originalOsRecords = new Map();
|
|
387
545
|
let osUploadInfo = new Map();
|
|
388
|
-
|
|
389
|
-
|
|
546
|
+
const exportComponentType = this.getName();
|
|
547
|
+
logger_1.Logger.log(this.messages.getMessage('foundOmniScriptsToMigrate', [omniscripts.length, exportComponentType]));
|
|
548
|
+
const progressBarType = exportComponentType;
|
|
549
|
+
const progressBar = (0, base_2.createProgressBar)('Migrating', progressBarType);
|
|
390
550
|
let progressCounter = 0;
|
|
391
551
|
progressBar.start(omniscripts.length, progressCounter);
|
|
552
|
+
let foundAngularBasedOmniScripts = false;
|
|
553
|
+
const angularWarningMessage = this.messages.getMessage('angularOmniscriptWarningMessage');
|
|
392
554
|
for (let omniscript of omniscripts) {
|
|
393
555
|
const mappedRecords = [];
|
|
394
556
|
// const originalRecords = new Map<string, AnyJson>();
|
|
@@ -405,20 +567,18 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
405
567
|
const type = omniscript[this.namespacePrefix + 'IsLwcEnabled__c'] ? 'LWC' : 'Angular';
|
|
406
568
|
if (type === 'Angular') {
|
|
407
569
|
// Skip Angular OmniScripts and add a warning record
|
|
408
|
-
const warningMessage = this.messages.getMessage('angularOmniscriptWarningMessage');
|
|
409
570
|
const skippedResponse = {
|
|
410
571
|
referenceId: recordId,
|
|
411
572
|
id: '',
|
|
412
573
|
success: false,
|
|
413
|
-
hasErrors:
|
|
414
|
-
errors: [
|
|
415
|
-
warnings: [],
|
|
574
|
+
hasErrors: false,
|
|
575
|
+
errors: [],
|
|
576
|
+
warnings: [angularWarningMessage],
|
|
416
577
|
newName: '',
|
|
578
|
+
skipped: true,
|
|
417
579
|
};
|
|
418
580
|
osUploadInfo.set(recordId, skippedResponse);
|
|
419
|
-
|
|
420
|
-
logger_1.Logger.warn(warningMessage);
|
|
421
|
-
progressBar.start(omniscripts.length, progressCounter);
|
|
581
|
+
foundAngularBasedOmniScripts = true;
|
|
422
582
|
continue;
|
|
423
583
|
}
|
|
424
584
|
}
|
|
@@ -426,11 +586,78 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
426
586
|
omniscript[`${this.namespacePrefix}IsActive__c`] = false;
|
|
427
587
|
// Get All elements for each OmniScript__c record(i.e IP/OS)
|
|
428
588
|
const elements = await this.getAllElementsForOmniScript(recordId);
|
|
589
|
+
// Check for duplicate element names within the same OmniScript
|
|
590
|
+
const elementNames = new Set();
|
|
591
|
+
const duplicateElementNames = new Set();
|
|
592
|
+
for (const elem of elements) {
|
|
593
|
+
const elemName = elem['Name'];
|
|
594
|
+
if (elementNames.has(elemName)) {
|
|
595
|
+
duplicateElementNames.add(elemName);
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
elementNames.add(elemName);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
// If duplicate element names found, skip this OmniScript
|
|
602
|
+
if (duplicateElementNames.size > 0) {
|
|
603
|
+
const duplicateNamesList = Array.from(duplicateElementNames).join(', ');
|
|
604
|
+
const skippedResponse = {
|
|
605
|
+
referenceId: recordId,
|
|
606
|
+
id: '',
|
|
607
|
+
success: false,
|
|
608
|
+
hasErrors: false,
|
|
609
|
+
errors: [],
|
|
610
|
+
warnings: [this.messages.getMessage('invalidOrRepeatingOmniscriptElementNames', [duplicateNamesList])],
|
|
611
|
+
newName: '',
|
|
612
|
+
skipped: true,
|
|
613
|
+
};
|
|
614
|
+
osUploadInfo.set(recordId, skippedResponse);
|
|
615
|
+
originalOsRecords.set(recordId, omniscript);
|
|
616
|
+
continue;
|
|
617
|
+
}
|
|
429
618
|
if (omniscript[`${this.namespacePrefix}IsProcedure__c`] === true) {
|
|
619
|
+
// Check for missing mandatory fields for Integration Procedures
|
|
620
|
+
const existingType = omniscript[this.namespacePrefix + 'Type__c'];
|
|
621
|
+
const existingSubType = omniscript[this.namespacePrefix + 'SubType__c'];
|
|
622
|
+
if (!existingType || existingType.trim() === '') {
|
|
623
|
+
const skippedResponse = {
|
|
624
|
+
referenceId: recordId,
|
|
625
|
+
id: '',
|
|
626
|
+
success: false,
|
|
627
|
+
hasErrors: true,
|
|
628
|
+
errors: [this.messages.getMessage('missingMandatoryField', ['Type', 'Integration Procedure'])],
|
|
629
|
+
warnings: [],
|
|
630
|
+
newName: '',
|
|
631
|
+
skipped: true,
|
|
632
|
+
};
|
|
633
|
+
osUploadInfo.set(recordId, skippedResponse);
|
|
634
|
+
originalOsRecords.set(recordId, omniscript);
|
|
635
|
+
continue;
|
|
636
|
+
}
|
|
637
|
+
if (!existingSubType || existingSubType.trim() === '') {
|
|
638
|
+
const skippedResponse = {
|
|
639
|
+
referenceId: recordId,
|
|
640
|
+
id: '',
|
|
641
|
+
success: false,
|
|
642
|
+
hasErrors: true,
|
|
643
|
+
errors: [this.messages.getMessage('missingMandatoryField', ['SubType', 'Integration Procedure'])],
|
|
644
|
+
warnings: [],
|
|
645
|
+
newName: '',
|
|
646
|
+
skipped: true,
|
|
647
|
+
};
|
|
648
|
+
osUploadInfo.set(recordId, skippedResponse);
|
|
649
|
+
originalOsRecords.set(recordId, omniscript);
|
|
650
|
+
continue;
|
|
651
|
+
}
|
|
652
|
+
// Check for reserved keys in PropertySet for Integration Procedures
|
|
653
|
+
const foundReservedKeys = new Set();
|
|
430
654
|
// do the formula replacement from custom to standard notation
|
|
431
655
|
if (functionDefinitionMetadata.length > 0 && elements.length > 0) {
|
|
432
656
|
for (let ipElement of elements) {
|
|
433
657
|
if (ipElement[`${this.namespacePrefix}PropertySet__c`] != null) {
|
|
658
|
+
// Check for reserved keys while processing the PropertySet
|
|
659
|
+
const propertySet = JSON.parse(ipElement[`${this.namespacePrefix}PropertySet__c`] || '{}');
|
|
660
|
+
this.collectReservedKeys(propertySet, foundReservedKeys);
|
|
434
661
|
var originalString = ipElement[`${this.namespacePrefix}PropertySet__c`];
|
|
435
662
|
try {
|
|
436
663
|
originalString = (0, FormulaUtil_1.getReplacedString)(this.namespacePrefix, ipElement[`${this.namespacePrefix}PropertySet__c`], functionDefinitionMetadata);
|
|
@@ -443,12 +670,66 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
443
670
|
}
|
|
444
671
|
}
|
|
445
672
|
}
|
|
673
|
+
// If reserved keys found, skip this IP
|
|
674
|
+
if (foundReservedKeys.size > 0) {
|
|
675
|
+
const reservedKeysList = Array.from(foundReservedKeys).join(', ');
|
|
676
|
+
const skippedResponse = {
|
|
677
|
+
referenceId: recordId,
|
|
678
|
+
id: '',
|
|
679
|
+
success: false,
|
|
680
|
+
hasErrors: false,
|
|
681
|
+
errors: [],
|
|
682
|
+
warnings: [this.messages.getMessage('reservedKeysFoundInPropertySet', [reservedKeysList])],
|
|
683
|
+
newName: '',
|
|
684
|
+
skipped: true,
|
|
685
|
+
};
|
|
686
|
+
osUploadInfo.set(recordId, skippedResponse);
|
|
687
|
+
originalOsRecords.set(recordId, omniscript);
|
|
688
|
+
continue;
|
|
689
|
+
}
|
|
446
690
|
}
|
|
447
691
|
// Perform the transformation for OS/IP Parent Record from OmniScript__c
|
|
448
692
|
const mappedOmniScript = this.mapOmniScriptRecord(omniscript);
|
|
449
693
|
// Clean type, subtype
|
|
450
694
|
mappedOmniScript[OmniScript_1.default.Type__c] = this.cleanName(mappedOmniScript[OmniScript_1.default.Type__c]);
|
|
451
695
|
mappedOmniScript[OmniScript_1.default.SubType__c] = this.cleanName(mappedOmniScript[OmniScript_1.default.SubType__c]);
|
|
696
|
+
// Check if Type or SubType becomes empty after cleaning for Integration Procedures
|
|
697
|
+
if (omniscript[`${this.namespacePrefix}IsProcedure__c`]) {
|
|
698
|
+
const originalType = omniscript[this.namespacePrefix + 'Type__c'];
|
|
699
|
+
const originalSubType = omniscript[this.namespacePrefix + 'SubType__c'];
|
|
700
|
+
if (!mappedOmniScript[OmniScript_1.default.Type__c] ||
|
|
701
|
+
mappedOmniScript[OmniScript_1.default.Type__c].trim() === '') {
|
|
702
|
+
const skippedResponse = {
|
|
703
|
+
referenceId: recordId,
|
|
704
|
+
id: '',
|
|
705
|
+
success: false,
|
|
706
|
+
hasErrors: true,
|
|
707
|
+
errors: [this.messages.getMessage('integrationProcedureTypeEmptyAfterCleaning', [originalType])],
|
|
708
|
+
warnings: [],
|
|
709
|
+
newName: '',
|
|
710
|
+
skipped: true,
|
|
711
|
+
};
|
|
712
|
+
osUploadInfo.set(recordId, skippedResponse);
|
|
713
|
+
originalOsRecords.set(recordId, omniscript);
|
|
714
|
+
continue;
|
|
715
|
+
}
|
|
716
|
+
if (!mappedOmniScript[OmniScript_1.default.SubType__c] ||
|
|
717
|
+
mappedOmniScript[OmniScript_1.default.SubType__c].trim() === '') {
|
|
718
|
+
const skippedResponse = {
|
|
719
|
+
referenceId: recordId,
|
|
720
|
+
id: '',
|
|
721
|
+
success: false,
|
|
722
|
+
hasErrors: true,
|
|
723
|
+
errors: [this.messages.getMessage('integrationProcedureSubtypeEmptyAfterCleaning', [originalSubType])],
|
|
724
|
+
warnings: [],
|
|
725
|
+
newName: '',
|
|
726
|
+
skipped: true,
|
|
727
|
+
};
|
|
728
|
+
osUploadInfo.set(recordId, skippedResponse);
|
|
729
|
+
originalOsRecords.set(recordId, omniscript);
|
|
730
|
+
continue;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
452
733
|
// Check duplicated name
|
|
453
734
|
let mappedOsName;
|
|
454
735
|
if (this.allVersions) {
|
|
@@ -474,17 +755,17 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
474
755
|
'_1';
|
|
475
756
|
}
|
|
476
757
|
if (duplicatedNames.has(mappedOsName)) {
|
|
477
|
-
this.setRecordErrors(omniscript, this.messages.getMessage('duplicatedOSName'));
|
|
478
758
|
originalOsRecords.set(recordId, omniscript);
|
|
479
|
-
const warningMessage = this.messages.getMessage('duplicatedOSName');
|
|
759
|
+
const warningMessage = this.messages.getMessage('duplicatedOSName', [this.getName(true), mappedOsName]);
|
|
480
760
|
const skippedResponse = {
|
|
481
761
|
referenceId: recordId,
|
|
482
762
|
id: '',
|
|
483
763
|
success: false,
|
|
484
|
-
hasErrors:
|
|
485
|
-
errors: [
|
|
486
|
-
warnings: [],
|
|
764
|
+
hasErrors: false,
|
|
765
|
+
errors: [],
|
|
766
|
+
warnings: [warningMessage],
|
|
487
767
|
newName: '',
|
|
768
|
+
skipped: true,
|
|
488
769
|
};
|
|
489
770
|
osUploadInfo.set(recordId, skippedResponse);
|
|
490
771
|
continue;
|
|
@@ -494,25 +775,44 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
494
775
|
mappedRecords.push(mappedOmniScript);
|
|
495
776
|
// Save the OmniScript__c records to Standard BPO i.e OmniProcess
|
|
496
777
|
const osUploadResponse = await net_1.NetUtils.createOne(this.connection, OmniScriptMigrationTool.OMNIPROCESS_NAME, recordId, mappedOmniScript);
|
|
497
|
-
if (osUploadResponse.success) {
|
|
778
|
+
if (!(osUploadResponse === null || osUploadResponse === void 0 ? void 0 : osUploadResponse.success)) {
|
|
779
|
+
osUploadResponse.errors = Array.isArray(osUploadResponse.errors)
|
|
780
|
+
? osUploadResponse.errors
|
|
781
|
+
: [osUploadResponse.errors];
|
|
782
|
+
osUploadInfo.set(recordId, osUploadResponse);
|
|
783
|
+
continue;
|
|
784
|
+
}
|
|
785
|
+
if (osUploadResponse === null || osUploadResponse === void 0 ? void 0 : osUploadResponse.success) {
|
|
498
786
|
// Fix errors
|
|
499
|
-
if (!osUploadResponse.success) {
|
|
500
|
-
osUploadResponse.errors = Array.isArray(osUploadResponse.errors)
|
|
501
|
-
? osUploadResponse.errors
|
|
502
|
-
: [osUploadResponse.errors];
|
|
503
|
-
}
|
|
504
787
|
osUploadResponse.warnings = osUploadResponse.warnings || [];
|
|
505
788
|
osUploadResponse.type = mappedOmniScript[OmniScript_1.default.Type__c];
|
|
506
789
|
osUploadResponse.subtype = mappedOmniScript[OmniScript_1.default.SubType__c];
|
|
507
790
|
osUploadResponse.language = mappedOmniScript[OmniScript_1.default.Language__c];
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
791
|
+
let originalOsName;
|
|
792
|
+
if (this.allVersions) {
|
|
793
|
+
originalOsName =
|
|
794
|
+
omniscript[this.namespacePrefix + 'Type__c'] +
|
|
795
|
+
'_' +
|
|
796
|
+
omniscript[this.namespacePrefix + 'SubType__c'] +
|
|
797
|
+
'_' +
|
|
798
|
+
omniscript[this.namespacePrefix + 'Language__c'] +
|
|
799
|
+
'_' +
|
|
800
|
+
(omniscript[this.namespacePrefix + 'Version__c'] || '1');
|
|
801
|
+
}
|
|
802
|
+
else {
|
|
803
|
+
originalOsName =
|
|
804
|
+
omniscript[this.namespacePrefix + 'Type__c'] +
|
|
805
|
+
'_' +
|
|
806
|
+
omniscript[this.namespacePrefix + 'SubType__c'] +
|
|
807
|
+
'_' +
|
|
808
|
+
omniscript[this.namespacePrefix + 'Language__c'] +
|
|
809
|
+
'_1';
|
|
810
|
+
}
|
|
811
|
+
// Always set the new name to show the migrated name
|
|
812
|
+
osUploadResponse.newName = mappedOsName;
|
|
813
|
+
// Only add warning if the name was actually modified
|
|
513
814
|
if (originalOsName !== mappedOsName) {
|
|
514
|
-
osUploadResponse.
|
|
515
|
-
osUploadResponse.warnings.unshift('WARNING: OmniScript name has been modified to fit naming rules: ' + mappedOsName);
|
|
815
|
+
osUploadResponse.warnings.unshift(`${this.getName(true)} name has been modified to fit naming rules: ${mappedOsName}`);
|
|
516
816
|
}
|
|
517
817
|
try {
|
|
518
818
|
// Upload All elements for each OmniScript__c record(i.e IP/OS)
|
|
@@ -534,7 +834,7 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
534
834
|
if (!updateResult.success) {
|
|
535
835
|
osUploadResponse.hasErrors = true;
|
|
536
836
|
osUploadResponse.errors = osUploadResponse.errors || [];
|
|
537
|
-
osUploadResponse.errors.push(this.messages.getMessage('errorWhileActivatingOs') + updateResult.errors);
|
|
837
|
+
osUploadResponse.errors.push(this.messages.getMessage('errorWhileActivatingOs', [this.getName(true)]) + updateResult.errors);
|
|
538
838
|
}
|
|
539
839
|
}
|
|
540
840
|
}
|
|
@@ -557,7 +857,7 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
557
857
|
error = e.toString();
|
|
558
858
|
}
|
|
559
859
|
}
|
|
560
|
-
osUploadResponse.errors.push(this.messages.getMessage('errorWhileCreatingElements') + error);
|
|
860
|
+
osUploadResponse.errors.push(this.messages.getMessage('errorWhileCreatingElements', [this.getName(true)]) + error);
|
|
561
861
|
}
|
|
562
862
|
finally {
|
|
563
863
|
// Create the return records and response which have been processed
|
|
@@ -567,13 +867,16 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
567
867
|
originalOsRecords.set(recordId, omniscript);
|
|
568
868
|
}
|
|
569
869
|
progressBar.stop();
|
|
870
|
+
if (foundAngularBasedOmniScripts) {
|
|
871
|
+
logger_1.Logger.warn(angularWarningMessage);
|
|
872
|
+
}
|
|
570
873
|
this.updateStorageForOmniscript(osUploadInfo, originalOsRecords);
|
|
571
874
|
const objectMigrationResults = [];
|
|
572
875
|
if (this.exportType === OmniScriptExportType.All || this.exportType === OmniScriptExportType.IP) {
|
|
573
876
|
objectMigrationResults.push(this.getMigratedRecordsByType('Integration Procedures', osUploadInfo, originalOsRecords));
|
|
574
877
|
}
|
|
575
878
|
if (this.exportType === OmniScriptExportType.All || this.exportType === OmniScriptExportType.OS) {
|
|
576
|
-
objectMigrationResults.push(this.getMigratedRecordsByType('
|
|
879
|
+
objectMigrationResults.push(this.getMigratedRecordsByType('Omniscripts', osUploadInfo, originalOsRecords));
|
|
577
880
|
}
|
|
578
881
|
return objectMigrationResults;
|
|
579
882
|
}
|
|
@@ -585,7 +888,7 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
585
888
|
let resultMap = new Map();
|
|
586
889
|
for (let record of Array.from(records.values())) {
|
|
587
890
|
if ((type === 'Integration Procedures' && record[`${this.namespacePrefix}IsProcedure__c`]) ||
|
|
588
|
-
(type === '
|
|
891
|
+
(type === 'Omniscripts' && !record[`${this.namespacePrefix}IsProcedure__c`])) {
|
|
589
892
|
recordMap.set(record['Id'], records.get(record['Id']));
|
|
590
893
|
if (results.get(record['Id'])) {
|
|
591
894
|
resultMap.set(record['Id'], results.get(record['Id']));
|
|
@@ -598,24 +901,9 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
598
901
|
results: resultMap,
|
|
599
902
|
};
|
|
600
903
|
}
|
|
601
|
-
addToAssessmentStorage(type, subtype, language) {
|
|
602
|
-
let storage = storageUtil_1.StorageUtil.getOmnistudioAssessmentStorage();
|
|
603
|
-
const key = `${type.val}${subtype.val}${language}`;
|
|
604
|
-
if (storage.osStorage.has(key)) {
|
|
605
|
-
storage.osStorage.get(key).isDuplicate = true;
|
|
606
|
-
}
|
|
607
|
-
else {
|
|
608
|
-
storage.osStorage.set(key, {
|
|
609
|
-
type: type.cleanName(),
|
|
610
|
-
subtype: subtype.cleanName(),
|
|
611
|
-
language: language || 'English',
|
|
612
|
-
isDuplicate: false,
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
904
|
updateStorageForOmniscript(osUploadInfo, originalOsRecords) {
|
|
617
905
|
let storage = storageUtil_1.StorageUtil.getOmnistudioMigrationStorage();
|
|
618
|
-
logger_1.Logger.logVerbose('
|
|
906
|
+
logger_1.Logger.logVerbose(this.messages.getMessage('updatingStorageForOmniscipt', ['Migration']));
|
|
619
907
|
for (let key of Array.from(originalOsRecords.keys())) {
|
|
620
908
|
try {
|
|
621
909
|
let oldrecord = originalOsRecords.get(key);
|
|
@@ -627,17 +915,24 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
627
915
|
language: newrecord['language'],
|
|
628
916
|
isDuplicate: false,
|
|
629
917
|
};
|
|
630
|
-
|
|
631
|
-
|
|
918
|
+
// New record can be undefined
|
|
919
|
+
if (newrecord === undefined) {
|
|
632
920
|
value.migrationSuccess = false;
|
|
633
921
|
}
|
|
634
922
|
else {
|
|
635
|
-
|
|
923
|
+
if (newrecord.hasErrors) {
|
|
924
|
+
value.error = newrecord.errors;
|
|
925
|
+
value.migrationSuccess = false;
|
|
926
|
+
}
|
|
927
|
+
else {
|
|
928
|
+
value.migrationSuccess = true;
|
|
929
|
+
}
|
|
636
930
|
}
|
|
637
|
-
let finalKey = `${oldrecord[this.namespacePrefix + 'Type__c']}${oldrecord[this.namespacePrefix + 'SubType__c']}${oldrecord[this.namespacePrefix + 'Language__c']}`;
|
|
931
|
+
let finalKey = `${oldrecord[this.namespacePrefix + 'Type__c']}${oldrecord[this.namespacePrefix + 'SubType__c']}${this.cleanLanguageName(oldrecord[this.namespacePrefix + 'Language__c'])}`;
|
|
932
|
+
finalKey = finalKey.toLowerCase();
|
|
638
933
|
if (storage.osStorage.has(finalKey)) {
|
|
639
934
|
// Key already exists - handle accordingly
|
|
640
|
-
logger_1.Logger.logVerbose(
|
|
935
|
+
logger_1.Logger.logVerbose(this.messages.getMessage('keyAlreadyInStorage', [finalKey]));
|
|
641
936
|
value.isDuplicate = true;
|
|
642
937
|
storage.osStorage.set(finalKey, value);
|
|
643
938
|
}
|
|
@@ -670,11 +965,21 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
670
965
|
{ field: this.namespacePrefix + 'SubType__c', direction: utils_1.SortDirection.ASC },
|
|
671
966
|
{ field: this.namespacePrefix + 'Version__c', direction: utils_1.SortDirection.ASC },
|
|
672
967
|
];
|
|
673
|
-
return await utils_1.QueryTools.queryWithFilterAndSort(this.connection, this.namespace, OmniScriptMigrationTool.OMNISCRIPT_NAME, this.getOmniScriptFields(), filters, sortFields)
|
|
968
|
+
return await utils_1.QueryTools.queryWithFilterAndSort(this.connection, this.namespace, OmniScriptMigrationTool.OMNISCRIPT_NAME, this.getOmniScriptFields(), filters, sortFields).catch((err) => {
|
|
969
|
+
if (err.errorCode === 'INVALID_TYPE') {
|
|
970
|
+
throw new interfaces_1.InvalidEntityTypeError(`${OmniScriptMigrationTool.OMNISCRIPT_NAME} type is not found under this namespace`);
|
|
971
|
+
}
|
|
972
|
+
throw err;
|
|
973
|
+
});
|
|
674
974
|
}
|
|
675
975
|
else {
|
|
676
976
|
filters.set(this.namespacePrefix + 'IsActive__c', true);
|
|
677
|
-
return await utils_1.QueryTools.queryWithFilter(this.connection, this.namespace, OmniScriptMigrationTool.OMNISCRIPT_NAME, this.getOmniScriptFields(), filters)
|
|
977
|
+
return await utils_1.QueryTools.queryWithFilter(this.connection, this.namespace, OmniScriptMigrationTool.OMNISCRIPT_NAME, this.getOmniScriptFields(), filters).catch((err) => {
|
|
978
|
+
if (err.errorCode === 'INVALID_TYPE') {
|
|
979
|
+
throw new interfaces_1.InvalidEntityTypeError(`${OmniScriptMigrationTool.OMNISCRIPT_NAME} type is not found under this namespace`);
|
|
980
|
+
}
|
|
981
|
+
throw err;
|
|
982
|
+
});
|
|
678
983
|
}
|
|
679
984
|
}
|
|
680
985
|
// Get All Elements w.r.t OmniScript__c i.e Elements tagged to passed in IP/OS
|
|
@@ -793,6 +1098,7 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
793
1098
|
}
|
|
794
1099
|
// Maps an individual Element into an OmniProcessElement record
|
|
795
1100
|
mapElementData(elementRecord, omniProcessId, parentElementUploadResponse, invalidIpReferences) {
|
|
1101
|
+
var _a, _b;
|
|
796
1102
|
// Transformed object
|
|
797
1103
|
const mappedObject = {};
|
|
798
1104
|
// Get the fields of the record
|
|
@@ -813,37 +1119,128 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
813
1119
|
// We need to fix the child references
|
|
814
1120
|
const elementType = mappedObject[Element_1.default.Type__c];
|
|
815
1121
|
const propertySet = JSON.parse(mappedObject[Element_1.default.PropertySet__c] || '{}');
|
|
1122
|
+
// Use NameMappingRegistry to update all dependency references
|
|
1123
|
+
const updatedPropertySet = this.nameRegistry.updateDependencyReferences(propertySet);
|
|
816
1124
|
switch (elementType) {
|
|
817
1125
|
case 'OmniScript':
|
|
818
|
-
|
|
819
|
-
propertySet['
|
|
1126
|
+
// Use registry for OmniScript references with explicit fallback
|
|
1127
|
+
const osType = propertySet['Type'] || '';
|
|
1128
|
+
const osSubType = propertySet['Sub Type'] || '';
|
|
1129
|
+
const osLanguage = propertySet['Language'] || 'English';
|
|
1130
|
+
// Construct full OmniScript name to check registry
|
|
1131
|
+
const fullOmniScriptName = `${osType}_${osSubType}_${osLanguage}`;
|
|
1132
|
+
if (this.nameRegistry.isAngularOmniScript(fullOmniScriptName)) {
|
|
1133
|
+
// Referenced OmniScript is Angular - add warning and keep original reference
|
|
1134
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('angularOmniScriptDependencyWarning', [
|
|
1135
|
+
'OmniScript element',
|
|
1136
|
+
fullOmniScriptName,
|
|
1137
|
+
])}`);
|
|
1138
|
+
// Keep original reference as-is since Angular OmniScript won't be migrated
|
|
1139
|
+
updatedPropertySet['Type'] = osType;
|
|
1140
|
+
updatedPropertySet['Sub Type'] = osSubType;
|
|
1141
|
+
updatedPropertySet['Language'] = osLanguage;
|
|
1142
|
+
}
|
|
1143
|
+
else if (this.nameRegistry.hasOmniScriptMapping(fullOmniScriptName)) {
|
|
1144
|
+
// Registry has mapping for this LWC OmniScript - extract cleaned parts
|
|
1145
|
+
const cleanedFullName = this.nameRegistry.getCleanedName(fullOmniScriptName, 'OmniScript');
|
|
1146
|
+
const parts = cleanedFullName.split('_');
|
|
1147
|
+
if (parts.length >= 2) {
|
|
1148
|
+
updatedPropertySet['Type'] = parts[0];
|
|
1149
|
+
updatedPropertySet['Sub Type'] = parts[1];
|
|
1150
|
+
// Language doesn't typically change, but update if provided
|
|
1151
|
+
if (parts.length >= 3) {
|
|
1152
|
+
updatedPropertySet['Language'] = parts[2];
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
else {
|
|
1157
|
+
// No registry mapping - use original fallback approach
|
|
1158
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['OmniScript', fullOmniScriptName])}`);
|
|
1159
|
+
updatedPropertySet['Type'] = this.cleanName(osType);
|
|
1160
|
+
updatedPropertySet['Sub Type'] = this.cleanName(osSubType);
|
|
1161
|
+
}
|
|
820
1162
|
break;
|
|
821
1163
|
case 'Integration Procedure Action':
|
|
822
|
-
const remoteOptions =
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
1164
|
+
const remoteOptions = updatedPropertySet['remoteOptions'] || {};
|
|
1165
|
+
// Use registry for DataMapper references with explicit fallback
|
|
1166
|
+
const preTransformBundle = (_a = propertySet['remoteOptions']) === null || _a === void 0 ? void 0 : _a['preTransformBundle'];
|
|
1167
|
+
if (preTransformBundle) {
|
|
1168
|
+
if (this.nameRegistry.hasDataMapperMapping(preTransformBundle)) {
|
|
1169
|
+
remoteOptions['preTransformBundle'] = this.nameRegistry.getDataMapperCleanedName(preTransformBundle);
|
|
1170
|
+
}
|
|
1171
|
+
else {
|
|
1172
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['DataMapper', preTransformBundle])}`);
|
|
1173
|
+
remoteOptions['preTransformBundle'] = this.cleanName(preTransformBundle);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
const postTransformBundle = (_b = propertySet['remoteOptions']) === null || _b === void 0 ? void 0 : _b['postTransformBundle'];
|
|
1177
|
+
if (postTransformBundle) {
|
|
1178
|
+
if (this.nameRegistry.hasDataMapperMapping(postTransformBundle)) {
|
|
1179
|
+
remoteOptions['postTransformBundle'] = this.nameRegistry.getDataMapperCleanedName(postTransformBundle);
|
|
1180
|
+
}
|
|
1181
|
+
else {
|
|
1182
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['DataMapper', postTransformBundle])}`);
|
|
1183
|
+
remoteOptions['postTransformBundle'] = this.cleanName(postTransformBundle);
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
updatedPropertySet['remoteOptions'] = remoteOptions;
|
|
1187
|
+
const preBundle = propertySet['preTransformBundle'];
|
|
1188
|
+
if (preBundle) {
|
|
1189
|
+
if (this.nameRegistry.hasDataMapperMapping(preBundle)) {
|
|
1190
|
+
updatedPropertySet['preTransformBundle'] = this.nameRegistry.getDataMapperCleanedName(preBundle);
|
|
1191
|
+
}
|
|
1192
|
+
else {
|
|
1193
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['DataMapper', preBundle])}`);
|
|
1194
|
+
updatedPropertySet['preTransformBundle'] = this.cleanName(preBundle);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
const postBundle = propertySet['postTransformBundle'];
|
|
1198
|
+
if (postBundle) {
|
|
1199
|
+
if (this.nameRegistry.hasDataMapperMapping(postBundle)) {
|
|
1200
|
+
updatedPropertySet['postTransformBundle'] = this.nameRegistry.getDataMapperCleanedName(postBundle);
|
|
1201
|
+
}
|
|
1202
|
+
else {
|
|
1203
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['DataMapper', postBundle])}`);
|
|
1204
|
+
updatedPropertySet['postTransformBundle'] = this.cleanName(postBundle);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
// Use registry for Integration Procedure references
|
|
829
1208
|
const key = propertySet['integrationProcedureKey'] || '';
|
|
830
1209
|
if (key) {
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
1210
|
+
const hasRegistryMapping = this.nameRegistry.hasIntegrationProcedureMapping(key);
|
|
1211
|
+
if (hasRegistryMapping) {
|
|
1212
|
+
const cleanedIpName = this.nameRegistry.getIntegrationProcedureCleanedName(key);
|
|
1213
|
+
updatedPropertySet['integrationProcedureKey'] = cleanedIpName;
|
|
1214
|
+
}
|
|
1215
|
+
else {
|
|
1216
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['IntegrationProcedure', key])}`);
|
|
1217
|
+
const parts = key.split('_');
|
|
1218
|
+
const newKey = parts.map((p) => this.cleanName(p, true)).join('_');
|
|
1219
|
+
if (parts.length > 2) {
|
|
1220
|
+
invalidIpReferences.set(mappedObject[Element_1.default.Name], key);
|
|
1221
|
+
}
|
|
1222
|
+
updatedPropertySet['integrationProcedureKey'] = newKey;
|
|
835
1223
|
}
|
|
836
|
-
propertySet['integrationProcedureKey'] = newKey;
|
|
837
1224
|
}
|
|
838
1225
|
break;
|
|
839
1226
|
case 'DataRaptor Turbo Action':
|
|
840
1227
|
case 'DataRaptor Transform Action':
|
|
841
1228
|
case 'DataRaptor Post Action':
|
|
842
1229
|
case 'DataRaptor Extract Action':
|
|
843
|
-
|
|
1230
|
+
// Use registry for DataMapper references with explicit fallback
|
|
1231
|
+
const bundleName = propertySet['bundle'];
|
|
1232
|
+
if (bundleName) {
|
|
1233
|
+
if (this.nameRegistry.hasDataMapperMapping(bundleName)) {
|
|
1234
|
+
updatedPropertySet['bundle'] = this.nameRegistry.getDataMapperCleanedName(bundleName);
|
|
1235
|
+
}
|
|
1236
|
+
else {
|
|
1237
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['DataMapper', bundleName])}`);
|
|
1238
|
+
updatedPropertySet['bundle'] = this.cleanName(bundleName);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
844
1241
|
break;
|
|
845
1242
|
}
|
|
846
|
-
mappedObject[Element_1.default.PropertySet__c] = JSON.stringify(
|
|
1243
|
+
mappedObject[Element_1.default.PropertySet__c] = JSON.stringify(updatedPropertySet);
|
|
847
1244
|
// BATCH framework requires that each record has an "attributes" property
|
|
848
1245
|
mappedObject['attributes'] = {
|
|
849
1246
|
type: OmniScriptMigrationTool.OMNIPROCESSELEMENT_NAME,
|
|
@@ -873,8 +1270,12 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
873
1270
|
content = JSON.parse(content);
|
|
874
1271
|
if (content && content['sOmniScriptId']) {
|
|
875
1272
|
content['sOmniScriptId'] = omniProcessId;
|
|
876
|
-
mappedObject[OmniScriptDefinition_1.default.Content__c] = JSON.stringify(content);
|
|
877
1273
|
}
|
|
1274
|
+
// Process the nested JSON structure to update bundle/reference names
|
|
1275
|
+
if (content && content['children']) {
|
|
1276
|
+
this.processContentChildren(content['children']);
|
|
1277
|
+
}
|
|
1278
|
+
mappedObject[OmniScriptDefinition_1.default.Content__c] = JSON.stringify(content);
|
|
878
1279
|
}
|
|
879
1280
|
catch (ex) {
|
|
880
1281
|
// Log
|
|
@@ -887,6 +1288,201 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
887
1288
|
};
|
|
888
1289
|
return mappedObject;
|
|
889
1290
|
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Recursively processes children elements in the content JSON to update bundle/reference names
|
|
1293
|
+
* @param children Array of child elements from the content JSON
|
|
1294
|
+
*/
|
|
1295
|
+
processContentChildren(children) {
|
|
1296
|
+
if (!Array.isArray(children)) {
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
children.forEach((child) => {
|
|
1300
|
+
if (child && child.type && child.propSetMap) {
|
|
1301
|
+
this.processContentElement(child);
|
|
1302
|
+
}
|
|
1303
|
+
// Process nested children in Step elements
|
|
1304
|
+
if (child && child.children && Array.isArray(child.children)) {
|
|
1305
|
+
child.children.forEach((nestedChild) => {
|
|
1306
|
+
if (nestedChild && nestedChild.eleArray && Array.isArray(nestedChild.eleArray)) {
|
|
1307
|
+
nestedChild.eleArray.forEach((element) => {
|
|
1308
|
+
if (element && element.type && element.propSetMap) {
|
|
1309
|
+
this.processContentElement(element);
|
|
1310
|
+
}
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Processes individual content element to update bundle/reference names based on type
|
|
1319
|
+
* @param element Individual element from the content JSON
|
|
1320
|
+
*/
|
|
1321
|
+
processContentElement(element) {
|
|
1322
|
+
const elementType = element.type;
|
|
1323
|
+
const propSetMap = element.propSetMap;
|
|
1324
|
+
if (!elementType || !propSetMap) {
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
switch (elementType) {
|
|
1328
|
+
case 'Integration Procedure Action':
|
|
1329
|
+
this.processIntegrationProcedureAction(propSetMap);
|
|
1330
|
+
break;
|
|
1331
|
+
case 'DataRaptor Turbo Action':
|
|
1332
|
+
case 'DataRaptor Transform Action':
|
|
1333
|
+
case 'DataRaptor Post Action':
|
|
1334
|
+
case 'DataRaptor Extract Action':
|
|
1335
|
+
this.processDataRaptorAction(propSetMap);
|
|
1336
|
+
break;
|
|
1337
|
+
case 'OmniScript':
|
|
1338
|
+
this.processOmniScriptAction(propSetMap);
|
|
1339
|
+
break;
|
|
1340
|
+
case 'Step':
|
|
1341
|
+
this.processStepAction(propSetMap);
|
|
1342
|
+
break;
|
|
1343
|
+
default:
|
|
1344
|
+
// Handle other element types if needed
|
|
1345
|
+
break;
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* Processes Integration Procedure Action elements to update reference names
|
|
1350
|
+
* @param propSetMap Property set map from the element
|
|
1351
|
+
*/
|
|
1352
|
+
processIntegrationProcedureAction(propSetMap) {
|
|
1353
|
+
// Handle remoteOptions pre/post transform bundles
|
|
1354
|
+
if (propSetMap.remoteOptions) {
|
|
1355
|
+
if (propSetMap.remoteOptions.preTransformBundle) {
|
|
1356
|
+
const bundleName = propSetMap.remoteOptions.preTransformBundle;
|
|
1357
|
+
if (this.nameRegistry.hasDataMapperMapping(bundleName)) {
|
|
1358
|
+
propSetMap.remoteOptions.preTransformBundle = this.nameRegistry.getDataMapperCleanedName(bundleName);
|
|
1359
|
+
}
|
|
1360
|
+
else {
|
|
1361
|
+
propSetMap.remoteOptions.preTransformBundle = this.cleanName(bundleName);
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
if (propSetMap.remoteOptions.postTransformBundle) {
|
|
1365
|
+
const bundleName = propSetMap.remoteOptions.postTransformBundle;
|
|
1366
|
+
if (this.nameRegistry.hasDataMapperMapping(bundleName)) {
|
|
1367
|
+
propSetMap.remoteOptions.postTransformBundle = this.nameRegistry.getDataMapperCleanedName(bundleName);
|
|
1368
|
+
}
|
|
1369
|
+
else {
|
|
1370
|
+
propSetMap.remoteOptions.postTransformBundle = this.cleanName(bundleName);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
// Handle direct pre/post transform bundles
|
|
1375
|
+
if (propSetMap.preTransformBundle) {
|
|
1376
|
+
const bundleName = propSetMap.preTransformBundle;
|
|
1377
|
+
if (this.nameRegistry.hasDataMapperMapping(bundleName)) {
|
|
1378
|
+
propSetMap.preTransformBundle = this.nameRegistry.getDataMapperCleanedName(bundleName);
|
|
1379
|
+
}
|
|
1380
|
+
else {
|
|
1381
|
+
propSetMap.preTransformBundle = this.cleanName(bundleName);
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
if (propSetMap.postTransformBundle) {
|
|
1385
|
+
const bundleName = propSetMap.postTransformBundle;
|
|
1386
|
+
if (this.nameRegistry.hasDataMapperMapping(bundleName)) {
|
|
1387
|
+
propSetMap.postTransformBundle = this.nameRegistry.getDataMapperCleanedName(bundleName);
|
|
1388
|
+
}
|
|
1389
|
+
else {
|
|
1390
|
+
propSetMap.postTransformBundle = this.cleanName(bundleName);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
// Handle integrationProcedureKey
|
|
1394
|
+
if (propSetMap.integrationProcedureKey) {
|
|
1395
|
+
const key = propSetMap.integrationProcedureKey;
|
|
1396
|
+
if (this.nameRegistry.hasIntegrationProcedureMapping(key)) {
|
|
1397
|
+
propSetMap.integrationProcedureKey = this.nameRegistry.getIntegrationProcedureCleanedName(key);
|
|
1398
|
+
}
|
|
1399
|
+
else {
|
|
1400
|
+
const parts = key.split('_');
|
|
1401
|
+
// Integration Procedures should have Type_SubType format (2 parts)
|
|
1402
|
+
if (parts.length > 2) {
|
|
1403
|
+
logger_1.Logger.logVerbose(this.messages.getMessage('integrationProcedureInvalidUnderscoreFormat', [key]));
|
|
1404
|
+
return;
|
|
1405
|
+
}
|
|
1406
|
+
propSetMap.integrationProcedureKey = parts.map((p) => this.cleanName(p, true)).join('_');
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* Processes DataRaptor Action elements to update bundle names
|
|
1412
|
+
* @param propSetMap Property set map from the element
|
|
1413
|
+
*/
|
|
1414
|
+
processDataRaptorAction(propSetMap) {
|
|
1415
|
+
if (propSetMap.bundle) {
|
|
1416
|
+
const bundleName = propSetMap.bundle;
|
|
1417
|
+
if (this.nameRegistry.hasDataMapperMapping(bundleName)) {
|
|
1418
|
+
propSetMap.bundle = this.nameRegistry.getDataMapperCleanedName(bundleName);
|
|
1419
|
+
}
|
|
1420
|
+
else {
|
|
1421
|
+
propSetMap.bundle = this.cleanName(bundleName);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* Processes OmniScript Action elements to update reference names
|
|
1427
|
+
* @param propSetMap Property set map from the element
|
|
1428
|
+
*/
|
|
1429
|
+
processOmniScriptAction(propSetMap) {
|
|
1430
|
+
const osType = propSetMap['Type'] || '';
|
|
1431
|
+
const osSubType = propSetMap['Sub Type'] || '';
|
|
1432
|
+
const osLanguage = propSetMap['Language'] || 'English';
|
|
1433
|
+
// Construct full OmniScript name to check registry
|
|
1434
|
+
const fullOmniScriptName = `${osType}_${osSubType}_${osLanguage}`;
|
|
1435
|
+
if (this.nameRegistry.isAngularOmniScript(fullOmniScriptName)) {
|
|
1436
|
+
// Keep original reference as-is since Angular OmniScript won't be migrated
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1439
|
+
else if (this.nameRegistry.hasOmniScriptMapping(fullOmniScriptName)) {
|
|
1440
|
+
// Registry has mapping for this LWC OmniScript - extract cleaned parts
|
|
1441
|
+
const cleanedFullName = this.nameRegistry.getCleanedName(fullOmniScriptName, 'OmniScript');
|
|
1442
|
+
const parts = cleanedFullName.split('_');
|
|
1443
|
+
if (parts.length >= 2) {
|
|
1444
|
+
propSetMap['Type'] = parts[0];
|
|
1445
|
+
propSetMap['Sub Type'] = parts[1];
|
|
1446
|
+
// Language doesn't typically change, but update if provided
|
|
1447
|
+
if (parts.length >= 3) {
|
|
1448
|
+
propSetMap['Language'] = parts[2];
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
else {
|
|
1453
|
+
// No registry mapping - use original fallback approach
|
|
1454
|
+
propSetMap['Type'] = this.cleanName(osType);
|
|
1455
|
+
propSetMap['Sub Type'] = this.cleanName(osSubType);
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* Processes Step elements to update reference names
|
|
1460
|
+
* @param propSetMap Property set map from the element
|
|
1461
|
+
*/
|
|
1462
|
+
processStepAction(propSetMap) {
|
|
1463
|
+
// Handle remoteOptions pre/post transform bundles if they exist in Step elements
|
|
1464
|
+
// Note: remoteClass and remoteMethod cleaning is not required for omniscript content step dependencies
|
|
1465
|
+
if (propSetMap.remoteOptions) {
|
|
1466
|
+
if (propSetMap.remoteOptions.preTransformBundle) {
|
|
1467
|
+
const bundleName = propSetMap.remoteOptions.preTransformBundle;
|
|
1468
|
+
if (this.nameRegistry.hasDataMapperMapping(bundleName)) {
|
|
1469
|
+
propSetMap.remoteOptions.preTransformBundle = this.nameRegistry.getDataMapperCleanedName(bundleName);
|
|
1470
|
+
}
|
|
1471
|
+
else {
|
|
1472
|
+
propSetMap.remoteOptions.preTransformBundle = this.cleanName(bundleName);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
if (propSetMap.remoteOptions.postTransformBundle) {
|
|
1476
|
+
const bundleName = propSetMap.remoteOptions.postTransformBundle;
|
|
1477
|
+
if (this.nameRegistry.hasDataMapperMapping(bundleName)) {
|
|
1478
|
+
propSetMap.remoteOptions.postTransformBundle = this.nameRegistry.getDataMapperCleanedName(bundleName);
|
|
1479
|
+
}
|
|
1480
|
+
else {
|
|
1481
|
+
propSetMap.remoteOptions.postTransformBundle = this.cleanName(bundleName);
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
890
1486
|
getOmniScriptFields() {
|
|
891
1487
|
return Object.keys(OmniScript_1.default);
|
|
892
1488
|
}
|
|
@@ -896,6 +1492,34 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
896
1492
|
getOmniScriptDefinitionFields() {
|
|
897
1493
|
return Object.keys(OmniScriptDefinition_1.default);
|
|
898
1494
|
}
|
|
1495
|
+
/**
|
|
1496
|
+
* Collects reserved keys found in PropertySet tagsToValidate
|
|
1497
|
+
* @param propertySet - The PropertySet JSON object to validate
|
|
1498
|
+
* @param foundReservedKeys - Set to collect found reserved keys
|
|
1499
|
+
*/
|
|
1500
|
+
collectReservedKeys(propertySet, foundReservedKeys) {
|
|
1501
|
+
// Iterate through each tag that needs validation
|
|
1502
|
+
for (const tagToValidate of this.tagsToValidate) {
|
|
1503
|
+
const tagValue = propertySet[tagToValidate];
|
|
1504
|
+
if (tagValue) {
|
|
1505
|
+
if (typeof tagValue === 'object' && tagValue !== null) {
|
|
1506
|
+
// If it's an object, check all its keys
|
|
1507
|
+
const keys = Object.keys(tagValue);
|
|
1508
|
+
for (const key of keys) {
|
|
1509
|
+
if (this.reservedKeys.has(key)) {
|
|
1510
|
+
foundReservedKeys.add(key);
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
else if (typeof tagValue === 'string') {
|
|
1515
|
+
// If it's a string, check if the value itself is a reserved key
|
|
1516
|
+
if (this.reservedKeys.has(tagValue)) {
|
|
1517
|
+
foundReservedKeys.add(tagValue);
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
899
1523
|
sleep() {
|
|
900
1524
|
return new Promise((resolve) => {
|
|
901
1525
|
setTimeout(resolve, 5000);
|