@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,535 @@
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 { TERMINAL_STATUSES } from '../models/profiling-execution-types.js';
12
+ import { validateObjectName } from './validation.js';
13
+ /**
14
+ * Default bulk execution options.
15
+ */
16
+ const DEFAULT_BULK_OPTIONS = {
17
+ parallel: 5,
18
+ skipEmpty: true,
19
+ pollInterval: 5000,
20
+ waitForCompletion: true,
21
+ };
22
+ /**
23
+ * Minimum and maximum parallel threads for bulk execution.
24
+ */
25
+ const MIN_PARALLEL = 1;
26
+ const MAX_PARALLEL = 10;
27
+ /**
28
+ * Error resolution mappings for common Apex errors.
29
+ * Maps error patterns to user-friendly resolution guidance.
30
+ */
31
+ const ERROR_RESOLUTIONS = [
32
+ {
33
+ pattern: /FIELD_CUSTOM_VALIDATION_EXCEPTION/i,
34
+ resolution: 'Grant FLS (Field-Level Security) access or exclude the field from profiling.',
35
+ },
36
+ {
37
+ pattern: /INSUFFICIENT_ACCESS|NO_ACCESS/i,
38
+ resolution: 'Verify that required permission sets are assigned to the running user.',
39
+ },
40
+ {
41
+ pattern: /QUERY_TIMEOUT|System\.QueryException.*[Tt]imeout/i,
42
+ resolution: 'Reduce the number of records by adding filters or reduce the number of fields.',
43
+ },
44
+ {
45
+ pattern: /APEX_CPU_TIME_LIMIT|System\.LimitException.*CPU/i,
46
+ resolution: 'Reduce parallel threads using the --parallel flag to lower CPU pressure.',
47
+ },
48
+ {
49
+ pattern: /TOO_MANY_SOQL_QUERIES|System\.LimitException.*SOQL/i,
50
+ resolution: 'Reduce parallel threads or wait for other operations to complete.',
51
+ },
52
+ {
53
+ pattern: /TOO_MANY_DML_STATEMENTS|System\.LimitException.*DML/i,
54
+ resolution: 'Reduce parallel threads or simplify the profiling definition.',
55
+ },
56
+ {
57
+ pattern: /REQUIRED_FIELD_MISSING/i,
58
+ resolution: 'Ensure all required fields are populated in the profiling definition.',
59
+ },
60
+ {
61
+ pattern: /DUPLICATE_VALUE|already exists/i,
62
+ resolution: 'A profiling request already exists. Cancel the existing request or wait for completion.',
63
+ },
64
+ {
65
+ pattern: /INVALID_CROSS_REFERENCE_KEY|Record Type.*not found/i,
66
+ resolution: 'Verify that the Record Type exists and is accessible to the running user.',
67
+ },
68
+ {
69
+ pattern: /ENTITY_IS_DELETED/i,
70
+ resolution: 'The profiling definition has been deleted. Refresh and select a valid definition.',
71
+ },
72
+ ];
73
+ /**
74
+ * Semaphore for controlling concurrent execution.
75
+ *
76
+ * Implements a counting semaphore pattern to limit the number of
77
+ * concurrent operations. Used to control parallel profiling threads.
78
+ */
79
+ class Semaphore {
80
+ permits;
81
+ waitQueue = [];
82
+ /**
83
+ * Creates a new semaphore with the specified number of permits.
84
+ *
85
+ * @param permits - Maximum number of concurrent operations allowed
86
+ */
87
+ constructor(permits) {
88
+ this.permits = permits;
89
+ }
90
+ /**
91
+ * Acquires a permit, blocking if none are available.
92
+ *
93
+ * @returns Promise that resolves when a permit is acquired
94
+ */
95
+ acquire() {
96
+ return new Promise((resolve) => {
97
+ if (this.permits > 0) {
98
+ this.permits--;
99
+ resolve();
100
+ }
101
+ else {
102
+ this.waitQueue.push(resolve);
103
+ }
104
+ });
105
+ }
106
+ /**
107
+ * Releases a permit, allowing a waiting operation to proceed.
108
+ */
109
+ release() {
110
+ const next = this.waitQueue.shift();
111
+ if (next) {
112
+ next();
113
+ }
114
+ else {
115
+ this.permits++;
116
+ }
117
+ }
118
+ }
119
+ /**
120
+ * Service for bulk execution of profiling definitions with controlled concurrency.
121
+ *
122
+ * Orchestrates parallel execution of multiple profiling definitions using a
123
+ * semaphore-based concurrency model. Receives an `IProfilingExecutor`
124
+ * callback object to decouple bulk orchestration from single-execution mechanics.
125
+ *
126
+ * Responsibilities:
127
+ * - Semaphore-based concurrency control (1-10 parallel threads)
128
+ * - Skip-empty logic (check record count before profiling)
129
+ * - Progress reporting via callbacks
130
+ * - Error resolution mapping for user-friendly guidance
131
+ * - Aggregate result summary (successful, failed, skipped)
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * const bulkService = new BulkExecutionService({
136
+ * soqlAdapter,
137
+ * pollingService,
138
+ * });
139
+ *
140
+ * const executor = {
141
+ * execute: (defId: string) => executionService.execute(defId),
142
+ * getStatus: (reqId: string) => executionService.getStatus(reqId),
143
+ * };
144
+ *
145
+ * const result = await bulkService.executeBulk(
146
+ * definitions,
147
+ * executor,
148
+ * { parallel: 5, skipEmpty: true },
149
+ * (update) => console.log(`${update.index + 1}/${update.total}: ${update.message}`)
150
+ * );
151
+ * ```
152
+ */
153
+ export class BulkExecutionService {
154
+ soqlAdapter;
155
+ pollingService;
156
+ logger;
157
+ constructor(config) {
158
+ this.soqlAdapter = config.soqlAdapter;
159
+ this.pollingService = config.pollingService;
160
+ this.logger = config.logger;
161
+ }
162
+ /**
163
+ * Maps an error message to user-friendly resolution guidance.
164
+ *
165
+ * Searches through known error patterns and returns appropriate resolution
166
+ * guidance. If no pattern matches, returns undefined.
167
+ *
168
+ * @param errorMessage - The error message to analyze
169
+ * @returns User-friendly resolution guidance or undefined
170
+ */
171
+ static getErrorResolution(errorMessage) {
172
+ for (const { pattern, resolution } of ERROR_RESOLUTIONS) {
173
+ if (pattern.test(errorMessage)) {
174
+ return resolution;
175
+ }
176
+ }
177
+ return undefined;
178
+ }
179
+ /**
180
+ * Reports progress update via callback.
181
+ *
182
+ * @param onProgress - Optional progress callback
183
+ * @param definition - Current definition
184
+ * @param status - Current status
185
+ * @param index - Index in batch
186
+ * @param total - Total count
187
+ * @param summary - Running summary
188
+ * @param message - Optional message
189
+ */
190
+ static reportProgress(onProgress, definition, status, index, total, summary, message) {
191
+ if (onProgress) {
192
+ onProgress({
193
+ current: definition,
194
+ status,
195
+ index,
196
+ total,
197
+ summary: { ...summary },
198
+ message,
199
+ });
200
+ }
201
+ }
202
+ /**
203
+ * Executes profiling for multiple definitions in parallel with controlled concurrency.
204
+ *
205
+ * Implements semaphore-based concurrency control, progress callbacks, skip-empty
206
+ * logic, and error resolution mapping. Returns an aggregated summary of results.
207
+ *
208
+ * @param definitions - Array of profiling definitions to execute
209
+ * @param executor - Executor interface for triggering and monitoring profiling
210
+ * @param options - Bulk execution options (parallel, skipEmpty, pollInterval)
211
+ * @param onProgress - Optional callback for progress updates
212
+ * @returns ServiceResult containing BulkExecutionResult with summary and per-definition results
213
+ */
214
+ async executeBulk(definitions, executor, options = {}, onProgress) {
215
+ const startTime = Date.now();
216
+ const emptyResult = {
217
+ summary: { total: 0, successful: 0, failed: 0, skipped: 0 },
218
+ definitions: [],
219
+ };
220
+ // Validate definitions array is non-empty
221
+ if (!definitions || definitions.length === 0) {
222
+ return createFailureResult(emptyResult, ServiceErrorCodes.PROFILING_BULK_EMPTY_DEFINITIONS, 'Bulk execution requires at least one definition', { metadata: { duration: Date.now() - startTime } });
223
+ }
224
+ // Merge options with defaults
225
+ const mergedOptions = {
226
+ ...DEFAULT_BULK_OPTIONS,
227
+ ...options,
228
+ };
229
+ // Validate parallel option
230
+ if (mergedOptions.parallel < MIN_PARALLEL || mergedOptions.parallel > MAX_PARALLEL) {
231
+ return createFailureResult(emptyResult, ServiceErrorCodes.PROFILING_BULK_INVALID_PARALLEL, `Invalid parallel option: ${String(mergedOptions.parallel)}. Must be between ${String(MIN_PARALLEL)} and ${String(MAX_PARALLEL)}.`, { metadata: { duration: Date.now() - startTime } });
232
+ }
233
+ this.logger?.log(`Starting bulk execution of ${String(definitions.length)} definitions with ${String(mergedOptions.parallel)} parallel threads`);
234
+ // Initialize tracking - use local variables to avoid no-param-reassign
235
+ let successfulCount = 0;
236
+ let failedCount = 0;
237
+ let skippedCount = 0;
238
+ const results = [];
239
+ const semaphore = new Semaphore(mergedOptions.parallel);
240
+ // Process all definitions concurrently with semaphore control
241
+ const processingPromises = definitions.map(async (definition, index) => {
242
+ const summary = () => ({
243
+ total: definitions.length,
244
+ successful: successfulCount,
245
+ failed: failedCount,
246
+ skipped: skippedCount,
247
+ });
248
+ return this.processDefinition({ definition, index, total: definitions.length }, {
249
+ options: mergedOptions,
250
+ semaphore,
251
+ getSummary: summary,
252
+ incrementCounter: (incrementType) => {
253
+ if (incrementType === 'successful')
254
+ successfulCount++;
255
+ else if (incrementType === 'failed')
256
+ failedCount++;
257
+ else if (incrementType === 'skipped')
258
+ skippedCount++;
259
+ },
260
+ }, { executor, onProgress });
261
+ });
262
+ try {
263
+ const definitionResults = await Promise.all(processingPromises);
264
+ results.push(...definitionResults);
265
+ }
266
+ catch (error) {
267
+ const errorMessage = error instanceof Error ? error.message : String(error);
268
+ this.logger?.error?.(`Bulk execution failed: ${errorMessage}`);
269
+ const finalSummary = {
270
+ total: definitions.length,
271
+ successful: successfulCount,
272
+ failed: failedCount,
273
+ skipped: skippedCount,
274
+ };
275
+ return createFailureResult({ summary: finalSummary, definitions: results }, ServiceErrorCodes.PROFILING_BULK_EXECUTION_FAILED, errorMessage, { metadata: { duration: Date.now() - startTime } });
276
+ }
277
+ const duration = Date.now() - startTime;
278
+ const finalSummary = {
279
+ total: definitions.length,
280
+ successful: successfulCount,
281
+ failed: failedCount,
282
+ skipped: skippedCount,
283
+ };
284
+ this.logger?.log(`Bulk execution completed: ${String(finalSummary.successful)} successful, ` +
285
+ `${String(finalSummary.failed)} failed, ${String(finalSummary.skipped)} skipped`);
286
+ // Determine overall success based on results
287
+ const allSucceeded = finalSummary.failed === 0;
288
+ const allFailed = finalSummary.successful === 0 && finalSummary.failed > 0;
289
+ if (allFailed) {
290
+ return createFailureResult({ summary: finalSummary, definitions: results }, ServiceErrorCodes.PROFILING_BULK_EXECUTION_FAILED, `All ${String(finalSummary.failed)} definitions failed to execute`, { metadata: { duration } });
291
+ }
292
+ if (!allSucceeded && finalSummary.successful > 0) {
293
+ // Partial success
294
+ return createSuccessResult({ summary: finalSummary, definitions: results }, {
295
+ message: `Bulk execution completed with ${String(finalSummary.successful)} successful, ${String(finalSummary.failed)} failed, ${String(finalSummary.skipped)} skipped`,
296
+ warnings: [`${String(finalSummary.failed)} definition(s) failed to execute`],
297
+ metadata: { duration },
298
+ });
299
+ }
300
+ return createSuccessResult({ summary: finalSummary, definitions: results }, {
301
+ message: `Bulk execution completed: ${String(finalSummary.successful)} successful, ${String(finalSummary.skipped)} skipped`,
302
+ metadata: { duration },
303
+ });
304
+ }
305
+ /**
306
+ * Checks the record count for an object.
307
+ *
308
+ * Used by skip-empty logic to determine if an object has records to profile.
309
+ *
310
+ * @param objectName - The Salesforce object API name
311
+ * @returns Typed result distinguishing success, validation failure, and query failure
312
+ */
313
+ async getRecordCount(objectName) {
314
+ // Validate object name before building SOQL
315
+ const validationError = validateObjectName(objectName);
316
+ if (validationError) {
317
+ this.logger?.warn?.(`Invalid object name for record count: ${objectName}`);
318
+ return { ok: false, reason: 'validation_failed', message: validationError };
319
+ }
320
+ const soql = new CuneiformQueryBuilder().count().from(objectName).toSOQL();
321
+ try {
322
+ const result = await this.soqlAdapter.query(soql);
323
+ if (result.success) {
324
+ return { ok: true, count: result.data.totalSize };
325
+ }
326
+ this.logger?.warn?.(`Record count query returned failure for ${objectName}: ${result.message ?? 'unknown'}`);
327
+ return { ok: false, reason: 'query_failed', message: result.message ?? 'Query returned failure' };
328
+ }
329
+ catch (error) {
330
+ const errorMessage = error instanceof Error ? error.message : String(error);
331
+ this.logger?.warn?.(`Record count query threw for ${objectName}: ${errorMessage}`);
332
+ return { ok: false, reason: 'query_failed', message: errorMessage };
333
+ }
334
+ }
335
+ /**
336
+ * Checks if a definition should be skipped due to empty records.
337
+ *
338
+ * @param definition - The profiling definition to check
339
+ * @returns Skip info if should be skipped, null otherwise
340
+ */
341
+ async checkSkipEmpty(definition) {
342
+ const recordCountResult = await this.getRecordCount(definition.objectName);
343
+ if (!recordCountResult.ok) {
344
+ if (recordCountResult.reason === 'validation_failed') {
345
+ // Invalid object name — skip with error rather than proceeding to certain failure
346
+ return { skipReason: 'error', reason: `Invalid object name: ${recordCountResult.message}` };
347
+ }
348
+ // Query failed — proceed with execution and let it fail naturally
349
+ this.logger?.log(`Record count query failed for ${definition.objectName}, proceeding with execution`);
350
+ return null;
351
+ }
352
+ if (recordCountResult.count === 0) {
353
+ this.logger?.log(`Skipping ${definition.name}: ${definition.objectName} has no records`);
354
+ return { skipReason: 'empty', reason: `${definition.objectName} has no records` };
355
+ }
356
+ return null;
357
+ }
358
+ /**
359
+ * Processes a single definition within bulk execution.
360
+ *
361
+ * Acquires a semaphore permit, executes the definition, waits for completion,
362
+ * and releases the permit. Updates summary counts and calls progress callback.
363
+ *
364
+ * @param item - The definition and its position in the batch
365
+ * @param ctx - Shared batch execution state (options, semaphore, counters)
366
+ * @param callbacks - Caller-provided execution and status functions
367
+ * @returns The execution result for this definition
368
+ */
369
+ async processDefinition(item, ctx, callbacks) {
370
+ const { definition, index, total } = item;
371
+ const { options, semaphore, getSummary, incrementCounter } = ctx;
372
+ const { executor, onProgress } = callbacks;
373
+ const defStartTime = Date.now();
374
+ // Acquire semaphore permit
375
+ await semaphore.acquire();
376
+ try {
377
+ // Report progress - starting
378
+ BulkExecutionService.reportProgress(onProgress, definition, 'pending', index, total, getSummary(), 'Waiting to execute');
379
+ // Skip-empty check
380
+ if (options.skipEmpty) {
381
+ const skipResult = await this.checkSkipEmpty(definition);
382
+ if (skipResult) {
383
+ incrementCounter('skipped');
384
+ BulkExecutionService.reportProgress(onProgress, definition, 'skipped', index, total, getSummary(), `Skipped: ${skipResult.reason}`);
385
+ return {
386
+ definition,
387
+ status: 'skipped',
388
+ skipReason: skipResult.skipReason,
389
+ durationMs: Date.now() - defStartTime,
390
+ };
391
+ }
392
+ }
393
+ // Check if already in progress
394
+ if (definition.status === 'IN PROGRESS') {
395
+ incrementCounter('skipped');
396
+ BulkExecutionService.reportProgress(onProgress, definition, 'skipped', index, total, getSummary(), 'Already in progress');
397
+ return {
398
+ definition,
399
+ status: 'skipped',
400
+ skipReason: 'in_progress',
401
+ durationMs: Date.now() - defStartTime,
402
+ };
403
+ }
404
+ // Report progress - executing
405
+ BulkExecutionService.reportProgress(onProgress, definition, 'executing', index, total, getSummary(), `Executing ${definition.name}`);
406
+ // Execute profiling via callback
407
+ const executeResult = await executor.execute(definition.id);
408
+ if (!executeResult.success) {
409
+ incrementCounter('failed');
410
+ const resolution = BulkExecutionService.getErrorResolution(executeResult.message ?? '');
411
+ BulkExecutionService.reportProgress(onProgress, definition, 'failed', index, total, getSummary(), executeResult.message);
412
+ return {
413
+ definition,
414
+ status: 'failed',
415
+ errorMessage: executeResult.message,
416
+ errorCode: executeResult.errorCode,
417
+ resolution,
418
+ durationMs: Date.now() - defStartTime,
419
+ };
420
+ }
421
+ const requestId = executeResult.data;
422
+ // Enqueue-only mode: skip waiting for completion
423
+ if (!options.waitForCompletion) {
424
+ incrementCounter('successful');
425
+ BulkExecutionService.reportProgress(onProgress, definition, 'completed', index, total, getSummary(), `Request ${requestId} enqueued for ${definition.name}`);
426
+ return {
427
+ definition,
428
+ status: 'completed',
429
+ requestId,
430
+ durationMs: Date.now() - defStartTime,
431
+ };
432
+ }
433
+ // Wait for completion via PollingService with custom initial delay from bulk options
434
+ const bulkCapture = { first: null };
435
+ const pollResult = await this.pollingService.poll(() => executor.getStatus(requestId), (status) => {
436
+ if (bulkCapture.first === null) {
437
+ bulkCapture.first = status;
438
+ }
439
+ return TERMINAL_STATUSES.has(status.status);
440
+ }, { initialDelayMs: options.pollInterval });
441
+ if (!pollResult.success) {
442
+ incrementCounter('failed');
443
+ const resolution = BulkExecutionService.getErrorResolution(pollResult.message ?? '');
444
+ BulkExecutionService.reportProgress(onProgress, definition, 'failed', index, total, getSummary(), pollResult.message);
445
+ return {
446
+ definition,
447
+ status: 'failed',
448
+ requestId,
449
+ errorMessage: pollResult.message,
450
+ errorCode: pollResult.errorCode,
451
+ resolution,
452
+ durationMs: Date.now() - defStartTime,
453
+ };
454
+ }
455
+ // Guard: PollingService contract guarantees data on success path,
456
+ // but the type is optional — defend against contract violations
457
+ if (!pollResult.data) {
458
+ incrementCounter('failed');
459
+ return {
460
+ definition,
461
+ status: 'failed',
462
+ requestId,
463
+ errorMessage: 'Polling succeeded but returned no result envelope',
464
+ errorCode: ServiceErrorCodes.PROFILING_POLL_FAILED,
465
+ durationMs: Date.now() - defStartTime,
466
+ };
467
+ }
468
+ const terminalStatus = pollResult.data.data;
469
+ if (terminalStatus === undefined) {
470
+ incrementCounter('failed');
471
+ return {
472
+ definition,
473
+ status: 'failed',
474
+ requestId,
475
+ errorMessage: 'Polling succeeded but returned no terminal status data',
476
+ errorCode: ServiceErrorCodes.PROFILING_POLL_FAILED,
477
+ durationMs: Date.now() - defStartTime,
478
+ };
479
+ }
480
+ const profilingResult = {
481
+ requestId,
482
+ status: terminalStatus.status,
483
+ definitionId: terminalStatus.definitionId,
484
+ success: terminalStatus.status === 'Completed',
485
+ errorMessage: terminalStatus.errorMessage,
486
+ startedAt: bulkCapture.first?.createdDate,
487
+ completedAt: terminalStatus.lastModifiedDate,
488
+ durationMs: Date.now() - defStartTime,
489
+ };
490
+ if (!profilingResult.success) {
491
+ incrementCounter('failed');
492
+ const resolution = BulkExecutionService.getErrorResolution(profilingResult.errorMessage ?? '');
493
+ BulkExecutionService.reportProgress(onProgress, definition, 'failed', index, total, getSummary(), profilingResult.errorMessage ?? 'Profiling failed');
494
+ return {
495
+ definition,
496
+ status: 'failed',
497
+ requestId,
498
+ result: profilingResult,
499
+ errorMessage: profilingResult.errorMessage,
500
+ resolution,
501
+ durationMs: Date.now() - defStartTime,
502
+ };
503
+ }
504
+ // Success
505
+ incrementCounter('successful');
506
+ BulkExecutionService.reportProgress(onProgress, definition, 'completed', index, total, getSummary(), `Completed ${definition.name}`);
507
+ return {
508
+ definition,
509
+ status: 'completed',
510
+ requestId,
511
+ result: profilingResult,
512
+ durationMs: Date.now() - defStartTime,
513
+ };
514
+ }
515
+ catch (error) {
516
+ const errorMessage = error instanceof Error ? error.message : String(error);
517
+ incrementCounter('failed');
518
+ const resolution = BulkExecutionService.getErrorResolution(errorMessage);
519
+ BulkExecutionService.reportProgress(onProgress, definition, 'failed', index, total, getSummary(), errorMessage);
520
+ return {
521
+ definition,
522
+ status: 'failed',
523
+ errorMessage,
524
+ errorCode: ServiceErrorCodes.PROFILING_EXECUTION_FAILED,
525
+ resolution,
526
+ durationMs: Date.now() - defStartTime,
527
+ };
528
+ }
529
+ finally {
530
+ // Always release semaphore permit
531
+ semaphore.release();
532
+ }
533
+ }
534
+ }
535
+ //# sourceMappingURL=BulkExecutionService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BulkExecutionService.js","sourceRoot":"","sources":["../../src/services/BulkExecutionService.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAapF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAG3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAcrD;;GAEG;AACH,MAAM,oBAAoB,GAAmC;IAC3D,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,IAAI;IACf,YAAY,EAAE,IAAI;IAClB,iBAAiB,EAAE,IAAI;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,YAAY,GAAG,EAAE,CAAC;AAYxB;;;GAGG;AACH,MAAM,iBAAiB,GAAsB;IAC3C;QACE,OAAO,EAAE,oCAAoC;QAC7C,UAAU,EAAE,8EAA8E;KAC3F;IACD;QACE,OAAO,EAAE,gCAAgC;QACzC,UAAU,EAAE,wEAAwE;KACrF;IACD;QACE,OAAO,EAAE,mDAAmD;QAC5D,UAAU,EAAE,gFAAgF;KAC7F;IACD;QACE,OAAO,EAAE,kDAAkD;QAC3D,UAAU,EAAE,0EAA0E;KACvF;IACD;QACE,OAAO,EAAE,qDAAqD;QAC9D,UAAU,EAAE,mEAAmE;KAChF;IACD;QACE,OAAO,EAAE,sDAAsD;QAC/D,UAAU,EAAE,+DAA+D;KAC5E;IACD;QACE,OA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AAC,YAAY,CAAC,CAAC;YACzE,oBAAoB,CAAC,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,YAAY,CAAC,CAAC;YAChH,OAAO;gBACL,UAAU;gBACV,MAAM,EAAE,QAAQ;gBAChB,YAAY;gBACZ,SAAS,EAAE,iBAAiB,CAAC,0BAA0B;gBACvD,UAAU;gBACV,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,YAAY;aACtC,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,kCAAkC;YAClC,SAAS,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Shape of the relevant slice of `package.json` consulted for compatibility
3
+ * metadata. `cuneiform.requiredAppVersion` is the minimum-required Cuneiform
4
+ * For Salesforce package version; `version` is the CLI plugin's own version
5
+ * (always populated by oclif/npm). Namespace/name are sourced from
6
+ * `namespace-constants.ts`.
7
+ */
8
+ export type CompatibilityManifest = {
9
+ version?: string;
10
+ cuneiform?: {
11
+ requiredAppVersion?: string;
12
+ };
13
+ };
14
+ /** Required Cuneiform For Salesforce app version, parsed from the manifest. */
15
+ export type RequiredAppVersion = {
16
+ /** Version string in Major.Minor (or Major.Minor.Patch.Build) form. */
17
+ version: string;
18
+ };
19
+ /**
20
+ * Comparison outcome produced by {@link CompatibilityService.compare} or set
21
+ * by the operation layer when the org is detected via namespace fallback but
22
+ * the version is unavailable (`installed-version-unknown`).
23
+ *
24
+ * Exit-code contract (set by the command layer): `installed-match`,
25
+ * `installed-newer`, and `installed-version-unknown` exit 0. `installed-older`
26
+ * and `not-installed` exit 1.
27
+ */
28
+ export type CompatibilityState = 'installed-match' | 'installed-newer' | 'installed-older' | 'installed-version-unknown' | 'not-installed';
29
+ /**
30
+ * Configuration for {@link CompatibilityService}.
31
+ */
32
+ export type ICompatibilityServiceConfig = {
33
+ /**
34
+ * Optional injectable manifest reader. Defaults to reading the CLI plugin's
35
+ * `package.json` from disk. Tests inject a deterministic reader to avoid
36
+ * touching the filesystem.
37
+ */
38
+ manifestReader?: () => CompatibilityManifest;
39
+ };
40
+ /**
41
+ * Service for evaluating compatibility between the running CLI version and the
42
+ * Cuneiform For Salesforce managed package installed in a target org.
43
+ *
44
+ * Stateless. The required version is sourced from `package.json`; the installed
45
+ * version is supplied by the caller (typically via
46
+ * `OrgInfoService.getCuneiformPackageInfo`).
47
+ *
48
+ * Comparison semantics: version strings are parsed as integer tuples padded to
49
+ * four parts (`Major.Minor.Patch.Build`). Equality on the padded tuple yields
50
+ * `installed-match`; lexicographic order on the padded tuple yields
51
+ * `installed-newer` / `installed-older`. A null/undefined installed version
52
+ * yields `not-installed`.
53
+ */
54
+ export declare class CompatibilityService {
55
+ private readonly manifestReader;
56
+ constructor(config?: ICompatibilityServiceConfig);
57
+ /**
58
+ * Compare a required version to an installed version. Pure function — exposed
59
+ * as a static method since it does not depend on instance state.
60
+ *
61
+ * @param required - required version string (`Major.Minor` or `Major.Minor.Patch.Build`)
62
+ * @param installed - installed version string, or `null`/`undefined` if absent
63
+ * @returns one of `installed-match`, `installed-newer`, `installed-older`, `not-installed`
64
+ * @throws SfError (E4682) when either version string contains a non-numeric component
65
+ */
66
+ static compare(required: string, installed: string | null | undefined): CompatibilityState;
67
+ /**
68
+ * Load the required Cuneiform For Salesforce app version from the manifest.
69
+ *
70
+ * @returns the parsed required version
71
+ * @throws SfError (E4681) when `cuneiform.requiredAppVersion` is missing or empty
72
+ */
73
+ loadRequired(): RequiredAppVersion;
74
+ /**
75
+ * Load the CLI plugin's own version from the manifest (`package.json` `version` field).
76
+ *
77
+ * @returns the CLI version string verbatim (e.g., "1.0.4-beta.1")
78
+ * @throws SfError (E4684) when `version` is missing or empty (should never happen for npm-published packages)
79
+ */
80
+ loadCliVersion(): string;
81
+ }