@hed-hog/core 0.0.349 → 0.0.351

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 (350) hide show
  1. package/dist/access-log/access-log.controller.d.ts +16 -0
  2. package/dist/access-log/access-log.controller.d.ts.map +1 -0
  3. package/dist/access-log/access-log.controller.js +44 -0
  4. package/dist/access-log/access-log.controller.js.map +1 -0
  5. package/dist/access-log/access-log.interceptor.d.ts +9 -0
  6. package/dist/access-log/access-log.interceptor.d.ts.map +1 -0
  7. package/dist/access-log/access-log.interceptor.js +46 -0
  8. package/dist/access-log/access-log.interceptor.js.map +1 -0
  9. package/dist/access-log/access-log.module.d.ts +3 -0
  10. package/dist/access-log/access-log.module.d.ts.map +1 -0
  11. package/dist/access-log/access-log.module.js +29 -0
  12. package/dist/access-log/access-log.module.js.map +1 -0
  13. package/dist/access-log/access-log.service.d.ts +47 -0
  14. package/dist/access-log/access-log.service.d.ts.map +1 -0
  15. package/dist/access-log/access-log.service.js +113 -0
  16. package/dist/access-log/access-log.service.js.map +1 -0
  17. package/dist/access-log/dto/query-access-log.dto.d.ts +8 -0
  18. package/dist/access-log/dto/query-access-log.dto.d.ts.map +1 -0
  19. package/dist/access-log/dto/query-access-log.dto.js +42 -0
  20. package/dist/access-log/dto/query-access-log.dto.js.map +1 -0
  21. package/dist/auth/auth.controller.d.ts +12 -12
  22. package/dist/auth/auth.service.d.ts +27 -27
  23. package/dist/auth/auth.service.d.ts.map +1 -1
  24. package/dist/auth/auth.service.js +0 -4
  25. package/dist/auth/auth.service.js.map +1 -1
  26. package/dist/challenge/challenge.service.d.ts +2 -2
  27. package/dist/challenge/challenge.service.d.ts.map +1 -1
  28. package/dist/challenge/challenge.service.js +0 -1
  29. package/dist/challenge/challenge.service.js.map +1 -1
  30. package/dist/core/system.module.d.ts.map +1 -1
  31. package/dist/core/system.module.js +1 -0
  32. package/dist/core/system.module.js.map +1 -1
  33. package/dist/core.module.d.ts.map +1 -1
  34. package/dist/core.module.js +15 -0
  35. package/dist/core.module.js.map +1 -1
  36. package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts +3 -3
  37. package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts +3 -3
  38. package/dist/dashboard/dashboard.module.d.ts.map +1 -1
  39. package/dist/dashboard/dashboard.module.js +4 -1
  40. package/dist/dashboard/dashboard.module.js.map +1 -1
  41. package/dist/file/file.controller.js +0 -1
  42. package/dist/file/file.controller.js.map +1 -1
  43. package/dist/file/file.service.d.ts +65 -0
  44. package/dist/file/file.service.d.ts.map +1 -1
  45. package/dist/file/file.service.js +151 -3
  46. package/dist/file/file.service.js.map +1 -1
  47. package/dist/file/provider/abstract.provider.d.ts +8 -0
  48. package/dist/file/provider/abstract.provider.d.ts.map +1 -1
  49. package/dist/file/provider/abstract.provider.js.map +1 -1
  50. package/dist/file/provider/azure.provider.d.ts +4 -0
  51. package/dist/file/provider/azure.provider.d.ts.map +1 -1
  52. package/dist/file/provider/azure.provider.js +14 -0
  53. package/dist/file/provider/azure.provider.js.map +1 -1
  54. package/dist/file/provider/gcs.provider.d.ts +4 -0
  55. package/dist/file/provider/gcs.provider.d.ts.map +1 -1
  56. package/dist/file/provider/gcs.provider.js +14 -0
  57. package/dist/file/provider/gcs.provider.js.map +1 -1
  58. package/dist/file/provider/local.provider.d.ts +4 -0
  59. package/dist/file/provider/local.provider.d.ts.map +1 -1
  60. package/dist/file/provider/local.provider.js +19 -0
  61. package/dist/file/provider/local.provider.js.map +1 -1
  62. package/dist/file/provider/provider.factory.d.ts.map +1 -1
  63. package/dist/file/provider/provider.factory.js +3 -0
  64. package/dist/file/provider/provider.factory.js.map +1 -1
  65. package/dist/file/provider/s3.provider.d.ts +4 -0
  66. package/dist/file/provider/s3.provider.d.ts.map +1 -1
  67. package/dist/file/provider/s3.provider.js +17 -0
  68. package/dist/file/provider/s3.provider.js.map +1 -1
  69. package/dist/index.d.ts +3 -0
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +4 -0
  72. package/dist/index.js.map +1 -1
  73. package/dist/mcp/guards/mcp-auth.guard.d.ts +6 -1
  74. package/dist/mcp/guards/mcp-auth.guard.d.ts.map +1 -1
  75. package/dist/mcp/guards/mcp-auth.guard.js +29 -2
  76. package/dist/mcp/guards/mcp-auth.guard.js.map +1 -1
  77. package/dist/mcp/mcp-api-key.controller.d.ts +32 -0
  78. package/dist/mcp/mcp-api-key.controller.d.ts.map +1 -0
  79. package/dist/mcp/mcp-api-key.controller.js +64 -0
  80. package/dist/mcp/mcp-api-key.controller.js.map +1 -0
  81. package/dist/mcp/mcp-api-key.service.d.ts +27 -0
  82. package/dist/mcp/mcp-api-key.service.d.ts.map +1 -0
  83. package/dist/mcp/mcp-api-key.service.js +74 -0
  84. package/dist/mcp/mcp-api-key.service.js.map +1 -0
  85. package/dist/mcp/mcp-audit.service.d.ts +3 -1
  86. package/dist/mcp/mcp-audit.service.d.ts.map +1 -1
  87. package/dist/mcp/mcp-audit.service.js +14 -2
  88. package/dist/mcp/mcp-audit.service.js.map +1 -1
  89. package/dist/mcp/mcp-registry.service.d.ts +1 -2
  90. package/dist/mcp/mcp-registry.service.d.ts.map +1 -1
  91. package/dist/mcp/mcp-registry.service.js +6 -2
  92. package/dist/mcp/mcp-registry.service.js.map +1 -1
  93. package/dist/mcp/mcp.controller.d.ts +3 -1
  94. package/dist/mcp/mcp.controller.d.ts.map +1 -1
  95. package/dist/mcp/mcp.controller.js +10 -2
  96. package/dist/mcp/mcp.controller.js.map +1 -1
  97. package/dist/mcp/mcp.module.d.ts.map +1 -1
  98. package/dist/mcp/mcp.module.js +80 -1
  99. package/dist/mcp/mcp.module.js.map +1 -1
  100. package/dist/mcp/tools/core-ai.mcp-tools.d.ts +45 -0
  101. package/dist/mcp/tools/core-ai.mcp-tools.d.ts.map +1 -0
  102. package/dist/mcp/tools/core-ai.mcp-tools.js +214 -0
  103. package/dist/mcp/tools/core-ai.mcp-tools.js.map +1 -0
  104. package/dist/mcp/tools/core-dashboard-items.mcp-tools.d.ts +21 -0
  105. package/dist/mcp/tools/core-dashboard-items.mcp-tools.d.ts.map +1 -0
  106. package/dist/mcp/tools/core-dashboard-items.mcp-tools.js +89 -0
  107. package/dist/mcp/tools/core-dashboard-items.mcp-tools.js.map +1 -0
  108. package/dist/mcp/tools/core-dashboard.mcp-tools.d.ts +29 -0
  109. package/dist/mcp/tools/core-dashboard.mcp-tools.d.ts.map +1 -0
  110. package/dist/mcp/tools/core-dashboard.mcp-tools.js +149 -0
  111. package/dist/mcp/tools/core-dashboard.mcp-tools.js.map +1 -0
  112. package/dist/mcp/tools/core-event-webhooks.mcp-tools.d.ts +30 -0
  113. package/dist/mcp/tools/core-event-webhooks.mcp-tools.d.ts.map +1 -0
  114. package/dist/mcp/tools/core-event-webhooks.mcp-tools.js +185 -0
  115. package/dist/mcp/tools/core-event-webhooks.mcp-tools.js.map +1 -0
  116. package/dist/mcp/tools/core-files.mcp-tools.d.ts +26 -0
  117. package/dist/mcp/tools/core-files.mcp-tools.d.ts.map +1 -0
  118. package/dist/mcp/tools/core-files.mcp-tools.js +140 -0
  119. package/dist/mcp/tools/core-files.mcp-tools.js.map +1 -0
  120. package/dist/mcp/tools/core-integration-events.mcp-tools.d.ts +26 -0
  121. package/dist/mcp/tools/core-integration-events.mcp-tools.d.ts.map +1 -0
  122. package/dist/mcp/tools/core-integration-events.mcp-tools.js +168 -0
  123. package/dist/mcp/tools/core-integration-events.mcp-tools.js.map +1 -0
  124. package/dist/mcp/tools/core-mail-profile.mcp-tools.d.ts +32 -0
  125. package/dist/mcp/tools/core-mail-profile.mcp-tools.d.ts.map +1 -0
  126. package/dist/mcp/tools/core-mail-profile.mcp-tools.js +178 -0
  127. package/dist/mcp/tools/core-mail-profile.mcp-tools.js.map +1 -0
  128. package/dist/mcp/tools/core-mail-sent.mcp-tools.d.ts +14 -0
  129. package/dist/mcp/tools/core-mail-sent.mcp-tools.d.ts.map +1 -0
  130. package/dist/mcp/tools/core-mail-sent.mcp-tools.js +106 -0
  131. package/dist/mcp/tools/core-mail-sent.mcp-tools.js.map +1 -0
  132. package/dist/mcp/tools/core-mail.mcp-tools.d.ts +36 -0
  133. package/dist/mcp/tools/core-mail.mcp-tools.d.ts.map +1 -0
  134. package/dist/mcp/tools/core-mail.mcp-tools.js +184 -0
  135. package/dist/mcp/tools/core-mail.mcp-tools.js.map +1 -0
  136. package/dist/mcp/tools/core-mcp-chat.mcp-tools.d.ts +21 -0
  137. package/dist/mcp/tools/core-mcp-chat.mcp-tools.d.ts.map +1 -0
  138. package/dist/mcp/tools/core-mcp-chat.mcp-tools.js +118 -0
  139. package/dist/mcp/tools/core-mcp-chat.mcp-tools.js.map +1 -0
  140. package/dist/mcp/tools/core-menus.mcp-tools.d.ts +40 -0
  141. package/dist/mcp/tools/core-menus.mcp-tools.d.ts.map +1 -0
  142. package/dist/mcp/tools/core-menus.mcp-tools.js +268 -0
  143. package/dist/mcp/tools/core-menus.mcp-tools.js.map +1 -0
  144. package/dist/mcp/tools/core-notifications.mcp-tools.d.ts +31 -0
  145. package/dist/mcp/tools/core-notifications.mcp-tools.d.ts.map +1 -0
  146. package/dist/mcp/tools/core-notifications.mcp-tools.js +178 -0
  147. package/dist/mcp/tools/core-notifications.mcp-tools.js.map +1 -0
  148. package/dist/mcp/tools/core-profile.mcp-tools.d.ts +20 -0
  149. package/dist/mcp/tools/core-profile.mcp-tools.d.ts.map +1 -0
  150. package/dist/mcp/tools/core-profile.mcp-tools.js +111 -0
  151. package/dist/mcp/tools/core-profile.mcp-tools.js.map +1 -0
  152. package/dist/mcp/tools/core-roles.mcp-tools.d.ts +70 -0
  153. package/dist/mcp/tools/core-roles.mcp-tools.d.ts.map +1 -0
  154. package/dist/mcp/tools/core-roles.mcp-tools.js +355 -0
  155. package/dist/mcp/tools/core-roles.mcp-tools.js.map +1 -0
  156. package/dist/mcp/tools/core-routes.mcp-tools.d.ts +52 -0
  157. package/dist/mcp/tools/core-routes.mcp-tools.d.ts.map +1 -0
  158. package/dist/mcp/tools/core-routes.mcp-tools.js +254 -0
  159. package/dist/mcp/tools/core-routes.mcp-tools.js.map +1 -0
  160. package/dist/mcp/tools/core-screens.mcp-tools.d.ts +47 -0
  161. package/dist/mcp/tools/core-screens.mcp-tools.d.ts.map +1 -0
  162. package/dist/mcp/tools/core-screens.mcp-tools.js +250 -0
  163. package/dist/mcp/tools/core-screens.mcp-tools.js.map +1 -0
  164. package/dist/mcp/tools/core-sessions.mcp-tools.d.ts +20 -0
  165. package/dist/mcp/tools/core-sessions.mcp-tools.d.ts.map +1 -0
  166. package/dist/mcp/tools/core-sessions.mcp-tools.js +128 -0
  167. package/dist/mcp/tools/core-sessions.mcp-tools.js.map +1 -0
  168. package/dist/mcp/tools/core-settings.mcp-tools.d.ts +25 -0
  169. package/dist/mcp/tools/core-settings.mcp-tools.d.ts.map +1 -1
  170. package/dist/mcp/tools/core-settings.mcp-tools.js +138 -0
  171. package/dist/mcp/tools/core-settings.mcp-tools.js.map +1 -1
  172. package/dist/mcp/tools/core-system.mcp-tools.d.ts +8 -0
  173. package/dist/mcp/tools/core-system.mcp-tools.d.ts.map +1 -0
  174. package/dist/mcp/tools/core-system.mcp-tools.js +40 -0
  175. package/dist/mcp/tools/core-system.mcp-tools.js.map +1 -0
  176. package/dist/mcp/tools/core-webhooks.mcp-tools.d.ts +46 -0
  177. package/dist/mcp/tools/core-webhooks.mcp-tools.d.ts.map +1 -0
  178. package/dist/mcp/tools/core-webhooks.mcp-tools.js +266 -0
  179. package/dist/mcp/tools/core-webhooks.mcp-tools.js.map +1 -0
  180. package/dist/mcp-chat/mcp-chat.controller.d.ts +5 -1
  181. package/dist/mcp-chat/mcp-chat.controller.d.ts.map +1 -1
  182. package/dist/mcp-chat/mcp-chat.controller.js +46 -0
  183. package/dist/mcp-chat/mcp-chat.controller.js.map +1 -1
  184. package/dist/mcp-chat/mcp-chat.service.d.ts +31 -3
  185. package/dist/mcp-chat/mcp-chat.service.d.ts.map +1 -1
  186. package/dist/mcp-chat/mcp-chat.service.js +776 -38
  187. package/dist/mcp-chat/mcp-chat.service.js.map +1 -1
  188. package/dist/notification/dto/create-notification.dto.d.ts +26 -0
  189. package/dist/notification/dto/create-notification.dto.d.ts.map +1 -0
  190. package/dist/notification/dto/create-notification.dto.js +86 -0
  191. package/dist/notification/dto/create-notification.dto.js.map +1 -0
  192. package/dist/notification/dto/update-progress.dto.d.ts +6 -0
  193. package/dist/notification/dto/update-progress.dto.d.ts.map +1 -0
  194. package/dist/notification/dto/update-progress.dto.js +33 -0
  195. package/dist/notification/dto/update-progress.dto.js.map +1 -0
  196. package/dist/notification/notification.controller.d.ts +112 -0
  197. package/dist/notification/notification.controller.d.ts.map +1 -0
  198. package/dist/notification/notification.controller.js +130 -0
  199. package/dist/notification/notification.controller.js.map +1 -0
  200. package/dist/notification/notification.module.d.ts +3 -0
  201. package/dist/notification/notification.module.d.ts.map +1 -0
  202. package/dist/notification/notification.module.js +29 -0
  203. package/dist/notification/notification.module.js.map +1 -0
  204. package/dist/notification/notification.service.d.ts +112 -0
  205. package/dist/notification/notification.service.d.ts.map +1 -0
  206. package/dist/notification/notification.service.js +269 -0
  207. package/dist/notification/notification.service.js.map +1 -0
  208. package/dist/pdf/pdf.service.js +1 -1
  209. package/dist/pdf/pdf.service.js.map +1 -1
  210. package/dist/profile/profile.controller.d.ts +4 -4
  211. package/dist/profile/profile.controller.js +0 -1
  212. package/dist/profile/profile.controller.js.map +1 -1
  213. package/dist/profile/profile.module.d.ts.map +1 -1
  214. package/dist/profile/profile.module.js +1 -0
  215. package/dist/profile/profile.module.js.map +1 -1
  216. package/dist/profile/profile.service.d.ts +4 -4
  217. package/dist/session/session.controller.d.ts +3 -3
  218. package/dist/session/session.service.d.ts +9 -9
  219. package/dist/setting/dto/update-setting-list.dto.d.ts +9 -0
  220. package/dist/setting/dto/update-setting-list.dto.d.ts.map +1 -0
  221. package/dist/setting/dto/update-setting-list.dto.js +44 -0
  222. package/dist/setting/dto/update-setting-list.dto.js.map +1 -0
  223. package/dist/setting/setting.controller.d.ts +20 -1
  224. package/dist/setting/setting.controller.d.ts.map +1 -1
  225. package/dist/setting/setting.controller.js +12 -0
  226. package/dist/setting/setting.controller.js.map +1 -1
  227. package/dist/setting/setting.service.d.ts +20 -1
  228. package/dist/setting/setting.service.d.ts.map +1 -1
  229. package/dist/setting/setting.service.js +80 -4
  230. package/dist/setting/setting.service.js.map +1 -1
  231. package/dist/task/task.service.d.ts +13 -0
  232. package/dist/task/task.service.d.ts.map +1 -1
  233. package/dist/task/task.service.js +85 -0
  234. package/dist/task/task.service.js.map +1 -1
  235. package/dist/token/token.service.d.ts.map +1 -1
  236. package/dist/token/token.service.js +0 -1
  237. package/dist/token/token.service.js.map +1 -1
  238. package/dist/user/user.controller.d.ts +11 -11
  239. package/dist/user/user.service.d.ts +27 -27
  240. package/dist/webhook-integration/dto/webhook-action.dto.d.ts +22 -0
  241. package/dist/webhook-integration/dto/webhook-action.dto.d.ts.map +1 -0
  242. package/dist/webhook-integration/dto/webhook-action.dto.js +120 -0
  243. package/dist/webhook-integration/dto/webhook-action.dto.js.map +1 -0
  244. package/dist/webhook-integration/webhook-integration.controller.d.ts +7 -5
  245. package/dist/webhook-integration/webhook-integration.controller.d.ts.map +1 -1
  246. package/dist/webhook-integration/webhook-integration.controller.js +18 -5
  247. package/dist/webhook-integration/webhook-integration.controller.js.map +1 -1
  248. package/dist/webhook-integration/webhook-integration.service.d.ts +18 -5
  249. package/dist/webhook-integration/webhook-integration.service.d.ts.map +1 -1
  250. package/dist/webhook-integration/webhook-integration.service.js +342 -59
  251. package/dist/webhook-integration/webhook-integration.service.js.map +1 -1
  252. package/dist/webhook-integration/webhook-utils.d.ts +1 -0
  253. package/dist/webhook-integration/webhook-utils.d.ts.map +1 -1
  254. package/dist/webhook-integration/webhook-utils.js +38 -0
  255. package/dist/webhook-integration/webhook-utils.js.map +1 -1
  256. package/hedhog/data/menu.yaml +63 -4
  257. package/hedhog/data/route.yaml +1437 -0
  258. package/hedhog/data/setting_group.yaml +112 -0
  259. package/hedhog/data/setting_subgroup.yaml +32 -0
  260. package/hedhog/frontend/app/access-log/page.tsx.ejs +772 -0
  261. package/hedhog/frontend/app/account/components/mcp-tokens.tsx.ejs +285 -0
  262. package/hedhog/frontend/app/account/layout.tsx.ejs +32 -55
  263. package/hedhog/frontend/app/account/mcp-tokens/page.tsx.ejs +5 -0
  264. package/hedhog/frontend/app/ai_agent/page.tsx.ejs +10 -3
  265. package/hedhog/frontend/app/dashboard/dashboard-home-tabs.tsx.ejs +33 -13
  266. package/hedhog/frontend/app/dashboard/management/tabs/components-tab.tsx.ejs +12 -5
  267. package/hedhog/frontend/app/dashboard/management/tabs/dashboards-tab.tsx.ejs +12 -5
  268. package/hedhog/frontend/app/integrations-webhooks/page.tsx.ejs +3559 -1835
  269. package/hedhog/frontend/app/mcp_chat/chat-components.tsx.ejs +633 -0
  270. package/hedhog/frontend/app/mcp_chat/chat-types.ts.ejs +16 -0
  271. package/hedhog/frontend/app/mcp_chat/page.tsx.ejs +583 -384
  272. package/hedhog/frontend/app/menu/page.tsx.ejs +9 -3
  273. package/hedhog/frontend/app/roles/page.tsx.ejs +18 -6
  274. package/hedhog/frontend/app/routes/page.tsx.ejs +9 -3
  275. package/hedhog/frontend/app/setting-list/page.tsx.ejs +822 -0
  276. package/hedhog/frontend/app/users/page.tsx.ejs +445 -203
  277. package/hedhog/frontend/app/users/user-access-sheet.tsx.ejs +310 -304
  278. package/hedhog/frontend/app/users/user-sheet.tsx.ejs +41 -44
  279. package/hedhog/frontend/messages/en.json +343 -3
  280. package/hedhog/frontend/messages/pt.json +343 -3
  281. package/hedhog/table/access_log.yaml +31 -0
  282. package/hedhog/table/mcp_api_key.yaml +30 -0
  283. package/hedhog/table/notification.yaml +72 -0
  284. package/hedhog/table/webhook_action_log.yaml +49 -0
  285. package/package.json +5 -4
  286. package/src/access-log/access-log.controller.ts +29 -0
  287. package/src/access-log/access-log.interceptor.ts +38 -0
  288. package/src/access-log/access-log.module.ts +16 -0
  289. package/src/access-log/access-log.service.ts +129 -0
  290. package/src/access-log/dto/query-access-log.dto.ts +23 -0
  291. package/src/auth/auth.service.ts +0 -7
  292. package/src/challenge/challenge.service.ts +0 -2
  293. package/src/core/system.module.ts +1 -0
  294. package/src/core.module.ts +15 -0
  295. package/src/dashboard/dashboard.module.ts +4 -1
  296. package/src/file/file.controller.ts +14 -14
  297. package/src/file/file.service.ts +198 -4
  298. package/src/file/provider/abstract.provider.ts +10 -0
  299. package/src/file/provider/azure.provider.ts +24 -0
  300. package/src/file/provider/gcs.provider.ts +20 -0
  301. package/src/file/provider/local.provider.ts +30 -2
  302. package/src/file/provider/provider.factory.ts +3 -0
  303. package/src/file/provider/s3.provider.ts +22 -0
  304. package/src/index.ts +5 -0
  305. package/src/mcp/guards/mcp-auth.guard.ts +64 -32
  306. package/src/mcp/mcp-api-key.controller.ts +42 -0
  307. package/src/mcp/mcp-api-key.service.ts +66 -0
  308. package/src/mcp/mcp-audit.service.ts +47 -36
  309. package/src/mcp/mcp-registry.service.ts +75 -69
  310. package/src/mcp/mcp.controller.ts +40 -30
  311. package/src/mcp/mcp.module.ts +115 -36
  312. package/src/mcp/tools/core-ai.mcp-tools.ts +156 -0
  313. package/src/mcp/tools/core-dashboard-items.mcp-tools.ts +63 -0
  314. package/src/mcp/tools/core-dashboard.mcp-tools.ts +103 -0
  315. package/src/mcp/tools/core-event-webhooks.mcp-tools.ts +134 -0
  316. package/src/mcp/tools/core-files.mcp-tools.ts +105 -0
  317. package/src/mcp/tools/core-integration-events.mcp-tools.ts +118 -0
  318. package/src/mcp/tools/core-mail-profile.mcp-tools.ts +128 -0
  319. package/src/mcp/tools/core-mail-sent.mcp-tools.ts +76 -0
  320. package/src/mcp/tools/core-mail.mcp-tools.ts +130 -0
  321. package/src/mcp/tools/core-mcp-chat.mcp-tools.ts +81 -0
  322. package/src/mcp/tools/core-menus.mcp-tools.ts +197 -0
  323. package/src/mcp/tools/core-notifications.mcp-tools.ts +128 -0
  324. package/src/mcp/tools/core-profile.mcp-tools.ts +74 -0
  325. package/src/mcp/tools/core-roles.mcp-tools.ts +288 -0
  326. package/src/mcp/tools/core-routes.mcp-tools.ts +196 -0
  327. package/src/mcp/tools/core-screens.mcp-tools.ts +186 -0
  328. package/src/mcp/tools/core-sessions.mcp-tools.ts +97 -0
  329. package/src/mcp/tools/core-settings.mcp-tools.ts +171 -53
  330. package/src/mcp/tools/core-system.mcp-tools.ts +19 -0
  331. package/src/mcp/tools/core-webhooks.mcp-tools.ts +199 -0
  332. package/src/mcp-chat/mcp-chat.controller.ts +113 -60
  333. package/src/mcp-chat/mcp-chat.service.ts +1343 -332
  334. package/src/notification/dto/create-notification.dto.ts +71 -0
  335. package/src/notification/dto/update-progress.dto.ts +16 -0
  336. package/src/notification/notification.controller.ts +83 -0
  337. package/src/notification/notification.module.ts +16 -0
  338. package/src/notification/notification.service.ts +324 -0
  339. package/src/pdf/pdf.service.ts +1 -1
  340. package/src/profile/profile.controller.ts +1 -1
  341. package/src/profile/profile.module.ts +1 -0
  342. package/src/setting/dto/update-setting-list.dto.ts +32 -0
  343. package/src/setting/setting.controller.ts +9 -0
  344. package/src/setting/setting.service.ts +99 -11
  345. package/src/task/task.service.ts +103 -0
  346. package/src/token/token.service.ts +0 -2
  347. package/src/webhook-integration/dto/webhook-action.dto.ts +96 -0
  348. package/src/webhook-integration/webhook-integration.controller.ts +124 -103
  349. package/src/webhook-integration/webhook-integration.service.ts +1137 -735
  350. package/src/webhook-integration/webhook-utils.ts +136 -79
