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

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