@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.
Files changed (252) hide show
  1. package/README.md +165 -73
  2. package/lib/commands/omnistudio/migration/assess.d.ts +23 -15
  3. package/lib/commands/omnistudio/migration/assess.js +250 -89
  4. package/lib/commands/omnistudio/migration/assess.js.map +1 -1
  5. package/lib/commands/omnistudio/migration/clean.d.ts +13 -0
  6. package/lib/commands/omnistudio/migration/clean.js +162 -0
  7. package/lib/commands/omnistudio/migration/clean.js.map +1 -0
  8. package/lib/commands/omnistudio/migration/info.d.ts +10 -16
  9. package/lib/commands/omnistudio/migration/info.js +53 -35
  10. package/lib/commands/omnistudio/migration/info.js.map +1 -1
  11. package/lib/commands/omnistudio/migration/migrate.d.ts +78 -18
  12. package/lib/commands/omnistudio/migration/migrate.js +461 -175
  13. package/lib/commands/omnistudio/migration/migrate.js.map +1 -1
  14. package/lib/error/deploymentErrors.d.ts +15 -0
  15. package/lib/error/deploymentErrors.js +35 -0
  16. package/lib/error/deploymentErrors.js.map +1 -0
  17. package/lib/error/errorInterfaces.d.ts +5 -0
  18. package/lib/error/errorInterfaces.js +9 -1
  19. package/lib/error/errorInterfaces.js.map +1 -1
  20. package/lib/javascripts/reportGeneratorUtility.js +585 -22
  21. package/lib/migration/ApexNamespaceRegistry.d.ts +49 -0
  22. package/lib/migration/ApexNamespaceRegistry.js +130 -0
  23. package/lib/migration/ApexNamespaceRegistry.js.map +1 -0
  24. package/lib/migration/CustomCssRegistry.d.ts +117 -0
  25. package/lib/migration/CustomCssRegistry.js +234 -0
  26. package/lib/migration/CustomCssRegistry.js.map +1 -0
  27. package/lib/migration/NameMappingRegistry.d.ts +134 -0
  28. package/lib/migration/NameMappingRegistry.js +411 -0
  29. package/lib/migration/NameMappingRegistry.js.map +1 -0
  30. package/lib/migration/base.d.ts +8 -6
  31. package/lib/migration/base.js +25 -8
  32. package/lib/migration/base.js.map +1 -1
  33. package/lib/migration/customLabels.d.ts +70 -0
  34. package/lib/migration/customLabels.js +177 -0
  35. package/lib/migration/customLabels.js.map +1 -0
  36. package/lib/migration/dataraptor.d.ts +13 -0
  37. package/lib/migration/dataraptor.js +205 -80
  38. package/lib/migration/dataraptor.js.map +1 -1
  39. package/lib/migration/deployer.d.ts +14 -0
  40. package/lib/migration/deployer.js +105 -0
  41. package/lib/migration/deployer.js.map +1 -0
  42. package/lib/migration/flexcard.d.ts +256 -6
  43. package/lib/migration/flexcard.js +1808 -268
  44. package/lib/migration/flexcard.js.map +1 -1
  45. package/lib/migration/globalautonumber.d.ts +8 -8
  46. package/lib/migration/globalautonumber.js +49 -24
  47. package/lib/migration/globalautonumber.js.map +1 -1
  48. package/lib/migration/interfaces.d.ts +14 -0
  49. package/lib/migration/interfaces.js.map +1 -1
  50. package/lib/migration/metadataobjnamecheck.js.map +1 -1
  51. package/lib/migration/omniscript.d.ts +218 -4
  52. package/lib/migration/omniscript.js +1709 -247
  53. package/lib/migration/omniscript.js.map +1 -1
  54. package/lib/migration/omniscriptInstance.d.ts +90 -0
  55. package/lib/migration/omniscriptInstance.js +755 -0
  56. package/lib/migration/omniscriptInstance.js.map +1 -0
  57. package/lib/migration/postMigrate.d.ts +20 -4
  58. package/lib/migration/postMigrate.js +199 -12
  59. package/lib/migration/postMigrate.js.map +1 -1
  60. package/lib/migration/premigrate.d.ts +51 -0
  61. package/lib/migration/premigrate.js +325 -0
  62. package/lib/migration/premigrate.js.map +1 -0
  63. package/lib/migration/related/ApexMigration.d.ts +3 -0
  64. package/lib/migration/related/ApexMigration.js +222 -56
  65. package/lib/migration/related/ApexMigration.js.map +1 -1
  66. package/lib/migration/related/ExperienceSiteMigration.d.ts +30 -5
  67. package/lib/migration/related/ExperienceSiteMigration.js +263 -73
  68. package/lib/migration/related/ExperienceSiteMigration.js.map +1 -1
  69. package/lib/migration/related/FlexipageMigration.d.ts +5 -5
  70. package/lib/migration/related/FlexipageMigration.js +60 -38
  71. package/lib/migration/related/FlexipageMigration.js.map +1 -1
  72. package/lib/migration/related/LwcMigration.js +45 -26
  73. package/lib/migration/related/LwcMigration.js.map +1 -1
  74. package/lib/migration/related/OmnistudioRelatedObjectMigrationFacade.js +48 -32
  75. package/lib/migration/related/OmnistudioRelatedObjectMigrationFacade.js.map +1 -1
  76. package/lib/styles/reportGenerator.css +241 -16
  77. package/lib/templates/assessmentReport.template +78 -8
  78. package/lib/templates/dashboard.template +86 -57
  79. package/lib/templates/migrationReport.template +151 -0
  80. package/lib/utils/OmnistudioSettingsPrefManager.d.ts +14 -0
  81. package/lib/utils/OmnistudioSettingsPrefManager.js +112 -0
  82. package/lib/utils/OmnistudioSettingsPrefManager.js.map +1 -0
  83. package/lib/utils/XMLUtil.js +2 -1
  84. package/lib/utils/XMLUtil.js.map +1 -1
  85. package/lib/utils/apex/executor/AnonymousApexRunner.d.ts +1 -1
  86. package/lib/utils/apex/parser/apexparser.d.ts +8 -1
  87. package/lib/utils/apex/parser/apexparser.js +79 -13
  88. package/lib/utils/apex/parser/apexparser.js.map +1 -1
  89. package/lib/utils/config/ExistingRecordCleanupService.d.ts +30 -0
  90. package/lib/utils/config/ExistingRecordCleanupService.js +266 -0
  91. package/lib/utils/config/ExistingRecordCleanupService.js.map +1 -0
  92. package/lib/utils/config/OmniStudioMetadataCleanupService.d.ts +36 -0
  93. package/lib/utils/config/OmniStudioMetadataCleanupService.js +123 -0
  94. package/lib/utils/config/OmniStudioMetadataCleanupService.js.map +1 -0
  95. package/lib/utils/config/SpecialCharacterRecordCleanupService.d.ts +17 -0
  96. package/lib/utils/config/SpecialCharacterRecordCleanupService.js +186 -0
  97. package/lib/utils/config/SpecialCharacterRecordCleanupService.js.map +1 -0
  98. package/lib/utils/constants/documentRegistry.d.ts +9 -17
  99. package/lib/utils/constants/documentRegistry.js +9 -17
  100. package/lib/utils/constants/documentRegistry.js.map +1 -1
  101. package/lib/utils/constants/stringContants.d.ts +78 -0
  102. package/lib/utils/constants/stringContants.js +91 -4
  103. package/lib/utils/constants/stringContants.js.map +1 -1
  104. package/lib/utils/customLabels.d.ts +35 -0
  105. package/lib/utils/customLabels.js +100 -0
  106. package/lib/utils/customLabels.js.map +1 -0
  107. package/lib/utils/dataModelService.d.ts +18 -0
  108. package/lib/utils/dataModelService.js +72 -0
  109. package/lib/utils/dataModelService.js.map +1 -0
  110. package/lib/utils/file/fileUtil.d.ts +3 -1
  111. package/lib/utils/file/fileUtil.js +30 -13
  112. package/lib/utils/file/fileUtil.js.map +1 -1
  113. package/lib/utils/flexipage/flexiPageTransformer.js +119 -23
  114. package/lib/utils/flexipage/flexiPageTransformer.js.map +1 -1
  115. package/lib/utils/formula/FormulaUtil.d.ts +1 -1
  116. package/lib/utils/formula/FormulaUtil.js +17 -9
  117. package/lib/utils/formula/FormulaUtil.js.map +1 -1
  118. package/lib/utils/formula/Stack.js.map +1 -1
  119. package/lib/utils/generatePackageXml.d.ts +6 -2
  120. package/lib/utils/generatePackageXml.js +73 -33
  121. package/lib/utils/generatePackageXml.js.map +1 -1
  122. package/lib/utils/index.d.ts +1 -0
  123. package/lib/utils/index.js +1 -0
  124. package/lib/utils/index.js.map +1 -1
  125. package/lib/utils/interfaces.d.ts +69 -8
  126. package/lib/utils/json/jsonutil.js.map +1 -1
  127. package/lib/utils/logger/fileLogger.js +17 -7
  128. package/lib/utils/logger/fileLogger.js.map +1 -1
  129. package/lib/utils/logger.d.ts +3 -3
  130. package/lib/utils/logger.js +10 -6
  131. package/lib/utils/logger.js.map +1 -1
  132. package/lib/utils/logging/debugtimer.js.map +1 -1
  133. package/lib/utils/lwcparser/fileutils/FileDiffUtil.js +30 -22
  134. package/lib/utils/lwcparser/fileutils/FileDiffUtil.js.map +1 -1
  135. package/lib/utils/lwcparser/fileutils/FileProcessorFactory.js.map +1 -1
  136. package/lib/utils/lwcparser/fileutils/HtmlFileProcessor.js.map +1 -1
  137. package/lib/utils/lwcparser/fileutils/JavascriptFileProcessor.js.map +1 -1
  138. package/lib/utils/lwcparser/fileutils/XmlFileProcessor.js.map +1 -1
  139. package/lib/utils/lwcparser/htmlParser/HTMLParser.js +29 -10
  140. package/lib/utils/lwcparser/htmlParser/HTMLParser.js.map +1 -1
  141. package/lib/utils/lwcparser/jsParser/JavaScriptParser.js +29 -11
  142. package/lib/utils/lwcparser/jsParser/JavaScriptParser.js.map +1 -1
  143. package/lib/utils/lwcparser/xmlParser/XmlParser.js +19 -8
  144. package/lib/utils/lwcparser/xmlParser/XmlParser.js.map +1 -1
  145. package/lib/utils/net/index.d.ts +5 -0
  146. package/lib/utils/net/index.js +40 -2
  147. package/lib/utils/net/index.js.map +1 -1
  148. package/lib/utils/omniscriptPackageManager.d.ts +31 -0
  149. package/lib/utils/omniscriptPackageManager.js +215 -0
  150. package/lib/utils/omniscriptPackageManager.js.map +1 -0
  151. package/lib/utils/orgPreferences.d.ts +25 -0
  152. package/lib/utils/orgPreferences.js +124 -8
  153. package/lib/utils/orgPreferences.js.map +1 -1
  154. package/lib/utils/orgUtils/index.d.ts +12 -5
  155. package/lib/utils/orgUtils/index.js +52 -22
  156. package/lib/utils/orgUtils/index.js.map +1 -1
  157. package/lib/utils/projectPathUtil.d.ts +1 -1
  158. package/lib/utils/projectPathUtil.js +27 -10
  159. package/lib/utils/projectPathUtil.js.map +1 -1
  160. package/lib/utils/promptUtil.d.ts +11 -1
  161. package/lib/utils/promptUtil.js +92 -0
  162. package/lib/utils/promptUtil.js.map +1 -1
  163. package/lib/utils/query/index.d.ts +1 -0
  164. package/lib/utils/query/index.js +18 -1
  165. package/lib/utils/query/index.js.map +1 -1
  166. package/lib/utils/recordPrioritization.d.ts +44 -0
  167. package/lib/utils/recordPrioritization.js +69 -0
  168. package/lib/utils/recordPrioritization.js.map +1 -0
  169. package/lib/utils/reportGenerator/reportInterfaces.d.ts +12 -0
  170. package/lib/utils/reportGenerator/reportUtil.d.ts +6 -1
  171. package/lib/utils/reportGenerator/reportUtil.js +22 -7
  172. package/lib/utils/reportGenerator/reportUtil.js.map +1 -1
  173. package/lib/utils/resultsbuilder/ApexAssessmentReporter.d.ts +1 -0
  174. package/lib/utils/resultsbuilder/ApexAssessmentReporter.js +40 -17
  175. package/lib/utils/resultsbuilder/ApexAssessmentReporter.js.map +1 -1
  176. package/lib/utils/resultsbuilder/CustomLabelAssessmentReporter.d.ts +13 -0
  177. package/lib/utils/resultsbuilder/CustomLabelAssessmentReporter.js +179 -0
  178. package/lib/utils/resultsbuilder/CustomLabelAssessmentReporter.js.map +1 -0
  179. package/lib/utils/resultsbuilder/CustomLabelMigrationReporter.d.ts +27 -0
  180. package/lib/utils/resultsbuilder/CustomLabelMigrationReporter.js +262 -0
  181. package/lib/utils/resultsbuilder/CustomLabelMigrationReporter.js.map +1 -0
  182. package/lib/utils/resultsbuilder/DRAssessmentReporter.js +38 -70
  183. package/lib/utils/resultsbuilder/DRAssessmentReporter.js.map +1 -1
  184. package/lib/utils/resultsbuilder/ExperienceSiteAssessmentReporter.d.ts +14 -0
  185. package/lib/utils/resultsbuilder/ExperienceSiteAssessmentReporter.js +143 -0
  186. package/lib/utils/resultsbuilder/ExperienceSiteAssessmentReporter.js.map +1 -0
  187. package/lib/utils/resultsbuilder/FlexcardAssessmentReporter.js +46 -85
  188. package/lib/utils/resultsbuilder/FlexcardAssessmentReporter.js.map +1 -1
  189. package/lib/utils/resultsbuilder/FlexipageAssessmentReporter.d.ts +1 -0
  190. package/lib/utils/resultsbuilder/FlexipageAssessmentReporter.js +37 -19
  191. package/lib/utils/resultsbuilder/FlexipageAssessmentReporter.js.map +1 -1
  192. package/lib/utils/resultsbuilder/GlobalAutoNumberAssessmentReporter.js +22 -14
  193. package/lib/utils/resultsbuilder/GlobalAutoNumberAssessmentReporter.js.map +1 -1
  194. package/lib/utils/resultsbuilder/IPAssessmentReporter.js +38 -71
  195. package/lib/utils/resultsbuilder/IPAssessmentReporter.js.map +1 -1
  196. package/lib/utils/resultsbuilder/LWCAssessmentReporter.d.ts +14 -0
  197. package/lib/utils/resultsbuilder/LWCAssessmentReporter.js +143 -139
  198. package/lib/utils/resultsbuilder/LWCAssessmentReporter.js.map +1 -1
  199. package/lib/utils/resultsbuilder/OSAssessmentReporter.js +41 -88
  200. package/lib/utils/resultsbuilder/OSAssessmentReporter.js.map +1 -1
  201. package/lib/utils/resultsbuilder/SaveForLaterAssessmentReporter.d.ts +12 -0
  202. package/lib/utils/resultsbuilder/SaveForLaterAssessmentReporter.js +109 -0
  203. package/lib/utils/resultsbuilder/SaveForLaterAssessmentReporter.js.map +1 -0
  204. package/lib/utils/resultsbuilder/assessmentReporter.d.ts +16 -6
  205. package/lib/utils/resultsbuilder/assessmentReporter.js +96 -152
  206. package/lib/utils/resultsbuilder/assessmentReporter.js.map +1 -1
  207. package/lib/utils/resultsbuilder/helpers/AssessmentReportHelper.d.ts +104 -0
  208. package/lib/utils/resultsbuilder/helpers/AssessmentReportHelper.js +380 -0
  209. package/lib/utils/resultsbuilder/helpers/AssessmentReportHelper.js.map +1 -0
  210. package/lib/utils/resultsbuilder/index.d.ts +37 -1
  211. package/lib/utils/resultsbuilder/index.js +582 -151
  212. package/lib/utils/resultsbuilder/index.js.map +1 -1
  213. package/lib/utils/resultsbuilder/reportingHelper.d.ts +2 -7
  214. package/lib/utils/resultsbuilder/reportingHelper.js +0 -43
  215. package/lib/utils/resultsbuilder/reportingHelper.js.map +1 -1
  216. package/lib/utils/sfcli/project/sfProject.d.ts +29 -0
  217. package/lib/utils/sfcli/project/sfProject.js +220 -2
  218. package/lib/utils/sfcli/project/sfProject.js.map +1 -1
  219. package/lib/utils/shell/cli.js +20 -14
  220. package/lib/utils/shell/cli.js.map +1 -1
  221. package/lib/utils/storageUtil.d.ts +14 -1
  222. package/lib/utils/storageUtil.js +31 -1
  223. package/lib/utils/storageUtil.js.map +1 -1
  224. package/lib/utils/stringUtils.d.ts +24 -0
  225. package/lib/utils/stringUtils.js +76 -9
  226. package/lib/utils/stringUtils.js.map +1 -1
  227. package/lib/utils/templateParser/__tests__/test.js +1 -2
  228. package/lib/utils/templateParser/__tests__/test.js.map +1 -1
  229. package/lib/utils/templateParser/generate.d.ts +1 -1
  230. package/lib/utils/templateParser/generate.js.map +1 -1
  231. package/lib/utils/templateParser/model/elementNode.d.ts +2 -2
  232. package/lib/utils/templateParser/model/elementNode.js +11 -2
  233. package/lib/utils/templateParser/model/elementNode.js.map +1 -1
  234. package/lib/utils/templateParser/model/nodeTypes.js +1 -1
  235. package/lib/utils/templateParser/model/nodeTypes.js.map +1 -1
  236. package/lib/utils/templateParser/util.d.ts +2 -2
  237. package/lib/utils/templateParser/util.js.map +1 -1
  238. package/lib/utils/validatorService.d.ts +14 -0
  239. package/lib/utils/validatorService.js +136 -0
  240. package/lib/utils/validatorService.js.map +1 -0
  241. package/messages/assess.json +220 -103
  242. package/messages/clean.json +40 -0
  243. package/messages/info.json +2 -1
  244. package/messages/migrate.json +314 -102
  245. package/oclif.manifest.json +1 -1
  246. package/package.json +49 -13
  247. package/lib/commands/basecommand.d.ts +0 -8
  248. package/lib/commands/basecommand.js +0 -13
  249. package/lib/commands/basecommand.js.map +0 -1
  250. package/lib/utils/OmniGlobalAutoNumberPrefManager.d.ts +0 -40
  251. package/lib/utils/OmniGlobalAutoNumberPrefManager.js +0 -65
  252. package/lib/utils/OmniGlobalAutoNumberPrefManager.js.map +0 -1
