@commandable/mcp 0.0.1

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 (397) hide show
  1. package/LICENSE +10 -0
  2. package/README.md +34 -0
  3. package/dist/cli/bin.d.ts +3 -0
  4. package/dist/cli/bin.d.ts.map +1 -0
  5. package/dist/cli/bin.js +7 -0
  6. package/dist/cli/bin.js.map +1 -0
  7. package/dist/cli/credentialManager.d.ts +19 -0
  8. package/dist/cli/credentialManager.d.ts.map +1 -0
  9. package/dist/cli/credentialManager.js +81 -0
  10. package/dist/cli/credentialManager.js.map +1 -0
  11. package/dist/cli/index.d.ts +2 -0
  12. package/dist/cli/index.d.ts.map +1 -0
  13. package/dist/cli/index.js +77 -0
  14. package/dist/cli/index.js.map +1 -0
  15. package/dist/cli/setup.d.ts +3 -0
  16. package/dist/cli/setup.d.ts.map +1 -0
  17. package/dist/cli/setup.js +194 -0
  18. package/dist/cli/setup.js.map +1 -0
  19. package/dist/crypto/encryption.d.ts +3 -0
  20. package/dist/crypto/encryption.d.ts.map +1 -0
  21. package/dist/crypto/encryption.js +29 -0
  22. package/dist/crypto/encryption.js.map +1 -0
  23. package/dist/db/client.d.ts +22 -0
  24. package/dist/db/client.d.ts.map +1 -0
  25. package/dist/db/client.js +43 -0
  26. package/dist/db/client.js.map +1 -0
  27. package/dist/db/credentialStore.d.ts +13 -0
  28. package/dist/db/credentialStore.d.ts.map +1 -0
  29. package/dist/db/credentialStore.js +57 -0
  30. package/dist/db/credentialStore.js.map +1 -0
  31. package/dist/db/integrationStore.d.ts +5 -0
  32. package/dist/db/integrationStore.d.ts.map +1 -0
  33. package/dist/db/integrationStore.js +65 -0
  34. package/dist/db/integrationStore.js.map +1 -0
  35. package/dist/db/migrate.d.ts +3 -0
  36. package/dist/db/migrate.d.ts.map +1 -0
  37. package/dist/db/migrate.js +88 -0
  38. package/dist/db/migrate.js.map +1 -0
  39. package/dist/db/schema.d.ts +911 -0
  40. package/dist/db/schema.d.ts.map +1 -0
  41. package/dist/db/schema.js +73 -0
  42. package/dist/db/schema.js.map +1 -0
  43. package/dist/errors/httpError.d.ts +6 -0
  44. package/dist/errors/httpError.d.ts.map +1 -0
  45. package/dist/errors/httpError.js +11 -0
  46. package/dist/errors/httpError.js.map +1 -0
  47. package/dist/index.d.ts +21 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +21 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/integrations/actionsFactory.d.ts +12 -0
  52. package/dist/integrations/actionsFactory.d.ts.map +1 -0
  53. package/dist/integrations/actionsFactory.js +68 -0
  54. package/dist/integrations/actionsFactory.js.map +1 -0
  55. package/dist/integrations/catalog.d.ts +9 -0
  56. package/dist/integrations/catalog.d.ts.map +1 -0
  57. package/dist/integrations/catalog.js +80 -0
  58. package/dist/integrations/catalog.js.map +1 -0
  59. package/dist/integrations/dataLoader.d.ts +47 -0
  60. package/dist/integrations/dataLoader.d.ts.map +1 -0
  61. package/dist/integrations/dataLoader.js +126 -0
  62. package/dist/integrations/dataLoader.js.map +1 -0
  63. package/dist/integrations/getIntegration.d.ts +11 -0
  64. package/dist/integrations/getIntegration.d.ts.map +1 -0
  65. package/dist/integrations/getIntegration.js +22 -0
  66. package/dist/integrations/getIntegration.js.map +1 -0
  67. package/dist/integrations/googleServiceAccount.d.ts +6 -0
  68. package/dist/integrations/googleServiceAccount.d.ts.map +1 -0
  69. package/dist/integrations/googleServiceAccount.js +54 -0
  70. package/dist/integrations/googleServiceAccount.js.map +1 -0
  71. package/dist/integrations/providerRegistry.d.ts +2 -0
  72. package/dist/integrations/providerRegistry.d.ts.map +1 -0
  73. package/dist/integrations/providerRegistry.js +50 -0
  74. package/dist/integrations/providerRegistry.js.map +1 -0
  75. package/dist/integrations/proxy.d.ts +16 -0
  76. package/dist/integrations/proxy.d.ts.map +1 -0
  77. package/dist/integrations/proxy.js +331 -0
  78. package/dist/integrations/proxy.js.map +1 -0
  79. package/dist/integrations/sandbox.d.ts +7 -0
  80. package/dist/integrations/sandbox.d.ts.map +1 -0
  81. package/dist/integrations/sandbox.js +210 -0
  82. package/dist/integrations/sandbox.js.map +1 -0
  83. package/dist/integrations/tools.d.ts +3 -0
  84. package/dist/integrations/tools.d.ts.map +1 -0
  85. package/dist/integrations/tools.js +70 -0
  86. package/dist/integrations/tools.js.map +1 -0
  87. package/dist/mcp/server.d.ts +15 -0
  88. package/dist/mcp/server.d.ts.map +1 -0
  89. package/dist/mcp/server.js +50 -0
  90. package/dist/mcp/server.js.map +1 -0
  91. package/dist/mcp/toolAdapter.d.ts +17 -0
  92. package/dist/mcp/toolAdapter.d.ts.map +1 -0
  93. package/dist/mcp/toolAdapter.js +18 -0
  94. package/dist/mcp/toolAdapter.js.map +1 -0
  95. package/dist/types.d.ts +34 -0
  96. package/dist/types.d.ts.map +1 -0
  97. package/dist/types.js +2 -0
  98. package/dist/types.js.map +1 -0
  99. package/integration-data/README.md +52 -0
  100. package/integration-data/airtable/credentials.json +20 -0
  101. package/integration-data/airtable/credentials_hint.md +4 -0
  102. package/integration-data/airtable/handlers/create_record.js +12 -0
  103. package/integration-data/airtable/handlers/delete_record.js +7 -0
  104. package/integration-data/airtable/handlers/get_record.js +4 -0
  105. package/integration-data/airtable/handlers/get_table_schema.js +6 -0
  106. package/integration-data/airtable/handlers/list_bases.js +4 -0
  107. package/integration-data/airtable/handlers/list_records.js +25 -0
  108. package/integration-data/airtable/handlers/list_table_fields.js +6 -0
  109. package/integration-data/airtable/handlers/list_tables.js +4 -0
  110. package/integration-data/airtable/handlers/list_views.js +6 -0
  111. package/integration-data/airtable/handlers/search_records.js +6 -0
  112. package/integration-data/airtable/handlers/update_record.js +11 -0
  113. package/integration-data/airtable/manifest.json +83 -0
  114. package/integration-data/airtable/schemas/create_record.json +12 -0
  115. package/integration-data/airtable/schemas/delete_record.json +11 -0
  116. package/integration-data/airtable/schemas/empty.json +6 -0
  117. package/integration-data/airtable/schemas/get_record.json +11 -0
  118. package/integration-data/airtable/schemas/id_base.json +9 -0
  119. package/integration-data/airtable/schemas/id_base_table.json +10 -0
  120. package/integration-data/airtable/schemas/list_records.json +26 -0
  121. package/integration-data/airtable/schemas/search_records.json +12 -0
  122. package/integration-data/airtable/schemas/update_record.json +13 -0
  123. package/integration-data/github/credentials.json +20 -0
  124. package/integration-data/github/credentials_hint.md +7 -0
  125. package/integration-data/github/handlers/add_labels_to_issue.js +12 -0
  126. package/integration-data/github/handlers/close_issue.js +5 -0
  127. package/integration-data/github/handlers/comment_on_issue.js +5 -0
  128. package/integration-data/github/handlers/create_branch.js +33 -0
  129. package/integration-data/github/handlers/create_commit.js +91 -0
  130. package/integration-data/github/handlers/create_issue.js +10 -0
  131. package/integration-data/github/handlers/create_or_update_file.js +21 -0
  132. package/integration-data/github/handlers/create_pull_request.js +16 -0
  133. package/integration-data/github/handlers/create_repo.js +11 -0
  134. package/integration-data/github/handlers/delete_repo.js +6 -0
  135. package/integration-data/github/handlers/get_issue.js +4 -0
  136. package/integration-data/github/handlers/get_repo.js +4 -0
  137. package/integration-data/github/handlers/list_branches.js +4 -0
  138. package/integration-data/github/handlers/list_commits.js +12 -0
  139. package/integration-data/github/handlers/list_issues.js +12 -0
  140. package/integration-data/github/handlers/list_pull_requests.js +8 -0
  141. package/integration-data/github/handlers/list_repos_install.js +4 -0
  142. package/integration-data/github/handlers/list_repos_user.js +4 -0
  143. package/integration-data/github/handlers/merge_pull_request.js +14 -0
  144. package/integration-data/github/handlers/update_issue.js +15 -0
  145. package/integration-data/github/manifest.json +26 -0
  146. package/integration-data/github/schemas/add_labels_to_issue.json +12 -0
  147. package/integration-data/github/schemas/close_issue.json +10 -0
  148. package/integration-data/github/schemas/comment_on_issue.json +11 -0
  149. package/integration-data/github/schemas/create_branch.json +12 -0
  150. package/integration-data/github/schemas/create_commit.json +25 -0
  151. package/integration-data/github/schemas/create_issue.json +13 -0
  152. package/integration-data/github/schemas/create_or_update_file.json +15 -0
  153. package/integration-data/github/schemas/create_pull_request.json +15 -0
  154. package/integration-data/github/schemas/create_repo.json +12 -0
  155. package/integration-data/github/schemas/delete_repo.json +10 -0
  156. package/integration-data/github/schemas/empty.json +5 -0
  157. package/integration-data/github/schemas/get_issue.json +10 -0
  158. package/integration-data/github/schemas/get_repo.json +9 -0
  159. package/integration-data/github/schemas/list_commits.json +12 -0
  160. package/integration-data/github/schemas/list_issues.json +12 -0
  161. package/integration-data/github/schemas/list_pull_requests.json +10 -0
  162. package/integration-data/github/schemas/merge_pull_request.json +14 -0
  163. package/integration-data/github/schemas/owner_repo.json +9 -0
  164. package/integration-data/github/schemas/update_issue.json +15 -0
  165. package/integration-data/google-calendar/credentials.json +36 -0
  166. package/integration-data/google-calendar/credentials_hint.md +9 -0
  167. package/integration-data/google-calendar/handlers/create_event.js +6 -0
  168. package/integration-data/google-calendar/handlers/delete_acl.js +6 -0
  169. package/integration-data/google-calendar/handlers/delete_event.js +7 -0
  170. package/integration-data/google-calendar/handlers/freebusy_query.js +4 -0
  171. package/integration-data/google-calendar/handlers/get_acl.js +5 -0
  172. package/integration-data/google-calendar/handlers/get_calendar.js +4 -0
  173. package/integration-data/google-calendar/handlers/get_event.js +5 -0
  174. package/integration-data/google-calendar/handlers/insert_acl.js +6 -0
  175. package/integration-data/google-calendar/handlers/list_acl.js +5 -0
  176. package/integration-data/google-calendar/handlers/list_calendars.js +4 -0
  177. package/integration-data/google-calendar/handlers/list_colors.js +4 -0
  178. package/integration-data/google-calendar/handlers/list_events.js +21 -0
  179. package/integration-data/google-calendar/handlers/list_settings.js +4 -0
  180. package/integration-data/google-calendar/handlers/move_event.js +6 -0
  181. package/integration-data/google-calendar/handlers/patch_event.js +5 -0
  182. package/integration-data/google-calendar/handlers/quick_add.js +6 -0
  183. package/integration-data/google-calendar/handlers/update_acl.js +7 -0
  184. package/integration-data/google-calendar/handlers/update_event.js +5 -0
  185. package/integration-data/google-calendar/manifest.json +26 -0
  186. package/integration-data/google-calendar/schemas/create_event.json +34 -0
  187. package/integration-data/google-calendar/schemas/delete_acl.json +9 -0
  188. package/integration-data/google-calendar/schemas/empty.json +1 -0
  189. package/integration-data/google-calendar/schemas/freebusy_query.json +13 -0
  190. package/integration-data/google-calendar/schemas/get_acl.json +9 -0
  191. package/integration-data/google-calendar/schemas/id_calendar.json +8 -0
  192. package/integration-data/google-calendar/schemas/id_calendar_event.json +9 -0
  193. package/integration-data/google-calendar/schemas/insert_acl.json +18 -0
  194. package/integration-data/google-calendar/schemas/list_events.json +15 -0
  195. package/integration-data/google-calendar/schemas/move_event.json +10 -0
  196. package/integration-data/google-calendar/schemas/patch_event.json +10 -0
  197. package/integration-data/google-calendar/schemas/quick_add.json +9 -0
  198. package/integration-data/google-calendar/schemas/update_acl.json +10 -0
  199. package/integration-data/google-calendar/schemas/update_event.json +10 -0
  200. package/integration-data/google-docs/credentials.json +36 -0
  201. package/integration-data/google-docs/credentials_hint.md +9 -0
  202. package/integration-data/google-docs/handlers/append_text.js +12 -0
  203. package/integration-data/google-docs/handlers/batch_update.js +13 -0
  204. package/integration-data/google-docs/handlers/create_document.js +9 -0
  205. package/integration-data/google-docs/handlers/delete_first_match.js +50 -0
  206. package/integration-data/google-docs/handlers/get_document.js +12 -0
  207. package/integration-data/google-docs/handlers/get_document_structured.js +6 -0
  208. package/integration-data/google-docs/handlers/get_document_text.js +17 -0
  209. package/integration-data/google-docs/handlers/insert_inline_image_after_first_match.js +41 -0
  210. package/integration-data/google-docs/handlers/insert_page_break_after_first_match.js +49 -0
  211. package/integration-data/google-docs/handlers/insert_table_after_first_match.js +49 -0
  212. package/integration-data/google-docs/handlers/insert_text_after_first_match.js +51 -0
  213. package/integration-data/google-docs/handlers/replace_all_text.js +8 -0
  214. package/integration-data/google-docs/handlers/style_first_match.js +42 -0
  215. package/integration-data/google-docs/handlers/update_document_style.js +8 -0
  216. package/integration-data/google-docs/handlers/update_paragraph_style_for_first_match.js +48 -0
  217. package/integration-data/google-docs/manifest.json +58 -0
  218. package/integration-data/google-docs/schemas/append_text.json +10 -0
  219. package/integration-data/google-docs/schemas/apply_text_style.json +13 -0
  220. package/integration-data/google-docs/schemas/batch_update.json +16 -0
  221. package/integration-data/google-docs/schemas/create_document.json +8 -0
  222. package/integration-data/google-docs/schemas/delete_content_range.json +11 -0
  223. package/integration-data/google-docs/schemas/delete_first_match.json +10 -0
  224. package/integration-data/google-docs/schemas/get_document.json +11 -0
  225. package/integration-data/google-docs/schemas/get_document_structured.json +9 -0
  226. package/integration-data/google-docs/schemas/get_document_text.json +9 -0
  227. package/integration-data/google-docs/schemas/insert_inline_image.json +12 -0
  228. package/integration-data/google-docs/schemas/insert_inline_image_after_first_match.json +13 -0
  229. package/integration-data/google-docs/schemas/insert_page_break.json +10 -0
  230. package/integration-data/google-docs/schemas/insert_page_break_after_first_match.json +11 -0
  231. package/integration-data/google-docs/schemas/insert_table.json +12 -0
  232. package/integration-data/google-docs/schemas/insert_table_after_first_match.json +13 -0
  233. package/integration-data/google-docs/schemas/insert_text_after_first_match.json +12 -0
  234. package/integration-data/google-docs/schemas/insert_text_at.json +11 -0
  235. package/integration-data/google-docs/schemas/replace_all_text.json +12 -0
  236. package/integration-data/google-docs/schemas/style_first_match.json +12 -0
  237. package/integration-data/google-docs/schemas/update_document_style.json +11 -0
  238. package/integration-data/google-docs/schemas/update_paragraph_style.json +13 -0
  239. package/integration-data/google-docs/schemas/update_paragraph_style_for_first_match.json +12 -0
  240. package/integration-data/google-sheet/credentials.json +36 -0
  241. package/integration-data/google-sheet/credentials_hint.md +9 -0
  242. package/integration-data/google-sheet/handlers/append_values.js +18 -0
  243. package/integration-data/google-sheet/handlers/batch_clear_values.js +6 -0
  244. package/integration-data/google-sheet/handlers/batch_clear_values_by_data_filter.js +6 -0
  245. package/integration-data/google-sheet/handlers/batch_get_values.js +16 -0
  246. package/integration-data/google-sheet/handlers/batch_update.js +14 -0
  247. package/integration-data/google-sheet/handlers/batch_update_values.js +16 -0
  248. package/integration-data/google-sheet/handlers/batch_update_values_by_data_filter.js +16 -0
  249. package/integration-data/google-sheet/handlers/clear_values.js +6 -0
  250. package/integration-data/google-sheet/handlers/copy_to_spreadsheet.js +6 -0
  251. package/integration-data/google-sheet/handlers/create_spreadsheet.js +5 -0
  252. package/integration-data/google-sheet/handlers/get_developer_metadata.js +6 -0
  253. package/integration-data/google-sheet/handlers/get_spreadsheet.js +12 -0
  254. package/integration-data/google-sheet/handlers/get_spreadsheet_by_data_filter.js +10 -0
  255. package/integration-data/google-sheet/handlers/get_values.js +14 -0
  256. package/integration-data/google-sheet/handlers/get_values_by_data_filter.js +14 -0
  257. package/integration-data/google-sheet/handlers/search_developer_metadata.js +7 -0
  258. package/integration-data/google-sheet/handlers/update_values.js +16 -0
  259. package/integration-data/google-sheet/manifest.json +125 -0
  260. package/integration-data/google-sheet/schemas/append_values.json +16 -0
  261. package/integration-data/google-sheet/schemas/batch_clear_values.json +10 -0
  262. package/integration-data/google-sheet/schemas/batch_clear_values_by_data_filter.json +10 -0
  263. package/integration-data/google-sheet/schemas/batch_get_values.json +13 -0
  264. package/integration-data/google-sheet/schemas/batch_update.json +13 -0
  265. package/integration-data/google-sheet/schemas/batch_update_values.json +25 -0
  266. package/integration-data/google-sheet/schemas/batch_update_values_by_data_filter.json +25 -0
  267. package/integration-data/google-sheet/schemas/clear_values.json +10 -0
  268. package/integration-data/google-sheet/schemas/copy_to_spreadsheet.json +11 -0
  269. package/integration-data/google-sheet/schemas/create_spreadsheet.json +11 -0
  270. package/integration-data/google-sheet/schemas/get_developer_metadata.json +10 -0
  271. package/integration-data/google-sheet/schemas/get_spreadsheet.json +15 -0
  272. package/integration-data/google-sheet/schemas/get_spreadsheet_by_data_filter.json +11 -0
  273. package/integration-data/google-sheet/schemas/get_values.json +13 -0
  274. package/integration-data/google-sheet/schemas/get_values_by_data_filter.json +17 -0
  275. package/integration-data/google-sheet/schemas/search_developer_metadata.json +14 -0
  276. package/integration-data/google-sheet/schemas/update_values.json +15 -0
  277. package/integration-data/google-slides/credentials.json +36 -0
  278. package/integration-data/google-slides/credentials_hint.md +9 -0
  279. package/integration-data/google-slides/handlers/append_text_to_title_of_first_slide.js +17 -0
  280. package/integration-data/google-slides/handlers/batch_update.js +15 -0
  281. package/integration-data/google-slides/handlers/create_presentation.js +8 -0
  282. package/integration-data/google-slides/handlers/create_slide_after_first_match.js +20 -0
  283. package/integration-data/google-slides/handlers/get_page_thumbnail.js +12 -0
  284. package/integration-data/google-slides/handlers/get_presentation.js +6 -0
  285. package/integration-data/google-slides/handlers/insert_image_after_first_match.js +19 -0
  286. package/integration-data/google-slides/handlers/insert_shape_after_first_match.js +21 -0
  287. package/integration-data/google-slides/handlers/replace_text_first_match.js +9 -0
  288. package/integration-data/google-slides/handlers/set_background_color_for_slide_index.js +15 -0
  289. package/integration-data/google-slides/handlers/style_text_first_match.js +48 -0
  290. package/integration-data/google-slides/manifest.json +41 -0
  291. package/integration-data/google-slides/schemas/append_text_to_title_of_first_slide.json +11 -0
  292. package/integration-data/google-slides/schemas/batch_update.json +13 -0
  293. package/integration-data/google-slides/schemas/create_presentation.json +8 -0
  294. package/integration-data/google-slides/schemas/create_slide_after_first_match.json +11 -0
  295. package/integration-data/google-slides/schemas/get_page_thumbnail.json +12 -0
  296. package/integration-data/google-slides/schemas/get_presentation.json +9 -0
  297. package/integration-data/google-slides/schemas/insert_image_after_first_match.json +13 -0
  298. package/integration-data/google-slides/schemas/insert_shape_after_first_match.json +13 -0
  299. package/integration-data/google-slides/schemas/replace_text_first_match.json +12 -0
  300. package/integration-data/google-slides/schemas/set_background_color_for_slide_index.json +11 -0
  301. package/integration-data/google-slides/schemas/style_text_first_match.json +12 -0
  302. package/integration-data/new_integration_prompt.md +41 -0
  303. package/integration-data/notion/credentials.json +21 -0
  304. package/integration-data/notion/credentials_hint.md +5 -0
  305. package/integration-data/notion/handlers/append_block_children.js +7 -0
  306. package/integration-data/notion/handlers/create_comment.js +10 -0
  307. package/integration-data/notion/handlers/create_database.js +11 -0
  308. package/integration-data/notion/handlers/create_page.js +13 -0
  309. package/integration-data/notion/handlers/delete_block.js +8 -0
  310. package/integration-data/notion/handlers/get_me.js +4 -0
  311. package/integration-data/notion/handlers/list_block_children.js +10 -0
  312. package/integration-data/notion/handlers/list_comments.js +14 -0
  313. package/integration-data/notion/handlers/list_users.js +10 -0
  314. package/integration-data/notion/handlers/query_database.js +10 -0
  315. package/integration-data/notion/handlers/retrieve_block.js +4 -0
  316. package/integration-data/notion/handlers/retrieve_database.js +4 -0
  317. package/integration-data/notion/handlers/retrieve_page.js +4 -0
  318. package/integration-data/notion/handlers/retrieve_page_property_item.js +10 -0
  319. package/integration-data/notion/handlers/retrieve_user.js +4 -0
  320. package/integration-data/notion/handlers/search.js +11 -0
  321. package/integration-data/notion/handlers/update_block.js +7 -0
  322. package/integration-data/notion/handlers/update_database.js +10 -0
  323. package/integration-data/notion/handlers/update_page_properties.js +10 -0
  324. package/integration-data/notion/manifest.json +139 -0
  325. package/integration-data/notion/prompt.md +26 -0
  326. package/integration-data/notion/schemas/append_block_children.json +10 -0
  327. package/integration-data/notion/schemas/create_comment.json +18 -0
  328. package/integration-data/notion/schemas/create_database.json +18 -0
  329. package/integration-data/notion/schemas/create_page.json +22 -0
  330. package/integration-data/notion/schemas/delete_block.json +9 -0
  331. package/integration-data/notion/schemas/empty.json +6 -0
  332. package/integration-data/notion/schemas/id_block.json +9 -0
  333. package/integration-data/notion/schemas/id_database.json +9 -0
  334. package/integration-data/notion/schemas/id_page.json +9 -0
  335. package/integration-data/notion/schemas/id_user.json +9 -0
  336. package/integration-data/notion/schemas/list_block_children.json +11 -0
  337. package/integration-data/notion/schemas/list_comments.json +15 -0
  338. package/integration-data/notion/schemas/list_users.json +9 -0
  339. package/integration-data/notion/schemas/query_database.json +13 -0
  340. package/integration-data/notion/schemas/retrieve_page_property_item.json +12 -0
  341. package/integration-data/notion/schemas/search.json +27 -0
  342. package/integration-data/notion/schemas/update_block.json +10 -0
  343. package/integration-data/notion/schemas/update_database.json +13 -0
  344. package/integration-data/notion/schemas/update_page_properties.json +13 -0
  345. package/integration-data/trello/credentials.json +26 -0
  346. package/integration-data/trello/credentials_hint.md +4 -0
  347. package/integration-data/trello/handlers/add_checklist_to_card.js +5 -0
  348. package/integration-data/trello/handlers/add_member_to_card.js +5 -0
  349. package/integration-data/trello/handlers/archive_list.js +5 -0
  350. package/integration-data/trello/handlers/create_card.js +13 -0
  351. package/integration-data/trello/handlers/create_list.js +7 -0
  352. package/integration-data/trello/handlers/delete_card.js +9 -0
  353. package/integration-data/trello/handlers/get_board.js +4 -0
  354. package/integration-data/trello/handlers/get_board_cards.js +4 -0
  355. package/integration-data/trello/handlers/get_board_custom_fields.js +4 -0
  356. package/integration-data/trello/handlers/get_board_labels.js +4 -0
  357. package/integration-data/trello/handlers/get_board_lists.js +4 -0
  358. package/integration-data/trello/handlers/get_board_members.js +4 -0
  359. package/integration-data/trello/handlers/get_board_memberships.js +4 -0
  360. package/integration-data/trello/handlers/get_card.js +4 -0
  361. package/integration-data/trello/handlers/get_card_actions.js +4 -0
  362. package/integration-data/trello/handlers/get_card_attachments.js +4 -0
  363. package/integration-data/trello/handlers/get_card_checklists.js +4 -0
  364. package/integration-data/trello/handlers/get_card_custom_field_items.js +4 -0
  365. package/integration-data/trello/handlers/get_card_members.js +4 -0
  366. package/integration-data/trello/handlers/get_list.js +4 -0
  367. package/integration-data/trello/handlers/get_list_cards.js +4 -0
  368. package/integration-data/trello/handlers/get_member.js +4 -0
  369. package/integration-data/trello/handlers/get_member_boards.js +4 -0
  370. package/integration-data/trello/handlers/get_member_organizations.js +4 -0
  371. package/integration-data/trello/handlers/get_organization.js +4 -0
  372. package/integration-data/trello/handlers/get_organization_boards.js +4 -0
  373. package/integration-data/trello/handlers/move_card_to_list.js +5 -0
  374. package/integration-data/trello/handlers/remove_member_from_card.js +9 -0
  375. package/integration-data/trello/handlers/search.js +5 -0
  376. package/integration-data/trello/handlers/update_card.js +19 -0
  377. package/integration-data/trello/handlers/update_list.js +11 -0
  378. package/integration-data/trello/manifest.json +231 -0
  379. package/integration-data/trello/schemas/add_checklist_to_card.json +10 -0
  380. package/integration-data/trello/schemas/add_member_to_card.json +10 -0
  381. package/integration-data/trello/schemas/archive_list.json +9 -0
  382. package/integration-data/trello/schemas/create_card.json +13 -0
  383. package/integration-data/trello/schemas/create_list.json +11 -0
  384. package/integration-data/trello/schemas/delete_card.json +9 -0
  385. package/integration-data/trello/schemas/display_trello_cards.json +45 -0
  386. package/integration-data/trello/schemas/empty.json +5 -0
  387. package/integration-data/trello/schemas/get_member.json +5 -0
  388. package/integration-data/trello/schemas/id_board.json +8 -0
  389. package/integration-data/trello/schemas/id_card.json +8 -0
  390. package/integration-data/trello/schemas/id_list.json +8 -0
  391. package/integration-data/trello/schemas/id_org.json +8 -0
  392. package/integration-data/trello/schemas/move_card_to_list.json +10 -0
  393. package/integration-data/trello/schemas/remove_member_from_card.json +10 -0
  394. package/integration-data/trello/schemas/search.json +8 -0
  395. package/integration-data/trello/schemas/update_card.json +16 -0
  396. package/integration-data/trello/schemas/update_list.json +12 -0
  397. package/package.json +61 -0
