@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,904 @@
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 { createSuccessResult, createFailureResult } from '../models/service-result.js';
9
+ import { ServiceErrorCodes } from '../adapters/errors.js';
10
+ import { CuneiformQueryBuilder } from '../adapters/soql/cuneiform-query-builder.js';
11
+ import { categorizeNamespace } from './namespace-constants.js';
12
+ // ─────────────────────────────────────────────────────────────────────────────
13
+ // Service Implementation
14
+ // ─────────────────────────────────────────────────────────────────────────────
15
+ /** Valid filter type values */
16
+ const VALID_FILTER_TYPES = new Set(['all', 'standard', 'custom']);
17
+ /** Valid classification values */
18
+ const VALID_CLASSIFICATIONS = new Set(['customer', 'internal', 'all']);
19
+ /** Valid sort field values */
20
+ const VALID_SORT_FIELDS = new Set(['name', 'recordCount', 'label']);
21
+ /**
22
+ * Orchestration service for the `sf cuneiform object list` command.
23
+ *
24
+ * Composes ObjectFilteringService for filtering and ContactPointService for
25
+ * contact point analysis. Computes summary statistics and namespace distribution.
26
+ *
27
+ * @design
28
+ * This is an orchestration service (not a domain service). It coordinates multiple
29
+ * services to fulfill command requirements, handles flag-specific logic, and
30
+ * transforms results into the command's expected output structure.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * const service = new ObjectListCommandService({
35
+ * objectFilteringService,
36
+ * contactPointService,
37
+ * restAdapter,
38
+ * logger: console,
39
+ * });
40
+ *
41
+ * // List custom objects with contact point analysis
42
+ * const result = await service.listObjects({
43
+ * filter: 'custom',
44
+ * withRecords: true,
45
+ * withContactPoints: true,
46
+ * minRecords: 1000,
47
+ * });
48
+ *
49
+ * if (result.success) {
50
+ * console.log(`Found ${result.data.summary.totalObjects} objects`);
51
+ * console.log(`Standard: ${result.data.summary.standardObjects}`);
52
+ * console.log(`Custom: ${result.data.summary.customObjects}`);
53
+ * }
54
+ * ```
55
+ */
56
+ export class ObjectListCommandService {
57
+ objectFilteringService;
58
+ contactPointService;
59
+ restApiAdapter;
60
+ soqlAdapter;
61
+ logger;
62
+ constructor(config) {
63
+ this.objectFilteringService = config.objectFilteringService;
64
+ this.contactPointService = config.contactPointService;
65
+ this.restApiAdapter = config.restApiAdapter;
66
+ this.soqlAdapter = config.soqlAdapter;
67
+ this.logger = config.logger;
68
+ }
69
+ /**
70
+ * Groups objects by their namespace category.
71
+ *
72
+ * Uses categorizeNamespace() to classify each object's namespace,
73
+ * then groups into standard/industry/managed/custom buckets with
74
+ * human-readable labels.
75
+ *
76
+ * @param objects - Array of ObjectListItem to group
77
+ * @returns Array of NamespaceCategoryGroup, ordered: standard, industry, managed, custom.
78
+ * Empty categories are omitted.
79
+ */
80
+ static groupObjectsByNamespaceCategory(objects) {
81
+ const categoryLabels = {
82
+ standard: 'Standard Objects',
83
+ industry: 'Industry Cloud',
84
+ managed: 'Managed Packages',
85
+ custom: 'Custom Packages',
86
+ };
87
+ const displayOrder = ['standard', 'industry', 'managed', 'custom'];
88
+ // Group objects by category
89
+ const grouped = new Map();
90
+ for (const obj of objects) {
91
+ const category = categorizeNamespace(obj.namespace);
92
+ const existing = grouped.get(category);
93
+ if (existing) {
94
+ existing.push(obj);
95
+ }
96
+ else {
97
+ grouped.set(category, [obj]);
98
+ }
99
+ }
100
+ // Build results in display order, skipping empty categories
101
+ const results = [];
102
+ for (const category of displayOrder) {
103
+ const categoryObjects = grouped.get(category);
104
+ if (categoryObjects && categoryObjects.length > 0) {
105
+ results.push({
106
+ category,
107
+ label: categoryLabels[category],
108
+ objects: categoryObjects,
109
+ count: categoryObjects.length,
110
+ });
111
+ }
112
+ }
113
+ return results;
114
+ }
115
+ /**
116
+ * Sorts objects by the specified field.
117
+ *
118
+ * @param objects - Objects to sort
119
+ * @param sort - Sort field
120
+ * @returns Sorted array (new array, not mutated)
121
+ */
122
+ static sortObjects(objects, sort) {
123
+ const sorted = [...objects];
124
+ sorted.sort((a, b) => {
125
+ switch (sort) {
126
+ case 'name':
127
+ return a.apiName.localeCompare(b.apiName);
128
+ case 'label':
129
+ return a.label.localeCompare(b.label);
130
+ case 'recordCount': {
131
+ // Sort by record count descending (highest first), then by label ascending for ties.
132
+ // CLI-4214: an unknown count (undefined) sorts as the lowest value so it lands last.
133
+ const countDiff = (b.recordCount ?? -1) - (a.recordCount ?? -1);
134
+ if (countDiff !== 0)
135
+ return countDiff;
136
+ return a.label.localeCompare(b.label);
137
+ }
138
+ }
139
+ });
140
+ return sorted;
141
+ }
142
+ /**
143
+ * Determines whether any enrichment flag requiring describe calls is active.
144
+ */
145
+ static needsDescribeCalls(options) {
146
+ return (options.includeFieldCounts === true || options.includeReferences === true || options.withContactPoints === true);
147
+ }
148
+ /**
149
+ * Builds FilterOptions from command options.
150
+ *
151
+ * `excludeSystemObjects` is set unconditionally — system suffix types
152
+ * (`__Feed`, `__History`, `__Share`, `__mdt`, `__ChangeEvent`, `__e`) are never
153
+ * valid object list targets. The shared `NON_DATA_SUFFIX_PATTERN` filter lives
154
+ * in `ObjectFilteringService.applySystemObjectExclusion` (CLI-3374 mirrors the
155
+ * opt-in PR #292 applied to `definition create`).
156
+ */
157
+ static buildFilterOptions(options) {
158
+ const filterOptions = {
159
+ type: options.filter === 'all' ? undefined : options.filter,
160
+ classification: options.classification,
161
+ withRecords: options.withRecords,
162
+ withoutRecords: options.withoutRecords,
163
+ withOwner: options.withOwner,
164
+ hasRecordTypes: options.withRecordTypes,
165
+ excludeSystemObjects: true,
166
+ };
167
+ if (options.namespace !== undefined) {
168
+ filterOptions.namespace = options.namespace;
169
+ }
170
+ if (options.pattern !== undefined) {
171
+ filterOptions.nameFilter = {
172
+ value: options.pattern,
173
+ operator: options.pattern.includes('*') ? 'wildcard' : 'contains',
174
+ };
175
+ }
176
+ return filterOptions;
177
+ }
178
+ /**
179
+ * Validates command options and returns an error message if invalid.
180
+ *
181
+ * @param options - Options to validate
182
+ * @returns Error message if invalid, undefined if valid
183
+ */
184
+ static validateOptions(options) {
185
+ // Validate filter type
186
+ if (options.filter !== undefined && !VALID_FILTER_TYPES.has(options.filter)) {
187
+ return `Invalid filter type: "${options.filter}". Must be 'all', 'standard', or 'custom'.`;
188
+ }
189
+ // Validate sort field
190
+ if (options.sort !== undefined && !VALID_SORT_FIELDS.has(options.sort)) {
191
+ return `Invalid sort field: "${options.sort}". Must be 'name', 'recordCount', or 'label'.`;
192
+ }
193
+ // Validate mutually exclusive flags
194
+ if (options.withRecords && options.withoutRecords) {
195
+ return 'Cannot specify both --with-records and --without-records.';
196
+ }
197
+ // Validate classification
198
+ if (options.classification !== undefined && !VALID_CLASSIFICATIONS.has(options.classification)) {
199
+ return `Invalid classification: "${options.classification}". Must be 'customer', 'internal', or 'all'.`;
200
+ }
201
+ // Validate minRecords
202
+ if (options.minRecords !== undefined) {
203
+ if (!Number.isInteger(options.minRecords) || options.minRecords < 0) {
204
+ return `Invalid min-records value: ${options.minRecords}. Must be a non-negative integer.`;
205
+ }
206
+ }
207
+ // Validate limit
208
+ if (options.limit !== undefined) {
209
+ if (!Number.isInteger(options.limit) || options.limit < 1) {
210
+ return `Invalid limit value: ${options.limit}. Must be a positive integer.`;
211
+ }
212
+ }
213
+ return ObjectListCommandService.validateObjectFlagConflicts(options);
214
+ }
215
+ /**
216
+ * Validates that `--object` is not combined with mutually exclusive flags.
217
+ *
218
+ * @returns Error message if a conflict is detected, undefined if valid
219
+ */
220
+ static validateObjectFlagConflicts(options) {
221
+ if (options.object === undefined)
222
+ return undefined;
223
+ if (options.object.trim().length === 0) {
224
+ return 'Object name cannot be empty.';
225
+ }
226
+ if (options.filter !== undefined && options.filter !== 'all') {
227
+ return 'Cannot use --filter with --object. These flags are mutually exclusive.';
228
+ }
229
+ if (options.namespace !== undefined) {
230
+ return 'Cannot use --namespace with --object. These flags are mutually exclusive.';
231
+ }
232
+ if (options.pattern !== undefined) {
233
+ return 'Cannot use --pattern with --object. These flags are mutually exclusive.';
234
+ }
235
+ if (options.withoutRecords) {
236
+ return 'Cannot use --without-records with --object. These flags are mutually exclusive.';
237
+ }
238
+ if (options.minRecords !== undefined && options.minRecords > 0) {
239
+ return 'Cannot use --min-records with --object. These flags are mutually exclusive.';
240
+ }
241
+ return undefined;
242
+ }
243
+ /**
244
+ * Determines if an object is external (ends with __x).
245
+ *
246
+ * @param name - Object API name
247
+ * @returns True if external object
248
+ */
249
+ static isExternalObject(name) {
250
+ return name.endsWith('__x');
251
+ }
252
+ /**
253
+ * Determines if an object is a Big Object (ends with __b).
254
+ *
255
+ * @param name - Object API name
256
+ * @returns True if Big Object
257
+ */
258
+ static isBigObject(name) {
259
+ return name.endsWith('__b');
260
+ }
261
+ /**
262
+ * Determines if an object is a Custom Metadata Type (ends with __mdt).
263
+ *
264
+ * @param name - Object API name
265
+ * @returns True if Custom Metadata Type
266
+ */
267
+ static isCustomMetadataType(name) {
268
+ return name.endsWith('__mdt');
269
+ }
270
+ /**
271
+ * Determines if an object is a Platform Event (ends with __e).
272
+ *
273
+ * @param name - Object API name
274
+ * @returns True if Platform Event
275
+ */
276
+ static isPlatformEvent(name) {
277
+ return name.endsWith('__e');
278
+ }
279
+ /**
280
+ * Extracts namespace from an object API name.
281
+ *
282
+ * @param name - Object API name
283
+ * @returns Namespace prefix or null for unmanaged objects
284
+ */
285
+ static extractNamespace(name) {
286
+ const parts = name.split('__');
287
+ // Namespace pattern: ns__Object__c has 3+ parts
288
+ if (parts.length >= 3) {
289
+ return parts[0];
290
+ }
291
+ return null;
292
+ }
293
+ /**
294
+ * Computes namespace distribution from a list of objects.
295
+ *
296
+ * @param objects - Array of SObjectInfo
297
+ * @returns Array of namespace counts, sorted by count descending
298
+ */
299
+ static computeNamespaceCounts(objects) {
300
+ const counts = new Map();
301
+ for (const obj of objects) {
302
+ const ns = obj.namespace ?? null;
303
+ counts.set(ns, (counts.get(ns) ?? 0) + 1);
304
+ }
305
+ // Convert to array and sort by count descending, then by namespace
306
+ const result = [];
307
+ for (const [namespace, count] of counts) {
308
+ result.push({ namespace, count });
309
+ }
310
+ result.sort((a, b) => {
311
+ if (b.count !== a.count) {
312
+ return b.count - a.count;
313
+ }
314
+ // null namespace sorts last
315
+ if (a.namespace === null)
316
+ return 1;
317
+ if (b.namespace === null)
318
+ return -1;
319
+ return a.namespace.localeCompare(b.namespace);
320
+ });
321
+ return result;
322
+ }
323
+ /**
324
+ * Creates an empty ObjectListResult for error cases.
325
+ *
326
+ * @param options - Applied filter options
327
+ * @returns Empty result structure
328
+ */
329
+ static createEmptyResult(options) {
330
+ return {
331
+ summary: {
332
+ totalObjects: 0,
333
+ withRecords: 0,
334
+ withoutRecords: 0,
335
+ standardObjects: 0,
336
+ customObjects: 0,
337
+ externalObjects: 0,
338
+ withNamespace: 0,
339
+ withoutNamespace: 0,
340
+ namespaceCounts: [],
341
+ totalRecordCount: 0,
342
+ },
343
+ filters: options,
344
+ objects: [],
345
+ };
346
+ }
347
+ /**
348
+ * Transforms ContactPointAnalysis to ContactPointSummary.
349
+ *
350
+ * @param analysis - ContactPointAnalysis from ContactPointService
351
+ * @returns ContactPointSummary for ObjectListItem
352
+ */
353
+ static transformContactPointAnalysis(analysis) {
354
+ const emailFields = [];
355
+ const phoneFields = [];
356
+ const urlFields = [];
357
+ for (const field of analysis.contactPointFields) {
358
+ const fieldInfo = {
359
+ apiName: field.fieldName,
360
+ label: field.fieldLabel,
361
+ isStandard: !field.fieldName.endsWith('__c'),
362
+ };
363
+ switch (field.contactPointType) {
364
+ case 'email':
365
+ emailFields.push(fieldInfo);
366
+ break;
367
+ case 'phone':
368
+ phoneFields.push(fieldInfo);
369
+ break;
370
+ // URL fields are detected by fieldType 'url' or name patterns
371
+ // ContactPointService uses 'other' for URL-like fields
372
+ default:
373
+ // Check if it might be a URL field by name
374
+ if (field.fieldName.toLowerCase().includes('url') || field.fieldName.toLowerCase().includes('website')) {
375
+ urlFields.push(fieldInfo);
376
+ }
377
+ }
378
+ }
379
+ return {
380
+ emailFields,
381
+ phoneFields,
382
+ urlFields,
383
+ summary: {
384
+ emailCount: emailFields.length,
385
+ phoneCount: phoneFields.length,
386
+ urlCount: urlFields.length,
387
+ totalContactPoints: emailFields.length + phoneFields.length + urlFields.length,
388
+ },
389
+ };
390
+ }
391
+ /**
392
+ * Computes summary statistics from filtered objects.
393
+ *
394
+ * @param objects - Filtered SObjectInfo array
395
+ * @returns ObjectListSummary
396
+ */
397
+ static computeSummary(objects) {
398
+ let withRecords = 0;
399
+ let withoutRecords = 0;
400
+ let standardObjects = 0;
401
+ let customObjects = 0;
402
+ let externalObjects = 0;
403
+ let withNamespace = 0;
404
+ let withoutNamespace = 0;
405
+ let withOwnerCount = 0;
406
+ let withRecordTypesCount = 0;
407
+ let hasOwnerData = false;
408
+ let hasRecordTypesData = false;
409
+ let totalRecordCount = 0;
410
+ for (const obj of objects) {
411
+ // Record count categorization and accumulation
412
+ totalRecordCount += obj.recordCount ?? 0;
413
+ if (obj.recordCount !== undefined && obj.recordCount > 0) {
414
+ withRecords++;
415
+ }
416
+ else {
417
+ withoutRecords++;
418
+ }
419
+ // Object type categorization
420
+ if (obj.isCustom) {
421
+ customObjects++;
422
+ }
423
+ else {
424
+ standardObjects++;
425
+ }
426
+ // External object count
427
+ if (ObjectListCommandService.isExternalObject(obj.name)) {
428
+ externalObjects++;
429
+ }
430
+ // Namespace presence count
431
+ const ns = ObjectListCommandService.extractNamespace(obj.name);
432
+ if (ns) {
433
+ withNamespace++;
434
+ }
435
+ else {
436
+ withoutNamespace++;
437
+ }
438
+ // Owner field count (only meaningful when data is populated)
439
+ if (obj.hasOwner !== undefined) {
440
+ hasOwnerData = true;
441
+ if (obj.hasOwner)
442
+ withOwnerCount++;
443
+ }
444
+ // Record types count (only meaningful when data is populated)
445
+ if (obj.hasRecordTypes !== undefined) {
446
+ hasRecordTypesData = true;
447
+ if (obj.hasRecordTypes)
448
+ withRecordTypesCount++;
449
+ }
450
+ }
451
+ return {
452
+ totalObjects: objects.length,
453
+ withRecords,
454
+ withoutRecords,
455
+ standardObjects,
456
+ customObjects,
457
+ externalObjects,
458
+ withNamespace,
459
+ withoutNamespace,
460
+ withOwner: hasOwnerData ? withOwnerCount : undefined,
461
+ withRecordTypes: hasRecordTypesData ? withRecordTypesCount : undefined,
462
+ namespaceCounts: ObjectListCommandService.computeNamespaceCounts(objects),
463
+ totalRecordCount,
464
+ };
465
+ }
466
+ /**
467
+ * Computes enrichment aggregate totals from post-enrichment object items.
468
+ * Returns a partial summary with only the enrichment totals that are active.
469
+ */
470
+ static computeEnrichmentTotals(items, options) {
471
+ const totals = {};
472
+ if (options.includeFieldCounts) {
473
+ totals.totalFieldCount = items.reduce((sum, obj) => sum + (obj.totalFields ?? 0), 0);
474
+ totals.totalCustomFieldCount = items.reduce((sum, obj) => sum + (obj.customFields ?? 0), 0);
475
+ }
476
+ if (options.includeReferences) {
477
+ totals.totalReferenceCount = items.reduce((sum, obj) => sum + (obj.lookupFieldCount ?? 0), 0);
478
+ }
479
+ if (options.withContactPoints) {
480
+ totals.totalContactPoints = items.reduce((sum, obj) => sum + (obj.contactPoints?.summary.totalContactPoints ?? 0), 0);
481
+ }
482
+ if (options.withRecordTypes) {
483
+ totals.totalRecordTypeCount = items.reduce((sum, obj) => sum + (obj.recordTypeCount ?? 0), 0);
484
+ }
485
+ if (options.withBusinessProcess) {
486
+ totals.totalBusinessProcessCount = items.reduce((sum, obj) => sum + (obj.businessProcessCount ?? 0), 0);
487
+ }
488
+ return totals;
489
+ }
490
+ /**
491
+ * Normalizes a warnings array to `undefined` when empty (CLI-4214).
492
+ * Keeps the truncation disclosure on the result while avoiding empty arrays.
493
+ *
494
+ * @param warnings - Warnings from the filtering service result
495
+ * @returns The warnings array when non-empty, otherwise undefined
496
+ */
497
+ static normalizeWarnings(warnings) {
498
+ return warnings && warnings.length > 0 ? warnings : undefined;
499
+ }
500
+ /**
501
+ * Transforms SObjectInfo array to ObjectListItem array.
502
+ *
503
+ * @param objects - SObjectInfo array from filtering
504
+ * @returns ObjectListItem array
505
+ */
506
+ static transformToListItems(objects) {
507
+ const items = [];
508
+ for (const obj of objects) {
509
+ const item = {
510
+ apiName: obj.name,
511
+ label: obj.label,
512
+ keyPrefix: null, // Will be populated if available from describe
513
+ // CLI-4214: carry the count and its provenance verbatim. Do NOT coerce an
514
+ // undefined count to 0 — an unknown count must render as unknown, not zero.
515
+ recordCount: obj.recordCount,
516
+ recordCountProvenance: obj.recordCountProvenance,
517
+ isCustom: obj.isCustom,
518
+ isExternal: ObjectListCommandService.isExternalObject(obj.name),
519
+ namespace: ObjectListCommandService.extractNamespace(obj.name),
520
+ isCustomer: obj.isCustomer,
521
+ hasOwner: obj.hasOwner,
522
+ hasRecordTypes: obj.hasRecordTypes,
523
+ };
524
+ items.push(item);
525
+ }
526
+ return items;
527
+ }
528
+ /**
529
+ * Lists Salesforce objects with filtering, summary statistics, and optional contact point analysis.
530
+ *
531
+ * @param options - Command options mapping to CLI flags
532
+ * @returns ServiceResult containing ObjectListResult
533
+ */
534
+ async listObjects(options = {}) {
535
+ const startTime = Date.now();
536
+ const emptyResult = ObjectListCommandService.createEmptyResult(options);
537
+ // Validate options
538
+ const validationError = ObjectListCommandService.validateOptions(options);
539
+ if (validationError) {
540
+ return createFailureResult(emptyResult, ServiceErrorCodes.OBJECT_LIST_QUERY_FAILED, validationError, {
541
+ metadata: { duration: Date.now() - startTime },
542
+ });
543
+ }
544
+ try {
545
+ this.logger?.log('ObjectListCommandService: Starting object list operation');
546
+ // Single-object short-circuit: bypass ObjectFilteringService and REST delegation
547
+ if (options.object) {
548
+ return await this.listSingleObject(options.object, options, startTime);
549
+ }
550
+ // Build filter options and execute filtering
551
+ const filterOptions = ObjectListCommandService.buildFilterOptions(options);
552
+ const filterResult = await this.objectFilteringService.filter(filterOptions);
553
+ if (!filterResult.success) {
554
+ return createFailureResult(emptyResult, ServiceErrorCodes.OBJECT_LIST_FILTER_FAILED, filterResult.message ?? 'Filter operation failed', { metadata: { duration: Date.now() - startTime } });
555
+ }
556
+ let filteredObjects = filterResult.data;
557
+ // Exclude Big Objects by default (not queryable via standard SOQL)
558
+ filteredObjects = filteredObjects.filter((obj) => !ObjectListCommandService.isBigObject(obj.name));
559
+ // Exclude Custom Metadata Types by default (configuration metadata, not data objects)
560
+ filteredObjects = filteredObjects.filter((obj) => !ObjectListCommandService.isCustomMetadataType(obj.name));
561
+ // Exclude Platform Events by default (event bus objects, not queryable data objects)
562
+ filteredObjects = filteredObjects.filter((obj) => !ObjectListCommandService.isPlatformEvent(obj.name));
563
+ // Apply minRecords filter
564
+ if (options.minRecords !== undefined && options.minRecords > 0) {
565
+ filteredObjects = filteredObjects.filter((obj) => (obj.recordCount ?? 0) >= options.minRecords);
566
+ }
567
+ // Compute summary statistics (before limiting)
568
+ const summary = ObjectListCommandService.computeSummary(filteredObjects);
569
+ // Transform to ObjectListItem array
570
+ let objectItems = ObjectListCommandService.transformToListItems(filteredObjects);
571
+ // Sort before limiting — sort must happen on the full set, not a truncated page.
572
+ // CLI-3601: apply the recordCount-desc default at the service layer so programmatic
573
+ // callers get deterministic ordering even when options.sort is omitted. ObjectListService
574
+ // (the lower-level composition service used by the MCP `cuneiform_object_list` tool)
575
+ // applies the same default in its own `listObjects()` — see ObjectListService.ts § "Sort".
576
+ // The command-layer flag default ('recordCount') is preserved for help-text
577
+ // discoverability but is redundant w.r.t. this service-level guarantee.
578
+ const sortField = options.sort ?? 'recordCount';
579
+ objectItems = ObjectListCommandService.sortObjects(objectItems, sortField);
580
+ // Apply limit after sort
581
+ if (options.limit !== undefined && options.limit < objectItems.length) {
582
+ objectItems = objectItems.slice(0, options.limit);
583
+ }
584
+ // Apply enrichments (field counts, references, record types, contact points)
585
+ // Shared describe session: when multiple field-data enrichments are active,
586
+ // describe calls are made once and shared across all enrichments.
587
+ const hasEnrichments = options.includeFieldCounts === true ||
588
+ options.includeReferences === true ||
589
+ options.withContactPoints === true ||
590
+ options.withRecordTypes === true ||
591
+ options.withBusinessProcess === true;
592
+ if (hasEnrichments) {
593
+ objectItems = await this.applyEnrichments(objectItems, options);
594
+ }
595
+ // Compute enrichment aggregate totals from post-enrichment data
596
+ Object.assign(summary, ObjectListCommandService.computeEnrichmentTotals(objectItems, options));
597
+ // Build contact point analysis metadata (if requested)
598
+ let contactPointAnalysis;
599
+ if (options.withContactPoints) {
600
+ const minThreshold = options.minRecords ?? 0;
601
+ const analyzedCount = objectItems.filter((obj) => (obj.recordCount ?? -1) >= minThreshold).length;
602
+ contactPointAnalysis = {
603
+ analyzedCount,
604
+ minRecordsThreshold: minThreshold,
605
+ };
606
+ }
607
+ const result = {
608
+ summary,
609
+ filters: options,
610
+ objects: objectItems,
611
+ // CLI-4214: surface the filtering chain's reconciliation truncation disclosure.
612
+ warnings: ObjectListCommandService.normalizeWarnings(filterResult.warnings),
613
+ contactPointAnalysis,
614
+ };
615
+ const duration = Date.now() - startTime;
616
+ this.logger?.log(`ObjectListCommandService: Completed in ${duration}ms, found ${summary.totalObjects} objects`);
617
+ return createSuccessResult(result, {
618
+ message: `Found ${summary.totalObjects} objects matching filter criteria`,
619
+ metadata: { duration },
620
+ });
621
+ }
622
+ catch (error) {
623
+ const errorMessage = error instanceof Error ? error.message : String(error);
624
+ this.logger?.log(`ObjectListCommandService: Failed - ${errorMessage}`);
625
+ return createFailureResult(emptyResult, ServiceErrorCodes.OBJECT_LIST_QUERY_FAILED, errorMessage, {
626
+ metadata: { duration: Date.now() - startTime },
627
+ });
628
+ }
629
+ }
630
+ /**
631
+ * Single-object short-circuit for the `--object` flag.
632
+ *
633
+ * Bypasses ObjectFilteringService entirely. Uses describeGlobal to confirm
634
+ * the object exists, then getRecordCounts to fetch the real record count
635
+ * in one targeted call.
636
+ *
637
+ * @param objectName - API name of the target object (case-insensitive match)
638
+ * @param options - Full command options (enrichments still apply)
639
+ * @param startTime - Operation start timestamp for duration tracking
640
+ */
641
+ async listSingleObject(objectName, options, startTime) {
642
+ const emptyResult = ObjectListCommandService.createEmptyResult(options);
643
+ if (!this.restApiAdapter) {
644
+ return createFailureResult(emptyResult, ServiceErrorCodes.OBJECT_LIST_QUERY_FAILED, '--object requires a REST API adapter; none was provided', { metadata: { duration: Date.now() - startTime } });
645
+ }
646
+ // Verify object exists via describeGlobal (case-insensitive name match)
647
+ const globalResult = await this.restApiAdapter.describeGlobal();
648
+ if (!globalResult.success) {
649
+ return createFailureResult(emptyResult, ServiceErrorCodes.OBJECT_LIST_GLOBAL_DESCRIBE_FAILED, globalResult.message ?? 'Global describe failed', { metadata: { duration: Date.now() - startTime } });
650
+ }
651
+ const sobject = globalResult.data.sobjects.find((s) => s.name.toLowerCase() === objectName.toLowerCase());
652
+ if (!sobject) {
653
+ return createFailureResult(emptyResult, ServiceErrorCodes.OBJECT_LIST_QUERY_FAILED, `Object "${objectName}" was not found in this org`, { metadata: { duration: Date.now() - startTime } });
654
+ }
655
+ // Fetch real record count directly — no filter chain needed.
656
+ // Fail loudly on count-fetch failure: returning recordCount: 0 silently would recreate the
657
+ // exact "default-50 trap" CLI-3041 was created to fix.
658
+ const countResult = await this.restApiAdapter.getRecordCounts([sobject.name]);
659
+ if (!countResult.success) {
660
+ return createFailureResult(emptyResult, ServiceErrorCodes.OBJECT_LIST_QUERY_FAILED, `Failed to fetch record count for "${sobject.name}": ${countResult.message ?? 'unknown error'}`, { metadata: { duration: Date.now() - startTime } });
661
+ }
662
+ const recordCount = countResult.data.get(sobject.name) ?? 0;
663
+ const info = {
664
+ name: sobject.name,
665
+ label: sobject.label,
666
+ isCustom: sobject.custom,
667
+ namespace: ObjectListCommandService.extractNamespace(sobject.name) ?? undefined,
668
+ recordCount,
669
+ // CLI-4214: the single-object path fetches an authoritative count via getRecordCounts.
670
+ recordCountProvenance: 'queried',
671
+ };
672
+ const summary = ObjectListCommandService.computeSummary([info]);
673
+ // Build ObjectListItem, enriching keyPrefix and labelPlural from global describe
674
+ const baseItem = ObjectListCommandService.transformToListItems([info])[0];
675
+ let objectItems = [
676
+ { ...baseItem, keyPrefix: sobject.keyPrefix, labelPlural: sobject.labelPlural },
677
+ ];
678
+ // Apply any requested enrichments (field counts, contact points, etc.)
679
+ const hasEnrichments = options.includeFieldCounts === true ||
680
+ options.includeReferences === true ||
681
+ options.withContactPoints === true ||
682
+ options.withRecordTypes === true ||
683
+ options.withBusinessProcess === true;
684
+ if (hasEnrichments) {
685
+ objectItems = await this.applyEnrichments(objectItems, options);
686
+ }
687
+ Object.assign(summary, ObjectListCommandService.computeEnrichmentTotals(objectItems, options));
688
+ let contactPointAnalysis;
689
+ if (options.withContactPoints) {
690
+ contactPointAnalysis = {
691
+ analyzedCount: objectItems.length,
692
+ minRecordsThreshold: options.minRecords ?? 0,
693
+ };
694
+ }
695
+ const result = {
696
+ summary,
697
+ filters: options,
698
+ objects: objectItems,
699
+ contactPointAnalysis,
700
+ };
701
+ const duration = Date.now() - startTime;
702
+ this.logger?.log(`ObjectListCommandService: Single-object lookup completed in ${duration}ms — ${sobject.name} (${recordCount} records)`);
703
+ return createSuccessResult(result, {
704
+ message: `Found ${sobject.name} with ${recordCount} records`,
705
+ metadata: { duration },
706
+ });
707
+ }
708
+ /**
709
+ * Fetches object describes for enrichment, shared across all field-data flags.
710
+ *
711
+ * @param objectNames - Object API names to describe
712
+ * @returns Map of object name to DescribeSObjectResult
713
+ */
714
+ async fetchObjectDescribes(objectNames) {
715
+ if (!this.restApiAdapter || objectNames.length === 0) {
716
+ return new Map();
717
+ }
718
+ this.logger?.log(`ObjectListCommandService: Fetching describes for ${objectNames.length} objects`);
719
+ const result = await this.restApiAdapter.describeObjects(objectNames);
720
+ if (result.success) {
721
+ return result.data;
722
+ }
723
+ this.logger?.log(`ObjectListCommandService: Describe fetch failed: ${result.message ?? 'unknown error'}`);
724
+ return new Map();
725
+ }
726
+ /**
727
+ * Fetches record type counts via aggregate SOQL.
728
+ *
729
+ * @returns Map of SobjectType to active record type count
730
+ */
731
+ async fetchRecordTypeCounts() {
732
+ if (!this.soqlAdapter) {
733
+ return new Map();
734
+ }
735
+ this.logger?.log('ObjectListCommandService: Fetching record type counts');
736
+ const soql = new CuneiformQueryBuilder()
737
+ .select(['SobjectType', 'COUNT(Id) cnt'])
738
+ .from('RecordType')
739
+ .where('IsActive', '=', true)
740
+ .groupBy(['SobjectType'])
741
+ .toSOQL();
742
+ const result = await this.soqlAdapter.query(soql);
743
+ const counts = new Map();
744
+ if (result.success) {
745
+ for (const record of result.data.records) {
746
+ counts.set(record.SobjectType, record.cnt);
747
+ }
748
+ }
749
+ else {
750
+ this.logger?.log(`ObjectListCommandService: Record type count query failed: ${result.message ?? 'unknown error'}`);
751
+ }
752
+ return counts;
753
+ }
754
+ /**
755
+ * Fetches active business process counts via aggregate SOQL.
756
+ *
757
+ * BusinessProcess records are linked to objects via the TableEnumOrId field,
758
+ * which maps to the SobjectType (e.g., 'Opportunity', 'Lead', 'Case', 'Solution').
759
+ *
760
+ * @returns Map of SobjectType to active business process count
761
+ */
762
+ async fetchBusinessProcessCounts() {
763
+ if (!this.soqlAdapter) {
764
+ return new Map();
765
+ }
766
+ this.logger?.log('ObjectListCommandService: Fetching business process counts');
767
+ const soql = new CuneiformQueryBuilder()
768
+ .select(['TableEnumOrId', 'COUNT(Id) cnt'])
769
+ .from('BusinessProcess')
770
+ .where('IsActive', '=', true)
771
+ .groupBy(['TableEnumOrId'])
772
+ .toSOQL();
773
+ const result = await this.soqlAdapter.query(soql);
774
+ const counts = new Map();
775
+ if (result.success) {
776
+ for (const record of result.data.records) {
777
+ counts.set(record.TableEnumOrId, record.cnt);
778
+ }
779
+ }
780
+ else {
781
+ this.logger?.log(`ObjectListCommandService: Business process count query failed: ${result.message ?? 'unknown error'}`);
782
+ }
783
+ return counts;
784
+ }
785
+ /**
786
+ * Applies enrichment data (field counts, references, record types, business processes, contact points) to object items.
787
+ *
788
+ * When multiple field-data enrichments are active, describe calls are shared (not duplicated).
789
+ *
790
+ * @param objectItems - Object items to enrich
791
+ * @param options - Command options determining which enrichments to apply
792
+ * @returns Enriched object items
793
+ */
794
+ async applyEnrichments(objectItems, options) {
795
+ const objectNames = objectItems.map((obj) => obj.apiName);
796
+ let enrichedItems = [...objectItems];
797
+ const progress = options.onProgress;
798
+ // Shared describe session: fetch once, use for all field-data enrichments
799
+ let describeMap;
800
+ if (ObjectListCommandService.needsDescribeCalls(options)) {
801
+ progress?.('Retrieving object metadata...');
802
+ describeMap = await this.fetchObjectDescribes(objectNames);
803
+ }
804
+ // Apply field count enrichment
805
+ if (options.includeFieldCounts && describeMap) {
806
+ progress?.('Extracting field counts...');
807
+ const dm = describeMap;
808
+ enrichedItems = enrichedItems.map((item) => {
809
+ const describe = dm.get(item.apiName);
810
+ if (describe) {
811
+ return {
812
+ ...item,
813
+ totalFields: describe.fields.length,
814
+ customFields: describe.fields.filter((f) => f.custom).length,
815
+ };
816
+ }
817
+ return item;
818
+ });
819
+ }
820
+ // Apply reference field enrichment
821
+ if (options.includeReferences && describeMap) {
822
+ progress?.('Extracting reference fields...');
823
+ const dm = describeMap;
824
+ enrichedItems = enrichedItems.map((item) => {
825
+ const describe = dm.get(item.apiName);
826
+ if (describe) {
827
+ return {
828
+ ...item,
829
+ lookupFieldCount: describe.fields.filter((f) => f.referenceTo && f.referenceTo.length > 0).length,
830
+ };
831
+ }
832
+ return item;
833
+ });
834
+ }
835
+ // Apply record type count enrichment (independent SOQL, not from describe)
836
+ if (options.withRecordTypes) {
837
+ progress?.('Retrieving record type counts...');
838
+ const recordTypeCounts = await this.fetchRecordTypeCounts();
839
+ enrichedItems = enrichedItems.map((item) => ({
840
+ ...item,
841
+ recordTypeCount: recordTypeCounts.get(item.apiName) ?? 0,
842
+ }));
843
+ }
844
+ // Apply business process count enrichment (independent SOQL, not from describe)
845
+ if (options.withBusinessProcess) {
846
+ progress?.('Retrieving business process counts...');
847
+ const businessProcessCounts = await this.fetchBusinessProcessCounts();
848
+ enrichedItems = enrichedItems.map((item) => ({
849
+ ...item,
850
+ businessProcessCount: businessProcessCounts.get(item.apiName) ?? 0,
851
+ }));
852
+ }
853
+ // Apply contact point enrichment (uses shared describe if available)
854
+ if (options.withContactPoints) {
855
+ progress?.('Classifying contact points...');
856
+ const minThreshold = options.minRecords ?? 0;
857
+ const objectNamesToAnalyze = enrichedItems
858
+ .filter((obj) => (obj.recordCount ?? -1) >= minThreshold)
859
+ .map((obj) => obj.apiName);
860
+ this.logger?.log(`ObjectListCommandService: Analyzing contact points for ${objectNamesToAnalyze.length} objects (threshold: ${minThreshold})`);
861
+ const contactPointResults = await this.fetchContactPoints(objectNamesToAnalyze);
862
+ enrichedItems = enrichedItems.map((item) => {
863
+ const cp = contactPointResults.get(item.apiName);
864
+ return {
865
+ ...item,
866
+ contactPoints: contactPointResults.has(item.apiName) ? cp : undefined,
867
+ };
868
+ });
869
+ }
870
+ return enrichedItems;
871
+ }
872
+ /**
873
+ * Fetches contact point analysis for a list of object names.
874
+ *
875
+ * Uses parallel execution with per-promise catch to prevent one failure
876
+ * from blocking others. Returns a map of object name to contact point summary.
877
+ *
878
+ * @param objectNames - Object API names to analyze
879
+ * @returns Map of object name to ContactPointSummary (or null on failure)
880
+ */
881
+ async fetchContactPoints(objectNames) {
882
+ const resultsMap = new Map();
883
+ const fetchPromises = objectNames.map(async (objectName) => {
884
+ try {
885
+ const cpResult = await this.contactPointService.analyzeContactPoints(objectName);
886
+ if (cpResult.success) {
887
+ resultsMap.set(objectName, ObjectListCommandService.transformContactPointAnalysis(cpResult.data));
888
+ }
889
+ else {
890
+ resultsMap.set(objectName, null);
891
+ this.logger?.log(`Contact point analysis failed for ${objectName}: ${cpResult.message ?? 'unknown error'}`);
892
+ }
893
+ }
894
+ catch (error) {
895
+ resultsMap.set(objectName, null);
896
+ const errorMessage = error instanceof Error ? error.message : String(error);
897
+ this.logger?.log(`Contact point analysis error for ${objectName}: ${errorMessage}`);
898
+ }
899
+ });
900
+ await Promise.all(fetchPromises);
901
+ return resultsMap;
902
+ }
903
+ }
904
+ //# sourceMappingURL=ObjectListCommandService.js.map