@@ -4,6 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ResultsBuilder = void 0;
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
9
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
10
+ /* eslint-disable @typescript-eslint/no-unused-vars */
7
11
  const fs_1 = __importDefault(require("fs"));
8
12
  const path_1 = __importDefault(require("path"));
9
13
  const open_1 = __importDefault(require("open"));
@@ -14,9 +18,9 @@ const FileDiffUtil_1 = require("../lwcparser/fileutils/FileDiffUtil");
14
18
  const logger_1 = require("../logger");
15
19
  const stringUtils_1 = require("../stringUtils");
16
20
  const stringContants_1 = require("../constants/stringContants");
17
- const reportingHelper_1 = require("./reportingHelper");
18
- const resultsDir = path_1.default.join(process.cwd(), 'migration_report');
19
- // const lwcConstants = { componentName: 'lwc', title: 'LWC Components Migration Result' };
21
+ const dataModelService_1 = require("../dataModelService");
22
+ const CustomLabelMigrationReporter_1 = require("./CustomLabelMigrationReporter");
23
+ const resultsDir = path_1.default.join(process.cwd(), stringContants_1.Constants.MigrationReportsFolderName);
20
24
  const migrationReportHTMLfileName = 'dashboard.html';
21
25
  const flexipageFileName = 'flexipage.html';