@@ -0,0 +1,71 @@
1
+ import {
2
+ IsBoolean,
3
+ IsDateString,
4
+ IsEnum,
5
+ IsNumber,
6
+ IsObject,
7
+ IsOptional,
8
+ IsString,
9
+ Max,
10
+ Min,
11
+ } from 'class-validator';
12
+
13
+ export enum NotificationType {
14
+ Info = 'info',
15
+ Success = 'success',
16
+ Warning = 'warning',
17
+ Error = 'error',
18
+ Progress = 'progress',
19
+ }
20
+
21
+ export enum NotificationActionType {
22
+ Url = 'url',
23
+ Sheet = 'sheet',
24
+ Modal = 'modal',
25
+ }
26
+
27
+ export class CreateNotificationDto {
28
+ @IsNumber()
29
+ user_id: number;
30
+
31
+ @IsString()
32
+ title: string;
33
+
34
+ @IsOptional()
35
+ @IsString()
36
+ body?: string;
37
+
38
+ @IsOptional()
39
+ @IsString()
40
+ icon?: string;
41
+
42
+ @IsOptional()
43
+ @IsEnum(NotificationType)
44
+ type?: NotificationType;
45
+
46
+ @IsOptional()
47
+ @IsEnum(NotificationActionType)
48
+ action_type?: NotificationActionType;
49
+
50
+ @IsOptional()
51
+ @IsObject()
52
+ action_data?: Record<string, unknown>;
53
+
54
+ @IsOptional()
55
+ @IsString()
56
+ action_url?: string;
57
+
58
+ @IsOptional()
59
+ @IsBoolean()
60
+ auto_remove?: boolean;
61
+
62
+ @IsOptional()
63
+ @IsNumber()
64
+ @Min(0)
65
+ @Max(100)
66
+ progress?: number;
67
+
68
+ @IsOptional()
69
+ @IsDateString()
70
+ started_at?: string;
71
+ }
@@ -0,0 +1,16 @@
1
+ import { IsBoolean, IsNumber, IsOptional, IsString, Max, Min } from 'class-validator';
2
+
3
+ export class UpdateProgressDto {
4
+ @IsNumber()
5
+ @Min(0)
6
+ @Max(100)
7
+ progress: number;
8
+
9
+ @IsOptional()
10
+ @IsString()
11
+ body?: string;
12
+
13
+ @IsOptional()
14
+ @IsBoolean()
15
+ success?: boolean;
16
+ }
@@ -0,0 +1,83 @@
1
+ import { Role, User } from '@hed-hog/api';
2
+ import { Pagination } from '@hed-hog/api-pagination';
3
+ import {
4
+ Body,
5
+ Controller,
6
+ Delete,
7
+ Get,
8
+ Param,
9
+ ParseIntPipe,
10
+ Patch,
11
+ Post,
12
+ Req,
13
+ Res,
14
+ } from '@nestjs/common';
15
+ import type { Request, Response } from 'express';
16
+ import { CreateNotificationDto } from './dto/create-notification.dto';
17
+ import { UpdateProgressDto } from './dto/update-progress.dto';
18
+ import { NotificationService } from './notification.service';
19
+
20
+ @Role()
21
+ @Controller('notification')
22
+ export class NotificationController {
23
+ constructor(private readonly notificationService: NotificationService) {}
24
+
25
+ @Get()
26
+ async list(@User() { id }, @Pagination() paginationParams) {
27
+ return this.notificationService.list(id, paginationParams);
28
+ }
29
+
30
+ @Get('stream')
31
+ async stream(
32
+ @User() { id },
33
+ @Req() req: Request,
34
+ @Res() res: Response,
35
+ ) {
36
+ return this.notificationService.stream(id, req, res);
37
+ }
38
+
39
+ @Get('unread-count')
40
+ async unreadCount(@User() { id }) {
41
+ return this.notificationService.unreadCount(id);
42
+ }
43
+
44
+ @Patch('read-all')
45
+ async markAllRead(@User() { id }) {
46
+ return this.notificationService.markAllRead(id);
47
+ }
48
+
49
+ @Patch(':id/read')
50
+ async markRead(
51
+ @User() { id: userId },
52
+ @Param('id', ParseIntPipe) id: number,
53
+ ) {
54
+ return this.notificationService.markRead(userId, id);
55
+ }
56
+
57
+ @Patch(':id/progress')
58
+ async updateProgress(
59
+ @User() { id: userId },
60
+ @Param('id', ParseIntPipe) id: number,
61
+ @Body() dto: UpdateProgressDto,
62
+ ) {
63
+ return this.notificationService.updateProgress(userId, id, dto);
64
+ }
65
+
66
+ @Delete()
67
+ async deleteAll(@User() { id }) {
68
+ return this.notificationService.deleteAll(id);
69
+ }
70
+
71
+ @Delete(':id')
72
+ async delete(
73
+ @User() { id: userId },
74
+ @Param('id', ParseIntPipe) id: number,
75
+ ) {
76
+ return this.notificationService.delete(userId, id);
77
+ }
78
+
79
+ @Post()
80
+ async create(@Body() data: CreateNotificationDto) {
81
+ return this.notificationService.create(data);
82
+ }
83
+ }
@@ -0,0 +1,16 @@
1
+ import { PaginationModule } from '@hed-hog/api-pagination';
2
+ import { PrismaModule } from '@hed-hog/api-prisma';
3
+ import { forwardRef, Module } from '@nestjs/common';
4
+ import { NotificationController } from './notification.controller';
5
+ import { NotificationService } from './notification.service';
6
+
7
+ @Module({
8
+ imports: [
9
+ forwardRef(() => PrismaModule),
10
+ forwardRef(() => PaginationModule),
11
+ ],
12
+ controllers: [NotificationController],
13
+ providers: [NotificationService],
14
+ exports: [NotificationService],
15
+ })
16
+ export class NotificationModule {}
@@ -0,0 +1,324 @@
1
+ import { PaginationService } from '@hed-hog/api-pagination';
2
+ import { PrismaService } from '@hed-hog/api-prisma';
3
+ import {
4
+ ForbiddenException,
5
+ forwardRef,
6
+ Inject,
7
+ Injectable,
8
+ Logger,
9
+ NotFoundException,
10
+ OnModuleDestroy,
11
+ OnModuleInit,
12
+ } from '@nestjs/common';
13
+ import type { Request, Response } from 'express';
14
+ import { randomUUID } from 'node:crypto';
15
+ import { EventEmitter } from 'node:events';
16
+ import { Client, type Notification as PgNotification } from 'pg';
17
+ import { CreateNotificationDto } from './dto/create-notification.dto';
18
+ import { UpdateProgressDto } from './dto/update-progress.dto';
19
+
20
+ type NotificationStreamEventType =
21
+ | 'ready'
22
+ | 'notification.created'
23
+ | 'notification.updated';
24
+
25
+ type NotificationStreamEvent = {
26
+ type: NotificationStreamEventType;
27
+ notificationId?: number;
28
+ notification?: unknown;
29
+ };
30
+
31
+ type ClusterNotificationPayload = NotificationStreamEvent & {
32
+ userId: number;
33
+ originInstanceId: string;
34
+ };
35
+
36
+ @Injectable()
37
+ export class NotificationService implements OnModuleInit, OnModuleDestroy {
38
+ private readonly logger = new Logger(NotificationService.name);
39
+ private readonly notificationEvents = new EventEmitter();
40
+ private readonly instanceId = randomUUID();
41
+ private readonly channelName = 'notification_events';
42
+ private pgClient: Client | null = null;
43
+
44
+ constructor(
45
+ @Inject(forwardRef(() => PrismaService))
46
+ private readonly prisma: PrismaService,
47
+ @Inject(forwardRef(() => PaginationService))
48
+ private readonly pagination: PaginationService,
49
+ ) {
50
+ this.notificationEvents.setMaxListeners(0);
51
+ }
52
+
53
+ async onModuleInit() {
54
+ const databaseUrl = String(process.env.DATABASE_URL || '');
55
+ if (!databaseUrl.startsWith('postgresql://')) {
56
+ this.logger.warn(
57
+ 'Cluster notification stream disabled because DATABASE_URL is not PostgreSQL',
58
+ );
59
+ return;
60
+ }
61
+
62
+ this.pgClient = new Client({ connectionString: databaseUrl });
63
+ this.pgClient.on('notification', (message: PgNotification) => {
64
+ this.handleClusterNotification(message);
65
+ });
66
+ this.pgClient.on('error', (error) => {
67
+ this.logger.error('Cluster notification listener error', error);
68
+ });
69
+
70
+ await this.pgClient.connect();
71
+ await this.pgClient.query(`LISTEN ${this.channelName}`);
72
+ this.logger.log(
73
+ `Cluster notification listener ready on channel ${this.channelName}`,
74
+ );
75
+ }
76
+
77
+ async onModuleDestroy() {
78
+ if (!this.pgClient) {
79
+ return;
80
+ }
81
+
82
+ try {
83
+ await this.pgClient.query(`UNLISTEN ${this.channelName}`);
84
+ } catch (error) {
85
+ this.logger.warn('Failed to unlisten notification channel', error as any);
86
+ }
87
+
88
+ try {
89
+ await this.pgClient.end();
90
+ } finally {
91
+ this.pgClient = null;
92
+ }
93
+ }
94
+
95
+ async list(userId: number, paginationParams: any) {
96
+ return this.pagination.paginate(
97
+ this.prisma.notification,
98
+ paginationParams,
99
+ {
100
+ where: { user_id: userId },
101
+ orderBy: { created_at: 'desc' },
102
+ },
103
+ );
104
+ }
105
+
106
+ async unreadCount(userId: number) {
107
+ const count = await this.prisma.notification.count({
108
+ where: { user_id: userId, status: 'unread' },
109
+ });
110
+ return { count };
111
+ }
112
+
113
+ async markRead(userId: number, id: number) {
114
+ const notification = await this.assertOwnership(userId, id);
115
+ if (notification.auto_remove) {
116
+ const deleted = await this.prisma.notification.delete({ where: { id } });
117
+ await this.broadcastNotificationEvent(userId, {
118
+ type: 'notification.updated',
119
+ notificationId: id,
120
+ });
121
+ return deleted;
122
+ }
123
+ const updated = await this.prisma.notification.update({
124
+ where: { id },
125
+ data: { status: 'read' },
126
+ });
127
+ await this.broadcastNotificationEvent(userId, {
128
+ type: 'notification.updated',
129
+ notificationId: id,
130
+ });
131
+ return updated;
132
+ }
133
+
134
+ async markAllRead(userId: number) {
135
+ await this.prisma.notification.deleteMany({
136
+ where: { user_id: userId, status: 'unread', auto_remove: true },
137
+ });
138
+ const updated = await this.prisma.notification.updateMany({
139
+ where: { user_id: userId, status: 'unread' },
140
+ data: { status: 'read' },
141
+ });
142
+ await this.broadcastNotificationEvent(userId, { type: 'notification.updated' });
143
+ return updated;
144
+ }
145
+
146
+ async delete(userId: number, id: number) {
147
+ await this.assertOwnership(userId, id);
148
+ const deleted = await this.prisma.notification.delete({ where: { id } });
149
+ await this.broadcastNotificationEvent(userId, {
150
+ type: 'notification.updated',
151
+ notificationId: id,
152
+ });
153
+ return deleted;
154
+ }
155
+
156
+ async deleteAll(userId: number) {
157
+ const result = await this.prisma.notification.deleteMany({
158
+ where: { user_id: userId },
159
+ });
160
+ await this.broadcastNotificationEvent(userId, { type: 'notification.updated' });
161
+ return result;
162
+ }
163
+
164
+ async create(data: CreateNotificationDto) {
165
+ const notification = await this.prisma.notification.create({
166
+ data: {
167
+ user_id: data.user_id,
168
+ title: data.title,
169
+ body: data.body,
170
+ icon: data.icon,
171
+ type: (data.type as any) ?? 'info',
172
+ action_type: (data.action_type as any) ?? 'url',
173
+ action_data: data.action_data as any,
174
+ action_url: data.action_url,
175
+ auto_remove: data.auto_remove ?? false,
176
+ progress: data.progress,
177
+ started_at: data.started_at ? new Date(data.started_at) : undefined,
178
+ },
179
+ });
180
+ await this.broadcastNotificationEvent(data.user_id, {
181
+ type: 'notification.created',
182
+ notificationId: notification.id,
183
+ notification,
184
+ });
185
+ return notification;
186
+ }
187
+
188
+ async updateProgress(userId: number, id: number, dto: UpdateProgressDto) {
189
+ await this.assertOwnership(userId, id);
190
+ const finished = dto.progress >= 100;
191
+ const notification = await this.prisma.notification.update({
192
+ where: { id },
193
+ data: {
194
+ progress: dto.progress,
195
+ body: dto.body,
196
+ type: finished ? (dto.success === false ? 'error' : 'success') as any : undefined,
197
+ finished_at: finished ? new Date() : undefined,
198
+ },
199
+ });
200
+ await this.broadcastNotificationEvent(userId, {
201
+ type: 'notification.updated',
202
+ notificationId: id,
203
+ notification,
204
+ });
205
+ return notification;
206
+ }
207
+
208
+ stream(userId: number, req: Request, res: Response) {
209
+ res.setHeader('Content-Type', 'text/event-stream; charset=utf-8');
210
+ res.setHeader('Cache-Control', 'no-cache, no-transform');
211
+ res.setHeader('Connection', 'keep-alive');
212
+ res.setHeader('X-Accel-Buffering', 'no');
213
+ res.flushHeaders();
214
+
215
+ const writeEvent = (event: NotificationStreamEvent) => {
216
+ if (res.writableEnded) {
217
+ return;
218
+ }
219
+
220
+ res.write(`event: ${event.type}\n`);
221
+ res.write(`data: ${JSON.stringify(event)}\n\n`);
222
+ };
223
+
224
+ const eventKey = this.getEventKey(userId);
225
+ const handler = (event: NotificationStreamEvent) => {
226
+ writeEvent(event);
227
+ };
228
+
229
+ this.notificationEvents.on(eventKey, handler);
230
+ writeEvent({ type: 'ready' });
231
+
232
+ const heartbeat = setInterval(() => {
233
+ if (!res.writableEnded) {
234
+ res.write(': ping\n\n');
235
+ }
236
+ }, 25000);
237
+
238
+ const cleanup = () => {
239
+ clearInterval(heartbeat);
240
+ this.notificationEvents.off(eventKey, handler);
241
+ };
242
+
243
+ req.on('close', cleanup);
244
+ res.on('close', cleanup);
245
+ }
246
+
247
+ async clearOldNotifications(retentionDays: number, batchLimit: number) {
248
+ return this.prisma.$executeRawUnsafe(
249
+ `WITH del AS (
250
+ SELECT id FROM notification
251
+ WHERE created_at < NOW() - INTERVAL '${retentionDays} days'
252
+ ORDER BY id
253
+ LIMIT ${batchLimit}
254
+ )
255
+ DELETE FROM notification n
256
+ USING del WHERE n.id = del.id`,
257
+ );
258
+ }
259
+
260
+ private async assertOwnership(userId: number, id: number) {
261
+ const notification = await this.prisma.notification.findUnique({
262
+ where: { id },
263
+ select: { user_id: true, auto_remove: true },
264
+ });
265
+ if (!notification) throw new NotFoundException();
266
+ if (notification.user_id !== userId) throw new ForbiddenException();
267
+ return notification;
268
+ }
269
+
270
+ private async broadcastNotificationEvent(
271
+ userId: number,
272
+ event: NotificationStreamEvent,
273
+ ) {
274
+ this.emitLocalNotificationEvent(userId, event);
275
+
276
+ const payload: ClusterNotificationPayload = {
277
+ ...event,
278
+ userId,
279
+ originInstanceId: this.instanceId,
280
+ };
281
+
282
+ try {
283
+ await this.prisma.$executeRaw`
284
+ SELECT pg_notify(${this.channelName}, ${JSON.stringify(payload)})
285
+ `;
286
+ } catch (error) {
287
+ this.logger.warn('Failed to broadcast notification event', error as any);
288
+ }
289
+ }
290
+
291
+ private getEventKey(userId: number) {
292
+ return `notification:${userId}`;
293
+ }
294
+
295
+ private emitLocalNotificationEvent(
296
+ userId: number,
297
+ event: NotificationStreamEvent,
298
+ ) {
299
+ this.notificationEvents.emit(this.getEventKey(userId), event);
300
+ }
301
+
302
+ private handleClusterNotification(message: PgNotification) {
303
+ if (message.channel !== this.channelName || !message.payload) {
304
+ return;
305
+ }
306
+
307
+ let payload: ClusterNotificationPayload;
308
+ try {
309
+ payload = JSON.parse(message.payload) as ClusterNotificationPayload;
310
+ } catch {
311
+ return;
312
+ }
313
+
314
+ if (!payload || payload.originInstanceId === this.instanceId) {
315
+ return;
316
+ }
317
+
318
+ this.emitLocalNotificationEvent(payload.userId, {
319
+ type: payload.type,
320
+ notificationId: payload.notificationId,
321
+ notification: payload.notification,
322
+ });
323
+ }
324
+ }
@@ -182,7 +182,7 @@ export class PdfService {
182
182
 
183
183
  if (missingRuntime) {
184
184
  throw new InternalServerErrorException(
185
- 'Playwright runtime is not available. Run `npx playwright install chromium` in apps/api.',
185
+ 'Playwright runtime is not available. Run `pnpm --filter api run playwright:install` in the API environment.',
186
186
  );
187
187
  }
188
188
 
@@ -81,7 +81,7 @@ export class ProfileController {
81
81
 
82
82
  @Post('mfa/email/verify/confirm')
83
83
  sendEmailVerificationMfaConfirm(@User() {id}, @Body() data: EmailVerificationDto, @Locale() locale: string) {
84
- console.log('sendEmailVerificationMfaConfirm')
84
+
85
85
  return this.profileService.confirmEmailVerificationMfa(locale, id, data);
86
86
  }
87
87
 
@@ -17,5 +17,6 @@ import { ProfileService } from './profile.service';
17
17
  ],
18
18
  controllers: [ProfileController],
19
19
  providers: [ProfileService],
20
+ exports: [ProfileService],
20
21
  })
