@salesforce/plugin-omnistudio-migration-tool 2.0.0-rc.2 → 2.0.0-rc.20
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 +14 -26
- package/lib/commands/omnistudio/migration/assess.d.ts +0 -1
- package/lib/commands/omnistudio/migration/assess.js +64 -30
- package/lib/commands/omnistudio/migration/assess.js.map +1 -1
- package/lib/commands/omnistudio/migration/info.js +2 -3
- 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 +250 -102
- package/lib/commands/omnistudio/migration/migrate.js.map +1 -1
- package/lib/javascripts/reportGeneratorUtility.js +1 -3
- 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/dataraptor.js +32 -13
- 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 +680 -112
- package/lib/migration/flexcard.js.map +1 -1
- package/lib/migration/globalautonumber.js +43 -53
- 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 +10 -1
- package/lib/migration/omniscript.js +399 -78
- package/lib/migration/omniscript.js.map +1 -1
- package/lib/migration/postMigrate.d.ts +22 -3
- package/lib/migration/postMigrate.js +146 -12
- package/lib/migration/postMigrate.js.map +1 -1
- package/lib/migration/premigrate.d.ts +16 -0
- package/lib/migration/premigrate.js +114 -0
- package/lib/migration/premigrate.js.map +1 -0
- package/lib/migration/related/ApexMigration.js +23 -15
- package/lib/migration/related/ApexMigration.js.map +1 -1
- package/lib/migration/related/ExperienceSiteMigration.d.ts +12 -4
- package/lib/migration/related/ExperienceSiteMigration.js +121 -53
- package/lib/migration/related/ExperienceSiteMigration.js.map +1 -1
- package/lib/migration/related/FlexipageMigration.js +2 -7
- package/lib/migration/related/FlexipageMigration.js.map +1 -1
- package/lib/migration/related/LwcMigration.js +13 -13
- package/lib/migration/related/LwcMigration.js.map +1 -1
- package/lib/migration/related/OmnistudioRelatedObjectMigrationFacade.js +23 -29
- package/lib/migration/related/OmnistudioRelatedObjectMigrationFacade.js.map +1 -1
- package/lib/styles/reportGenerator.css +10 -11
- package/lib/templates/assessmentReport.template +29 -17
- package/lib/templates/dashboard.template +7 -2
- package/lib/templates/migrationReport.template +14 -12
- 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/constants/documentRegistry.d.ts +1 -1
- package/lib/utils/constants/documentRegistry.js +3 -3
- package/lib/utils/constants/documentRegistry.js.map +1 -1
- package/lib/utils/constants/stringContants.d.ts +2 -0
- package/lib/utils/constants/stringContants.js +3 -1
- package/lib/utils/constants/stringContants.js.map +1 -1
- package/lib/utils/file/fileUtil.d.ts +3 -1
- package/lib/utils/file/fileUtil.js +13 -4
- package/lib/utils/file/fileUtil.js.map +1 -1
- package/lib/utils/flexipage/flexiPageTransformer.js +12 -8
- package/lib/utils/flexipage/flexiPageTransformer.js.map +1 -1
- package/lib/utils/generatePackageXml.d.ts +4 -2
- package/lib/utils/generatePackageXml.js +20 -22
- package/lib/utils/generatePackageXml.js.map +1 -1
- package/lib/utils/interfaces.d.ts +29 -0
- package/lib/utils/logger.d.ts +1 -1
- package/lib/utils/logger.js +7 -2
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/lwcparser/fileutils/FileDiffUtil.js +78 -61
- package/lib/utils/lwcparser/fileutils/FileDiffUtil.js.map +1 -1
- package/lib/utils/lwcparser/jsParser/JavaScriptParser.js +1 -1
- package/lib/utils/lwcparser/jsParser/JavaScriptParser.js.map +1 -1
- package/lib/utils/lwcparser/xmlParser/XmlParser.js +1 -1
- package/lib/utils/lwcparser/xmlParser/XmlParser.js.map +1 -1
- package/lib/utils/orgPreferences.d.ts +1 -0
- package/lib/utils/orgPreferences.js +9 -6
- package/lib/utils/orgPreferences.js.map +1 -1
- package/lib/utils/orgUtils/index.d.ts +1 -1
- package/lib/utils/orgUtils/index.js +4 -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 +2 -0
- package/lib/utils/resultsbuilder/ApexAssessmentReporter.js +27 -10
- package/lib/utils/resultsbuilder/ApexAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/DRAssessmentReporter.js +27 -11
- package/lib/utils/resultsbuilder/DRAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/ExperienceSiteAssessmentReporter.d.ts +12 -0
- package/lib/utils/resultsbuilder/ExperienceSiteAssessmentReporter.js +93 -0
- package/lib/utils/resultsbuilder/ExperienceSiteAssessmentReporter.js.map +1 -0
- package/lib/utils/resultsbuilder/FlexcardAssessmentReporter.js +35 -13
- package/lib/utils/resultsbuilder/FlexcardAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/FlexipageAssessmentReporter.d.ts +1 -0
- package/lib/utils/resultsbuilder/FlexipageAssessmentReporter.js +3 -2
- package/lib/utils/resultsbuilder/FlexipageAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/IPAssessmentReporter.js +31 -12
- package/lib/utils/resultsbuilder/IPAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/LWCAssessmentReporter.d.ts +12 -0
- package/lib/utils/resultsbuilder/LWCAssessmentReporter.js +117 -139
- package/lib/utils/resultsbuilder/LWCAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/OSAssessmentReporter.js +19 -20
- package/lib/utils/resultsbuilder/OSAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/assessmentReporter.d.ts +3 -1
- package/lib/utils/resultsbuilder/assessmentReporter.js +106 -67
- package/lib/utils/resultsbuilder/assessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/index.d.ts +5 -1
- package/lib/utils/resultsbuilder/index.js +186 -71
- package/lib/utils/resultsbuilder/index.js.map +1 -1
- package/lib/utils/resultsbuilder/reportingHelper.js +1 -1
- 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 +1 -0
- package/lib/utils/stringUtils.js +22 -1
- package/lib/utils/stringUtils.js.map +1 -1
- package/messages/assess.json +79 -38
- package/messages/migrate.json +117 -32
- package/oclif.manifest.json +1 -1
- package/package.json +8 -6
- package/lib/utils/OmniGlobalAutoNumberPrefManager.d.ts +0 -39
- package/lib/utils/OmniGlobalAutoNumberPrefManager.js +0 -64
- 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
32
|
getName() {
|
|
26
|
-
|
|
33
|
+
if (this.exportType === OmniScriptExportType.IP) {
|
|
34
|
+
return 'Integration Procedures';
|
|
35
|
+
}
|
|
36
|
+
else if (this.exportType === OmniScriptExportType.OS) {
|
|
37
|
+
return 'OmniScripts';
|
|
38
|
+
}
|
|
27
39
|
}
|
|
28
40
|
getRecordName(record) {
|
|
29
41
|
return (record[this.namespacePrefix + 'Type__c'] +
|
|
@@ -116,16 +128,19 @@ 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) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
140
|
+
if (err instanceof interfaces_1.InvalidEntityTypeError) {
|
|
141
|
+
throw err;
|
|
142
|
+
}
|
|
143
|
+
logger_1.Logger.error(this.messages.getMessage('errorDuringOmniScriptAssessment'), err);
|
|
129
144
|
}
|
|
130
145
|
}
|
|
131
146
|
async processOmniComponents(omniscripts, dataRaptorAssessmentInfos, flexCardAssessmentInfos) {
|
|
@@ -135,7 +150,8 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
135
150
|
const existingOmniscriptNames = new Set();
|
|
136
151
|
const existingDataRaptorNames = new Set(dataRaptorAssessmentInfos.map((info) => info.name));
|
|
137
152
|
const existingFlexCardNames = new Set(flexCardAssessmentInfos.map((info) => info.name));
|
|
138
|
-
const
|
|
153
|
+
const progressBarType = this.getName();
|
|
154
|
+
const progressBar = (0, base_2.createProgressBar)('Assessing', progressBarType);
|
|
139
155
|
let progressCounter = 0;
|
|
140
156
|
progressBar.start(omniscripts.length, progressCounter);
|
|
141
157
|
// First, collect all OmniScript names from the omniscripts array
|
|
@@ -163,7 +179,7 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
163
179
|
infos: [],
|
|
164
180
|
warnings: [],
|
|
165
181
|
errors: [this.messages.getMessage('unexpectedError')],
|
|
166
|
-
migrationStatus: '
|
|
182
|
+
migrationStatus: 'Failed',
|
|
167
183
|
type: 'OmniScript',
|
|
168
184
|
missingIP: [],
|
|
169
185
|
missingDR: [],
|
|
@@ -183,20 +199,15 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
183
199
|
warnings: [],
|
|
184
200
|
errors: [this.messages.getMessage('unexpectedError')],
|
|
185
201
|
path: '',
|
|
202
|
+
migrationStatus: 'Failed',
|
|
186
203
|
});
|
|
187
204
|
}
|
|
188
205
|
const error = e;
|
|
189
|
-
logger_1.Logger.error(
|
|
190
|
-
logger_1.Logger.error(error.stack);
|
|
206
|
+
logger_1.Logger.error('Error processing omniscripts', error);
|
|
191
207
|
continue;
|
|
192
208
|
}
|
|
193
209
|
if (omniAssessmentInfo.type === 'OmniScript') {
|
|
194
210
|
const type = omniscript[this.namespacePrefix + 'IsLwcEnabled__c'] ? 'LWC' : 'Angular';
|
|
195
|
-
let migrationStatus = 'Can be Automated';
|
|
196
|
-
if (type === 'Angular') {
|
|
197
|
-
omniAssessmentInfo.warnings.unshift(this.messages.getMessage('angularOSWarning'));
|
|
198
|
-
migrationStatus = 'Need Manual Intervention';
|
|
199
|
-
}
|
|
200
211
|
const osAssessmentInfo = {
|
|
201
212
|
name: omniAssessmentInfo.name,
|
|
202
213
|
type: type,
|
|
@@ -213,7 +224,8 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
213
224
|
infos: [],
|
|
214
225
|
warnings: omniAssessmentInfo.warnings,
|
|
215
226
|
errors: [],
|
|
216
|
-
migrationStatus: migrationStatus,
|
|
227
|
+
migrationStatus: omniAssessmentInfo.migrationStatus,
|
|
228
|
+
nameMapping: omniAssessmentInfo.nameMapping,
|
|
217
229
|
};
|
|
218
230
|
osAssessmentInfos.push(osAssessmentInfo);
|
|
219
231
|
}
|
|
@@ -228,6 +240,7 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
228
240
|
dependenciesRemoteAction: omniAssessmentInfo.dependenciesRemoteAction,
|
|
229
241
|
infos: [],
|
|
230
242
|
warnings: omniAssessmentInfo.warnings,
|
|
243
|
+
migrationStatus: omniAssessmentInfo.migrationStatus,
|
|
231
244
|
errors: [],
|
|
232
245
|
path: '',
|
|
233
246
|
};
|
|
@@ -253,10 +266,26 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
253
266
|
const dependenciesRA = [];
|
|
254
267
|
const dependenciesLWC = [];
|
|
255
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
|
+
}
|
|
256
283
|
for (const elem of elements) {
|
|
257
284
|
const type = elem[this.namespacePrefix + 'Type__c'];
|
|
258
285
|
const elemName = `${elem['Name']}`;
|
|
259
286
|
const propertySet = JSON.parse(elem[this.namespacePrefix + 'PropertySet__c'] || '{}');
|
|
287
|
+
// Collect reserved keys from PropertySet
|
|
288
|
+
this.collectReservedKeys(propertySet, foundReservedKeys);
|
|
260
289
|
// Check for OmniScript dependencies
|
|
261
290
|
if (type === 'OmniScript') {
|
|
262
291
|
const nameVal = `${elemName}`;
|
|
@@ -281,7 +310,12 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
281
310
|
}
|
|
282
311
|
}
|
|
283
312
|
// Check for DataRaptor dependencies
|
|
284
|
-
if ([
|
|
313
|
+
if ([
|
|
314
|
+
'DataRaptor Extract Action',
|
|
315
|
+
'DataRaptor Turbo Action',
|
|
316
|
+
'DataRaptor Transform Action',
|
|
317
|
+
'DataRaptor Post Action',
|
|
318
|
+
].includes(type)) {
|
|
285
319
|
const nameVal = `${elemName}`;
|
|
286
320
|
dependencyDR.push({ name: propertySet['bundle'], location: nameVal });
|
|
287
321
|
if (!existingOmniscriptNames.has(nameVal) && !existingDataRaptorNames.has(nameVal)) {
|
|
@@ -321,12 +355,24 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
321
355
|
const existingSubTypeVal = new stringval_1.StringVal(existingSubType, 'sub type');
|
|
322
356
|
const omniScriptName = omniscript[this.namespacePrefix + 'Name'];
|
|
323
357
|
const existingOmniScriptNameVal = new stringval_1.StringVal(omniScriptName, 'name');
|
|
358
|
+
let assessmentStatus = 'Ready for migration';
|
|
324
359
|
const warnings = [];
|
|
325
|
-
|
|
326
|
-
|
|
360
|
+
// Check for Angular OmniScript dependencies
|
|
361
|
+
for (const osDep of dependencyOS) {
|
|
362
|
+
if (this.nameRegistry.isAngularOmniScript(osDep.name)) {
|
|
363
|
+
warnings.push(this.messages.getMessage('angularOmniScriptDependencyWarning', [osDep.location, osDep.name]));
|
|
364
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
365
|
+
}
|
|
327
366
|
}
|
|
328
|
-
|
|
329
|
-
|
|
367
|
+
// This we need broken down, better create an object and propagate it
|
|
368
|
+
// Here break it and then combine it
|
|
369
|
+
const newType = existingTypeVal.cleanName();
|
|
370
|
+
const newSubType = existingSubTypeVal.cleanName();
|
|
371
|
+
const newLanguage = omniscript[this.namespacePrefix + 'Language__c']
|
|
372
|
+
? `${omniscript[this.namespacePrefix + 'Language__c']}`
|
|
373
|
+
: '';
|
|
374
|
+
const recordName = `${newType}_` +
|
|
375
|
+
`${newSubType}` +
|
|
330
376
|
(omniscript[this.namespacePrefix + 'Language__c'] ? `_${omniscript[this.namespacePrefix + 'Language__c']}` : '') +
|
|
331
377
|
`_${omniscript[this.namespacePrefix + 'Version__c']}`;
|
|
332
378
|
const oldName = `${existingTypeVal.val}_` +
|
|
@@ -339,6 +385,7 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
339
385
|
existingTypeVal.val,
|
|
340
386
|
existingTypeVal.cleanName(),
|
|
341
387
|
]));
|
|
388
|
+
assessmentStatus = 'Warnings';
|
|
342
389
|
}
|
|
343
390
|
if (!existingSubTypeVal.isNameCleaned()) {
|
|
344
391
|
warnings.push(this.messages.getMessage('changeMessage', [
|
|
@@ -346,6 +393,7 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
346
393
|
existingSubTypeVal.val,
|
|
347
394
|
existingSubTypeVal.cleanName(),
|
|
348
395
|
]));
|
|
396
|
+
assessmentStatus = 'Warnings';
|
|
349
397
|
}
|
|
350
398
|
if (!existingOmniScriptNameVal.isNameCleaned()) {
|
|
351
399
|
warnings.push(this.messages.getMessage('changeMessage', [
|
|
@@ -353,14 +401,35 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
353
401
|
existingOmniScriptNameVal.val,
|
|
354
402
|
existingOmniScriptNameVal.cleanName(),
|
|
355
403
|
]));
|
|
404
|
+
assessmentStatus = 'Warnings';
|
|
356
405
|
}
|
|
357
406
|
if (existingOmniscriptNames.has(recordName)) {
|
|
358
407
|
warnings.push(this.messages.getMessage('duplicatedName') + ' ' + recordName);
|
|
408
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
359
409
|
}
|
|
360
410
|
else {
|
|
361
411
|
existingOmniscriptNames.add(recordName);
|
|
362
412
|
}
|
|
363
|
-
|
|
413
|
+
// Add warning for duplicate element names within the same OmniScript
|
|
414
|
+
if (duplicateElementNames.size > 0) {
|
|
415
|
+
const duplicateNamesList = Array.from(duplicateElementNames).join(', ');
|
|
416
|
+
warnings.unshift(this.messages.getMessage('invalidOrRepeatingOmniscriptElementNames', [duplicateNamesList]));
|
|
417
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
418
|
+
}
|
|
419
|
+
// Add warning for reserved keys found in PropertySet
|
|
420
|
+
if (foundReservedKeys.size > 0) {
|
|
421
|
+
const reservedKeysList = Array.from(foundReservedKeys).join(', ');
|
|
422
|
+
warnings.unshift(this.messages.getMessage('reservedKeysFoundInPropertySet', [reservedKeysList]));
|
|
423
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
424
|
+
}
|
|
425
|
+
if (omniProcessType === this.OMNISCRIPT) {
|
|
426
|
+
const type = omniscript[this.namespacePrefix + 'IsLwcEnabled__c'] ? 'LWC' : 'Angular';
|
|
427
|
+
if (type === 'Angular') {
|
|
428
|
+
warnings.unshift(this.messages.getMessage('angularOSWarning'));
|
|
429
|
+
assessmentStatus = 'Needs Manual Intervention';
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
const result = {
|
|
364
433
|
name: recordName,
|
|
365
434
|
id: omniscript['Id'],
|
|
366
435
|
oldName: oldName,
|
|
@@ -372,12 +441,70 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
372
441
|
infos: [],
|
|
373
442
|
warnings: warnings,
|
|
374
443
|
errors: [],
|
|
375
|
-
migrationStatus:
|
|
444
|
+
migrationStatus: assessmentStatus,
|
|
376
445
|
type: omniProcessType,
|
|
377
446
|
missingDR: missingDR,
|
|
378
447
|
missingIP: missingIP,
|
|
379
448
|
missingOS: missingOS,
|
|
380
449
|
};
|
|
450
|
+
if (omniProcessType === this.OMNISCRIPT) {
|
|
451
|
+
const nameMapping = {
|
|
452
|
+
oldType: existingType,
|
|
453
|
+
oldSubtype: existingSubType,
|
|
454
|
+
oldLanguage: omniscript[this.namespacePrefix + 'Language__c'],
|
|
455
|
+
newType: newType,
|
|
456
|
+
newSubType: newSubType,
|
|
457
|
+
newLanguage: newLanguage,
|
|
458
|
+
};
|
|
459
|
+
result.nameMapping = nameMapping;
|
|
460
|
+
}
|
|
461
|
+
return result;
|
|
462
|
+
}
|
|
463
|
+
updateStorageForOmniscriptAssessment(osAssessmentInfo) {
|
|
464
|
+
if (osAssessmentInfo === undefined || osAssessmentInfo === null) {
|
|
465
|
+
logger_1.Logger.error(this.messages.getMessage('missingInfo'));
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
let storage = storageUtil_1.StorageUtil.getOmnistudioAssessmentStorage();
|
|
469
|
+
logger_1.Logger.logVerbose(this.messages.getMessage('updatingStorageForOmniscipt', ['Assessment']));
|
|
470
|
+
for (let currentOsRecordInfo of osAssessmentInfo) {
|
|
471
|
+
try {
|
|
472
|
+
let nameMapping = currentOsRecordInfo.nameMapping;
|
|
473
|
+
if (nameMapping === undefined) {
|
|
474
|
+
logger_1.Logger.logVerbose(this.messages.getMessage('nameMappingUndefined'));
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
let value = {
|
|
478
|
+
type: nameMapping.newType,
|
|
479
|
+
subtype: nameMapping.newSubType,
|
|
480
|
+
language: nameMapping.newLanguage,
|
|
481
|
+
isDuplicate: false,
|
|
482
|
+
};
|
|
483
|
+
if (currentOsRecordInfo.errors && currentOsRecordInfo.errors.length > 0) {
|
|
484
|
+
value.error = currentOsRecordInfo.errors;
|
|
485
|
+
value.migrationSuccess = false;
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
value.migrationSuccess = true;
|
|
489
|
+
}
|
|
490
|
+
let finalKey = `${nameMapping.oldType}${nameMapping.oldSubtype}${nameMapping.oldLanguage}`;
|
|
491
|
+
finalKey = finalKey.toLowerCase();
|
|
492
|
+
if (storage.osStorage.has(finalKey)) {
|
|
493
|
+
// Key already exists - handle accordingly
|
|
494
|
+
logger_1.Logger.logVerbose(this.messages.getMessage('keyAlreadyInStorage', [finalKey]));
|
|
495
|
+
value.isDuplicate = true;
|
|
496
|
+
storage.osStorage.set(finalKey, value);
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
// Key doesn't exist - safe to set
|
|
500
|
+
storage.osStorage.set(finalKey, value);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
catch (error) {
|
|
504
|
+
logger_1.Logger.error(error);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
storageUtil_1.StorageUtil.printAssessmentStorage();
|
|
381
508
|
}
|
|
382
509
|
async migrate() {
|
|
383
510
|
// Get All Records from OmniScript__c (IP & OS Parent Records)
|
|
@@ -388,10 +515,14 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
388
515
|
// Variables to be returned After Migration
|
|
389
516
|
let originalOsRecords = new Map();
|
|
390
517
|
let osUploadInfo = new Map();
|
|
391
|
-
|
|
392
|
-
|
|
518
|
+
const exportComponentType = this.getName();
|
|
519
|
+
logger_1.Logger.log(this.messages.getMessage('foundOmniScriptsToMigrate', [omniscripts.length, exportComponentType]));
|
|
520
|
+
const progressBarType = exportComponentType;
|
|
521
|
+
const progressBar = (0, base_2.createProgressBar)('Migrating', progressBarType);
|
|
393
522
|
let progressCounter = 0;
|
|
394
523
|
progressBar.start(omniscripts.length, progressCounter);
|
|
524
|
+
let foundAngularBasedOmniScripts = false;
|
|
525
|
+
const angularWarningMessage = this.messages.getMessage('angularOmniscriptWarningMessage');
|
|
395
526
|
for (let omniscript of omniscripts) {
|
|
396
527
|
const mappedRecords = [];
|
|
397
528
|
// const originalRecords = new Map<string, AnyJson>();
|
|
@@ -408,20 +539,18 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
408
539
|
const type = omniscript[this.namespacePrefix + 'IsLwcEnabled__c'] ? 'LWC' : 'Angular';
|
|
409
540
|
if (type === 'Angular') {
|
|
410
541
|
// Skip Angular OmniScripts and add a warning record
|
|
411
|
-
const warningMessage = this.messages.getMessage('angularOmniscriptWarningMessage');
|
|
412
542
|
const skippedResponse = {
|
|
413
543
|
referenceId: recordId,
|
|
414
544
|
id: '',
|
|
415
545
|
success: false,
|
|
416
|
-
hasErrors:
|
|
417
|
-
errors: [
|
|
418
|
-
warnings: [],
|
|
546
|
+
hasErrors: false,
|
|
547
|
+
errors: [],
|
|
548
|
+
warnings: [angularWarningMessage],
|
|
419
549
|
newName: '',
|
|
550
|
+
skipped: true,
|
|
420
551
|
};
|
|
421
552
|
osUploadInfo.set(recordId, skippedResponse);
|
|
422
|
-
|
|
423
|
-
logger_1.Logger.warn(warningMessage);
|
|
424
|
-
progressBar.start(omniscripts.length, progressCounter);
|
|
553
|
+
foundAngularBasedOmniScripts = true;
|
|
425
554
|
continue;
|
|
426
555
|
}
|
|
427
556
|
}
|
|
@@ -429,24 +558,74 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
429
558
|
omniscript[`${this.namespacePrefix}IsActive__c`] = false;
|
|
430
559
|
// Get All elements for each OmniScript__c record(i.e IP/OS)
|
|
431
560
|
const elements = await this.getAllElementsForOmniScript(recordId);
|
|
561
|
+
// Check for duplicate element names within the same OmniScript
|
|
562
|
+
const elementNames = new Set();
|
|
563
|
+
const duplicateElementNames = new Set();
|
|
564
|
+
for (const elem of elements) {
|
|
565
|
+
const elemName = elem['Name'];
|
|
566
|
+
if (elementNames.has(elemName)) {
|
|
567
|
+
duplicateElementNames.add(elemName);
|
|
568
|
+
}
|
|
569
|
+
else {
|
|
570
|
+
elementNames.add(elemName);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
// If duplicate element names found, skip this OmniScript
|
|
574
|
+
if (duplicateElementNames.size > 0) {
|
|
575
|
+
const duplicateNamesList = Array.from(duplicateElementNames).join(', ');
|
|
576
|
+
const skippedResponse = {
|
|
577
|
+
referenceId: recordId,
|
|
578
|
+
id: '',
|
|
579
|
+
success: false,
|
|
580
|
+
hasErrors: false,
|
|
581
|
+
errors: [],
|
|
582
|
+
warnings: [this.messages.getMessage('invalidOrRepeatingOmniscriptElementNames', [duplicateNamesList])],
|
|
583
|
+
newName: '',
|
|
584
|
+
skipped: true,
|
|
585
|
+
};
|
|
586
|
+
osUploadInfo.set(recordId, skippedResponse);
|
|
587
|
+
originalOsRecords.set(recordId, omniscript);
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
432
590
|
if (omniscript[`${this.namespacePrefix}IsProcedure__c`] === true) {
|
|
591
|
+
// Check for reserved keys in PropertySet for Integration Procedures
|
|
592
|
+
const foundReservedKeys = new Set();
|
|
433
593
|
// do the formula replacement from custom to standard notation
|
|
434
594
|
if (functionDefinitionMetadata.length > 0 && elements.length > 0) {
|
|
435
595
|
for (let ipElement of elements) {
|
|
436
596
|
if (ipElement[`${this.namespacePrefix}PropertySet__c`] != null) {
|
|
597
|
+
// Check for reserved keys while processing the PropertySet
|
|
598
|
+
const propertySet = JSON.parse(ipElement[`${this.namespacePrefix}PropertySet__c`] || '{}');
|
|
599
|
+
this.collectReservedKeys(propertySet, foundReservedKeys);
|
|
437
600
|
var originalString = ipElement[`${this.namespacePrefix}PropertySet__c`];
|
|
438
601
|
try {
|
|
439
602
|
originalString = (0, FormulaUtil_1.getReplacedString)(this.namespacePrefix, ipElement[`${this.namespacePrefix}PropertySet__c`], functionDefinitionMetadata);
|
|
440
603
|
ipElement[`${this.namespacePrefix}PropertySet__c`] = originalString;
|
|
441
604
|
}
|
|
442
605
|
catch (ex) {
|
|
443
|
-
logger_1.Logger.error(
|
|
444
|
-
logger_1.Logger.error(ex.stack);
|
|
606
|
+
logger_1.Logger.error('Error processing formula for integration procedure', ex);
|
|
445
607
|
logger_1.Logger.logVerbose(this.messages.getMessage('formulaSyntaxError', [ipElement[`${this.namespacePrefix}PropertySet__c`]]));
|
|
446
608
|
}
|
|
447
609
|
}
|
|
448
610
|
}
|
|
449
611
|
}
|
|
612
|
+
// If reserved keys found, skip this IP
|
|
613
|
+
if (foundReservedKeys.size > 0) {
|
|
614
|
+
const reservedKeysList = Array.from(foundReservedKeys).join(', ');
|
|
615
|
+
const skippedResponse = {
|
|
616
|
+
referenceId: recordId,
|
|
617
|
+
id: '',
|
|
618
|
+
success: false,
|
|
619
|
+
hasErrors: false,
|
|
620
|
+
errors: [],
|
|
621
|
+
warnings: [this.messages.getMessage('reservedKeysFoundInPropertySet', [reservedKeysList])],
|
|
622
|
+
newName: '',
|
|
623
|
+
skipped: true,
|
|
624
|
+
};
|
|
625
|
+
osUploadInfo.set(recordId, skippedResponse);
|
|
626
|
+
originalOsRecords.set(recordId, omniscript);
|
|
627
|
+
continue;
|
|
628
|
+
}
|
|
450
629
|
}
|
|
451
630
|
// Perform the transformation for OS/IP Parent Record from OmniScript__c
|
|
452
631
|
const mappedOmniScript = this.mapOmniScriptRecord(omniscript);
|
|
@@ -509,13 +688,30 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
509
688
|
osUploadResponse.type = mappedOmniScript[OmniScript_1.default.Type__c];
|
|
510
689
|
osUploadResponse.subtype = mappedOmniScript[OmniScript_1.default.SubType__c];
|
|
511
690
|
osUploadResponse.language = mappedOmniScript[OmniScript_1.default.Language__c];
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
691
|
+
let originalOsName;
|
|
692
|
+
if (this.allVersions) {
|
|
693
|
+
originalOsName =
|
|
694
|
+
omniscript[this.namespacePrefix + 'Type__c'] +
|
|
695
|
+
'_' +
|
|
696
|
+
omniscript[this.namespacePrefix + 'SubType__c'] +
|
|
697
|
+
'_' +
|
|
698
|
+
omniscript[this.namespacePrefix + 'Language__c'] +
|
|
699
|
+
'_' +
|
|
700
|
+
(omniscript[this.namespacePrefix + 'Version__c'] || '1');
|
|
701
|
+
}
|
|
702
|
+
else {
|
|
703
|
+
originalOsName =
|
|
704
|
+
omniscript[this.namespacePrefix + 'Type__c'] +
|
|
705
|
+
'_' +
|
|
706
|
+
omniscript[this.namespacePrefix + 'SubType__c'] +
|
|
707
|
+
'_' +
|
|
708
|
+
omniscript[this.namespacePrefix + 'Language__c'] +
|
|
709
|
+
'_1';
|
|
710
|
+
}
|
|
711
|
+
// Always set the new name to show the migrated name
|
|
712
|
+
osUploadResponse.newName = mappedOsName;
|
|
713
|
+
// Only add warning if the name was actually modified
|
|
517
714
|
if (originalOsName !== mappedOsName) {
|
|
518
|
-
osUploadResponse.newName = mappedOsName;
|
|
519
715
|
osUploadResponse.warnings.unshift('WARNING: OmniScript name has been modified to fit naming rules: ' + mappedOsName);
|
|
520
716
|
}
|
|
521
717
|
try {
|
|
@@ -571,6 +767,9 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
571
767
|
originalOsRecords.set(recordId, omniscript);
|
|
572
768
|
}
|
|
573
769
|
progressBar.stop();
|
|
770
|
+
if (foundAngularBasedOmniScripts) {
|
|
771
|
+
logger_1.Logger.warn(angularWarningMessage);
|
|
772
|
+
}
|
|
574
773
|
this.updateStorageForOmniscript(osUploadInfo, originalOsRecords);
|
|
575
774
|
const objectMigrationResults = [];
|
|
576
775
|
if (this.exportType === OmniScriptExportType.All || this.exportType === OmniScriptExportType.IP) {
|
|
@@ -602,24 +801,9 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
602
801
|
results: resultMap,
|
|
603
802
|
};
|
|
604
803
|
}
|
|
605
|
-
addToAssessmentStorage(type, subtype, language) {
|
|
606
|
-
let storage = storageUtil_1.StorageUtil.getOmnistudioAssessmentStorage();
|
|
607
|
-
const key = `${type.val}${subtype.val}${language}`;
|
|
608
|
-
if (storage.osStorage.has(key)) {
|
|
609
|
-
storage.osStorage.get(key).isDuplicate = true;
|
|
610
|
-
}
|
|
611
|
-
else {
|
|
612
|
-
storage.osStorage.set(key, {
|
|
613
|
-
type: type.cleanName(),
|
|
614
|
-
subtype: subtype.cleanName(),
|
|
615
|
-
language: language || 'English',
|
|
616
|
-
isDuplicate: false,
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
804
|
updateStorageForOmniscript(osUploadInfo, originalOsRecords) {
|
|
621
805
|
let storage = storageUtil_1.StorageUtil.getOmnistudioMigrationStorage();
|
|
622
|
-
logger_1.Logger.logVerbose('
|
|
806
|
+
logger_1.Logger.logVerbose(this.messages.getMessage('updatingStorageForOmniscipt', ['Migration']));
|
|
623
807
|
for (let key of Array.from(originalOsRecords.keys())) {
|
|
624
808
|
try {
|
|
625
809
|
let oldrecord = originalOsRecords.get(key);
|
|
@@ -631,17 +815,24 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
631
815
|
language: newrecord['language'],
|
|
632
816
|
isDuplicate: false,
|
|
633
817
|
};
|
|
634
|
-
|
|
635
|
-
|
|
818
|
+
// New record can be undefined
|
|
819
|
+
if (newrecord === undefined) {
|
|
636
820
|
value.migrationSuccess = false;
|
|
637
821
|
}
|
|
638
822
|
else {
|
|
639
|
-
|
|
823
|
+
if (newrecord.hasErrors) {
|
|
824
|
+
value.error = newrecord.errors;
|
|
825
|
+
value.migrationSuccess = false;
|
|
826
|
+
}
|
|
827
|
+
else {
|
|
828
|
+
value.migrationSuccess = true;
|
|
829
|
+
}
|
|
640
830
|
}
|
|
641
831
|
let finalKey = `${oldrecord[this.namespacePrefix + 'Type__c']}${oldrecord[this.namespacePrefix + 'SubType__c']}${oldrecord[this.namespacePrefix + 'Language__c']}`;
|
|
832
|
+
finalKey = finalKey.toLowerCase();
|
|
642
833
|
if (storage.osStorage.has(finalKey)) {
|
|
643
834
|
// Key already exists - handle accordingly
|
|
644
|
-
logger_1.Logger.logVerbose(
|
|
835
|
+
logger_1.Logger.logVerbose(this.messages.getMessage('keyAlreadyInStorage', [finalKey]));
|
|
645
836
|
value.isDuplicate = true;
|
|
646
837
|
storage.osStorage.set(finalKey, value);
|
|
647
838
|
}
|
|
@@ -674,11 +865,21 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
674
865
|
{ field: this.namespacePrefix + 'SubType__c', direction: utils_1.SortDirection.ASC },
|
|
675
866
|
{ field: this.namespacePrefix + 'Version__c', direction: utils_1.SortDirection.ASC },
|
|
676
867
|
];
|
|
677
|
-
return await utils_1.QueryTools.queryWithFilterAndSort(this.connection, this.namespace, OmniScriptMigrationTool.OMNISCRIPT_NAME, this.getOmniScriptFields(), filters, sortFields)
|
|
868
|
+
return await utils_1.QueryTools.queryWithFilterAndSort(this.connection, this.namespace, OmniScriptMigrationTool.OMNISCRIPT_NAME, this.getOmniScriptFields(), filters, sortFields).catch((err) => {
|
|
869
|
+
if (err.errorCode === 'INVALID_TYPE') {
|
|
870
|
+
throw new interfaces_1.InvalidEntityTypeError(`${OmniScriptMigrationTool.OMNISCRIPT_NAME} type is not found under this namespace`);
|
|
871
|
+
}
|
|
872
|
+
throw err;
|
|
873
|
+
});
|
|
678
874
|
}
|
|
679
875
|
else {
|
|
680
876
|
filters.set(this.namespacePrefix + 'IsActive__c', true);
|
|
681
|
-
return await utils_1.QueryTools.queryWithFilter(this.connection, this.namespace, OmniScriptMigrationTool.OMNISCRIPT_NAME, this.getOmniScriptFields(), filters)
|
|
877
|
+
return await utils_1.QueryTools.queryWithFilter(this.connection, this.namespace, OmniScriptMigrationTool.OMNISCRIPT_NAME, this.getOmniScriptFields(), filters).catch((err) => {
|
|
878
|
+
if (err.errorCode === 'INVALID_TYPE') {
|
|
879
|
+
throw new interfaces_1.InvalidEntityTypeError(`${OmniScriptMigrationTool.OMNISCRIPT_NAME} type is not found under this namespace`);
|
|
880
|
+
}
|
|
881
|
+
throw err;
|
|
882
|
+
});
|
|
682
883
|
}
|
|
683
884
|
}
|
|
684
885
|
// Get All Elements w.r.t OmniScript__c i.e Elements tagged to passed in IP/OS
|
|
@@ -797,6 +998,7 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
797
998
|
}
|
|
798
999
|
// Maps an individual Element into an OmniProcessElement record
|
|
799
1000
|
mapElementData(elementRecord, omniProcessId, parentElementUploadResponse, invalidIpReferences) {
|
|
1001
|
+
var _a, _b;
|
|
800
1002
|
// Transformed object
|
|
801
1003
|
const mappedObject = {};
|
|
802
1004
|
// Get the fields of the record
|
|
@@ -817,37 +1019,128 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
817
1019
|
// We need to fix the child references
|
|
818
1020
|
const elementType = mappedObject[Element_1.default.Type__c];
|
|
819
1021
|
const propertySet = JSON.parse(mappedObject[Element_1.default.PropertySet__c] || '{}');
|
|
1022
|
+
// Use NameMappingRegistry to update all dependency references
|
|
1023
|
+
const updatedPropertySet = this.nameRegistry.updateDependencyReferences(propertySet);
|
|
820
1024
|
switch (elementType) {
|
|
821
1025
|
case 'OmniScript':
|
|
822
|
-
|
|
823
|
-
propertySet['
|
|
1026
|
+
// Use registry for OmniScript references with explicit fallback
|
|
1027
|
+
const osType = propertySet['Type'] || '';
|
|
1028
|
+
const osSubType = propertySet['Sub Type'] || '';
|
|
1029
|
+
const osLanguage = propertySet['Language'] || 'English';
|
|
1030
|
+
// Construct full OmniScript name to check registry
|
|
1031
|
+
const fullOmniScriptName = `${osType}_${osSubType}_${osLanguage}`;
|
|
1032
|
+
if (this.nameRegistry.isAngularOmniScript(fullOmniScriptName)) {
|
|
1033
|
+
// Referenced OmniScript is Angular - add warning and keep original reference
|
|
1034
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('angularOmniScriptDependencyWarning', [
|
|
1035
|
+
'OmniScript element',
|
|
1036
|
+
fullOmniScriptName,
|
|
1037
|
+
])}`);
|
|
1038
|
+
// Keep original reference as-is since Angular OmniScript won't be migrated
|
|
1039
|
+
updatedPropertySet['Type'] = osType;
|
|
1040
|
+
updatedPropertySet['Sub Type'] = osSubType;
|
|
1041
|
+
updatedPropertySet['Language'] = osLanguage;
|
|
1042
|
+
}
|
|
1043
|
+
else if (this.nameRegistry.hasOmniScriptMapping(fullOmniScriptName)) {
|
|
1044
|
+
// Registry has mapping for this LWC OmniScript - extract cleaned parts
|
|
1045
|
+
const cleanedFullName = this.nameRegistry.getCleanedName(fullOmniScriptName, 'OmniScript');
|
|
1046
|
+
const parts = cleanedFullName.split('_');
|
|
1047
|
+
if (parts.length >= 2) {
|
|
1048
|
+
updatedPropertySet['Type'] = parts[0];
|
|
1049
|
+
updatedPropertySet['Sub Type'] = parts[1];
|
|
1050
|
+
// Language doesn't typically change, but update if provided
|
|
1051
|
+
if (parts.length >= 3) {
|
|
1052
|
+
updatedPropertySet['Language'] = parts[2];
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
else {
|
|
1057
|
+
// No registry mapping - use original fallback approach
|
|
1058
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['OmniScript', fullOmniScriptName])}`);
|
|
1059
|
+
updatedPropertySet['Type'] = this.cleanName(osType);
|
|
1060
|
+
updatedPropertySet['Sub Type'] = this.cleanName(osSubType);
|
|
1061
|
+
}
|
|
824
1062
|
break;
|
|
825
1063
|
case 'Integration Procedure Action':
|
|
826
|
-
const remoteOptions =
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
1064
|
+
const remoteOptions = updatedPropertySet['remoteOptions'] || {};
|
|
1065
|
+
// Use registry for DataMapper references with explicit fallback
|
|
1066
|
+
const preTransformBundle = (_a = propertySet['remoteOptions']) === null || _a === void 0 ? void 0 : _a['preTransformBundle'];
|
|
1067
|
+
if (preTransformBundle) {
|
|
1068
|
+
if (this.nameRegistry.hasDataMapperMapping(preTransformBundle)) {
|
|
1069
|
+
remoteOptions['preTransformBundle'] = this.nameRegistry.getDataMapperCleanedName(preTransformBundle);
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['DataMapper', preTransformBundle])}`);
|
|
1073
|
+
remoteOptions['preTransformBundle'] = this.cleanName(preTransformBundle);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
const postTransformBundle = (_b = propertySet['remoteOptions']) === null || _b === void 0 ? void 0 : _b['postTransformBundle'];
|
|
1077
|
+
if (postTransformBundle) {
|
|
1078
|
+
if (this.nameRegistry.hasDataMapperMapping(postTransformBundle)) {
|
|
1079
|
+
remoteOptions['postTransformBundle'] = this.nameRegistry.getDataMapperCleanedName(postTransformBundle);
|
|
1080
|
+
}
|
|
1081
|
+
else {
|
|
1082
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['DataMapper', postTransformBundle])}`);
|
|
1083
|
+
remoteOptions['postTransformBundle'] = this.cleanName(postTransformBundle);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
updatedPropertySet['remoteOptions'] = remoteOptions;
|
|
1087
|
+
const preBundle = propertySet['preTransformBundle'];
|
|
1088
|
+
if (preBundle) {
|
|
1089
|
+
if (this.nameRegistry.hasDataMapperMapping(preBundle)) {
|
|
1090
|
+
updatedPropertySet['preTransformBundle'] = this.nameRegistry.getDataMapperCleanedName(preBundle);
|
|
1091
|
+
}
|
|
1092
|
+
else {
|
|
1093
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['DataMapper', preBundle])}`);
|
|
1094
|
+
updatedPropertySet['preTransformBundle'] = this.cleanName(preBundle);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
const postBundle = propertySet['postTransformBundle'];
|
|
1098
|
+
if (postBundle) {
|
|
1099
|
+
if (this.nameRegistry.hasDataMapperMapping(postBundle)) {
|
|
1100
|
+
updatedPropertySet['postTransformBundle'] = this.nameRegistry.getDataMapperCleanedName(postBundle);
|
|
1101
|
+
}
|
|
1102
|
+
else {
|
|
1103
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['DataMapper', postBundle])}`);
|
|
1104
|
+
updatedPropertySet['postTransformBundle'] = this.cleanName(postBundle);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
// Use registry for Integration Procedure references
|
|
833
1108
|
const key = propertySet['integrationProcedureKey'] || '';
|
|
834
1109
|
if (key) {
|
|
835
|
-
const
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
1110
|
+
const hasRegistryMapping = this.nameRegistry.hasIntegrationProcedureMapping(key);
|
|
1111
|
+
if (hasRegistryMapping) {
|
|
1112
|
+
const cleanedIpName = this.nameRegistry.getIntegrationProcedureCleanedName(key);
|
|
1113
|
+
updatedPropertySet['integrationProcedureKey'] = cleanedIpName;
|
|
1114
|
+
}
|
|
1115
|
+
else {
|
|
1116
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['IntegrationProcedure', key])}`);
|
|
1117
|
+
const parts = key.split('_');
|
|
1118
|
+
const newKey = parts.map((p) => this.cleanName(p, true)).join('_');
|
|
1119
|
+
if (parts.length > 2) {
|
|
1120
|
+
invalidIpReferences.set(mappedObject[Element_1.default.Name], key);
|
|
1121
|
+
}
|
|
1122
|
+
updatedPropertySet['integrationProcedureKey'] = newKey;
|
|
839
1123
|
}
|
|
840
|
-
propertySet['integrationProcedureKey'] = newKey;
|
|
841
1124
|
}
|
|
842
1125
|
break;
|
|
843
1126
|
case 'DataRaptor Turbo Action':
|
|
844
1127
|
case 'DataRaptor Transform Action':
|
|
845
1128
|
case 'DataRaptor Post Action':
|
|
846
1129
|
case 'DataRaptor Extract Action':
|
|
847
|
-
|
|
1130
|
+
// Use registry for DataMapper references with explicit fallback
|
|
1131
|
+
const bundleName = propertySet['bundle'];
|
|
1132
|
+
if (bundleName) {
|
|
1133
|
+
if (this.nameRegistry.hasDataMapperMapping(bundleName)) {
|
|
1134
|
+
updatedPropertySet['bundle'] = this.nameRegistry.getDataMapperCleanedName(bundleName);
|
|
1135
|
+
}
|
|
1136
|
+
else {
|
|
1137
|
+
logger_1.Logger.logVerbose(`\n${this.messages.getMessage('componentMappingNotFound', ['DataMapper', bundleName])}`);
|
|
1138
|
+
updatedPropertySet['bundle'] = this.cleanName(bundleName);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
848
1141
|
break;
|
|
849
1142
|
}
|
|
850
|
-
mappedObject[Element_1.default.PropertySet__c] = JSON.stringify(
|
|
1143
|
+
mappedObject[Element_1.default.PropertySet__c] = JSON.stringify(updatedPropertySet);
|
|
851
1144
|
// BATCH framework requires that each record has an "attributes" property
|
|
852
1145
|
mappedObject['attributes'] = {
|
|
853
1146
|
type: OmniScriptMigrationTool.OMNIPROCESSELEMENT_NAME,
|
|
@@ -900,6 +1193,34 @@ class OmniScriptMigrationTool extends base_1.BaseMigrationTool {
|
|
|
900
1193
|
getOmniScriptDefinitionFields() {
|
|
901
1194
|
return Object.keys(OmniScriptDefinition_1.default);
|
|
902
1195
|
}
|
|
1196
|
+
/**
|
|
1197
|
+
* Collects reserved keys found in PropertySet tagsToValidate
|
|
1198
|
+
* @param propertySet - The PropertySet JSON object to validate
|
|
1199
|
+
* @param foundReservedKeys - Set to collect found reserved keys
|
|
1200
|
+
*/
|
|
1201
|
+
collectReservedKeys(propertySet, foundReservedKeys) {
|
|
1202
|
+
// Iterate through each tag that needs validation
|
|
1203
|
+
for (const tagToValidate of this.tagsToValidate) {
|
|
1204
|
+
const tagValue = propertySet[tagToValidate];
|
|
1205
|
+
if (tagValue) {
|
|
1206
|
+
if (typeof tagValue === 'object' && tagValue !== null) {
|
|
1207
|
+
// If it's an object, check all its keys
|
|
1208
|
+
const keys = Object.keys(tagValue);
|
|
1209
|
+
for (const key of keys) {
|
|
1210
|
+
if (this.reservedKeys.has(key)) {
|
|
1211
|
+
foundReservedKeys.add(key);
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
else if (typeof tagValue === 'string') {
|
|
1216
|
+
// If it's a string, check if the value itself is a reserved key
|
|
1217
|
+
if (this.reservedKeys.has(tagValue)) {
|
|
1218
|
+
foundReservedKeys.add(tagValue);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
903
1224
|
sleep() {
|
|
904
1225
|
return new Promise((resolve) => {
|
|
905
1226
|
setTimeout(resolve, 5000);
|