@peernova/cuneiform-sf 1.0.3-beta.0 → 1.0.4-beta.8

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 (494) hide show
  1. package/LICENSE +81 -30
  2. package/README.md +59 -95
  3. package/lib/adapters/connection-facade.d.ts +458 -0
  4. package/lib/adapters/connection-facade.js +379 -0
  5. package/lib/adapters/connection-facade.js.map +1 -0
  6. package/lib/adapters/errors.d.ts +547 -0
  7. package/lib/adapters/errors.js +937 -0
  8. package/lib/adapters/errors.js.map +1 -0
  9. package/lib/adapters/index.d.ts +33 -0
  10. package/lib/adapters/index.js +50 -0
  11. package/lib/adapters/index.js.map +1 -0
  12. package/lib/adapters/lifecycle.d.ts +119 -0
  13. package/lib/adapters/lifecycle.js +94 -0
  14. package/lib/adapters/lifecycle.js.map +1 -0
  15. package/lib/adapters/rest/cache.d.ts +69 -0
  16. package/lib/adapters/rest/cache.js +133 -0
  17. package/lib/adapters/rest/cache.js.map +1 -0
  18. package/lib/adapters/rest/index.d.ts +11 -0
  19. package/lib/adapters/rest/index.js +18 -0
  20. package/lib/adapters/rest/index.js.map +1 -0
  21. package/lib/adapters/rest/profiling-rest-client.d.ts +137 -0
  22. package/lib/adapters/rest/profiling-rest-client.js +115 -0
  23. package/lib/adapters/rest/profiling-rest-client.js.map +1 -0
  24. package/lib/adapters/rest/rest-api-adapter.d.ts +389 -0
  25. package/lib/adapters/rest/rest-api-adapter.js +747 -0
  26. package/lib/adapters/rest/rest-api-adapter.js.map +1 -0
  27. package/lib/adapters/rest/types.d.ts +34 -0
  28. package/lib/adapters/rest/types.js +9 -0
  29. package/lib/adapters/rest/types.js.map +1 -0
  30. package/lib/adapters/retry.d.ts +91 -0
  31. package/lib/adapters/retry.js +215 -0
  32. package/lib/adapters/retry.js.map +1 -0
  33. package/lib/adapters/soql/cuneiform-query-builder.d.ts +391 -0
  34. package/lib/adapters/soql/cuneiform-query-builder.js +559 -0
  35. package/lib/adapters/soql/cuneiform-query-builder.js.map +1 -0
  36. package/lib/adapters/soql/index.d.ts +13 -0
  37. package/lib/adapters/soql/index.js +21 -0
  38. package/lib/adapters/soql/index.js.map +1 -0
  39. package/lib/adapters/soql/soql-query-adapter.d.ts +141 -0
  40. package/lib/adapters/soql/soql-query-adapter.js +259 -0
  41. package/lib/adapters/soql/soql-query-adapter.js.map +1 -0
  42. package/lib/adapters/soql/types.d.ts +37 -0
  43. package/lib/adapters/soql/types.js +19 -0
  44. package/lib/adapters/soql/types.js.map +1 -0
  45. package/lib/adapters/testing/index.d.ts +37 -0
  46. package/lib/adapters/testing/index.js +20 -0
  47. package/lib/adapters/testing/index.js.map +1 -0
  48. package/lib/adapters/testing/mock-connection.d.ts +77 -0
  49. package/lib/adapters/testing/mock-connection.js +207 -0
  50. package/lib/adapters/testing/mock-connection.js.map +1 -0
  51. package/lib/adapters/testing/mock-logger.d.ts +29 -0
  52. package/lib/adapters/testing/mock-logger.js +57 -0
  53. package/lib/adapters/testing/mock-logger.js.map +1 -0
  54. package/lib/adapters/testing/mock-mcp-adapters.d.ts +32 -0
  55. package/lib/adapters/testing/mock-mcp-adapters.js +52 -0
  56. package/lib/adapters/testing/mock-mcp-adapters.js.map +1 -0
  57. package/lib/adapters/testing/mock-oclif-config.d.ts +22 -0
  58. package/lib/adapters/testing/mock-oclif-config.js +90 -0
  59. package/lib/adapters/testing/mock-oclif-config.js.map +1 -0
  60. package/lib/adapters/testing/mock-rest-adapter.d.ts +26 -0
  61. package/lib/adapters/testing/mock-rest-adapter.js +243 -0
  62. package/lib/adapters/testing/mock-rest-adapter.js.map +1 -0
  63. package/lib/adapters/testing/mock-salesforce-connection.d.ts +40 -0
  64. package/lib/adapters/testing/mock-salesforce-connection.js +61 -0
  65. package/lib/adapters/testing/mock-salesforce-connection.js.map +1 -0
  66. package/lib/adapters/testing/mock-soql-adapter.d.ts +30 -0
  67. package/lib/adapters/testing/mock-soql-adapter.js +120 -0
  68. package/lib/adapters/testing/mock-soql-adapter.js.map +1 -0
  69. package/lib/adapters/testing/mock-tooling-adapter.d.ts +24 -0
  70. package/lib/adapters/testing/mock-tooling-adapter.js +163 -0
  71. package/lib/adapters/testing/mock-tooling-adapter.js.map +1 -0
  72. package/lib/adapters/testing/stub-connection.d.ts +93 -0
  73. package/lib/adapters/testing/stub-connection.js +97 -0
  74. package/lib/adapters/testing/stub-connection.js.map +1 -0
  75. package/lib/adapters/testing/stub-rest-adapter.d.ts +52 -0
  76. package/lib/adapters/testing/stub-rest-adapter.js +58 -0
  77. package/lib/adapters/testing/stub-rest-adapter.js.map +1 -0
  78. package/lib/adapters/testing/stub-soql-adapter.d.ts +56 -0
  79. package/lib/adapters/testing/stub-soql-adapter.js +50 -0
  80. package/lib/adapters/testing/stub-soql-adapter.js.map +1 -0
  81. package/lib/adapters/testing/types.d.ts +71 -0
  82. package/lib/adapters/testing/types.js +9 -0
  83. package/lib/adapters/testing/types.js.map +1 -0
  84. package/lib/adapters/tooling/index.d.ts +10 -0
  85. package/lib/adapters/tooling/index.js +17 -0
  86. package/lib/adapters/tooling/index.js.map +1 -0
  87. package/lib/adapters/tooling/tooling-api-adapter.d.ts +157 -0
  88. package/lib/adapters/tooling/tooling-api-adapter.js +339 -0
  89. package/lib/adapters/tooling/tooling-api-adapter.js.map +1 -0
  90. package/lib/adapters/tooling/types.d.ts +81 -0
  91. package/lib/adapters/tooling/types.js +9 -0
  92. package/lib/adapters/tooling/types.js.map +1 -0
  93. package/lib/adapters/types.d.ts +112 -0
  94. package/lib/adapters/types.js +169 -0
  95. package/lib/adapters/types.js.map +1 -0
  96. package/lib/base/cuneiform-command.d.ts +152 -0
  97. package/lib/base/cuneiform-command.js +243 -0
  98. package/lib/base/cuneiform-command.js.map +1 -0
  99. package/lib/commands/cuneiform/compatibility/check.d.ts +43 -0
  100. package/lib/commands/cuneiform/compatibility/check.js +114 -0
  101. package/lib/commands/cuneiform/compatibility/check.js.map +1 -0
  102. package/lib/commands/cuneiform/definition/create.d.ts +119 -0
  103. package/lib/commands/cuneiform/definition/create.js +693 -0
  104. package/lib/commands/cuneiform/definition/create.js.map +1 -0
  105. package/lib/commands/cuneiform/definition/export.d.ts +11 -2
  106. package/lib/commands/cuneiform/definition/export.js +56 -20
  107. package/lib/commands/cuneiform/definition/export.js.map +1 -1
  108. package/lib/commands/cuneiform/definition/get.d.ts +86 -0
  109. package/lib/commands/cuneiform/definition/get.js +270 -0
  110. package/lib/commands/cuneiform/definition/get.js.map +1 -0
  111. package/lib/commands/cuneiform/definition/import.d.ts +12 -7
  112. package/lib/commands/cuneiform/definition/import.js +30 -19
  113. package/lib/commands/cuneiform/definition/import.js.map +1 -1
  114. package/lib/commands/cuneiform/definition/list.d.ts +110 -0
  115. package/lib/commands/cuneiform/definition/list.js +344 -0
  116. package/lib/commands/cuneiform/definition/list.js.map +1 -0
  117. package/lib/commands/cuneiform/definition/purge.d.ts +105 -0
  118. package/lib/commands/cuneiform/definition/purge.js +533 -0
  119. package/lib/commands/cuneiform/definition/purge.js.map +1 -0
  120. package/lib/commands/cuneiform/definition/update.d.ts +58 -0
  121. package/lib/commands/cuneiform/definition/update.js +206 -0
  122. package/lib/commands/cuneiform/definition/update.js.map +1 -0
  123. package/lib/commands/cuneiform/mcp/serve.d.ts +56 -0
  124. package/lib/commands/cuneiform/mcp/serve.js +109 -0
  125. package/lib/commands/cuneiform/mcp/serve.js.map +1 -0
  126. package/lib/commands/cuneiform/object/describe.d.ts +61 -0
  127. package/lib/commands/cuneiform/object/describe.js +461 -0
  128. package/lib/commands/cuneiform/object/describe.js.map +1 -0
  129. package/lib/commands/cuneiform/object/list.d.ts +111 -0
  130. package/lib/commands/cuneiform/object/list.js +239 -0
  131. package/lib/commands/cuneiform/object/list.js.map +1 -0
  132. package/lib/commands/cuneiform/org/details.d.ts +99 -0
  133. package/lib/commands/cuneiform/org/details.js +521 -0
  134. package/lib/commands/cuneiform/org/details.js.map +1 -0
  135. package/lib/commands/cuneiform/org/reset.d.ts +46 -0
  136. package/lib/commands/cuneiform/org/reset.js +135 -0
  137. package/lib/commands/cuneiform/org/reset.js.map +1 -0
  138. package/lib/commands/cuneiform/profile/request/cancel.d.ts +59 -0
  139. package/lib/commands/cuneiform/profile/request/cancel.js +202 -0
  140. package/lib/commands/cuneiform/profile/request/cancel.js.map +1 -0
  141. package/lib/commands/cuneiform/profile/request/delete.d.ts +59 -0
  142. package/lib/commands/cuneiform/profile/request/delete.js +223 -0
  143. package/lib/commands/cuneiform/profile/request/delete.js.map +1 -0
  144. package/lib/commands/cuneiform/profile/request/list.d.ts +35 -0
  145. package/lib/commands/cuneiform/profile/request/list.js +102 -0
  146. package/lib/commands/cuneiform/profile/request/list.js.map +1 -0
  147. package/lib/commands/cuneiform/profile.d.ts +90 -0
  148. package/lib/commands/cuneiform/profile.js +322 -0
  149. package/lib/commands/cuneiform/profile.js.map +1 -0
  150. package/lib/commands/cuneiform/summary/purge.d.ts +77 -0
  151. package/lib/commands/cuneiform/summary/purge.js +429 -0
  152. package/lib/commands/cuneiform/summary/purge.js.map +1 -0
  153. package/lib/commands/cuneiform/summary/reprofile.d.ts +60 -0
  154. package/lib/commands/cuneiform/summary/reprofile.js +236 -0
  155. package/lib/commands/cuneiform/summary/reprofile.js.map +1 -0
  156. package/lib/commands/cuneiform/summary/stop.d.ts +59 -0
  157. package/lib/commands/cuneiform/summary/stop.js +234 -0
  158. package/lib/commands/cuneiform/summary/stop.js.map +1 -0
  159. package/lib/commands/cuneiform/user/details.d.ts +73 -0
  160. package/lib/commands/cuneiform/user/details.js +391 -0
  161. package/lib/commands/cuneiform/user/details.js.map +1 -0
  162. package/lib/constants/index.d.ts +8 -0
  163. package/lib/constants/index.js +16 -0
  164. package/lib/constants/index.js.map +1 -0
  165. package/lib/constants/namespace-constants.d.ts +91 -0
  166. package/lib/constants/namespace-constants.js +211 -0
  167. package/lib/constants/namespace-constants.js.map +1 -0
  168. package/lib/debug/command-debug-proxy.d.ts +101 -0
  169. package/lib/debug/command-debug-proxy.js +171 -0
  170. package/lib/debug/command-debug-proxy.js.map +1 -0
  171. package/lib/debug/debug-logger.d.ts +85 -0
  172. package/lib/debug/debug-logger.js +133 -0
  173. package/lib/debug/debug-logger.js.map +1 -0
  174. package/lib/debug/index.d.ts +12 -0
  175. package/lib/debug/index.js +20 -0
  176. package/lib/debug/index.js.map +1 -0
  177. package/lib/debug/service-debug-proxy.d.ts +30 -0
  178. package/lib/debug/service-debug-proxy.js +102 -0
  179. package/lib/debug/service-debug-proxy.js.map +1 -0
  180. package/lib/hooks/prerun.d.ts +25 -0
  181. package/lib/hooks/prerun.js +47 -0
  182. package/lib/hooks/prerun.js.map +1 -0
  183. package/lib/mcp/config/mcp-config.d.ts +55 -0
  184. package/lib/mcp/config/mcp-config.js +51 -0
  185. package/lib/mcp/config/mcp-config.js.map +1 -0
  186. package/lib/mcp/config/pagination.d.ts +96 -0
  187. package/lib/mcp/config/pagination.js +108 -0
  188. package/lib/mcp/config/pagination.js.map +1 -0
  189. package/lib/mcp/config/system-prompts.d.ts +18 -0
  190. package/lib/mcp/config/system-prompts.js +92 -0
  191. package/lib/mcp/config/system-prompts.js.map +1 -0
  192. package/lib/mcp/errors.d.ts +23 -0
  193. package/lib/mcp/errors.js +27 -0
  194. package/lib/mcp/errors.js.map +1 -0
  195. package/lib/mcp/schemas/input-schemas.d.ts +327 -0
  196. package/lib/mcp/schemas/input-schemas.js +302 -0
  197. package/lib/mcp/schemas/input-schemas.js.map +1 -0
  198. package/lib/mcp/server.d.ts +40 -0
  199. package/lib/mcp/server.js +316 -0
  200. package/lib/mcp/server.js.map +1 -0
  201. package/lib/mcp/tools/contactpoint-tools.d.ts +14 -0
  202. package/lib/mcp/tools/contactpoint-tools.js +34 -0
  203. package/lib/mcp/tools/contactpoint-tools.js.map +1 -0
  204. package/lib/mcp/tools/definition-io-tools.d.ts +19 -0
  205. package/lib/mcp/tools/definition-io-tools.js +152 -0
  206. package/lib/mcp/tools/definition-io-tools.js.map +1 -0
  207. package/lib/mcp/tools/definition-tools.d.ts +51 -0
  208. package/lib/mcp/tools/definition-tools.js +199 -0
  209. package/lib/mcp/tools/definition-tools.js.map +1 -0
  210. package/lib/mcp/tools/index.d.ts +37 -0
  211. package/lib/mcp/tools/index.js +88 -0
  212. package/lib/mcp/tools/index.js.map +1 -0
  213. package/lib/mcp/tools/object-tools.d.ts +22 -0
  214. package/lib/mcp/tools/object-tools.js +306 -0
  215. package/lib/mcp/tools/object-tools.js.map +1 -0
  216. package/lib/mcp/tools/org-tools.d.ts +14 -0
  217. package/lib/mcp/tools/org-tools.js +177 -0
  218. package/lib/mcp/tools/org-tools.js.map +1 -0
  219. package/lib/mcp/tools/profile-tools.d.ts +59 -0
  220. package/lib/mcp/tools/profile-tools.js +213 -0
  221. package/lib/mcp/tools/profile-tools.js.map +1 -0
  222. package/lib/mcp/tools/summary-tools.d.ts +14 -0
  223. package/lib/mcp/tools/summary-tools.js +38 -0
  224. package/lib/mcp/tools/summary-tools.js.map +1 -0
  225. package/lib/mcp/tools/tool-factory.d.ts +63 -0
  226. package/lib/mcp/tools/tool-factory.js +146 -0
  227. package/lib/mcp/tools/tool-factory.js.map +1 -0
  228. package/lib/mcp/tools/user-tools.d.ts +25 -0
  229. package/lib/mcp/tools/user-tools.js +167 -0
  230. package/lib/mcp/tools/user-tools.js.map +1 -0
  231. package/lib/models/date-literal.d.ts +211 -0
  232. package/lib/models/date-literal.js +615 -0
  233. package/lib/models/date-literal.js.map +1 -0
  234. package/lib/models/object-describe-types.d.ts +173 -0
  235. package/lib/models/object-describe-types.js +9 -0
  236. package/lib/models/object-describe-types.js.map +1 -0
  237. package/lib/models/profile-request-types.d.ts +118 -0
  238. package/lib/models/profile-request-types.js +23 -0
  239. package/lib/models/profile-request-types.js.map +1 -0
  240. package/lib/models/profiling-execution-types.d.ts +154 -0
  241. package/lib/models/profiling-execution-types.js +14 -0
  242. package/lib/models/profiling-execution-types.js.map +1 -0
  243. package/lib/models/service-result.d.ts +114 -0
  244. package/lib/models/service-result.js +81 -0
  245. package/lib/models/service-result.js.map +1 -0
  246. package/lib/models/sfdmu-types.d.ts +4 -25
  247. package/lib/models/sfdmu-types.js +7 -3
  248. package/lib/models/sfdmu-types.js.map +1 -1
  249. package/lib/models/status-types.d.ts +38 -0
  250. package/lib/models/status-types.js +12 -0
  251. package/lib/models/status-types.js.map +1 -0
  252. package/lib/models/summary-bulk-types.d.ts +61 -0
  253. package/lib/models/summary-bulk-types.js +23 -0
  254. package/lib/models/summary-bulk-types.js.map +1 -0
  255. package/lib/models/user-details-types.d.ts +163 -0
  256. package/lib/models/user-details-types.js +9 -0
  257. package/lib/models/user-details-types.js.map +1 -0
  258. package/lib/models/year-range.d.ts +78 -0
  259. package/lib/models/year-range.js +153 -0
  260. package/lib/models/year-range.js.map +1 -0
  261. package/lib/operations/CompatibilityCheckOperation.d.ts +62 -0
  262. package/lib/operations/CompatibilityCheckOperation.js +102 -0
  263. package/lib/operations/CompatibilityCheckOperation.js.map +1 -0
  264. package/lib/operations/DefinitionCreateOperation.d.ts +411 -0
  265. package/lib/operations/DefinitionCreateOperation.js +1121 -0
  266. package/lib/operations/DefinitionCreateOperation.js.map +1 -0
  267. package/lib/operations/DefinitionExportOperation.d.ts +65 -2
  268. package/lib/operations/DefinitionExportOperation.js +94 -10
  269. package/lib/operations/DefinitionExportOperation.js.map +1 -1
  270. package/lib/operations/DefinitionImportOperation.d.ts +61 -11
  271. package/lib/operations/DefinitionImportOperation.js +194 -31
  272. package/lib/operations/DefinitionImportOperation.js.map +1 -1
  273. package/lib/operations/DefinitionListOperation.d.ts +66 -0
  274. package/lib/operations/DefinitionListOperation.js +108 -0
  275. package/lib/operations/DefinitionListOperation.js.map +1 -0
  276. package/lib/operations/DefinitionPurgeOperation.d.ts +199 -0
  277. package/lib/operations/DefinitionPurgeOperation.js +465 -0
  278. package/lib/operations/DefinitionPurgeOperation.js.map +1 -0
  279. package/lib/operations/DefinitionUpdateOperation.d.ts +78 -0
  280. package/lib/operations/DefinitionUpdateOperation.js +142 -0
  281. package/lib/operations/DefinitionUpdateOperation.js.map +1 -0
  282. package/lib/operations/OrgDetailsOperation.d.ts +253 -0
  283. package/lib/operations/OrgDetailsOperation.js +456 -0
  284. package/lib/operations/OrgDetailsOperation.js.map +1 -0
  285. package/lib/operations/OrgResetOperation.d.ts +114 -0
  286. package/lib/operations/OrgResetOperation.js +209 -0
  287. package/lib/operations/OrgResetOperation.js.map +1 -0
  288. package/lib/operations/ProfileOperation.d.ts +187 -0
  289. package/lib/operations/ProfileOperation.js +373 -0
  290. package/lib/operations/ProfileOperation.js.map +1 -0
  291. package/lib/operations/ProfileRequestCancelOperation.d.ts +59 -0
  292. package/lib/operations/ProfileRequestCancelOperation.js +137 -0
  293. package/lib/operations/ProfileRequestCancelOperation.js.map +1 -0
  294. package/lib/operations/ProfileRequestDeleteOperation.d.ts +64 -0
  295. package/lib/operations/ProfileRequestDeleteOperation.js +134 -0
  296. package/lib/operations/ProfileRequestDeleteOperation.js.map +1 -0
  297. package/lib/operations/ProfileRequestListOperation.d.ts +39 -0
  298. package/lib/operations/ProfileRequestListOperation.js +61 -0
  299. package/lib/operations/ProfileRequestListOperation.js.map +1 -0
  300. package/lib/operations/SummaryPurgeOperation.d.ts +134 -0
  301. package/lib/operations/SummaryPurgeOperation.js +257 -0
  302. package/lib/operations/SummaryPurgeOperation.js.map +1 -0
  303. package/lib/operations/SummaryReprofileOperation.d.ts +88 -0
  304. package/lib/operations/SummaryReprofileOperation.js +174 -0
  305. package/lib/operations/SummaryReprofileOperation.js.map +1 -0
  306. package/lib/operations/SummaryStopOperation.d.ts +87 -0
  307. package/lib/operations/SummaryStopOperation.js +175 -0
  308. package/lib/operations/SummaryStopOperation.js.map +1 -0
  309. package/lib/services/BulkExecutionService.d.ts +120 -0
  310. package/lib/services/BulkExecutionService.js +535 -0
  311. package/lib/services/BulkExecutionService.js.map +1 -0
  312. package/lib/services/CompatibilityService.d.ts +81 -0
  313. package/lib/services/CompatibilityService.js +118 -0
  314. package/lib/services/CompatibilityService.js.map +1 -0
  315. package/lib/services/ConfigureMode.d.ts +85 -0
  316. package/lib/services/ConfigureMode.js +390 -0
  317. package/lib/services/ConfigureMode.js.map +1 -0
  318. package/lib/services/ContactPointService.d.ts +111 -0
  319. package/lib/services/ContactPointService.js +286 -0
  320. package/lib/services/ContactPointService.js.map +1 -0
  321. package/lib/services/DataAvailabilityService.d.ts +81 -0
  322. package/lib/services/DataAvailabilityService.js +128 -0
  323. package/lib/services/DataAvailabilityService.js.map +1 -0
  324. package/lib/services/DefinitionFieldGenerationService.d.ts +309 -0
  325. package/lib/services/DefinitionFieldGenerationService.js +795 -0
  326. package/lib/services/DefinitionFieldGenerationService.js.map +1 -0
  327. package/lib/services/DefinitionQueryBuilder.d.ts +59 -0
  328. package/lib/services/DefinitionQueryBuilder.js +234 -0
  329. package/lib/services/DefinitionQueryBuilder.js.map +1 -0
  330. package/lib/services/ObjectDescribeService.d.ts +436 -0
  331. package/lib/services/ObjectDescribeService.js +869 -0
  332. package/lib/services/ObjectDescribeService.js.map +1 -0
  333. package/lib/services/ObjectFilteringService.d.ts +400 -0
  334. package/lib/services/ObjectFilteringService.js +878 -0
  335. package/lib/services/ObjectFilteringService.js.map +1 -0
  336. package/lib/services/ObjectListCommandService.d.ts +429 -0
  337. package/lib/services/ObjectListCommandService.js +873 -0
  338. package/lib/services/ObjectListCommandService.js.map +1 -0
  339. package/lib/services/ObjectListService.d.ts +201 -0
  340. package/lib/services/ObjectListService.js +345 -0
  341. package/lib/services/ObjectListService.js.map +1 -0
  342. package/lib/services/OrgInfoService.d.ts +485 -0
  343. package/lib/services/OrgInfoService.js +1122 -0
  344. package/lib/services/OrgInfoService.js.map +1 -0
  345. package/lib/services/PollingService.d.ts +105 -0
  346. package/lib/services/PollingService.js +117 -0
  347. package/lib/services/PollingService.js.map +1 -0
  348. package/lib/services/ProfileRequestService.d.ts +186 -0
  349. package/lib/services/ProfileRequestService.js +555 -0
  350. package/lib/services/ProfileRequestService.js.map +1 -0
  351. package/lib/services/ProfilingDefinitionService.d.ts +535 -0
  352. package/lib/services/ProfilingDefinitionService.js +981 -0
  353. package/lib/services/ProfilingDefinitionService.js.map +1 -0
  354. package/lib/services/ProfilingExecutionService.d.ts +122 -0
  355. package/lib/services/ProfilingExecutionService.js +320 -0
  356. package/lib/services/ProfilingExecutionService.js.map +1 -0
  357. package/lib/services/ProfilingSummaryService.d.ts +292 -0
  358. package/lib/services/ProfilingSummaryService.js +685 -0
  359. package/lib/services/ProfilingSummaryService.js.map +1 -0
  360. package/lib/services/RecordTypeService.d.ts +129 -0
  361. package/lib/services/RecordTypeService.js +284 -0
  362. package/lib/services/RecordTypeService.js.map +1 -0
  363. package/lib/services/SFDMUService.d.ts +17 -3
  364. package/lib/services/SFDMUService.js +49 -16
  365. package/lib/services/SFDMUService.js.map +1 -1
  366. package/lib/services/TabDetectionService.d.ts +105 -0
  367. package/lib/services/TabDetectionService.js +206 -0
  368. package/lib/services/TabDetectionService.js.map +1 -0
  369. package/lib/services/UnconfigureMode.d.ts +74 -0
  370. package/lib/services/UnconfigureMode.js +378 -0
  371. package/lib/services/UnconfigureMode.js.map +1 -0
  372. package/lib/services/UserConfigurationService.d.ts +155 -0
  373. package/lib/services/UserConfigurationService.js +573 -0
  374. package/lib/services/UserConfigurationService.js.map +1 -0
  375. package/lib/services/UserConfigurationTypes.d.ts +181 -0
  376. package/lib/services/UserConfigurationTypes.js +14 -0
  377. package/lib/services/UserConfigurationTypes.js.map +1 -0
  378. package/lib/services/UserReadinessService.d.ts +330 -0
  379. package/lib/services/UserReadinessService.js +831 -0
  380. package/lib/services/UserReadinessService.js.map +1 -0
  381. package/lib/services/constants.d.ts +53 -0
  382. package/lib/services/constants.js +71 -0
  383. package/lib/services/constants.js.map +1 -0
  384. package/lib/services/namespace-constants.d.ts +1 -0
  385. package/lib/services/namespace-constants.js +11 -0
  386. package/lib/services/namespace-constants.js.map +1 -0
  387. package/lib/services/validation.d.ts +47 -0
  388. package/lib/services/validation.js +119 -0
  389. package/lib/services/validation.js.map +1 -0
  390. package/lib/utils/batch-processor.d.ts +13 -0
  391. package/lib/utils/batch-processor.js +39 -0
  392. package/lib/utils/batch-processor.js.map +1 -0
  393. package/lib/utils/formatting/availability-grid.d.ts +81 -0
  394. package/lib/utils/formatting/availability-grid.js +94 -0
  395. package/lib/utils/formatting/availability-grid.js.map +1 -0
  396. package/lib/utils/formatting/business-process-grid.d.ts +51 -0
  397. package/lib/utils/formatting/business-process-grid.js +58 -0
  398. package/lib/utils/formatting/business-process-grid.js.map +1 -0
  399. package/lib/utils/formatting/command-display.d.ts +154 -0
  400. package/lib/utils/formatting/command-display.js +154 -0
  401. package/lib/utils/formatting/command-display.js.map +1 -0
  402. package/lib/utils/formatting/definition-create-display.d.ts +118 -0
  403. package/lib/utils/formatting/definition-create-display.js +231 -0
  404. package/lib/utils/formatting/definition-create-display.js.map +1 -0
  405. package/lib/utils/formatting/empty-states.d.ts +35 -0
  406. package/lib/utils/formatting/empty-states.js +70 -0
  407. package/lib/utils/formatting/empty-states.js.map +1 -0
  408. package/lib/utils/formatting/errors.d.ts +33 -0
  409. package/lib/utils/formatting/errors.js +72 -0
  410. package/lib/utils/formatting/errors.js.map +1 -0
  411. package/lib/utils/formatting/field-types.d.ts +32 -0
  412. package/lib/utils/formatting/field-types.js +88 -0
  413. package/lib/utils/formatting/field-types.js.map +1 -0
  414. package/lib/utils/formatting/index.d.ts +29 -0
  415. package/lib/utils/formatting/index.js +28 -0
  416. package/lib/utils/formatting/index.js.map +1 -0
  417. package/lib/utils/formatting/indicators.d.ts +113 -0
  418. package/lib/utils/formatting/indicators.js +161 -0
  419. package/lib/utils/formatting/indicators.js.map +1 -0
  420. package/lib/utils/formatting/loading-messages.d.ts +37 -0
  421. package/lib/utils/formatting/loading-messages.js +50 -0
  422. package/lib/utils/formatting/loading-messages.js.map +1 -0
  423. package/lib/utils/formatting/namespace-display.d.ts +31 -0
  424. package/lib/utils/formatting/namespace-display.js +64 -0
  425. package/lib/utils/formatting/namespace-display.js.map +1 -0
  426. package/lib/utils/formatting/numbers.d.ts +73 -0
  427. package/lib/utils/formatting/numbers.js +187 -0
  428. package/lib/utils/formatting/numbers.js.map +1 -0
  429. package/lib/utils/formatting/object-describe-display.d.ts +114 -0
  430. package/lib/utils/formatting/object-describe-display.js +440 -0
  431. package/lib/utils/formatting/object-describe-display.js.map +1 -0
  432. package/lib/utils/formatting/object-list-display.d.ts +213 -0
  433. package/lib/utils/formatting/object-list-display.js +672 -0
  434. package/lib/utils/formatting/object-list-display.js.map +1 -0
  435. package/lib/utils/formatting/org-identity.d.ts +15 -0
  436. package/lib/utils/formatting/org-identity.js +28 -0
  437. package/lib/utils/formatting/org-identity.js.map +1 -0
  438. package/lib/utils/formatting/record-age-grid.d.ts +41 -0
  439. package/lib/utils/formatting/record-age-grid.js +56 -0
  440. package/lib/utils/formatting/record-age-grid.js.map +1 -0
  441. package/lib/utils/formatting/sections.d.ts +108 -0
  442. package/lib/utils/formatting/sections.js +150 -0
  443. package/lib/utils/formatting/sections.js.map +1 -0
  444. package/lib/utils/formatting/tables.d.ts +90 -0
  445. package/lib/utils/formatting/tables.js +113 -0
  446. package/lib/utils/formatting/tables.js.map +1 -0
  447. package/lib/utils/formatting/user-details-display.d.ts +101 -0
  448. package/lib/utils/formatting/user-details-display.js +425 -0
  449. package/lib/utils/formatting/user-details-display.js.map +1 -0
  450. package/lib/utils/pagination/index.d.ts +11 -0
  451. package/lib/utils/pagination/index.js +18 -0
  452. package/lib/utils/pagination/index.js.map +1 -0
  453. package/lib/utils/pagination/keypress-reader.d.ts +20 -0
  454. package/lib/utils/pagination/keypress-reader.js +63 -0
  455. package/lib/utils/pagination/keypress-reader.js.map +1 -0
  456. package/lib/utils/pagination/paginate-output.d.ts +48 -0
  457. package/lib/utils/pagination/paginate-output.js +136 -0
  458. package/lib/utils/pagination/paginate-output.js.map +1 -0
  459. package/messages/compatibility.check.md +71 -0
  460. package/messages/cuneiform.access.md +138 -0
  461. package/messages/definition.create.md +511 -0
  462. package/messages/definition.export.md +56 -13
  463. package/messages/definition.get.md +147 -0
  464. package/messages/definition.import.md +35 -18
  465. package/messages/definition.list.md +264 -0
  466. package/messages/definition.purge.md +318 -0
  467. package/messages/definition.update.md +118 -0
  468. package/messages/mcp.serve.md +66 -0
  469. package/messages/object.describe.md +201 -0
  470. package/messages/object.list.md +443 -0
  471. package/messages/org.details.md +386 -0
  472. package/messages/org.reset.md +71 -0
  473. package/messages/profile.md +231 -0
  474. package/messages/profile.request.cancel.md +143 -0
  475. package/messages/profile.request.delete.md +139 -0
  476. package/messages/profile.request.list.md +89 -0
  477. package/messages/summary.purge.md +218 -0
  478. package/messages/summary.reprofile.md +150 -0
  479. package/messages/summary.stop.md +157 -0
  480. package/messages/user.details.md +501 -0
  481. package/oclif.lock +1954 -4859
  482. package/oclif.manifest.json +2697 -82
  483. package/package.json +89 -18
  484. package/lib/commands/cuneiform/about.d.ts +0 -13
  485. package/lib/commands/cuneiform/about.js +0 -26
  486. package/lib/commands/cuneiform/about.js.map +0 -1
  487. package/lib/commands/hello/world.d.ts +0 -14
  488. package/lib/commands/hello/world.js +0 -27
  489. package/lib/commands/hello/world.js.map +0 -1
  490. package/lib/index.d.ts +0 -2
  491. package/lib/index.js +0 -2
  492. package/lib/index.js.map +0 -1
  493. package/messages/cuneiform.about.md +0 -19
  494. package/messages/hello.world.md +0 -29