21
22
  export class ProfileModule {}
@@ -0,0 +1,32 @@
1
+ import { Type } from 'class-transformer';
2
+ import {
3
+ IsArray,
4
+ IsInt,
5
+ IsOptional,
6
+ IsString,
7
+ Length,
8
+ ValidateNested,
9
+ } from 'class-validator';
10
+
11
+ export class UpdateSettingListItemDTO {
12
+ @IsOptional()
13
+ @Type(() => Number)
14
+ @IsInt()
15
+ id?: number;
16
+
17
+ @IsString()
18
+ @Length(1, 255)
19
+ value: string;
20
+
21
+ @IsOptional()
22
+ @Type(() => Number)
23
+ @IsInt()
24
+ order?: number;
25
+ }
26
+
27
+ export class UpdateSettingListDTO {
28
+ @IsArray()
29
+ @ValidateNested({ each: true })
30
+ @Type(() => UpdateSettingListItemDTO)
31
+ options: UpdateSettingListItemDTO[];
32
+ }
@@ -27,6 +27,7 @@ import { DeleteDTO } from './dto/delete.dto';
27
27
  import { ExportDto } from './dto/export.dto';
28
28
  import { SettingUserDTO } from './dto/setting-user.dto';
29
29
  import { SettingDTO } from './dto/setting.dto';
30
+ import { UpdateSettingListDTO } from './dto/update-setting-list.dto';
30
31
  import { UpdateDTO } from './dto/update.dto';
31
32
  import { SettingService } from './setting.service';
32
33
 
@@ -124,6 +125,14 @@ export class SettingsController {
124
125
  return this.settingService.updateFromSlug(slug, data);
125
126
  }
126
127
 
128
+ @Put(':settingId/options')
129
+ async updateSettingListOptions(
130
+ @Param('settingId', ParseIntPipe) settingId: number,
131
+ @Body() data: UpdateSettingListDTO,
132
+ ) {
133
+ return this.settingService.updateSettingListOptions(settingId, data);
134
+ }
135
+
127
136
  @Put()
128
137
  async setManySettings(@Body() data: SettingDTO) {
129
138
  return this.settingService.setManySettings(data);