@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,316 @@
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 { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
9
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
10
+ import { DebugLogger } from '../debug/debug-logger.js';
11
+ import { createMcpAdapters } from './config/mcp-config.js';
12
+ import { CUNEIFORM_SYSTEM_PROMPT } from './config/system-prompts.js';
13
+ import { McpErrorCodes } from './errors.js';
14
+ import { createMcpError, extractErrorMessage, typedHandler } from './tools/tool-factory.js';
15
+ // Input schemas — single source of truth for validation
16
+ import { OrgDetailsInputSchema, ObjectListInputSchema, ObjectDescribeInputSchema, UserDetailsInputSchema, UserConfigureInputSchema, DefinitionListInputSchema, DefinitionGetInputSchema, DefinitionGetByKeyInputSchema, DefinitionCreateInputSchema, DefinitionUpdateInputSchema, DefinitionPurgeInputSchema, DefinitionExportInputSchema, DefinitionImportInputSchema, ContactPointAnalyzeInputSchema, SummaryListInputSchema, RequestListInputSchema, ProfileExecuteInputSchema, ProfileStatusInputSchema, ProfileCancelInputSchema, ProfileDeleteInputSchema, } from './schemas/input-schemas.js';
17
+ // Handler functions
18
+ import { handleOrgDetails } from './tools/org-tools.js';
19
+ import { handleObjectList, handleObjectDescribe } from './tools/object-tools.js';
20
+ import { handleUserDetails, handleUserConfigure } from './tools/user-tools.js';
21
+ import { handleDefinitionList, handleDefinitionGet, handleDefinitionGetByKey, handleDefinitionCreate, handleDefinitionUpdate, handleDefinitionPurge, } from './tools/definition-tools.js';
22
+ import { handleDefinitionExport, handleDefinitionImport } from './tools/definition-io-tools.js';
23
+ import { handleContactPointAnalyze } from './tools/contactpoint-tools.js';
24
+ import { handleSummaryList } from './tools/summary-tools.js';
25
+ import { handleRequestList, handleProfileExecute, handleProfileStatus, handleProfileCancel, handleProfileDelete, } from './tools/profile-tools.js';
26
+ /**
27
+ * Wraps a handler with debug logging (timing, params, result size).
28
+ *
29
+ * @param toolName - Tool name for log output
30
+ * @param adapters - Session-scoped MCP adapters
31
+ * @param handler - Handler function
32
+ * @param args - Validated input arguments
33
+ * @param debug - Whether debug logging is enabled
34
+ * @returns CallToolResult from the handler
35
+ */
36
+ async function invokeWithLogging(toolName, adapters, handler, args, debug) {
37
+ if (debug) {
38
+ DebugLogger.setEnabled(true);
39
+ }
40
+ if (debug) {
41
+ DebugLogger.log('MCP', toolName, 'params', JSON.stringify(args));
42
+ }
43
+ const start = Date.now();
44
+ try {
45
+ const result = await handler(adapters, args);
46
+ const duration = Date.now() - start;
47
+ const success = !result.isError;
48
+ if (debug) {
49
+ try {
50
+ const resultStr = JSON.stringify(result);
51
+ const sizeBytes = new TextEncoder().encode(resultStr).length;
52
+ DebugLogger.logResult('MCP', toolName, success, duration, sizeBytes);
53
+ }
54
+ catch (serializeError) {
55
+ /* eslint-disable-next-line no-console -- MCP uses stderr for logging */
56
+ console.error(`[MCP] Warning: Result for ${toolName} is not JSON-serializable: ` +
57
+ `${serializeError instanceof Error ? serializeError.message : String(serializeError)}. ` +
58
+ 'This may cause a transport error.');
59
+ DebugLogger.logResult('MCP', toolName, success, duration);
60
+ }
61
+ }
62
+ else {
63
+ DebugLogger.logResult('MCP', toolName, success, duration);
64
+ }
65
+ return result;
66
+ }
67
+ catch (error) {
68
+ const errorMessage = extractErrorMessage(error, `invokeWithLogging:${toolName}`);
69
+ DebugLogger.log('MCP', toolName, 'error', errorMessage);
70
+ return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, errorMessage);
71
+ }
72
+ }
73
+ /**
74
+ * Complete tool registry with descriptions, schemas, and handlers.
75
+ *
76
+ * Handlers accept typed params — casts at this boundary are safe because
77
+ * the McpServer SDK validates input via Zod schemas before calling handlers.
78
+ */
79
+ /* eslint-disable camelcase -- MCP tool names use underscores */
80
+ export function getToolRegistrations() {
81
+ return [
82
+ // --- Org & Metadata ---
83
+ {
84
+ name: 'cuneiform_org_details',
85
+ description: 'Get Salesforce org configuration by section. Returns ONE section per call. ' +
86
+ 'Start with section=identity to see available sections, then request specific sections as needed. ' +
87
+ 'Sections: identity (org info), cuneiform (package status), features (enabled features), ' +
88
+ 'clouds (detected clouds, paginated), namespaces (installed namespaces, paginated), limits (API limits). ' +
89
+ 'Pass nextCursor from _pagination envelope as cursor for paginated sections.',
90
+ inputSchema: OrgDetailsInputSchema,
91
+ handler: typedHandler(handleOrgDetails),
92
+ },
93
+ {
94
+ name: 'cuneiform_object_list',
95
+ description: 'List Salesforce objects with record counts, type filtering (standard/custom), namespace filtering, ' +
96
+ 'and pattern matching. Returns up to 25 objects per page (max 50). Apply filters first to narrow results ' +
97
+ 'before paginating. Pass nextCursor from the _pagination envelope as cursor to retrieve the next page. ' +
98
+ 'Use to discover which objects exist in the org before profiling.',
99
+ inputSchema: ObjectListInputSchema,
100
+ handler: typedHandler(handleObjectList),
101
+ },
102
+ {
103
+ name: 'cuneiform_object_describe',
104
+ description: 'Get detailed metadata for a single Salesforce object by section. Accepts exactly ONE object API name. ' +
105
+ 'Start with section=summary to see available sections. Sections: summary (object info + field counts), ' +
106
+ 'fields (paginated field list with filtering), fieldDistribution (field type breakdown), recordTypes ' +
107
+ '(paginated record types), relationships (paginated lookups and references). Do NOT loop through all ' +
108
+ 'objects from object_list — describe only the objects the user is interested in.',
109
+ inputSchema: ObjectDescribeInputSchema,
110
+ handler: typedHandler(handleObjectDescribe),
111
+ },
112
+ // --- User Management ---
113
+ {
114
+ name: 'cuneiform_user_details',
115
+ description: 'Confirm that Cuneiform for Salesforce is installed and the current user is configured for remote profiling. ' +
116
+ 'Returns org context, user identity, prerequisite checks (Cuneiform installed, admin access), permission set ' +
117
+ 'assignments, configuration profile status, and actionable resolution guidance when the user is not ready. ' +
118
+ 'Call this FIRST before any other Cuneiform tool to verify the user can run profiling.',
119
+ inputSchema: UserDetailsInputSchema,
120
+ handler: typedHandler(handleUserDetails),
121
+ },
122
+ {
123
+ name: 'cuneiform_user_configure',
124
+ description: 'Configure the current user for Cuneiform profiling access. Assigns required permission sets and ' +
125
+ 'enables API-only profiling. ALWAYS call cuneiform_user_details first to check prerequisites. ' +
126
+ 'ALWAYS use dryRun=true first to preview changes, then call again with dryRun=false to apply.',
127
+ inputSchema: UserConfigureInputSchema,
128
+ handler: typedHandler(handleUserConfigure),
129
+ },
130
+ // --- Definition Lifecycle ---
131
+ {
132
+ name: 'cuneiform_definition_list',
133
+ description: 'List profiling definitions with optional filtering by object name, status, and active state. ' +
134
+ 'Returns definition keys, target objects, field counts, and profiling status.',
135
+ inputSchema: DefinitionListInputSchema,
136
+ handler: typedHandler(handleDefinitionList),
137
+ },
138
+ {
139
+ name: 'cuneiform_definition_get',
140
+ description: 'Get a profiling definition by its Salesforce ID. Returns full definition details.',
141
+ inputSchema: DefinitionGetInputSchema,
142
+ handler: typedHandler(handleDefinitionGet),
143
+ },
144
+ {
145
+ name: 'cuneiform_definition_get_by_key',
146
+ description: 'Get profiling definitions by their human-readable keys (e.g., PD-0001). ' +
147
+ 'Supports retrieving multiple definitions in a single call.',
148
+ inputSchema: DefinitionGetByKeyInputSchema,
149
+ handler: typedHandler(handleDefinitionGetByKey),
150
+ },
151
+ {
152
+ name: 'cuneiform_definition_create',
153
+ description: 'Create profiling definitions for objects matching the specified criteria. ' +
154
+ 'ALWAYS use dryRun=true first to preview what will be created.',
155
+ inputSchema: DefinitionCreateInputSchema,
156
+ handler: typedHandler(handleDefinitionCreate),
157
+ },
158
+ {
159
+ name: 'cuneiform_definition_update',
160
+ description: 'Update metadata attributes (name, category, timeCategory, segmentCategory, description) on an existing ' +
161
+ 'profiling definition. Supply one or more attributes; untouched attributes are preserved.',
162
+ inputSchema: DefinitionUpdateInputSchema,
163
+ handler: typedHandler(handleDefinitionUpdate),
164
+ },
165
+ {
166
+ name: 'cuneiform_definition_purge',
167
+ description: 'Delete profiling definitions that have never been profiled. ' +
168
+ 'Use to clean up unused definitions after scope changes.',
169
+ inputSchema: DefinitionPurgeInputSchema,
170
+ handler: typedHandler(handleDefinitionPurge),
171
+ },
172
+ // --- Definition I/O ---
173
+ {
174
+ name: 'cuneiform_definition_export',
175
+ description: 'Export all profiling definitions as VCS-friendly files. ' +
176
+ 'Returns file contents (CSV/JSON) for version control or cross-org portability.',
177
+ inputSchema: DefinitionExportInputSchema,
178
+ handler: typedHandler(handleDefinitionExport),
179
+ },
180
+ {
181
+ name: 'cuneiform_definition_import',
182
+ description: 'Import profiling definitions from exported files. ALWAYS use simulation=true first to preview changes.',
183
+ inputSchema: DefinitionImportInputSchema,
184
+ handler: typedHandler(handleDefinitionImport),
185
+ },
186
+ // --- Analysis ---
187
+ {
188
+ name: 'cuneiform_contactpoint_analyze',
189
+ description: 'Identify and classify contact point fields in a Salesforce object. ' +
190
+ 'Detects email, phone, address, and social media fields.',
191
+ inputSchema: ContactPointAnalyzeInputSchema,
192
+ handler: typedHandler(handleContactPointAnalyze),
193
+ },
194
+ // --- Results ---
195
+ {
196
+ name: 'cuneiform_summary_list',
197
+ description: 'List profiling summaries for a specific definition. ' +
198
+ 'Returns summary-level records including overall status, total records profiled, fields profiled, last profiled date, and whether each summary is the latest run.',
199
+ inputSchema: SummaryListInputSchema,
200
+ handler: typedHandler(handleSummaryList),
201
+ },
202
+ // --- Profiling ---
203
+ {
204
+ name: 'cuneiform_request_list',
205
+ description: 'List profiling requests with optional status filtering and offset-based pagination. ' +
206
+ 'Filter by a single status (e.g. "Queued") or multiple statuses (e.g. ["Queued", "Completed"]). ' +
207
+ 'Returns id, name, definitionId, definitionName, objectName, status, createdDate, lastModifiedDate, and submittedBy per request. ' +
208
+ 'Use to monitor in-progress requests, audit completed profiling, or find requests eligible for cancellation or deletion.',
209
+ inputSchema: RequestListInputSchema,
210
+ handler: typedHandler(handleRequestList),
211
+ },
212
+ {
213
+ name: 'cuneiform_profile_execute',
214
+ description: 'Execute a profiling definition. Triggers Apex processing to analyze field values and data quality. ' +
215
+ 'Can optionally wait for completion.',
216
+ inputSchema: ProfileExecuteInputSchema,
217
+ handler: typedHandler(handleProfileExecute),
218
+ },
219
+ {
220
+ name: 'cuneiform_profile_status',
221
+ description: 'Check the status of a profiling execution request.',
222
+ inputSchema: ProfileStatusInputSchema,
223
+ handler: typedHandler(handleProfileStatus),
224
+ },
225
+ {
226
+ name: 'cuneiform_profile_cancel',
227
+ description: 'Cancel an active profiling execution. Supports cancelling by request ID or by definition ID ' +
228
+ '(cancels all active requests for that definition).',
229
+ inputSchema: ProfileCancelInputSchema,
230
+ handler: typedHandler(handleProfileCancel),
231
+ },
232
+ {
233
+ name: 'cuneiform_profile_delete',
234
+ description: 'Delete terminal profiling requests by ID. Only Canceled requests can be deleted. This operation is irreversible.',
235
+ inputSchema: ProfileDeleteInputSchema,
236
+ handler: typedHandler(handleProfileDelete),
237
+ },
238
+ ];
239
+ }
240
+ /* eslint-enable camelcase */
241
+ /**
242
+ * Creates and configures the Cuneiform MCP server using McpServer.
243
+ *
244
+ * Registers all 18 tools via `registerTool()` with native Zod schema support,
245
+ * eliminating the manual dispatch layer and JSON Schema duplication.
246
+ *
247
+ * @param config - MCP server configuration
248
+ * @param connection - Salesforce connection
249
+ * @returns Configured McpServer instance
250
+ */
251
+ export function createMcpServer(config, connection) {
252
+ const server = new McpServer({
253
+ name: config.name,
254
+ version: config.version,
255
+ }, {
256
+ capabilities: {
257
+ tools: {},
258
+ prompts: {},
259
+ },
260
+ });
261
+ // Construct adapters once — shared across all tool invocations in this session.
262
+ // LRU caches (e.g., RestApiAdapter describe cache) persist across paginated calls.
263
+ const adapters = createMcpAdapters(connection);
264
+ // Register all tools with native Zod schemas
265
+ const tools = getToolRegistrations();
266
+ for (const tool of tools) {
267
+ server.registerTool(tool.name, {
268
+ description: tool.description,
269
+ inputSchema: tool.inputSchema,
270
+ }, async (args) => invokeWithLogging(tool.name, adapters, tool.handler, args, config.debug));
271
+ }
272
+ // Register system prompt
273
+ server.registerPrompt('cuneiform_system', { description: 'Cuneiform CLI system prompt' }, () => Promise.resolve({
274
+ description: 'Cuneiform CLI system prompt',
275
+ messages: [
276
+ {
277
+ role: 'user',
278
+ content: {
279
+ type: 'text',
280
+ text: CUNEIFORM_SYSTEM_PROMPT,
281
+ },
282
+ },
283
+ ],
284
+ }));
285
+ return server;
286
+ }
287
+ /**
288
+ * Starts the MCP server with stdio transport.
289
+ *
290
+ * @param server - Configured McpServer instance
291
+ * @param debug - Enable debug logging
292
+ */
293
+ /* eslint-disable no-console -- MCP uses stderr for logging */
294
+ export async function startMcpServer(server, debug) {
295
+ const transport = new StdioServerTransport();
296
+ if (debug) {
297
+ console.error('[MCP] Starting server...');
298
+ }
299
+ try {
300
+ await server.connect(transport);
301
+ }
302
+ catch (error) {
303
+ const message = error instanceof Error ? error.message : String(error);
304
+ console.error(`[MCP] Server failed to start: ${message}`);
305
+ if (error instanceof Error && error.stack) {
306
+ console.error(error.stack);
307
+ }
308
+ throw new Error(`MCP server failed to connect to stdio transport: ${message}. ` +
309
+ 'Ensure the process has stdin/stdout available and is not running in a detached context.');
310
+ }
311
+ if (debug) {
312
+ console.error('[MCP] Server started and connected to stdio transport');
313
+ }
314
+ }
315
+ /* eslint-enable no-console */
316
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAIjF,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAA0C,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACnG,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5F,wDAAwD;AACxD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,6BAA6B,EAC7B,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,8BAA8B,EAC9B,sBAAsB,EACt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,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,CAAC,KAAK,CAAC,iCAAiC,OAAO,EAAE,CAAC,CAAC;QAC1D,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAC1C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,MAAM,IAAI,KAAK,CACb,oDAAoD,OAAO,IAAI;YAC7D,yFAAyF,CAC5F,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAC;IACzE,CAAC;AACH,CAAC;AACD,8BAA8B"}
@@ -0,0 +1,14 @@
1
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { McpAdapters } from '../config/mcp-config.js';
3
+ import type { ContactPointAnalyzeInput } from '../schemas/input-schemas.js';
4
+ /**
5
+ * Handler for cuneiform_contactpoint_analyze tool invocation.
6
+ *
7
+ * Analyzes a Salesforce object's fields to identify contact point fields
8
+ * such as email addresses, phone numbers, names, and social media identifiers.
9
+ *
10
+ * @param adapters - Session-scoped MCP adapters
11
+ * @param params - Validated input from MCP SDK
12
+ * @returns MCP CallToolResult
13
+ */
14
+ export declare function handleContactPointAnalyze(adapters: McpAdapters, params: ContactPointAnalyzeInput): Promise<CallToolResult>;
@@ -0,0 +1,34 @@
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 { ContactPointService } from '../../services/ContactPointService.js';
9
+ import { McpErrorCodes } from '../errors.js';
10
+ import { createMcpError, serviceResultToMcp, extractErrorMessage } from './tool-factory.js';
11
+ /**
12
+ * Handler for cuneiform_contactpoint_analyze tool invocation.
13
+ *
14
+ * Analyzes a Salesforce object's fields to identify contact point fields
15
+ * such as email addresses, phone numbers, names, and social media identifiers.
16
+ *
17
+ * @param adapters - Session-scoped MCP adapters
18
+ * @param params - Validated input from MCP SDK
19
+ * @returns MCP CallToolResult
20
+ */
21
+ export async function handleContactPointAnalyze(adapters, params) {
22
+ try {
23
+ const contactPointService = new ContactPointService({
24
+ restApiAdapter: adapters.rest,
25
+ });
26
+ // Execute contact point analysis
27
+ const result = await contactPointService.analyzeContactPoints(params.objectName);
28
+ return serviceResultToMcp(result);
29
+ }
30
+ catch (error) {
31
+ return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, `Failed to analyze contact points: ${extractErrorMessage(error, 'handleContactPointAnalyze')}`);
32
+ }
33
+ }
34
+ //# sourceMappingURL=contactpoint-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contactpoint-tools.js","sourceRoot":"","sources":["../../../src/mcp/tools/contactpoint-tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE5F;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,QAAqB,EACrB,MAAgC;IAEhC,IAAI,CAAC;QACH,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,CAAC;YAClD,cAAc,EAAE,QAAQ,CAAC,IAAI;SAC9B,CAAC,CAAC;QAEH,iCAAiC;QACjC,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,oBAAoB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAEjF,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,cAAc,CACnB,aAAa,CAAC,sBAAsB,EACpC,qCAAqC,mBAAmB,CAAC,KAAK,EAAE,2BAA2B,CAAC,EAAE,CAC/F,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { McpAdapters } from '../config/mcp-config.js';
3
+ import type { DefinitionExportInput, DefinitionImportInput } from '../schemas/input-schemas.js';
4
+ /**
5
+ * Handler for cuneiform_definition_export tool invocation.
6
+ *
7
+ * @param adapters - Session-scoped MCP adapters
8
+ * @param params - Validated input from MCP SDK
9
+ * @returns MCP CallToolResult with file contents
10
+ */
11
+ export declare function handleDefinitionExport(adapters: McpAdapters, params: DefinitionExportInput): Promise<CallToolResult>;
12
+ /**
13
+ * Handler for cuneiform_definition_import tool invocation.
14
+ *
15
+ * @param adapters - Session-scoped MCP adapters
16
+ * @param params - Validated input from MCP SDK
17
+ * @returns MCP CallToolResult
18
+ */
19
+ export declare function handleDefinitionImport(adapters: McpAdapters, params: DefinitionImportInput): Promise<CallToolResult>;
@@ -0,0 +1,152 @@
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 * as crypto from 'node:crypto';
9
+ import * as fs from 'node:fs';
10
+ import * as os from 'node:os';
11
+ import * as path from 'node:path';
12
+ import { SFDMUService } from '../../services/SFDMUService.js';
13
+ import { DefinitionExportOperation, ExportErrorCodes } from '../../operations/DefinitionExportOperation.js';
14
+ import { DefinitionImportOperation } from '../../operations/DefinitionImportOperation.js';
15
+ import { McpErrorCodes } from '../errors.js';
16
+ import { serviceResultToMcp, createMcpError, extractErrorMessage } from './tool-factory.js';
17
+ /**
18
+ * Handler for cuneiform_definition_export tool invocation.
19
+ *
20
+ * @param adapters - Session-scoped MCP adapters
21
+ * @param params - Validated input from MCP SDK
22
+ * @returns MCP CallToolResult with file contents
23
+ */
24
+ export async function handleDefinitionExport(adapters, params) {
25
+ let tempDir;
26
+ try {
27
+ // Generate a unique path without pre-creating the directory.
28
+ // Using a path-string-only approach (not mkdtempSync) so that DefinitionExportOperation
29
+ // can create the directory itself — it guards against accidental overwrites via existsSync,
30
+ // which would false-positive if mkdtempSync had already created the dir (F37).
31
+ tempDir = path.join(os.tmpdir(), `cuneiform-export-${crypto.randomBytes(3).toString('hex')}`);
32
+ // Initialize service and operation
33
+ const sfdmuService = new SFDMUService();
34
+ const exportOperation = new DefinitionExportOperation(sfdmuService);
35
+ // Get target org username
36
+ const targetOrg = adapters.connection.getUsername();
37
+ if (!targetOrg) {
38
+ return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, 'Could not determine target org username');
39
+ }
40
+ // Execute export to temp directory
41
+ const result = await exportOperation.execute({
42
+ targetOrg,
43
+ outputDir: tempDir,
44
+ excludeIds: params.excludeIds,
45
+ });
46
+ if (!result.success) {
47
+ // OUTPUT_DIR_EXISTS guidance ("Use a different path") is not actionable through the MCP
48
+ // interface — callers have no outputDir parameter. Rewrite it to a retry instruction.
49
+ if (result.errorCode === ExportErrorCodes.OUTPUT_DIR_EXISTS) {
50
+ return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, 'Export failed due to a temporary directory conflict. Retry the operation to generate a new unique path.');
51
+ }
52
+ return serviceResultToMcp(result);
53
+ }
54
+ // Read all exported files into memory and return them inline.
55
+ // MCP clients cannot access server-local filesystem paths, so file contents must be
56
+ // returned in the response payload rather than as disk paths (F36).
57
+ const files = [];
58
+ for (const filename of result.data.files) {
59
+ const filePath = path.join(tempDir, filename);
60
+ if (fs.existsSync(filePath) && fs.statSync(filePath).isFile()) {
61
+ const ext = path.extname(filename).toLowerCase().slice(1);
62
+ files.push({ filename, content: fs.readFileSync(filePath, 'utf8'), format: ext || 'text' });
63
+ }
64
+ }
65
+ // Return success with inline file contents.
66
+ // Override the operation message — it references the server-local temp path, which is
67
+ // cleaned up in finally and is not meaningful to an MCP caller.
68
+ return serviceResultToMcp({
69
+ success: true,
70
+ data: {
71
+ definitionsExported: result.data.definitionsExported,
72
+ files,
73
+ },
74
+ message: `Successfully exported ${result.data.definitionsExported} definitions. ${files.length} file(s) returned inline in data.files.`,
75
+ warnings: result.warnings,
76
+ });
77
+ }
78
+ catch (error) {
79
+ return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, `Failed to export definitions: ${extractErrorMessage(error, 'handleDefinitionExport')}`);
80
+ }
81
+ finally {
82
+ // Clean up temp directory
83
+ if (tempDir && fs.existsSync(tempDir)) {
84
+ try {
85
+ fs.rmSync(tempDir, { recursive: true, force: true });
86
+ }
87
+ catch (cleanupError) {
88
+ /* eslint-disable-next-line no-console -- MCP uses stderr for logging */
89
+ console.error(`[MCP] Warning: Failed to clean up temp directory ${tempDir}: ` +
90
+ `${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
91
+ }
92
+ }
93
+ }
94
+ }
95
+ /**
96
+ * Handler for cuneiform_definition_import tool invocation.
97
+ *
98
+ * @param adapters - Session-scoped MCP adapters
99
+ * @param params - Validated input from MCP SDK
100
+ * @returns MCP CallToolResult
101
+ */
102
+ export async function handleDefinitionImport(adapters, params) {
103
+ let tempDir;
104
+ try {
105
+ // Generate a unique path then create the directory explicitly — consistent with the export
106
+ // handler pattern (path-string-only generation, not mkdtempSync).
107
+ tempDir = path.join(os.tmpdir(), `cuneiform-import-${crypto.randomBytes(3).toString('hex')}`);
108
+ fs.mkdirSync(tempDir, { recursive: true });
109
+ // Write file contents to temp directory with path traversal guard
110
+ for (const [filename, content] of Object.entries(params.fileContents)) {
111
+ const sanitized = path.basename(filename);
112
+ if (sanitized !== filename || filename.includes('..')) {
113
+ return createMcpError(McpErrorCodes.INVALID_TOOL_INPUT, `Invalid filename '${filename}': filenames must not contain path separators or '..' components`);
114
+ }
115
+ const filePath = path.join(tempDir, sanitized);
116
+ fs.writeFileSync(filePath, content, 'utf8');
117
+ }
118
+ // Initialize service and operation
119
+ const sfdmuService = new SFDMUService();
120
+ const importOperation = new DefinitionImportOperation(sfdmuService);
121
+ // Get target org username
122
+ const targetOrg = adapters.connection.getUsername();
123
+ if (!targetOrg) {
124
+ return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, 'Could not determine target org username');
125
+ }
126
+ // Execute import from temp directory
127
+ const result = await importOperation.execute({
128
+ targetOrg,
129
+ sourceDir: tempDir,
130
+ operation: params.operation,
131
+ simulation: params.simulation,
132
+ });
133
+ return serviceResultToMcp(result);
134
+ }
135
+ catch (error) {
136
+ return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, `Failed to import definitions: ${extractErrorMessage(error, 'handleDefinitionImport')}`);
137
+ }
138
+ finally {
139
+ // Clean up temp directory
140
+ if (tempDir && fs.existsSync(tempDir)) {
141
+ try {
142
+ fs.rmSync(tempDir, { recursive: true, force: true });
143
+ }
144
+ catch (cleanupError) {
145
+ /* eslint-disable-next-line no-console -- MCP uses stderr for logging */
146
+ console.error(`[MCP] Warning: Failed to clean up temp directory ${tempDir}: ` +
147
+ `${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
148
+ }
149
+ }
150
+ }
151
+ }
152
+ //# sourceMappingURL=definition-io-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition-io-tools.js","sourceRoot":"","sources":["../../../src/mcp/tools/definition-io-tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OA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AAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACvD,CAAC;YAAC,OAAO,YAAY,EAAE,CAAC;gBACtB,wEAAwE;gBACxE,OAAO,CAAC,KAAK,CACX,oDAAoD,OAAO,IAAI;oBAC7D,GAAG,YAAY,YAAY,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CACnF,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,51 @@
1
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { McpAdapters } from '../config/mcp-config.js';
3
+ import type { DefinitionListInput, DefinitionGetInput, DefinitionGetByKeyInput, DefinitionCreateInput, DefinitionUpdateInput, DefinitionPurgeInput } from '../schemas/input-schemas.js';
4
+ /**
5
+ * Handler for cuneiform_definition_list tool invocation.
6
+ *
7
+ * @param adapters - Session-scoped MCP adapters
8
+ * @param params - Validated input from MCP SDK
9
+ * @returns MCP CallToolResult
10
+ */
11
+ export declare function handleDefinitionList(adapters: McpAdapters, params: DefinitionListInput): Promise<CallToolResult>;
12
+ /**
13
+ * Handler for cuneiform_definition_get tool invocation.
14
+ *
15
+ * @param adapters - Session-scoped MCP adapters
16
+ * @param params - Validated input from MCP SDK
17
+ * @returns MCP CallToolResult
18
+ */
19
+ export declare function handleDefinitionGet(adapters: McpAdapters, params: DefinitionGetInput): Promise<CallToolResult>;
20
+ /**
21
+ * Handler for cuneiform_definition_get_by_key tool invocation.
22
+ *
23
+ * @param adapters - Session-scoped MCP adapters
24
+ * @param params - Validated input from MCP SDK
25
+ * @returns MCP CallToolResult
26
+ */
27
+ export declare function handleDefinitionGetByKey(adapters: McpAdapters, params: DefinitionGetByKeyInput): Promise<CallToolResult>;
28
+ /**
29
+ * Handler for cuneiform_definition_create tool invocation.
30
+ *
31
+ * @param adapters - Session-scoped MCP adapters
32
+ * @param params - Validated input from MCP SDK
33
+ * @returns MCP CallToolResult
34
+ */
35
+ export declare function handleDefinitionCreate(adapters: McpAdapters, params: DefinitionCreateInput): Promise<CallToolResult>;
36
+ /**
37
+ * Handler for cuneiform_definition_update tool invocation.
38
+ *
39
+ * @param adapters - Session-scoped MCP adapters
40
+ * @param params - Validated input from MCP SDK
41
+ * @returns MCP CallToolResult
42
+ */
43
+ export declare function handleDefinitionUpdate(adapters: McpAdapters, params: DefinitionUpdateInput): Promise<CallToolResult>;
44
+ /**
45
+ * Handler for cuneiform_definition_purge tool invocation.
46
+ *
47
+ * @param adapters - Session-scoped MCP adapters
48
+ * @param params - Validated input from MCP SDK
49
+ * @returns MCP CallToolResult
50
+ */
51
+ export declare function handleDefinitionPurge(adapters: McpAdapters, params: DefinitionPurgeInput): Promise<CallToolResult>;