@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
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
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
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
37
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
38
+ /* eslint-disable @typescript-eslint/no-explicit-any */
39
+ const fs = __importStar(require("fs"));
40
+ const os = __importStar(require("os"));
41
+ const path = __importStar(require("path"));
42
+ const core_1 = require("@salesforce/core");
43
+ const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
44
+ const logger_1 = require("../../../utils/logger");
45
+ const orgUtils_1 = require("../../../utils/orgUtils");
46
+ const dataModelService_1 = require("../../../utils/dataModelService");
47
+ const SpecialCharacterRecordCleanupService_1 = require("../../../utils/config/SpecialCharacterRecordCleanupService");
48
+ const ExistingRecordCleanupService_1 = require("../../../utils/config/ExistingRecordCleanupService");
49
+ const promptUtil_1 = require("../../../utils/promptUtil");
50
+ const ASSESS_OUTPUT_FOLDER = 'clean_assessment';
51
+ core_1.Messages.importMessagesDirectory(__dirname);
52
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-omnistudio-migration-tool', 'clean');
53
+ class Clean extends sf_plugins_core_1.SfCommand {
54
+ async run() {
55
+ const { flags: parsedFlags } = await this.parse(Clean);
56
+ const ux = new sf_plugins_core_1.Ux();
57
+ const logger = await core_1.Logger.child(this.constructor.name);
58
+ logger_1.Logger.initialiseLogger(ux, logger, 'clean', parsedFlags.verbose);
59
+ try {
60
+ return await this.runClean(parsedFlags, ux);
61
+ }
62
+ catch (e) {
63
+ const error = e;
64
+ logger_1.Logger.error(messages.getMessage('errorRunningClean', [error.message]));
65
+ process.exit(1);
66
+ }
67
+ }
68
+ async runClean(parsedFlags, ux) {
69
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
70
+ const org = parsedFlags['target-org'];
71
+ const conn = org.getConnection();
72
+ const orgs = await orgUtils_1.OrgUtils.getOrgDetails(conn);
73
+ (0, dataModelService_1.initializeDataModelService)(orgs);
74
+ if (!(0, dataModelService_1.isStandardDataModel)()) {
75
+ logger_1.Logger.warn(messages.getMessage('standardDataModelRequired'));
76
+ return { success: false };
77
+ }
78
+ if ((0, dataModelService_1.isStandardDataModelWithMetadataAPIEnabled)()) {
79
+ logger_1.Logger.log(messages.getMessage('metadataApiAlreadyEnabled'));
80
+ return { success: false };
81
+ }
82
+ if (parsedFlags.assess) {
83
+ return this.runAssess(conn, ux);
84
+ }
85
+ logger_1.Logger.warn(messages.getMessage('sandboxWarning'));
86
+ const confirmed = await (0, promptUtil_1.askConfirmation)(messages.getMessage('confirmDeletion'));
87
+ if (!confirmed) {
88
+ logger_1.Logger.log(messages.getMessage('operationCancelled'));
89
+ return { success: false };
90
+ }
91
+ const specialCharService = new SpecialCharacterRecordCleanupService_1.SpecialCharacterRecordCleanupService(conn, messages, ux);
92
+ await specialCharService.deactivateAndDelete();
93
+ const existingRecordCleanupService = new ExistingRecordCleanupService_1.ExistingRecordCleanupService(conn, messages, ux);
94
+ await existingRecordCleanupService.cleanAll();
95
+ logger_1.Logger.log(messages.getMessage('deletionComplete'));
96
+ return { success: true };
97
+ }
98
+ async runAssess(conn, ux) {
99
+ var _a, _b;
100
+ logger_1.Logger.log(messages.getMessage('assessPhaseStart'));
101
+ const specialCharService = new SpecialCharacterRecordCleanupService_1.SpecialCharacterRecordCleanupService(conn, messages, ux);
102
+ const existingRecordService = new ExistingRecordCleanupService_1.ExistingRecordCleanupService(conn, messages, ux);
103
+ // Run phases sequentially so their log output does not interleave
104
+ const specialCharMap = await specialCharService.assess();
105
+ const nullUniqueNameMap = await existingRecordService.assess();
106
+ // Collect all entity names from both phases
107
+ const allEntities = new Set([...specialCharMap.keys(), ...nullUniqueNameMap.keys()]);
108
+ let totalRecords = 0;
109
+ const outputDir = path.join(process.cwd(), ASSESS_OUTPUT_FOLDER);
110
+ fs.mkdirSync(outputDir, { recursive: true });
111
+ for (const entityName of allEntities) {
112
+ const specialCharRecords = (_a = specialCharMap.get(entityName)) !== null && _a !== void 0 ? _a : [];
113
+ const nullUniqueNameRecords = (_b = nullUniqueNameMap.get(entityName)) !== null && _b !== void 0 ? _b : [];
114
+ const entityTotal = specialCharRecords.length + nullUniqueNameRecords.length;
115
+ totalRecords += entityTotal;
116
+ const strip = (records) => records.map(({ attributes, ...rest }) => {
117
+ void attributes; // Explicitly mark as intentionally unused
118
+ return rest;
119
+ });
120
+ const assessment = {
121
+ component: entityName,
122
+ specialCharacterRecords: strip(specialCharRecords),
123
+ orphanRecords: strip(nullUniqueNameRecords),
124
+ totalToDelete: entityTotal,
125
+ };
126
+ // Use a filesystem-safe filename (remove spaces)
127
+ const fileName = `${entityName.replace(/ /g, '')}.json`;
128
+ const filePath = path.join(outputDir, fileName);
129
+ fs.writeFileSync(filePath, JSON.stringify(assessment, null, 2));
130
+ logger_1.Logger.log(messages.getMessage('assessmentFileWritten', [filePath]));
131
+ }
132
+ if (totalRecords === 0) {
133
+ logger_1.Logger.log(messages.getMessage('assessmentNoRecords'));
134
+ }
135
+ else {
136
+ logger_1.Logger.log(messages.getMessage('assessmentComplete', [outputDir]));
137
+ }
138
+ return { success: true };
139
+ }
140
+ }
141
+ Clean.description = messages.getMessage('commandDescription');
142
+ Clean.examples = messages.getMessage('examples').split(os.EOL);
143
+ Clean.args = [];
144
+ Clean.flags = {
145
+ 'target-org': sf_plugins_core_1.Flags.optionalOrg({
146
+ summary: 'Target org username or alias',
147
+ char: 'u',
148
+ required: true,
149
+ aliases: ['targetusername'],
150
+ deprecateAliases: true,
151
+ makeDefault: false,
152
+ }),
153
+ verbose: sf_plugins_core_1.Flags.boolean({
154
+ description: messages.getMessage('enableVerboseOutput'),
155
+ }),
156
+ assess: sf_plugins_core_1.Flags.boolean({
157
+ description: messages.getMessage('assessFlagDescription'),
158
+ default: false,
159
+ }),
160
+ };
161
+ exports.default = Clean;
162
+ //# sourceMappingURL=clean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean.js","sourceRoot":"","sources":["../../../../src/commands/omnistudio/migration/clean.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA4D;AAC5D,sDAAsD;AACtD,uDAAuD;AACvD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,2CAAmF;AACnF,iEAA4E;AAC5E,kDAA+C;AAC/C,sDAAyE;AACzE,sEAIyC;AACzC,qHAAkH;AAClH,qGAAkG;AAClG,0DAA4D;AAE5D,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEhD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,8CAA8C,EAAE,OAAO,CAAC,CAAC;AAYhG,MAAqB,KAAM,SAAQ,2BAAsB;IAyBhD,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvD,MAAM,EAAE,GAAG,IAAI,oBAAE,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,MAAM,aAAU,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC7D,eAAM,CAAC,gBAAgB,CAAC,EA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AAE,QAAQ,CAAC,UAAU,CAAC,uBAAuB,CAAC;QACzD,OAAO,EAAE,KAAK;KACf,CAAC;CACH,CAAC;kBAvBiB,KAAK"}
@@ -1,19 +1,13 @@
1
- import { flags, SfdxCommand } from '@salesforce/command';
2
- import { AnyJson } from '@salesforce/ts-types';
3
- export default class Org extends SfdxCommand {
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export type InfoResult = {
3
+ orgId: string;
4
+ outputString: string;
5
+ };
6
+ export default class Info extends SfCommand<InfoResult> {
4
7
  static description: string;
5
8
  static examples: string[];
6
- static args: {
7
- name: string;
8
- }[];
9
- protected static flagsConfig: {
10
- name: flags.Discriminated<flags.String>;
11
- allversions: flags.Discriminated<flags.Boolean<boolean>>;
12
- verbose: flags.Builtin;
13
- };
14
- protected static requiresUsername: boolean;
15
- protected static supportsDevhubUsername: boolean;
16
- protected static requiresProject: boolean;
17
- run(): Promise<AnyJson>;
18
- runInfo(): Promise<AnyJson>;
9
+ static args: any;
10
+ static readonly flags: any;
11
+ run(): Promise<InfoResult>;
12
+ runInfo(): Promise<InfoResult>;
19
13
  }
@@ -15,13 +15,23 @@ 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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
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
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  /*
27
37
  * Copyright (c) 2020, salesforce.com, inc.
@@ -30,15 +40,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
30
40
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
31
41
  */
32
42
  const os = __importStar(require("os"));
33
- const command_1 = require("@salesforce/command");
34
43
  const core_1 = require("@salesforce/core");
44
+ const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
35
45
  const logger_1 = require("../../../utils/logger");
36
46
  // Initialize Messages with the current plugin directory
37
47
  core_1.Messages.importMessagesDirectory(__dirname);
38
48
  // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
39
49
  // or any library that is using the messages framework can also be loaded this way.
40
50
  const messages = core_1.Messages.loadMessages('@salesforce/plugin-omnistudio-migration-tool', 'info');
41
- class Org extends command_1.SfdxCommand {
51
+ class Info extends sf_plugins_core_1.SfCommand {
42
52
  async run() {
43
53
  try {
44
54
  return await this.runInfo();
@@ -49,18 +59,20 @@ class Org extends command_1.SfdxCommand {
49
59
  }
50
60
  }
51
61
  async runInfo() {
52
- const name = (this.flags.name || 'world');
53
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
54
- const allVersions = this.flags.allversions || false;
55
- // this.org is guaranteed because requiresUsername=true, as opposed to supportsUsername
56
- const conn = this.org.getConnection();
62
+ const { flags: parsedFlags } = await this.parse(Info);
63
+ const name = parsedFlags.name || 'world';
64
+ const allVersions = parsedFlags.allversions || false;
65
+ // target-org is required by flag definition, so it will always be present
66
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
67
+ const org = parsedFlags['target-org'];
68
+ const conn = org.getConnection();
57
69
  const query = 'Select Name, TrialExpirationDate from Organization';
58
70
  // Query the org
59
71
  const result = await conn.query(query);
60
72
  // Organization will always return one result, but this is an example of throwing an error
61
73
  // The output and --json will automatically be handled for you.
62
74
  if (!result.records || result.records.length <= 0) {
63
- throw new core_1.SfdxError(messages.getMessage('errorNoOrgResults', [this.org.getOrgId()]));
75
+ throw new core_1.SfError(messages.getMessage('errorNoOrgResults', [org.getOrgId()]));
64
76
  }
65
77
  // Organization always only returns one result
66
78
  const orgName = result.records[0].Name;
@@ -74,42 +86,48 @@ class Org extends command_1.SfdxCommand {
74
86
  outputString = messages.getMessage('greetingOrgInfo', [name, orgName]);
75
87
  }
76
88
  logger_1.Logger.log(outputString);
77
- // this.hubOrg is NOT guaranteed because supportsHubOrgUsername=true, as opposed to requiresHubOrgUsername.
78
- if (this.hubOrg) {
79
- const hubOrgId = this.hubOrg.getOrgId();
89
+ // Check for dev hub org
90
+ const hubOrg = parsedFlags['target-dev-hub'];
91
+ if (hubOrg) {
92
+ const hubOrgId = hubOrg.getOrgId();
80
93
  logger_1.Logger.log(messages.getMessage('hubOrgId', [hubOrgId]));
81
94
  }
82
95
  if (allVersions) {
83
96
  outputString = outputString + messages.getMessage('allVersionsAppended');
84
97
  }
85
98
  // Return an object to be displayed with --json
86
- return { orgId: this.org.getOrgId(), outputString };
99
+ return { orgId: org.getOrgId(), outputString };
87
100
  }
88
101
  }
89
- exports.default = Org;
90
- Org.description = messages.getMessage('commandDescription');
91
- Org.examples = messages.getMessage('examples').split(os.EOL);
92
- Org.args = [{ name: 'file' }];
93
- Org.flagsConfig = {
94
- // flag with a value (-n, --name=VALUE)
95
- name: command_1.flags.string({
102
+ Info.description = messages.getMessage('commandDescription');
103
+ Info.examples = messages.getMessage('examples').split(os.EOL);
104
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
105
+ Info.args = [];
106
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
107
+ Info.flags = {
108
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
109
+ 'target-org': sf_plugins_core_1.Flags.optionalOrg({
110
+ char: 'u',
111
+ summary: 'Target org username or alias',
112
+ required: true,
113
+ aliases: ['targetusername'],
114
+ deprecateAliases: true,
115
+ makeDefault: false, // Prevent auto-resolution during command-reference generation
116
+ }),
117
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
118
+ name: sf_plugins_core_1.Flags.string({
96
119
  char: 'n',
97
120
  description: messages.getMessage('nameFlagDescription'),
98
121
  }),
99
- allversions: command_1.flags.boolean({
122
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
123
+ allversions: sf_plugins_core_1.Flags.boolean({
100
124
  char: 'a',
101
125
  description: messages.getMessage('allVersionsDescription'),
102
126
  required: false,
103
127
  }),
104
- verbose: command_1.flags.builtin({
105
- type: 'builtin',
128
+ verbose: sf_plugins_core_1.Flags.boolean({
106
129
  description: 'Enable verbose output',
107
130
  }),
108
131
  };
109
- // Comment this out if your command does not require an org username
110
- Org.requiresUsername = true;
111
- // Comment this out if your command does not support a hub org username
112
- Org.supportsDevhubUsername = true;
113
- // Set this to true if your command requires a project workspace; 'requiresProject' is false by default
114
- Org.requiresProject = false;
132
+ exports.default = Info;
115
133
  //# sourceMappingURL=info.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"info.js","sourceRoot":"","sources":["../../../../src/commands/omnistudio/migration/info.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,uCAAyB;AACzB,iDAAyD;AACzD,2CAAuD;AAEvD,kDAA+C;AAE/C,wDAAwD;AACxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,iGAAiG;AACjG,mFAAmF;AACnF,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,8CAA8C,EAAE,MAAM,CAAC,CAAC;AAE/F,MAAqB,GAAI,SAAQ,qBAAW;IAiCnC,KAAK,CAAC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WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC;QAC1D,QAAQ,EAAE,KAAK;KAChB,CAAC;IACF,OAAO,EAAE,uBAAK,CAAC,OAAO,CAAC;QACrB,WAAW,EAAE,uBAAuB;KACrC,CAAC;CACH,CAAC;kBAjCiB,IAAI"}
@@ -1,29 +1,89 @@
1
- import { flags } from '@salesforce/command';
2
- import OmniStudioBaseCommand from '../../basecommand';
3
- export default class Migrate extends OmniStudioBaseCommand {
1
+ import { Org, Logger as CoreLogger } from '@salesforce/core';
2
+ import { SfCommand, Ux } from '@salesforce/sf-plugins-core';
3
+ export type MigrateResult = {
4
+ objectMigrationResults: any[];
5
+ };
6
+ interface MigrateFlags {
7
+ 'target-org'?: Org;
8
+ only?: string;
9
+ allversions?: boolean;
10
+ relatedobjects?: string;
11
+ verbose?: boolean;
12
+ }
13
+ export default class Migrate extends SfCommand<MigrateResult> {
4
14
  static description: string;
5
15
  static examples: string[];
6
- static args: {
7
- name: string;
8
- }[];
9
- protected static flagsConfig: {
10
- namespace: flags.Discriminated<flags.String>;
11
- only: flags.Discriminated<flags.String>;
12
- allversions: flags.Discriminated<flags.Boolean<boolean>>;
13
- relatedobjects: flags.Discriminated<flags.String>;
14
- verbose: flags.Builtin;
15
- };
16
+ static args: any;
17
+ static readonly flags: any;
18
+ private readonly OMNISTUDIO_COMPONENTS_FOR_LOGGING;
16
19
  run(): Promise<any>;
17
- runMigration(): Promise<any>;
20
+ runMigration(parsedFlags: MigrateFlags, ux: Ux, logger: CoreLogger): Promise<MigrateResult>;
21
+ private processRelatedObjects;
18
22
  private getMigrationConsent;
19
- private handleExperienceSitePrerequisites;
20
23
  private collectActionItems;
21
- private removeKeyFromRelatedObjectsToProcess;
22
24
  private truncateObjects;
23
25
  private migrateObjects;
24
- private getMigrationObjects;
26
+ /**
27
+ * Log the start of component migration and track timing
28
+ */
29
+ private logMigrationStart;
30
+ /**
31
+ * Log the completion or failure of component migration
32
+ */
33
+ private logMigrationComplete;
34
+ /**
35
+ * Check if migration logging should be skipped for a component
36
+ * Returns true if Metadata API is enabled and the component doesn't need migration
37
+ */
38
+ private shouldSkipTruncationLogging;
39
+ /**
40
+ * Check if migration logging should be skipped for a component
41
+ * Returns true if Metadata API is enabled and the component doesn't need migration
42
+ */
43
+ private shouldSkipLogging;
44
+ /**
45
+ * Log the start of component truncation and track timing
46
+ */
47
+ private logTruncationStart;
48
+ /**
49
+ * Log the completion of component truncation
50
+ */
51
+ private logTruncationComplete;
52
+ /**
53
+ * Get migration objects in the correct dependency order:
54
+ * 1. Data Mappers (lowest dependencies)
55
+ * 2. Integration Procedures/ OmniScripts
56
+ * 3. FlexCards (highest dependencies)
57
+ * 4. GlobalAutoNumbers (independent)
58
+ */
59
+ private getMigrationObjectsInCorrectOrder;
60
+ /**
61
+ * Pre-process all components to register their name mappings
62
+ */
63
+ private preProcessAllComponents;
64
+ /**
65
+ * Query DataMappers from the org
66
+ */
67
+ private queryDataMappers;
68
+ /**
69
+ * Query OmniScripts from the org (both LWC and Angular)
70
+ */
71
+ private queryOmniScripts;
72
+ /**
73
+ * Separate OmniScripts into LWC and Angular based on IsLwcEnabled__c field
74
+ */
75
+ private separateOmniScriptsByType;
76
+ /**
77
+ * Query FlexCards from the org
78
+ */
79
+ private queryFlexCards;
80
+ /**
81
+ * Filter components based on the migrateOnly flag
82
+ */
83
+ private filterComponentsByMigrateOnly;
25
84
  private getTargetApexNamespace;
26
85
  private getGeneralConsent;
27
- private getExpSiteMetadataEnableConsent;
28
86
  private mergeRecordAndUploadResults;
87
+ private logTruncationErrors;
29
88
  }
89
+ export {};