@rudderhq/server 0.2.5-canary.9 → 0.2.5

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 (309) hide show
  1. package/dist/bootstrap/plugin-host-runtime.d.ts +39 -39
  2. package/dist/bundled-plugins/plugin-linear/dist/worker.js +101 -147
  3. package/dist/bundled-plugins/plugin-linear/dist/worker.js.map +2 -2
  4. package/dist/bundled-plugins/plugin-linear/package.json +1 -1
  5. package/dist/routes/access-onboarding.helpers.d.ts +142 -0
  6. package/dist/routes/access-onboarding.helpers.d.ts.map +1 -0
  7. package/dist/routes/access-onboarding.helpers.js +762 -0
  8. package/dist/routes/access-onboarding.helpers.js.map +1 -0
  9. package/dist/routes/access.d.ts +2 -48
  10. package/dist/routes/access.d.ts.map +1 -1
  11. package/dist/routes/access.helpers.d.ts +109 -0
  12. package/dist/routes/access.helpers.d.ts.map +1 -0
  13. package/dist/routes/access.helpers.js +460 -0
  14. package/dist/routes/access.helpers.js.map +1 -0
  15. package/dist/routes/access.js +6 -1218
  16. package/dist/routes/access.js.map +1 -1
  17. package/dist/routes/agents.d.ts.map +1 -1
  18. package/dist/routes/agents.js +55 -1057
  19. package/dist/routes/agents.js.map +1 -1
  20. package/dist/routes/agents.management-routes.d.ts +12 -0
  21. package/dist/routes/agents.management-routes.d.ts.map +1 -0
  22. package/dist/routes/agents.management-routes.js +1067 -0
  23. package/dist/routes/agents.management-routes.js.map +1 -0
  24. package/dist/routes/chats.d.ts.map +1 -1
  25. package/dist/routes/chats.js +42 -652
  26. package/dist/routes/chats.js.map +1 -1
  27. package/dist/routes/chats.stream-routes.d.ts +12 -0
  28. package/dist/routes/chats.stream-routes.d.ts.map +1 -0
  29. package/dist/routes/chats.stream-routes.js +666 -0
  30. package/dist/routes/chats.stream-routes.js.map +1 -0
  31. package/dist/routes/issues.comments-attachments.d.ts +12 -0
  32. package/dist/routes/issues.comments-attachments.d.ts.map +1 -0
  33. package/dist/routes/issues.comments-attachments.js +511 -0
  34. package/dist/routes/issues.comments-attachments.js.map +1 -0
  35. package/dist/routes/issues.d.ts.map +1 -1
  36. package/dist/routes/issues.js +43 -1128
  37. package/dist/routes/issues.js.map +1 -1
  38. package/dist/routes/issues.mutations.d.ts +12 -0
  39. package/dist/routes/issues.mutations.d.ts.map +1 -0
  40. package/dist/routes/issues.mutations.js +635 -0
  41. package/dist/routes/issues.mutations.js.map +1 -0
  42. package/dist/routes/plugins.d.ts.map +1 -1
  43. package/dist/routes/plugins.js +14 -694
  44. package/dist/routes/plugins.js.map +1 -1
  45. package/dist/routes/plugins.operations-routes.d.ts +28 -0
  46. package/dist/routes/plugins.operations-routes.d.ts.map +1 -0
  47. package/dist/routes/plugins.operations-routes.js +720 -0
  48. package/dist/routes/plugins.operations-routes.js.map +1 -0
  49. package/dist/services/access.d.ts +21 -21
  50. package/dist/services/activity.d.ts +19 -19
  51. package/dist/services/agents.d.ts +158 -158
  52. package/dist/services/approvals.d.ts +29 -29
  53. package/dist/services/assets.d.ts +8 -8
  54. package/dist/services/automations.d.ts +41 -27
  55. package/dist/services/automations.d.ts.map +1 -1
  56. package/dist/services/automations.js +287 -110
  57. package/dist/services/automations.js.map +1 -1
  58. package/dist/services/automations.scheduler.d.ts +9 -0
  59. package/dist/services/automations.scheduler.d.ts.map +1 -0
  60. package/dist/services/automations.scheduler.js +101 -0
  61. package/dist/services/automations.scheduler.js.map +1 -0
  62. package/dist/services/board-auth.d.ts +32 -32
  63. package/dist/services/calendar.d.ts +26 -26
  64. package/dist/services/chat-assistant.d.ts +3 -47
  65. package/dist/services/chat-assistant.d.ts.map +1 -1
  66. package/dist/services/chat-assistant.helpers.d.ts +156 -0
  67. package/dist/services/chat-assistant.helpers.d.ts.map +1 -0
  68. package/dist/services/chat-assistant.helpers.js +862 -0
  69. package/dist/services/chat-assistant.helpers.js.map +1 -0
  70. package/dist/services/chat-assistant.js +2 -861
  71. package/dist/services/chat-assistant.js.map +1 -1
  72. package/dist/services/chats.d.ts +149 -247
  73. package/dist/services/chats.d.ts.map +1 -1
  74. package/dist/services/chats.helpers.d.ts +117 -0
  75. package/dist/services/chats.helpers.d.ts.map +1 -0
  76. package/dist/services/chats.helpers.js +285 -0
  77. package/dist/services/chats.helpers.js.map +1 -0
  78. package/dist/services/chats.js +6 -286
  79. package/dist/services/chats.js.map +1 -1
  80. package/dist/services/costs.d.ts +8 -8
  81. package/dist/services/finance.d.ts +18 -18
  82. package/dist/services/goals.d.ts +30 -30
  83. package/dist/services/heartbeat.d.ts +3 -1
  84. package/dist/services/heartbeat.d.ts.map +1 -1
  85. package/dist/services/heartbeat.js +3 -1
  86. package/dist/services/heartbeat.js.map +1 -1
  87. package/dist/services/issue-approvals.d.ts +4 -4
  88. package/dist/services/issue-review-wakeup.d.ts +3 -3
  89. package/dist/services/issues.comments-attachments.d.ts +141 -0
  90. package/dist/services/issues.comments-attachments.d.ts.map +1 -0
  91. package/dist/services/issues.comments-attachments.js +313 -0
  92. package/dist/services/issues.comments-attachments.js.map +1 -0
  93. package/dist/services/issues.d.ts +205 -256
  94. package/dist/services/issues.d.ts.map +1 -1
  95. package/dist/services/issues.helpers.d.ts +87 -0
  96. package/dist/services/issues.helpers.d.ts.map +1 -0
  97. package/dist/services/issues.helpers.js +270 -0
  98. package/dist/services/issues.helpers.js.map +1 -0
  99. package/dist/services/issues.js +5 -569
  100. package/dist/services/issues.js.map +1 -1
  101. package/dist/services/knowledge-portability/organization-portability.core.d.ts +210 -0
  102. package/dist/services/knowledge-portability/organization-portability.core.d.ts.map +1 -0
  103. package/dist/services/knowledge-portability/organization-portability.core.js +997 -0
  104. package/dist/services/knowledge-portability/organization-portability.core.js.map +1 -0
  105. package/dist/services/knowledge-portability/organization-portability.d.ts +6 -28
  106. package/dist/services/knowledge-portability/organization-portability.d.ts.map +1 -1
  107. package/dist/services/knowledge-portability/organization-portability.export.d.ts +24 -0
  108. package/dist/services/knowledge-portability/organization-portability.export.d.ts.map +1 -0
  109. package/dist/services/knowledge-portability/organization-portability.export.js +607 -0
  110. package/dist/services/knowledge-portability/organization-portability.export.js.map +1 -0
  111. package/dist/services/knowledge-portability/organization-portability.files.d.ts +69 -0
  112. package/dist/services/knowledge-portability/organization-portability.files.d.ts.map +1 -0
  113. package/dist/services/knowledge-portability/organization-portability.files.js +597 -0
  114. package/dist/services/knowledge-portability/organization-portability.files.js.map +1 -0
  115. package/dist/services/knowledge-portability/organization-portability.import.d.ts +31 -0
  116. package/dist/services/knowledge-portability/organization-portability.import.d.ts.map +1 -0
  117. package/dist/services/knowledge-portability/organization-portability.import.js +575 -0
  118. package/dist/services/knowledge-portability/organization-portability.import.js.map +1 -0
  119. package/dist/services/knowledge-portability/organization-portability.js +37 -3848
  120. package/dist/services/knowledge-portability/organization-portability.js.map +1 -1
  121. package/dist/services/knowledge-portability/organization-portability.package.d.ts +72 -0
  122. package/dist/services/knowledge-portability/organization-portability.package.d.ts.map +1 -0
  123. package/dist/services/knowledge-portability/organization-portability.package.js +749 -0
  124. package/dist/services/knowledge-portability/organization-portability.package.js.map +1 -0
  125. package/dist/services/knowledge-portability/organization-portability.preview.d.ts +18 -0
  126. package/dist/services/knowledge-portability/organization-portability.preview.d.ts.map +1 -0
  127. package/dist/services/knowledge-portability/organization-portability.preview.js +333 -0
  128. package/dist/services/knowledge-portability/organization-portability.preview.js.map +1 -0
  129. package/dist/services/knowledge-portability/organization-portability.resolve-source.d.ts +4 -0
  130. package/dist/services/knowledge-portability/organization-portability.resolve-source.d.ts.map +1 -0
  131. package/dist/services/knowledge-portability/organization-portability.resolve-source.js +86 -0
  132. package/dist/services/knowledge-portability/organization-portability.resolve-source.js.map +1 -0
  133. package/dist/services/knowledge-portability/organization-skills.catalog.d.ts +221 -0
  134. package/dist/services/knowledge-portability/organization-skills.catalog.d.ts.map +1 -0
  135. package/dist/services/knowledge-portability/organization-skills.catalog.js +999 -0
  136. package/dist/services/knowledge-portability/organization-skills.catalog.js.map +1 -0
  137. package/dist/services/knowledge-portability/organization-skills.d.ts +4 -75
  138. package/dist/services/knowledge-portability/organization-skills.d.ts.map +1 -1
  139. package/dist/services/knowledge-portability/organization-skills.js +11 -2008
  140. package/dist/services/knowledge-portability/organization-skills.js.map +1 -1
  141. package/dist/services/knowledge-portability/organization-skills.scans.d.ts +16 -0
  142. package/dist/services/knowledge-portability/organization-skills.scans.d.ts.map +1 -0
  143. package/dist/services/knowledge-portability/organization-skills.scans.js +300 -0
  144. package/dist/services/knowledge-portability/organization-skills.scans.js.map +1 -0
  145. package/dist/services/knowledge-portability/organization-skills.sources.d.ts +68 -0
  146. package/dist/services/knowledge-portability/organization-skills.sources.d.ts.map +1 -0
  147. package/dist/services/knowledge-portability/organization-skills.sources.js +728 -0
  148. package/dist/services/knowledge-portability/organization-skills.sources.js.map +1 -0
  149. package/dist/services/messenger.d.ts +2 -2
  150. package/dist/services/messenger.js +2 -2
  151. package/dist/services/messenger.js.map +1 -1
  152. package/dist/services/organization-skills.d.ts +3 -1
  153. package/dist/services/organization-skills.d.ts.map +1 -1
  154. package/dist/services/organization-skills.js +3 -1
  155. package/dist/services/organization-skills.js.map +1 -1
  156. package/dist/services/orgs.d.ts +9 -9
  157. package/dist/services/plugin-loader.core.d.ts +14 -0
  158. package/dist/services/plugin-loader.core.d.ts.map +1 -0
  159. package/dist/services/plugin-loader.core.js +905 -0
  160. package/dist/services/plugin-loader.core.js.map +1 -0
  161. package/dist/services/plugin-loader.d.ts +3 -440
  162. package/dist/services/plugin-loader.d.ts.map +1 -1
  163. package/dist/services/plugin-loader.helpers.d.ts +468 -0
  164. package/dist/services/plugin-loader.helpers.d.ts.map +1 -0
  165. package/dist/services/plugin-loader.helpers.js +263 -0
  166. package/dist/services/plugin-loader.helpers.js.map +1 -0
  167. package/dist/services/plugin-loader.js +3 -1191
  168. package/dist/services/plugin-loader.js.map +1 -1
  169. package/dist/services/plugin-loader.worker-paths.d.ts +7 -0
  170. package/dist/services/plugin-loader.worker-paths.d.ts.map +1 -0
  171. package/dist/services/plugin-loader.worker-paths.js +85 -0
  172. package/dist/services/plugin-loader.worker-paths.js.map +1 -0
  173. package/dist/services/plugin-registry.d.ts +123 -123
  174. package/dist/services/projects.d.ts +8 -8
  175. package/dist/services/runtime-kernel/heartbeat.core.d.ts +725 -0
  176. package/dist/services/runtime-kernel/heartbeat.core.d.ts.map +1 -0
  177. package/dist/services/runtime-kernel/heartbeat.core.js +525 -0
  178. package/dist/services/runtime-kernel/heartbeat.core.js.map +1 -0
  179. package/dist/services/runtime-kernel/heartbeat.d.ts +38 -259
  180. package/dist/services/runtime-kernel/heartbeat.d.ts.map +1 -1
  181. package/dist/services/runtime-kernel/heartbeat.execute.d.ts +5 -0
  182. package/dist/services/runtime-kernel/heartbeat.execute.d.ts.map +1 -0
  183. package/dist/services/runtime-kernel/heartbeat.execute.js +1052 -0
  184. package/dist/services/runtime-kernel/heartbeat.execute.js.map +1 -0
  185. package/dist/services/runtime-kernel/heartbeat.js +50 -4142
  186. package/dist/services/runtime-kernel/heartbeat.js.map +1 -1
  187. package/dist/services/runtime-kernel/heartbeat.misc.d.ts +30 -0
  188. package/dist/services/runtime-kernel/heartbeat.misc.d.ts.map +1 -0
  189. package/dist/services/runtime-kernel/heartbeat.misc.js +483 -0
  190. package/dist/services/runtime-kernel/heartbeat.misc.js.map +1 -0
  191. package/dist/services/runtime-kernel/heartbeat.recovery.d.ts +38 -0
  192. package/dist/services/runtime-kernel/heartbeat.recovery.d.ts.map +1 -0
  193. package/dist/services/runtime-kernel/heartbeat.recovery.js +605 -0
  194. package/dist/services/runtime-kernel/heartbeat.recovery.js.map +1 -0
  195. package/dist/services/runtime-kernel/heartbeat.release.d.ts +6 -0
  196. package/dist/services/runtime-kernel/heartbeat.release.d.ts.map +1 -0
  197. package/dist/services/runtime-kernel/heartbeat.release.js +398 -0
  198. package/dist/services/runtime-kernel/heartbeat.release.js.map +1 -0
  199. package/dist/services/runtime-kernel/heartbeat.sessions.d.ts +229 -0
  200. package/dist/services/runtime-kernel/heartbeat.sessions.d.ts.map +1 -0
  201. package/dist/services/runtime-kernel/heartbeat.sessions.js +708 -0
  202. package/dist/services/runtime-kernel/heartbeat.sessions.js.map +1 -0
  203. package/dist/services/runtime-kernel/heartbeat.wakeup.d.ts +5 -0
  204. package/dist/services/runtime-kernel/heartbeat.wakeup.d.ts.map +1 -0
  205. package/dist/services/runtime-kernel/heartbeat.wakeup.js +552 -0
  206. package/dist/services/runtime-kernel/heartbeat.wakeup.js.map +1 -0
  207. package/dist/services/secrets.d.ts +25 -25
  208. package/dist/services/sidebar-badges.js +1 -1
  209. package/dist/services/sidebar-badges.js.map +1 -1
  210. package/dist/services/workspace-runtime.comments.d.ts +6 -0
  211. package/dist/services/workspace-runtime.comments.d.ts.map +1 -0
  212. package/dist/services/workspace-runtime.comments.js +17 -0
  213. package/dist/services/workspace-runtime.comments.js.map +1 -0
  214. package/dist/services/workspace-runtime.d.ts +4 -163
  215. package/dist/services/workspace-runtime.d.ts.map +1 -1
  216. package/dist/services/workspace-runtime.helpers.d.ts +163 -0
  217. package/dist/services/workspace-runtime.helpers.d.ts.map +1 -0
  218. package/dist/services/workspace-runtime.helpers.js +360 -0
  219. package/dist/services/workspace-runtime.helpers.js.map +1 -0
  220. package/dist/services/workspace-runtime.js +4 -1236
  221. package/dist/services/workspace-runtime.js.map +1 -1
  222. package/dist/services/workspace-runtime.lifecycle.d.ts +35 -0
  223. package/dist/services/workspace-runtime.lifecycle.d.ts.map +1 -0
  224. package/dist/services/workspace-runtime.lifecycle.js +266 -0
  225. package/dist/services/workspace-runtime.lifecycle.js.map +1 -0
  226. package/dist/services/workspace-runtime.services.d.ts +140 -0
  227. package/dist/services/workspace-runtime.services.d.ts.map +1 -0
  228. package/dist/services/workspace-runtime.services.js +606 -0
  229. package/dist/services/workspace-runtime.services.js.map +1 -0
  230. package/package.json +21 -15
  231. package/ui-dist/assets/{_basePickBy-B5mJzzqZ.js → _basePickBy-N8I9ml5Y.js} +1 -1
  232. package/ui-dist/assets/{_baseUniq-B10Ec09o.js → _baseUniq-BuSlpRSQ.js} +1 -1
  233. package/ui-dist/assets/{arc-Bw7wimOa.js → arc-qX-dPyA1.js} +1 -1
  234. package/ui-dist/assets/{architectureDiagram-2XIMDMQ5-DZr0XEvv.js → architectureDiagram-2XIMDMQ5-DhjkbXsp.js} +1 -1
  235. package/ui-dist/assets/{blockDiagram-WCTKOSBZ-D0jl0LgB.js → blockDiagram-WCTKOSBZ-JS-tTu3J.js} +1 -1
  236. package/ui-dist/assets/{c4Diagram-IC4MRINW-BEFxBnEm.js → c4Diagram-IC4MRINW-4DqwCWIx.js} +1 -1
  237. package/ui-dist/assets/channel-CccCW5_a.js +1 -0
  238. package/ui-dist/assets/{chunk-4BX2VUAB-Cbul1GoA.js → chunk-4BX2VUAB-T37SqBpp.js} +1 -1
  239. package/ui-dist/assets/{chunk-55IACEB6-DuouC3bT.js → chunk-55IACEB6-BSj9hdqK.js} +1 -1
  240. package/ui-dist/assets/{chunk-FMBD7UC4-bN1jF9xw.js → chunk-FMBD7UC4-Dkrlh0Wk.js} +1 -1
  241. package/ui-dist/assets/{chunk-JSJVCQXG-B0-Ij6ZF.js → chunk-JSJVCQXG-C0ZE3QdB.js} +1 -1
  242. package/ui-dist/assets/{chunk-KX2RTZJC-BjI3IEjI.js → chunk-KX2RTZJC-DOZQM9gW.js} +1 -1
  243. package/ui-dist/assets/{chunk-NQ4KR5QH-MUoGr46n.js → chunk-NQ4KR5QH-5Yr3U2k8.js} +1 -1
  244. package/ui-dist/assets/{chunk-QZHKN3VN-CQoI9Ouy.js → chunk-QZHKN3VN-CvKTufwF.js} +1 -1
  245. package/ui-dist/assets/{chunk-WL4C6EOR-DSJh3iDp.js → chunk-WL4C6EOR-IoEM0jyx.js} +1 -1
  246. package/ui-dist/assets/classDiagram-VBA2DB6C-JKk4tCW2.js +1 -0
  247. package/ui-dist/assets/classDiagram-v2-RAHNMMFH-JKk4tCW2.js +1 -0
  248. package/ui-dist/assets/clone-Onaweg8D.js +1 -0
  249. package/ui-dist/assets/{cose-bilkent-S5V4N54A-BPepglgB.js → cose-bilkent-S5V4N54A-CTvr1OFj.js} +1 -1
  250. package/ui-dist/assets/{dagre-KLK3FWXG-DhnHVZkt.js → dagre-KLK3FWXG-UZ-SNjVK.js} +1 -1
  251. package/ui-dist/assets/{diagram-E7M64L7V-DNvXtoOO.js → diagram-E7M64L7V-D7RAN0Hr.js} +1 -1
  252. package/ui-dist/assets/{diagram-IFDJBPK2-DhGlDTgn.js → diagram-IFDJBPK2-B4LViaFR.js} +1 -1
  253. package/ui-dist/assets/{diagram-P4PSJMXO-BmXEloWS.js → diagram-P4PSJMXO-CY1be7ak.js} +1 -1
  254. package/ui-dist/assets/{erDiagram-INFDFZHY-BTYVzaLM.js → erDiagram-INFDFZHY-Dca0KkvJ.js} +1 -1
  255. package/ui-dist/assets/{flowDiagram-PKNHOUZH-CqMNQUVv.js → flowDiagram-PKNHOUZH-i-qMvfwg.js} +1 -1
  256. package/ui-dist/assets/{ganttDiagram-A5KZAMGK-B2le_64a.js → ganttDiagram-A5KZAMGK-Wxq2lhbh.js} +1 -1
  257. package/ui-dist/assets/{gitGraphDiagram-K3NZZRJ6-BtxOBq5A.js → gitGraphDiagram-K3NZZRJ6-DwzgPlAY.js} +1 -1
  258. package/ui-dist/assets/{graph-C5E6qFfm.js → graph-BAqf89Tz.js} +1 -1
  259. package/ui-dist/assets/{index-Piq-IPXt.js → index-4eCzaLuY.js} +1 -1
  260. package/ui-dist/assets/{index-DT6UN2ec.js → index-8uu-nKqK.js} +1 -1
  261. package/ui-dist/assets/{index-T5NVZ3nR.js → index-B-1NEcI_.js} +1 -1
  262. package/ui-dist/assets/{index-D-MoarxG.js → index-B0b_3Eu5.js} +1 -1
  263. package/ui-dist/assets/{index-CZiP3FBQ.js → index-B8v0eZjP.js} +1 -1
  264. package/ui-dist/assets/{index-C1Ga66FM.js → index-BN7Moj3u.js} +1 -1
  265. package/ui-dist/assets/{index-xBUfBdQn.js → index-BSpxh3cY.js} +1 -1
  266. package/ui-dist/assets/{index-CQcMWp51.js → index-BY44RIi9.js} +1 -1
  267. package/ui-dist/assets/{index-3a93sZNI.js → index-BhyQJhdZ.js} +1 -1
  268. package/ui-dist/assets/{index-BsVDit5y.js → index-BkPL_iGU.js} +1 -1
  269. package/ui-dist/assets/{index-88lBSTsW.js → index-BsPfoHXS.js} +1 -1
  270. package/ui-dist/assets/{index-CyJtcUF0.js → index-BstW7nmv.js} +1 -1
  271. package/ui-dist/assets/{index-BvZ0Ptfl.js → index-BwB67Zyz.js} +1 -1
  272. package/ui-dist/assets/index-C2peSkmT.css +1 -0
  273. package/ui-dist/assets/{index-vkCrQLeX.js → index-C3ktOsS_.js} +1 -1
  274. package/ui-dist/assets/{index-D2hZpQJT.js → index-CMyABlS-.js} +1 -1
  275. package/ui-dist/assets/{index-C4WCPEY4.js → index-CyBJ8ujC.js} +1 -1
  276. package/ui-dist/assets/{index-Bf7NB_lK.js → index-DAxM2W3O.js} +1 -1
  277. package/ui-dist/assets/{index-Dq7H6-Lm.js → index-DVZXPmhk.js} +1 -1
  278. package/ui-dist/assets/{index-CskDu6A3.js → index-Dc19uAyw.js} +1 -1
  279. package/ui-dist/assets/index-DzHrwZu1.js +1511 -0
  280. package/ui-dist/assets/{index-B20JneLK.js → index-LJuf53Ye.js} +1 -1
  281. package/ui-dist/assets/{index-D6McTDMQ.js → index-Ugw5VWWz.js} +1 -1
  282. package/ui-dist/assets/{index-CcVGS6HJ.js → index-YGraEFR7.js} +1 -1
  283. package/ui-dist/assets/{infoDiagram-LFFYTUFH-BiCCZcIW.js → infoDiagram-LFFYTUFH-jLmDtFVR.js} +1 -1
  284. package/ui-dist/assets/{ishikawaDiagram-PHBUUO56-BiwBemM5.js → ishikawaDiagram-PHBUUO56-6OGMyLT8.js} +1 -1
  285. package/ui-dist/assets/{journeyDiagram-4ABVD52K-D8RGr2xl.js → journeyDiagram-4ABVD52K-yQjl6E0t.js} +1 -1
  286. package/ui-dist/assets/{kanban-definition-K7BYSVSG-C733Fj-E.js → kanban-definition-K7BYSVSG-DkdCeQlS.js} +1 -1
  287. package/ui-dist/assets/{layout-CM4c3NA_.js → layout-CqSYvZ_w.js} +1 -1
  288. package/ui-dist/assets/{linear-DzH21Xsf.js → linear-B8xGZaoi.js} +1 -1
  289. package/ui-dist/assets/{mermaid.core-Z2rpoVP2.js → mermaid.core-AKL_cdyk.js} +4 -4
  290. package/ui-dist/assets/{mindmap-definition-YRQLILUH-DylLLj9w.js → mindmap-definition-YRQLILUH-Zr-dXC0x.js} +1 -1
  291. package/ui-dist/assets/{pieDiagram-SKSYHLDU-617wI_rr.js → pieDiagram-SKSYHLDU-BvDAU-Nk.js} +1 -1
  292. package/ui-dist/assets/{quadrantDiagram-337W2JSQ-lxoCPJIL.js → quadrantDiagram-337W2JSQ-Dn9kM62o.js} +1 -1
  293. package/ui-dist/assets/{requirementDiagram-Z7DCOOCP-C5XydQ9-.js → requirementDiagram-Z7DCOOCP-GIsIh7Sd.js} +1 -1
  294. package/ui-dist/assets/{sankeyDiagram-WA2Y5GQK--grmq-Q8.js → sankeyDiagram-WA2Y5GQK-CUCuBkuf.js} +1 -1
  295. package/ui-dist/assets/{sequenceDiagram-2WXFIKYE-BS2PeYH-.js → sequenceDiagram-2WXFIKYE-MDpUY2HM.js} +1 -1
  296. package/ui-dist/assets/{stateDiagram-RAJIS63D-CeuZtj2z.js → stateDiagram-RAJIS63D-BymMpuUU.js} +1 -1
  297. package/ui-dist/assets/stateDiagram-v2-FVOUBMTO-Bi2oCU6d.js +1 -0
  298. package/ui-dist/assets/{timeline-definition-YZTLITO2-DxHdMpRr.js → timeline-definition-YZTLITO2-B6ofPhhy.js} +1 -1
  299. package/ui-dist/assets/{treemap-KZPCXAKY-Bv1ZlC5h.js → treemap-KZPCXAKY-DnLO6w1l.js} +1 -1
  300. package/ui-dist/assets/{vennDiagram-LZ73GAT5-DvpZSXY2.js → vennDiagram-LZ73GAT5-D0MyZIDl.js} +1 -1
  301. package/ui-dist/assets/{xychartDiagram-JWTSCODW-DttOu1GC.js → xychartDiagram-JWTSCODW-rADY1iUG.js} +1 -1
  302. package/ui-dist/index.html +2 -2
  303. package/ui-dist/assets/channel-DGUh6rEi.js +0 -1
  304. package/ui-dist/assets/classDiagram-VBA2DB6C-1ntk2IOV.js +0 -1
  305. package/ui-dist/assets/classDiagram-v2-RAHNMMFH-1ntk2IOV.js +0 -1
  306. package/ui-dist/assets/clone-BpddY88c.js +0 -1
  307. package/ui-dist/assets/index-C8AD6s7S.js +0 -1510
  308. package/ui-dist/assets/index-Ded0dPwB.css +0 -1
  309. package/ui-dist/assets/stateDiagram-v2-FVOUBMTO-DXq0yC5C.js +0 -1
