@salesforce/plugin-omnistudio-migration-tool 2.0.0-rc.6 → 2.0.0-rc.61
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 +165 -73
- package/lib/commands/omnistudio/migration/assess.d.ts +23 -15
- package/lib/commands/omnistudio/migration/assess.js +250 -89
- package/lib/commands/omnistudio/migration/assess.js.map +1 -1
- package/lib/commands/omnistudio/migration/clean.d.ts +13 -0
- package/lib/commands/omnistudio/migration/clean.js +162 -0
- package/lib/commands/omnistudio/migration/clean.js.map +1 -0
- package/lib/commands/omnistudio/migration/info.d.ts +10 -16
- package/lib/commands/omnistudio/migration/info.js +53 -35
- package/lib/commands/omnistudio/migration/info.js.map +1 -1
- package/lib/commands/omnistudio/migration/migrate.d.ts +78 -18
- package/lib/commands/omnistudio/migration/migrate.js +461 -175
- package/lib/commands/omnistudio/migration/migrate.js.map +1 -1
- package/lib/error/deploymentErrors.d.ts +15 -0
- package/lib/error/deploymentErrors.js +35 -0
- package/lib/error/deploymentErrors.js.map +1 -0
- package/lib/error/errorInterfaces.d.ts +5 -0
- package/lib/error/errorInterfaces.js +9 -1
- package/lib/error/errorInterfaces.js.map +1 -1
- package/lib/javascripts/reportGeneratorUtility.js +585 -22
- package/lib/migration/ApexNamespaceRegistry.d.ts +49 -0
- package/lib/migration/ApexNamespaceRegistry.js +130 -0
- package/lib/migration/ApexNamespaceRegistry.js.map +1 -0
- package/lib/migration/CustomCssRegistry.d.ts +117 -0
- package/lib/migration/CustomCssRegistry.js +234 -0
- package/lib/migration/CustomCssRegistry.js.map +1 -0
- package/lib/migration/NameMappingRegistry.d.ts +134 -0
- package/lib/migration/NameMappingRegistry.js +411 -0
- package/lib/migration/NameMappingRegistry.js.map +1 -0
- package/lib/migration/base.d.ts +8 -6
- package/lib/migration/base.js +25 -8
- package/lib/migration/base.js.map +1 -1
- package/lib/migration/customLabels.d.ts +70 -0
- package/lib/migration/customLabels.js +177 -0
- package/lib/migration/customLabels.js.map +1 -0
- package/lib/migration/dataraptor.d.ts +13 -0
- package/lib/migration/dataraptor.js +205 -80
- package/lib/migration/dataraptor.js.map +1 -1
- package/lib/migration/deployer.d.ts +14 -0
- package/lib/migration/deployer.js +105 -0
- package/lib/migration/deployer.js.map +1 -0
- package/lib/migration/flexcard.d.ts +256 -6
- package/lib/migration/flexcard.js +1808 -268
- package/lib/migration/flexcard.js.map +1 -1
- package/lib/migration/globalautonumber.d.ts +8 -8
- package/lib/migration/globalautonumber.js +49 -24
- package/lib/migration/globalautonumber.js.map +1 -1
- package/lib/migration/interfaces.d.ts +14 -0
- package/lib/migration/interfaces.js.map +1 -1
- package/lib/migration/metadataobjnamecheck.js.map +1 -1
- package/lib/migration/omniscript.d.ts +218 -4
- package/lib/migration/omniscript.js +1709 -247
- package/lib/migration/omniscript.js.map +1 -1
- package/lib/migration/omniscriptInstance.d.ts +90 -0
- package/lib/migration/omniscriptInstance.js +755 -0
- package/lib/migration/omniscriptInstance.js.map +1 -0
- package/lib/migration/postMigrate.d.ts +20 -4
- package/lib/migration/postMigrate.js +199 -12
- package/lib/migration/postMigrate.js.map +1 -1
- package/lib/migration/premigrate.d.ts +51 -0
- package/lib/migration/premigrate.js +325 -0
- package/lib/migration/premigrate.js.map +1 -0
- package/lib/migration/related/ApexMigration.d.ts +3 -0
- package/lib/migration/related/ApexMigration.js +222 -56
- package/lib/migration/related/ApexMigration.js.map +1 -1
- package/lib/migration/related/ExperienceSiteMigration.d.ts +30 -5
- package/lib/migration/related/ExperienceSiteMigration.js +263 -73
- package/lib/migration/related/ExperienceSiteMigration.js.map +1 -1
- package/lib/migration/related/FlexipageMigration.d.ts +5 -5
- package/lib/migration/related/FlexipageMigration.js +60 -38
- package/lib/migration/related/FlexipageMigration.js.map +1 -1
- package/lib/migration/related/LwcMigration.js +45 -26
- package/lib/migration/related/LwcMigration.js.map +1 -1
- package/lib/migration/related/OmnistudioRelatedObjectMigrationFacade.js +48 -32
- package/lib/migration/related/OmnistudioRelatedObjectMigrationFacade.js.map +1 -1
- package/lib/styles/reportGenerator.css +241 -16
- package/lib/templates/assessmentReport.template +78 -8
- package/lib/templates/dashboard.template +86 -57
- package/lib/templates/migrationReport.template +151 -0
- package/lib/utils/OmnistudioSettingsPrefManager.d.ts +14 -0
- package/lib/utils/OmnistudioSettingsPrefManager.js +112 -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/executor/AnonymousApexRunner.d.ts +1 -1
- package/lib/utils/apex/parser/apexparser.d.ts +8 -1
- package/lib/utils/apex/parser/apexparser.js +79 -13
- package/lib/utils/apex/parser/apexparser.js.map +1 -1
- package/lib/utils/config/ExistingRecordCleanupService.d.ts +30 -0
- package/lib/utils/config/ExistingRecordCleanupService.js +266 -0
- package/lib/utils/config/ExistingRecordCleanupService.js.map +1 -0
- package/lib/utils/config/OmniStudioMetadataCleanupService.d.ts +36 -0
- package/lib/utils/config/OmniStudioMetadataCleanupService.js +123 -0
- package/lib/utils/config/OmniStudioMetadataCleanupService.js.map +1 -0
- package/lib/utils/config/SpecialCharacterRecordCleanupService.d.ts +17 -0
- package/lib/utils/config/SpecialCharacterRecordCleanupService.js +186 -0
- package/lib/utils/config/SpecialCharacterRecordCleanupService.js.map +1 -0
- package/lib/utils/constants/documentRegistry.d.ts +9 -17
- package/lib/utils/constants/documentRegistry.js +9 -17
- package/lib/utils/constants/documentRegistry.js.map +1 -1
- package/lib/utils/constants/stringContants.d.ts +78 -0
- package/lib/utils/constants/stringContants.js +91 -4
- package/lib/utils/constants/stringContants.js.map +1 -1
- package/lib/utils/customLabels.d.ts +35 -0
- package/lib/utils/customLabels.js +100 -0
- package/lib/utils/customLabels.js.map +1 -0
- package/lib/utils/dataModelService.d.ts +18 -0
- package/lib/utils/dataModelService.js +72 -0
- package/lib/utils/dataModelService.js.map +1 -0
- package/lib/utils/file/fileUtil.d.ts +3 -1
- package/lib/utils/file/fileUtil.js +30 -13
- package/lib/utils/file/fileUtil.js.map +1 -1
- package/lib/utils/flexipage/flexiPageTransformer.js +119 -23
- package/lib/utils/flexipage/flexiPageTransformer.js.map +1 -1
- package/lib/utils/formula/FormulaUtil.d.ts +1 -1
- package/lib/utils/formula/FormulaUtil.js +17 -9
- package/lib/utils/formula/FormulaUtil.js.map +1 -1
- package/lib/utils/formula/Stack.js.map +1 -1
- package/lib/utils/generatePackageXml.d.ts +6 -2
- package/lib/utils/generatePackageXml.js +73 -33
- package/lib/utils/generatePackageXml.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/interfaces.d.ts +69 -8
- package/lib/utils/json/jsonutil.js.map +1 -1
- package/lib/utils/logger/fileLogger.js +17 -7
- package/lib/utils/logger/fileLogger.js.map +1 -1
- package/lib/utils/logger.d.ts +3 -3
- package/lib/utils/logger.js +10 -6
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/logging/debugtimer.js.map +1 -1
- package/lib/utils/lwcparser/fileutils/FileDiffUtil.js +30 -22
- package/lib/utils/lwcparser/fileutils/FileDiffUtil.js.map +1 -1
- package/lib/utils/lwcparser/fileutils/FileProcessorFactory.js.map +1 -1
- package/lib/utils/lwcparser/fileutils/HtmlFileProcessor.js.map +1 -1
- package/lib/utils/lwcparser/fileutils/JavascriptFileProcessor.js.map +1 -1
- package/lib/utils/lwcparser/fileutils/XmlFileProcessor.js.map +1 -1
- package/lib/utils/lwcparser/htmlParser/HTMLParser.js +29 -10
- package/lib/utils/lwcparser/htmlParser/HTMLParser.js.map +1 -1
- package/lib/utils/lwcparser/jsParser/JavaScriptParser.js +29 -11
- package/lib/utils/lwcparser/jsParser/JavaScriptParser.js.map +1 -1
- package/lib/utils/lwcparser/xmlParser/XmlParser.js +19 -8
- package/lib/utils/lwcparser/xmlParser/XmlParser.js.map +1 -1
- package/lib/utils/net/index.d.ts +5 -0
- package/lib/utils/net/index.js +40 -2
- package/lib/utils/net/index.js.map +1 -1
- package/lib/utils/omniscriptPackageManager.d.ts +31 -0
- package/lib/utils/omniscriptPackageManager.js +215 -0
- package/lib/utils/omniscriptPackageManager.js.map +1 -0
- package/lib/utils/orgPreferences.d.ts +25 -0
- package/lib/utils/orgPreferences.js +124 -8
- package/lib/utils/orgPreferences.js.map +1 -1
- package/lib/utils/orgUtils/index.d.ts +12 -5
- package/lib/utils/orgUtils/index.js +52 -22
- package/lib/utils/orgUtils/index.js.map +1 -1
- package/lib/utils/projectPathUtil.d.ts +1 -1
- package/lib/utils/projectPathUtil.js +27 -10
- package/lib/utils/projectPathUtil.js.map +1 -1
- package/lib/utils/promptUtil.d.ts +11 -1
- package/lib/utils/promptUtil.js +92 -0
- package/lib/utils/promptUtil.js.map +1 -1
- package/lib/utils/query/index.d.ts +1 -0
- package/lib/utils/query/index.js +18 -1
- package/lib/utils/query/index.js.map +1 -1
- package/lib/utils/recordPrioritization.d.ts +44 -0
- package/lib/utils/recordPrioritization.js +69 -0
- package/lib/utils/recordPrioritization.js.map +1 -0
- package/lib/utils/reportGenerator/reportInterfaces.d.ts +12 -0
- package/lib/utils/reportGenerator/reportUtil.d.ts +6 -1
- package/lib/utils/reportGenerator/reportUtil.js +22 -7
- package/lib/utils/reportGenerator/reportUtil.js.map +1 -1
- package/lib/utils/resultsbuilder/ApexAssessmentReporter.d.ts +1 -0
- package/lib/utils/resultsbuilder/ApexAssessmentReporter.js +40 -17
- package/lib/utils/resultsbuilder/ApexAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/CustomLabelAssessmentReporter.d.ts +13 -0
- package/lib/utils/resultsbuilder/CustomLabelAssessmentReporter.js +179 -0
- package/lib/utils/resultsbuilder/CustomLabelAssessmentReporter.js.map +1 -0
- package/lib/utils/resultsbuilder/CustomLabelMigrationReporter.d.ts +27 -0
- package/lib/utils/resultsbuilder/CustomLabelMigrationReporter.js +262 -0
- package/lib/utils/resultsbuilder/CustomLabelMigrationReporter.js.map +1 -0
- package/lib/utils/resultsbuilder/DRAssessmentReporter.js +38 -70
- package/lib/utils/resultsbuilder/DRAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/ExperienceSiteAssessmentReporter.d.ts +14 -0
- package/lib/utils/resultsbuilder/ExperienceSiteAssessmentReporter.js +143 -0
- package/lib/utils/resultsbuilder/ExperienceSiteAssessmentReporter.js.map +1 -0
- package/lib/utils/resultsbuilder/FlexcardAssessmentReporter.js +46 -85
- package/lib/utils/resultsbuilder/FlexcardAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/FlexipageAssessmentReporter.d.ts +1 -0
- package/lib/utils/resultsbuilder/FlexipageAssessmentReporter.js +37 -19
- package/lib/utils/resultsbuilder/FlexipageAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/GlobalAutoNumberAssessmentReporter.js +22 -14
- package/lib/utils/resultsbuilder/GlobalAutoNumberAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/IPAssessmentReporter.js +38 -71
- 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 +41 -88
- package/lib/utils/resultsbuilder/OSAssessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/SaveForLaterAssessmentReporter.d.ts +12 -0
- package/lib/utils/resultsbuilder/SaveForLaterAssessmentReporter.js +109 -0
- package/lib/utils/resultsbuilder/SaveForLaterAssessmentReporter.js.map +1 -0
- package/lib/utils/resultsbuilder/assessmentReporter.d.ts +16 -6
- package/lib/utils/resultsbuilder/assessmentReporter.js +96 -152
- package/lib/utils/resultsbuilder/assessmentReporter.js.map +1 -1
- package/lib/utils/resultsbuilder/helpers/AssessmentReportHelper.d.ts +104 -0
- package/lib/utils/resultsbuilder/helpers/AssessmentReportHelper.js +380 -0
- package/lib/utils/resultsbuilder/helpers/AssessmentReportHelper.js.map +1 -0
- package/lib/utils/resultsbuilder/index.d.ts +37 -1
- package/lib/utils/resultsbuilder/index.js +582 -151
- 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 +29 -0
- package/lib/utils/sfcli/project/sfProject.js +220 -2
- package/lib/utils/sfcli/project/sfProject.js.map +1 -1
- package/lib/utils/shell/cli.js +20 -14
- package/lib/utils/shell/cli.js.map +1 -1
- package/lib/utils/storageUtil.d.ts +14 -1
- package/lib/utils/storageUtil.js +31 -1
- package/lib/utils/storageUtil.js.map +1 -1
- package/lib/utils/stringUtils.d.ts +24 -0
- package/lib/utils/stringUtils.js +76 -9
- package/lib/utils/stringUtils.js.map +1 -1
- package/lib/utils/templateParser/__tests__/test.js +1 -2
- package/lib/utils/templateParser/__tests__/test.js.map +1 -1
- package/lib/utils/templateParser/generate.d.ts +1 -1
- package/lib/utils/templateParser/generate.js.map +1 -1
- package/lib/utils/templateParser/model/elementNode.d.ts +2 -2
- package/lib/utils/templateParser/model/elementNode.js +11 -2
- package/lib/utils/templateParser/model/elementNode.js.map +1 -1
- package/lib/utils/templateParser/model/nodeTypes.js +1 -1
- package/lib/utils/templateParser/model/nodeTypes.js.map +1 -1
- package/lib/utils/templateParser/util.d.ts +2 -2
- package/lib/utils/templateParser/util.js.map +1 -1
- package/lib/utils/validatorService.d.ts +14 -0
- package/lib/utils/validatorService.js +136 -0
- package/lib/utils/validatorService.js.map +1 -0
- package/messages/assess.json +220 -103
- package/messages/clean.json +40 -0
- package/messages/info.json +2 -1
- package/messages/migrate.json +314 -102
- package/oclif.manifest.json +1 -1
- package/package.json +49 -13
- package/lib/commands/basecommand.d.ts +0 -8
- package/lib/commands/basecommand.js +0 -13
- package/lib/commands/basecommand.js.map +0 -1
- package/lib/utils/OmniGlobalAutoNumberPrefManager.d.ts +0 -40
- package/lib/utils/OmniGlobalAutoNumberPrefManager.js +0 -65
- package/lib/utils/OmniGlobalAutoNumberPrefManager.js.map +0 -1
|
@@ -15,19 +15,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
39
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
30
40
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
41
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
31
42
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
32
43
|
/*
|
|
33
44
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -35,16 +46,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
35
46
|
* Licensed under the BSD 3-Clause license.
|
|
36
47
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
37
48
|
*/
|
|
49
|
+
const path_1 = __importDefault(require("path"));
|
|
38
50
|
const os = __importStar(require("os"));
|
|
39
|
-
const command_1 = require("@salesforce/command");
|
|
40
51
|
const core_1 = require("@salesforce/core");
|
|
41
|
-
const
|
|
52
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
42
53
|
const dataraptor_1 = require("../../../migration/dataraptor");
|
|
43
54
|
const utils_1 = require("../../../utils");
|
|
44
55
|
const interfaces_1 = require("../../../migration/interfaces");
|
|
45
56
|
const resultsbuilder_1 = require("../../../utils/resultsbuilder");
|
|
46
57
|
const flexcard_1 = require("../../../migration/flexcard");
|
|
47
58
|
const omniscript_1 = require("../../../migration/omniscript");
|
|
59
|
+
const customLabels_1 = require("../../../migration/customLabels");
|
|
48
60
|
const logger_1 = require("../../../utils/logger");
|
|
49
61
|
const OmnistudioRelatedObjectMigrationFacade_1 = __importDefault(require("../../../migration/related/OmnistudioRelatedObjectMigrationFacade"));
|
|
50
62
|
const generatePackageXml_1 = require("../../../utils/generatePackageXml");
|
|
@@ -55,50 +67,61 @@ const projectPathUtil_1 = require("../../../utils/projectPathUtil");
|
|
|
55
67
|
const promptUtil_1 = require("../../../utils/promptUtil");
|
|
56
68
|
const projectPathUtil_2 = require("../../../utils/projectPathUtil");
|
|
57
69
|
const postMigrate_1 = require("../../../migration/postMigrate");
|
|
70
|
+
const premigrate_1 = require("../../../migration/premigrate");
|
|
58
71
|
const globalautonumber_1 = require("../../../migration/globalautonumber");
|
|
72
|
+
const dataModelService_1 = require("../../../utils/dataModelService");
|
|
73
|
+
const NameMappingRegistry_1 = require("../../../migration/NameMappingRegistry");
|
|
74
|
+
const ApexNamespaceRegistry_1 = require("../../../migration/ApexNamespaceRegistry");
|
|
75
|
+
const validatorService_1 = require("../../../utils/validatorService");
|
|
76
|
+
const omniscriptInstance_1 = require("../../../migration/omniscriptInstance");
|
|
59
77
|
// Initialize Messages with the current plugin directory
|
|
60
78
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
61
79
|
// Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
|
|
62
80
|
// or any library that is using the messages framework can also be loaded this way.
|
|
63
81
|
const messages = core_1.Messages.loadMessages('@salesforce/plugin-omnistudio-migration-tool', 'migrate');
|
|
64
|
-
class Migrate extends
|
|
82
|
+
class Migrate extends sf_plugins_core_1.SfCommand {
|
|
83
|
+
constructor() {
|
|
84
|
+
super(...arguments);
|
|
85
|
+
// OmniStudio components that don't need migration logging when metadata API is enabled
|
|
86
|
+
this.OMNISTUDIO_COMPONENTS_FOR_LOGGING = [stringContants_1.Constants.CustomLabel, stringContants_1.Constants.GlobalAutoNumber];
|
|
87
|
+
}
|
|
65
88
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
89
|
async run() {
|
|
67
|
-
|
|
90
|
+
const { flags: parsedFlags } = await this.parse(Migrate);
|
|
91
|
+
const ux = new sf_plugins_core_1.Ux();
|
|
92
|
+
const logger = await core_1.Logger.child(this.constructor.name);
|
|
93
|
+
logger_1.Logger.initialiseLogger(ux, logger, 'migrate', parsedFlags.verbose);
|
|
68
94
|
try {
|
|
69
|
-
|
|
70
|
-
return await this.runMigration();
|
|
95
|
+
return await this.runMigration(parsedFlags, ux, logger);
|
|
71
96
|
}
|
|
72
97
|
catch (e) {
|
|
73
98
|
const error = e;
|
|
74
|
-
logger_1.Logger.error(messages.getMessage('errorRunningMigrate'
|
|
99
|
+
logger_1.Logger.error(messages.getMessage('errorRunningMigrate', [error.message]));
|
|
75
100
|
process.exit(1);
|
|
76
101
|
}
|
|
77
102
|
}
|
|
78
|
-
// eslint-disable-next-line
|
|
79
|
-
async runMigration() {
|
|
80
|
-
|
|
81
|
-
const migrateOnly =
|
|
82
|
-
|
|
83
|
-
const relatedObjects =
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (!orgs.hasValidNamespace && this.flags.namespace) {
|
|
94
|
-
logger_1.Logger.warn(messages.getMessage('invalidNamespace') + orgs.packageDetails.namespace);
|
|
95
|
-
}
|
|
96
|
-
if (!orgs.packageDetails) {
|
|
97
|
-
logger_1.Logger.error(messages.getMessage('noPackageInstalled'));
|
|
98
|
-
return;
|
|
103
|
+
// eslint-disable-next-line complexity
|
|
104
|
+
async runMigration(parsedFlags, ux, logger) {
|
|
105
|
+
var _a;
|
|
106
|
+
const migrateOnly = parsedFlags.only || '';
|
|
107
|
+
let allVersions = parsedFlags.allversions || false;
|
|
108
|
+
const relatedObjects = parsedFlags.relatedobjects || '';
|
|
109
|
+
// target-org is required by flag definition, so it will always be present
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
111
|
+
const org = parsedFlags['target-org'];
|
|
112
|
+
const conn = org.getConnection();
|
|
113
|
+
const apiVersion = conn.getApiVersion();
|
|
114
|
+
// Validate that --only and --relatedobjects flags are not used together
|
|
115
|
+
if (migrateOnly && relatedObjects) {
|
|
116
|
+
logger_1.Logger.error(messages.getMessage('relatedFlagsNotSupportedWithOnly'));
|
|
117
|
+
process.exit(1);
|
|
99
118
|
}
|
|
100
|
-
|
|
101
|
-
|
|
119
|
+
const orgs = await orgUtils_1.OrgUtils.getOrgDetails(conn);
|
|
120
|
+
// Initialize global data model service
|
|
121
|
+
(0, dataModelService_1.initializeDataModelService)(orgs);
|
|
122
|
+
const validator = new validatorService_1.ValidatorService(orgs, messages, conn);
|
|
123
|
+
const isValidationPassed = await validator.validate();
|
|
124
|
+
if (!isValidationPassed) {
|
|
102
125
|
return;
|
|
103
126
|
}
|
|
104
127
|
// Enable Omni preferences
|
|
@@ -122,61 +145,114 @@ class Migrate extends basecommand_1.default {
|
|
|
122
145
|
let projectPath;
|
|
123
146
|
let objectsToProcess = [];
|
|
124
147
|
let targetApexNamespace;
|
|
148
|
+
const preMigrate = new premigrate_1.PreMigrate(namespace, conn, logger, messages, ux);
|
|
125
149
|
const isExperienceBundleMetadataAPIProgramaticallyEnabled = { value: false };
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
for (const obj of objectsToProcess) {
|
|
132
|
-
if (!validOptions.includes(obj)) {
|
|
133
|
-
logger_1.Logger.error(messages.getMessage('invalidRelatedObjectsOption', [obj]));
|
|
134
|
-
process.exit(1);
|
|
135
|
-
}
|
|
150
|
+
if ((0, dataModelService_1.isStandardDataModel)()) {
|
|
151
|
+
if (!(0, dataModelService_1.isStandardDataModelWithMetadataAPIEnabled)()) {
|
|
152
|
+
// Only if metadata API is off we need the allVersions Consent and Omnistudio Metadata Cleanup
|
|
153
|
+
allVersions = await preMigrate.handleAllVersionsPrerequisites(allVersions);
|
|
154
|
+
await preMigrate.handleOmnistudioMetadataPrerequisites();
|
|
136
155
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
156
|
+
}
|
|
157
|
+
let actionItems = [];
|
|
158
|
+
let deploymentConfig = { autoDeploy: false, authKey: undefined };
|
|
159
|
+
if (relatedObjects) {
|
|
160
|
+
const relatedObjectProcessResult = await this.processRelatedObjects(relatedObjects, preMigrate, conn, isExperienceBundleMetadataAPIProgramaticallyEnabled, actionItems);
|
|
161
|
+
objectsToProcess = relatedObjectProcessResult.objectsToProcess;
|
|
162
|
+
projectPath = relatedObjectProcessResult.projectPath;
|
|
163
|
+
targetApexNamespace = relatedObjectProcessResult.targetApexNamespace;
|
|
164
|
+
deploymentConfig = relatedObjectProcessResult.deploymentConfig;
|
|
146
165
|
}
|
|
147
166
|
logger_1.Logger.log(messages.getMessage('migrationInitialization', [String(namespace)]));
|
|
148
167
|
logger_1.Logger.log(messages.getMessage('apiVersionInfo', [apiVersion]));
|
|
149
168
|
logger_1.Logger.logVerbose(messages.getMessage('migrationTargets', [migrateOnly || 'all']));
|
|
150
169
|
logger_1.Logger.logVerbose(messages.getMessage('relatedObjectsInfo', [relatedObjects || 'none']));
|
|
151
170
|
logger_1.Logger.logVerbose(messages.getMessage('allVersionsFlagInfo', [String(allVersions)]));
|
|
152
|
-
//
|
|
153
|
-
|
|
171
|
+
// Initialize the name mapping registry and pre-process all components
|
|
172
|
+
const nameRegistry = NameMappingRegistry_1.NameMappingRegistry.getInstance();
|
|
173
|
+
nameRegistry.clear(); // Clear any previous mappings
|
|
174
|
+
logger_1.Logger.log(messages.getMessage('startingComponentPreProcessing'));
|
|
175
|
+
await ApexNamespaceRegistry_1.ApexNamespaceRegistry.getInstance().initialize(conn, namespace);
|
|
176
|
+
await this.preProcessAllComponents(namespace, conn, migrateOnly);
|
|
177
|
+
// Register the migration objects with CORRECTED ORDER
|
|
154
178
|
let migrationObjects = [];
|
|
155
|
-
migrationObjects = this.
|
|
179
|
+
migrationObjects = this.getMigrationObjectsInCorrectOrder(migrateOnly, migrationObjects, namespace, conn, allVersions, logger, ux);
|
|
156
180
|
// Migrate individual objects
|
|
157
181
|
const debugTimer = utils_1.DebugTimer.getInstance();
|
|
158
|
-
// We need to truncate the standard objects first
|
|
159
|
-
let objectMigrationResults
|
|
160
|
-
objectMigrationResults =
|
|
182
|
+
// We need to truncate the standard objects first (in reverse order for cleanup)
|
|
183
|
+
let objectMigrationResults;
|
|
184
|
+
objectMigrationResults = await this.truncateObjects([...migrationObjects].reverse(), debugTimer);
|
|
161
185
|
const allTruncateComplete = objectMigrationResults.length === 0;
|
|
162
|
-
if
|
|
163
|
-
|
|
186
|
+
// Log truncation errors if any exist
|
|
187
|
+
if (!allTruncateComplete) {
|
|
188
|
+
this.logTruncationErrors(objectMigrationResults);
|
|
189
|
+
return;
|
|
164
190
|
}
|
|
165
|
-
|
|
191
|
+
objectMigrationResults = await this.migrateObjects(migrationObjects, debugTimer, namespace);
|
|
192
|
+
const omnistudioRelatedObjectsMigration = new OmnistudioRelatedObjectMigrationFacade_1.default(namespace, migrateOnly, allVersions, org, projectPath, targetApexNamespace);
|
|
166
193
|
const relatedObjectMigrationResult = omnistudioRelatedObjectsMigration.migrateAll(objectsToProcess);
|
|
167
|
-
generatePackageXml_1.generatePackageXml.createChangeList(relatedObjectMigrationResult.apexAssessmentInfos, relatedObjectMigrationResult.lwcAssessmentInfos, relatedObjectMigrationResult.flexipageAssessmentInfos);
|
|
168
194
|
// POST MIGRATION
|
|
169
|
-
|
|
170
|
-
const postMigrate = new postMigrate_1.PostMigrate(this.org, namespace, conn, this.logger, messages, this.ux, objectsToProcess);
|
|
195
|
+
const postMigrate = new postMigrate_1.PostMigrate(org, namespace, conn, logger, messages, ux, objectsToProcess, deploymentConfig, projectPath);
|
|
171
196
|
if (!migrateOnly) {
|
|
172
|
-
|
|
197
|
+
await postMigrate.executeTasks(namespace, actionItems);
|
|
173
198
|
}
|
|
174
|
-
await postMigrate.restoreExperienceAPIMetadataSettings(isExperienceBundleMetadataAPIProgramaticallyEnabled);
|
|
175
199
|
const migrationActionItems = this.collectActionItems(objectMigrationResults);
|
|
176
200
|
actionItems = [...actionItems, ...migrationActionItems];
|
|
177
|
-
|
|
201
|
+
generatePackageXml_1.generatePackageXml.createChangeList(relatedObjectMigrationResult.apexAssessmentInfos, deploymentConfig.autoDeploy && deploymentConfig.authKey ? relatedObjectMigrationResult.lwcAssessmentInfos : [], relatedObjectMigrationResult.experienceSiteAssessmentInfos, relatedObjectMigrationResult.flexipageAssessmentInfos, org.getConnection().version, messages);
|
|
202
|
+
try {
|
|
203
|
+
generatePackageXml_1.generatePackageXml.createOmnistudioDeploymentXml(relatedObjectMigrationResult.apexAssessmentInfos, deploymentConfig.autoDeploy && deploymentConfig.authKey ? relatedObjectMigrationResult.lwcAssessmentInfos : [], relatedObjectMigrationResult.experienceSiteAssessmentInfos, relatedObjectMigrationResult.flexipageAssessmentInfos, org.getConnection().version);
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
logger_1.Logger.error(messages.getMessage('unexpectedError'), error);
|
|
207
|
+
logger_1.Logger.logVerbose(error);
|
|
208
|
+
}
|
|
209
|
+
let deploymentFailed = false;
|
|
210
|
+
try {
|
|
211
|
+
await postMigrate.deploy(actionItems);
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
deploymentFailed = true;
|
|
215
|
+
logger_1.Logger.error(messages.getMessage('errorDeployingComponents'), error);
|
|
216
|
+
logger_1.Logger.logVerbose(error);
|
|
217
|
+
// Even if deployment fails completely, continue with report generation
|
|
218
|
+
// Action items are already added to the array by the deploy method
|
|
219
|
+
}
|
|
220
|
+
await resultsbuilder_1.ResultsBuilder.generateReport(objectMigrationResults, relatedObjectMigrationResult, conn.instanceUrl, orgs, messages, actionItems, objectsToProcess, migrateOnly, deploymentFailed);
|
|
221
|
+
logger_1.Logger.log(messages.getMessage('migrationSuccessfulMessage', [
|
|
222
|
+
(_a = orgs.orgDetails) === null || _a === void 0 ? void 0 : _a.Id,
|
|
223
|
+
path_1.default.join(process.cwd(), stringContants_1.Constants.MigrationReportsFolderName),
|
|
224
|
+
]));
|
|
178
225
|
// Return results needed for --json flag
|
|
179
|
-
return { objectMigrationResults };
|
|
226
|
+
return { objectMigrationResults: [] };
|
|
227
|
+
}
|
|
228
|
+
async processRelatedObjects(relatedObjects, preMigrate, conn, isExperienceBundleMetadataAPIProgramaticallyEnabled, actionItems) {
|
|
229
|
+
const validOptions = [stringContants_1.Constants.Apex, stringContants_1.Constants.ExpSites, stringContants_1.Constants.FlexiPage, stringContants_1.Constants.LWC];
|
|
230
|
+
const objectsToProcess = relatedObjects.split(',').map((obj) => obj.trim());
|
|
231
|
+
// Validate input
|
|
232
|
+
for (const obj of objectsToProcess) {
|
|
233
|
+
if (!validOptions.includes(obj)) {
|
|
234
|
+
logger_1.Logger.error(messages.getMessage('invalidRelatedObjectsOption', [obj]));
|
|
235
|
+
process.exit(1);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
let deploymentConfig = { autoDeploy: false, authKey: undefined };
|
|
239
|
+
let projectPath;
|
|
240
|
+
let targetApexNamespace;
|
|
241
|
+
// Check for general consent to make modifications with OMT
|
|
242
|
+
const generalConsent = await this.getGeneralConsent();
|
|
243
|
+
if (generalConsent) {
|
|
244
|
+
// Use ProjectPathUtil for APEX project folder selection (matches assess.ts logic)
|
|
245
|
+
projectPath = await projectPathUtil_1.ProjectPathUtil.getProjectPath(messages, true);
|
|
246
|
+
targetApexNamespace = await this.getTargetApexNamespace(objectsToProcess, targetApexNamespace);
|
|
247
|
+
await preMigrate.handleExperienceSitePrerequisites(objectsToProcess, conn, isExperienceBundleMetadataAPIProgramaticallyEnabled);
|
|
248
|
+
deploymentConfig = await preMigrate.getAutoDeployConsent(objectsToProcess.includes(stringContants_1.Constants.LWC), actionItems);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
objectsToProcess.length = 0;
|
|
252
|
+
logger_1.Logger.warn(messages.getMessage('relatedObjectsConsentNotGiven'));
|
|
253
|
+
logger_1.Logger.logVerbose(messages.getMessage('relatedObjectsToProcess', [JSON.stringify(objectsToProcess)]));
|
|
254
|
+
}
|
|
255
|
+
return { objectsToProcess, projectPath, targetApexNamespace, deploymentConfig };
|
|
180
256
|
}
|
|
181
257
|
async getMigrationConsent() {
|
|
182
258
|
const askWithTimeOut = promptUtil_1.PromptUtil.askWithTimeOut(messages);
|
|
@@ -205,30 +281,6 @@ class Migrate extends basecommand_1.default {
|
|
|
205
281
|
}
|
|
206
282
|
return consent;
|
|
207
283
|
}
|
|
208
|
-
async handleExperienceSitePrerequisites(objectsToProcess, conn, isExperienceBundleMetadataAPIProgramaticallyEnabled) {
|
|
209
|
-
if (objectsToProcess.includes(stringContants_1.Constants.ExpSites)) {
|
|
210
|
-
const expMetadataApiConsent = await this.getExpSiteMetadataEnableConsent();
|
|
211
|
-
logger_1.Logger.logVerbose(`The consent for exp site is ${expMetadataApiConsent}`);
|
|
212
|
-
if (expMetadataApiConsent === false) {
|
|
213
|
-
logger_1.Logger.warn('Consent for experience sites is not provided. Experience sites will not be processed');
|
|
214
|
-
this.removeKeyFromRelatedObjectsToProcess(stringContants_1.Constants.ExpSites, objectsToProcess);
|
|
215
|
-
logger_1.Logger.logVerbose(`Objects to process after removing expsite are ${JSON.stringify(objectsToProcess)}`);
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
const isMetadataAPIPreEnabled = await orgPreferences_1.OrgPreferences.isExperienceBundleMetadataAPIEnabled(conn);
|
|
219
|
-
if (isMetadataAPIPreEnabled === true) {
|
|
220
|
-
logger_1.Logger.logVerbose('ExperienceBundle metadata api is already enabled');
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
logger_1.Logger.logVerbose('ExperienceBundle metadata api needs to be programatically enabled');
|
|
224
|
-
isExperienceBundleMetadataAPIProgramaticallyEnabled.value = await orgPreferences_1.OrgPreferences.setExperienceBundleMetadataAPI(conn, true);
|
|
225
|
-
if (isExperienceBundleMetadataAPIProgramaticallyEnabled.value === false) {
|
|
226
|
-
this.removeKeyFromRelatedObjectsToProcess(stringContants_1.Constants.ExpSites, objectsToProcess);
|
|
227
|
-
logger_1.Logger.warn('Since the api could not able enabled the experience sites would not be processed');
|
|
228
|
-
}
|
|
229
|
-
logger_1.Logger.logVerbose(`Objects to process are ${JSON.stringify(objectsToProcess)}`);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
284
|
collectActionItems(objectMigrationResults) {
|
|
233
285
|
const actionItems = [];
|
|
234
286
|
// Collect errors from migration results and add them to action items
|
|
@@ -239,20 +291,15 @@ class Migrate extends basecommand_1.default {
|
|
|
239
291
|
}
|
|
240
292
|
return actionItems;
|
|
241
293
|
}
|
|
242
|
-
removeKeyFromRelatedObjectsToProcess(keyToRemove, relatedObjects) {
|
|
243
|
-
const index = relatedObjects.indexOf(stringContants_1.Constants.ExpSites);
|
|
244
|
-
if (index > -1) {
|
|
245
|
-
relatedObjects.splice(index, 1);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
294
|
async truncateObjects(migrationObjects, debugTimer) {
|
|
249
295
|
const objectMigrationResults = [];
|
|
250
|
-
|
|
296
|
+
// Truncate in reverse order (highest dependencies first) - this is correct for cleanup
|
|
297
|
+
for (const cls of migrationObjects) {
|
|
251
298
|
try {
|
|
252
|
-
|
|
253
|
-
|
|
299
|
+
const componentName = cls.getName();
|
|
300
|
+
this.logTruncationStart(componentName, debugTimer);
|
|
254
301
|
await cls.truncate();
|
|
255
|
-
|
|
302
|
+
this.logTruncationComplete(componentName);
|
|
256
303
|
}
|
|
257
304
|
catch (ex) {
|
|
258
305
|
objectMigrationResults.push({
|
|
@@ -266,30 +313,28 @@ class Migrate extends basecommand_1.default {
|
|
|
266
313
|
}
|
|
267
314
|
return objectMigrationResults;
|
|
268
315
|
}
|
|
269
|
-
async migrateObjects(migrationObjects, debugTimer) {
|
|
316
|
+
async migrateObjects(migrationObjects, debugTimer, namespace) {
|
|
270
317
|
let objectMigrationResults = [];
|
|
271
|
-
|
|
318
|
+
// Migrate in correct dependency order
|
|
319
|
+
for (const cls of migrationObjects) {
|
|
272
320
|
try {
|
|
273
|
-
|
|
274
|
-
|
|
321
|
+
const componentName = cls.getName();
|
|
322
|
+
this.logMigrationStart(componentName, debugTimer);
|
|
275
323
|
const results = await cls.migrate();
|
|
276
|
-
|
|
277
|
-
logger_1.Logger.error(messages.getMessage('migrationFailed', [cls.getName()]));
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
logger_1.Logger.log(messages.getMessage('migrationCompleted', [cls.getName()]));
|
|
281
|
-
}
|
|
324
|
+
this.logMigrationComplete(componentName, results);
|
|
282
325
|
objectMigrationResults = objectMigrationResults.concat(results.map((r) => {
|
|
283
326
|
return {
|
|
284
327
|
name: r.name,
|
|
285
328
|
data: this.mergeRecordAndUploadResults(r, cls),
|
|
286
329
|
errors: r.errors,
|
|
330
|
+
totalCount: r.totalCount, // Preserve totalCount for custom labels
|
|
331
|
+
allRecords: r.allRecords, // All records for CSV export
|
|
287
332
|
};
|
|
288
333
|
}));
|
|
289
334
|
}
|
|
290
335
|
catch (ex) {
|
|
291
336
|
if (ex instanceof interfaces_1.InvalidEntityTypeError) {
|
|
292
|
-
logger_1.Logger.error(
|
|
337
|
+
logger_1.Logger.error(messages.getMessage('invalidTypeMigrateErrorMessage', [namespace]));
|
|
293
338
|
process.exit(1);
|
|
294
339
|
}
|
|
295
340
|
const errMsg = ex instanceof Error ? ex.message : String(ex);
|
|
@@ -304,31 +349,123 @@ class Migrate extends basecommand_1.default {
|
|
|
304
349
|
}
|
|
305
350
|
return objectMigrationResults;
|
|
306
351
|
}
|
|
307
|
-
|
|
352
|
+
/**
|
|
353
|
+
* Log the start of component migration and track timing
|
|
354
|
+
*/
|
|
355
|
+
logMigrationStart(componentName, debugTimer) {
|
|
356
|
+
const shouldSkipLogging = this.shouldSkipLogging(componentName);
|
|
357
|
+
if (!shouldSkipLogging) {
|
|
358
|
+
logger_1.Logger.log(messages.getMessage('migratingComponent', [componentName]));
|
|
359
|
+
debugTimer.lap('Migrating: ' + componentName);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Log the completion or failure of component migration
|
|
364
|
+
*/
|
|
365
|
+
logMigrationComplete(componentName, results) {
|
|
366
|
+
const shouldSkipLogging = this.shouldSkipLogging(componentName);
|
|
367
|
+
if (!shouldSkipLogging) {
|
|
368
|
+
if (results.some((result) => { var _a; return ((_a = result === null || result === void 0 ? void 0 : result.errors) === null || _a === void 0 ? void 0 : _a.length) > 0; }) && !(0, dataModelService_1.isStandardDataModelWithMetadataAPIEnabled)()) {
|
|
369
|
+
logger_1.Logger.error(messages.getMessage('migrationFailed', [componentName]));
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
logger_1.Logger.log(messages.getMessage('migrationCompleted', [componentName]));
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Check if migration logging should be skipped for a component
|
|
378
|
+
* Returns true if Metadata API is enabled and the component doesn't need migration
|
|
379
|
+
*/
|
|
380
|
+
shouldSkipTruncationLogging(componentName) {
|
|
381
|
+
if ((0, dataModelService_1.isStandardDataModel)()) {
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
return this.shouldSkipLogging(componentName);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Check if migration logging should be skipped for a component
|
|
388
|
+
* Returns true if Metadata API is enabled and the component doesn't need migration
|
|
389
|
+
*/
|
|
390
|
+
shouldSkipLogging(componentName) {
|
|
391
|
+
if (!(0, dataModelService_1.isStandardDataModelWithMetadataAPIEnabled)()) {
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
// Skip logging for OmniStudio components that don't need migration when metadata API is enabled
|
|
395
|
+
return !this.OMNISTUDIO_COMPONENTS_FOR_LOGGING.some((component) => componentName.toLowerCase().includes(component.toLowerCase()));
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Log the start of component truncation and track timing
|
|
399
|
+
*/
|
|
400
|
+
logTruncationStart(componentName, debugTimer) {
|
|
401
|
+
const shouldSkipLogging = this.shouldSkipTruncationLogging(componentName);
|
|
402
|
+
if (!shouldSkipLogging) {
|
|
403
|
+
logger_1.Logger.log(messages.getMessage('cleaningComponent', [componentName]));
|
|
404
|
+
debugTimer.lap('Cleaning: ' + componentName);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Log the completion of component truncation
|
|
409
|
+
*/
|
|
410
|
+
logTruncationComplete(componentName) {
|
|
411
|
+
const shouldSkipLogging = this.shouldSkipTruncationLogging(componentName);
|
|
412
|
+
if (!shouldSkipLogging) {
|
|
413
|
+
logger_1.Logger.log(messages.getMessage('cleaningDone', [componentName]));
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Get migration objects in the correct dependency order:
|
|
418
|
+
* 1. Data Mappers (lowest dependencies)
|
|
419
|
+
* 2. Integration Procedures/ OmniScripts
|
|
420
|
+
* 3. FlexCards (highest dependencies)
|
|
421
|
+
* 4. GlobalAutoNumbers (independent)
|
|
422
|
+
*/
|
|
423
|
+
getMigrationObjectsInCorrectOrder(migrateOnly, migrationObjects, namespace, conn, allVersions, logger, ux) {
|
|
308
424
|
if (!migrateOnly) {
|
|
309
425
|
migrationObjects = [
|
|
310
|
-
new dataraptor_1.DataRaptorMigrationTool(namespace, conn,
|
|
311
|
-
|
|
312
|
-
new
|
|
313
|
-
|
|
426
|
+
new dataraptor_1.DataRaptorMigrationTool(namespace, conn, logger, messages, ux),
|
|
427
|
+
// Integration Procedure
|
|
428
|
+
new omniscript_1.OmniScriptMigrationTool(omniscript_1.OmniScriptExportType.IP, namespace, conn, logger, messages, ux, allVersions),
|
|
429
|
+
// OmniScript
|
|
430
|
+
new omniscript_1.OmniScriptMigrationTool(omniscript_1.OmniScriptExportType.OS, namespace, conn, logger, messages, ux, allVersions),
|
|
431
|
+
new flexcard_1.CardMigrationTool(namespace, conn, logger, messages, ux, allVersions),
|
|
432
|
+
new customLabels_1.CustomLabelsMigrationTool(namespace, conn, logger, messages, ux),
|
|
314
433
|
];
|
|
434
|
+
if (!(0, dataModelService_1.isFoundationPackage)()) {
|
|
435
|
+
migrationObjects.push(new globalautonumber_1.GlobalAutoNumberMigrationTool(namespace, conn, logger, messages, ux));
|
|
436
|
+
migrationObjects.push(new omniscriptInstance_1.OmniScriptInstanceMigrationTool(namespace, conn, logger, messages, ux));
|
|
437
|
+
}
|
|
315
438
|
}
|
|
316
439
|
else {
|
|
440
|
+
// For single component migration, the order doesn't matter as much
|
|
441
|
+
// but we still maintain consistency
|
|
317
442
|
switch (migrateOnly) {
|
|
318
443
|
case stringContants_1.Constants.Omniscript:
|
|
319
|
-
migrationObjects.push(new omniscript_1.OmniScriptMigrationTool(omniscript_1.OmniScriptExportType.OS, namespace, conn,
|
|
444
|
+
migrationObjects.push(new omniscript_1.OmniScriptMigrationTool(omniscript_1.OmniScriptExportType.OS, namespace, conn, logger, messages, ux, allVersions));
|
|
320
445
|
break;
|
|
321
446
|
case stringContants_1.Constants.IntegrationProcedure:
|
|
322
|
-
migrationObjects.push(new omniscript_1.OmniScriptMigrationTool(omniscript_1.OmniScriptExportType.IP, namespace, conn,
|
|
447
|
+
migrationObjects.push(new omniscript_1.OmniScriptMigrationTool(omniscript_1.OmniScriptExportType.IP, namespace, conn, logger, messages, ux, allVersions));
|
|
323
448
|
break;
|
|
324
449
|
case stringContants_1.Constants.Flexcard:
|
|
325
|
-
migrationObjects.push(new flexcard_1.CardMigrationTool(namespace, conn,
|
|
450
|
+
migrationObjects.push(new flexcard_1.CardMigrationTool(namespace, conn, logger, messages, ux, allVersions));
|
|
326
451
|
break;
|
|
327
452
|
case stringContants_1.Constants.DataMapper:
|
|
328
|
-
migrationObjects.push(new dataraptor_1.DataRaptorMigrationTool(namespace, conn,
|
|
453
|
+
migrationObjects.push(new dataraptor_1.DataRaptorMigrationTool(namespace, conn, logger, messages, ux));
|
|
329
454
|
break;
|
|
330
455
|
case stringContants_1.Constants.GlobalAutoNumber:
|
|
331
|
-
|
|
456
|
+
if ((0, dataModelService_1.isFoundationPackage)()) {
|
|
457
|
+
logger_1.Logger.warn(messages.getMessage('globalAutoNumberUnSupportedInOmnistudioPackage'));
|
|
458
|
+
}
|
|
459
|
+
migrationObjects.push(new globalautonumber_1.GlobalAutoNumberMigrationTool(namespace, conn, logger, messages, ux));
|
|
460
|
+
break;
|
|
461
|
+
case stringContants_1.Constants.CustomLabel:
|
|
462
|
+
migrationObjects.push(new customLabels_1.CustomLabelsMigrationTool(namespace, conn, logger, messages, ux));
|
|
463
|
+
break;
|
|
464
|
+
case stringContants_1.Constants.SaveForLater:
|
|
465
|
+
if ((0, dataModelService_1.isFoundationPackage)()) {
|
|
466
|
+
logger_1.Logger.warn(messages.getMessage('globalAutoNumberUnSupportedInOmnistudioPackage'));
|
|
467
|
+
}
|
|
468
|
+
migrationObjects.push(new omniscriptInstance_1.OmniScriptInstanceMigrationTool(namespace, conn, logger, messages, ux));
|
|
332
469
|
break;
|
|
333
470
|
default:
|
|
334
471
|
throw new Error(messages.getMessage('invalidOnlyFlag'));
|
|
@@ -336,9 +473,127 @@ class Migrate extends basecommand_1.default {
|
|
|
336
473
|
}
|
|
337
474
|
return migrationObjects;
|
|
338
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* Pre-process all components to register their name mappings
|
|
478
|
+
*/
|
|
479
|
+
async preProcessAllComponents(namespace, conn, migrateOnly) {
|
|
480
|
+
try {
|
|
481
|
+
if ((0, dataModelService_1.isStandardDataModelWithMetadataAPIEnabled)()) {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
const nameRegistry = NameMappingRegistry_1.NameMappingRegistry.getInstance();
|
|
485
|
+
// Query all components that will be migrated
|
|
486
|
+
const dataMappers = await this.queryDataMappers(conn, namespace);
|
|
487
|
+
const allOmniScripts = await this.queryOmniScripts(conn, namespace, false); // All OmniScripts (LWC + Angular)
|
|
488
|
+
const integrationProcedures = await this.queryOmniScripts(conn, namespace, true); // Integration Procedures only
|
|
489
|
+
const flexCards = await this.queryFlexCards(conn, namespace);
|
|
490
|
+
// Separate OmniScripts into LWC and Angular types
|
|
491
|
+
const { lwc: lwcOmniScripts, angular: angularOmniScripts } = this.separateOmniScriptsByType(allOmniScripts, namespace);
|
|
492
|
+
// Filter based on migrateOnly flag if specified
|
|
493
|
+
const filteredData = this.filterComponentsByMigrateOnly(migrateOnly, dataMappers, lwcOmniScripts, // Only LWC OmniScripts for migration
|
|
494
|
+
integrationProcedures, flexCards);
|
|
495
|
+
// Register all name mappings (including Angular OmniScripts for tracking)
|
|
496
|
+
nameRegistry.preProcessComponents(filteredData.dataMappers, filteredData.omniScripts, // LWC OmniScripts
|
|
497
|
+
angularOmniScripts, // Angular OmniScripts (for tracking)
|
|
498
|
+
filteredData.integrationProcedures, filteredData.flexCards);
|
|
499
|
+
const allMappings = nameRegistry.getAllNameMappings();
|
|
500
|
+
logger_1.Logger.log(messages.getMessage('completeComponentMappingMessage', [allMappings.length]));
|
|
501
|
+
}
|
|
502
|
+
catch (error) {
|
|
503
|
+
logger_1.Logger.error(messages.getMessage('errorComponentMapping'), error);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Query DataMappers from the org
|
|
508
|
+
*/
|
|
509
|
+
async queryDataMappers(conn, namespace) {
|
|
510
|
+
let query;
|
|
511
|
+
if ((0, dataModelService_1.isStandardDataModel)()) {
|
|
512
|
+
query = "SELECT Id, Name FROM OmniDataTransform WHERE Type != 'Migration'";
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
query = `SELECT Id, Name FROM ${namespace}__DRBundle__c WHERE ${namespace}__Type__c != 'Migration'`;
|
|
516
|
+
}
|
|
517
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
518
|
+
const result = await conn.query(query);
|
|
519
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
520
|
+
return result.records || [];
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Query OmniScripts from the org (both LWC and Angular)
|
|
524
|
+
*/
|
|
525
|
+
async queryOmniScripts(conn, namespace, isProcedure) {
|
|
526
|
+
const procedureFilter = isProcedure ? 'true' : 'false';
|
|
527
|
+
let query;
|
|
528
|
+
// Query all OmniScripts (both LWC and Angular)
|
|
529
|
+
if ((0, dataModelService_1.isStandardDataModel)()) {
|
|
530
|
+
query = `SELECT Id, Name, Type, SubType, Language, IsIntegrationProcedure, IsWebCompEnabled FROM OmniProcess WHERE IsIntegrationProcedure = ${procedureFilter} and IsActive = true`;
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
query = `SELECT Id, Name, ${namespace}__Type__c, ${namespace}__SubType__c, ${namespace}__Language__c, ${namespace}__IsProcedure__c, ${namespace}__IsLwcEnabled__c FROM ${namespace}__OmniScript__c WHERE ${namespace}__IsProcedure__c = ${procedureFilter} and ${namespace}__IsActive__c = true`;
|
|
534
|
+
}
|
|
535
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
536
|
+
const result = await conn.query(query);
|
|
537
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
538
|
+
return result.records || [];
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Separate OmniScripts into LWC and Angular based on IsLwcEnabled__c field
|
|
542
|
+
*/
|
|
543
|
+
separateOmniScriptsByType(omniscripts, namespace) {
|
|
544
|
+
const lwc = [];
|
|
545
|
+
const angular = [];
|
|
546
|
+
for (const omniscript of omniscripts) {
|
|
547
|
+
const isLwcEnabled = omniscript[(0, dataModelService_1.getFieldKeyForOmniscript)(namespace, 'IsLwcEnabled__c')];
|
|
548
|
+
if (isLwcEnabled) {
|
|
549
|
+
lwc.push(omniscript);
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
angular.push(omniscript);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return { lwc, angular };
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Query FlexCards from the org
|
|
559
|
+
*/
|
|
560
|
+
async queryFlexCards(conn, namespace) {
|
|
561
|
+
let query;
|
|
562
|
+
if ((0, dataModelService_1.isStandardDataModel)()) {
|
|
563
|
+
query = 'SELECT Id, Name FROM OmniUiCard WHERE IsActive = true';
|
|
564
|
+
}
|
|
565
|
+
else {
|
|
566
|
+
query = `SELECT Id, Name FROM ${namespace}__VlocityCard__c WHERE ${namespace}__CardType__c = 'flex' AND ${namespace}__Active__c = true`;
|
|
567
|
+
}
|
|
568
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
569
|
+
const result = await conn.query(query);
|
|
570
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
571
|
+
return result.records || [];
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Filter components based on the migrateOnly flag
|
|
575
|
+
*/
|
|
576
|
+
filterComponentsByMigrateOnly(migrateOnly, dataMappers, omniScripts, integrationProcedures, flexCards) {
|
|
577
|
+
if (!migrateOnly) {
|
|
578
|
+
return { dataMappers, omniScripts, integrationProcedures, flexCards };
|
|
579
|
+
}
|
|
580
|
+
// Return only the components that match the migrateOnly filter
|
|
581
|
+
switch (migrateOnly) {
|
|
582
|
+
case stringContants_1.Constants.DataMapper:
|
|
583
|
+
return { dataMappers, omniScripts: [], integrationProcedures: [], flexCards: [] };
|
|
584
|
+
case stringContants_1.Constants.Omniscript:
|
|
585
|
+
return { dataMappers: [], omniScripts, integrationProcedures: [], flexCards: [] };
|
|
586
|
+
case stringContants_1.Constants.IntegrationProcedure:
|
|
587
|
+
return { dataMappers: [], omniScripts: [], integrationProcedures, flexCards: [] };
|
|
588
|
+
case stringContants_1.Constants.Flexcard:
|
|
589
|
+
return { dataMappers: [], omniScripts: [], integrationProcedures: [], flexCards };
|
|
590
|
+
default:
|
|
591
|
+
return { dataMappers: [], omniScripts: [], integrationProcedures: [], flexCards: [] };
|
|
592
|
+
}
|
|
593
|
+
}
|
|
339
594
|
async getTargetApexNamespace(objectsToProcess, targetApexNamespace) {
|
|
340
595
|
if (objectsToProcess.includes(stringContants_1.Constants.Apex)) {
|
|
341
|
-
targetApexNamespace = await
|
|
596
|
+
targetApexNamespace = await (0, promptUtil_1.askQuestion)(messages.getMessage('enterTargetNamespace'));
|
|
342
597
|
logger_1.Logger.log(messages.getMessage('usingTargetNamespace', [targetApexNamespace]));
|
|
343
598
|
}
|
|
344
599
|
return targetApexNamespace;
|
|
@@ -356,75 +611,106 @@ class Migrate extends basecommand_1.default {
|
|
|
356
611
|
}
|
|
357
612
|
return consent;
|
|
358
613
|
}
|
|
359
|
-
async getExpSiteMetadataEnableConsent() {
|
|
360
|
-
let consent = null;
|
|
361
|
-
while (consent === null) {
|
|
362
|
-
try {
|
|
363
|
-
consent = await logger_1.Logger.confirm('By proceeding further, you hereby consent to enable digital experience metadata api(y/n). If y sites will be processed, if n expsites will not be processed');
|
|
364
|
-
}
|
|
365
|
-
catch (error) {
|
|
366
|
-
logger_1.Logger.log(messages.getMessage('invalidYesNoResponse'));
|
|
367
|
-
consent = null;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
return consent;
|
|
371
|
-
}
|
|
372
614
|
mergeRecordAndUploadResults(migrationResults, migrationTool) {
|
|
373
615
|
const mergedResults = [];
|
|
374
616
|
for (const record of Array.from(migrationResults.records.values())) {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
:
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
617
|
+
// For custom labels, preserve all the custom fields
|
|
618
|
+
if (migrationTool.getName().toLowerCase().includes(stringContants_1.Constants.CustomLabelPluralName.toLowerCase())) {
|
|
619
|
+
// Use the record as-is for custom labels since it already has all the needed fields
|
|
620
|
+
const customLabelRecord = record;
|
|
621
|
+
mergedResults.push({
|
|
622
|
+
id: customLabelRecord.id || customLabelRecord.name,
|
|
623
|
+
name: customLabelRecord.name || customLabelRecord.labelName,
|
|
624
|
+
status: customLabelRecord.status || 'Skipped',
|
|
625
|
+
errors: customLabelRecord.errors || [],
|
|
626
|
+
migratedId: customLabelRecord.migratedId || customLabelRecord.id,
|
|
627
|
+
warnings: customLabelRecord.warnings || [],
|
|
628
|
+
migratedName: customLabelRecord.migratedName || customLabelRecord.name,
|
|
629
|
+
// Preserve custom fields for custom labels
|
|
630
|
+
coreInfo: customLabelRecord.coreInfo,
|
|
631
|
+
packageInfo: customLabelRecord.packageInfo,
|
|
632
|
+
message: customLabelRecord.message,
|
|
633
|
+
cloneStatus: customLabelRecord.cloneStatus,
|
|
634
|
+
labelName: customLabelRecord.labelName,
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
// Original logic for other components
|
|
639
|
+
const obj = {
|
|
640
|
+
id: record['Id'],
|
|
641
|
+
name: migrationTool.getRecordName(record),
|
|
642
|
+
status: 'Skipped',
|
|
643
|
+
errors: record['errors'],
|
|
644
|
+
migratedId: undefined,
|
|
645
|
+
warnings: [],
|
|
646
|
+
migratedName: '',
|
|
647
|
+
};
|
|
648
|
+
if (migrationResults.results.has(record['Id'])) {
|
|
649
|
+
const recordResults = migrationResults.results.get(record['Id']);
|
|
650
|
+
let errors = obj.errors || [];
|
|
651
|
+
errors = errors.concat(recordResults.errors || []);
|
|
652
|
+
if (recordResults === null || recordResults === void 0 ? void 0 : recordResults.skipped) {
|
|
653
|
+
obj.status = 'Skipped';
|
|
654
|
+
}
|
|
655
|
+
else if (!recordResults || recordResults.hasErrors) {
|
|
656
|
+
obj.status = 'Failed';
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
obj.status = 'Successfully migrated';
|
|
660
|
+
}
|
|
661
|
+
obj.errors = errors;
|
|
662
|
+
obj.migratedId = recordResults.id;
|
|
663
|
+
obj.warnings = recordResults.warnings;
|
|
664
|
+
obj.migratedName = recordResults.newName;
|
|
665
|
+
}
|
|
666
|
+
mergedResults.push(obj);
|
|
397
667
|
}
|
|
398
|
-
mergedResults.push(obj);
|
|
399
668
|
}
|
|
400
669
|
return mergedResults;
|
|
401
670
|
}
|
|
671
|
+
logTruncationErrors(objectMigrationResults) {
|
|
672
|
+
objectMigrationResults.forEach((result) => {
|
|
673
|
+
if (result.errors && result.errors.length > 0) {
|
|
674
|
+
logger_1.Logger.error(messages.getMessage('truncationFailed', [result.name, result.errors.join(', ')]));
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
}
|
|
402
678
|
}
|
|
403
|
-
exports.default = Migrate;
|
|
404
679
|
Migrate.description = messages.getMessage('commandDescription');
|
|
405
680
|
Migrate.examples = messages.getMessage('examples').split(os.EOL);
|
|
406
|
-
|
|
407
|
-
Migrate.
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
681
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
682
|
+
Migrate.args = [];
|
|
683
|
+
Migrate.flags = {
|
|
684
|
+
'target-org': sf_plugins_core_1.Flags.optionalOrg({
|
|
685
|
+
summary: 'Target org username or alias',
|
|
686
|
+
char: 'u',
|
|
687
|
+
required: true,
|
|
688
|
+
aliases: ['targetusername'],
|
|
689
|
+
deprecateAliases: true,
|
|
690
|
+
makeDefault: false, // Prevent auto-resolution during command-reference generation
|
|
411
691
|
}),
|
|
412
|
-
only:
|
|
692
|
+
only: sf_plugins_core_1.Flags.string({
|
|
413
693
|
char: 'o',
|
|
414
694
|
description: messages.getMessage('onlyFlagDescription'),
|
|
415
695
|
}),
|
|
416
|
-
allversions:
|
|
696
|
+
allversions: sf_plugins_core_1.Flags.boolean({
|
|
417
697
|
char: 'a',
|
|
418
698
|
description: messages.getMessage('allVersionsDescription'),
|
|
419
699
|
required: false,
|
|
420
700
|
}),
|
|
421
|
-
relatedobjects:
|
|
701
|
+
relatedobjects: sf_plugins_core_1.Flags.string({
|
|
422
702
|
char: 'r',
|
|
423
703
|
description: messages.getMessage('relatedObjectGA'),
|
|
424
704
|
}),
|
|
425
|
-
verbose:
|
|
426
|
-
type: 'builtin',
|
|
705
|
+
verbose: sf_plugins_core_1.Flags.boolean({
|
|
427
706
|
description: 'Enable verbose output',
|
|
428
707
|
}),
|
|
708
|
+
loglevel: sf_plugins_core_1.Flags.string({
|
|
709
|
+
description: 'Logging level (deprecated, use --verbose instead)',
|
|
710
|
+
deprecated: {
|
|
711
|
+
message: messages.getMessage('loglevelFlagDeprecated'),
|
|
712
|
+
},
|
|
713
|
+
}),
|
|
429
714
|
};
|
|
715
|
+
exports.default = Migrate;
|
|
430
716
|
//# sourceMappingURL=migrate.js.map
|