@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,118 @@
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 { readFileSync } from 'node:fs';
9
+ import { dirname, join } from 'node:path';
10
+ import { fileURLToPath } from 'node:url';
11
+ import { SfError } from '@salesforce/core';
12
+ /**
13
+ * Default manifest reader — loads `package.json` from the project root by
14
+ * resolving a path relative to this source file. Source layout:
15
+ * `src/services/CompatibilityService.ts` → `../../package.json`. The compiled
16
+ * layout (`lib/services/CompatibilityService.js`) resolves identically.
17
+ */
18
+ const defaultManifestReader = () => {
19
+ const here = dirname(fileURLToPath(import.meta.url));
20
+ const pkgPath = join(here, '..', '..', 'package.json');
21
+ return JSON.parse(readFileSync(pkgPath, 'utf-8'));
22
+ };
23
+ /**
24
+ * Service for evaluating compatibility between the running CLI version and the
25
+ * Cuneiform For Salesforce managed package installed in a target org.
26
+ *
27
+ * Stateless. The required version is sourced from `package.json`; the installed
28
+ * version is supplied by the caller (typically via
29
+ * `OrgInfoService.getCuneiformPackageInfo`).
30
+ *
31
+ * Comparison semantics: version strings are parsed as integer tuples padded to
32
+ * four parts (`Major.Minor.Patch.Build`). Equality on the padded tuple yields
33
+ * `installed-match`; lexicographic order on the padded tuple yields
34
+ * `installed-newer` / `installed-older`. A null/undefined installed version
35
+ * yields `not-installed`.
36
+ */
37
+ export class CompatibilityService {
38
+ manifestReader;
39
+ constructor(config) {
40
+ this.manifestReader = config?.manifestReader ?? defaultManifestReader;
41
+ }
42
+ /**
43
+ * Compare a required version to an installed version. Pure function — exposed
44
+ * as a static method since it does not depend on instance state.
45
+ *
46
+ * @param required - required version string (`Major.Minor` or `Major.Minor.Patch.Build`)
47
+ * @param installed - installed version string, or `null`/`undefined` if absent
48
+ * @returns one of `installed-match`, `installed-newer`, `installed-older`, `not-installed`
49
+ * @throws SfError (E4682) when either version string contains a non-numeric component
50
+ */
51
+ static compare(required, installed) {
52
+ if (installed === null || installed === undefined)
53
+ return 'not-installed';
54
+ const requiredParts = parseVersion(required, 'required');
55
+ const installedParts = parseVersion(installed, 'installed');
56
+ for (let i = 0; i < 4; i++) {
57
+ const r = requiredParts[i] ?? 0;
58
+ const v = installedParts[i] ?? 0;
59
+ if (v > r)
60
+ return 'installed-newer';
61
+ if (v < r)
62
+ return 'installed-older';
63
+ }
64
+ return 'installed-match';
65
+ }
66
+ /**
67
+ * Load the required Cuneiform For Salesforce app version from the manifest.
68
+ *
69
+ * @returns the parsed required version
70
+ * @throws SfError (E4681) when `cuneiform.requiredAppVersion` is missing or empty
71
+ */
72
+ loadRequired() {
73
+ const manifest = this.manifestReader();
74
+ const raw = manifest.cuneiform?.requiredAppVersion;
75
+ if (typeof raw !== 'string' || raw.trim() === '') {
76
+ throw new SfError('package.json is missing the required "cuneiform.requiredAppVersion" field. ' +
77
+ 'Add it as part of the CLI release procedure (see README → "Compatibility").', 'E4681');
78
+ }
79
+ return { version: stripLeadingV(raw.trim()) };
80
+ }
81
+ /**
82
+ * Load the CLI plugin's own version from the manifest (`package.json` `version` field).
83
+ *
84
+ * @returns the CLI version string verbatim (e.g., "1.0.4-beta.1")
85
+ * @throws SfError (E4684) when `version` is missing or empty (should never happen for npm-published packages)
86
+ */
87
+ loadCliVersion() {
88
+ const manifest = this.manifestReader();
89
+ const raw = manifest.version;
90
+ if (typeof raw !== 'string' || raw.trim() === '') {
91
+ throw new SfError('package.json is missing the "version" field.', 'E4684');
92
+ }
93
+ return raw.trim();
94
+ }
95
+ }
96
+ /**
97
+ * Parse a Salesforce package version string into a 4-tuple of integers, padding
98
+ * missing parts with 0.
99
+ */
100
+ function parseVersion(raw, label) {
101
+ const stripped = stripLeadingV(raw.trim());
102
+ const parts = stripped.split('.');
103
+ const tuple = [];
104
+ for (const part of parts) {
105
+ if (!/^\d+$/.test(part)) {
106
+ throw new SfError(`${label} version "${raw}" contains a non-numeric component "${part}". ` +
107
+ 'Expected Major.Minor or Major.Minor.Patch.Build.', 'E4682');
108
+ }
109
+ tuple.push(Number.parseInt(part, 10));
110
+ }
111
+ while (tuple.length < 4)
112
+ tuple.push(0);
113
+ return tuple;
114
+ }
115
+ function stripLeadingV(raw) {
116
+ return raw.startsWith('v') || raw.startsWith('V') ? raw.slice(1) : raw;
117
+ }
118
+ //# sourceMappingURL=CompatibilityService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompatibilityService.js","sourceRo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Aa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,OAAO,CACf,GAAG,KAAK,aAAa,GAAG,uCAAuC,IAAI,KAAK;gBACtE,kDAAkD,EACpD,OAAO,CACR,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACvC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,aAAa,CAAC,GAAW;IAChC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACzE,CAAC"}
@@ -0,0 +1,85 @@
1
+ import type { ServiceResult } from '../models/service-result.js';
2
+ import { type UserConfigurationResult, type IConfigurationServiceDeps } from './UserConfigurationTypes.js';
3
+ /**
4
+ * Handles the configure workflow for UserConfigurationService.
5
+ *
6
+ * Checks the current user state, identifies required changes (permission sets,
7
+ * API-only profiling), and optionally applies them. Supports dry-run mode to
8
+ * preview changes without applying them.
9
+ *
10
+ * This class is instantiated by UserConfigurationService and should not be
11
+ * used directly by consumers.
12
+ */
13
+ export declare class ConfigureMode {
14
+ private readonly deps;
15
+ constructor(deps: IConfigurationServiceDeps);
16
+ /**
17
+ * Creates an empty UserConfigurationResult for error cases.
18
+ */
19
+ private static createEmptyConfigurationResult;
20
+ /**
21
+ * Builds the previous configuration state from readiness check.
22
+ */
23
+ private static buildConfigurationState;
24
+ /**
25
+ * Builds the list of required configuration actions.
26
+ */
27
+ private static buildConfigurationActions;
28
+ /**
29
+ * Creates the result when Cuneiform is not installed.
30
+ */
31
+ private static createCuneiformNotInstalledResult;
32
+ /**
33
+ * Handles permission set insert failures, mapping error codes appropriately.
34
+ */
35
+ private static handlePermissionSetInsertFailure;
36
+ /**
37
+ * Orchestrates user configuration for Cuneiform operations.
38
+ *
39
+ * Checks the current user state, identifies required changes (permission sets,
40
+ * API-only profiling), and optionally applies them. Supports dry-run mode to
41
+ * preview changes without applying them.
42
+ *
43
+ * **Idempotency**: Skips already-configured items. Re-running configure() on
44
+ * a fully configured user will report all actions as 'skipped'.
45
+ *
46
+ * @param userId - The Salesforce user ID to configure
47
+ * @param options - Configuration options
48
+ * @param options.dryRun - If true, reports planned changes without applying them (default: false)
49
+ * @returns ServiceResult containing UserConfigurationResult with actions taken/skipped/failed
50
+ */
51
+ execute(userId: string, options?: {
52
+ dryRun?: boolean;
53
+ }): Promise<ServiceResult<UserConfigurationResult>>;
54
+ /**
55
+ * Executes a single permission set assignment action.
56
+ */
57
+ private executePermissionSetAction;
58
+ /**
59
+ * Executes a single API-only profiling action.
60
+ */
61
+ private executeApiOnlyProfilingAction;
62
+ /**
63
+ * Executes all configuration actions sequentially.
64
+ *
65
+ * Actions are executed sequentially because permission set assignments
66
+ * may have dependencies and order matters for proper error reporting.
67
+ */
68
+ private executeConfigurationActions;
69
+ /**
70
+ * Fetches user readiness state and user info in parallel.
71
+ */
72
+ private fetchUserReadinessState;
73
+ /**
74
+ * Fetches the updated configuration state after applying changes.
75
+ */
76
+ private fetchUpdatedState;
77
+ /**
78
+ * Builds the final configuration result based on execution outcomes.
79
+ */
80
+ private buildConfigurationResult;
81
+ /**
82
+ * Creates the result for dry-run mode or when no changes are needed.
83
+ */
84
+ private createDryRunOrNoChangesResult;
85
+ }
@@ -0,0 +1,390 @@
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 { AdapterErrorCodes, ServiceErrorCodes } from '../adapters/errors.js';
10
+ import { CUNEIFORM_NAMESPACE } from './namespace-constants.js';
11
+ import { validateRequiredString } from './validation.js';
12
+ import { REQUIRED_PERMISSION_SETS, REQUIRED_PERMISSION_SET_LABELS } from './UserReadinessService.js';
13
+ import { CONFIGURABLE_PERMISSION_SETS, } from './UserConfigurationTypes.js';
14
+ /**
15
+ * Handles the configure workflow for UserConfigurationService.
16
+ *
17
+ * Checks the current user state, identifies required changes (permission sets,
18
+ * API-only profiling), and optionally applies them. Supports dry-run mode to
19
+ * preview changes without applying them.
20
+ *
21
+ * This class is instantiated by UserConfigurationService and should not be
22
+ * used directly by consumers.
23
+ */
24
+ export class ConfigureMode {
25
+ deps;
26
+ constructor(deps) {
27
+ this.deps = deps;
28
+ }
29
+ // ============================================================================
30
+ // Static helpers
31
+ // ============================================================================
32
+ /**
33
+ * Creates an empty UserConfigurationResult for error cases.
34
+ */
35
+ static createEmptyConfigurationResult(userId, dryRun, username = '') {
36
+ return {
37
+ user: { id: userId, username },
38
+ dryRun,
39
+ previousState: {
40
+ userId,
41
+ username,
42
+ hasRequiredPermissionSets: false,
43
+ missingPermissionSets: [...REQUIRED_PERMISSION_SETS],
44
+ apiOnlyProfilingEnabled: false,
45
+ },
46
+ actions: [],
47
+ currentState: null,
48
+ summary: {
49
+ changesRequired: 0,
50
+ changesApplied: 0,
51
+ changesFailed: 0,
52
+ isReady: false,
53
+ },
54
+ };
55
+ }
56
+ /**
57
+ * Builds the previous configuration state from readiness check.
58
+ */
59
+ static buildConfigurationState(userId, username, readiness) {
60
+ return {
61
+ userId,
62
+ username,
63
+ hasRequiredPermissionSets: readiness.permissionSets.hasAllRequired,
64
+ missingPermissionSets: readiness.permissionSets.missingRequired,
65
+ apiOnlyProfilingEnabled: readiness.configProfile.apiOnlyProfilingEnabled ?? false,
66
+ profileDeveloperName: readiness.configProfile.profileDeveloperName,
67
+ };
68
+ }
69
+ /**
70
+ * Builds the list of required configuration actions.
71
+ */
72
+ static buildConfigurationActions(previousState, dryRun) {
73
+ const actions = [];
74
+ // Only create assignment actions for configurable permission sets.
75
+ // Admin User Pro is a prerequisite (read-only verification) — not assigned by CLI.
76
+ const configurableMissing = previousState.missingPermissionSets.filter((ps) => CONFIGURABLE_PERMISSION_SETS.includes(ps));
77
+ for (const missingPerm of configurableMissing) {
78
+ actions.push({
79
+ type: 'assignPermissionSet',
80
+ target: missingPerm,
81
+ targetLabel: REQUIRED_PERMISSION_SET_LABELS[missingPerm],
82
+ status: dryRun ? 'skipped' : 'applied',
83
+ message: dryRun ? 'Would assign permission set' : undefined,
84
+ });
85
+ }
86
+ if (!previousState.apiOnlyProfilingEnabled && previousState.profileDeveloperName) {
87
+ actions.push({
88
+ type: 'enableApiOnlyProfiling',
89
+ target: previousState.profileDeveloperName,
90
+ status: dryRun ? 'skipped' : 'applied',
91
+ message: dryRun ? 'Would enable API-only profiling' : undefined,
92
+ });
93
+ }
94
+ return actions;
95
+ }
96
+ /**
97
+ * Creates the result when Cuneiform is not installed.
98
+ */
99
+ static createCuneiformNotInstalledResult(userId, username, dryRun, previousState, startTime) {
100
+ return createFailureResult({
101
+ user: { id: userId, username },
102
+ dryRun,
103
+ previousState,
104
+ actions: [],
105
+ currentState: null,
106
+ summary: { changesRequired: 0, changesApplied: 0, changesFailed: 0, isReady: false },
107
+ }, ServiceErrorCodes.USER_CUNEIFORM_NAMESPACE_NOT_FOUND, 'Cuneiform for Salesforce is not installed in this org', { metadata: { duration: Date.now() - startTime } });
108
+ }
109
+ /**
110
+ * Handles permission set insert failures, mapping error codes appropriately.
111
+ */
112
+ static handlePermissionSetInsertFailure(insertResult) {
113
+ if (insertResult.errorCode === AdapterErrorCodes.INSERT_DUPLICATE_VALUE) {
114
+ return { status: 'skipped', message: 'Permission set already assigned', failed: false };
115
+ }
116
+ if (insertResult.errorCode === AdapterErrorCodes.INSERT_INSUFFICIENT_ACCESS) {
117
+ return { status: 'failed', message: 'Insufficient access to assign permission set', failed: true };
118
+ }
119
+ return {
120
+ status: 'failed',
121
+ message: insertResult.message ?? 'Permission set assignment failed',
122
+ failed: true,
123
+ };
124
+ }
125
+ /**
126
+ * Orchestrates user configuration for Cuneiform operations.
127
+ *
128
+ * Checks the current user state, identifies required changes (permission sets,
129
+ * API-only profiling), and optionally applies them. Supports dry-run mode to
130
+ * preview changes without applying them.
131
+ *
132
+ * **Idempotency**: Skips already-configured items. Re-running configure() on
133
+ * a fully configured user will report all actions as 'skipped'.
134
+ *
135
+ * @param userId - The Salesforce user ID to configure
136
+ * @param options - Configuration options
137
+ * @param options.dryRun - If true, reports planned changes without applying them (default: false)
138
+ * @returns ServiceResult containing UserConfigurationResult with actions taken/skipped/failed
139
+ */
140
+ async execute(userId, options) {
141
+ const startTime = Date.now();
142
+ const dryRun = options?.dryRun ?? false;
143
+ // Validate userId
144
+ const validationError = validateRequiredString(userId, 'User ID');
145
+ if (validationError) {
146
+ return createFailureResult(ConfigureMode.createEmptyConfigurationResult(userId, dryRun), ServiceErrorCodes.USER_CONFIG_USER_ID_REQUIRED, validationError, { metadata: { duration: Date.now() - startTime } });
147
+ }
148
+ try {
149
+ this.deps.logger?.log(`Configuring user: ${userId}${dryRun ? ' (dry-run)' : ''}`);
150
+ // Step 1: Get current user readiness state
151
+ const { readiness: rawReadiness, username, errorResult, } = await this.fetchUserReadinessState(userId, dryRun, startTime);
152
+ if (errorResult)
153
+ return errorResult;
154
+ // readiness is guaranteed non-undefined when errorResult is null
155
+ const readiness = rawReadiness;
156
+ const previousState = ConfigureMode.buildConfigurationState(userId, username, readiness);
157
+ // Check if Cuneiform is installed
158
+ if (!readiness.isCuneiformInstalled) {
159
+ return ConfigureMode.createCuneiformNotInstalledResult(userId, username, dryRun, previousState, startTime);
160
+ }
161
+ // Gate: Self-registration must be enabled for CLI self-provisioning
162
+ // This ensures the admin has explicitly authorized users to self-configure
163
+ // API profiling access via the CLI. Without this, the permission set
164
+ // assignment is blocked to preserve the admin's security posture.
165
+ // Only enforced when a config profile exists — if no profile is configured,
166
+ // the configure flow will create/enable it (handled by downstream actions).
167
+ if (readiness.configProfile.isConfigured && readiness.configProfile.selfRegistrationEnabled !== true) {
168
+ return createFailureResult(ConfigureMode.createEmptyConfigurationResult(userId, dryRun, username), ServiceErrorCodes.SELF_REGISTRATION_NOT_ENABLED, 'Cuneiform is installed and API-Only Profiling is enabled, but CLI self-provisioning is not available. ' +
169
+ 'Your administrator has not enabled CLI self-provisioning for API-based profiling. ' +
170
+ 'This setting ensures your admin controls which users can configure their own API profiling access. ' +
171
+ 'Ask your Salesforce administrator to enable "Enable API Profiling Self-Registration" ' +
172
+ 'in the Cuneiform Configuration Profile (Custom Metadata), ' +
173
+ 'or request they assign the API-Based Profiling permission set to you directly.', { metadata: { duration: Date.now() - startTime } });
174
+ }
175
+ // Step 2: Identify required actions
176
+ const actions = ConfigureMode.buildConfigurationActions(previousState, dryRun);
177
+ const changesRequired = actions.length;
178
+ // If dry-run or no changes needed, return early
179
+ if (dryRun || changesRequired === 0) {
180
+ return this.createDryRunOrNoChangesResult(userId, username, dryRun, previousState, actions, changesRequired, readiness.isReady, startTime);
181
+ }
182
+ // Step 3: Execute actions
183
+ const { changesApplied, changesFailed } = await this.executeConfigurationActions(actions, userId);
184
+ // Step 4: Get updated state (if changes were made)
185
+ const currentState = await this.fetchUpdatedState(userId, username, changesApplied);
186
+ return this.buildConfigurationResult(userId, username, dryRun, previousState, actions, currentState, changesRequired, changesApplied, changesFailed, Date.now() - startTime);
187
+ }
188
+ catch (error) {
189
+ const errorMessage = error instanceof Error ? error.message : String(error);
190
+ this.deps.logger?.log(`Configuration failed: ${errorMessage}`);
191
+ return createFailureResult(ConfigureMode.createEmptyConfigurationResult(userId, dryRun), ServiceErrorCodes.USER_CONFIG_QUERY_FAILED, errorMessage, { metadata: { duration: Date.now() - startTime } });
192
+ }
193
+ }
194
+ // ============================================================================
195
+ // Private instance helpers
196
+ // ============================================================================
197
+ /**
198
+ * Executes a single permission set assignment action.
199
+ */
200
+ async executePermissionSetAction(action, userId) {
201
+ const permSetIdResult = await this.deps.getPermissionSetId(action.target, CUNEIFORM_NAMESPACE);
202
+ if (!permSetIdResult.success || !permSetIdResult.data) {
203
+ return {
204
+ applied: false,
205
+ failed: true,
206
+ update: {
207
+ status: 'failed',
208
+ message: permSetIdResult.message ?? 'Permission set not found',
209
+ },
210
+ };
211
+ }
212
+ const insertResult = await this.deps.restApiAdapter.insertRecord('PermissionSetAssignment', {
213
+ AssigneeId: userId,
214
+ PermissionSetId: permSetIdResult.data,
215
+ });
216
+ if (!insertResult.success) {
217
+ const failureInfo = ConfigureMode.handlePermissionSetInsertFailure(insertResult);
218
+ return {
219
+ applied: false,
220
+ failed: failureInfo.failed,
221
+ update: { status: failureInfo.status, message: failureInfo.message },
222
+ };
223
+ }
224
+ return {
225
+ applied: true,
226
+ failed: false,
227
+ update: {
228
+ status: 'applied',
229
+ message: 'Permission set assigned',
230
+ details: { permissionSetAssignmentId: insertResult.data.id },
231
+ },
232
+ };
233
+ }
234
+ /**
235
+ * Executes a single API-only profiling action.
236
+ */
237
+ async executeApiOnlyProfilingAction(action) {
238
+ const deployResult = await this.deps.enableApiOnlyProfiling(action.target);
239
+ if (!deployResult.success) {
240
+ return {
241
+ applied: false,
242
+ failed: true,
243
+ update: {
244
+ status: 'failed',
245
+ message: deployResult.message ?? 'Failed to enable API-only profiling',
246
+ },
247
+ };
248
+ }
249
+ const update = {
250
+ status: 'applied',
251
+ message: 'API-only profiling deployment triggered',
252
+ };
253
+ if (deployResult.data.jobId) {
254
+ update.details = { deploymentJobId: deployResult.data.jobId };
255
+ // Wait for deployment to complete so state is consistent for subsequent operations
256
+ const completionResult = await this.deps.waitForDeploymentCompletion(deployResult.data.jobId);
257
+ if (completionResult.success && completionResult.data.status === 'Failed') {
258
+ return {
259
+ applied: false,
260
+ failed: true,
261
+ update: {
262
+ status: 'failed',
263
+ message: completionResult.data.errorMessage ?? 'CMT deployment failed',
264
+ details: { deploymentJobId: deployResult.data.jobId },
265
+ },
266
+ };
267
+ }
268
+ update.message = `API-only profiling deployment ${completionResult.data.status.toLowerCase()}`;
269
+ }
270
+ return { applied: true, failed: false, update };
271
+ }
272
+ /**
273
+ * Executes all configuration actions sequentially.
274
+ *
275
+ * Actions are executed sequentially because permission set assignments
276
+ * may have dependencies and order matters for proper error reporting.
277
+ */
278
+ async executeConfigurationActions(actions, userId) {
279
+ let changesApplied = 0;
280
+ let changesFailed = 0;
281
+ /* eslint-disable no-await-in-loop -- Sequential execution required: permission set dependencies */
282
+ for (const [i, action] of actions.entries()) {
283
+ const result = action.type === 'assignPermissionSet'
284
+ ? await this.executePermissionSetAction(action, userId)
285
+ : await this.executeApiOnlyProfilingAction(action);
286
+ // Apply the update to the action in the array
287
+ Object.assign(actions[i], result.update);
288
+ if (result.applied)
289
+ changesApplied++;
290
+ if (result.failed)
291
+ changesFailed++;
292
+ }
293
+ /* eslint-enable no-await-in-loop */
294
+ return { changesApplied, changesFailed };
295
+ }
296
+ /**
297
+ * Fetches user readiness state and user info in parallel.
298
+ */
299
+ async fetchUserReadinessState(userId, dryRun, startTime) {
300
+ const [readinessResult, userInfoResult] = await Promise.all([
301
+ this.deps.userReadinessService.checkReadiness(userId),
302
+ this.deps.userReadinessService.getUserInfo(userId),
303
+ ]);
304
+ if (!readinessResult.success) {
305
+ return {
306
+ readiness: undefined,
307
+ username: '',
308
+ errorResult: createFailureResult(ConfigureMode.createEmptyConfigurationResult(userId, dryRun), readinessResult.errorCode ?? ServiceErrorCodes.USER_CONFIG_QUERY_FAILED, readinessResult.message ?? 'Failed to check user readiness', { metadata: { duration: Date.now() - startTime } }),
309
+ };
310
+ }
311
+ return {
312
+ readiness: readinessResult.data,
313
+ username: userInfoResult.success ? userInfoResult.data.username : '',
314
+ errorResult: null,
315
+ };
316
+ }
317
+ /**
318
+ * Fetches the updated configuration state after applying changes.
319
+ */
320
+ async fetchUpdatedState(userId, username, changesApplied) {
321
+ if (changesApplied === 0)
322
+ return null;
323
+ const updatedReadinessResult = await this.deps.userReadinessService.checkReadiness(userId);
324
+ if (!updatedReadinessResult.success)
325
+ return null;
326
+ return ConfigureMode.buildConfigurationState(userId, username, updatedReadinessResult.data);
327
+ }
328
+ /**
329
+ * Builds the final configuration result based on execution outcomes.
330
+ */
331
+ buildConfigurationResult(userId, username, dryRun, previousState, actions, currentState, changesRequired, changesApplied, changesFailed, duration) {
332
+ const isReady = currentState?.hasRequiredPermissionSets === true && currentState?.apiOnlyProfilingEnabled === true;
333
+ const result = {
334
+ user: { id: userId, username },
335
+ dryRun,
336
+ previousState,
337
+ actions,
338
+ currentState,
339
+ summary: { changesRequired, changesApplied, changesFailed, isReady },
340
+ };
341
+ // All changes failed
342
+ if (changesFailed > 0 && changesApplied === 0) {
343
+ this.deps.logger?.log(`Configuration failed: all ${changesFailed} change(s) failed`);
344
+ return createFailureResult(result, ServiceErrorCodes.USER_CONFIG_PERMISSION_SET_ASSIGN_FAILED, `Configuration failed: all ${changesFailed} change(s) failed`, { metadata: { duration } });
345
+ }
346
+ // Partial failure
347
+ if (changesFailed > 0) {
348
+ this.deps.logger?.log(`Configuration partially complete: ${changesApplied} applied, ${changesFailed} failed`);
349
+ return createSuccessResult(result, {
350
+ message: `Configuration partially complete: ${changesApplied} applied, ${changesFailed} failed`,
351
+ warnings: [`${changesFailed} configuration action(s) failed`],
352
+ metadata: { duration },
353
+ });
354
+ }
355
+ // All changes applied successfully
356
+ this.deps.logger?.log(`Configuration complete: ${changesApplied} change(s) applied`);
357
+ return createSuccessResult(result, {
358
+ message: `Configuration complete: ${changesApplied} change(s) applied`,
359
+ metadata: { duration },
360
+ });
361
+ }
362
+ /**
363
+ * Creates the result for dry-run mode or when no changes are needed.
364
+ */
365
+ createDryRunOrNoChangesResult(userId, username, dryRun, previousState, actions, changesRequired, isReadinessReady, startTime) {
366
+ const duration = Date.now() - startTime;
367
+ const isReady = changesRequired === 0 && isReadinessReady;
368
+ const message = dryRun
369
+ ? `Dry-run complete: ${changesRequired} change(s) would be applied`
370
+ : 'This user is already fully configured; no changes are necessary';
371
+ this.deps.logger?.log(message);
372
+ return createSuccessResult({
373
+ user: { id: userId, username },
374
+ dryRun,
375
+ previousState,
376
+ actions: actions.map((a) => ({ ...a, message: dryRun ? 'Would be applied' : 'Already configured' })),
377
+ currentState: dryRun ? null : previousState,
378
+ summary: {
379
+ changesRequired,
380
+ changesApplied: 0,
381
+ changesFailed: 0,
382
+ isReady,
383
+ },
384
+ }, {
385
+ message,
386
+ metadata: { duration },
387
+ });
388
+ }
389
+ }
390
+ //# sourceMappingURL=ConfigureMode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigureMode.js","sourceRoot":"","sources":["../../src/services/ConfigureMode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AACrG,OAAO,EACL,4BAA4B,GAK7B,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;GASG;AACH,MAAM,OAAO,aAAa;IACP,IAAI,CAA4B;IAEjD,YAAmB,IAA+B;QAChD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,+EAA+E;IAC/E,iBAAiB;IACjB,+EAA+E;IAE/E;;OAEG;IACK,MAAM,CAAC,8BAA8B,CAC3C,MAA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