@@ -1,7 +1,9 @@
1
1
  /*
2
- * Copyright (c) 2026, PeerNova Inc. All rights reserved.
3
- * SPDX-License-Identifier: BSD-3-Clause
4
- * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
2
+ * Copyright (c) 2026, PeerNova, Inc. All Rights Reserved.
3
+ * PROPRIETARY AND CONFIDENTIAL. Unauthorized copying, modification,
4
+ * or distribution is strictly prohibited. Use is governed by the
5
+ * Master Subscription Agreement (MSA) between PeerNova, Inc. and the
6
+ * licensee. See LICENSE file in the repo root.
5
7
  */
6
8
  import * as fs from 'node:fs';
7
9
  import * as os from 'node:os';
@@ -9,15 +11,18 @@ import * as path from 'node:path';
9
11
  import { SfError } from '@salesforce/core';
10
12
  /**
11
13
  * Error codes specific to import operations.
14
+ *
15
+ * These codes are returned in ServiceResult.errorCode when import fails.
16
+ * User action: Check the corresponding message for resolution steps.
12
17
  */
13
18
  export const ImportErrorCodes = {
14
- /** Source directory does not exist */
19
+ /** Source directory does not exist. User should verify the --source path. */
15
20
  SOURCE_NOT_FOUND: 'IMPORT_SOURCE_NOT_FOUND',
16
- /** Source directory is missing required files */
21
+ /** Source directory is missing pnova__Profiling_Definition__c.csv. User should verify export was successful. */
17
22
  INVALID_SOURCE: 'IMPORT_INVALID_SOURCE',
18
- /** Failed to write config file */
23
+ /** Failed to write temporary export.json config. Check disk space and permissions. */
19
24
  CONFIG_WRITE_FAILED: 'IMPORT_CONFIG_WRITE_FAILED',
20
- /** Import operation failed */
25
+ /** SFDMU import operation failed. Check SFDMU output for details. */
21
26
  IMPORT_FAILED: 'IMPORT_FAILED',
22
27
  };
