@peernova/cuneiform-sf 1.0.2 → 1.0.4-beta.10

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 (488) hide show
  1. package/LICENSE +81 -30
  2. package/README.md +168 -134
  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/lifecycle.d.ts +112 -0
  10. package/lib/adapters/lifecycle.js +94 -0
  11. package/lib/adapters/lifecycle.js.map +1 -0
  12. package/lib/adapters/rest/cache.d.ts +69 -0
  13. package/lib/adapters/rest/cache.js +133 -0
  14. package/lib/adapters/rest/cache.js.map +1 -0
  15. package/lib/adapters/rest/index.d.ts +11 -0
  16. package/lib/adapters/rest/index.js +18 -0
  17. package/lib/adapters/rest/index.js.map +1 -0
  18. package/lib/adapters/rest/profiling-rest-client.d.ts +137 -0
  19. package/lib/adapters/rest/profiling-rest-client.js +115 -0
  20. package/lib/adapters/rest/profiling-rest-client.js.map +1 -0
  21. package/lib/adapters/rest/rest-api-adapter.d.ts +393 -0
  22. package/lib/adapters/rest/rest-api-adapter.js +764 -0
  23. package/lib/adapters/rest/rest-api-adapter.js.map +1 -0
  24. package/lib/adapters/rest/types.d.ts +34 -0
  25. package/lib/adapters/rest/types.js +9 -0
  26. package/lib/adapters/rest/types.js.map +1 -0
  27. package/lib/adapters/retry.d.ts +91 -0
  28. package/lib/adapters/retry.js +215 -0
  29. package/lib/adapters/retry.js.map +1 -0
  30. package/lib/adapters/soql/cuneiform-query-builder.d.ts +418 -0
  31. package/lib/adapters/soql/cuneiform-query-builder.js +606 -0
  32. package/lib/adapters/soql/cuneiform-query-builder.js.map +1 -0
  33. package/lib/adapters/soql/soql-query-adapter.d.ts +141 -0
  34. package/lib/adapters/soql/soql-query-adapter.js +259 -0
  35. package/lib/adapters/soql/soql-query-adapter.js.map +1 -0
  36. package/lib/adapters/soql/types.d.ts +37 -0
  37. package/lib/adapters/soql/types.js +19 -0
  38. package/lib/adapters/soql/types.js.map +1 -0
  39. package/lib/adapters/testing/index.d.ts +37 -0
  40. package/lib/adapters/testing/index.js +20 -0
  41. package/lib/adapters/testing/index.js.map +1 -0
  42. package/lib/adapters/testing/mock-connection.d.ts +77 -0
  43. package/lib/adapters/testing/mock-connection.js +207 -0
  44. package/lib/adapters/testing/mock-connection.js.map +1 -0
  45. package/lib/adapters/testing/mock-logger.d.ts +29 -0
  46. package/lib/adapters/testing/mock-logger.js +57 -0
  47. package/lib/adapters/testing/mock-logger.js.map +1 -0
  48. package/lib/adapters/testing/mock-mcp-adapters.d.ts +32 -0
  49. package/lib/adapters/testing/mock-mcp-adapters.js +52 -0
  50. package/lib/adapters/testing/mock-mcp-adapters.js.map +1 -0
  51. package/lib/adapters/testing/mock-oclif-config.d.ts +22 -0
  52. package/lib/adapters/testing/mock-oclif-config.js +90 -0
  53. package/lib/adapters/testing/mock-oclif-config.js.map +1 -0
  54. package/lib/adapters/testing/mock-rest-adapter.d.ts +26 -0
  55. package/lib/adapters/testing/mock-rest-adapter.js +243 -0
  56. package/lib/adapters/testing/mock-rest-adapter.js.map +1 -0
  57. package/lib/adapters/testing/mock-salesforce-connection.d.ts +40 -0
  58. package/lib/adapters/testing/mock-salesforce-connection.js +61 -0
  59. package/lib/adapters/testing/mock-salesforce-connection.js.map +1 -0
  60. package/lib/adapters/testing/mock-soql-adapter.d.ts +30 -0
  61. package/lib/adapters/testing/mock-soql-adapter.js +120 -0
  62. package/lib/adapters/testing/mock-soql-adapter.js.map +1 -0
  63. package/lib/adapters/testing/mock-tooling-adapter.d.ts +24 -0
  64. package/lib/adapters/testing/mock-tooling-adapter.js +163 -0
  65. package/lib/adapters/testing/mock-tooling-adapter.js.map +1 -0
  66. package/lib/adapters/testing/stub-connection.d.ts +93 -0
  67. package/lib/adapters/testing/stub-connection.js +97 -0
  68. package/lib/adapters/testing/stub-connection.js.map +1 -0
  69. package/lib/adapters/testing/stub-rest-adapter.d.ts +52 -0
  70. package/lib/adapters/testing/stub-rest-adapter.js +58 -0
  71. package/lib/adapters/testing/stub-rest-adapter.js.map +1 -0
  72. package/lib/adapters/testing/stub-soql-adapter.d.ts +56 -0
  73. package/lib/adapters/testing/stub-soql-adapter.js +50 -0
  74. package/lib/adapters/testing/stub-soql-adapter.js.map +1 -0
  75. package/lib/adapters/testing/types.d.ts +71 -0
  76. package/lib/adapters/testing/types.js +9 -0
  77. package/lib/adapters/testing/types.js.map +1 -0
  78. package/lib/adapters/tooling/index.d.ts +10 -0
  79. package/lib/adapters/tooling/index.js +17 -0
  80. package/lib/adapters/tooling/index.js.map +1 -0
  81. package/lib/adapters/tooling/tooling-api-adapter.d.ts +157 -0
  82. package/lib/adapters/tooling/tooling-api-adapter.js +339 -0
  83. package/lib/adapters/tooling/tooling-api-adapter.js.map +1 -0
  84. package/lib/adapters/tooling/types.d.ts +81 -0
  85. package/lib/adapters/tooling/types.js +9 -0
  86. package/lib/adapters/tooling/types.js.map +1 -0
  87. package/lib/adapters/types.d.ts +112 -0
  88. package/lib/adapters/types.js +169 -0
  89. package/lib/adapters/types.js.map +1 -0
  90. package/lib/base/cuneiform-command.d.ts +175 -0
  91. package/lib/base/cuneiform-command.js +326 -0
  92. package/lib/base/cuneiform-command.js.map +1 -0
  93. package/lib/commands/cuneiform/compatibility/check.d.ts +43 -0
  94. package/lib/commands/cuneiform/compatibility/check.js +114 -0
  95. package/lib/commands/cuneiform/compatibility/check.js.map +1 -0
  96. package/lib/commands/cuneiform/definition/create.d.ts +120 -0
  97. package/lib/commands/cuneiform/definition/create.js +737 -0
  98. package/lib/commands/cuneiform/definition/create.js.map +1 -0
  99. package/lib/commands/cuneiform/definition/export.d.ts +57 -0
  100. package/lib/commands/cuneiform/definition/export.js +133 -0
  101. package/lib/commands/cuneiform/definition/export.js.map +1 -0
  102. package/lib/commands/cuneiform/definition/get.d.ts +86 -0
  103. package/lib/commands/cuneiform/definition/get.js +277 -0
  104. package/lib/commands/cuneiform/definition/get.js.map +1 -0
  105. package/lib/commands/cuneiform/definition/import.d.ts +54 -0
  106. package/lib/commands/cuneiform/definition/import.js +118 -0
  107. package/lib/commands/cuneiform/definition/import.js.map +1 -0
  108. package/lib/commands/cuneiform/definition/list.d.ts +110 -0
  109. package/lib/commands/cuneiform/definition/list.js +351 -0
  110. package/lib/commands/cuneiform/definition/list.js.map +1 -0
  111. package/lib/commands/cuneiform/definition/purge.d.ts +109 -0
  112. package/lib/commands/cuneiform/definition/purge.js +578 -0
  113. package/lib/commands/cuneiform/definition/purge.js.map +1 -0
  114. package/lib/commands/cuneiform/definition/update.d.ts +58 -0
  115. package/lib/commands/cuneiform/definition/update.js +209 -0
  116. package/lib/commands/cuneiform/definition/update.js.map +1 -0
  117. package/lib/commands/cuneiform/mcp/serve.d.ts +56 -0
  118. package/lib/commands/cuneiform/mcp/serve.js +109 -0
  119. package/lib/commands/cuneiform/mcp/serve.js.map +1 -0
  120. package/lib/commands/cuneiform/object/describe.d.ts +61 -0
  121. package/lib/commands/cuneiform/object/describe.js +461 -0
  122. package/lib/commands/cuneiform/object/describe.js.map +1 -0
  123. package/lib/commands/cuneiform/object/list.d.ts +123 -0
  124. package/lib/commands/cuneiform/object/list.js +264 -0
  125. package/lib/commands/cuneiform/object/list.js.map +1 -0
  126. package/lib/commands/cuneiform/org/details.d.ts +99 -0
  127. package/lib/commands/cuneiform/org/details.js +521 -0
  128. package/lib/commands/cuneiform/org/details.js.map +1 -0
  129. package/lib/commands/cuneiform/org/reset.d.ts +46 -0
  130. package/lib/commands/cuneiform/org/reset.js +135 -0
  131. package/lib/commands/cuneiform/org/reset.js.map +1 -0
  132. package/lib/commands/cuneiform/profile/request/cancel.d.ts +59 -0
  133. package/lib/commands/cuneiform/profile/request/cancel.js +202 -0
  134. package/lib/commands/cuneiform/profile/request/cancel.js.map +1 -0
  135. package/lib/commands/cuneiform/profile/request/delete.d.ts +59 -0
  136. package/lib/commands/cuneiform/profile/request/delete.js +223 -0
  137. package/lib/commands/cuneiform/profile/request/delete.js.map +1 -0
  138. package/lib/commands/cuneiform/profile/request/list.d.ts +35 -0
  139. package/lib/commands/cuneiform/profile/request/list.js +102 -0
  140. package/lib/commands/cuneiform/profile/request/list.js.map +1 -0
  141. package/lib/commands/cuneiform/profile.d.ts +93 -0
  142. package/lib/commands/cuneiform/profile.js +353 -0
  143. package/lib/commands/cuneiform/profile.js.map +1 -0
  144. package/lib/commands/cuneiform/summary/purge.d.ts +80 -0
  145. package/lib/commands/cuneiform/summary/purge.js +467 -0
  146. package/lib/commands/cuneiform/summary/purge.js.map +1 -0
  147. package/lib/commands/cuneiform/summary/reprofile.d.ts +60 -0
  148. package/lib/commands/cuneiform/summary/reprofile.js +236 -0
  149. package/lib/commands/cuneiform/summary/reprofile.js.map +1 -0
  150. package/lib/commands/cuneiform/summary/stop.d.ts +59 -0
  151. package/lib/commands/cuneiform/summary/stop.js +234 -0
  152. package/lib/commands/cuneiform/summary/stop.js.map +1 -0
  153. package/lib/commands/cuneiform/user/details.d.ts +77 -0
  154. package/lib/commands/cuneiform/user/details.js +414 -0
  155. package/lib/commands/cuneiform/user/details.js.map +1 -0
  156. package/lib/constants/namespace-constants.d.ts +102 -0
  157. package/lib/constants/namespace-constants.js +225 -0
  158. package/lib/constants/namespace-constants.js.map +1 -0
  159. package/lib/debug/command-debug-proxy.d.ts +101 -0
  160. package/lib/debug/command-debug-proxy.js +171 -0
  161. package/lib/debug/command-debug-proxy.js.map +1 -0
  162. package/lib/debug/debug-logger.d.ts +85 -0
  163. package/lib/debug/debug-logger.js +133 -0
  164. package/lib/debug/debug-logger.js.map +1 -0
  165. package/lib/debug/service-debug-proxy.d.ts +30 -0
  166. package/lib/debug/service-debug-proxy.js +102 -0
  167. package/lib/debug/service-debug-proxy.js.map +1 -0
  168. package/lib/hooks/prerun.d.ts +25 -0
  169. package/lib/hooks/prerun.js +47 -0
  170. package/lib/hooks/prerun.js.map +1 -0
  171. package/lib/mcp/config/mcp-config.d.ts +55 -0
  172. package/lib/mcp/config/mcp-config.js +51 -0
  173. package/lib/mcp/config/mcp-config.js.map +1 -0
  174. package/lib/mcp/config/pagination.d.ts +96 -0
  175. package/lib/mcp/config/pagination.js +108 -0
  176. package/lib/mcp/config/pagination.js.map +1 -0
  177. package/lib/mcp/config/system-prompts.d.ts +18 -0
  178. package/lib/mcp/config/system-prompts.js +92 -0
  179. package/lib/mcp/config/system-prompts.js.map +1 -0
  180. package/lib/mcp/errors.d.ts +23 -0
  181. package/lib/mcp/errors.js +27 -0
  182. package/lib/mcp/errors.js.map +1 -0
  183. package/lib/mcp/schemas/input-schemas.d.ts +327 -0
  184. package/lib/mcp/schemas/input-schemas.js +310 -0
  185. package/lib/mcp/schemas/input-schemas.js.map +1 -0
  186. package/lib/mcp/server.d.ts +40 -0
  187. package/lib/mcp/server.js +316 -0
  188. package/lib/mcp/server.js.map +1 -0
  189. package/lib/mcp/tools/contactpoint-tools.d.ts +14 -0
  190. package/lib/mcp/tools/contactpoint-tools.js +34 -0
  191. package/lib/mcp/tools/contactpoint-tools.js.map +1 -0
  192. package/lib/mcp/tools/definition-io-tools.d.ts +19 -0
  193. package/lib/mcp/tools/definition-io-tools.js +152 -0
  194. package/lib/mcp/tools/definition-io-tools.js.map +1 -0
  195. package/lib/mcp/tools/definition-tools.d.ts +51 -0
  196. package/lib/mcp/tools/definition-tools.js +220 -0
  197. package/lib/mcp/tools/definition-tools.js.map +1 -0
  198. package/lib/mcp/tools/index.d.ts +37 -0
  199. package/lib/mcp/tools/index.js +88 -0
  200. package/lib/mcp/tools/index.js.map +1 -0
  201. package/lib/mcp/tools/object-tools.d.ts +22 -0
  202. package/lib/mcp/tools/object-tools.js +327 -0
  203. package/lib/mcp/tools/object-tools.js.map +1 -0
  204. package/lib/mcp/tools/org-tools.d.ts +14 -0
  205. package/lib/mcp/tools/org-tools.js +177 -0
  206. package/lib/mcp/tools/org-tools.js.map +1 -0
  207. package/lib/mcp/tools/profile-tools.d.ts +59 -0
  208. package/lib/mcp/tools/profile-tools.js +213 -0
  209. package/lib/mcp/tools/profile-tools.js.map +1 -0
  210. package/lib/mcp/tools/summary-tools.d.ts +14 -0
  211. package/lib/mcp/tools/summary-tools.js +38 -0
  212. package/lib/mcp/tools/summary-tools.js.map +1 -0
  213. package/lib/mcp/tools/tool-factory.d.ts +63 -0
  214. package/lib/mcp/tools/tool-factory.js +146 -0
  215. package/lib/mcp/tools/tool-factory.js.map +1 -0
  216. package/lib/mcp/tools/user-tools.d.ts +25 -0
  217. package/lib/mcp/tools/user-tools.js +167 -0
  218. package/lib/mcp/tools/user-tools.js.map +1 -0
  219. package/lib/models/cascade-skip-accumulator.d.ts +25 -0
  220. package/lib/models/cascade-skip-accumulator.js +9 -0
  221. package/lib/models/cascade-skip-accumulator.js.map +1 -0
  222. package/lib/models/date-literal.d.ts +280 -0
  223. package/lib/models/date-literal.js +1164 -0
  224. package/lib/models/date-literal.js.map +1 -0
  225. package/lib/models/object-describe-types.d.ts +173 -0
  226. package/lib/models/object-describe-types.js +9 -0
  227. package/lib/models/object-describe-types.js.map +1 -0
  228. package/lib/models/portability-recipe.d.ts +35 -0
  229. package/lib/models/portability-recipe.js +113 -0
  230. package/lib/models/portability-recipe.js.map +1 -0
  231. package/lib/models/profile-request-types.d.ts +118 -0
  232. package/lib/models/profile-request-types.js +23 -0
  233. package/lib/models/profile-request-types.js.map +1 -0
  234. package/lib/models/profiling-execution-types.d.ts +154 -0
  235. package/lib/models/profiling-execution-types.js +14 -0
  236. package/lib/models/profiling-execution-types.js.map +1 -0
  237. package/lib/models/service-result.d.ts +114 -0
  238. package/lib/models/service-result.js +81 -0
  239. package/lib/models/service-result.js.map +1 -0
  240. package/lib/models/sfdmu-types.d.ts +49 -0
  241. package/lib/models/sfdmu-types.js +23 -0
  242. package/lib/models/sfdmu-types.js.map +1 -0
  243. package/lib/models/status-types.d.ts +38 -0
  244. package/lib/models/status-types.js +12 -0
  245. package/lib/models/status-types.js.map +1 -0
  246. package/lib/models/summary-bulk-types.d.ts +61 -0
  247. package/lib/models/summary-bulk-types.js +23 -0
  248. package/lib/models/summary-bulk-types.js.map +1 -0
  249. package/lib/models/user-details-types.d.ts +188 -0
  250. package/lib/models/user-details-types.js +9 -0
  251. package/lib/models/user-details-types.js.map +1 -0
  252. package/lib/models/year-range.d.ts +78 -0
  253. package/lib/models/year-range.js +153 -0
  254. package/lib/models/year-range.js.map +1 -0
  255. package/lib/operations/CompatibilityCheckOperation.d.ts +62 -0
  256. package/lib/operations/CompatibilityCheckOperation.js +102 -0
  257. package/lib/operations/CompatibilityCheckOperation.js.map +1 -0
  258. package/lib/operations/DefinitionCreateOperation.d.ts +427 -0
  259. package/lib/operations/DefinitionCreateOperation.js +1270 -0
  260. package/lib/operations/DefinitionCreateOperation.js.map +1 -0
  261. package/lib/operations/DefinitionExportOperation.d.ts +155 -0
  262. package/lib/operations/DefinitionExportOperation.js +281 -0
  263. package/lib/operations/DefinitionExportOperation.js.map +1 -0
  264. package/lib/operations/DefinitionImportOperation.d.ts +144 -0
  265. package/lib/operations/DefinitionImportOperation.js +357 -0
  266. package/lib/operations/DefinitionImportOperation.js.map +1 -0
  267. package/lib/operations/DefinitionListOperation.d.ts +66 -0
  268. package/lib/operations/DefinitionListOperation.js +108 -0
  269. package/lib/operations/DefinitionListOperation.js.map +1 -0
  270. package/lib/operations/DefinitionPurgeOperation.d.ts +203 -0
  271. package/lib/operations/DefinitionPurgeOperation.js +465 -0
  272. package/lib/operations/DefinitionPurgeOperation.js.map +1 -0
  273. package/lib/operations/DefinitionUpdateOperation.d.ts +78 -0
  274. package/lib/operations/DefinitionUpdateOperation.js +142 -0
  275. package/lib/operations/DefinitionUpdateOperation.js.map +1 -0
  276. package/lib/operations/OrgDetailsOperation.d.ts +253 -0
  277. package/lib/operations/OrgDetailsOperation.js +456 -0
  278. package/lib/operations/OrgDetailsOperation.js.map +1 -0
  279. package/lib/operations/OrgResetOperation.d.ts +114 -0
  280. package/lib/operations/OrgResetOperation.js +209 -0
  281. package/lib/operations/OrgResetOperation.js.map +1 -0
  282. package/lib/operations/ProfileOperation.d.ts +192 -0
  283. package/lib/operations/ProfileOperation.js +371 -0
  284. package/lib/operations/ProfileOperation.js.map +1 -0
  285. package/lib/operations/ProfileRequestCancelOperation.d.ts +59 -0
  286. package/lib/operations/ProfileRequestCancelOperation.js +137 -0
  287. package/lib/operations/ProfileRequestCancelOperation.js.map +1 -0
  288. package/lib/operations/ProfileRequestDeleteOperation.d.ts +64 -0
  289. package/lib/operations/ProfileRequestDeleteOperation.js +134 -0
  290. package/lib/operations/ProfileRequestDeleteOperation.js.map +1 -0
  291. package/lib/operations/ProfileRequestListOperation.d.ts +39 -0
  292. package/lib/operations/ProfileRequestListOperation.js +61 -0
  293. package/lib/operations/ProfileRequestListOperation.js.map +1 -0
  294. package/lib/operations/SummaryPurgeOperation.d.ts +134 -0
  295. package/lib/operations/SummaryPurgeOperation.js +257 -0
  296. package/lib/operations/SummaryPurgeOperation.js.map +1 -0
  297. package/lib/operations/SummaryReprofileOperation.d.ts +88 -0
  298. package/lib/operations/SummaryReprofileOperation.js +174 -0
  299. package/lib/operations/SummaryReprofileOperation.js.map +1 -0
  300. package/lib/operations/SummaryStopOperation.d.ts +87 -0
  301. package/lib/operations/SummaryStopOperation.js +175 -0
  302. package/lib/operations/SummaryStopOperation.js.map +1 -0
  303. package/lib/services/BulkExecutionService.d.ts +120 -0
  304. package/lib/services/BulkExecutionService.js +535 -0
  305. package/lib/services/BulkExecutionService.js.map +1 -0
  306. package/lib/services/CompatibilityService.d.ts +81 -0
  307. package/lib/services/CompatibilityService.js +118 -0
  308. package/lib/services/CompatibilityService.js.map +1 -0
  309. package/lib/services/ConfigureMode.d.ts +98 -0
  310. package/lib/services/ConfigureMode.js +413 -0
  311. package/lib/services/ConfigureMode.js.map +1 -0
  312. package/lib/services/ContactPointService.d.ts +111 -0
  313. package/lib/services/ContactPointService.js +286 -0
  314. package/lib/services/ContactPointService.js.map +1 -0
  315. package/lib/services/DataAvailabilityService.d.ts +81 -0
  316. package/lib/services/DataAvailabilityService.js +128 -0
  317. package/lib/services/DataAvailabilityService.js.map +1 -0
  318. package/lib/services/DefinitionFieldGenerationService.d.ts +357 -0
  319. package/lib/services/DefinitionFieldGenerationService.js +899 -0
  320. package/lib/services/DefinitionFieldGenerationService.js.map +1 -0
  321. package/lib/services/DefinitionQueryBuilder.d.ts +92 -0
  322. package/lib/services/DefinitionQueryBuilder.js +328 -0
  323. package/lib/services/DefinitionQueryBuilder.js.map +1 -0
  324. package/lib/services/ObjectDescribeService.d.ts +436 -0
  325. package/lib/services/ObjectDescribeService.js +881 -0
  326. package/lib/services/ObjectDescribeService.js.map +1 -0
  327. package/lib/services/ObjectFilteringService.d.ts +484 -0
  328. package/lib/services/ObjectFilteringService.js +1080 -0
  329. package/lib/services/ObjectFilteringService.js.map +1 -0
  330. package/lib/services/ObjectListCommandService.d.ts +467 -0
  331. package/lib/services/ObjectListCommandService.js +904 -0
  332. package/lib/services/ObjectListCommandService.js.map +1 -0
  333. package/lib/services/ObjectListService.d.ts +201 -0
  334. package/lib/services/ObjectListService.js +350 -0
  335. package/lib/services/ObjectListService.js.map +1 -0
  336. package/lib/services/OrgInfoService.d.ts +493 -0
  337. package/lib/services/OrgInfoService.js +1142 -0
  338. package/lib/services/OrgInfoService.js.map +1 -0
  339. package/lib/services/PollingService.d.ts +105 -0
  340. package/lib/services/PollingService.js +117 -0
  341. package/lib/services/PollingService.js.map +1 -0
  342. package/lib/services/ProfileRequestService.d.ts +186 -0
  343. package/lib/services/ProfileRequestService.js +555 -0
  344. package/lib/services/ProfileRequestService.js.map +1 -0
  345. package/lib/services/ProfilingDefinitionService.d.ts +575 -0
  346. package/lib/services/ProfilingDefinitionService.js +1029 -0
  347. package/lib/services/ProfilingDefinitionService.js.map +1 -0
  348. package/lib/services/ProfilingExecutionService.d.ts +122 -0
  349. package/lib/services/ProfilingExecutionService.js +320 -0
  350. package/lib/services/ProfilingExecutionService.js.map +1 -0
  351. package/lib/services/ProfilingSummaryService.d.ts +292 -0
  352. package/lib/services/ProfilingSummaryService.js +688 -0
  353. package/lib/services/ProfilingSummaryService.js.map +1 -0
  354. package/lib/services/RecordTypeService.d.ts +129 -0
  355. package/lib/services/RecordTypeService.js +284 -0
  356. package/lib/services/RecordTypeService.js.map +1 -0
  357. package/lib/services/SFDMUService.d.ts +146 -0
  358. package/lib/services/SFDMUService.js +323 -0
  359. package/lib/services/SFDMUService.js.map +1 -0
  360. package/lib/services/TabDetectionService.d.ts +105 -0
  361. package/lib/services/TabDetectionService.js +206 -0
  362. package/lib/services/TabDetectionService.js.map +1 -0
  363. package/lib/services/UnconfigureMode.d.ts +74 -0
  364. package/lib/services/UnconfigureMode.js +378 -0
  365. package/lib/services/UnconfigureMode.js.map +1 -0
  366. package/lib/services/UserConfigurationService.d.ts +158 -0
  367. package/lib/services/UserConfigurationService.js +574 -0
  368. package/lib/services/UserConfigurationService.js.map +1 -0
  369. package/lib/services/UserConfigurationTypes.d.ts +181 -0
  370. package/lib/services/UserConfigurationTypes.js +14 -0
  371. package/lib/services/UserConfigurationTypes.js.map +1 -0
  372. package/lib/services/UserReadinessService.d.ts +347 -0
  373. package/lib/services/UserReadinessService.js +891 -0
  374. package/lib/services/UserReadinessService.js.map +1 -0
  375. package/lib/services/constants.d.ts +54 -0
  376. package/lib/services/constants.js +71 -0
  377. package/lib/services/constants.js.map +1 -0
  378. package/lib/services/namespace-constants.d.ts +1 -0
  379. package/lib/services/namespace-constants.js +11 -0
  380. package/lib/services/namespace-constants.js.map +1 -0
  381. package/lib/services/namespace-filter.d.ts +36 -0
  382. package/lib/services/namespace-filter.js +109 -0
  383. package/lib/services/namespace-filter.js.map +1 -0
  384. package/lib/services/validation.d.ts +47 -0
  385. package/lib/services/validation.js +119 -0
  386. package/lib/services/validation.js.map +1 -0
  387. package/lib/utils/batch-processor.d.ts +13 -0
  388. package/lib/utils/batch-processor.js +39 -0
  389. package/lib/utils/batch-processor.js.map +1 -0
  390. package/lib/utils/formatting/availability-grid.d.ts +81 -0
  391. package/lib/utils/formatting/availability-grid.js +94 -0
  392. package/lib/utils/formatting/availability-grid.js.map +1 -0
  393. package/lib/utils/formatting/business-process-grid.d.ts +51 -0
  394. package/lib/utils/formatting/business-process-grid.js +58 -0
  395. package/lib/utils/formatting/business-process-grid.js.map +1 -0
  396. package/lib/utils/formatting/command-display.d.ts +154 -0
  397. package/lib/utils/formatting/command-display.js +154 -0
  398. package/lib/utils/formatting/command-display.js.map +1 -0
  399. package/lib/utils/formatting/definition-create-display.d.ts +118 -0
  400. package/lib/utils/formatting/definition-create-display.js +230 -0
  401. package/lib/utils/formatting/definition-create-display.js.map +1 -0
  402. package/lib/utils/formatting/empty-states.d.ts +35 -0
  403. package/lib/utils/formatting/empty-states.js +70 -0
  404. package/lib/utils/formatting/empty-states.js.map +1 -0
  405. package/lib/utils/formatting/errors.d.ts +33 -0
  406. package/lib/utils/formatting/errors.js +72 -0
  407. package/lib/utils/formatting/errors.js.map +1 -0
  408. package/lib/utils/formatting/field-types.d.ts +32 -0
  409. package/lib/utils/formatting/field-types.js +88 -0
  410. package/lib/utils/formatting/field-types.js.map +1 -0
  411. package/lib/utils/formatting/index.d.ts +29 -0
  412. package/lib/utils/formatting/index.js +28 -0
  413. package/lib/utils/formatting/index.js.map +1 -0
  414. package/lib/utils/formatting/indicators.d.ts +113 -0
  415. package/lib/utils/formatting/indicators.js +161 -0
  416. package/lib/utils/formatting/indicators.js.map +1 -0
  417. package/lib/utils/formatting/loading-messages.d.ts +37 -0
  418. package/lib/utils/formatting/loading-messages.js +50 -0
  419. package/lib/utils/formatting/loading-messages.js.map +1 -0
  420. package/lib/utils/formatting/namespace-display.d.ts +31 -0
  421. package/lib/utils/formatting/namespace-display.js +64 -0
  422. package/lib/utils/formatting/namespace-display.js.map +1 -0
  423. package/lib/utils/formatting/numbers.d.ts +73 -0
  424. package/lib/utils/formatting/numbers.js +187 -0
  425. package/lib/utils/formatting/numbers.js.map +1 -0
  426. package/lib/utils/formatting/object-describe-display.d.ts +117 -0
  427. package/lib/utils/formatting/object-describe-display.js +447 -0
  428. package/lib/utils/formatting/object-describe-display.js.map +1 -0
  429. package/lib/utils/formatting/object-list-display.d.ts +225 -0
  430. package/lib/utils/formatting/object-list-display.js +718 -0
  431. package/lib/utils/formatting/object-list-display.js.map +1 -0
  432. package/lib/utils/formatting/org-identity.d.ts +15 -0
  433. package/lib/utils/formatting/org-identity.js +28 -0
  434. package/lib/utils/formatting/org-identity.js.map +1 -0
  435. package/lib/utils/formatting/record-age-grid.d.ts +41 -0
  436. package/lib/utils/formatting/record-age-grid.js +56 -0
  437. package/lib/utils/formatting/record-age-grid.js.map +1 -0
  438. package/lib/utils/formatting/sections.d.ts +108 -0
  439. package/lib/utils/formatting/sections.js +150 -0
  440. package/lib/utils/formatting/sections.js.map +1 -0
  441. package/lib/utils/formatting/tables.d.ts +90 -0
  442. package/lib/utils/formatting/tables.js +113 -0
  443. package/lib/utils/formatting/tables.js.map +1 -0
  444. package/lib/utils/formatting/user-details-display.d.ts +101 -0
  445. package/lib/utils/formatting/user-details-display.js +425 -0
  446. package/lib/utils/formatting/user-details-display.js.map +1 -0
  447. package/lib/utils/pagination/keypress-reader.d.ts +20 -0
  448. package/lib/utils/pagination/keypress-reader.js +63 -0
  449. package/lib/utils/pagination/keypress-reader.js.map +1 -0
  450. package/lib/utils/pagination/paginate-output.d.ts +48 -0
  451. package/lib/utils/pagination/paginate-output.js +136 -0
  452. package/lib/utils/pagination/paginate-output.js.map +1 -0
  453. package/messages/compatibility.check.md +71 -0
  454. package/messages/cuneiform.access.md +138 -0
  455. package/messages/definition.create.md +525 -0
  456. package/messages/definition.export.md +84 -0
  457. package/messages/definition.get.md +147 -0
  458. package/messages/definition.import.md +65 -0
  459. package/messages/definition.list.md +264 -0
  460. package/messages/definition.purge.md +330 -0
  461. package/messages/definition.update.md +118 -0
  462. package/messages/mcp.serve.md +66 -0
  463. package/messages/object.describe.md +205 -0
  464. package/messages/object.list.md +463 -0
  465. package/messages/org.details.md +386 -0
  466. package/messages/org.reset.md +71 -0
  467. package/messages/profile.md +243 -0
  468. package/messages/profile.request.cancel.md +143 -0
  469. package/messages/profile.request.delete.md +139 -0
  470. package/messages/profile.request.list.md +89 -0
  471. package/messages/summary.purge.md +218 -0
  472. package/messages/summary.reprofile.md +150 -0
  473. package/messages/summary.stop.md +157 -0
  474. package/messages/user.details.md +501 -0
  475. package/oclif.lock +3267 -2148
  476. package/oclif.manifest.json +2829 -31
  477. package/package.json +104 -18
  478. package/lib/commands/cuneiform/about.d.ts +0 -13
  479. package/lib/commands/cuneiform/about.js +0 -26
  480. package/lib/commands/cuneiform/about.js.map +0 -1
  481. package/lib/commands/hello/world.d.ts +0 -14
  482. package/lib/commands/hello/world.js +0 -27
  483. package/lib/commands/hello/world.js.map +0 -1
  484. package/lib/index.d.ts +0 -2
  485. package/lib/index.js +0 -2
  486. package/lib/index.js.map +0 -1
  487. package/messages/cuneiform.about.md +0 -19
  488. package/messages/hello.world.md +0 -29