@@ -0,0 +1,54 @@
1
+ import { JWT } from 'google-auth-library';
2
+ const cache = new Map();
3
+ function cacheKey(args) {
4
+ // Keep key stable but avoid storing the entire JSON as a Map key.
5
+ // client_email is a stable identifier and not secret by itself.
6
+ let email = 'unknown';
7
+ try {
8
+ const parsed = JSON.parse(args.serviceAccountJson || '{}');
9
+ if (typeof parsed?.client_email === 'string')
10
+ email = parsed.client_email;
11
+ }
12
+ catch { }
13
+ const scopesKey = [...args.scopes].sort().join(' ');
14
+ const subjectKey = args.subject || '';
15
+ return `${email}::${subjectKey}::${scopesKey}`;
16
+ }
17
+ export async function getGoogleAccessToken(args) {
18
+ if (!args.serviceAccountJson)
19
+ throw new Error('Missing serviceAccountJson');
20
+ if (!Array.isArray(args.scopes) || !args.scopes.length)
21
+ throw new Error('Missing scopes');
22
+ const key = cacheKey(args);
23
+ const existing = cache.get(key);
24
+ const now = Date.now();
25
+ if (existing && existing.expiresAtMs - now > 60_000)
26
+ return existing.token;
27
+ let parsed;
28
+ try {
29
+ parsed = JSON.parse(args.serviceAccountJson);
30
+ }
31
+ catch {
32
+ throw new Error('serviceAccountJson must be valid JSON');
33
+ }
34
+ const clientEmail = parsed?.client_email;
35
+ const privateKey = parsed?.private_key;
36
+ if (typeof clientEmail !== 'string' || !clientEmail.trim())
37
+ throw new Error('serviceAccountJson is missing client_email');
38
+ if (typeof privateKey !== 'string' || !privateKey.trim())
39
+ throw new Error('serviceAccountJson is missing private_key');
40
+ const jwt = new JWT({
41
+ email: clientEmail,
42
+ key: privateKey,
43
+ scopes: args.scopes,
44
+ subject: args.subject,
45
+ });
46
+ const res = await jwt.authorize();
47
+ const token = res?.access_token;
48
+ if (!token)
49
+ throw new Error('Failed to mint Google access token');
50
+ const expiresAtMs = typeof res.expiry_date === 'number' ? res.expiry_date : (now + 55 * 60_000);
51
+ cache.set(key, { token, expiresAtMs });
52
+ return token;
53
+ }
54
+ //# sourceMappingURL=googleServiceAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"googleServiceAccount.js","sourceRoot":"","sources":["../../src/integrations/googleServiceAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAOzC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAuB,CAAA;AAE5C,SAAS,QAAQ,CAAC,IAAwE;IACxF,kEAAkE;IAClE,gEAAgE;IAChE,IAAI,KAAK,GAAG,SAAS,CAAA;IACrB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,CAAA;QAC1D,IAAI,OAAO,MAAM,EAAE,YAAY,KAAK,QAAQ;YAC1C,KAAK,GAAG,MAAM,CAAC,YAAY,CAAA;IAC/B,CAAC;IACD,MAAM,CAAC,CAAA,CAAC;IAER,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,M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AU,KAAK,QAAQ,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;QACtD,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;IAE9D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;QAClB,KAAK,EAAE,WAAW;QAClB,GAAG,EAAE,UAAU;QACf,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC,CAAA;IAEF,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,SAAS,EAAE,CAAA;IACjC,MAAM,KAAK,GAAG,GAAG,EAAE,YAAY,CAAA;IAC/B,IAAI,CAAC,KAAK;QACR,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IAEvD,MAAM,WAAW,GAAG,OAAO,GAAG,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,MAAM,CAAC,CAAA;IAC/F,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAA;IACtC,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const PROVIDERS: Record<string, any>;
2
+ //# sourceMappingURL=providerRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providerRegistry.d.ts","sourceRoot":"","sources":["../../src/integrations/providerRegistry.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAgDzC,CAAA"}
@@ -0,0 +1,50 @@
1
+ export const PROVIDERS = {
2
+ 'http': {
3
+ baseUrl: '',
4
+ makeAuth: () => ({}),
5
+ },
6
+ 'trello': {
7
+ baseUrl: 'https://api.trello.com/1',
8
+ makeAuth: (token, apiKey) => ({ key: apiKey, token }),
9
+ },
10
+ 'slack': {
11
+ baseUrl: 'https://slack.com/api',
12
+ makeAuth: (token) => ({ Authorization: `Bearer ${token}` }),
13
+ },
14
+ 'airtable': {
15
+ baseUrl: 'https://api.airtable.com/v0',
16
+ makeAuth: (token) => ({ Authorization: `Bearer ${token}` }),
17
+ },
18
+ 'github': {
19
+ baseUrl: 'https://api.github.com',
20
+ makeAuth: (token) => ({ Authorization: `Bearer ${token}` }),
21
+ },
22
+ 'notion': {
23
+ baseUrl: 'https://api.notion.com/v1',
24
+ makeAuth: (token) => ({
25
+ 'Authorization': `Bearer ${token}`,
26
+ 'Notion-Version': '2022-06-28',
27
+ }),
28
+ },
29
+ 'google-calendar': {
30
+ baseUrl: 'https://www.googleapis.com/calendar/v3',
31
+ makeAuth: (token) => ({ Authorization: `Bearer ${token}` }),
32
+ },
33
+ 'google-sheet': {
34
+ baseUrl: 'https://sheets.googleapis.com/v4',
35
+ makeAuth: (token) => ({ Authorization: `Bearer ${token}` }),
36
+ },
37
+ 'google-docs': {
38
+ baseUrl: 'https://docs.googleapis.com/v1',
39
+ makeAuth: (token) => ({ Authorization: `Bearer ${token}` }),
40
+ },
41
+ 'google-slides': {
42
+ baseUrl: 'https://slides.googleapis.com/v1',
43
+ makeAuth: (token) => ({ Authorization: `Bearer ${token}` }),
44
+ },
45
+ 'jira': {
46
+ baseUrl: (sub) => `https://api.atlassian.com/ex/jira/${sub}`,
47
+ makeAuth: (token) => ({ Authorization: `Bearer ${token}` }),
48
+ },
49
+ };
50
+ //# sourceMappingURL=providerRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providerRegistry.js","sourceRoot":"","sources":["../../src/integrations/providerRegistry.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAwB;IAC5C,MAAM,EAAE;QACN,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;KACrB;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,0BAA0B;QACnC,QAAQ,EAAE,CAAC,KAAa,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3C,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,CAAC;KACpE;IACD,MAAM,EAAE;QACN,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,qCAAqC,GAAG,EAAE;QACpE,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,CAAC;KACpE;CACF,CAAA"}
@@ -0,0 +1,16 @@
1
+ import type { IntegrationData } from '../types.js';
2
+ export interface CredentialStore {
3
+ getCredentials: (spaceId: string, credentialId: string) => Promise<Record<string, string> | null>;
4
+ }
5
+ export interface IntegrationProxyOptions {
6
+ managedOAuthSecretKey?: string;
7
+ managedOAuthBaseUrl?: string;
8
+ trelloApiKey?: string;
9
+ credentialStore?: CredentialStore;
10
+ }
11
+ export declare class IntegrationProxy {
12
+ private readonly opts;
13
+ constructor(opts?: IntegrationProxyOptions);
14
+ call(integration: IntegrationData, path: string, init?: RequestInit): Promise<Response>;
15
+ }
16
+ //# sourceMappingURL=proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/integrations/proxy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAKlD,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;CAClG;AAED,MAAM,WAAW,uBAAuB;IAEtC,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAE5B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe,CAAC,EAAE,eAAe,CAAA;CAClC;AAED,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,GAAE,uBAA4B;IAEzD,IAAI,CAAC,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC;CAiWlG"}
@@ -0,0 +1,331 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import { HttpError } from '../errors/httpError.js';
3
+ import { PROVIDERS } from './providerRegistry.js';
4
+ import { loadIntegrationCredentialConfig } from './dataLoader.js';
5
+ import { getGoogleAccessToken } from './googleServiceAccount.js';
6
+ export class IntegrationProxy {
7
+ opts;
8
+ constructor(opts = {}) {
9
+ this.opts = opts;
10
+ }
11
+ async call(integration, path, init = {}) {
12
+ const { type: provider, connectionId } = integration;
13
+ if (!provider || !path)
14
+ throw new HttpError(400, 'provider and path are required.');
15
+ const joinWithoutDuplicateSegments = (baseUrl, rawPath) => {
16
+ let pathOnly = rawPath || '';
17
+ let queryPart = '';
18
+ const qIndex = pathOnly.indexOf('?');
19
+ if (qIndex >= 0) {
20
+ queryPart = pathOnly.slice(qIndex + 1);
21
+ pathOnly = pathOnly.slice(0, qIndex);
22
+ }
23
+ try {
24
+ const base = new URL(baseUrl);
25
+ const baseSegs = base.pathname.split('/').filter(Boolean);
26
+ const pathSegs = (pathOnly || '/').split('/').filter(Boolean);
27
+ let overlap = 0;
28
+ const maxK = Math.min(baseSegs.length, pathSegs.length);
29
+ for (let k = maxK; k >= 1; k--) {
30
+ let ok = true;
31
+ for (let i = 0; i < k; i++) {
32
+ if (baseSegs[baseSegs.length - k + i] !== pathSegs[i]) {
33
+ ok = false;
34
+ break;
35
+ }
36
+ }
37
+ if (ok) {
38
+ overlap = k;
39
+ break;
40
+ }
41
+ }
42
+ const normalizedPath = `/${[...baseSegs, ...pathSegs.slice(overlap)].join('/')}`;
43
+ const baseOrigin = base.origin;
44
+ const urlNoQuery = `${baseOrigin}${normalizedPath}`;
45
+ return queryPart ? `${urlNoQuery}?${queryPart}` : urlNoQuery;
46
+ }
47
+ catch {
48
+ const cleanedBase = baseUrl.replace(/\/+$/, '');
49
+ const cleanedPath = (`/${(pathOnly || '').replace(/^\/+/, '')}`);
50
+ const baseParts = cleanedBase.split('/').filter(Boolean);
51
+ const pathParts = cleanedPath.split('/').filter(Boolean);
52
+ let overlap = 0;
53
+ const maxK = Math.min(baseParts.length, pathParts.length);
54
+ for (let k = maxK; k >= 1; k--) {
55
+ let ok = true;
56
+ for (let i = 0; i < k; i++) {
57
+ if (baseParts[baseParts.length - k + i] !== pathParts[i]) {
58
+ ok = false;
59
+ break;
60
+ }
61
+ }
62
+ if (ok) {
63
+ overlap = k;
64
+ break;
65
+ }
66
+ }
67
+ const joined = `/${[...baseParts, ...pathParts.slice(overlap)].join('/')}`;
68
+ return queryPart ? `${joined}?${queryPart}` : joined;
69
+ }
70
+ };
71
+ if (provider === 'http') {
72
+ const cfg = integration.config || {};
73
+ const baseUrl = cfg.baseUrl;
74
+ if (!baseUrl)
75
+ throw new HttpError(400, 'HTTP integration requires a baseUrl in its config.');
76
+ const authType = cfg.authType || 'none';
77
+ const preparedInit = { ...init };
78
+ if (preparedInit.body !== undefined && typeof preparedInit.body !== 'string') {
79
+ preparedInit.body = JSON.stringify(preparedInit.body);
80
+ preparedInit.headers = {
81
+ 'Content-Type': 'application/json',
82
+ ...preparedInit.headers,
83
+ };
84
+ }
85
+ const authHeaders = {};
86
+ const authQuery = new URLSearchParams();
87
+ if (authType === 'api_key_header' && cfg.apiKeyHeaderName && cfg.apiKey) {
88
+ authHeaders[cfg.apiKeyHeaderName] = cfg.apiKey;
89
+ }
90
+ else if (authType === 'api_key_query' && cfg.apiKeyQueryParam && cfg.apiKey) {
91
+ authQuery.set(cfg.apiKeyQueryParam, cfg.apiKey);
92
+ }
93
+ else if (authType === 'basic' && cfg.basicUsername !== undefined && cfg.basicPassword !== undefined) {
94
+ const token = Buffer.from(`${cfg.basicUsername}:${cfg.basicPassword}`).toString('base64');
95
+ authHeaders.Authorization = `Basic ${token}`;
96
+ }
97
+ else if (authType === 'custom') {
98
+ if (cfg.customHeaders)
99
+ Object.assign(authHeaders, cfg.customHeaders);
100
+ if (cfg.customQuery) {
101
+ for (const [k, v] of Object.entries(cfg.customQuery))
102
+ authQuery.set(k, v);
103
+ }
104
+ }
105
+ const authQueryString = authQuery.toString();
106
+ let finalUrl = joinWithoutDuplicateSegments(baseUrl, path);
107
+ if (authQueryString)
108
+ finalUrl = finalUrl + (finalUrl.includes('?') ? '&' : '?') + authQueryString;
109
+ const response = await fetch(finalUrl, {
110
+ ...preparedInit,
111
+ method: preparedInit.method || 'GET',
112
+ headers: {
113
+ ...preparedInit.headers,
114
+ ...authHeaders,
115
+ },
116
+ });
117
+ if (!response.ok) {
118
+ const contentType = response.headers.get('content-type') || '';
119
+ let bodyText = '';
120
+ try {
121
+ bodyText = contentType.includes('json') ? JSON.stringify(await response.json()) : await response.text();
122
+ }
123
+ catch { }
124
+ const redactedUrl = cfg.apiKey ? finalUrl.replace(cfg.apiKey, '***') : finalUrl;
125
+ throw new HttpError(response.status, 'Failed to proxy request to http integration.', {
126
+ status: response.status,
127
+ url: redactedUrl,
128
+ contentType,
129
+ body: bodyText?.slice(0, 4000),
130
+ });
131
+ }
132
+ return response;
133
+ }
134
+ const usesCredentials = integration.connectionMethod === 'credentials';
135
+ if (usesCredentials) {
136
+ if (!this.opts.credentialStore)
137
+ throw new HttpError(500, 'Credential storage is not configured.');
138
+ const spaceId = integration.spaceId;
139
+ if (!spaceId)
140
+ throw new HttpError(400, 'spaceId is required for credentials-based integrations.');
141
+ const credentialId = integration.credentialId;
142
+ if (!credentialId)
143
+ throw new HttpError(400, 'credentialId is required for credentials-based integrations.');
144
+ const credCfg = loadIntegrationCredentialConfig(provider);
145
+ if (!credCfg)
146
+ throw new HttpError(501, `Provider '${provider}' does not support credentials-based auth yet.`);
147
+ const creds = await this.opts.credentialStore.getCredentials(spaceId, credentialId);
148
+ if (!creds)
149
+ throw new HttpError(400, 'No credentials are configured for this integration.');
150
+ if (provider.startsWith('google-')) {
151
+ const maybeToken = creds.token;
152
+ const serviceAccountJson = creds.serviceAccountJson;
153
+ if (!maybeToken && !serviceAccountJson) {
154
+ throw new HttpError(400, `Google integration '${provider}' requires either a 'token' or 'serviceAccountJson' credential.`);
155
+ }
156
+ if (!maybeToken && serviceAccountJson) {
157
+ const subject = typeof creds.subject === 'string' ? creds.subject : undefined;
158
+ const rawScopes = creds.scopes;
159
+ const scopesFromCreds = Array.isArray(rawScopes)
160
+ ? rawScopes.map((s) => String(s)).filter(Boolean)
161
+ : (typeof rawScopes === 'string'
162
+ ? rawScopes.split(/[,\s]+/g).map(s => s.trim()).filter(Boolean)
163
+ : []);
164
+ const defaultScopes = {
165
+ 'google-sheet': ['https://www.googleapis.com/auth/spreadsheets'],
166
+ 'google-docs': ['https://www.googleapis.com/auth/documents', 'https://www.googleapis.com/auth/drive'],
167
+ 'google-slides': ['https://www.googleapis.com/auth/presentations', 'https://www.googleapis.com/auth/drive'],
168
+ 'google-calendar': ['https://www.googleapis.com/auth/calendar'],
169
+ };
170
+ const scopes = scopesFromCreds.length ? scopesFromCreds : (defaultScopes[provider] || []);
171
+ if (!scopes.length)
172
+ throw new HttpError(400, `Missing OAuth scopes for Google integration '${provider}'.`);
173
+ const token = await getGoogleAccessToken({ serviceAccountJson, scopes, subject });
174
+ creds.token = token;
175
+ }
176
+ }
177
+ const resolveTemplate = (template) => {
178
+ return String(template).replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g, (_m, key) => {
179
+ const v = creds[key];
180
+ if (v === undefined || v === null)
181
+ throw new HttpError(400, `Missing credential field '${key}'.`);
182
+ return String(v);
183
+ });
184
+ };
185
+ const resolvedHeaders = {};
186
+ const resolvedQuery = new URLSearchParams();
187
+ for (const [k, v] of Object.entries(credCfg.injection?.headers || {}))
188
+ resolvedHeaders[k] = resolveTemplate(v);
189
+ for (const [k, v] of Object.entries(credCfg.injection?.query || {}))
190
+ resolvedQuery.set(k, resolveTemplate(v));
191
+ const providerCfg = PROVIDERS[provider];
192
+ if (!providerCfg)
193
+ throw new HttpError(501, `Provider '${provider}' is not configured in the server proxy.`);
194
+ const baseUrl = typeof providerCfg.baseUrl === 'function' ? providerCfg.baseUrl( /* todo */) : providerCfg.baseUrl;
195
+ let finalUrl = joinWithoutDuplicateSegments(baseUrl, path);
196
+ const queryString = resolvedQuery.toString();
197
+ if (queryString)
198
+ finalUrl = finalUrl + (finalUrl.includes('?') ? '&' : '?') + queryString;
199
+ const preparedInit = { ...init };
200
+ if (preparedInit.body !== undefined && typeof preparedInit.body !== 'string') {
201
+ preparedInit.body = JSON.stringify(preparedInit.body);
202
+ preparedInit.headers = {
203
+ 'Content-Type': 'application/json',
204
+ ...preparedInit.headers,
205
+ };
206
+ }
207
+ const redact = (s) => {
208
+ let out = s;
209
+ for (const val of Object.values(creds)) {
210
+ if (typeof val === 'string' && val.length)
211
+ out = out.split(val).join('***');
212
+ }
213
+ return out;
214
+ };
215
+ const response = await fetch(finalUrl, {
216
+ ...preparedInit,
217
+ method: preparedInit.method || 'GET',
218
+ headers: {
219
+ ...preparedInit.headers,
220
+ ...resolvedHeaders,
221
+ },
222
+ });
223
+ if (!response.ok) {
224
+ const contentType = response.headers.get('content-type') || '';
225
+ let bodyText = '';
226
+ try {
227
+ bodyText = contentType.includes('json') ? JSON.stringify(await response.json()) : await response.text();
228
+ }
229
+ catch { }
230
+ throw new HttpError(response.status, `Failed to proxy request to ${provider}.`, {
231
+ status: response.status,
232
+ url: redact(finalUrl),
233
+ contentType,
234
+ body: bodyText?.slice(0, 4000),
235
+ });
236
+ }
237
+ return response;
238
+ }
239
+ // Managed OAuth branch: used by hosted deployments / CI.
240
+ if (!connectionId)
241
+ throw new HttpError(400, 'connectionId is required for non-http providers.');
242
+ if (!this.opts.managedOAuthBaseUrl || !this.opts.managedOAuthSecretKey)
243
+ throw new HttpError(501, 'Managed OAuth is not configured for this server.');
244
+ let managedConnection;
245
+ try {
246
+ const managedUrl = `${this.opts.managedOAuthBaseUrl}/connection/${encodeURIComponent(connectionId)}?provider_config_key=${encodeURIComponent(provider)}`;
247
+ const resp = await fetch(managedUrl, {
248
+ headers: { Authorization: `Bearer ${this.opts.managedOAuthSecretKey}` },
249
+ });
250
+ if (!resp.ok)
251
+ throw new Error(`Managed OAuth connection lookup failed (${resp.status})`);
252
+ managedConnection = await resp.json();
253
+ }
254
+ catch (error) {
255
+ console.error('Failed to fetch connection details from managed OAuth gateway:', error);
256
+ throw new HttpError(502, 'Failed to retrieve connection details from managed OAuth gateway.');
257
+ }
258
+ const providerId = provider;
259
+ const providerCfg = PROVIDERS[providerId];
260
+ const creds = managedConnection.credentials || {};
261
+ const userAccessToken = creds.access_token || creds.oauth_token || creds.token;
262
+ if (!providerCfg)
263
+ throw new HttpError(501, `Provider '${providerId}' is not configured in the server proxy.`);
264
+ const baseUrl = typeof providerCfg.baseUrl === 'function' ? providerCfg.baseUrl( /* todo */) : providerCfg.baseUrl;
265
+ const finalUrl = joinWithoutDuplicateSegments(baseUrl, path);
266
+ try {
267
+ const preparedInit = { ...init };
268
+ if (preparedInit.body !== undefined && typeof preparedInit.body !== 'string') {
269
+ preparedInit.body = JSON.stringify(preparedInit.body);
270
+ preparedInit.headers = {
271
+ 'Content-Type': 'application/json',
272
+ ...preparedInit.headers,
273
+ };
274
+ }
275
+ if (providerId === 'trello') {
276
+ if (!this.opts.trelloApiKey)
277
+ throw new HttpError(500, 'Trello API key is not configured.');
278
+ const queryParams = new URLSearchParams({
279
+ ...providerCfg.makeAuth(userAccessToken, this.opts.trelloApiKey),
280
+ }).toString();
281
+ const urlWithAuth = finalUrl + (finalUrl.includes('?') ? '&' : '?') + queryParams;
282
+ const response = await fetch(urlWithAuth, { ...preparedInit, method: preparedInit.method || 'GET' });
283
+ if (!response.ok) {
284
+ const contentType = response.headers.get('content-type') || '';
285
+ let bodyText = '';
286
+ try {
287
+ bodyText = contentType.includes('json') ? JSON.stringify(await response.json()) : await response.text();
288
+ }
289
+ catch { }
290
+ throw new HttpError(response.status, `Failed to proxy request to ${providerId}.`, {
291
+ status: response.status,
292
+ url: urlWithAuth,
293
+ contentType,
294
+ body: bodyText?.slice(0, 4000),
295
+ });
296
+ }
297
+ return response;
298
+ }
299
+ const response = await fetch(finalUrl, {
300
+ ...preparedInit,
301
+ method: preparedInit.method || 'GET',
302
+ headers: {
303
+ ...preparedInit.headers,
304
+ ...providerCfg.makeAuth(userAccessToken),
305
+ },
306
+ });
307
+ if (!response.ok) {
308
+ const contentType = response.headers.get('content-type') || '';
309
+ let bodyText = '';
310
+ try {
311
+ bodyText = contentType.includes('json') ? JSON.stringify(await response.json()) : await response.text();
312
+ }
313
+ catch { }
314
+ throw new HttpError(response.status, `Failed to proxy request to ${providerId}.`, {
315
+ status: response.status,
316
+ url: finalUrl,
317
+ contentType,
318
+ body: bodyText?.slice(0, 4000),
319
+ });
320
+ }
321
+ return response;
322
+ }
323
+ catch (error) {
324
+ console.error(`Error proxying request to ${providerId}:`, error);
325
+ if (error && typeof error === 'object' && 'statusCode' in error)
326
+ throw error;
327
+ throw new HttpError(500, `Failed to proxy request to ${providerId}.`, error?.message);
328
+ }
329
+ }
330
+ }
331
+ //# sourceMappingURL=proxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/integrations/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAehE,MAAM,OAAO,gBAAgB;IACE;IAA7B,YAA6B,OAAgC,EAAE;QAAlC,SAAI,GAAJ,IAAI,CAA8B;IAAG,C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C,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;gBACzG,CAAC;gBACD,MAAM,CAAC,CAAA,CAAC;gBACR,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,8BAA8B,UAAU,GAAG,EAAE;oBAChF,MAAM,EAAE,QAAQ,CAAC,MAAM;oBACvB,GAAG,EAAE,QAAQ;oBACb,WAAW;oBACX,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC;iBAC/B,CAAC,CAAA;YACJ,CAAC;YACD,OAAO,QAAQ,CAAA;QACjB,CAAC;QACD,OAAO,KAAU,EAAE,CAAC;YAClB,OAAO,CAAC,KAAK,CAAC,6BAA6B,UAAU,GAAG,EAAE,KAAK,CAAC,CAAA;YAChE,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,YAAY,IAAI,KAAK;gBAC7D,MAAM,KAAK,CAAA;YACb,MAAM,IAAI,SAAS,CAAC,GAAG,EAAE,8BAA8B,UAAU,GAAG,EAAG,KAAa,EAAE,OAAO,CAAC,CAAA;QAChG,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ export declare function loadWorkflowModule(source: string, getIntegration?: Function): Promise<any>;
2
+ export declare function createSafeHandlerFromString(handlerString: string, getIntegration: Function): (args: any) => Promise<{
3
+ success: boolean;
4
+ result: any;
5
+ logs: string[];
6
+ }>;
7
+ //# sourceMappingURL=sandbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/integrations/sandbox.ts"],"names":[],"mappings":"AAiBA,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAkFhG;AAED,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,QAAQ,GACvB,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAyE3E"}