23
28
  /**
@@ -34,15 +39,31 @@ export const ImportErrorCodes = {
34
39
  * targetOrg: 'myOrg',
35
40
  * sourceDir: './backup/definitions',
36
41
  * operation: 'Upsert',
37
- * dryRun: true
42
+ * simulation: true
38
43
  * });
39
44
  * ```
40
45
  */
41
46
  export class DefinitionImportOperation {
42
- /** SFDMU query for profiling definitions (used in config generation) */
43
- static DEFINITION_QUERY = 'SELECT Id, Name, RecordTypeId, pnova__Agg_Status__c, pnova__Agg_StatusStatistical__c, pnova__Aud_VersionCRMBase__c, pnova__Aud_VersionCRMEnterprise__c, pnova__Aud_VersionDCBase__c, pnova__Profiling_IsProfileForAllFields__c, pnova__Profiling_IsProfileForAllRecords__c, pnova__Prop_Category__c, pnova__Prop_Description__c, pnova__Prop_Filter_JSON_SetA__c, pnova__Prop_Filter_JSON_SetB__c, pnova__Prop_Filter_SetA__c, pnova__Prop_Filter_SetB__c, pnova__Prop_InsightGroups_JSON__c, pnova__Prop_IsActive__c, pnova__Prop_IsFiltered_SetA__c, pnova__Prop_IsFiltered_SetB__c, pnova__Prop_IsNotificationEnabled__c, pnova__Prop_IsProfilingLaunchedFromWizard__c, pnova__Prop_KpiBusinessImpact__c, pnova__Prop_KpiBusinessImpact_JSON__c, pnova__Prop_KpiDataQuality__c, pnova__Prop_KpiDataQuality_JSON__c, pnova__Prop_AreKpisDefined__c, pnova__Prop_LicenseViolations__c, pnova__Prop_Name__c, pnova__Prop_SelectedFields__c, pnova__Prop_SelectedFields_JSON__c, pnova__Prop_SelectedFieldsCount__c, pnova__Prop_SObjectApiName__c, pnova__Prop_SObjectFullApiName__c, pnova__Prop_SObjectLabel__c, pnova__Prop_SObjectRecordTypeId__c, pnova__Prop_SObjectRecordTypeLabel__c FROM pnova__Profiling_Definition__c';
47
+ /**
48
+ * SFDMU query for profiling definitions (used in config generation).
49
+ * Includes formula fields (PropFx_*) for CSV compatibility with export - these are
50
+ * read-only and will be ignored by Salesforce during import (computed automatically).
51
+ *
52
+ * CLI-3039: Removed pnova__Aud_VersionDCBase__c and pnova__Prop_LicenseViolations__c
53
+ * — both are absent from packaging/v4.12.0 and SFDMU was logging "Missing in the
54
+ * Target and will be excluded from the migration" warnings on every import.
55
+ */
56
+ static DEFINITION_QUERY = 'SELECT Id, Name, RecordTypeId, pnova__Agg_Status__c, pnova__Agg_StatusStatistical__c, pnova__Aud_VersionCRMBase__c, pnova__Aud_VersionCRMEnterprise__c, pnova__Prop_IsProfilingAllFieldsEnabled__c, pnova__Prop_Category__c, pnova__Prop_Description__c, pnova__Prop_Filter_JSON_SetA__c, pnova__Prop_Filter_JSON_SetB__c, pnova__Prop_Filter_SetA__c, pnova__Prop_Filter_SetB__c, pnova__Prop_InsightGroups_JSON__c, pnova__Prop_IsActive__c, pnova__Prop_IsFiltered_SetA__c, pnova__Prop_IsFiltered_SetB__c, pnova__Prop_IsNotificationEnabled__c, pnova__Prop_IsProfilingLaunchedFromWizard__c, pnova__Prop_KpiBusinessImpact__c, pnova__Prop_KpiBusinessImpact_JSON__c, pnova__Prop_KpiDataQuality__c, pnova__Prop_KpiDataQuality_JSON__c, pnova__Prop_AreKpisDefined__c, pnova__Prop_Name__c, pnova__Prop_SelectedFields__c, pnova__Prop_SelectedFields_JSON__c, pnova__Prop_SelectedFieldsCount__c, pnova__Prop_SObjectApiName__c, pnova__Prop_SObjectFullApiName__c, pnova__Prop_SObjectLabel__c, pnova__Prop_SObjectRecordTypeId__c, pnova__Prop_SObjectRecordTypeLabel__c, pnova__PropFx_IsMetadataProfilingOnly__c, pnova__PropFx_IsProfilingAllRecords__c FROM pnova__Profiling_Definition__c';
44
57
  /** Expected CSV file name */
45
58
  static DEFINITION_CSV = 'pnova__Profiling_Definition__c.csv';
59
+ /**
60
+ * Columns stripped from the definition CSV before SFDMU import.
61
+ * These carry source-org profiling history and must start fresh in the target.
62
+ */
63
+ static IMPORT_CLEAR_COLUMNS = [
64
+ 'pnova__Agg_Status__c',
65
+ 'pnova__Agg_StatusStatistical__c',
66
+ ];
46
67
  sfdmuService;
47
68
  logger;
48
69
  /**
@@ -58,14 +79,25 @@ export class DefinitionImportOperation {
58
79
  /**
59
80
  * Builds the SFDMU import configuration.
60
81
  *
82
+ * Creates an export.json config structure for SFDMU import operations.
83
+ * Note: SFDMU always reads 'export.json' regardless of operation direction.
84
+ *
85
+ * RecordType is declared first as a Readonly reference object so that SFDMU can
86
+ * resolve the RecordType.$$DeveloperName$NamespacePrefix$SobjectType lookup column
87
+ * from the RecordType.csv sidecar file. Without this entry, SFDMU finds the sidecar
88
+ * but does not include RecordType in its import plan, leaving RecordTypeId as #N/A
89
+ * and causing Salesforce to reject the insert.
90
+ *
61
91
  * @param operation - The import operation type (Insert or Upsert)
62
- * @returns SFDMU configuration object
92
+ * @returns Config object with promptOnMissingParentObjects=false and objects array
63
93
  */
64
94
  static buildSFDMUConfig(operation) {
65
95
  return {
66
96
  promptOnMissingParentObjects: false,
67
97
  objects: [
68
98
  {
99
+ // RecordTypeId is expected to be present directly in the source CSV (as exported by
100
+ // sf cuneiform definition export). SFDMU uses it as-is — no composite key lookup.
69
101
  query: DefinitionImportOperation.DEFINITION_QUERY,
70
102
  operation,
71
103
  externalId: 'Name',
@@ -73,6 +105,105 @@ export class DefinitionImportOperation {
73
105
  ],
74
106
  };
75
107
  }
108
+ /**
109
+ * Counts data rows in the source definition CSV.
110
+ *
111
+ * SFDMU import also processes the RecordType.csv sidecar used for lookup resolution,
112
+ * so its "Processed N records" log lines cover multiple objects. Reading the source CSV
113
+ * directly gives the exact definition count (CLI-3140).
114
+ *
115
+ * Returns 0 if the file is absent or unreadable.
116
+ */
117
+ static countCsvDataRows(csvPath) {
118
+ try {
119
+ const content = fs.readFileSync(csvPath, 'utf-8');
120
+ return content.split('\n').filter((line, index) => index > 0 && line.trim().length > 0).length;
121
+ }
122
+ catch {
123
+ return 0;
124
+ }
125
+ }
126
+ /**
127
+ * Parses a single CSV line into fields, handling RFC-4180 quoting and a leading UTF-8 BOM
128
+ * on the first field of the first line (written by SFDMU).
129
+ */
130
+ static parseCSVLine(line) {
131
+ const fields = [];
132
+ let current = '';
133
+ let inQuotes = false;
134
+ let i = 0;
135
+ // Strip BOM from the very first character if present
136
+ if (line.startsWith('')) {
137
+ i = 1;
138
+ }
139
+ while (i < line.length) {
140
+ const ch = line[i];
141
+ if (inQuotes) {
142
+ if (ch === '"') {
143
+ if (line[i + 1] === '"') {
144
+ current += '"';
145
+ i += 2;
146
+ }
147
+ else {
148
+ inQuotes = false;
149
+ i++;
150
+ }
151
+ }
152
+ else {
153
+ current += ch;
154
+ i++;
155
+ }
156
+ }
157
+ else if (ch === '"') {
158
+ inQuotes = true;
159
+ i++;
160
+ }
161
+ else if (ch === ',') {
162
+ fields.push(current);
163
+ current = '';
164
+ i++;
165
+ }
166
+ else {
167
+ current += ch;
168
+ i++;
169
+ }
170
+ }
171
+ fields.push(current);
172
+ return fields;
173
+ }
174
+ /** Serializes fields back to a CSV line, quoting every field for safety. */
175
+ static serializeCSVLine(fields) {
176
+ return fields.map((f) => `"${f.replace(/"/g, '""')}"`).join(',');
177
+ }
178
+ /**
179
+ * Removes the specified columns from CSV content (header + corresponding value in every row).
180
+ * Preserves the original line endings. Returns the original content unchanged if no matching
181
+ * columns are found.
182
+ */
183
+ static stripColumns(csvContent, columnsToStrip) {
184
+ const normalized = csvContent.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
185
+ const lines = normalized.split('\n');
186
+ if (lines.length === 0)
187
+ return csvContent;
188
+ const headerFields = DefinitionImportOperation.parseCSVLine(lines[0]);
189
+ const stripSet = new Set(columnsToStrip);
190
+ const keepIndices = headerFields.map((_, idx) => idx).filter((idx) => !stripSet.has(headerFields[idx]));
191
+ if (keepIndices.length === headerFields.length) {
192
+ return csvContent;
193
+ }
194
+ const resultLines = [];
195
+ for (let i = 0; i < lines.length; i++) {
196
+ const line = lines[i];
197
+ if (i === 0 || line.trim().length > 0) {
198
+ const rowFields = DefinitionImportOperation.parseCSVLine(line);
199
+ resultLines.push(DefinitionImportOperation.serializeCSVLine(keepIndices.map((idx) => rowFields[idx] ?? '')));
200
+ }
201
+ else {
202
+ resultLines.push('');
203
+ }
204
+ }
205
+ return resultLines.join('\n');
206
+ }
76
207
  /**
77
208
  * Executes the import operation.
78
209
  *
@@ -90,7 +221,7 @@ export class DefinitionImportOperation {
90
221
  data: {
91
222
  definitionsImported: 0,
92
223
  sourceDir,
93
- dryRun: options.dryRun ?? false,
224
+ simulation: options.simulation ?? false,
94
225
  },
95
226
  errorCode: ImportErrorCodes.SOURCE_NOT_FOUND,
96
227
  message: `Source directory does not exist: ${sourceDir}`,
@@ -104,12 +235,33 @@ export class DefinitionImportOperation {
104
235
  data: {
105
236
  definitionsImported: 0,
106
237
  sourceDir,
107
- dryRun: options.dryRun ?? false,
238
+ simulation: options.simulation ?? false,
108
239
  },
109
240
  errorCode: ImportErrorCodes.INVALID_SOURCE,
110
241
  message: `Source directory is missing required file: ${DefinitionImportOperation.DEFINITION_CSV}`,
111
242
  };
112
243
  }
244
+ // Simulation mode: validate CSV structure and count data rows without calling SFDMU.
245
+ // SFDMU does not support a --simulation flag, so simulation is handled here at the
246
+ // operation layer. This validates the source directory, counts importable rows, and
247
+ // returns a preview result without modifying any org data.
248
+ if (options.simulation) {
249
+ const csvContent = fs.readFileSync(csvPath, 'utf-8');
250
+ // Count data rows (exclude header line and empty trailing lines)
251
+ const dataRows = csvContent.split('\n').filter((line, index) => index > 0 && line.trim().length > 0);
252
+ return {
253
+ success: true,
254
+ data: {
255
+ definitionsImported: dataRows.length,
256
+ sourceDir,
257
+ simulation: true,
258
+ },
259
+ message: `Simulation completed — ${dataRows.length} definitions would be imported to ${options.targetOrg}`,
260
+ metadata: {
261
+ duration: Date.now() - startTime,
262
+ },
263
+ };
264
+ }
113
265
  // Create temp directory for SFDMU import
114
266
  // SFDMU always reads from 'export.json', so we use a temp dir to avoid
115
267
  // mutating the user's source directory (which may contain their export config)
@@ -126,21 +278,27 @@ export class DefinitionImportOperation {
126
278
  this.logger?.log(`Copied CSV to: ${destPath}`);
127
279
  }
128
280
  }
281
+ // Strip runtime-state columns on Insert only — Upsert preserves existing data so
282
+ // the status values in the CSV are intentional (the caller owns them).
283
+ // On Insert the target starts fresh, so source-org profiling history must not be written in.
284
+ const effectiveOperation = options.operation ?? 'Insert';
285
+ const defCsvPath = path.join(tempDir, DefinitionImportOperation.DEFINITION_CSV);
286
+ if (effectiveOperation === 'Insert' && fs.existsSync(defCsvPath)) {
287
+ const stripped = DefinitionImportOperation.stripColumns(fs.readFileSync(defCsvPath, 'utf-8'), DefinitionImportOperation.IMPORT_CLEAR_COLUMNS);
288
+ fs.writeFileSync(defCsvPath, stripped, 'utf-8');
289
+ }
129
290
  // Generate import configuration in temp directory
130
291
  // Note: SFDMU always reads 'export.json' from the config path, regardless of operation type
131
- const config = DefinitionImportOperation.buildSFDMUConfig(options.operation ?? 'Insert');
292
+ const config = DefinitionImportOperation.buildSFDMUConfig(effectiveOperation);
132
293
  const configPath = path.join(tempDir, 'export.json');
133
294
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
134
295
  this.logger?.log(`Wrote SFDMU config to: ${configPath}`);
135
- // Build SFDMU options pointing to temp directory
296
+ // Build SFDMU options pointing to temp directory (simulation not passed — handled above)
136
297
  const sfdmuOptions = {
137
298
  targetOrg: options.targetOrg,
138
299
  configPath: tempDir,
139
300
  };
140
301
  // Execute SFDMU import
141
- // Note: For dry-run, we'd ideally use SFDMU's --simulation flag
142
- // but that requires SFDMU version support check. For now, we execute
143
- // the actual import. The dryRun flag is preserved for future enhancement.
144
302
  const sfdmuResult = await this.sfdmuService.runImport(sfdmuOptions);
145
303
  if (!sfdmuResult.success) {
146
304
  return {
@@ -148,7 +306,7 @@ export class DefinitionImportOperation {
148
306
  data: {
149
307
  definitionsImported: 0,
150
308
  sourceDir,
151
- dryRun: options.dryRun ?? false,
309
+ simulation: options.simulation ?? false,
152
310
  sfdmuOutput: sfdmuResult.data.stderr,
153
311
  },
154
312
  errorCode: sfdmuResult.errorCode ?? ImportErrorCodes.IMPORT_FAILED,
@@ -158,15 +316,18 @@ export class DefinitionImportOperation {
158
316
  },
159
317
  };
160
318
  }
319
+ // Count definitions from source CSV — more reliable than parsing SFDMU output
320
+ // which also counts RecordType records processed for lookup resolution (CLI-3140).
321
+ const definitionsImported = DefinitionImportOperation.countCsvDataRows(csvPath);
161
322
  return {
162
323
  success: true,
163
324
  data: {
164
- definitionsImported: sfdmuResult.data.recordsProcessed ?? 0,
325
+ definitionsImported,
165
326
  sourceDir,
166
- dryRun: options.dryRun ?? false,
327
+ simulation: options.simulation ?? false,
167
328
  sfdmuOutput: sfdmuResult.data.stdout,
168
329
  },
169
- message: `Successfully imported ${sfdmuResult.data.recordsProcessed ?? 0} definitions to ${options.targetOrg}`,
330
+ message: `Successfully imported ${definitionsImported} definitions into ${options.targetOrg}`,
170
331
  warnings: sfdmuResult.warnings,
171
332
  metadata: {
172
333
  duration: Date.now() - startTime,
@@ -174,15 +335,7 @@ export class DefinitionImportOperation {
174
335
  };
175
336
  }
176
337
  finally {
177
- // Clean up temp directory
178
- try {
179
- fs.rmSync(tempDir, { recursive: true, force: true });
180
- this.logger?.log(`Cleaned up temp directory: ${tempDir}`);
181
- }
182
- catch {
183
- // Ignore cleanup errors - temp dir will be cleaned up by OS eventually
184
- this.logger?.log(`Warning: Failed to clean up temp directory: ${tempDir}`);
185
- }
338
+ this.cleanupTempDir(tempDir);
186
339
  }
187
340
  }
188
341
  catch (error) {
@@ -190,5 +343,15 @@ export class DefinitionImportOperation {
190
343
  throw new SfError(`Import operation failed: ${errorMessage}`, 'ImportOperationError');
191
344
  }
192
345
  }
346
+ /** Remove the temp directory, logging on failure instead of throwing (to avoid shadowing real errors in finally blocks). */
347
+ cleanupTempDir(tempDir) {
348
+ try {
349
+ fs.rmSync(tempDir, { recursive: true, force: true });
350
+ }
351
+ catch (cleanupError) {
352
+ /* c8 ignore next 5 -- rmSync with force:true rarely throws; ESM modules cannot be stubbed to simulate it */
353
+ this.logger?.log(`Warning: failed to clean up temp directory ${tempDir}: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
354
+ }
355
+ }
193
356
  }
194
357
  //# sourceMappingURL=DefinitionImportOperation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DefinitionImportOperation.js","sourceRoot":"","sources":["../../src/operations/DefinitionImportOperation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AA8C3C;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,sCAAsC;IACtC,gBAAgB,EAAE,yBAAyB;IAC3C,iDAAiD;IACjD,cAAc,EAAE,uBAAuB;IACvC,kCAAkC;IA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CAAC"}
@@ -0,0 +1,66 @@
1
+ import type { ServiceResult } from '../models/service-result.js';
2
+ import type { ProfilingDefinitionService, DefinitionListFilter, DefinitionListPagination, DefinitionListSort, DefinitionListResult } from '../services/ProfilingDefinitionService.js';
3
+ /**
4
+ * Options for the definition list operation.
5
+ *
6
+ * Maps directly to the DefinitionListOptions accepted by ProfilingDefinitionService.listDefinitions().
7
+ * The operation acts as a thin orchestration layer between command flags and the service.
8
+ */
9
+ export type ListOptions = {
10
+ /** Filter criteria for narrowing the definition list */
11
+ filter?: DefinitionListFilter;
12
+ /** Pagination parameters (limit, offset) */
13
+ pagination?: DefinitionListPagination;
14
+ /** Sort specification (field, direction) */
15
+ sort?: DefinitionListSort;
16
+ };
17
+ /**
18
+ * Error codes specific to list operations.
19
+ */
20
+ export declare const ListErrorCodes: {
21
+ /** Service query failed (non-exception failure) */
22
+ readonly LIST_FAILED: "LIST_FAILED";
23
+ /** Operation failed unexpectedly (exception) */
24
+ readonly OPERATION_FAILED: "LIST_OPERATION_FAILED";
25
+ };
26
+ /**
27
+ * Orchestrates listing of profiling definitions.
28
+ *
29
+ * Follows the 4-layer architecture: Command -> Operation -> Service -> API
30
+ * This operation layer handles:
31
+ * 1. Accepts parsed command flags as ListOptions
32
+ * 2. Delegates to ProfilingDefinitionService.listDefinitions()
33
+ * 3. Returns ServiceResult<DefinitionListResult> with timing metadata
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const operation = new DefinitionListOperation(definitionService);
38
+ * const result = await operation.execute({
39
+ * filter: { status: 'active', objects: ['Account'] },
40
+ * pagination: { limit: 10, offset: 0 },
41
+ * sort: { field: 'name', direction: 'asc' }
42
+ * });
43
+ * ```
44
+ */
45
+ export declare class DefinitionListOperation {
46
+ private readonly definitionService;
47
+ private readonly logger?;
48
+ /**
49
+ * Creates a new DefinitionListOperation.
50
+ *
51
+ * @param definitionService - The ProfilingDefinitionService instance for querying definitions
52
+ * @param logger - Optional logger for debug output
53
+ */
54
+ constructor(definitionService: ProfilingDefinitionService, logger?: Console);
55
+ /**
56
+ * Executes the definition list operation.
57
+ *
58
+ * Returns a ServiceResult with success=false and one of the following error codes on failure:
59
+ * - LIST_FAILED: When the underlying service query returns a failure result
60
+ * - OPERATION_FAILED: When an unexpected exception occurs
61
+ *
62
+ * @param options - List options (filter, pagination, sort)
63
+ * @returns ServiceResult containing DefinitionListResult or error details
64
+ */
65
+ execute(options: ListOptions): Promise<ServiceResult<DefinitionListResult>>;
66
+ }
@@ -0,0 +1,108 @@
1
+ /*
2
+ * Copyright (c) 2026, PeerNova, Inc. All Rights Reserved.
3
+ * PROPRIETARY AND CONFIDENTIAL. Unauthorized copying, modification,
4
+ * or distribution is strictly prohibited. Use is governed by the
5
+ * Master Subscription Agreement (MSA) between PeerNova, Inc. and the
6
+ * licensee. See LICENSE file in the repo root.
7
+ */
8
+ /**
9
+ * Error codes specific to list operations.
10
+ */
11
+ export const ListErrorCodes = {
12
+ /** Service query failed (non-exception failure) */
13
+ LIST_FAILED: 'LIST_FAILED',
14
+ /** Operation failed unexpectedly (exception) */
15
+ OPERATION_FAILED: 'LIST_OPERATION_FAILED',
16
+ };
17
+ /**
18
+ * Orchestrates listing of profiling definitions.
19
+ *
20
+ * Follows the 4-layer architecture: Command -> Operation -> Service -> API
21
+ * This operation layer handles:
22
+ * 1. Accepts parsed command flags as ListOptions
23
+ * 2. Delegates to ProfilingDefinitionService.listDefinitions()
24
+ * 3. Returns ServiceResult<DefinitionListResult> with timing metadata
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * const operation = new DefinitionListOperation(definitionService);
29
+ * const result = await operation.execute({
30
+ * filter: { status: 'active', objects: ['Account'] },
31
+ * pagination: { limit: 10, offset: 0 },
32
+ * sort: { field: 'name', direction: 'asc' }
33
+ * });
34
+ * ```
35
+ */
36
+ export class DefinitionListOperation {
37
+ definitionService;
38
+ logger;
39
+ /**
40
+ * Creates a new DefinitionListOperation.
41
+ *
42
+ * @param definitionService - The ProfilingDefinitionService instance for querying definitions
43
+ * @param logger - Optional logger for debug output
44
+ */
45
+ constructor(definitionService, logger) {
46
+ this.definitionService = definitionService;
47
+ this.logger = logger;
48
+ }
49
+ /**
50
+ * Executes the definition list operation.
51
+ *
52
+ * Returns a ServiceResult with success=false and one of the following error codes on failure:
53
+ * - LIST_FAILED: When the underlying service query returns a failure result
54
+ * - OPERATION_FAILED: When an unexpected exception occurs
55
+ *
56
+ * @param options - List options (filter, pagination, sort)
57
+ * @returns ServiceResult containing DefinitionListResult or error details
58
+ */
59
+ async execute(options) {
60
+ const startTime = Date.now();
61
+ const emptyResult = {
62
+ definitions: [],
63
+ totalCount: 0,
64
+ summary: { activeCount: 0, inactiveCount: 0, profiledCount: 0, notProfiledCount: 0 },
65
+ };
66
+ try {
67
+ this.logger?.log('Starting definition list operation');
68
+ const listResult = await this.definitionService.listDefinitions({
69
+ filter: options.filter,
70
+ pagination: options.pagination,
71
+ sort: options.sort,
72
+ });
73
+ const duration = Date.now() - startTime;
74
+ if (!listResult.success) {
75
+ const errorMessage = listResult.message ?? 'Unknown error';
76
+ this.logger?.log(`Definition list failed: ${errorMessage}`);
77
+ return {
78
+ success: false,
79
+ data: emptyResult,
80
+ errorCode: ListErrorCodes.LIST_FAILED,
81
+ message: listResult.message ?? 'Definition list query failed',
82
+ metadata: { duration },
83
+ };
84
+ }
85
+ const { definitions, totalCount, summary } = listResult.data;
86
+ this.logger?.log(`Definition list completed: ${String(definitions.length)} definitions found`);
87
+ return {
88
+ success: true,
89
+ data: { definitions, totalCount, summary },
90
+ message: `Found ${String(totalCount)} definitions`,
91
+ metadata: { duration },
92
+ };
93
+ }
94
+ catch (error) {
95
+ const duration = Date.now() - startTime;
96
+ const errorMessage = error instanceof Error ? error.message : String(error);
97
+ this.logger?.log(`Definition list failed: ${errorMessage}`);
98
+ return {
99
+ success: false,
100
+ data: emptyResult,
101
+ errorCode: ListErrorCodes.OPERATION_FAILED,
102
+ message: `Definition list failed: ${errorMessage}`,
103
+ metadata: { duration },
104
+ };
105
+ }
106
+ }
107
+ }
108
+ //# sourceMappingURL=DefinitionListOperation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefinitionListOperation.js","sourceRoot":"","sources":["../../src/operations/DefinitionListOperation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA4BH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,mDAAmD;IACnD,WAAW,EAAE,aAAa;IAC1B,gDAAgD;IAChD,gBAAgB,EAAE,uBAAuB;CACjC,CAAC;AAEX;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,uBAAuB;IACjB,iBAAiB,CAA6B;IAC9C,MAAM,CAAW;IAElC;;;;;OAKG;IACH,YAAmB,iBAA6C,EAAE,MAAgB;QAChF,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;OASG;IACI,KAAK,CAAC,OAAO,CAAC,OAAoB;QACvC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,WAAW,GAAyB;YACxC,WAAW,EAAE,EAAE;YACf,UAAU,EAAE,CAAC;YACb,OAAO,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE;SACrF,CAAC;QAEF,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,oCAAoC,CAAC,CAAC;YAEvD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC;gBAC9D,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAA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