22
26
  const templateDir = 'templates';
@@ -26,8 +30,10 @@ const reportTemplateFilePath = path_1.default.join(__dirname, '..', '..', templa
26
30
  const dashboardTemplateFilePath = path_1.default.join(__dirname, '..', '..', templateDir, dashboardTemplateName);
27
31
  const apexFileName = 'apex.html';
28
32
  const experienceSiteFileName = 'experienceSite.html';
33
+ const lwcFileName = 'lwc.html';
29
34
  class ResultsBuilder {
30
- static async generateReport(results, relatedObjectMigrationResult, instanceUrl, orgDetails, messages, actionItems, objectsToProcess) {
35
+ static async generateReport(results, relatedObjectMigrationResult, instanceUrl, orgDetails, messages, actionItems, objectsToProcess, migrateOnly, deploymentFailed = false) {
36
+ ResultsBuilder.deploymentFailed = deploymentFailed;
31
37
  fs_1.default.mkdirSync(resultsDir, { recursive: true });
32
38
  logger_1.Logger.info(messages.getMessage('generatingComponentReports'));
33
39
  for (const result of results) {
@@ -36,29 +42,36 @@ class ResultsBuilder {
36
42
  logger_1.Logger.info(messages.getMessage('generatingRelatedObjectReports'));
37
43
  this.generateReportForRelatedObject(relatedObjectMigrationResult, instanceUrl, orgDetails, messages, objectsToProcess);
38
44
  logger_1.Logger.info(messages.getMessage('generatingMigrationReportDashboard'));
39
- this.generateMigrationReportDashboard(orgDetails, results, relatedObjectMigrationResult, messages, actionItems, objectsToProcess);
45
+ this.generateMigrationReportDashboard(orgDetails, results, relatedObjectMigrationResult, messages, actionItems, objectsToProcess, migrateOnly);
40
46
  (0, fileUtil_1.pushAssestUtilites)('javascripts', resultsDir);
41
47
  (0, fileUtil_1.pushAssestUtilites)('styles', resultsDir);
42
48
  await (0, open_1.default)(path_1.default.join(resultsDir, migrationReportHTMLfileName));
43
49
  }
44
50
  static generateReportForResult(result, instanceUrl, orgDetails, messages) {
45
- var _a;
51
+ var _a, _b;
46
52
  logger_1.Logger.captureVerboseData(`${result.name} data`, result);
53
+ // Handle Custom Labels migration specifically
54
+ if (result.name.toLowerCase().includes('custom labels')) {
55
+ this.generateCustomLabelsMigrationReport(result, instanceUrl, orgDetails, messages);
56
+ return;
57
+ }
47
58
  // Determine which rollback flag to use based on component type
48
59
  let rollbackFlagNames = [];
49
60
  const componentName = result.name.toLowerCase();
61
+ const isGlobalAutoNumber = componentName.includes('global auto number') || componentName.includes('globalautonumber');
50
62
  if (componentName.includes('datamapper') || componentName.includes('data mapper')) {
51
63
  rollbackFlagNames = ['RollbackDRChanges'];
52
64
  }
53
65
  else if (componentName.includes('omniscript') || componentName.includes('integration procedure')) {
54
66
  rollbackFlagNames = ['RollbackOSChanges', 'RollbackIPChanges'];
55
67
  }
56
- else if (componentName.includes('global auto number') || componentName.includes('globalautonumber')) {
68
+ else if (isGlobalAutoNumber) {
57
69
  rollbackFlagNames = ['RollbackDRChanges', 'RollbackIPChanges'];
58
70
  }
59
71
  const rollbackFlags = orgDetails.rollbackFlags || [];
60
72
  const flags = rollbackFlagNames.filter((flag) => rollbackFlags.includes(flag));
61
- const data = {
73
+ // Common report fields
74
+ const baseData = {
62
75
  title: `${(0, stringUtils_1.getMigrationHeading)(result.name)} Migration Report`,
63
76
  heading: `${(0, stringUtils_1.getMigrationHeading)(result.name)} Migration Report`,
64
77
  org: {
@@ -68,76 +81,36 @@ class ResultsBuilder {
68
81
  dataModel: orgDetails.dataModel,
69
82
  },
70
83
  assessmentDate: new Date().toLocaleString(),
84
+ total: 0,
85
+ filterGroups: [],
86
+ headerGroups: [],
87
+ rows: [],
88
+ };
89
+ // If Global Auto Number and foundation package, skip document creation as feature is not supported
90
+ if (isGlobalAutoNumber && orgDetails.isFoundationPackage) {
91
+ return;
92
+ }
93
+ const data = {
94
+ ...baseData,
71
95
  total: ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0,
72
- filterGroups: [
73
- (0, reportUtil_1.createFilterGroupParam)('Filter By Status', 'status', ['Successfully Completed', 'Failed', 'Skipped']),
74
- ],
75
- headerGroups: [
76
- {
77
- header: [
78
- {
79
- name: 'Managed Package',
80
- colspan: 2,
81
- rowspan: 1,
82
- },
83
- {
84
- name: 'Standard',
85
- colspan: 2,
86
- rowspan: 1,
87
- },
88
- {
89
- name: 'Status',
90
- colspan: 1,
91
- rowspan: 2,
92
- },
93
- {
94
- name: 'Errors',
95
- colspan: 1,
96
- rowspan: 2,
97
- },
98
- {
99
- name: 'Summary',
100
- colspan: 1,
101
- rowspan: 2,
102
- },
103
- ],
104
- },
105
- {
106
- header: [
107
- {
108
- name: 'ID',
109
- colspan: 1,
110
- rowspan: 1,
111
- },
112
- {
113
- name: 'Name',
114
- colspan: 1,
115
- rowspan: 1,
116
- },
117
- {
118
- name: 'ID',
119
- colspan: 1,
120
- rowspan: 1,
121
- },
122
- {
123
- name: 'Name',
124
- colspan: 1,
125
- rowspan: 1,
126
- },
127
- ],
128
- },
129
- ],
96
+ filterGroups: [...this.getStatusFilterGroup(((_b = result.data) === null || _b === void 0 ? void 0 : _b.map((item) => item.status)) || [])],
97
+ headerGroups: [...this.getHeaderGroupsForReport(componentName, isGlobalAutoNumber)],
130
98
  rows: [
131
99
  ...(result.data || []).map((item) => ({
132
100
  rowId: `${this.rowClass}${this.rowId++}`,
133
101
  data: [
134
102
  (0, reportUtil_1.createRowDataParam)('id', item.id, false, 1, 1, true, `${instanceUrl}/${item.id}`),
135
103
  (0, reportUtil_1.createRowDataParam)('name', item.name, true, 1, 1, false),
136
- (0, reportUtil_1.createRowDataParam)('migratedId', item.migratedId, false, 1, 1, true, `${instanceUrl}/${item.migratedId}`),
104
+ // Include migratedId for custom data model OR Global Auto Number
105
+ ...((0, dataModelService_1.isStandardDataModel)() && !isGlobalAutoNumber
106
+ ? []
107
+ : [
108
+ (0, reportUtil_1.createRowDataParam)('migratedId', item.migratedId, false, 1, 1, true, `${instanceUrl}/${item.migratedId}`),
109
+ ]),
137
110
  (0, reportUtil_1.createRowDataParam)('migratedName', item.migratedName, false, 1, 1, false),
138
- (0, reportUtil_1.createRowDataParam)('status', item.status === 'Complete' ? 'Successfully Completed' : item.status, false, 1, 1, false, undefined, reportingHelper_1.reportingHelper.decorateStatus(item.status)),
139
- (0, reportUtil_1.createRowDataParam)('errors', item.errors ? 'Has Errors' : 'Has No Errors', false, 1, 1, false, undefined, item.errors ? reportingHelper_1.reportingHelper.decorateErrors(item.errors) : []),
140
- (0, reportUtil_1.createRowDataParam)('summary', item.warnings ? 'Has Warnings' : 'Has No Warnings', false, 1, 1, false, undefined, item.warnings ? reportingHelper_1.reportingHelper.decorateErrors(item.warnings) : []),
111
+ (0, reportUtil_1.createRowDataParam)('status', item.status, false, 1, 1, false, undefined, undefined, item.status === stringContants_1.Status.SuccessfullyMigrated ? 'text-success' : 'text-error'),
112
+ (0, reportUtil_1.createRowDataParam)('errors', item.errors ? stringContants_1.Status.Failed : 'Has No Errors', false, 1, 1, false, undefined, item.errors || []),
113
+ (0, reportUtil_1.createRowDataParam)('summary', item.warnings ? 'Warnings' : 'Has No Warnings', false, 1, 1, false, undefined, item.warnings || []),
141
114
  ],
142
115
  })),
143
116
  ],
@@ -147,6 +120,153 @@ class ResultsBuilder {
147
120
  const html = generate_1.TemplateParser.generate(reportTemplate, data, messages);
148
121
  fs_1.default.writeFileSync(path_1.default.join(resultsDir, result.name.replace(/ /g, '_').replace(/\//g, '_') + '.html'), html);
149
122
  }
123
+ static getHeaderGroupsForReport(componentName, isGlobalAutoNumber) {
124
+ const firstRowHeaders = [
125
+ ...this.getNameHeaders(componentName, isGlobalAutoNumber),
126
+ { name: 'Status', colspan: 1, rowspan: 2 },
127
+ { name: 'Errors', colspan: 1, rowspan: 2 },
128
+ { name: 'Summary', colspan: 1, rowspan: 2 },
129
+ ];
130
+ const nameLabel = (0, dataModelService_1.isStandardDataModel)() ? 'Updated Name' : 'Name';
131
+ const secondRowHeadersForCustom = [
132
+ { name: 'ID', colspan: 1, rowspan: 1 },
133
+ { name: 'Name', colspan: 1, rowspan: 1 },
134
+ { name: 'ID', colspan: 1, rowspan: 1 },
135
+ { name: nameLabel, colspan: 1, rowspan: 1 },
136
+ ];
137
+ const secondRowHeadersForStandard = [
138
+ { name: 'ID', colspan: 1, rowspan: 1 },
139
+ { name: 'Name', colspan: 1, rowspan: 1 },
140
+ { name: nameLabel, colspan: 1, rowspan: 1 },
141
+ ];
142
+ // Global Auto Number always needs 4 columns (Managed Package + Standard), even in standard data model
143
+ if ((0, dataModelService_1.isStandardDataModel)() && !isGlobalAutoNumber) {
144
+ return [{ header: firstRowHeaders }, { header: secondRowHeadersForStandard }];
145
+ }
146
+ else {
147
+ return [{ header: firstRowHeaders }, { header: secondRowHeadersForCustom }];
148
+ }
149
+ }
150
+ static getNameHeaders(componentName, isGlobalAutoNumber) {
151
+ if ((0, dataModelService_1.isStandardDataModel)() && !isGlobalAutoNumber) {
152
+ return [{ name: 'Standard', colspan: 3, rowspan: 1 }];
153
+ }
154
+ else {
155
+ return [
156
+ { name: 'Managed Package', colspan: 2, rowspan: 1 },
157
+ { name: 'Standard', colspan: 2, rowspan: 1 },
158
+ ];
159
+ }
160
+ }
161
+ static generateCustomLabelsMigrationReport(result, instanceUrl, orgDetails, messages) {
162
+ logger_1.Logger.captureVerboseData(`${result.name} data`, result);
163
+ // Convert migration results to CustomLabelMigrationInfo format
164
+ const customLabelMigrationInfos = [];
165
+ if (result.data) {
166
+ result.data.forEach((record) => {
167
+ // Handle both old and new data formats
168
+ const labelName = record.name || record.labelName;
169
+ const cloneStatus = record.status === stringContants_1.Status.Complete
170
+ ? 'created'
171
+ : record.status === 'Error'
172
+ ? 'error'
173
+ : record.status === stringContants_1.Status.Skipped
174
+ ? 'duplicate'
175
+ : record.status || 'duplicate';
176
+ const message = record.message || '';
177
+ const coreInfo = record.coreInfo || { id: '', value: '' };
178
+ const packageInfo = record.packageInfo || { id: '', value: '' };
179
+ const errors = record.errors || [];
180
+ const warnings = record.warnings || [];
181
+ customLabelMigrationInfos.push({
182
+ labelName,
183
+ cloneStatus,
184
+ message,
185
+ coreInfo,
186
+ packageInfo,
187
+ errors,
188
+ warnings,
189
+ });
190
+ });
191
+ }
192
+ const pageSize = 1000; // Smaller page size for better performance
193
+ const totalLabels = customLabelMigrationInfos.length;
194
+ const totalPages = Math.max(1, Math.ceil(totalLabels / pageSize));
195
+ logger_1.Logger.logVerbose(messages.getMessage('generatingCustomLabelsReport', [totalLabels, totalPages, pageSize]));
196
+ // Generate CSV file with all labels for export
197
+ this.generateCustomLabelMigrationCsvFile(stringContants_1.Constants.CustomLabelMigrationCsvFileName, result);
198
+ // Generate paginated reports
199
+ for (let page = 1; page <= totalPages; page++) {
200
+ const data = CustomLabelMigrationReporter_1.CustomLabelMigrationReporter.getCustomLabelMigrationData(customLabelMigrationInfos, instanceUrl, orgDetails, page, pageSize);
201
+ // Pass CSV filename in props so the export button can download it
202
+ data.props = JSON.stringify({ csvFile: stringContants_1.Constants.CustomLabelMigrationCsvFileName });
203
+ const reportTemplate = fs_1.default.readFileSync(reportTemplateFilePath, 'utf8');
204
+ // Replace the pagination section with custom generated HTML
205
+ const customPaginationHtml = CustomLabelMigrationReporter_1.CustomLabelMigrationReporter.generateCustomTemplateForPage(page, totalPages);
206
+ const modifiedTemplate = reportTemplate.replace(/<!-- Pagination Navigation -->[\s\S]*?<\/div>\s*<\/div>\s*<\/c:if>/, customPaginationHtml);
207
+ const html = generate_1.TemplateParser.generate(modifiedTemplate, data, messages);
208
+ const fileName = totalPages > 1 ? `Custom_Labels_Page_${page}_of_${totalPages}.html` : 'Custom_Labels.html';
209
+ fs_1.default.writeFileSync(path_1.default.join(resultsDir, fileName), html);
210
+ logger_1.Logger.logVerbose(messages.getMessage('generatedCustomLabelsReportPage', [page, totalPages, data.rows.length]));
211
+ }
212
+ }
213
+ /**
214
+ * Generates a CSV file containing all custom label migration data for export
215
+ */
216
+ // eslint-disable-next-line complexity
217
+ static generateCustomLabelMigrationCsvFile(fileName, result) {
218
+ var _a, _b, _c, _d, _e, _f, _g, _h;
219
+ const headers = [
220
+ 'Name',
221
+ 'Package - Id',
222
+ 'Package - Value',
223
+ 'Core - Id',
224
+ 'Core - Value',
225
+ 'Migration Status',
226
+ 'Summary',
227
+ ];
228
+ const csvRows = [];
229
+ csvRows.push(headers.map((h) => (0, stringUtils_1.escapeCSVValue)(h)).join(','));
230
+ // Use allRecords if available (contains all labels including success), otherwise use data (errors only)
231
+ if (result.allRecords && result.allRecords.size > 0) {
232
+ const sortedEntries = [...result.allRecords.entries()].sort((a, b) => a[0].localeCompare(b[0]));
233
+ for (const [, record] of sortedEntries) {
234
+ const status = record.cloneStatus === 'created'
235
+ ? 'Successfully migrated'
236
+ : record.cloneStatus === 'error'
237
+ ? 'Failed'
238
+ : 'Skipped';
239
+ const row = [
240
+ record.labelName || '',
241
+ ((_a = record.packageInfo) === null || _a === void 0 ? void 0 : _a.id) || '',
242
+ (0, stringUtils_1.stripHtml)(((_b = record.packageInfo) === null || _b === void 0 ? void 0 : _b.value) || ''),
243
+ ((_c = record.coreInfo) === null || _c === void 0 ? void 0 : _c.id) || '',
244
+ (0, stringUtils_1.stripHtml)(((_d = record.coreInfo) === null || _d === void 0 ? void 0 : _d.value) || ''),
245
+ status,
246
+ record.message || '',
247
+ ];
248
+ csvRows.push(row.map((v) => (0, stringUtils_1.escapeCSVValue)(v)).join(','));
249
+ }
250
+ }
251
+ else if (result.data) {
252
+ const sortedData = [...result.data].sort((a, b) => a.name.localeCompare(b.name));
253
+ for (const record of sortedData) {
254
+ const row = [
255
+ record.name || '',
256
+ ((_e = record.packageInfo) === null || _e === void 0 ? void 0 : _e.id) || '',
257
+ (0, stringUtils_1.stripHtml)(((_f = record.packageInfo) === null || _f === void 0 ? void 0 : _f.value) || ''),
258
+ ((_g = record.coreInfo) === null || _g === void 0 ? void 0 : _g.id) || '',
259
+ (0, stringUtils_1.stripHtml)(((_h = record.coreInfo) === null || _h === void 0 ? void 0 : _h.value) || ''),
260
+ record.status || '',
261
+ record.message || '',
262
+ ];
263
+ csvRows.push(row.map((v) => (0, stringUtils_1.escapeCSVValue)(v)).join(','));
264
+ }
265
+ }
266
+ const csvContent = '' + csvRows.join('\n');
267
+ fs_1.default.writeFileSync(path_1.default.join(resultsDir, fileName), csvContent, 'utf8');
268
+ logger_1.Logger.logVerbose(`Generated custom label migration CSV export: ${fileName}`);
269
+ }
150
270
  static generateReportForRelatedObject(result, instanceUrl, orgDetails, messages, objectsToProcess) {
151
271
  if (objectsToProcess.includes(stringContants_1.Constants.Apex)) {
152
272
  this.generateReportForApex(result.apexAssessmentInfos, instanceUrl, orgDetails, messages);
@@ -157,26 +277,36 @@ class ResultsBuilder {
157
277
  if (objectsToProcess.includes(stringContants_1.Constants.FlexiPage)) {
158
278
  this.generateReportForFlexipage(result.flexipageAssessmentInfos, instanceUrl, orgDetails, messages);
159
279
  }
280
+ if (objectsToProcess.includes(stringContants_1.Constants.LWC)) {
281
+ this.generateReportForLwc(result.lwcAssessmentInfos, instanceUrl, orgDetails, messages);
282
+ }
160
283
  }
161
284
  static generateReportForExperienceSites(result, instanceUrl, orgDetails, messages) {
162
285
  logger_1.Logger.logVerbose('Generating experience site report');
163
286
  const data = {
164
- title: 'Experience Site',
165
- heading: 'Experience Site',
287
+ title: 'Experience Cloud Site Pages Migration Report',
288
+ heading: 'Experience Cloud Site Pages Migration Report',
166
289
  org: {
167
290
  name: orgDetails.orgDetails.Name,
168
291
  id: orgDetails.orgDetails.Id,
169
292
  namespace: orgDetails.packageDetails.namespace,
170
293
  dataModel: orgDetails.dataModel,
171
294
  },
172
- assessmentDate: new Date().toString(),
295
+ assessmentDate: new Date().toLocaleString(),
173
296
  total: result.length,
174
- filterGroups: [(0, reportUtil_1.createFilterGroupParam)('Filter by Errors', 'warnings', ['Has Errors', 'Has No Errors'])],
297
+ filterGroups: [
298
+ ...this.getStatusFilterGroup(result.flatMap((item) => item.experienceSiteAssessmentPageInfos.map((page) => this.resolveDisplayStatus(page.status, messages)))),
299
+ ],
175
300
  headerGroups: [
176
301
  {
177
302
  header: [
178
303
  {
179
- name: 'Component Name',
304
+ name: 'Experience Cloud Site Name',
305
+ colspan: 1,
306
+ rowspan: 1,
307
+ },
308
+ {
309
+ name: 'Page Name',
180
310
  colspan: 1,
181
311
  rowspan: 1,
182
312
  },
@@ -186,12 +316,12 @@ class ResultsBuilder {
186
316
  rowspan: 1,
187
317
  },
188
318
  {
189
- name: 'Code Difference',
319
+ name: 'Status',
190
320
  colspan: 1,
191
321
  rowspan: 1,
192
322
  },
193
323
  {
194
- name: 'Summary',
324
+ name: 'Differences',
195
325
  colspan: 1,
196
326
  rowspan: 1,
197
327
  },
@@ -203,16 +333,12 @@ class ResultsBuilder {
203
333
  ],
204
334
  },
205
335
  ],
206
- rows: result.map((item) => ({
207
- rowId: `${this.rowClass}${this.rowId++}`,
208
- data: [
209
- (0, reportUtil_1.createRowDataParam)('name', item.name, true, 1, 1, false),
210
- (0, reportUtil_1.createRowDataParam)('path', item.path, false, 1, 1, false),
211
- (0, reportUtil_1.createRowDataParam)('diff', item.name + 'diff', false, 1, 1, false, undefined, FileDiffUtil_1.FileDiffUtil.getDiffHTML(item.diff, item.name)),
212
- (0, reportUtil_1.createRowDataParam)('infos', item.infos ? item.infos.join(', ') : '', false, 1, 1, false, undefined, item.infos),
213
- (0, reportUtil_1.createRowDataParam)('warnings', item.warnings ? 'Has Errors' : 'Has No Errors', false, 1, 1, false, undefined, item.warnings),
214
- ],
215
- })),
336
+ rows: this.getRowsForExperienceSites(result, messages),
337
+ props: JSON.stringify({
338
+ recordName: 'Pages',
339
+ rowBased: true,
340
+ rowCount: true,
341
+ }),
216
342
  };
217
343
  const reportTemplate = fs_1.default.readFileSync(reportTemplateFilePath, 'utf8');
218
344
  const html = generate_1.TemplateParser.generate(reportTemplate, data, messages);
@@ -222,22 +348,24 @@ class ResultsBuilder {
222
348
  static generateReportForFlexipage(result, instanceUrl, orgDetails, messages) {
223
349
  logger_1.Logger.captureVerboseData('flexipage data', result);
224
350
  const data = {
225
- title: 'Flexipages',
226
- heading: 'Flexipages',
351
+ title: 'FlexiPages Migration Report',
352
+ heading: 'FlexiPages Migration Report',
227
353
  org: {
228
354
  name: orgDetails.orgDetails.Name,
229
355
  id: orgDetails.orgDetails.Id,
230
356
  namespace: orgDetails.packageDetails.namespace,
231
357
  dataModel: orgDetails.dataModel,
232
358
  },
233
- assessmentDate: new Date().toString(),
359
+ assessmentDate: new Date().toLocaleString(),
234
360
  total: result.length,
235
- filterGroups: [(0, reportUtil_1.createFilterGroupParam)('Filter by Status', 'status', ['Complete', 'Failed'])],
361
+ filterGroups: [
362
+ ...this.getStatusFilterGroup(result.map((item) => this.resolveDisplayStatus(item.status, messages))),
363
+ ],
236
364
  headerGroups: [
237
365
  {
238
366
  header: [
239
367
  {
240
- name: 'Flexipage Name',
368
+ name: 'FlexiPage Name',
241
369
  colspan: 1,
242
370
  rowspan: 1,
243
371
  },
@@ -267,11 +395,11 @@ class ResultsBuilder {
267
395
  rows: result.map((item) => ({
268
396
  rowId: `${this.rowClass}${this.rowId++}`,
269
397
  data: [
270
- (0, reportUtil_1.createRowDataParam)('name', item.name, true, 1, 1, false),
271
- (0, reportUtil_1.createRowDataParam)('path', item.path, false, 1, 1, false),
272
- (0, reportUtil_1.createRowDataParam)('status', item.status, false, 1, 1, false, undefined, undefined, item.status === 'Failed' ? 'text-error' : 'text-success'),
273
- (0, reportUtil_1.createRowDataParam)('diff', '', false, 1, 1, false, undefined, FileDiffUtil_1.FileDiffUtil.getDiffHTML(item.diff, item.name)),
274
- (0, reportUtil_1.createRowDataParam)('error', 'error', false, 1, 1, false, undefined, item.errors, 'text-error'),
398
+ (0, reportUtil_1.createRowDataParam)('name', item.name.substring(0, item.name.length - this.flexiPageFileSuffix.length), true, 1, 1, false),
399
+ (0, reportUtil_1.createRowDataParam)('path', item.name, false, 1, 1, true, item.path),
400
+ (0, reportUtil_1.createRowDataParam)('status', this.resolveDisplayStatus(item.status, messages), false, 1, 1, false, undefined, undefined, this.resolveStatusClass(item.status)),
401
+ (0, reportUtil_1.createRowDataParam)('diff', '', false, 1, 1, false, undefined, FileDiffUtil_1.FileDiffUtil.getDiffHTML(item.diff, item.name), 'diff-cell'),
402
+ (0, reportUtil_1.createRowDataParam)('error', 'error', false, 1, 1, false, undefined, item.errors),
275
403
  ],
276
404
  })),
277
405
  };
@@ -282,8 +410,8 @@ class ResultsBuilder {
282
410
  static generateReportForApex(result, instanceUrl, orgDetails, messages) {
283
411
  logger_1.Logger.captureVerboseData('apex data', result);
284
412
  const data = {
285
- title: 'Apex File Migration Report',
286
- heading: 'Apex File Migration Report',
413
+ title: 'Apex Classes Migration Report',
414
+ heading: 'Apex Classes Migration Report',
287
415
  org: {
288
416
  name: orgDetails.orgDetails.Name,
289
417
  id: orgDetails.orgDetails.Id,
@@ -292,7 +420,9 @@ class ResultsBuilder {
292
420
  },
293
421
  assessmentDate: new Date().toLocaleString(),
294
422
  total: result.length,
295
- filterGroups: [(0, reportUtil_1.createFilterGroupParam)('Filter by Errors', 'warnings', ['Has Errors', 'Has No Errors'])],
423
+ filterGroups: [
424
+ (0, reportUtil_1.createFilterGroupParam)('Filter by Errors', 'warnings', [stringContants_1.Status.Failed, stringContants_1.Status.SuccessfullyCompleted]),
425
+ ],
296
426
  headerGroups: [
297
427
  {
298
428
  header: [
@@ -306,6 +436,11 @@ class ResultsBuilder {
306
436
  colspan: 1,
307
437
  rowspan: 1,
308
438
  },
439
+ {
440
+ name: 'Status',
441
+ colspan: 1,
442
+ rowspan: 1,
443
+ },
309
444
  {
310
445
  name: 'Code Difference',
311
446
  colspan: 1,
@@ -329,50 +464,173 @@ class ResultsBuilder {
329
464
  data: [
330
465
  (0, reportUtil_1.createRowDataParam)('name', item.name, true, 1, 1, false),
331
466
  (0, reportUtil_1.createRowDataParam)('path', item.name, false, 1, 1, true, item.path, item.name + '.cls'),
332
- (0, reportUtil_1.createRowDataParam)('diff', item.name + 'diff', false, 1, 1, false, undefined, FileDiffUtil_1.FileDiffUtil.getDiffHTML(item.diff, item.name)),
333
- (0, reportUtil_1.createRowDataParam)('infos', item.infos ? item.infos.join(', ') : '', false, 1, 1, false, undefined, item.infos),
334
- (0, reportUtil_1.createRowDataParam)('warnings', item.warnings ? 'Has Errors' : 'Has No Errors', false, 1, 1, false, undefined, item.warnings ? reportingHelper_1.reportingHelper.decorateErrors(item.warnings) : []),
467
+ (0, reportUtil_1.createRowDataParam)('status', item.status, false, 1, 1, false, undefined, undefined, this.successStatus.includes(item.status)
468
+ ? 'text-success'
469
+ : this.errorStatus.includes(item.status)
470
+ ? 'text-error'
471
+ : 'text-warning'),
472
+ (0, reportUtil_1.createRowDataParam)('diff', item.name + 'diff', false, 1, 1, false, undefined, FileDiffUtil_1.FileDiffUtil.getDiffHTML(item.diff, item.name), 'diff-cell'),
473
+ (0, reportUtil_1.createRowDataParam)('infos', item.infos ? item.infos.join(', ') : '', false, 1, 1, false, undefined, [
474
+ ...item.infos,
475
+ ...item.warnings,
476
+ ]),
477
+ (0, reportUtil_1.createRowDataParam)('warnings', item.errors.length > 0 ? stringContants_1.Status.Failed : stringContants_1.Status.SuccessfullyCompleted, false, 1, 1, false, undefined, item.errors),
335
478
  ],
336
479
  })),
337
- rollbackFlags: (orgDetails.rollbackFlags || []).includes('RollbackApexChanges')
338
- ? ['RollbackApexChanges']
339
- : undefined,
340
480
  };
341
481
  const reportTemplate = fs_1.default.readFileSync(reportTemplateFilePath, 'utf8');
342
482
  const html = generate_1.TemplateParser.generate(reportTemplate, data, messages);
343
483
  fs_1.default.writeFileSync(path_1.default.join(resultsDir, apexFileName), html);
344
484
  // call generate html from template
345
485
  }
346
- static generateMigrationReportDashboard(orgDetails, results, relatedObjectMigrationResult, messages, actionItems, objectsToProcess) {
347
- var _a, _b, _c;
486
+ static generateReportForLwc(result, instanceUrl, orgDetails, messages) {
487
+ logger_1.Logger.captureVerboseData('lwc data', result);
488
+ const data = {
489
+ title: 'Lightning Web Components Migration Report',
490
+ heading: 'Lightning Web Components Migration Report',
491
+ org: {
492
+ name: orgDetails.orgDetails.Name,
493
+ id: orgDetails.orgDetails.Id,
494
+ namespace: orgDetails.packageDetails.namespace,
495
+ dataModel: orgDetails.dataModel,
496
+ },
497
+ assessmentDate: new Date().toLocaleString(),
498
+ total: result.length,
499
+ filterGroups: [
500
+ ...this.getStatusFilterGroup(result.flatMap((item) => this.resolveDisplayStatus(this.getStatusFromErrors(item.errors), messages))),
501
+ ],
502
+ headerGroups: [
503
+ {
504
+ header: [
505
+ {
506
+ name: 'Name',
507
+ colspan: 1,
508
+ rowspan: 1,
509
+ },
510
+ {
511
+ name: 'Status',
512
+ colspan: 1,
513
+ rowspan: 1,
514
+ },
515
+ {
516
+ name: 'File Reference',
517
+ colspan: 1,
518
+ rowspan: 1,
519
+ },
520
+ {
521
+ name: 'File Diff',
522
+ colspan: 1,
523
+ rowspan: 1,
524
+ },
525
+ {
526
+ name: 'Migration Status',
527
+ colspan: 1,
528
+ rowspan: 1,
529
+ },
530
+ {
531
+ name: 'Errors',
532
+ colspan: 1,
533
+ rowspan: 1,
534
+ },
535
+ ],
536
+ },
537
+ ],
538
+ rows: this.getLwcRowsForReport(result, messages),
539
+ };
540
+ const reportTemplate = fs_1.default.readFileSync(reportTemplateFilePath, 'utf8');
541
+ const html = generate_1.TemplateParser.generate(reportTemplate, data, messages);
542
+ fs_1.default.writeFileSync(path_1.default.join(resultsDir, lwcFileName), html);
543
+ }
544
+ static getLwcRowsForReport(lwcAssessmentInfos, messages) {
545
+ const rows = [];
546
+ for (const lwcAssessmentInfo of lwcAssessmentInfos) {
547
+ let showCommon = true;
548
+ const rid = `${this.rowClass}${this.rowId++}`;
549
+ const commonRowSpan = Math.max(1, lwcAssessmentInfo.changeInfos.length);
550
+ const actualStatus = this.getStatusFromErrors(lwcAssessmentInfo.errors);
551
+ const displayStatus = this.resolveDisplayStatus(actualStatus, messages);
552
+ const statusClass = this.resolveStatusClass(actualStatus);
553
+ for (const fileChangeInfo of lwcAssessmentInfo.changeInfos) {
554
+ rows.push({
555
+ rowId: rid,
556
+ data: [
557
+ ...(showCommon
558
+ ? [
559
+ (0, reportUtil_1.createRowDataParam)('name', lwcAssessmentInfo.name, true, commonRowSpan, 1, false),
560
+ (0, reportUtil_1.createRowDataParam)('status', displayStatus, false, commonRowSpan, 1, false, undefined, undefined, statusClass),
561
+ ]
562
+ : []),
563
+ (0, reportUtil_1.createRowDataParam)('fileReference', fileChangeInfo.name, false, 1, 1, true, fileChangeInfo.path, fileChangeInfo.name, 'normal-td-padding'),
564
+ (0, reportUtil_1.createRowDataParam)('diff', fileChangeInfo.name + 'diff', false, 1, 1, false, undefined, FileDiffUtil_1.FileDiffUtil.getDiffHTML(fileChangeInfo.diff, fileChangeInfo.name), 'diff-cell'),
565
+ ...(showCommon
566
+ ? [
567
+ (0, reportUtil_1.createRowDataParam)('comments', lwcAssessmentInfo.warnings && lwcAssessmentInfo.warnings.length > 0
568
+ ? stringContants_1.Status.Failed
569
+ : stringContants_1.Status.SuccessfullyCompleted, false, commonRowSpan, 1, false, undefined, lwcAssessmentInfo.warnings || []),
570
+ (0, reportUtil_1.createRowDataParam)('errors', lwcAssessmentInfo.errors ? lwcAssessmentInfo.errors.join(', ') : '', false, commonRowSpan, 1, false, undefined, lwcAssessmentInfo.errors || []),
571
+ ]
572
+ : []),
573
+ ],
574
+ });
575
+ showCommon = false;
576
+ }
577
+ }
578
+ return rows;
579
+ }
580
+ // Related object summary item creation helper methods
581
+ static createApexMigrationSummaryItem(relatedObjectMigrationResult) {
582
+ var _a;
583
+ return {
584
+ name: 'Apex Classes',
585
+ total: ((_a = relatedObjectMigrationResult.apexAssessmentInfos) === null || _a === void 0 ? void 0 : _a.length) || 0,
586
+ data: this.getDifferentStatusDataForApex(relatedObjectMigrationResult.apexAssessmentInfos),
587
+ file: apexFileName,
588
+ };
589
+ }
590
+ static createExperienceSiteMigrationSummaryItem(relatedObjectMigrationResult) {
591
+ var _a;
592
+ return {
593
+ name: 'Experience Cloud Sites',
594
+ total: ((_a = relatedObjectMigrationResult.experienceSiteAssessmentInfos) === null || _a === void 0 ? void 0 : _a.flatMap((item) => item.experienceSiteAssessmentPageInfos).length) || 0,
595
+ data: this.getDifferentStatusDataForExperienceSites(relatedObjectMigrationResult.experienceSiteAssessmentInfos),
596
+ file: experienceSiteFileName,
597
+ };
598
+ }
599
+ static createFlexipageMigrationSummaryItem(relatedObjectMigrationResult) {
600
+ var _a;
601
+ return {
602
+ name: 'FlexiPages',
603
+ total: ((_a = relatedObjectMigrationResult.flexipageAssessmentInfos) === null || _a === void 0 ? void 0 : _a.length) || 0,
604
+ data: this.getDifferentStatusDataForFlexipage(relatedObjectMigrationResult.flexipageAssessmentInfos),
605
+ file: flexipageFileName,
606
+ };
607
+ }
608
+ static createLWCMigrationSummaryItem(relatedObjectMigrationResult) {
609
+ var _a;
610
+ return {
611
+ name: 'Lightning Web Components',
612
+ total: ((_a = relatedObjectMigrationResult.lwcAssessmentInfos) === null || _a === void 0 ? void 0 : _a.length) || 0,
613
+ data: this.getDifferentStatusDataForLwc(relatedObjectMigrationResult.lwcAssessmentInfos),
614
+ file: lwcFileName,
615
+ };
616
+ }
617
+ static generateMigrationReportDashboard(orgDetails, results, relatedObjectMigrationResult, messages, actionItems, objectsToProcess, migrateOnly) {
348
618
  const relatedObjectSummaryItems = [];
349
619
  if (objectsToProcess.includes(stringContants_1.Constants.Apex)) {
350
- relatedObjectSummaryItems.push({
351
- name: 'Apex File Migration',
352
- total: ((_a = relatedObjectMigrationResult.apexAssessmentInfos) === null || _a === void 0 ? void 0 : _a.length) || 0,
353
- data: this.getDifferentStatusDataForApex(relatedObjectMigrationResult.apexAssessmentInfos),
354
- file: apexFileName,
355
- });
620
+ relatedObjectSummaryItems.push(this.createApexMigrationSummaryItem(relatedObjectMigrationResult));
356
621
  }
357
622
  if (objectsToProcess.includes(stringContants_1.Constants.ExpSites)) {
358
- relatedObjectSummaryItems.push({
359
- name: 'ExperienceSites',
360
- total: ((_b = relatedObjectMigrationResult.experienceSiteAssessmentInfos) === null || _b === void 0 ? void 0 : _b.length) || 0,
361
- data: this.getDifferentStatusDataForApex(relatedObjectMigrationResult.experienceSiteAssessmentInfos),
362
- file: experienceSiteFileName,
363
- });
623
+ relatedObjectSummaryItems.push(this.createExperienceSiteMigrationSummaryItem(relatedObjectMigrationResult));
364
624
  }
365
625
  if (objectsToProcess.includes(stringContants_1.Constants.FlexiPage)) {
366
- relatedObjectSummaryItems.push({
367
- name: 'Flexipage',
368
- total: ((_c = relatedObjectMigrationResult.flexipageAssessmentInfos) === null || _c === void 0 ? void 0 : _c.length) || 0,
369
- data: this.getDifferentStatusDataForFlexipage(relatedObjectMigrationResult.flexipageAssessmentInfos),
370
- file: flexipageFileName,
371
- });
626
+ relatedObjectSummaryItems.push(this.createFlexipageMigrationSummaryItem(relatedObjectMigrationResult));
627
+ }
628
+ if (objectsToProcess.includes(stringContants_1.Constants.LWC)) {
629
+ relatedObjectSummaryItems.push(this.createLWCMigrationSummaryItem(relatedObjectMigrationResult));
372
630
  }
373
631
  const data = {
374
- title: 'Migration Report Dashboard',
375
- heading: 'Migration Report Dashboard',
632
+ title: 'Omnistudio Migration Report Dashboard',
633
+ heading: 'Omnistudio Migration Report Dashboard',
376
634
  org: {
377
635
  name: orgDetails.orgDetails.Name,
378
636
  id: orgDetails.orgDetails.Id,
@@ -381,14 +639,52 @@ class ResultsBuilder {
381
639
  },
382
640
  assessmentDate: new Date().toLocaleString(),
383
641
  summaryItems: [
384
- ...results.map((result) => {
385
- var _a;
386
- return ({
387
- name: `${(0, stringUtils_1.getMigrationHeading)(result.name)} Migration`,
388
- total: ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0,
389
- data: this.getDifferentStatusDataForResult(result.data),
390
- file: result.name.replace(/ /g, '_').replace(/\//g, '_') + '.html',
391
- });
642
+ ...results
643
+ .filter((result) => {
644
+ // When metadata API is enabled and not migrateOnly, exclude OmniStudio components as we dont need to process them
645
+ if ((0, dataModelService_1.isStandardDataModelWithMetadataAPIEnabled)() && !migrateOnly) {
646
+ const componentName = result.name.toLowerCase();
647
+ // Only include Custom Labels and Global Auto Numbers
648
+ return (componentName.includes('custom labels') ||
649
+ componentName.includes('global auto number') ||
650
+ componentName.includes('globalautonumber'));
651
+ }
652
+ // Include all items in other cases
653
+ return true;
654
+ })
655
+ .map((result) => {
656
+ var _a, _b;
657
+ // Handle custom labels specially for pagination and status calculation
658
+ if (result.name.toLowerCase().includes('custom labels')) {
659
+ const totalLabels = result.totalCount || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0;
660
+ // Use actual processed records for file naming, not total count
661
+ const processedRecords = ((_b = result.data) === null || _b === void 0 ? void 0 : _b.length) || 0;
662
+ const totalPages = Math.max(1, Math.ceil(processedRecords / 1000));
663
+ const fileName = totalPages > 1 ? `Custom_Labels_Page_1_of_${totalPages}.html` : 'Custom_Labels.html';
664
+ return {
665
+ name: result.name,
666
+ total: totalLabels,
667
+ data: this.getCustomLabelStatusData(result.data, result.totalCount),
668
+ file: fileName,
669
+ };
670
+ }
671
+ // Handle Global Auto Numbers in foundation package (not supported)
672
+ const isGlobalAutoNumber = result.name.toLowerCase().includes('global auto number') ||
673
+ result.name.toLowerCase().includes('globalautonumber');
674
+ if (isGlobalAutoNumber) {
675
+ if (orgDetails.isFoundationPackage) {
676
+ return this.createSpecialCaseMigrationSummaryItem(result, messages.getMessage('globalAutoNumberUnSupportedInOmnistudioPackage')); // Foundation Package does not have the custom global auto number entity
677
+ }
678
+ else {
679
+ return this.createMigrationSummaryItem(result);
680
+ }
681
+ }
682
+ // Handle metadata API enabled with migrateOnly
683
+ if ((0, dataModelService_1.isStandardDataModelWithMetadataAPIEnabled)() && migrateOnly) {
684
+ return this.createSpecialCaseMigrationSummaryItem(result, messages.getMessage('processingNotRequired'));
685
+ }
686
+ // Default case
687
+ return this.createMigrationSummaryItem(result);
392
688
  }),
393
689
  ...relatedObjectSummaryItems,
394
690
  ],
@@ -399,54 +695,189 @@ class ResultsBuilder {
399
695
  const html = generate_1.TemplateParser.generate(dashboardTemplate, data, messages);
400
696
  fs_1.default.writeFileSync(path_1.default.join(resultsDir, 'dashboard.html'), html);
401
697
  }
698
+ static createSpecialCaseMigrationSummaryItem(result, customMessage) {
699
+ return {
700
+ name: `${(0, stringUtils_1.getMigrationHeading)(result.name)}`,
701
+ total: 0,
702
+ data: [{ name: customMessage, count: 0, cssClass: 'text-warning' }],
703
+ file: result.name.replace(/ /g, '_').replace(/\//g, '_') + '.html',
704
+ showDetails: false,
705
+ };
706
+ }
707
+ static createMigrationSummaryItem(result) {
708
+ var _a;
709
+ return {
710
+ name: `${(0, stringUtils_1.getMigrationHeading)(result.name)}`,
711
+ total: ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0,
712
+ data: this.getDifferentStatusDataForResult(result.data),
713
+ file: result.name.replace(/ /g, '_').replace(/\//g, '_') + '.html',
714
+ };
715
+ }
402
716
  static getDifferentStatusDataForResult(data) {
403
717
  let complete = 0;
404
718
  let error = 0;
405
719
  let skip = 0;
406
720
  data.forEach((item) => {
407
- if (item.status === 'Complete')
721
+ if (item.status === stringContants_1.Status.SuccessfullyMigrated)
408
722
  complete++;
409
- if (item.status === 'Failed')
723
+ if (item.status === stringContants_1.Status.Failed)
410
724
  error++;
411
- if (item.status === 'Skipped')
725
+ if (item.status === stringContants_1.Status.Skipped)
412
726
  skip++;
413
727
  });
414
728
  return [
415
- { name: 'Successfully Completed', count: complete, cssClass: 'text-success' },
416
- { name: 'Failed', count: error, cssClass: 'text-error' },
417
- { name: 'Skipped', count: skip, cssClass: 'text-warning' },
729
+ { name: stringContants_1.Status.SuccessfullyMigrated, count: complete, cssClass: 'text-success' },
730
+ { name: stringContants_1.Status.Skipped, count: skip, cssClass: 'text-error' },
731
+ { name: stringContants_1.Status.Failed, count: error, cssClass: 'text-error' },
732
+ ];
733
+ }
734
+ static getCustomLabelStatusData(data, totalCount) {
735
+ // For custom labels, we need to calculate based on the total from API response
736
+ // The data only contains error and duplicate (where message is not "same value")
737
+ // So we need to calculate the actual counts from the migration tool
738
+ let error = 0;
739
+ let duplicate = 0;
740
+ data.forEach((item) => {
741
+ // Handle both old and new status formats
742
+ const status = item.status || item.cloneStatus;
743
+ if (status === 'error' || status === 'Error' || status === stringContants_1.Status.Failed)
744
+ error++;
745
+ else if (status === 'duplicate' || status === stringContants_1.Status.Skipped)
746
+ duplicate++;
747
+ });
748
+ // Use totalCount if provided, otherwise fall back to data length
749
+ const actualTotal = totalCount || data.length;
750
+ const successfullyMigrated = Math.max(0, actualTotal - error - duplicate);
751
+ return [
752
+ { name: stringContants_1.Status.SuccessfullyMigrated, count: successfullyMigrated, cssClass: 'text-success' },
753
+ { name: stringContants_1.Status.Failed, count: error, cssClass: 'text-error' },
754
+ { name: stringContants_1.Status.Skipped, count: duplicate, cssClass: 'text-warning' },
418
755
  ];
419
756
  }
420
757
  static getDifferentStatusDataForApex(data) {
421
758
  let complete = 0;
422
759
  let error = 0;
423
760
  data.forEach((item) => {
424
- if (!item.warnings || item.warnings.length === 0)
761
+ if (this.successStatus.includes(item.status))
425
762
  complete++;
426
763
  else
427
764
  error++;
428
765
  });
429
766
  return [
430
- { name: 'Successfully Completed', count: complete, cssClass: 'text-success' },
431
- { name: 'Failed', count: error, cssClass: 'text-error' },
767
+ { name: stringContants_1.Status.SuccessfullyMigrated, count: complete, cssClass: 'text-success' },
768
+ { name: stringContants_1.Status.Skipped, count: 0, cssClass: 'text-error' },
769
+ { name: stringContants_1.Status.Failed, count: error, cssClass: 'text-error' },
432
770
  ];
433
771
  }
434
- static getDifferentStatusDataForFlexipage(data) {
772
+ static buildStatusSummary(counts) {
773
+ const result = [
774
+ { name: stringContants_1.Status.SuccessfullyMigrated, count: counts.completed, cssClass: 'text-success' },
775
+ ];
776
+ if (counts.manualDeploymentNeeded > 0) {
777
+ result.push({
778
+ name: stringContants_1.Status.ManualDeploymentNeeded,
779
+ count: counts.manualDeploymentNeeded,
780
+ cssClass: 'text-error',
781
+ });
782
+ }
783
+ result.push({ name: stringContants_1.Status.Skipped, count: counts.skipped, cssClass: 'text-error' });
784
+ result.push({ name: stringContants_1.Status.Failed, count: counts.failed, cssClass: 'text-error' });
785
+ return result;
786
+ }
787
+ static countStatusesFromItems(statuses) {
435
788
  let completed = 0;
789
+ let manualDeploymentNeeded = 0;
790
+ let skipped = 0;
436
791
  let failed = 0;
437
- data.forEach((item) => {
438
- if (item.status === 'Complete')
792
+ for (const status of statuses) {
793
+ if (this.isManualDeploymentNeeded(status)) {
794
+ manualDeploymentNeeded++;
795
+ }
796
+ else if (status === stringContants_1.Status.SuccessfullyMigrated) {
439
797
  completed++;
440
- else
798
+ }
799
+ else if (status === stringContants_1.Status.Skipped) {
800
+ skipped++;
801
+ }
802
+ else {
441
803
  failed++;
804
+ }
805
+ }
806
+ return { completed, manualDeploymentNeeded, skipped, failed };
807
+ }
808
+ static getDifferentStatusDataForFlexipage(data) {
809
+ return this.buildStatusSummary(this.countStatusesFromItems(data.map((item) => item.status)));
810
+ }
811
+ static getDifferentStatusDataForLwc(data) {
812
+ return this.buildStatusSummary(this.countStatusesFromItems(data.map((item) => this.getStatusFromErrors(item.errors))));
813
+ }
814
+ static getDifferentStatusDataForExperienceSites(data) {
815
+ const statuses = data.flatMap((item) => item.experienceSiteAssessmentPageInfos.map((page) => page.status));
816
+ return this.buildStatusSummary(this.countStatusesFromItems(statuses));
817
+ }
818
+ static getStatusFilterGroup(statuses) {
819
+ const statusSet = new Set(statuses);
820
+ if (statusSet.size === 0)
821
+ return [];
822
+ return [(0, reportUtil_1.createFilterGroupParam)('Filter by Status', 'status', Array.from(statusSet))];
823
+ }
824
+ static getStatusFromErrors(errors) {
825
+ if (errors && errors.length > 0)
826
+ return stringContants_1.Status.Failed;
827
+ return stringContants_1.Status.SuccessfullyMigrated;
828
+ }
829
+ /** True when deployment failed but the component was successfully processed locally. */
830
+ static isManualDeploymentNeeded(status) {
831
+ return this.deploymentFailed && status === stringContants_1.Status.SuccessfullyMigrated;
832
+ }
833
+ /** Returns display status — "Manual deployment needed" when deployment failed, original status otherwise. */
834
+ static resolveDisplayStatus(status, messages) {
835
+ return this.isManualDeploymentNeeded(status) ? messages.getMessage('manualDeploymentNeeded') : status;
836
+ }
837
+ /** Returns CSS class — error for manual deployment needed, success/error otherwise. */
838
+ static resolveStatusClass(status) {
839
+ if (this.isManualDeploymentNeeded(status))
840
+ return 'text-error';
841
+ return status === stringContants_1.Status.SuccessfullyMigrated ? 'text-success' : 'text-error';
842
+ }
843
+ static getRowsForExperienceSites(result, messages) {
844
+ const rows = [];
845
+ result.forEach((item) => {
846
+ const rId = `${this.rowClass}${this.rowId++}`;
847
+ let showBundleName = true;
848
+ item.experienceSiteAssessmentPageInfos.forEach((page) => {
849
+ rows.push({
850
+ rowId: rId,
851
+ data: this.getRowDataForExperienceSites(page, item, showBundleName, messages),
852
+ });
853
+ showBundleName = false;
854
+ });
442
855
  });
856
+ return rows;
857
+ }
858
+ static getRowDataForExperienceSites(page, item, showBundleName, messages) {
859
+ const displayStatus = this.resolveDisplayStatus(page.status, messages);
860
+ const statusClass = this.resolveStatusClass(page.status);
443
861
  return [
444
- { name: 'Completed', count: completed, cssClass: 'text-success' },
445
- { name: 'Failed', count: failed, cssClass: 'text-error' },
862
+ (0, reportUtil_1.createRowDataParam)('name', item.experienceBundleName, true, item.experienceSiteAssessmentPageInfos.length, 1, false, undefined, undefined, showBundleName ? '' : 'no-display'),
863
+ (0, reportUtil_1.createRowDataParam)('pageName', page.name, false, 1, 1, false, undefined, undefined),
864
+ (0, reportUtil_1.createRowDataParam)('path', page.name + this.experienceSiteFileSuffix, false, 1, 1, true, page.path),
865
+ (0, reportUtil_1.createRowDataParam)('status', displayStatus, false, 1, 1, false, undefined, undefined, statusClass),
866
+ (0, reportUtil_1.createRowDataParam)('diff', page.name + 'diff', false, 1, 1, false, undefined, FileDiffUtil_1.FileDiffUtil.getDiffHTML(page.diff, page.name), 'diff-cell'),
867
+ (0, reportUtil_1.createRowDataParam)('errors', page.errors ? page.errors.join(', ') : '', false, 1, 1, false, undefined, [
868
+ ...(page.errors || []),
869
+ ...(page.warnings || []),
870
+ ]),
446
871
  ];
447
872
  }
448
873
  }
449
874
  exports.ResultsBuilder = ResultsBuilder;
450
875
  ResultsBuilder.rowClass = 'data-row-';
451
876
  ResultsBuilder.rowId = 0;
877
+ ResultsBuilder.experienceSiteFileSuffix = '.json';
878
+ ResultsBuilder.flexiPageFileSuffix = '.flexipage-meta.xml';
879
+ ResultsBuilder.successStatus = [stringContants_1.Status.ReadyForMigration, stringContants_1.Status.Complete, stringContants_1.Status.SuccessfullyMigrated];
880
+ ResultsBuilder.errorStatus = [stringContants_1.Status.Failed, stringContants_1.Status.NeedsManualIntervention];
881
+ /** Set at report generation start; used to show "Manual deployment needed" when deployment failed */
882
+ ResultsBuilder.deploymentFailed = false;
452
883
  //# sourceMappingURL=index.js.map