@@ -18,11 +18,9 @@
18
18
  */
19
19
  import { existsSync } from "node:fs";
20
20
  import path from "node:path";
21
- import { randomUUID } from "node:crypto";
22
21
  import { fileURLToPath } from "node:url";
23
22
  import { Router } from "express";
24
- import { and, desc, eq, gte } from "drizzle-orm";
25
- import { organizations, pluginLogs, pluginWebhookDeliveries } from "@rudderhq/db";
23
+ import { organizations } from "@rudderhq/db";
26
24
  import { PLUGIN_STATUSES, } from "@rudderhq/shared";
27
25
  import { pluginRegistryService } from "../services/plugin-registry.js";
28
26
  import { pluginLifecycleManager } from "../services/plugin-lifecycle.js";
@@ -31,7 +29,7 @@ import { logActivity } from "../services/activity-log.js";
31
29
  import { publishGlobalLiveEvent } from "../services/live-events.js";
32
30
  import { JsonRpcCallError, PLUGIN_RPC_ERROR_CODES } from "@rudderhq/plugin-sdk";
33
31
  import { assertBoard, assertCompanyAccess, getActorInfo } from "./authz.js";
34
- import { validateInstanceConfig } from "../services/plugin-config-validator.js";
32
+ import { registerPluginOperationsRoutes } from "./plugins.operations-routes.js";
35
33
  /** UUID v4 regex used for plugin ID route resolution. */
