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

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