@@ -0,0 +1,899 @@
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
+ import { buildDateLiteralFilterJson, buildComparativeDateLiteralFilterJson, buildComparativeYearFilterJson, buildHistoricalYearFilterJson, buildLifetimeComparativeFilterJson, composeRecordTypeFilter, DATE_LITERAL_CONSTANTS, humanizeDateField, LITERAL_CASCADES, yearBoundaryISO, yearBoundaryDisplay, } from '../models/date-literal.js';
9
+ /**
10
+ * Complete mapping of date literal keys to their expression builder constants
11
+ * and SOQL equivalents. Source: ISV `constantsUtils.js` in `fsc_expressionBuilder3`.
12
+ */
13
+ const DATE_LITERAL_MAP = {
14
+ TODAY: { constant: '$Constant.Today', soqlLiteral: 'TODAY', displayName: 'Today' },
15
+ YESTERDAY: { constant: '$Constant.Yesterday', soqlLiteral: 'YESTERDAY', displayName: 'Yesterday' },
16
+ THIS_WEEK: { constant: '$Constant.ThisWeek', soqlLiteral: 'THIS_WEEK', displayName: 'This Week' },
17
+ LAST_WEEK: { constant: '$Constant.LastWeek', soqlLiteral: 'LAST_WEEK', displayName: 'Last Week' },
18
+ THIS_MONTH: { constant: '$Constant.ThisMonth', soqlLiteral: 'THIS_MONTH', displayName: 'This Month' },
19
+ LAST_MONTH: { constant: '$Constant.LastMonth', soqlLiteral: 'LAST_MONTH', displayName: 'Last Month' },
20
+ THIS_QUARTER: { constant: '$Constant.ThisQuarter', soqlLiteral: 'THIS_QUARTER', displayName: 'This Quarter' },
21
+ LAST_QUARTER: { constant: '$Constant.LastQuarter', soqlLiteral: 'LAST_QUARTER', displayName: 'Last Quarter' },
22
+ THIS_YEAR: { constant: '$Constant.ThisYear', soqlLiteral: 'THIS_YEAR', displayName: 'This Year' },
23
+ LAST_YEAR: { constant: '$Constant.LastYear', soqlLiteral: 'LAST_YEAR', displayName: 'Last Year' },
24
+ TWO_YEARS_AGO: { constant: '$Constant.TwoYearsAgo', soqlLiteral: 'N_YEARS_AGO:2', displayName: 'Two Years Ago' },
25
+ THREE_YEARS_AGO: {
26
+ constant: '$Constant.ThreeYearsAgo',
27
+ soqlLiteral: 'N_YEARS_AGO:3',
28
+ displayName: 'Three Years Ago',
29
+ },
30
+ LAST_TWO_YEARS: {
31
+ constant: '$Constant.LastTwoYears',
32
+ soqlLiteral: 'LAST_N_YEARS:2',
33
+ displayName: 'Last Two Years',
34
+ },
35
+ LAST_THREE_YEARS: {
36
+ constant: '$Constant.LastThreeYears',
37
+ soqlLiteral: 'LAST_N_YEARS:3',
38
+ displayName: 'Last Three Years',
39
+ },
40
+ };
41
+ /**
42
+ * Business process outcome field mapping.
43
+ * These boolean fields are system-maintained, universal across all orgs.
44
+ */
45
+ const OUTCOME_FIELD_MAP = {
46
+ Opportunity: { fieldName: 'IsWon', trueLabel: 'Won', falseLabel: 'Lost' },
47
+ Case: { fieldName: 'IsClosed', trueLabel: 'Closed', falseLabel: 'Open' },
48
+ Lead: { fieldName: 'IsConverted', trueLabel: 'Converted', falseLabel: 'Unconverted' },
49
+ };
50
+ /**
51
+ * Pure field generation service for profiling definitions.
52
+ *
53
+ * Encapsulates stateless naming, categorisation, description, and candidate-input
54
+ * building logic extracted from DefinitionCreateOperation. Every method is
55
+ * `public static` — no constructor dependencies, no adapters, no connection.
56
+ *
57
+ * The DefinitionCreateOperation delegates to this service for:
58
+ * - Definition name resolution (buildName, resolveDefinitionName)
59
+ * - Category / time-category / segment-category resolution
60
+ * - Description template generation
61
+ * - Candidate input construction for metadata, historical, comparative, record-type, and outcome methods
62
+ * - Outcome field lookup and filter JSON construction
63
+ */
64
+ export class DefinitionFieldGenerationService {
65
+ /** Exposes the date literal constant map for external consumers and tests. */
66
+ static DATE_LITERAL_MAP = DATE_LITERAL_MAP;
67
+ /** The bullet separator used in definition names. */
68
+ static NAME_SEPARATOR = ' \u2022 ';
69
+ // ── Public API (composition) ──────────────────────────────────────
70
+ /**
71
+ * Resolves the definition name from the method and context.
72
+ * Single source of truth for definition naming across all definition types.
73
+ *
74
+ * @param label - Object label (e.g., 'Account', 'Lead')
75
+ * @param method - ISV method (metadata, historical, comparative)
76
+ * @param context - Optional context: timeLabel, year, recordTypeName, outcomeLabels, unbounded
77
+ * @returns The formatted definition name
78
+ */
79
+ static resolveDefinitionName(label, method, context) {
80
+ // REQ-002 portability naming (CLI-4215): the bulk-recipe mode emits the simplified
81
+ // `${label} • ${suffix}` (object + suffix only, bullet delimiter per CLI-4215 review) and
82
+ // skips the `All Fields`/time-segment composition. namePrefix and the normal bullet suffix
83
+ // join do not apply here. The required suffix is enforced at the command boundary (CLI-4264);
84
+ // without one, fall back to the bare label rather than a trailing separator.
85
+ if (context?.portabilityNaming) {
86
+ return context.nameSuffix
87
+ ? `${label}${DefinitionFieldGenerationService.NAME_SEPARATOR}${context.nameSuffix}`
88
+ : label;
89
+ }
90
+ const baseName = DefinitionFieldGenerationService.buildName(label, method, context ?? {});
91
+ const sep = DefinitionFieldGenerationService.NAME_SEPARATOR;
92
+ // namePrefix joins with a plain space (matching REST path ISV behavior).
93
+ // nameSuffix joins with the bullet separator (• ).
94
+ const withSuffix = context?.nameSuffix ? `${baseName}${sep}${context.nameSuffix}` : baseName;
95
+ return context?.namePrefix ? `${context.namePrefix} ${withSuffix}` : withSuffix;
96
+ }
97
+ /**
98
+ * Resolves all definition metadata (category, timeCategory, segmentCategory, description)
99
+ * from the method and context. Single source of truth for definition classification.
100
+ *
101
+ * @param label - Object label (e.g., 'Account', 'Lead')
102
+ * @param method - ISV method (metadata, historical, comparative)
103
+ * @param context - Optional context: timeLabel, year, recordTypeName, outcomeLabels, overrides
104
+ * @returns Resolved metadata for the definition
105
+ */
106
+ static resolveDefinitionMetadata(label, method, context) {
107
+ const ctx = context ?? {};
108
+ return {
109
+ category: DefinitionFieldGenerationService.resolveCategory(method, ctx),
110
+ timeCategory: DefinitionFieldGenerationService.resolveTimeCategoryFromContext(method, ctx),
111
+ segmentCategory: DefinitionFieldGenerationService.resolveSegmentCategory(method, ctx),
112
+ description: ctx.descriptionOverride ??
113
+ DefinitionFieldGenerationService.resolveDescription(label, method, ctx) + (ctx.origin ? ` ${ctx.origin}` : ''),
114
+ };
115
+ }
116
+ /**
117
+ * Maps Salesforce objects to their outcome boolean fields.
118
+ *
119
+ * @param objectName - Salesforce object API name (e.g., 'Opportunity', 'Case', 'Lead')
120
+ * @returns Outcome field mapping, or undefined if the object has no outcome field
121
+ */
122
+ static getOutcomeField(objectName) {
123
+ return OUTCOME_FIELD_MAP[objectName];
124
+ }
125
+ /**
126
+ * Builds a single outcome definition input for a given object, outcome mapping, and optional time/RT context.
127
+ * Consolidates the repeated context + input construction pattern used across buildOutcomeCandidateInputs
128
+ * and buildInputsForRecordType.
129
+ *
130
+ * @param obj - Resolved SObject metadata
131
+ * @param outcome - Outcome field mapping for the object
132
+ * @param options - Field generation options
133
+ * @param timeLabel - Optional time label (e.g., 'This Year')
134
+ * @param recordTypeName - Optional record type developer name
135
+ * @param dateLiteral - Optional date literal key
136
+ * @param dateField - Optional date field API name
137
+ * @returns A single CreateDefinitionInput for the outcome comparison
138
+ */
139
+ static buildOutcomeInput(obj, outcome, options, timeLabel, recordTypeName, dateLiteral, dateField) {
140
+ const ctx = {
141
+ outcomeLabels: { trueLabel: outcome.trueLabel, falseLabel: outcome.falseLabel },
142
+ timeLabel,
143
+ recordTypeName: recordTypeName ?? options.recordType,
144
+ categoryOverride: options.category,
145
+ timeCategoryOverride: options.timeCategory,
146
+ segmentCategoryOverride: options.segmentCategory,
147
+ descriptionOverride: options.description,
148
+ noValueFrequency: options.noValueFrequency,
149
+ namePrefix: options.namePrefix,
150
+ nameSuffix: options.nameSuffix,
151
+ portabilityNaming: options.portabilityNaming,
152
+ origin: options.origin,
153
+ dateField,
154
+ };
155
+ return {
156
+ name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, 'metadata', ctx),
157
+ objectName: obj.name,
158
+ objectLabel: obj.label,
159
+ // CLI-3375: wire-level method='outcome' for outcome candidates (honest tagging).
160
+ // Internal name/metadata resolution still uses 'metadata' as the resolution key — the
161
+ // resolution functions key off semantic shape, not the wire-level method tag.
162
+ method: 'outcome',
163
+ ...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, 'metadata', ctx),
164
+ isActive: true,
165
+ noValueFrequency: options.noValueFrequency,
166
+ discoverFields: true,
167
+ recordTypeName: recordTypeName ?? options.recordType,
168
+ filterJson: DefinitionFieldGenerationService.buildOutcomeFilterJson(outcome.fieldName, obj.name, dateLiteral, dateField, obj.label),
169
+ };
170
+ }
171
+ /**
172
+ * Builds an ISV-compatible filterJson string for business process outcome comparisons.
173
+ * SetA filters for the true outcome, SetB filters for the false outcome.
174
+ * Produces the expression builder JSON schema that `fsc_expressionBuilder3` expects.
175
+ *
176
+ * @param fieldName - Boolean field API name (e.g., 'IsWon', 'IsClosed', 'IsConverted')
177
+ * @param objectName - Salesforce object API name (e.g., 'Opportunity', 'Case', 'Lead')
178
+ * @param dateLiteral - Optional date literal key for time-scoped outcome filters
179
+ * @param dateField - Optional date field API name
180
+ * @param objectLabel - Optional object label for display in date expressions
181
+ * @returns JSON string compatible with GlobalProfilingService.createProfilingDefinition()
182
+ */
183
+ static buildOutcomeFilterJson(fieldName, objectName, dateLiteral, dateField, objectLabel, yearBoundary) {
184
+ const buildExpression = (boolValue) => {
185
+ const expressions = [
186
+ {
187
+ objectType: objectName,
188
+ parameter: boolValue ? '$Constant.TrueValue' : '$Constant.FalseValue',
189
+ parameterValue: String(boolValue),
190
+ dataType: 'BOOLEAN',
191
+ label: `${objectName}: ${fieldName}`,
192
+ type: objectName,
193
+ fieldName,
194
+ operator: 'equals',
195
+ operatorSymbol: '=',
196
+ value: `$${objectName}.${fieldName}`,
197
+ dateLiteral: '',
198
+ },
199
+ ];
200
+ if (dateLiteral && dateField) {
201
+ const constantValue = DATE_LITERAL_CONSTANTS[dateLiteral] ?? dateLiteral;
202
+ expressions.push({
203
+ objectType: objectName,
204
+ parameter: constantValue,
205
+ parameterValue: dateLiteral,
206
+ dataType: 'DATETIME',
207
+ label: `${objectLabel ?? objectName}: ${humanizeDateField(dateField)}`,
208
+ type: objectName,
209
+ fieldName: dateField,
210
+ operator: 'equals',
211
+ operatorSymbol: '=',
212
+ value: `$${objectName}.${dateField}`,
213
+ dateLiteral,
214
+ });
215
+ }
216
+ // Year boundary expressions: >= Jan 1 YYYY AND < Jan 1 YYYY+1
217
+ if (yearBoundary && dateField) {
218
+ const yField = dateField;
219
+ const yLabel = `${objectLabel ?? objectName}: ${humanizeDateField(dateField)}`;
220
+ const yValue = `$${objectName}.${yField}`;
221
+ // yearBoundaryISO and yearBoundaryDisplay imported from date-literal.ts
222
+ const yearStart = yearBoundaryISO(yearBoundary.year);
223
+ const yearEnd = yearBoundaryISO(yearBoundary.year + 1);
224
+ const yearStartDisplay = yearBoundaryDisplay(yearBoundary.year);
225
+ const yearEndDisplay = yearBoundaryDisplay(yearBoundary.year + 1);
226
+ expressions.push({
227
+ objectType: objectName,
228
+ parameter: yearStartDisplay,
229
+ parameterValue: yearStart,
230
+ dataType: 'DATETIME',
231
+ label: yLabel,
232
+ type: objectName,
233
+ fieldName: yField,
234
+ operator: 'greater_or_equal',
235
+ operatorSymbol: '>=',
236
+ value: yValue,
237
+ dateLiteral: '',
238
+ });
239
+ expressions.push({
240
+ objectType: objectName,
241
+ parameter: yearEndDisplay,
242
+ parameterValue: yearEnd,
243
+ dataType: 'DATETIME',
244
+ label: yLabel,
245
+ type: objectName,
246
+ fieldName: yField,
247
+ operator: 'less_than',
248
+ operatorSymbol: '<',
249
+ value: yValue,
250
+ dateLiteral: '',
251
+ });
252
+ }
253
+ return { expressions, logicType: 'AND' };
254
+ };
255
+ let dateClause = '';
256
+ if (dateLiteral && dateField) {
257
+ dateClause = ` AND ${dateField} = ${dateLiteral}`;
258
+ }
259
+ else if (yearBoundary && dateField) {
260
+ // yearBoundaryISO imported from date-literal.ts
261
+ dateClause = ` AND ${dateField} >= ${yearBoundaryISO(yearBoundary.year)} AND ${dateField} < ${yearBoundaryISO(yearBoundary.year + 1)}`;
262
+ }
263
+ const payload = {
264
+ hasFilters: true,
265
+ setA: { json: buildExpression(true), expression: `${fieldName} = true${dateClause}` },
266
+ setB: { json: buildExpression(false), expression: `${fieldName} = false${dateClause}` },
267
+ };
268
+ return JSON.stringify(payload);
269
+ }
270
+ // ── Naming / Metadata Resolution ──────────────────────────────────
271
+ /**
272
+ * Builds the base definition name from an object label, method, and context.
273
+ *
274
+ * @param label - Object label (e.g., 'Account', 'Lead')
275
+ * @param method - ISV method string
276
+ * @param ctx - Definition metadata context
277
+ * @returns Formatted base definition name (without prefix/suffix)
278
+ */
279
+ static buildName(label, method, ctx) {
280
+ const s = DefinitionFieldGenerationService.NAME_SEPARATOR;
281
+ const prefix = ctx.recordTypeName ? `${label}${s}All Fields${s}${ctx.recordTypeName}` : `${label}${s}All Fields`;
282
+ if (ctx.outcomeLabels) {
283
+ const timeSegment = ctx.timeLabel ?? 'Lifetime';
284
+ // Outcome variants embed the trueLabel vs falseLabel in the name, which already
285
+ // carries the semantic distinction. The noValueFrequency disambiguator is omitted
286
+ // here because outcome definitions never share names with non-outcome definitions
287
+ // of the same object.
288
+ return `${prefix}${s}${timeSegment}${s}${ctx.outcomeLabels.trueLabel} vs ${ctx.outcomeLabels.falseLabel}`;
289
+ }
290
+ if (method === 'metadata') {
291
+ // Metadata-only definitions never capture value frequency, so the disambiguator
292
+ // would be a meaningless name change. Metadata names remain stable.
293
+ return `${prefix}${s}Metadata Only`;
294
+ }
295
+ // Resolve the time segment for non-metadata, non-outcome variants.
296
+ let timeSegment;
297
+ if (ctx.lifetimePrimary) {
298
+ // Lifetime-vs-X comparative variant (CLI-2944) — name's time segment is "Lifetime vs {timeLabel}".
299
+ timeSegment = `Lifetime vs ${DefinitionFieldGenerationService.resolveLifetimeTimeLabel(ctx)}`;
300
+ }
301
+ else if (ctx.timeLabel) {
302
+ // Comparative definitions include "vs Prior" to distinguish from historical with the same time label.
303
+ // Without this, "Account • All Fields • This Year" would collide for both methods in --method full.
304
+ timeSegment = method === 'comparative' ? `${ctx.timeLabel} vs Prior` : ctx.timeLabel;
305
+ }
306
+ else if (method === 'historical') {
307
+ timeSegment = ctx.year !== undefined ? `${ctx.year}` : 'Lifetime';
308
+ }
309
+ else {
310
+ // Comparative with year — include time dimension in name
311
+ const effectiveYear = ctx.year ?? new Date().getFullYear();
312
+ timeSegment = ctx.unbounded ? `${effectiveYear} vs Prior` : `${effectiveYear} vs ${effectiveYear - 1}`;
313
+ }
314
+ // CLI-3064: Append "No Value Frequency" disambiguator when noValueFrequency is set.
315
+ // Mirrors the comparative `vs Prior` disambiguator pattern above — without this,
316
+ // value-frequency and no-value-frequency variants of the same (object, method,
317
+ // time-segment, recordType) collide on the name-keyed dedup gate and the second is
318
+ // silently skipped. The disambiguator becomes part of the base name so user-supplied
319
+ // `--name-prefix` and `--name-suffix` compose cleanly around it in resolveDefinitionName.
320
+ const variantSuffix = ctx.noValueFrequency ? `${s}No Value Frequency` : '';
321
+ return `${prefix}${s}${timeSegment}${variantSuffix}`;
322
+ }
323
+ /**
324
+ * Resolves the time-segment label for the lifetime-vs-X comparative variant. Prefers an explicit
325
+ * timeLabel (set by the operation layer for date literals or year-range spans), then falls back
326
+ * to the year for single-year cascade entries. Used by buildName, resolveTimeCategoryFromContext,
327
+ * and resolveDescription so the lifetime variant renders consistently.
328
+ */
329
+ static resolveLifetimeTimeLabel(ctx) {
330
+ if (ctx.timeLabel)
331
+ return ctx.timeLabel;
332
+ if (ctx.year !== undefined)
333
+ return String(ctx.year);
334
+ return 'Lifetime';
335
+ }
336
+ /**
337
+ * Resolves the primary category from method and context.
338
+ *
339
+ * @param method - ISV method string
340
+ * @param ctx - Definition metadata context
341
+ * @returns Category string (e.g., 'Metadata', 'Baseline', 'Comparative', 'Record Types')
342
+ */
343
+ static resolveCategory(method, ctx) {
344
+ if (ctx.categoryOverride)
345
+ return ctx.categoryOverride;
346
+ if (ctx.outcomeLabels)
347
+ return 'Comparative';
348
+ if (ctx.recordTypeName)
349
+ return 'Record Types';
350
+ if (method === 'metadata')
351
+ return 'Metadata';
352
+ return 'Baseline';
353
+ }
354
+ /**
355
+ * Resolves the time category from method and context.
356
+ *
357
+ * @param method - ISV method string
358
+ * @param ctx - Definition metadata context
359
+ * @returns Time category string (e.g., 'N/A', 'Lifetime', '2025 vs 2024')
360
+ */
361
+ static resolveTimeCategoryFromContext(method, ctx) {
362
+ if (ctx.timeCategoryOverride)
363
+ return ctx.timeCategoryOverride;
364
+ if (method === 'metadata' && !ctx.outcomeLabels)
365
+ return 'N/A';
366
+ // Lifetime-vs-X comparative variant (CLI-2944) — timeCategory mirrors the name's time segment.
367
+ if (ctx.lifetimePrimary) {
368
+ return `Lifetime vs ${DefinitionFieldGenerationService.resolveLifetimeTimeLabel(ctx)}`;
369
+ }
370
+ if (ctx.timeLabel) {
371
+ // Match buildName: comparative with time label uses "vs Prior" suffix
372
+ if (method === 'comparative' && !ctx.outcomeLabels)
373
+ return `${ctx.timeLabel} vs Prior`;
374
+ return ctx.timeLabel;
375
+ }
376
+ if (ctx.year !== undefined && method === 'comparative') {
377
+ return ctx.unbounded ? `${ctx.year} vs Prior` : `${ctx.year} vs ${ctx.year - 1}`;
378
+ }
379
+ if (ctx.year !== undefined)
380
+ return String(ctx.year);
381
+ return 'Lifetime';
382
+ }
383
+ /**
384
+ * Resolves the segment category from method and context.
385
+ *
386
+ * @param method - ISV method string
387
+ * @param ctx - Definition metadata context
388
+ * @returns Segment category string (e.g., 'N/A', 'Historical', 'Comparative', record type name)
389
+ */
390
+ static resolveSegmentCategory(method, ctx) {
391
+ if (ctx.segmentCategoryOverride)
392
+ return ctx.segmentCategoryOverride;
393
+ // Outcome check must precede metadata check because outcomes use method='metadata' at the ISV boundary
394
+ if (ctx.outcomeLabels)
395
+ return `${ctx.outcomeLabels.trueLabel} vs ${ctx.outcomeLabels.falseLabel}`;
396
+ if (method === 'metadata')
397
+ return 'N/A';
398
+ if (ctx.recordTypeName)
399
+ return ctx.recordTypeName;
400
+ // Lifetime-vs-X comparative variant (CLI-2944) — segmentCategory is "Comparative" regardless of
401
+ // whether the secondary filter is year-based or date-literal-based (AC8).
402
+ if (ctx.lifetimePrimary)
403
+ return 'Comparative';
404
+ if (method === 'comparative' && (ctx.year !== undefined || ctx.timeLabel !== undefined))
405
+ return 'Comparative';
406
+ return 'Historical';
407
+ }
408
+ /**
409
+ * Generates a human-readable description from label, method, and context.
410
+ *
411
+ * @param label - Object label (e.g., 'Account', 'Lead')
412
+ * @param method - ISV method string
413
+ * @param ctx - Definition metadata context
414
+ * @returns Generated description string
415
+ */
416
+ static resolveDescription(label, method, ctx) {
417
+ // Metadata-only (CRa) — no field statistics or value frequency
418
+ if (method === 'metadata' && !ctx.outcomeLabels) {
419
+ return (`Metadata profiling for ${label}. Captures Salesforce object and field metadata including ` +
420
+ 'data types, namespaces, field descriptions, help text, and custom field dependency counts across ' +
421
+ 'layouts, reports, and low-code/pro-code sources. Does not capture field profiling statistics, ' +
422
+ 'value frequency results, or KPI results.');
423
+ }
424
+ // Build captures clause based on noValueFrequency
425
+ const captures = ctx.noValueFrequency
426
+ ? 'Captures object and field metadata, field utilization rates, and distinctness and default value analysis'
427
+ : 'Captures object and field metadata, field utilization rates, distinctness and default value analysis, and value frequency distributions';
428
+ const boundary = ctx.noValueFrequency
429
+ ? ' Does not capture value frequency distributions or KPI results.'
430
+ : ' Does not capture KPI results.';
431
+ // Business process outcome comparison (SetA + SetB)
432
+ if (ctx.outcomeLabels) {
433
+ return (`Business outcome comparison for ${label} \u2014 ${ctx.outcomeLabels.trueLabel} vs ${ctx.outcomeLabels.falseLabel}. ` +
434
+ `${captures} for both ${ctx.outcomeLabels.trueLabel} and ${ctx.outcomeLabels.falseLabel} record sets.${boundary}`);
435
+ }
436
+ // Lifetime-vs-X comparative variant (CLI-2944) \u2014 must precede recordTypeName branch so the
437
+ // lifetime template wins when both lifetimePrimary and recordTypeName are set (AC9 second template).
438
+ if (ctx.lifetimePrimary) {
439
+ const lifetimeLabel = DefinitionFieldGenerationService.resolveLifetimeTimeLabel(ctx);
440
+ if (ctx.recordTypeName) {
441
+ return (`Comparative profiling for ${label} (${ctx.recordTypeName}) \u2014 all records vs records from ${lifetimeLabel}, ` +
442
+ `scoped to the ${ctx.recordTypeName} record type. ${captures} for both record sets.${boundary}`);
443
+ }
444
+ return (`Comparative profiling for ${label} \u2014 all records vs records from ${lifetimeLabel}. ` +
445
+ `${captures} for both the complete record set and the ${lifetimeLabel} record set.${boundary}`);
446
+ }
447
+ // Record type scoped
448
+ if (ctx.recordTypeName) {
449
+ const scope = ctx.timeLabel
450
+ ? `filtered to ${ctx.timeLabel}`
451
+ : ctx.year !== undefined
452
+ ? `comparing ${ctx.year} vs ${ctx.year - 1}`
453
+ : 'across all records';
454
+ return (`Record type profiling for ${label} \u2014 ${ctx.recordTypeName}. ` +
455
+ `${captures} scoped to the ${ctx.recordTypeName} record type ${scope}.${boundary}`);
456
+ }
457
+ // Historical / comparative with date literal
458
+ if (ctx.timeLabel) {
459
+ const dateFieldLabel = humanizeDateField(ctx.dateField ?? 'CreatedDate');
460
+ return (`Historical profiling for ${label} \u2014 ${ctx.timeLabel}. ` +
461
+ `${captures} across the profiled record set. Records filtered to ${ctx.timeLabel} by ${dateFieldLabel}.${boundary}`);
462
+ }
463
+ // Historical lifetime (no filter)
464
+ if (method === 'historical') {
465
+ return (`Historical profiling for ${label} \u2014 all records. ` +
466
+ `${captures} across the complete record set with no time-based filtering.${boundary}`);
467
+ }
468
+ // Year-based comparative
469
+ const y = ctx.year ?? new Date().getFullYear();
470
+ return (`Comparative profiling for ${label} \u2014 ${y} vs ${y - 1}. ` +
471
+ `${captures} across the profiled record set.${boundary}`);
472
+ }
473
+ // ── Candidate Input Builders ──────────────────────────────────────
474
+ /**
475
+ * Selects the comparative filter JSON for a date-literal entry.
476
+ * lifetimePrimary → SetA empty (all records), SetB = supplied literal.
477
+ * regular comparative → SetA = literal, SetB = prior from LITERAL_CASCADES[literal][1]; falls back to SetA-only when no prior exists.
478
+ * historical/metadata → SetA only.
479
+ */
480
+ static pickDateLiteralComparativeFilter(literal, isLifetimeComparative, dateField, objectName, objectLabel, isRegularComparative) {
481
+ if (isLifetimeComparative) {
482
+ return buildLifetimeComparativeFilterJson(dateField, { kind: 'dateLiteral', literal }, objectName, objectLabel);
483
+ }
484
+ if (isRegularComparative) {
485
+ const priorLiteral = LITERAL_CASCADES[literal][1];
486
+ if (priorLiteral) {
487
+ return buildComparativeDateLiteralFilterJson(dateField, literal, priorLiteral, objectName, objectLabel);
488
+ }
489
+ }
490
+ return buildDateLiteralFilterJson(dateField, literal, objectName, objectLabel);
491
+ }
492
+ /**
493
+ * Selects the comparative filter JSON for a year-range entry. Returns the lifetime-vs-X
494
+ * variant when in lifetimePrimary mode; otherwise the existing year-vs-prior comparative
495
+ * filter (CLI-2944).
496
+ */
497
+ static pickYearComparativeFilter(entry, lifetimePrimary, objectName, objectLabel) {
498
+ if (lifetimePrimary) {
499
+ return buildLifetimeComparativeFilterJson('CreatedDate', { kind: 'year', year: entry.year }, objectName, objectLabel);
500
+ }
501
+ return buildComparativeYearFilterJson('CreatedDate', entry.year, !!entry.unbounded, objectName, objectLabel);
502
+ }
503
+ /**
504
+ * Builds candidate CreateDefinitionInput entries for non-recordtype methods.
505
+ *
506
+ * For comparative method, creates one input per object per YearRange entry.
507
+ * For metadata/historical, creates one input per object (yearRange is ignored).
508
+ *
509
+ * @param objects - Resolved SObject metadata entries
510
+ * @param method - ISV method (metadata, historical, comparative)
511
+ * @param year - Comparative year (default: current year)
512
+ * @param yearRange - Resolved year range entries
513
+ * @param options - Field generation options
514
+ * @returns Array of candidate definition inputs
515
+ */
516
+ static buildCandidateInputs(objects, method, year, yearRange, options) {
517
+ const inputs = [];
518
+ // CLI-3375: metadata-only definitions are filter-irrelevant by contract — they describe field
519
+ // shape, not time-scoped data. Producing one (object × dateLiteralEntry) input with filterJson
520
+ // populated caused two leaks: (1) the persisted record carried a misleading CreatedDate filter,
521
+ // and (2) DefinitionQueryBuilder.buildCreateDefinitionRequestBody's guard
522
+ // `input.method==='metadata' && !input.filterJson` falsified, falling through to the default
523
+ // `["CRa","CRb","CRc"]` insightGroups instead of the `["CRa"]` metadata-only set. Collapse to
524
+ // one filter-free input per object for the metadata variant; historical/comparative continue
525
+ // to expand over the date-literal range below.
526
+ if (options.dateLiteralRange && options.dateLiteralRange.entries.length > 0 && method === 'metadata') {
527
+ return DefinitionFieldGenerationService.buildMetadataInputsForObjects(objects, options);
528
+ }
529
+ if (options.dateLiteralRange && options.dateLiteralRange.entries.length > 0) {
530
+ return DefinitionFieldGenerationService.buildDateLiteralInputs(objects, method, options);
531
+ }
532
+ // Year-based path (existing behavior)
533
+ if (method === 'comparative' && yearRange.entries.length > 0) {
534
+ const lifetimePrimary = options.lifetimePrimary === true;
535
+ for (const obj of objects) {
536
+ for (const entry of yearRange.entries) {
537
+ const filterJson = DefinitionFieldGenerationService.pickYearComparativeFilter(entry, lifetimePrimary, obj.name, obj.label);
538
+ const ctx = {
539
+ year: entry.year,
540
+ unbounded: entry.unbounded,
541
+ lifetimePrimary,
542
+ recordTypeName: options.recordType,
543
+ categoryOverride: options.category,
544
+ timeCategoryOverride: options.timeCategory,
545
+ segmentCategoryOverride: options.segmentCategory,
546
+ descriptionOverride: options.description,
547
+ noValueFrequency: options.noValueFrequency,
548
+ namePrefix: options.namePrefix,
549
+ nameSuffix: options.nameSuffix,
550
+ portabilityNaming: options.portabilityNaming,
551
+ origin: options.origin,
552
+ };
553
+ inputs.push({
554
+ name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, method, ctx),
555
+ objectName: obj.name,
556
+ objectLabel: obj.label,
557
+ method,
558
+ ...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, method, ctx),
559
+ isActive: true,
560
+ lifetimePrimary,
561
+ noValueFrequency: options.noValueFrequency,
562
+ recordTypeName: options.recordType,
563
+ discoverFields: true,
564
+ filterJson,
565
+ });
566
+ }
567
+ }
568
+ }
569
+ else {
570
+ for (const obj of objects) {
571
+ const isComparative = method === 'comparative';
572
+ // Only apply year to historical when explicitly requested (not as part of --method full)
573
+ const historicalWithYear = method === 'historical' && options.year !== undefined && options.method === 'historical';
574
+ const ctx = {
575
+ year: isComparative || historicalWithYear ? year : undefined,
576
+ unbounded: options.usePrior,
577
+ recordTypeName: options.recordType,
578
+ categoryOverride: options.category,
579
+ timeCategoryOverride: options.timeCategory,
580
+ segmentCategoryOverride: options.segmentCategory,
581
+ descriptionOverride: options.description,
582
+ noValueFrequency: options.noValueFrequency,
583
+ namePrefix: options.namePrefix,
584
+ nameSuffix: options.nameSuffix,
585
+ portabilityNaming: options.portabilityNaming,
586
+ origin: options.origin,
587
+ };
588
+ // Build filter JSON based on method + year
589
+ let filterJson;
590
+ if (isComparative) {
591
+ filterJson = buildComparativeYearFilterJson('CreatedDate', year, !!options.usePrior, obj.name, obj.label);
592
+ }
593
+ else if (historicalWithYear) {
594
+ filterJson = buildHistoricalYearFilterJson('CreatedDate', year, obj.name, obj.label);
595
+ }
596
+ inputs.push({
597
+ name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, method, ctx),
598
+ objectName: obj.name,
599
+ objectLabel: obj.label,
600
+ method,
601
+ ...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, method, ctx),
602
+ isActive: true,
603
+ noValueFrequency: options.noValueFrequency,
604
+ recordTypeName: options.recordType,
605
+ discoverFields: true,
606
+ ...(filterJson ? { filterJson } : {}),
607
+ });
608
+ }
609
+ }
610
+ return inputs;
611
+ }
612
+ /**
613
+ * Builds candidate inputs for a single record type on a single object.
614
+ *
615
+ * Creates 1 historical + N comparative definitions (one per YearRange entry).
616
+ * For outcome-capable objects in full method, also adds outcome split per RT.
617
+ *
618
+ * CLI-3834: every emitted input carries a `filterJson` whose SetA carries a `RecordTypeId =
619
+ * <rt.id>` condition AND-composed with any existing time scope. SetB receives the same scope
620
+ * when the underlying filter helper produces it (year-based comparative). Without this, the
621
+ * server-side WHERE clause has no RT filter and profiling runs object-wide.
622
+ *
623
+ * @param obj - Resolved SObject metadata
624
+ * @param rt - Record type reference (id + developer name) — typically the upstream `RecordTypeInfo`. `id` is used to populate the server-side filter; `name` populates the label/segment fields.
625
+ * @param yearRange - Resolved year range entries
626
+ * @param options - Field generation options
627
+ * @returns Array of candidate definition inputs for this record type
628
+ */
629
+ static buildInputsForRecordType(obj, rt, yearRange, options) {
630
+ const inputs = [];
631
+ // Only cross record types with outcomes in full method — standalone --method recordtype should not add outcome variants
632
+ const outcome = options.method === 'full' ? DefinitionFieldGenerationService.getOutcomeField(obj.name) : undefined;
633
+ const composeRt = (existing) => composeRecordTypeFilter(existing, rt.id, obj.name, obj.label);
634
+ // Date literal path: create one definition per date literal entry (no lifetime baseline)
635
+ if (options.dateLiteralRange && options.dateLiteralRange.entries.length > 0) {
636
+ const dateField = options.dateLiteralRange.dateField;
637
+ for (const dlEntry of options.dateLiteralRange.entries) {
638
+ const ctx = {
639
+ timeLabel: dlEntry.label,
640
+ dateField,
641
+ recordTypeName: rt.name,
642
+ categoryOverride: options.category,
643
+ timeCategoryOverride: options.timeCategory,
644
+ segmentCategoryOverride: options.segmentCategory,
645
+ descriptionOverride: options.description,
646
+ noValueFrequency: options.noValueFrequency,
647
+ namePrefix: options.namePrefix,
648
+ nameSuffix: options.nameSuffix,
649
+ portabilityNaming: options.portabilityNaming,
650
+ origin: options.origin,
651
+ };
652
+ inputs.push({
653
+ name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, 'comparative', ctx),
654
+ objectName: obj.name,
655
+ objectLabel: obj.label,
656
+ method: 'comparative',
657
+ ...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, 'comparative', ctx),
658
+ isActive: true,
659
+ noValueFrequency: options.noValueFrequency,
660
+ recordTypeName: rt.name,
661
+ discoverFields: true,
662
+ filterJson: composeRt(buildDateLiteralFilterJson(dateField, dlEntry.literal, obj.name, obj.label)),
663
+ });
664
+ // Outcome x record type x date literal: for outcome-capable objects, add outcome split per RT per time
665
+ if (outcome) {
666
+ const outcomeInput = DefinitionFieldGenerationService.buildOutcomeInput(obj, outcome, options, dlEntry.label, rt.name, dlEntry.literal, dateField);
667
+ outcomeInput.filterJson = composeRt(outcomeInput.filterJson);
668
+ inputs.push(outcomeInput);
669
+ }
670
+ }
671
+ return inputs;
672
+ }
673
+ // Year-based path (existing behavior)
674
+ // 1. Lifetime historical (no year filter) — shows overall record type usage
675
+ const lifetimeCtx = {
676
+ recordTypeName: rt.name,
677
+ categoryOverride: options.category,
678
+ timeCategoryOverride: options.timeCategory,
679
+ segmentCategoryOverride: options.segmentCategory,
680
+ descriptionOverride: options.description,
681
+ noValueFrequency: options.noValueFrequency,
682
+ namePrefix: options.namePrefix,
683
+ nameSuffix: options.nameSuffix,
684
+ portabilityNaming: options.portabilityNaming,
685
+ origin: options.origin,
686
+ };
687
+ inputs.push({
688
+ name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, 'historical', lifetimeCtx),
689
+ objectName: obj.name,
690
+ objectLabel: obj.label,
691
+ method: 'historical',
692
+ ...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, 'historical', lifetimeCtx),
693
+ isActive: true,
694
+ noValueFrequency: options.noValueFrequency,
695
+ recordTypeName: rt.name,
696
+ discoverFields: true,
697
+ filterJson: composeRt(undefined),
698
+ });
699
+ // Outcome x record type (Lifetime): for outcome-capable objects, add outcome split per RT
700
+ if (outcome) {
701
+ const outcomeInput = DefinitionFieldGenerationService.buildOutcomeInput(obj, outcome, options, undefined, rt.name);
702
+ outcomeInput.filterJson = composeRt(outcomeInput.filterJson);
703
+ inputs.push(outcomeInput);
704
+ }
705
+ // 2+. Comparative definitions from year range entries
706
+ for (const entry of yearRange.entries) {
707
+ const compCtx = {
708
+ year: entry.year,
709
+ unbounded: entry.unbounded,
710
+ recordTypeName: rt.name,
711
+ categoryOverride: options.category,
712
+ timeCategoryOverride: options.timeCategory,
713
+ segmentCategoryOverride: options.segmentCategory,
714
+ descriptionOverride: options.description,
715
+ noValueFrequency: options.noValueFrequency,
716
+ namePrefix: options.namePrefix,
717
+ nameSuffix: options.nameSuffix,
718
+ portabilityNaming: options.portabilityNaming,
719
+ origin: options.origin,
720
+ };
721
+ inputs.push({
722
+ name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, 'comparative', compCtx),
723
+ objectName: obj.name,
724
+ objectLabel: obj.label,
725
+ method: 'comparative',
726
+ ...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, 'comparative', compCtx),
727
+ isActive: true,
728
+ noValueFrequency: options.noValueFrequency,
729
+ recordTypeName: rt.name,
730
+ discoverFields: true,
731
+ filterJson: composeRt(buildComparativeYearFilterJson('CreatedDate', entry.year, !!entry.unbounded, obj.name, obj.label)),
732
+ });
733
+ }
734
+ return inputs;
735
+ }
736
+ /**
737
+ * Builds candidate inputs for business process outcome profiling.
738
+ * Creates one definition per object that has a business process outcome boolean field.
739
+ *
740
+ * @param objects - Resolved SObject metadata entries
741
+ * @param options - Field generation options
742
+ * @param warnings - Mutable warnings array to append skip messages (standalone callers only)
743
+ * @param yearRange - Optional year range for outcome scoping
744
+ * @param cascade - Optional accumulator. Presence signals cascade-mode (`buildFullCandidateInputs`):
745
+ * objects with no outcome field are silently skipped — no warning is emitted (CLI-3611).
746
+ * Absence is the standalone caller (`--method outcome`) — per-object warning fires as before.
747
+ * @returns Array of candidate definition inputs for outcome-capable objects
748
+ */
749
+ static buildOutcomeCandidateInputs(objects, options, warnings, yearRange, cascade) {
750
+ const inputs = [];
751
+ for (const obj of objects) {
752
+ const outcome = DefinitionFieldGenerationService.getOutcomeField(obj.name);
753
+ if (!outcome) {
754
+ if (!cascade) {
755
+ warnings.push(`${obj.name} has no outcome field — skipped for outcome profiling.`);
756
+ }
757
+ // CLI-3611: cascade mode (--method full) silently skips objects without outcome fields.
758
+ // Outcome support is limited to Opportunity/Case/Lead by platform design — skipping
759
+ // other objects is expected, not an error condition worth surfacing to the user.
760
+ continue;
761
+ }
762
+ // Date literal path: create one outcome definition per object x date literal entry
763
+ if (options.dateLiteralRange && options.dateLiteralRange.entries.length > 0) {
764
+ const dateField = options.dateLiteralRange.dateField;
765
+ for (const dlEntry of options.dateLiteralRange.entries) {
766
+ inputs.push(DefinitionFieldGenerationService.buildOutcomeInput(obj, outcome, options, dlEntry.label, undefined, dlEntry.literal, dateField));
767
+ }
768
+ continue;
769
+ }
770
+ // Year path: create one outcome definition per year, scoped to that year.
771
+ // Outcome splits (Won vs Lost) operate within each year — both SetA and SetB
772
+ // are scoped to the same time window. --use-prior (unbounded) is silently
773
+ // ignored — the year is used for scoping regardless.
774
+ if (yearRange && yearRange.entries.length > 0) {
775
+ for (const entry of yearRange.entries) {
776
+ const ctx = {
777
+ outcomeLabels: { trueLabel: outcome.trueLabel, falseLabel: outcome.falseLabel },
778
+ timeLabel: String(entry.year),
779
+ year: entry.year,
780
+ unbounded: false,
781
+ recordTypeName: options.recordType,
782
+ categoryOverride: options.category,
783
+ timeCategoryOverride: options.timeCategory,
784
+ segmentCategoryOverride: options.segmentCategory,
785
+ descriptionOverride: options.description,
786
+ noValueFrequency: options.noValueFrequency,
787
+ namePrefix: options.namePrefix,
788
+ nameSuffix: options.nameSuffix,
789
+ portabilityNaming: options.portabilityNaming,
790
+ origin: options.origin,
791
+ };
792
+ inputs.push({
793
+ name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, 'metadata', ctx),
794
+ objectName: obj.name,
795
+ objectLabel: obj.label,
796
+ // CLI-3375: wire-level method='outcome' for year-scoped outcome candidates (honest tagging).
797
+ // Name/metadata resolution still keys off 'metadata' — semantic shape only.
798
+ method: 'outcome',
799
+ ...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, 'metadata', ctx),
800
+ isActive: true,
801
+ noValueFrequency: options.noValueFrequency,
802
+ discoverFields: true,
803
+ recordTypeName: options.recordType,
804
+ filterJson: DefinitionFieldGenerationService.buildOutcomeFilterJson(outcome.fieldName, obj.name, undefined, 'CreatedDate', obj.label, { year: entry.year, unbounded: entry.unbounded }),
805
+ });
806
+ }
807
+ continue;
808
+ }
809
+ // Lifetime path (no date literal, no year): original behavior — single definition per object
810
+ inputs.push(DefinitionFieldGenerationService.buildOutcomeInput(obj, outcome, options));
811
+ }
812
+ return inputs;
813
+ }
814
+ /**
815
+ * Builds one filter-free metadata-only input per object. Extracted from `buildCandidateInputs`
816
+ * (CLI-3375) to enforce the contract that a metadata-only definition is filter-irrelevant by
817
+ * design — independent of whether the caller passed a date-literal range. Used by the
818
+ * metadata-variant short-circuit at the top of `buildCandidateInputs`.
819
+ */
820
+ static buildMetadataInputsForObjects(objects, options) {
821
+ const inputs = [];
822
+ for (const obj of objects) {
823
+ const ctx = {
824
+ recordTypeName: options.recordType,
825
+ categoryOverride: options.category,
826
+ timeCategoryOverride: options.timeCategory,
827
+ segmentCategoryOverride: options.segmentCategory,
828
+ descriptionOverride: options.description,
829
+ noValueFrequency: options.noValueFrequency,
830
+ namePrefix: options.namePrefix,
831
+ nameSuffix: options.nameSuffix,
832
+ portabilityNaming: options.portabilityNaming,
833
+ origin: options.origin,
834
+ };
835
+ inputs.push({
836
+ name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, 'metadata', ctx),
837
+ objectName: obj.name,
838
+ objectLabel: obj.label,
839
+ method: 'metadata',
840
+ ...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, 'metadata', ctx),
841
+ isActive: true,
842
+ noValueFrequency: options.noValueFrequency,
843
+ recordTypeName: options.recordType,
844
+ discoverFields: true,
845
+ });
846
+ }
847
+ return inputs;
848
+ }
849
+ /**
850
+ * Builds (object × dateLiteralEntry) inputs for historical and comparative methods. Extracted
851
+ * from `buildCandidateInputs` (CLI-3375) to keep that method's cyclomatic complexity within
852
+ * lint limits after introducing the metadata-variant short-circuit. The metadata variant does
853
+ * NOT route through here — see `buildMetadataInputsForObjects` for that path.
854
+ */
855
+ static buildDateLiteralInputs(objects,
856
+ // Includes 'metadata' for type compatibility with the caller's narrower union; in practice the
857
+ // caller short-circuits the metadata variant via `buildMetadataInputsForObjects` before reaching here.
858
+ method, options) {
859
+ const inputs = [];
860
+ const dateField = options.dateLiteralRange.dateField;
861
+ for (const obj of objects) {
862
+ for (const dlEntry of options.dateLiteralRange.entries) {
863
+ const isLifetimeComparative = method === 'comparative' && options.lifetimePrimary === true;
864
+ const isRegularComparative = method === 'comparative' && options.lifetimePrimary !== true;
865
+ const ctx = {
866
+ timeLabel: dlEntry.label,
867
+ dateField,
868
+ lifetimePrimary: isLifetimeComparative,
869
+ recordTypeName: options.recordType,
870
+ categoryOverride: options.category,
871
+ timeCategoryOverride: options.timeCategory,
872
+ segmentCategoryOverride: options.segmentCategory,
873
+ descriptionOverride: options.description,
874
+ noValueFrequency: options.noValueFrequency,
875
+ namePrefix: options.namePrefix,
876
+ nameSuffix: options.nameSuffix,
877
+ portabilityNaming: options.portabilityNaming,
878
+ origin: options.origin,
879
+ };
880
+ const filterJson = DefinitionFieldGenerationService.pickDateLiteralComparativeFilter(dlEntry.literal, isLifetimeComparative, dateField, obj.name, obj.label, isRegularComparative);
881
+ inputs.push({
882
+ name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, method, ctx),
883
+ objectName: obj.name,
884
+ objectLabel: obj.label,
885
+ method,
886
+ ...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, method, ctx),
887
+ isActive: true,
888
+ lifetimePrimary: isLifetimeComparative,
889
+ noValueFrequency: options.noValueFrequency,
890
+ recordTypeName: options.recordType,
891
+ discoverFields: true,
892
+ filterJson,
893
+ });
894
+ }
895
+ }
896
+ return inputs;
897
+ }
898
+ }
899
+ //# sourceMappingURL=DefinitionFieldGenerationService.js.map