36
34
  const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
37
35
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -1111,696 +1109,18 @@ export function pluginRoutes(db, loader, jobDeps, webhookDeps, toolDeps, bridgeD
1111
1109
  *
1112
1110
  * Response: Array of log entries, newest first.
1113
1111
  */
1114
- router.get("/plugins/:pluginId/logs", async (req, res) => {
1115
- assertBoard(req);
1116
- const { pluginId } = req.params;
1117
- const plugin = await resolvePlugin(registry, pluginId);
1118
- if (!plugin) {
1119
- res.status(404).json({ error: "Plugin not found" });
1120
- return;
1121
- }
1122
- const limit = Math.min(Math.max(parseInt(req.query.limit, 10) || 25, 1), 500);
1123
- const level = req.query.level;
1124
- const since = req.query.since;
1125
- const conditions = [eq(pluginLogs.pluginId, plugin.id)];
1126
- if (level) {
1127
- conditions.push(eq(pluginLogs.level, level));
1128
- }
1129
- if (since) {
1130
- const sinceDate = new Date(since);
1131
- if (!isNaN(sinceDate.getTime())) {
1132
- conditions.push(gte(pluginLogs.createdAt, sinceDate));
1133
- }
1134
- }
1135
- const rows = await db
1136
- .select()
1137
- .from(pluginLogs)
1138
- .where(and(...conditions))
1139
- .orderBy(desc(pluginLogs.createdAt))
1140
- .limit(limit);
1141
- res.json(rows);
1142
- });
1143
- /**
1144
- * POST /api/plugins/:pluginId/upgrade
1145
- *
1146
- * Upgrade a plugin to a newer version.
1147
- *
1148
- * Request body (optional):
1149
- * - version: Target version (defaults to latest)
1150
- *
1151
- * If the upgrade adds new capabilities, the plugin transitions to
1152
- * 'upgrade_pending' state for board approval. Otherwise, it goes
1153
- * directly to 'ready'.
1154
- *
1155
- * Response: PluginRecord
1156
- * Errors: 404 if plugin not found, 400 for lifecycle errors
1157
- */
1158
- router.post("/plugins/:pluginId/upgrade", async (req, res) => {
1159
- assertBoard(req);
1160
- const { pluginId } = req.params;
1161
- const body = req.body;
1162
- const version = body?.version;
1163
- const plugin = await resolvePlugin(registry, pluginId);
1164
- if (!plugin) {
1165
- res.status(404).json({ error: "Plugin not found" });
1166
- return;
1167
- }
1168
- try {
1169
- // Upgrade the plugin - this would typically:
1170
- // 1. Download the new version
1171
- // 2. Compare capabilities
1172
- // 3. If new capabilities, mark as upgrade_pending
1173
- // 4. Otherwise, transition to ready
1174
- const result = await lifecycle.upgrade(plugin.id, version);
1175
- await logPluginMutationActivity(req, "plugin.upgraded", plugin.id, {
1176
- pluginId: plugin.id,
1177
- pluginKey: plugin.pluginKey,
1178
- previousVersion: plugin.version,
1179
- version: result?.version ?? plugin.version,
1180
- targetVersion: version ?? null,
1181
- });
1182
- publishGlobalLiveEvent({ type: "plugin.ui.updated", payload: { pluginId: plugin.id, action: "upgraded" } });
1183
- res.json(result);
1184
- }
1185
- catch (err) {
1186
- const message = err instanceof Error ? err.message : String(err);
1187
- res.status(400).json({ error: message });
1188
- }
1189
- });
1190
- // ===========================================================================
1191
- // Plugin configuration routes
1192
- // ===========================================================================
1193
- /**
1194
- * GET /api/plugins/:pluginId/config
1195
- *
1196
- * Retrieve the current instance configuration for a plugin.
1197
- *
1198
- * Returns the `PluginConfig` record if one exists, or `null` if the plugin
1199
- * has not yet been configured.
1200
- *
1201
- * Response: `PluginConfig | null`
1202
- * Errors: 404 if plugin not found
1203
- */
1204
- router.get("/plugins/:pluginId/config", async (req, res) => {
1205
- assertBoard(req);
1206
- const { pluginId } = req.params;
1207
- const plugin = await resolvePlugin(registry, pluginId);
1208
- if (!plugin) {
1209
- res.status(404).json({ error: "Plugin not found" });
1210
- return;
1211
- }
1212
- const config = await registry.getConfig(plugin.id);
1213
- res.json(config);
1214
- });
1215
- /**
1216
- * POST /api/plugins/:pluginId/config
1217
- *
1218
- * Save (create or replace) the instance configuration for a plugin.
1219
- *
1220
- * The caller provides the full `configJson` object. The server persists it
1221
- * via `registry.upsertConfig()`.
1222
- *
1223
- * Request body:
1224
- * - `configJson`: Configuration values matching the plugin's `instanceConfigSchema`
1225
- *
1226
- * Response: `PluginConfig`
1227
- * Errors:
1228
- * - 400 if request validation fails
1229
- * - 404 if plugin not found
1230
- */
1231
- router.post("/plugins/:pluginId/config", async (req, res) => {
1232
- assertBoard(req);
1233
- const { pluginId } = req.params;
1234
- const plugin = await resolvePlugin(registry, pluginId);
1235
- if (!plugin) {
1236
- res.status(404).json({ error: "Plugin not found" });
1237
- return;
1238
- }
1239
- const body = req.body;
1240
- if (!body?.configJson || typeof body.configJson !== "object") {
1241
- res.status(400).json({ error: '"configJson" is required and must be an object' });
1242
- return;
1243
- }
1244
- // Strip devUiUrl unless the caller is an instance admin. devUiUrl activates
1245
- // a dev-proxy in the static file route that could be abused for SSRF if any
1246
- // board-level user were allowed to set it.
1247
- if ("devUiUrl" in body.configJson &&
1248
- !(req.actor.type === "board" && req.actor.isInstanceAdmin)) {
1249
- delete body.configJson.devUiUrl;
1250
- }
1251
- // Validate configJson against the plugin's instanceConfigSchema (if declared).
1252
- // This ensures CLI/API callers get the same validation the UI performs client-side.
1253
- const schema = plugin.manifestJson?.instanceConfigSchema;
1254
- if (schema && Object.keys(schema).length > 0) {
1255
- const validation = validateInstanceConfig(body.configJson, schema);
1256
- if (!validation.valid) {
1257
- res.status(400).json({
1258
- error: "Configuration does not match the plugin's instanceConfigSchema",
1259
- fieldErrors: validation.errors,
1260
- });
1261
- return;
1262
- }
1263
- }
1264
- try {
1265
- const result = await registry.upsertConfig(plugin.id, {
1266
- configJson: body.configJson,
1267
- });
1268
- await logPluginMutationActivity(req, "plugin.config.updated", plugin.id, {
1269
- pluginId: plugin.id,
1270
- pluginKey: plugin.pluginKey,
1271
- configKeyCount: Object.keys(body.configJson).length,
1272
- });
1273
- // Notify the running worker about the config change (PLUGIN_SPEC §25.4.4).
1274
- // If the worker implements onConfigChanged, send the new config via RPC.
1275
- // If it doesn't (METHOD_NOT_IMPLEMENTED), restart the worker so it picks
1276
- // up the new config on re-initialize. If no worker is running, skip.
1277
- if (bridgeDeps?.workerManager.isRunning(plugin.id)) {
1278
- try {
1279
- await bridgeDeps.workerManager.call(plugin.id, "configChanged", { config: body.configJson });
1280
- }
1281
- catch (rpcErr) {
1282
- if (rpcErr instanceof JsonRpcCallError &&
1283
- rpcErr.code === PLUGIN_RPC_ERROR_CODES.METHOD_NOT_IMPLEMENTED) {
1284
- // Worker doesn't handle live config — restart it.
1285
- try {
1286
- await lifecycle.restartWorker(plugin.id);
1287
- }
1288
- catch {
1289
- // Restart failure is non-fatal for the config save response.
1290
- }
1291
- }
1292
- // Other RPC errors (timeout, unavailable) are non-fatal — config is
1293
- // already persisted and will take effect on next worker restart.
1294
- }
1295
- }
1296
- res.json(result);
1297
- }
1298
- catch (err) {
1299
- const message = err instanceof Error ? err.message : String(err);
1300
- res.status(400).json({ error: message });
1301
- }
1302
- });
1303
- /**
1304
- * POST /api/plugins/:pluginId/config/test
1305
- *
1306
- * Test a plugin configuration without persisting it by calling the plugin
1307
- * worker's `validateConfig` RPC method.
1308
- *
1309
- * Only works when the plugin's worker implements `onValidateConfig`.
1310
- * If the worker does not implement the method, returns
1311
- * `{ valid: false, supported: false, message: "..." }` with HTTP 200.
1312
- *
1313
- * Request body:
1314
- * - `configJson`: Configuration values to validate
1315
- *
1316
- * Response: `{ valid: boolean; message?: string; supported?: boolean }`
1317
- * Errors:
1318
- * - 400 if request validation fails
1319
- * - 404 if plugin not found
1320
- * - 501 if bridge deps (worker manager) are not configured
1321
- * - 502 if the worker is unavailable
1322
- */
1323
- router.post("/plugins/:pluginId/config/test", async (req, res) => {
1324
- assertBoard(req);
1325
- if (!bridgeDeps) {
1326
- res.status(501).json({ error: "Plugin bridge is not enabled" });
1327
- return;
1328
- }
1329
- const { pluginId } = req.params;
1330
- const plugin = await resolvePlugin(registry, pluginId);
1331
- if (!plugin) {
1332
- res.status(404).json({ error: "Plugin not found" });
1333
- return;
1334
- }
1335
- if (plugin.status !== "ready") {
1336
- res.status(400).json({
1337
- error: `Plugin is not ready (current status: ${plugin.status})`,
1338
- });
1339
- return;
1340
- }
1341
- const body = req.body;
1342
- if (!body?.configJson || typeof body.configJson !== "object") {
1343
- res.status(400).json({ error: '"configJson" is required and must be an object' });
1344
- return;
1345
- }
1346
- // Fast schema-level rejection before hitting the worker RPC.
1347
- const schema = plugin.manifestJson?.instanceConfigSchema;
1348
- if (schema && Object.keys(schema).length > 0) {
1349
- const validation = validateInstanceConfig(body.configJson, schema);
1350
- if (!validation.valid) {
1351
- res.status(400).json({
1352
- error: "Configuration does not match the plugin's instanceConfigSchema",
1353
- fieldErrors: validation.errors,
1354
- });
1355
- return;
1356
- }
1357
- }
1358
- try {
1359
- const result = await bridgeDeps.workerManager.call(plugin.id, "validateConfig", { config: body.configJson });
1360
- // The worker returns PluginConfigValidationResult { ok, warnings?, errors? }
1361
- // Map to the frontend-expected shape { valid, message? }
1362
- if (result.ok) {
1363
- const warningText = result.warnings?.length
1364
- ? `Warnings: ${result.warnings.join("; ")}`
1365
- : undefined;
1366
- res.json({ valid: true, message: warningText });
1367
- }
1368
- else {
1369
- const errorText = result.errors?.length
1370
- ? result.errors.join("; ")
1371
- : "Configuration validation failed.";
1372
- res.json({ valid: false, message: errorText });
1373
- }
1374
- }
1375
- catch (err) {
1376
- // If the worker does not implement validateConfig, return a structured response
1377
- if (err instanceof JsonRpcCallError &&
1378
- err.code === PLUGIN_RPC_ERROR_CODES.METHOD_NOT_IMPLEMENTED) {
1379
- res.json({
1380
- valid: false,
1381
- supported: false,
1382
- message: "This plugin does not support configuration testing.",
1383
- });
1384
- return;
1385
- }
1386
- // Worker unavailable or other RPC errors
1387
- const bridgeError = mapRpcErrorToBridgeError(err);
1388
- res.status(502).json(bridgeError);
1389
- }
1390
- });
1391
- // ===========================================================================
1392
- // Job scheduling routes
1393
- // ===========================================================================
1394
- /**
1395
- * GET /api/plugins/:pluginId/jobs
1396
- *
1397
- * List all scheduled jobs for a plugin.
1398
- *
1399
- * Query params:
1400
- * - `status` (optional): Filter by job status (`active`, `paused`, `failed`)
1401
- *
1402
- * Response: PluginJobRecord[]
1403
- * Errors: 404 if plugin not found
1404
- */
1405
- router.get("/plugins/:pluginId/jobs", async (req, res) => {
1406
- assertBoard(req);
1407
- if (!jobDeps) {
1408
- res.status(501).json({ error: "Job scheduling is not enabled" });
1409
- return;
1410
- }
1411
- const { pluginId } = req.params;
1412
- const plugin = await resolvePlugin(registry, pluginId);
1413
- if (!plugin) {
1414
- res.status(404).json({ error: "Plugin not found" });
1415
- return;
1416
- }
1417
- const rawStatus = req.query.status;
1418
- const validStatuses = ["active", "paused", "failed"];
1419
- if (rawStatus !== undefined && !validStatuses.includes(rawStatus)) {
1420
- res.status(400).json({
1421
- error: `Invalid status '${rawStatus}'. Must be one of: ${validStatuses.join(", ")}`,
1422
- });
1423
- return;
1424
- }
1425
- try {
1426
- const jobs = await jobDeps.jobStore.listJobs(plugin.id, rawStatus);
1427
- res.json(jobs);
1428
- }
1429
- catch (err) {
1430
- const message = err instanceof Error ? err.message : String(err);
1431
- res.status(500).json({ error: message });
1432
- }
1433
- });
1434
- /**
1435
- * GET /api/plugins/:pluginId/jobs/:jobId/runs
1436
- *
1437
- * List execution history for a specific job.
1438
- *
1439
- * Query params:
1440
- * - `limit` (optional): Maximum number of runs to return (default: 50)
1441
- *
1442
- * Response: PluginJobRunRecord[]
1443
- * Errors: 404 if plugin not found
1444
- */
1445
- router.get("/plugins/:pluginId/jobs/:jobId/runs", async (req, res) => {
1446
- assertBoard(req);
1447
- if (!jobDeps) {
1448
- res.status(501).json({ error: "Job scheduling is not enabled" });
1449
- return;
1450
- }
1451
- const { pluginId, jobId } = req.params;
1452
- const plugin = await resolvePlugin(registry, pluginId);
1453
- if (!plugin) {
1454
- res.status(404).json({ error: "Plugin not found" });
1455
- return;
1456
- }
1457
- const job = await jobDeps.jobStore.getJobByIdForPlugin(plugin.id, jobId);
1458
- if (!job) {
1459
- res.status(404).json({ error: "Job not found" });
1460
- return;
1461
- }
1462
- const limit = req.query.limit ? parseInt(req.query.limit, 10) : 25;
1463
- if (isNaN(limit) || limit < 1 || limit > 500) {
1464
- res.status(400).json({ error: "limit must be a number between 1 and 500" });
1465
- return;
1466
- }
1467
- try {
1468
- const runs = await jobDeps.jobStore.listRunsByJob(jobId, limit);
1469
- res.json(runs);
1470
- }
1471
- catch (err) {
1472
- const message = err instanceof Error ? err.message : String(err);
1473
- res.status(500).json({ error: message });
1474
- }
1475
- });
1476
- /**
1477
- * POST /api/plugins/:pluginId/jobs/:jobId/trigger
1478
- *
1479
- * Manually trigger a job execution outside its cron schedule.
1480
- *
1481
- * Creates a run with `trigger: "manual"` and dispatches immediately.
1482
- * The response returns before the job completes (non-blocking).
1483
- *
1484
- * Response: `{ runId: string, jobId: string }`
1485
- * Errors:
1486
- * - 404 if plugin not found
1487
- * - 400 if job not found, not active, already running, or worker unavailable
1488
- */
1489
- router.post("/plugins/:pluginId/jobs/:jobId/trigger", async (req, res) => {
1490
- assertBoard(req);
1491
- if (!jobDeps) {
1492
- res.status(501).json({ error: "Job scheduling is not enabled" });
1493
- return;
1494
- }
1495
- const { pluginId, jobId } = req.params;
1496
- const plugin = await resolvePlugin(registry, pluginId);
1497
- if (!plugin) {
1498
- res.status(404).json({ error: "Plugin not found" });
1499
- return;
1500
- }
1501
- const job = await jobDeps.jobStore.getJobByIdForPlugin(plugin.id, jobId);
1502
- if (!job) {
1503
- res.status(404).json({ error: "Job not found" });
1504
- return;
1505
- }
1506
- try {
1507
- const result = await jobDeps.scheduler.triggerJob(jobId, "manual");
1508
- res.json(result);
1509
- }
1510
- catch (err) {
1511
- const message = err instanceof Error ? err.message : String(err);
1512
- res.status(400).json({ error: message });
1513
- }
1514
- });
1515
- // ===========================================================================
1516
- // Webhook ingestion route
1517
- // ===========================================================================
1518
- /**
1519
- * POST /api/plugins/:pluginId/webhooks/:endpointKey
1520
- *
1521
- * Receive an inbound webhook delivery for a plugin.
1522
- *
1523
- * This route is called by external systems (e.g. GitHub, Linear, Stripe) to
1524
- * deliver webhook payloads to a plugin. The host validates that:
1525
- * 1. The plugin exists and is in 'ready' state
1526
- * 2. The plugin declares the `webhooks.receive` capability
1527
- * 3. The `endpointKey` matches a declared webhook in the manifest
1528
- *
1529
- * The delivery is recorded in the `plugin_webhook_deliveries` table and
1530
- * dispatched to the worker via the `handleWebhook` RPC method.
1531
- *
1532
- * **Note:** This route does NOT require board authentication — webhook
1533
- * endpoints must be publicly accessible for external callers. Signature
1534
- * verification is the plugin's responsibility.
1535
- *
1536
- * Response: `{ deliveryId: string, status: string }`
1537
- * Errors:
1538
- * - 404 if plugin not found or endpointKey not declared
1539
- * - 400 if plugin is not in ready state or lacks webhooks.receive capability
1540
- * - 502 if the worker is unavailable or the RPC call fails
1541
- */
1542
- router.post("/plugins/:pluginId/webhooks/:endpointKey", async (req, res) => {
1543
- if (!webhookDeps) {
1544
- res.status(501).json({ error: "Webhook ingestion is not enabled" });
1545
- return;
1546
- }
1547
- const { pluginId, endpointKey } = req.params;
1548
- // Step 1: Resolve the plugin
1549
- const plugin = await resolvePlugin(registry, pluginId);
1550
- if (!plugin) {
1551
- res.status(404).json({ error: "Plugin not found" });
1552
- return;
1553
- }
1554
- // Step 2: Validate the plugin is in 'ready' state
1555
- if (plugin.status !== "ready") {
1556
- res.status(400).json({
1557
- error: `Plugin is not ready (current status: ${plugin.status})`,
1558
- });
1559
- return;
1560
- }
1561
- // Step 3: Validate the plugin has webhooks.receive capability
1562
- const manifest = plugin.manifestJson;
1563
- if (!manifest) {
1564
- res.status(400).json({ error: "Plugin manifest is missing" });
1565
- return;
1566
- }
1567
- const capabilities = manifest.capabilities ?? [];
1568
- if (!capabilities.includes("webhooks.receive")) {
1569
- res.status(400).json({
1570
- error: "Plugin does not have the webhooks.receive capability",
1571
- });
1572
- return;
1573
- }
1574
- // Step 4: Validate the endpointKey exists in the manifest's webhook declarations
1575
- const declaredWebhooks = manifest.webhooks ?? [];
1576
- const webhookDecl = declaredWebhooks.find((w) => w.endpointKey === endpointKey);
1577
- if (!webhookDecl) {
1578
- res.status(404).json({
1579
- error: `Webhook endpoint '${endpointKey}' is not declared by this plugin`,
1580
- });
1581
- return;
1582
- }
1583
- // Step 5: Extract request data
1584
- const requestId = randomUUID();
1585
- const rawHeaders = {};
1586
- for (const [key, value] of Object.entries(req.headers)) {
1587
- if (typeof value === "string") {
1588
- rawHeaders[key] = value;
1589
- }
1590
- else if (Array.isArray(value)) {
1591
- rawHeaders[key] = value.join(", ");
1592
- }
1593
- }
1594
- // Use the raw buffer stashed by the express.json() `verify` callback.
1595
- // This preserves the exact bytes the provider signed, whereas
1596
- // JSON.stringify(req.body) would re-serialize and break HMAC verification.
1597
- const stashedRaw = req.rawBody;
1598
- const rawBody = stashedRaw ? stashedRaw.toString("utf-8") : "";
1599
- const parsedBody = req.body;
1600
- const payload = req.body ?? {};
1601
- // Step 6: Record the delivery in the database
1602
- const startedAt = new Date();
1603
- const [delivery] = await db
1604
- .insert(pluginWebhookDeliveries)
1605
- .values({
1606
- pluginId: plugin.id,
1607
- webhookKey: endpointKey,
1608
- status: "pending",
1609
- payload,
1610
- headers: rawHeaders,
1611
- startedAt,
1612
- })
1613
- .returning({ id: pluginWebhookDeliveries.id });
1614
- // Step 7: Dispatch to the worker via handleWebhook RPC
1615
- try {
1616
- await webhookDeps.workerManager.call(plugin.id, "handleWebhook", {
1617
- endpointKey,
1618
- headers: req.headers,
1619
- rawBody,
1620
- parsedBody,
1621
- requestId,
1622
- });
1623
- // Step 8: Update delivery record to success
1624
- const finishedAt = new Date();
1625
- const durationMs = finishedAt.getTime() - startedAt.getTime();
1626
- await db
1627
- .update(pluginWebhookDeliveries)
1628
- .set({
1629
- status: "success",
1630
- durationMs,
1631
- finishedAt,
1632
- })
1633
- .where(eq(pluginWebhookDeliveries.id, delivery.id));
1634
- res.status(200).json({
1635
- deliveryId: delivery.id,
1636
- status: "success",
1637
- });
1638
- }
1639
- catch (err) {
1640
- // Step 8 (error): Update delivery record to failed
1641
- const finishedAt = new Date();
1642
- const durationMs = finishedAt.getTime() - startedAt.getTime();
1643
- const errorMessage = err instanceof Error ? err.message : String(err);
1644
- await db
1645
- .update(pluginWebhookDeliveries)
1646
- .set({
1647
- status: "failed",
1648
- durationMs,
1649
- error: errorMessage,
1650
- finishedAt,
1651
- })
1652
- .where(eq(pluginWebhookDeliveries.id, delivery.id));
1653
- res.status(502).json({
1654
- deliveryId: delivery.id,
1655
- status: "failed",
1656
- error: errorMessage,
1657
- });
1658
- }
1659
- });
1660
- // ===========================================================================
1661
- // Plugin health dashboard — aggregated diagnostics for the settings page
1662
- // ===========================================================================
1663
- /**
1664
- * GET /api/plugins/:pluginId/dashboard
1665
- *
1666
- * Aggregated health dashboard data for a plugin's settings page.
1667
- *
1668
- * Returns worker diagnostics (status, uptime, crash history), recent job
1669
- * runs, recent webhook deliveries, and the current health check result —
1670
- * all in a single response to avoid multiple round-trips.
1671
- *
1672
- * Response: PluginDashboardData
1673
- * Errors: 404 if plugin not found
1674
- */
1675
- router.get("/plugins/:pluginId/dashboard", async (req, res) => {
1676
- assertBoard(req);
1677
- const { pluginId } = req.params;
1678
- const plugin = await resolvePlugin(registry, pluginId);
1679
- if (!plugin) {
1680
- res.status(404).json({ error: "Plugin not found" });
1681
- return;
1682
- }
1683
- // --- Worker diagnostics ---
1684
- let worker = null;
1685
- // Try bridgeDeps first (primary source for worker manager), fallback to webhookDeps
1686
- const wm = bridgeDeps?.workerManager ?? webhookDeps?.workerManager ?? null;
1687
- if (wm) {
1688
- const handle = wm.getWorker(plugin.id);
1689
- if (handle) {
1690
- const diag = handle.diagnostics();
1691
- worker = {
1692
- status: diag.status,
1693
- pid: diag.pid,
1694
- uptime: diag.uptime,
1695
- consecutiveCrashes: diag.consecutiveCrashes,
1696
- totalCrashes: diag.totalCrashes,
1697
- pendingRequests: diag.pendingRequests,
1698
- lastCrashAt: diag.lastCrashAt,
1699
- nextRestartAt: diag.nextRestartAt,
1700
- };
1701
- }
1702
- }
1703
- // --- Recent job runs (last 10, newest first) ---
1704
- let recentJobRuns = [];
1705
- if (jobDeps) {
1706
- try {
1707
- const runs = await jobDeps.jobStore.listRunsByPlugin(plugin.id, undefined, 10);
1708
- // Also fetch job definitions so we can include jobKey
1709
- const jobs = await jobDeps.jobStore.listJobs(plugin.id);
1710
- const jobKeyMap = new Map(jobs.map((j) => [j.id, j.jobKey]));
1711
- recentJobRuns = runs
1712
- .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())
1713
- .map((r) => ({
1714
- id: r.id,
1715
- jobId: r.jobId,
1716
- jobKey: jobKeyMap.get(r.jobId) ?? undefined,
1717
- trigger: r.trigger,
1718
- status: r.status,
1719
- durationMs: r.durationMs,
1720
- error: r.error,
1721
- startedAt: r.startedAt ? new Date(r.startedAt).toISOString() : null,
1722
- finishedAt: r.finishedAt ? new Date(r.finishedAt).toISOString() : null,
1723
- createdAt: new Date(r.createdAt).toISOString(),
1724
- }));
1725
- }
1726
- catch {
1727
- // Job data unavailable — leave empty
1728
- }
1729
- }
1730
- // --- Recent webhook deliveries (last 10, newest first) ---
1731
- let recentWebhookDeliveries = [];
1732
- try {
1733
- const deliveries = await db
1734
- .select({
1735
- id: pluginWebhookDeliveries.id,
1736
- webhookKey: pluginWebhookDeliveries.webhookKey,
1737
- status: pluginWebhookDeliveries.status,
1738
- durationMs: pluginWebhookDeliveries.durationMs,
1739
- error: pluginWebhookDeliveries.error,
1740
- startedAt: pluginWebhookDeliveries.startedAt,
1741
- finishedAt: pluginWebhookDeliveries.finishedAt,
1742
- createdAt: pluginWebhookDeliveries.createdAt,
1743
- })
1744
- .from(pluginWebhookDeliveries)
1745
- .where(eq(pluginWebhookDeliveries.pluginId, plugin.id))
1746
- .orderBy(desc(pluginWebhookDeliveries.createdAt))
1747
- .limit(10);
1748
- recentWebhookDeliveries = deliveries.map((d) => ({
1749
- id: d.id,
1750
- webhookKey: d.webhookKey,
1751
- status: d.status,
1752
- durationMs: d.durationMs,
1753
- error: d.error,
1754
- startedAt: d.startedAt ? d.startedAt.toISOString() : null,
1755
- finishedAt: d.finishedAt ? d.finishedAt.toISOString() : null,
1756
- createdAt: d.createdAt.toISOString(),
1757
- }));
1758
- }
1759
- catch {
1760
- // Webhook data unavailable — leave empty
1761
- }
1762
- // --- Health check (same logic as GET /health) ---
1763
- const checks = [];
1764
- checks.push({
1765
- name: "registry",
1766
- passed: true,
1767
- message: "Plugin found in registry",
1768
- });
1769
- const hasValidManifest = Boolean(plugin.manifestJson?.id);
1770
- checks.push({
1771
- name: "manifest",
1772
- passed: hasValidManifest,
1773
- message: hasValidManifest ? "Manifest is valid" : "Manifest is invalid or missing",
1774
- });
1775
- const isHealthy = plugin.status === "ready";
1776
- checks.push({
1777
- name: "status",
1778
- passed: isHealthy,
1779
- message: `Current status: ${plugin.status}`,
1780
- });
1781
- const hasNoError = !plugin.lastError;
1782
- if (!hasNoError) {
1783
- checks.push({
1784
- name: "error_state",
1785
- passed: false,
1786
- message: plugin.lastError ?? undefined,
1787
- });
1788
- }
1789
- const health = {
1790
- pluginId: plugin.id,
1791
- status: plugin.status,
1792
- healthy: isHealthy && hasValidManifest && hasNoError,
1793
- checks,
1794
- lastError: plugin.lastError ?? undefined,
1795
- };
1796
- res.json({
1797
- pluginId: plugin.id,
1798
- worker,
1799
- recentJobRuns,
1800
- recentWebhookDeliveries,
1801
- health,
1802
- checkedAt: new Date().toISOString(),
1803
- });
1112
+ registerPluginOperationsRoutes({
1113
+ router,
1114
+ db,
1115
+ loader,
1116
+ registry,
1117
+ lifecycle,
1118
+ bridgeDeps,
1119
+ jobDeps,
1120
+ webhookDeps,
1121
+ resolvePlugin,
1122
+ logPluginMutationActivity,
1123
+ mapRpcErrorToBridgeError,
1804
1124
  });
1805
1125
  return router;
1806
1126
  }