@marinoscar/platform-api 0.1.0-next.19 → 0.1.0-next.21

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 (437) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +1 -0
  3. package/dist/alerts/alerts-admin.controller.d.ts +40 -0
  4. package/dist/alerts/alerts-admin.controller.d.ts.map +1 -0
  5. package/dist/alerts/alerts-admin.controller.js +297 -0
  6. package/dist/alerts/alerts-admin.controller.js.map +1 -0
  7. package/dist/alerts/alerts-context.service.d.ts +64 -0
  8. package/dist/alerts/alerts-context.service.d.ts.map +1 -0
  9. package/dist/alerts/alerts-context.service.js +190 -0
  10. package/dist/alerts/alerts-context.service.js.map +1 -0
  11. package/dist/alerts/alerts-dispatch.service.d.ts +53 -0
  12. package/dist/alerts/alerts-dispatch.service.d.ts.map +1 -0
  13. package/dist/alerts/alerts-dispatch.service.js +135 -0
  14. package/dist/alerts/alerts-dispatch.service.js.map +1 -0
  15. package/dist/alerts/alerts-evaluation.service.d.ts +88 -0
  16. package/dist/alerts/alerts-evaluation.service.d.ts.map +1 -0
  17. package/dist/alerts/alerts-evaluation.service.js +296 -0
  18. package/dist/alerts/alerts-evaluation.service.js.map +1 -0
  19. package/dist/alerts/alerts-event.listener.d.ts +22 -0
  20. package/dist/alerts/alerts-event.listener.d.ts.map +1 -0
  21. package/dist/alerts/alerts-event.listener.js +72 -0
  22. package/dist/alerts/alerts-event.listener.js.map +1 -0
  23. package/dist/alerts/alerts-incidents.service.d.ts +86 -0
  24. package/dist/alerts/alerts-incidents.service.d.ts.map +1 -0
  25. package/dist/alerts/alerts-incidents.service.js +144 -0
  26. package/dist/alerts/alerts-incidents.service.js.map +1 -0
  27. package/dist/alerts/alerts-rules.service.d.ts +73 -0
  28. package/dist/alerts/alerts-rules.service.d.ts.map +1 -0
  29. package/dist/alerts/alerts-rules.service.js +205 -0
  30. package/dist/alerts/alerts-rules.service.js.map +1 -0
  31. package/dist/alerts/alerts-seed.service.d.ts +25 -0
  32. package/dist/alerts/alerts-seed.service.d.ts.map +1 -0
  33. package/dist/alerts/alerts-seed.service.js +82 -0
  34. package/dist/alerts/alerts-seed.service.js.map +1 -0
  35. package/dist/alerts/alerts.constants.d.ts +53 -0
  36. package/dist/alerts/alerts.constants.d.ts.map +1 -0
  37. package/dist/alerts/alerts.constants.js +57 -0
  38. package/dist/alerts/alerts.constants.js.map +1 -0
  39. package/dist/alerts/alerts.errors.d.ts +44 -0
  40. package/dist/alerts/alerts.errors.d.ts.map +1 -0
  41. package/dist/alerts/alerts.errors.js +47 -0
  42. package/dist/alerts/alerts.errors.js.map +1 -0
  43. package/dist/alerts/alerts.metrics.d.ts +60 -0
  44. package/dist/alerts/alerts.metrics.d.ts.map +1 -0
  45. package/dist/alerts/alerts.metrics.js +135 -0
  46. package/dist/alerts/alerts.metrics.js.map +1 -0
  47. package/dist/alerts/alerts.module.d.ts +35 -0
  48. package/dist/alerts/alerts.module.d.ts.map +1 -0
  49. package/dist/alerts/alerts.module.js +96 -0
  50. package/dist/alerts/alerts.module.js.map +1 -0
  51. package/dist/alerts/alerts.options.d.ts +64 -0
  52. package/dist/alerts/alerts.options.d.ts.map +1 -0
  53. package/dist/alerts/alerts.options.js +34 -0
  54. package/dist/alerts/alerts.options.js.map +1 -0
  55. package/dist/alerts/alerts.permissions.d.ts +27 -0
  56. package/dist/alerts/alerts.permissions.d.ts.map +1 -0
  57. package/dist/alerts/alerts.permissions.js +29 -0
  58. package/dist/alerts/alerts.permissions.js.map +1 -0
  59. package/dist/alerts/alerts.types.d.ts +182 -0
  60. package/dist/alerts/alerts.types.d.ts.map +1 -0
  61. package/dist/alerts/alerts.types.js +3 -0
  62. package/dist/alerts/alerts.types.js.map +1 -0
  63. package/dist/alerts/data/alerts-db.d.ts +169 -0
  64. package/dist/alerts/data/alerts-db.d.ts.map +1 -0
  65. package/dist/alerts/data/alerts-db.js +18 -0
  66. package/dist/alerts/data/alerts-db.js.map +1 -0
  67. package/dist/alerts/dto/alerts.dto.d.ts +132 -0
  68. package/dist/alerts/dto/alerts.dto.d.ts.map +1 -0
  69. package/dist/alerts/dto/alerts.dto.js +42 -0
  70. package/dist/alerts/dto/alerts.dto.js.map +1 -0
  71. package/dist/alerts/handlers/alerts-evaluate-event.handler.d.ts +23 -0
  72. package/dist/alerts/handlers/alerts-evaluate-event.handler.d.ts.map +1 -0
  73. package/dist/alerts/handlers/alerts-evaluate-event.handler.js +71 -0
  74. package/dist/alerts/handlers/alerts-evaluate-event.handler.js.map +1 -0
  75. package/dist/alerts/handlers/alerts-evaluate.handler.d.ts +25 -0
  76. package/dist/alerts/handlers/alerts-evaluate.handler.d.ts.map +1 -0
  77. package/dist/alerts/handlers/alerts-evaluate.handler.js +54 -0
  78. package/dist/alerts/handlers/alerts-evaluate.handler.js.map +1 -0
  79. package/dist/alerts/handlers/alerts-incidents-purge.handler.d.ts +29 -0
  80. package/dist/alerts/handlers/alerts-incidents-purge.handler.d.ts.map +1 -0
  81. package/dist/alerts/handlers/alerts-incidents-purge.handler.js +76 -0
  82. package/dist/alerts/handlers/alerts-incidents-purge.handler.js.map +1 -0
  83. package/dist/alerts/index.d.ts +45 -0
  84. package/dist/alerts/index.d.ts.map +1 -0
  85. package/dist/alerts/index.js +108 -0
  86. package/dist/alerts/index.js.map +1 -0
  87. package/dist/alerts/kinds/alert-kind.registry.d.ts +33 -0
  88. package/dist/alerts/kinds/alert-kind.registry.d.ts.map +1 -0
  89. package/dist/alerts/kinds/alert-kind.registry.js +63 -0
  90. package/dist/alerts/kinds/alert-kind.registry.js.map +1 -0
  91. package/dist/alerts/kinds/builtin-kinds.d.ts +18 -0
  92. package/dist/alerts/kinds/builtin-kinds.d.ts.map +1 -0
  93. package/dist/alerts/kinds/builtin-kinds.js +33 -0
  94. package/dist/alerts/kinds/builtin-kinds.js.map +1 -0
  95. package/dist/alerts/kinds/metric-threshold.kind.d.ts +11 -0
  96. package/dist/alerts/kinds/metric-threshold.kind.d.ts.map +1 -0
  97. package/dist/alerts/kinds/metric-threshold.kind.js +63 -0
  98. package/dist/alerts/kinds/metric-threshold.kind.js.map +1 -0
  99. package/dist/alerts/kinds/metric-threshold.sql.d.ts +41 -0
  100. package/dist/alerts/kinds/metric-threshold.sql.d.ts.map +1 -0
  101. package/dist/alerts/kinds/metric-threshold.sql.js +124 -0
  102. package/dist/alerts/kinds/metric-threshold.sql.js.map +1 -0
  103. package/dist/alerts/kinds/node-event.kind.d.ts +44 -0
  104. package/dist/alerts/kinds/node-event.kind.d.ts.map +1 -0
  105. package/dist/alerts/kinds/node-event.kind.js +113 -0
  106. package/dist/alerts/kinds/node-event.kind.js.map +1 -0
  107. package/dist/alerts/kinds/node-offline.kind.d.ts +11 -0
  108. package/dist/alerts/kinds/node-offline.kind.d.ts.map +1 -0
  109. package/dist/alerts/kinds/node-offline.kind.js +41 -0
  110. package/dist/alerts/kinds/node-offline.kind.js.map +1 -0
  111. package/dist/alerts/kinds/telemetry-unavailable.kind.d.ts +11 -0
  112. package/dist/alerts/kinds/telemetry-unavailable.kind.d.ts.map +1 -0
  113. package/dist/alerts/kinds/telemetry-unavailable.kind.js +40 -0
  114. package/dist/alerts/kinds/telemetry-unavailable.kind.js.map +1 -0
  115. package/dist/alerts/kinds/verdict.kind.d.ts +13 -0
  116. package/dist/alerts/kinds/verdict.kind.d.ts.map +1 -0
  117. package/dist/alerts/kinds/verdict.kind.js +34 -0
  118. package/dist/alerts/kinds/verdict.kind.js.map +1 -0
  119. package/dist/alerts/notifications/alerts.notifications.d.ts +77 -0
  120. package/dist/alerts/notifications/alerts.notifications.d.ts.map +1 -0
  121. package/dist/alerts/notifications/alerts.notifications.js +145 -0
  122. package/dist/alerts/notifications/alerts.notifications.js.map +1 -0
  123. package/dist/alerts/starter-rules.d.ts +21 -0
  124. package/dist/alerts/starter-rules.d.ts.map +1 -0
  125. package/dist/alerts/starter-rules.js +141 -0
  126. package/dist/alerts/starter-rules.js.map +1 -0
  127. package/dist/alerts/state/alert-state-machine.d.ts +92 -0
  128. package/dist/alerts/state/alert-state-machine.d.ts.map +1 -0
  129. package/dist/alerts/state/alert-state-machine.js +96 -0
  130. package/dist/alerts/state/alert-state-machine.js.map +1 -0
  131. package/dist/alerts/tasks/alerts-evaluate.task.d.ts +18 -0
  132. package/dist/alerts/tasks/alerts-evaluate.task.d.ts.map +1 -0
  133. package/dist/alerts/tasks/alerts-evaluate.task.js +61 -0
  134. package/dist/alerts/tasks/alerts-evaluate.task.js.map +1 -0
  135. package/dist/alerts/tasks/alerts-purge.task.d.ts +15 -0
  136. package/dist/alerts/tasks/alerts-purge.task.d.ts.map +1 -0
  137. package/dist/alerts/tasks/alerts-purge.task.js +58 -0
  138. package/dist/alerts/tasks/alerts-purge.task.js.map +1 -0
  139. package/dist/alerts/testing/conformance.d.ts +58 -0
  140. package/dist/alerts/testing/conformance.d.ts.map +1 -0
  141. package/dist/alerts/testing/conformance.js +198 -0
  142. package/dist/alerts/testing/conformance.js.map +1 -0
  143. package/dist/alerts/testing/fakes.d.ts +80 -0
  144. package/dist/alerts/testing/fakes.d.ts.map +1 -0
  145. package/dist/alerts/testing/fakes.js +230 -0
  146. package/dist/alerts/testing/fakes.js.map +1 -0
  147. package/dist/alerts/testing/index.d.ts +5 -0
  148. package/dist/alerts/testing/index.d.ts.map +1 -0
  149. package/dist/alerts/testing/index.js +15 -0
  150. package/dist/alerts/testing/index.js.map +1 -0
  151. package/dist/core/index.d.ts +1 -0
  152. package/dist/core/index.d.ts.map +1 -1
  153. package/dist/core/index.js +8 -2
  154. package/dist/core/index.js.map +1 -1
  155. package/dist/core/net/ip-classify.d.ts +39 -0
  156. package/dist/core/net/ip-classify.d.ts.map +1 -0
  157. package/dist/core/net/ip-classify.js +196 -0
  158. package/dist/core/net/ip-classify.js.map +1 -0
  159. package/dist/credentials/testing/conformance.d.ts.map +1 -1
  160. package/dist/credentials/testing/conformance.js +1 -0
  161. package/dist/credentials/testing/conformance.js.map +1 -1
  162. package/dist/jobs/data/jobs-db.d.ts +26 -0
  163. package/dist/jobs/data/jobs-db.d.ts.map +1 -1
  164. package/dist/jobs/index.d.ts +1 -1
  165. package/dist/jobs/index.d.ts.map +1 -1
  166. package/dist/jobs/index.js.map +1 -1
  167. package/dist/manifest/platform-model-ownership.d.ts +1 -1
  168. package/dist/manifest/platform-model-ownership.d.ts.map +1 -1
  169. package/dist/manifest/platform-model-ownership.js +30 -1
  170. package/dist/manifest/platform-model-ownership.js.map +1 -1
  171. package/dist/manifest/platform-permissions.d.ts +6 -2
  172. package/dist/manifest/platform-permissions.d.ts.map +1 -1
  173. package/dist/manifest/platform-permissions.js +56 -44
  174. package/dist/manifest/platform-permissions.js.map +1 -1
  175. package/dist/manifest/platform-user-owned-models.d.ts.map +1 -1
  176. package/dist/manifest/platform-user-owned-models.js +16 -0
  177. package/dist/manifest/platform-user-owned-models.js.map +1 -1
  178. package/dist/nodes/dto/node-admin.dto.d.ts +5 -0
  179. package/dist/nodes/dto/node-admin.dto.d.ts.map +1 -1
  180. package/dist/nodes/dto/node-admin.dto.js +19 -0
  181. package/dist/nodes/dto/node-admin.dto.js.map +1 -1
  182. package/dist/nodes/dto/node-control-plane.dto.d.ts +26 -0
  183. package/dist/nodes/dto/node-control-plane.dto.d.ts.map +1 -1
  184. package/dist/nodes/dto/node-event.dto.d.ts +100 -0
  185. package/dist/nodes/dto/node-event.dto.d.ts.map +1 -0
  186. package/dist/nodes/dto/node-event.dto.js +239 -0
  187. package/dist/nodes/dto/node-event.dto.js.map +1 -0
  188. package/dist/nodes/dto/node-response.dto.d.ts +21 -0
  189. package/dist/nodes/dto/node-response.dto.d.ts.map +1 -1
  190. package/dist/nodes/dto/node-response.dto.js +42 -1
  191. package/dist/nodes/dto/node-response.dto.js.map +1 -1
  192. package/dist/nodes/events/node-event.event.d.ts +41 -0
  193. package/dist/nodes/events/node-event.event.d.ts.map +1 -0
  194. package/dist/nodes/events/node-event.event.js +69 -0
  195. package/dist/nodes/events/node-event.event.js.map +1 -0
  196. package/dist/nodes/handlers/node-events-purge.handler.d.ts +31 -0
  197. package/dist/nodes/handlers/node-events-purge.handler.d.ts.map +1 -0
  198. package/dist/nodes/handlers/node-events-purge.handler.js +91 -0
  199. package/dist/nodes/handlers/node-events-purge.handler.js.map +1 -0
  200. package/dist/nodes/index.d.ts +11 -4
  201. package/dist/nodes/index.d.ts.map +1 -1
  202. package/dist/nodes/index.js +20 -1
  203. package/dist/nodes/index.js.map +1 -1
  204. package/dist/nodes/node-events.service.d.ts +87 -0
  205. package/dist/nodes/node-events.service.d.ts.map +1 -0
  206. package/dist/nodes/node-events.service.js +271 -0
  207. package/dist/nodes/node-events.service.js.map +1 -0
  208. package/dist/nodes/node-fleet-metrics.service.d.ts +10 -1
  209. package/dist/nodes/node-fleet-metrics.service.d.ts.map +1 -1
  210. package/dist/nodes/node-fleet-metrics.service.js +31 -0
  211. package/dist/nodes/node-fleet-metrics.service.js.map +1 -1
  212. package/dist/nodes/node-lifecycle.service.d.ts +16 -1
  213. package/dist/nodes/node-lifecycle.service.d.ts.map +1 -1
  214. package/dist/nodes/node-lifecycle.service.js +7 -0
  215. package/dist/nodes/node-lifecycle.service.js.map +1 -1
  216. package/dist/nodes/nodes-admin.controller.d.ts +5 -1
  217. package/dist/nodes/nodes-admin.controller.d.ts.map +1 -1
  218. package/dist/nodes/nodes-admin.controller.js +32 -2
  219. package/dist/nodes/nodes-admin.controller.js.map +1 -1
  220. package/dist/nodes/nodes.controller.d.ts +7 -3
  221. package/dist/nodes/nodes.controller.d.ts.map +1 -1
  222. package/dist/nodes/nodes.controller.js +46 -6
  223. package/dist/nodes/nodes.controller.js.map +1 -1
  224. package/dist/nodes/nodes.metrics.d.ts +23 -1
  225. package/dist/nodes/nodes.metrics.d.ts.map +1 -1
  226. package/dist/nodes/nodes.metrics.js +80 -1
  227. package/dist/nodes/nodes.metrics.js.map +1 -1
  228. package/dist/nodes/nodes.module.d.ts.map +1 -1
  229. package/dist/nodes/nodes.module.js +6 -0
  230. package/dist/nodes/nodes.module.js.map +1 -1
  231. package/dist/nodes/nodes.options.d.ts +17 -0
  232. package/dist/nodes/nodes.options.d.ts.map +1 -1
  233. package/dist/nodes/nodes.options.js +13 -2
  234. package/dist/nodes/nodes.options.js.map +1 -1
  235. package/dist/nodes/nodes.service.d.ts +3 -1
  236. package/dist/nodes/nodes.service.d.ts.map +1 -1
  237. package/dist/nodes/nodes.service.js +14 -3
  238. package/dist/nodes/nodes.service.js.map +1 -1
  239. package/dist/nodes/tasks/node-events-purge.task.d.ts +13 -0
  240. package/dist/nodes/tasks/node-events-purge.task.d.ts.map +1 -0
  241. package/dist/nodes/tasks/node-events-purge.task.js +73 -0
  242. package/dist/nodes/tasks/node-events-purge.task.js.map +1 -0
  243. package/dist/telemetry/dashboard/telemetry-dashboard.service.d.ts +30 -8
  244. package/dist/telemetry/dashboard/telemetry-dashboard.service.d.ts.map +1 -1
  245. package/dist/telemetry/dashboard/telemetry-dashboard.service.js +12 -0
  246. package/dist/telemetry/dashboard/telemetry-dashboard.service.js.map +1 -1
  247. package/dist/telemetry/dashboard/telemetry-dashboard.verdict.d.ts +15 -0
  248. package/dist/telemetry/dashboard/telemetry-dashboard.verdict.d.ts.map +1 -1
  249. package/dist/telemetry/dashboard/telemetry-dashboard.verdict.js +17 -2
  250. package/dist/telemetry/dashboard/telemetry-dashboard.verdict.js.map +1 -1
  251. package/dist/telemetry/dto/telemetry-dashboard.dto.d.ts +3 -3
  252. package/dist/telemetry/index.d.ts +4 -2
  253. package/dist/telemetry/index.d.ts.map +1 -1
  254. package/dist/telemetry/index.js +4 -1
  255. package/dist/telemetry/index.js.map +1 -1
  256. package/dist/telemetry/metrics/groups/nodes.metric-group.d.ts.map +1 -1
  257. package/dist/telemetry/metrics/groups/nodes.metric-group.js +77 -0
  258. package/dist/telemetry/metrics/groups/nodes.metric-group.js.map +1 -1
  259. package/dist/telemetry/metrics/metric-verdict.d.ts +1 -1
  260. package/dist/telemetry/metrics/metric-verdict.d.ts.map +1 -1
  261. package/dist/telemetry/metrics/metric-verdict.js +15 -1
  262. package/dist/telemetry/metrics/metric-verdict.js.map +1 -1
  263. package/dist/telemetry/query/telemetry-query-facade.d.ts +1 -1
  264. package/dist/telemetry/query/telemetry-query-facade.d.ts.map +1 -1
  265. package/dist/telemetry/query/telemetry-query-facade.js.map +1 -1
  266. package/dist/telemetry/query/telemetry-query.service.d.ts +2 -2
  267. package/dist/telemetry/query/telemetry-query.service.d.ts.map +1 -1
  268. package/dist/telemetry/query/telemetry-query.service.js +4 -0
  269. package/dist/telemetry/query/telemetry-query.service.js.map +1 -1
  270. package/dist/telemetry/stack/dto/telemetry-stack.dto.d.ts +1 -1
  271. package/dist/telemetry/telemetry-support-bundle.section.d.ts +4 -4
  272. package/dist/telemetry/telemetry.module.d.ts.map +1 -1
  273. package/dist/telemetry/telemetry.module.js +1 -0
  274. package/dist/telemetry/telemetry.module.js.map +1 -1
  275. package/dist/telemetry/testing/metric-schema.fixture.d.ts.map +1 -1
  276. package/dist/telemetry/testing/metric-schema.fixture.js +56 -0
  277. package/dist/telemetry/testing/metric-schema.fixture.js.map +1 -1
  278. package/dist/user-data/platform-user-data.d.ts.map +1 -1
  279. package/dist/user-data/platform-user-data.js +2 -0
  280. package/dist/user-data/platform-user-data.js.map +1 -1
  281. package/dist/webhooks/data/webhooks-db.d.ts +176 -0
  282. package/dist/webhooks/data/webhooks-db.d.ts.map +1 -0
  283. package/dist/webhooks/data/webhooks-db.js +14 -0
  284. package/dist/webhooks/data/webhooks-db.js.map +1 -0
  285. package/dist/webhooks/egress/egress-guard.d.ts +99 -0
  286. package/dist/webhooks/egress/egress-guard.d.ts.map +1 -0
  287. package/dist/webhooks/egress/egress-guard.js +172 -0
  288. package/dist/webhooks/egress/egress-guard.js.map +1 -0
  289. package/dist/webhooks/egress/transport.d.ts +58 -0
  290. package/dist/webhooks/egress/transport.d.ts.map +1 -0
  291. package/dist/webhooks/egress/transport.js +115 -0
  292. package/dist/webhooks/egress/transport.js.map +1 -0
  293. package/dist/webhooks/handlers/webhook-deliver.handler.d.ts +76 -0
  294. package/dist/webhooks/handlers/webhook-deliver.handler.d.ts.map +1 -0
  295. package/dist/webhooks/handlers/webhook-deliver.handler.js +333 -0
  296. package/dist/webhooks/handlers/webhook-deliver.handler.js.map +1 -0
  297. package/dist/webhooks/handlers/webhook-fanout.handler.d.ts +28 -0
  298. package/dist/webhooks/handlers/webhook-fanout.handler.d.ts.map +1 -0
  299. package/dist/webhooks/handlers/webhook-fanout.handler.js +73 -0
  300. package/dist/webhooks/handlers/webhook-fanout.handler.js.map +1 -0
  301. package/dist/webhooks/handlers/webhook-purge.handler.d.ts +33 -0
  302. package/dist/webhooks/handlers/webhook-purge.handler.d.ts.map +1 -0
  303. package/dist/webhooks/handlers/webhook-purge.handler.js +77 -0
  304. package/dist/webhooks/handlers/webhook-purge.handler.js.map +1 -0
  305. package/dist/webhooks/http/admin-webhooks.controller.d.ts +36 -0
  306. package/dist/webhooks/http/admin-webhooks.controller.d.ts.map +1 -0
  307. package/dist/webhooks/http/admin-webhooks.controller.js +250 -0
  308. package/dist/webhooks/http/admin-webhooks.controller.js.map +1 -0
  309. package/dist/webhooks/http/org-webhooks.controller.d.ts +36 -0
  310. package/dist/webhooks/http/org-webhooks.controller.d.ts.map +1 -0
  311. package/dist/webhooks/http/org-webhooks.controller.js +249 -0
  312. package/dist/webhooks/http/org-webhooks.controller.js.map +1 -0
  313. package/dist/webhooks/http/scope-context.d.ts +17 -0
  314. package/dist/webhooks/http/scope-context.d.ts.map +1 -0
  315. package/dist/webhooks/http/scope-context.js +28 -0
  316. package/dist/webhooks/http/scope-context.js.map +1 -0
  317. package/dist/webhooks/http/webhook.dto.d.ts +174 -0
  318. package/dist/webhooks/http/webhook.dto.d.ts.map +1 -0
  319. package/dist/webhooks/http/webhook.dto.js +58 -0
  320. package/dist/webhooks/http/webhook.dto.js.map +1 -0
  321. package/dist/webhooks/http/webhooks.controller.d.ts +36 -0
  322. package/dist/webhooks/http/webhooks.controller.d.ts.map +1 -0
  323. package/dist/webhooks/http/webhooks.controller.js +243 -0
  324. package/dist/webhooks/http/webhooks.controller.js.map +1 -0
  325. package/dist/webhooks/index.d.ts +43 -0
  326. package/dist/webhooks/index.d.ts.map +1 -0
  327. package/dist/webhooks/index.js +147 -0
  328. package/dist/webhooks/index.js.map +1 -0
  329. package/dist/webhooks/listeners/webhook-event.listeners.d.ts +23 -0
  330. package/dist/webhooks/listeners/webhook-event.listeners.d.ts.map +1 -0
  331. package/dist/webhooks/listeners/webhook-event.listeners.js +120 -0
  332. package/dist/webhooks/listeners/webhook-event.listeners.js.map +1 -0
  333. package/dist/webhooks/notifications/webhook-notification.channel.d.ts +31 -0
  334. package/dist/webhooks/notifications/webhook-notification.channel.d.ts.map +1 -0
  335. package/dist/webhooks/notifications/webhook-notification.channel.js +127 -0
  336. package/dist/webhooks/notifications/webhook-notification.channel.js.map +1 -0
  337. package/dist/webhooks/notifications/webhook-notifications.d.ts +98 -0
  338. package/dist/webhooks/notifications/webhook-notifications.d.ts.map +1 -0
  339. package/dist/webhooks/notifications/webhook-notifications.js +150 -0
  340. package/dist/webhooks/notifications/webhook-notifications.js.map +1 -0
  341. package/dist/webhooks/ports.d.ts +29 -0
  342. package/dist/webhooks/ports.d.ts.map +1 -0
  343. package/dist/webhooks/ports.js +23 -0
  344. package/dist/webhooks/ports.js.map +1 -0
  345. package/dist/webhooks/registry/builtin-events.d.ts +57 -0
  346. package/dist/webhooks/registry/builtin-events.d.ts.map +1 -0
  347. package/dist/webhooks/registry/builtin-events.js +113 -0
  348. package/dist/webhooks/registry/builtin-events.js.map +1 -0
  349. package/dist/webhooks/registry/webhook-catalog.d.ts +63 -0
  350. package/dist/webhooks/registry/webhook-catalog.d.ts.map +1 -0
  351. package/dist/webhooks/registry/webhook-catalog.js +123 -0
  352. package/dist/webhooks/registry/webhook-catalog.js.map +1 -0
  353. package/dist/webhooks/registry/webhook-event.registry.d.ts +116 -0
  354. package/dist/webhooks/registry/webhook-event.registry.d.ts.map +1 -0
  355. package/dist/webhooks/registry/webhook-event.registry.js +152 -0
  356. package/dist/webhooks/registry/webhook-event.registry.js.map +1 -0
  357. package/dist/webhooks/signing.d.ts +31 -0
  358. package/dist/webhooks/signing.d.ts.map +1 -0
  359. package/dist/webhooks/signing.js +48 -0
  360. package/dist/webhooks/signing.js.map +1 -0
  361. package/dist/webhooks/tasks/webhook-purge.task.d.ts +17 -0
  362. package/dist/webhooks/tasks/webhook-purge.task.d.ts.map +1 -0
  363. package/dist/webhooks/tasks/webhook-purge.task.js +68 -0
  364. package/dist/webhooks/tasks/webhook-purge.task.js.map +1 -0
  365. package/dist/webhooks/testing/conformance.d.ts +61 -0
  366. package/dist/webhooks/testing/conformance.d.ts.map +1 -0
  367. package/dist/webhooks/testing/conformance.js +316 -0
  368. package/dist/webhooks/testing/conformance.js.map +1 -0
  369. package/dist/webhooks/testing/in-memory.d.ts +156 -0
  370. package/dist/webhooks/testing/in-memory.d.ts.map +1 -0
  371. package/dist/webhooks/testing/in-memory.js +323 -0
  372. package/dist/webhooks/testing/in-memory.js.map +1 -0
  373. package/dist/webhooks/testing/index.d.ts +7 -0
  374. package/dist/webhooks/testing/index.d.ts.map +1 -0
  375. package/dist/webhooks/testing/index.js +25 -0
  376. package/dist/webhooks/testing/index.js.map +1 -0
  377. package/dist/webhooks/testing/kit.d.ts +86 -0
  378. package/dist/webhooks/testing/kit.d.ts.map +1 -0
  379. package/dist/webhooks/testing/kit.js +113 -0
  380. package/dist/webhooks/testing/kit.js.map +1 -0
  381. package/dist/webhooks/webhook-endpoints.service.d.ts +142 -0
  382. package/dist/webhooks/webhook-endpoints.service.d.ts.map +1 -0
  383. package/dist/webhooks/webhook-endpoints.service.js +366 -0
  384. package/dist/webhooks/webhook-endpoints.service.js.map +1 -0
  385. package/dist/webhooks/webhook-envelope.d.ts +36 -0
  386. package/dist/webhooks/webhook-envelope.d.ts.map +1 -0
  387. package/dist/webhooks/webhook-envelope.js +46 -0
  388. package/dist/webhooks/webhook-envelope.js.map +1 -0
  389. package/dist/webhooks/webhook-secrets.service.d.ts +49 -0
  390. package/dist/webhooks/webhook-secrets.service.d.ts.map +1 -0
  391. package/dist/webhooks/webhook-secrets.service.js +118 -0
  392. package/dist/webhooks/webhook-secrets.service.js.map +1 -0
  393. package/dist/webhooks/webhook-views.d.ts +34 -0
  394. package/dist/webhooks/webhook-views.d.ts.map +1 -0
  395. package/dist/webhooks/webhook-views.js +83 -0
  396. package/dist/webhooks/webhook-views.js.map +1 -0
  397. package/dist/webhooks/webhooks.access.d.ts +28 -0
  398. package/dist/webhooks/webhooks.access.d.ts.map +1 -0
  399. package/dist/webhooks/webhooks.access.js +55 -0
  400. package/dist/webhooks/webhooks.access.js.map +1 -0
  401. package/dist/webhooks/webhooks.constants.d.ts +73 -0
  402. package/dist/webhooks/webhooks.constants.d.ts.map +1 -0
  403. package/dist/webhooks/webhooks.constants.js +100 -0
  404. package/dist/webhooks/webhooks.constants.js.map +1 -0
  405. package/dist/webhooks/webhooks.credentials.d.ts +28 -0
  406. package/dist/webhooks/webhooks.credentials.d.ts.map +1 -0
  407. package/dist/webhooks/webhooks.credentials.js +51 -0
  408. package/dist/webhooks/webhooks.credentials.js.map +1 -0
  409. package/dist/webhooks/webhooks.errors.d.ts +25 -0
  410. package/dist/webhooks/webhooks.errors.d.ts.map +1 -0
  411. package/dist/webhooks/webhooks.errors.js +65 -0
  412. package/dist/webhooks/webhooks.errors.js.map +1 -0
  413. package/dist/webhooks/webhooks.metrics.d.ts +24 -0
  414. package/dist/webhooks/webhooks.metrics.d.ts.map +1 -0
  415. package/dist/webhooks/webhooks.metrics.js +70 -0
  416. package/dist/webhooks/webhooks.metrics.js.map +1 -0
  417. package/dist/webhooks/webhooks.module.d.ts +29 -0
  418. package/dist/webhooks/webhooks.module.d.ts.map +1 -0
  419. package/dist/webhooks/webhooks.module.js +108 -0
  420. package/dist/webhooks/webhooks.module.js.map +1 -0
  421. package/dist/webhooks/webhooks.options.d.ts +119 -0
  422. package/dist/webhooks/webhooks.options.d.ts.map +1 -0
  423. package/dist/webhooks/webhooks.options.js +80 -0
  424. package/dist/webhooks/webhooks.options.js.map +1 -0
  425. package/dist/webhooks/webhooks.permissions.d.ts +47 -0
  426. package/dist/webhooks/webhooks.permissions.d.ts.map +1 -0
  427. package/dist/webhooks/webhooks.permissions.js +83 -0
  428. package/dist/webhooks/webhooks.permissions.js.map +1 -0
  429. package/dist/webhooks/webhooks.repository.d.ts +162 -0
  430. package/dist/webhooks/webhooks.repository.d.ts.map +1 -0
  431. package/dist/webhooks/webhooks.repository.js +246 -0
  432. package/dist/webhooks/webhooks.repository.js.map +1 -0
  433. package/dist/webhooks/webhooks.service.d.ts +91 -0
  434. package/dist/webhooks/webhooks.service.d.ts.map +1 -0
  435. package/dist/webhooks/webhooks.service.js +216 -0
  436. package/dist/webhooks/webhooks.service.js.map +1 -0
  437. package/package.json +19 -3
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ // =============================================================================
3
+ // The webhooks slice's notification declarations (issue #1046)
4
+ // =============================================================================
5
+ //
6
+ // Pure data, no side effect: the app registers them from its notification
7
+ // manifest (the reference app: `platform/webhooks/webhooks.notifications.ts`).
8
+ //
9
+ // - the CHANNEL `webhook` ("Webhooks"): a user's notifications, delivered to
10
+ // the user's own webhook endpoints. It appears as a column in the
11
+ // preferences matrix of every event that declares it; `withWebhookChannel`
12
+ // is how an app puts it on events without editing the package;
13
+ // - the EVENT `webhooks.endpoint_disabled`: sent to an endpoint's owner when
14
+ // the platform switches it off (too many failures, or the receiver said
15
+ // 410 Gone), by email and in the bell.
16
+ // =============================================================================
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.WEBHOOKS_NOTIFICATIONS = exports.WEBHOOK_NOTIFICATION_CHANNEL = void 0;
19
+ exports.webhookEndpointDisabledBrowserTemplate = webhookEndpointDisabledBrowserTemplate;
20
+ exports.webhookEndpointDisabledEmail = webhookEndpointDisabledEmail;
21
+ exports.registerWebhooksEmailTemplates = registerWebhooksEmailTemplates;
22
+ exports.withWebhookChannel = withWebhookChannel;
23
+ const index_1 = require("../../email/index");
24
+ const webhooks_constants_1 = require("../webhooks.constants");
25
+ /**
26
+ * The `webhook` channel's registry entry. Its id is persisted in preferences
27
+ * and delivery rows: never rename it.
28
+ *
29
+ * @extensionPoint registry
30
+ * @stability experimental
31
+ */
32
+ exports.WEBHOOK_NOTIFICATION_CHANNEL = Object.freeze({
33
+ id: webhooks_constants_1.WEBHOOK_NOTIFICATION_CHANNEL_ID,
34
+ label: 'Webhooks',
35
+ description: "Sends the notification to your own webhook endpoints as a signed JSON POST.",
36
+ userConfigurable: true,
37
+ criticalCapable: false,
38
+ broadcastDefault: false,
39
+ rendersRawData: true,
40
+ });
41
+ /**
42
+ * The bell and push text of `webhooks.endpoint_disabled`.
43
+ *
44
+ * @param data - the event data.
45
+ * @returns title, body and a root-relative link to the settings page.
46
+ *
47
+ * @stability experimental
48
+ */
49
+ function webhookEndpointDisabledBrowserTemplate(data) {
50
+ const why = data.reason === 'gone' ? 'the receiver answered 410 Gone' : 'it failed too many times in a row';
51
+ return {
52
+ title: 'A webhook endpoint was disabled',
53
+ body: `"${data.endpointName}" (${data.host}) was switched off because ${why}. Fix the receiver, then enable it again.`,
54
+ link: data.scope === 'system' ? '/admin/settings/webhooks' : data.scope === 'org' ? '/admin/settings/org-webhooks' : '/settings/webhooks',
55
+ };
56
+ }
57
+ /**
58
+ * The email of `webhooks.endpoint_disabled`.
59
+ *
60
+ * @param data - the event data; the endpoint name is user-typed and escaped on the way in.
61
+ * @param ctx - the render context.
62
+ * @returns the rendered message.
63
+ *
64
+ * @stability experimental
65
+ */
66
+ function webhookEndpointDisabledEmail(data, ctx) {
67
+ const context = (0, index_1.resolveEmailRenderContext)(ctx);
68
+ const why = data.reason === 'gone' ? 'the receiver answered 410 Gone' : 'it failed too many times in a row';
69
+ const title = 'A webhook endpoint was disabled';
70
+ const summary = `"${data.endpointName}" (${data.host}) was switched off because ${why}.`;
71
+ const bodyHtml = (0, index_1.html) `
72
+ <p style="margin:0 0 16px 0;"><strong>${data.endpointName}</strong> (${data.host}) was switched off because ${why}.</p>
73
+ <p style="margin:0 0 16px 0;">Deliveries to it have stopped. Fix the receiver, then open the webhook settings and enable the endpoint again; its failure count starts over.</p>
74
+ <p style="margin:0;font-size:13px;line-height:20px;color:#4b5563;">You are receiving this because you own this endpoint in ${context.appName}.</p>
75
+ `;
76
+ const htmlDocument = (0, index_1.renderLayout)({ title, previewText: summary, bodyHtml: bodyHtml }, context);
77
+ const text = (0, index_1.plainText)({
78
+ title,
79
+ lines: [summary, '', 'Deliveries to it have stopped. Fix the receiver, then open the webhook settings and enable the endpoint again.', '', `You are receiving this because you own this endpoint in ${context.appName}.`],
80
+ }, context);
81
+ return { subject: `${context.appName}: ${title}`, html: htmlDocument, text, headers: { ...index_1.TRANSACTIONAL_EMAIL_HEADERS } };
82
+ }
83
+ /**
84
+ * Registers the slice's one email template with the email slice's registry.
85
+ * Idempotent. Call it from the notification manifest, after the email render
86
+ * context is configured and before `registerNotifications(WEBHOOKS_NOTIFICATIONS)`.
87
+ *
88
+ * @throws RegistryError `DUPLICATE_ID` when the app registered the name with another renderer; `FROZEN` after bootstrap.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * registerWebhooksEmailTemplates();
93
+ * registerNotifications(WEBHOOKS_NOTIFICATIONS);
94
+ * ```
95
+ *
96
+ * @extensionPoint registry
97
+ * @stability experimental
98
+ */
99
+ function registerWebhooksEmailTemplates() {
100
+ if (index_1.emailTemplateRegistry.get(webhooks_constants_1.WEBHOOK_ENDPOINT_DISABLED_EMAIL_TEMPLATE)?.render === webhookEndpointDisabledEmail)
101
+ return;
102
+ const entry = { name: webhooks_constants_1.WEBHOOK_ENDPOINT_DISABLED_EMAIL_TEMPLATE, render: webhookEndpointDisabledEmail, registrant: 'webhooks' };
103
+ index_1.emailTemplateRegistry.register(entry);
104
+ }
105
+ /**
106
+ * The `webhooks.endpoint_disabled` registration: event, email template name and
107
+ * browser renderer.
108
+ *
109
+ * @stability experimental
110
+ */
111
+ exports.WEBHOOKS_NOTIFICATIONS = Object.freeze([
112
+ {
113
+ event: {
114
+ key: webhooks_constants_1.WEBHOOK_ENDPOINT_DISABLED_EVENT_KEY,
115
+ label: 'Webhook endpoint disabled',
116
+ description: 'Sent to the owner of a webhook endpoint when it is switched off after repeated failures or a 410 Gone.',
117
+ channels: ['email', 'browser'],
118
+ defaultEnabled: true,
119
+ },
120
+ emailTemplate: webhooks_constants_1.WEBHOOK_ENDPOINT_DISABLED_EMAIL_TEMPLATE,
121
+ browserTemplate: webhookEndpointDisabledBrowserTemplate,
122
+ },
123
+ ]);
124
+ /**
125
+ * Puts the `webhook` channel on notification registrations, so a member can
126
+ * forward the event to their endpoints from the preferences matrix. The
127
+ * slice's own `webhooks.endpoint_disabled` is left alone (a webhook about a
128
+ * broken webhook helps no one). The input is not modified.
129
+ *
130
+ * @param registrations - what the manifest would register.
131
+ * @returns the same registrations with `webhook` appended to each event's channels.
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * registerNotifications(withWebhookChannel(AUTH_NOTIFICATIONS));
136
+ * ```
137
+ *
138
+ * @extensionPoint hook
139
+ * @stability experimental
140
+ */
141
+ function withWebhookChannel(registrations) {
142
+ return registrations.map((registration) => {
143
+ const { event } = registration;
144
+ // An event with no channels is invalid: leave it alone so the registry rejects it, rather than the channel masking it.
145
+ if (event.key === webhooks_constants_1.WEBHOOK_ENDPOINT_DISABLED_EVENT_KEY || event.channels.length === 0 || event.channels.includes(webhooks_constants_1.WEBHOOK_NOTIFICATION_CHANNEL_ID))
146
+ return registration;
147
+ return { ...registration, event: { ...event, channels: [...event.channels, webhooks_constants_1.WEBHOOK_NOTIFICATION_CHANNEL_ID] } };
148
+ });
149
+ }
150
+ //# sourceMappingURL=webhook-notifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-notifications.js","sourceRoot":"","sources":["../../../src/webhooks/notifications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;;;;;GAKG;AACU,QAAA,sBAAsB,GAAwC,MAAM,CAAC,MAAM,CAAC;IACvF;QACE,KAAK,EAAE;YACL,GAAG,EAAE,wDAAmC;YACxC,KAAK,EAAE,2BAA2B;YAClC,WAAW,EAAE,wGAAwG;YACrH,QAAQ,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;YAC9B,cAAc,EAAE,IAAI;SACrB;QACD,aAAa,EAAE,6DAAwC;QACvD,eAAe,EAAE,sCAA+C;KACjE;CACF,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,kBAAkB,CAAC,aAAkD;IACnF,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE;QACxC,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC;QAC/B,uHAAuH;QACvH,IAAI,KAAK,CAAC,GAAG,KAAK,wDAAmC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,oDAA+B,CAAC;YAAE,OAAO,YAAY,CAAC;QACtK,OAAO,EAAE,GAAG,YAAY,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,oDAA+B,CAAC,EAAE,EAAE,CAAC;IAClH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { RlsRunnableClient, SystemAccessReason } from '../core/index';
2
+ import type { DefaultOrgReader } from '../identity/index';
3
+ import type { WebhooksTx } from './data/webhooks-db';
4
+ /**
5
+ * Injection token of the {@link WebhooksSystemPrisma} the app binds to its bypass client.
6
+ *
7
+ * @extensionPoint token
8
+ * @stability experimental
9
+ */
10
+ export declare const WEBHOOKS_SYSTEM_PRISMA: unique symbol;
11
+ /**
12
+ * The bypass client, as the slice sees it (`PrismaSystemService` of the
13
+ * reference app). Reached with a registered reason, always `webhooks` (every
14
+ * system-scope query) or `retention` (the purge).
15
+ *
16
+ * @stability experimental
17
+ */
18
+ export interface WebhooksSystemPrisma {
19
+ /** One bypass statement. */
20
+ asSystem(reason: SystemAccessReason): WebhooksTx;
21
+ /** One interactive bypass transaction. */
22
+ runAsSystem<R>(reason: SystemAccessReason, fn: (tx: WebhooksTx) => Promise<R>, options?: {
23
+ maxWait?: number;
24
+ timeout?: number;
25
+ }): Promise<R>;
26
+ }
27
+ /** The tenant client, as the slice sees it: `forOrg` scoped statements and the RLS transaction helper's client. @stability experimental */
28
+ export type WebhooksPrisma = RlsRunnableClient & DefaultOrgReader;
29
+ //# sourceMappingURL=ports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../src/webhooks/ports.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,OAAO,MAAkE,CAAC;AAE/G;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,4BAA4B;IAC5B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,GAAG,UAAU,CAAC;IACjD,0CAA0C;IAC1C,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC9I;AAED,2IAA2I;AAC3I,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ // =============================================================================
3
+ // The webhooks slice's host ports (issue #1046)
4
+ // =============================================================================
5
+ //
6
+ // One injection token per capability the slice needs from the application. The
7
+ // tenant database is the core port `PLATFORM_PRISMA`, the audit trail
8
+ // `AUDIT_SINK`, the queue `JobsService`, the notifications `NotificationsService`
9
+ // (global), the encrypted store the credentials slice's services. The one thing
10
+ // the slice cannot reach by itself is the BYPASS client, which only the app
11
+ // owns: system-scope endpoints have no organization, so their rows are visible
12
+ // to the bypass client only.
13
+ // =============================================================================
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.WEBHOOKS_SYSTEM_PRISMA = void 0;
16
+ /**
17
+ * Injection token of the {@link WebhooksSystemPrisma} the app binds to its bypass client.
18
+ *
19
+ * @extensionPoint token
20
+ * @stability experimental
21
+ */
22
+ exports.WEBHOOKS_SYSTEM_PRISMA = Symbol.for('@marinoscar/platform/webhooks/SYSTEM_PRISMA');
23
+ //# sourceMappingURL=ports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ports.js","sourceRoot":"","sources":["../../src/webhooks/ports.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,gDAAgD;AAChD,gFAAgF;AAChF,EAAE;AACF,+EAA+E;AAC/E,sEAAsE;AACtE,kFAAkF;AAClF,gFAAgF;AAChF,4EAA4E;AAC5E,+EAA+E;AAC/E,6BAA6B;AAC7B,gFAAgF;;;AAMhF;;;;;GAKG;AACU,QAAA,sBAAsB,GAAkB,MAAM,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ import { type WebhookEventDef } from './webhook-event.registry';
3
+ /** The key of the test event; sent only by the `.../test` route, never subscribable. @stability experimental */
4
+ export declare const WEBHOOK_PING_EVENT_KEY = "webhooks.ping";
5
+ /** The key of the node-offline event. @stability experimental */
6
+ export declare const NODE_OFFLINE_WEBHOOK_EVENT_KEY = "nodes.node.offline";
7
+ /** The key of the node-reported-event event. @stability experimental */
8
+ export declare const NODE_EVENT_WEBHOOK_EVENT_KEY = "nodes.node.event";
9
+ /** The key of the permanent-job-failure event. @stability experimental */
10
+ export declare const JOB_FAILED_WEBHOOK_EVENT_KEY = "jobs.job.failed";
11
+ /** `data` of `webhooks.ping`. @stability experimental */
12
+ export declare const webhookPingDataSchema: z.ZodObject<{
13
+ message: z.ZodString;
14
+ endpointId: z.ZodString;
15
+ }, z.core.$strip>;
16
+ /** `data` of `nodes.node.offline`. @stability experimental */
17
+ export declare const nodeOfflineDataSchema: z.ZodObject<{
18
+ nodeId: z.ZodString;
19
+ nodeName: z.ZodString;
20
+ lastHeartbeatAt: z.ZodNullable<z.ZodString>;
21
+ markedOfflineAt: z.ZodString;
22
+ staleAfterMinutes: z.ZodNumber;
23
+ }, z.core.$strip>;
24
+ /** `data` of `nodes.node.event`. @stability experimental */
25
+ export declare const nodeEventDataSchema: z.ZodObject<{
26
+ nodeId: z.ZodString;
27
+ nodeName: z.ZodString;
28
+ type: z.ZodString;
29
+ severity: z.ZodEnum<{
30
+ warning: "warning";
31
+ info: "info";
32
+ critical: "critical";
33
+ }>;
34
+ attrs: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
35
+ occurredAt: z.ZodString;
36
+ }, z.core.$strip>;
37
+ /** `data` of `jobs.job.failed`. @stability experimental */
38
+ export declare const jobFailedDataSchema: z.ZodObject<{
39
+ jobId: z.ZodString;
40
+ type: z.ZodString;
41
+ subjectType: z.ZodNullable<z.ZodString>;
42
+ subjectId: z.ZodNullable<z.ZodString>;
43
+ orgId: z.ZodNullable<z.ZodString>;
44
+ attempts: z.ZodNumber;
45
+ lastError: z.ZodNullable<z.ZodString>;
46
+ finishedAt: z.ZodNullable<z.ZodString>;
47
+ }, z.core.$strip>;
48
+ /** The platform's events, in registration order. @stability experimental */
49
+ export declare const BUILTIN_WEBHOOK_EVENTS: readonly WebhookEventDef[];
50
+ /**
51
+ * Registers the platform's events. Idempotent. Called by
52
+ * `WebhooksModule.forRoot()`.
53
+ *
54
+ * @stability experimental
55
+ */
56
+ export declare function registerBuiltinWebhookEvents(): void;
57
+ //# sourceMappingURL=builtin-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-events.d.ts","sourceRoot":"","sources":["../../../src/webhooks/registry/builtin-events.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEtF,gHAAgH;AAChH,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AACtD,iEAAiE;AACjE,eAAO,MAAM,8BAA8B,uBAAuB,CAAC;AACnE,wEAAwE;AACxE,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,0EAA0E;AAC1E,eAAO,MAAM,4BAA4B,oBAAoB,CAAC;AAI9D,yDAAyD;AACzD,eAAO,MAAM,qBAAqB;;;iBAA4D,CAAC;AAC/F,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB;;;;;;iBAMhC,CAAC;AACH,4DAA4D;AAC5D,eAAO,MAAM,mBAAmB;;;;;;;;;;;iBAO9B,CAAC;AACH,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB;;;;;;;;;iBAS9B,CAAC;AAEH,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,EAAE,SAAS,eAAe,EA4C/B,CAAC;AAE/B;;;;;GAKG;AACH,wBAAgB,4BAA4B,IAAI,IAAI,CAEnD"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ // =============================================================================
3
+ // The platform's own webhook events (issue #1046)
4
+ // =============================================================================
5
+ //
6
+ // `webhooks.ping` (the test route), the two node events and the permanent job
7
+ // failure. The notification bridge (`notification.<eventKey>`) is not
8
+ // registered one by one: it is derived from the notifications registry when the
9
+ // catalog is read (`./webhook-catalog.ts`). The alerts slice registers its own
10
+ // two events (`alerts.alert.fired`, `alerts.alert.resolved`) from its module.
11
+ // =============================================================================
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.BUILTIN_WEBHOOK_EVENTS = exports.jobFailedDataSchema = exports.nodeEventDataSchema = exports.nodeOfflineDataSchema = exports.webhookPingDataSchema = exports.JOB_FAILED_WEBHOOK_EVENT_KEY = exports.NODE_EVENT_WEBHOOK_EVENT_KEY = exports.NODE_OFFLINE_WEBHOOK_EVENT_KEY = exports.WEBHOOK_PING_EVENT_KEY = void 0;
14
+ exports.registerBuiltinWebhookEvents = registerBuiltinWebhookEvents;
15
+ const zod_1 = require("zod");
16
+ const webhooks_1 = require("@marinoscar/platform-contract/webhooks");
17
+ const webhook_event_registry_1 = require("./webhook-event.registry");
18
+ /** The key of the test event; sent only by the `.../test` route, never subscribable. @stability experimental */
19
+ exports.WEBHOOK_PING_EVENT_KEY = 'webhooks.ping';
20
+ /** The key of the node-offline event. @stability experimental */
21
+ exports.NODE_OFFLINE_WEBHOOK_EVENT_KEY = 'nodes.node.offline';
22
+ /** The key of the node-reported-event event. @stability experimental */
23
+ exports.NODE_EVENT_WEBHOOK_EVENT_KEY = 'nodes.node.event';
24
+ /** The key of the permanent-job-failure event. @stability experimental */
25
+ exports.JOB_FAILED_WEBHOOK_EVENT_KEY = 'jobs.job.failed';
26
+ const iso = zod_1.z.string();
27
+ /** `data` of `webhooks.ping`. @stability experimental */
28
+ exports.webhookPingDataSchema = zod_1.z.object({ message: zod_1.z.string(), endpointId: zod_1.z.string() });
29
+ /** `data` of `nodes.node.offline`. @stability experimental */
30
+ exports.nodeOfflineDataSchema = zod_1.z.object({
31
+ nodeId: zod_1.z.string(),
32
+ nodeName: zod_1.z.string(),
33
+ lastHeartbeatAt: iso.nullable(),
34
+ markedOfflineAt: iso,
35
+ staleAfterMinutes: zod_1.z.number(),
36
+ });
37
+ /** `data` of `nodes.node.event`. @stability experimental */
38
+ exports.nodeEventDataSchema = zod_1.z.object({
39
+ nodeId: zod_1.z.string(),
40
+ nodeName: zod_1.z.string(),
41
+ type: zod_1.z.string(),
42
+ severity: zod_1.z.enum(['info', 'warning', 'critical']),
43
+ attrs: zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.string(), zod_1.z.number(), zod_1.z.boolean()])),
44
+ occurredAt: iso,
45
+ });
46
+ /** `data` of `jobs.job.failed`. @stability experimental */
47
+ exports.jobFailedDataSchema = zod_1.z.object({
48
+ jobId: zod_1.z.string(),
49
+ type: zod_1.z.string(),
50
+ subjectType: zod_1.z.string().nullable(),
51
+ subjectId: zod_1.z.string().nullable(),
52
+ orgId: zod_1.z.string().nullable(),
53
+ attempts: zod_1.z.number().int(),
54
+ lastError: zod_1.z.string().nullable(),
55
+ finishedAt: iso.nullable(),
56
+ });
57
+ /** The platform's events, in registration order. @stability experimental */
58
+ exports.BUILTIN_WEBHOOK_EVENTS = Object.freeze([
59
+ {
60
+ key: exports.WEBHOOK_PING_EVENT_KEY,
61
+ label: 'Test ping',
62
+ description: 'Sent by the Test button of an endpoint to check that the receiver answers and verifies the signature.',
63
+ group: 'Webhooks',
64
+ audience: 'user',
65
+ payloadSchema: exports.webhookPingDataSchema,
66
+ example: { message: 'This is a test delivery.', endpointId: '00000000-0000-4000-8000-000000000000' },
67
+ source: 'platform',
68
+ },
69
+ {
70
+ key: exports.NODE_OFFLINE_WEBHOOK_EVENT_KEY,
71
+ label: 'Worker node offline',
72
+ description: 'A worker node stopped heartbeating and was marked offline.',
73
+ group: 'Nodes',
74
+ audience: 'system',
75
+ permission: webhooks_1.WEBHOOK_PERMISSIONS.SYSTEM_READ,
76
+ payloadSchema: exports.nodeOfflineDataSchema,
77
+ example: { nodeId: 'node-1', nodeName: 'builder-1', lastHeartbeatAt: '2026-11-01T10:00:00.000Z', markedOfflineAt: '2026-11-01T10:05:00.000Z', staleAfterMinutes: 5 },
78
+ source: 'platform',
79
+ },
80
+ {
81
+ key: exports.NODE_EVENT_WEBHOOK_EVENT_KEY,
82
+ label: 'Worker node event',
83
+ description: 'A worker node reported an event (power, sleep, low disk).',
84
+ group: 'Nodes',
85
+ audience: 'system',
86
+ permission: webhooks_1.WEBHOOK_PERMISSIONS.SYSTEM_READ,
87
+ payloadSchema: exports.nodeEventDataSchema,
88
+ example: { nodeId: 'node-1', nodeName: 'builder-1', type: 'disk.low', severity: 'warning', attrs: { freeGb: 3 }, occurredAt: '2026-11-01T10:00:00.000Z' },
89
+ source: 'platform',
90
+ },
91
+ {
92
+ key: exports.JOB_FAILED_WEBHOOK_EVENT_KEY,
93
+ label: 'Job failed',
94
+ description: 'A background job failed for good: it used its last attempt.',
95
+ group: 'Jobs',
96
+ audience: 'system',
97
+ permission: webhooks_1.WEBHOOK_PERMISSIONS.SYSTEM_READ,
98
+ payloadSchema: exports.jobFailedDataSchema,
99
+ example: { jobId: 'job-1', type: 'example.task', subjectType: null, subjectId: null, orgId: null, attempts: 3, lastError: 'Connection refused', finishedAt: '2026-11-01T10:00:00.000Z' },
100
+ source: 'platform',
101
+ },
102
+ ]);
103
+ /**
104
+ * Registers the platform's events. Idempotent. Called by
105
+ * `WebhooksModule.forRoot()`.
106
+ *
107
+ * @stability experimental
108
+ */
109
+ function registerBuiltinWebhookEvents() {
110
+ for (const event of exports.BUILTIN_WEBHOOK_EVENTS)
111
+ (0, webhook_event_registry_1.registerWebhookEvent)(event);
112
+ }
113
+ //# sourceMappingURL=builtin-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-events.js","sourceRoot":"","sources":["../../../src/webhooks/registry/builtin-events.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,kDAAkD;AAClD,gFAAgF;AAChF,EAAE;AACF,8EAA8E;AAC9E,sEAAsE;AACtE,gFAAgF;AAChF,+EAA+E;AAC/E,8EAA8E;AAC9E,gFAAgF;;;AAuGhF,oEAEC;AAvGD,6BAAwB;AAExB,qEAA6E;AAE7E,qEAAsF;AAEtF,gHAAgH;AACnG,QAAA,sBAAsB,GAAG,eA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ACD;QACE,GAAG,EAAE,oCAA4B;QACjC,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE,2DAA2D;QACxE,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,8BAAmB,CAAC,WAAW;QAC3C,aAAa,EAAE,2BAAmB;QAClC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,0BAA0B,EAAE;QACzJ,MAAM,EAAE,UAAU;KACnB;IACD;QACE,GAAG,EAAE,oCAA4B;QACjC,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,6DAA6D;QAC1E,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,8BAAmB,CAAC,WAAW;QAC3C,aAAa,EAAE,2BAAmB;QAClC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,oBAAoB,EAAE,UAAU,EAAE,0BAA0B,EAAE;QACxL,MAAM,EAAE,UAAU;KACnB;CAC0B,CAAC,CAAC;AAE/B;;;;;GAKG;AACH,SAAgB,4BAA4B;IAC1C,KAAK,MAAM,KAAK,IAAI,8BAAsB;QAAE,IAAA,6CAAoB,EAAC,KAAK,CAAC,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { z } from 'zod';
2
+ import type { WebhookEventCatalogEntry, WebhookScope } from '@marinoscar/platform-contract/webhooks';
3
+ import { type WebhookEventDef } from './webhook-event.registry';
4
+ /** `data` of every `notification.<eventKey>` event. @stability experimental */
5
+ export declare const notificationBridgeDataSchema: z.ZodObject<{
6
+ event: z.ZodObject<{
7
+ key: z.ZodString;
8
+ label: z.ZodString;
9
+ description: z.ZodString;
10
+ }, z.core.$strip>;
11
+ title: z.ZodString;
12
+ body: z.ZodString;
13
+ link: z.ZodNullable<z.ZodString>;
14
+ fields: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
15
+ }, z.core.$strip>;
16
+ /**
17
+ * Every event the catalog knows: the registered ones, then the bridged
18
+ * notifications.
19
+ *
20
+ * @returns the definitions.
21
+ *
22
+ * @stability experimental
23
+ */
24
+ export declare function allWebhookEvents(): WebhookEventDef[];
25
+ /**
26
+ * Resolves an exact event key: registered first, then a bridged notification.
27
+ *
28
+ * @param key - the emitted key.
29
+ * @returns the definition, or `undefined` for an unknown key.
30
+ *
31
+ * @stability experimental
32
+ */
33
+ export declare function resolveWebhookEvent(key: string): WebhookEventDef | undefined;
34
+ /**
35
+ * The events an endpoint of `scope` may subscribe to (the test ping excluded).
36
+ *
37
+ * @param scope - the endpoint scope.
38
+ * @returns the definitions.
39
+ *
40
+ * @stability experimental
41
+ */
42
+ export declare function subscribableEvents(scope: WebhookScope): WebhookEventDef[];
43
+ /**
44
+ * Whether a subscription entry names at least one event an endpoint of `scope`
45
+ * can receive.
46
+ *
47
+ * @param pattern - an `eventKeys` entry.
48
+ * @param scope - the endpoint scope.
49
+ * @returns `true` when subscribable.
50
+ *
51
+ * @stability experimental
52
+ */
53
+ export declare function subscriptionIsSubscribable(pattern: string, scope: WebhookScope): boolean;
54
+ /**
55
+ * The catalog entries for `scope`, as the route serves them.
56
+ *
57
+ * @param scope - the endpoint scope.
58
+ * @returns the entries.
59
+ *
60
+ * @stability experimental
61
+ */
62
+ export declare function catalogFor(scope: WebhookScope): WebhookEventCatalogEntry[];
63
+ //# sourceMappingURL=webhook-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-catalog.d.ts","sourceRoot":"","sources":["../../../src/webhooks/registry/webhook-catalog.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAKrG,OAAO,EAA2D,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEzH,+EAA+E;AAC/E,eAAO,MAAM,4BAA4B;;;;;;;;;;iBAMvC,CAAC;AA2BH;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,EAAE,CAEpD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAK5E;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe,EAAE,CAEzE;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAExF;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,wBAAwB,EAAE,CAU1E"}
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ // =============================================================================
3
+ // The event catalog a caller sees, and event resolution (issue #1046)
4
+ // =============================================================================
5
+ //
6
+ // Registered events (`registerWebhookEvent`) plus the notification bridge: every
7
+ // event of the notifications registry that declares the `webhook` channel is
8
+ // subscribable by a member as
9
+ // `notification.<eventKey>` (audience `user`), with a fixed payload shape. Read
10
+ // fresh each time (the notifications registry is filled by the app's manifest).
11
+ // =============================================================================
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.notificationBridgeDataSchema = void 0;
14
+ exports.allWebhookEvents = allWebhookEvents;
15
+ exports.resolveWebhookEvent = resolveWebhookEvent;
16
+ exports.subscribableEvents = subscribableEvents;
17
+ exports.subscriptionIsSubscribable = subscriptionIsSubscribable;
18
+ exports.catalogFor = catalogFor;
19
+ const zod_1 = require("zod");
20
+ const index_1 = require("../../notifications/index");
21
+ const webhooks_constants_1 = require("../webhooks.constants");
22
+ const builtin_events_1 = require("./builtin-events");
23
+ const webhook_event_registry_1 = require("./webhook-event.registry");
24
+ /** `data` of every `notification.<eventKey>` event. @stability experimental */
25
+ exports.notificationBridgeDataSchema = zod_1.z.object({
26
+ event: zod_1.z.object({ key: zod_1.z.string(), label: zod_1.z.string(), description: zod_1.z.string() }),
27
+ title: zod_1.z.string(),
28
+ body: zod_1.z.string(),
29
+ link: zod_1.z.string().nullable(),
30
+ fields: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).nullable(),
31
+ });
32
+ /** The sample `data` of a bridged notification. */
33
+ const NOTIFICATION_EXAMPLE = {
34
+ event: { key: 'example.thing_happened', label: 'Thing happened', description: 'Sent when a thing happens.' },
35
+ title: 'Thing happened',
36
+ body: 'Something you follow changed.',
37
+ link: '/things/1',
38
+ fields: null,
39
+ };
40
+ function bridged() {
41
+ // Only an event that declares the `webhook` channel is ever routed to the sender, so only those are subscribable.
42
+ return index_1.notificationEventRegistry.list().filter((event) => event.channels.includes(webhooks_constants_1.WEBHOOK_NOTIFICATION_CHANNEL_ID)).map((event) => ({
43
+ key: `${webhooks_constants_1.WEBHOOK_NOTIFICATION_EVENT_PREFIX}${event.key}`,
44
+ label: `Notification: ${event.label}`,
45
+ description: `${event.description} Delivered to your endpoints only when you also switch the Webhooks channel on for this event in your notification preferences.`,
46
+ group: 'Notifications',
47
+ audience: 'user',
48
+ payloadSchema: exports.notificationBridgeDataSchema,
49
+ example: NOTIFICATION_EXAMPLE,
50
+ source: 'notifications',
51
+ }));
52
+ }
53
+ /**
54
+ * Every event the catalog knows: the registered ones, then the bridged
55
+ * notifications.
56
+ *
57
+ * @returns the definitions.
58
+ *
59
+ * @stability experimental
60
+ */
61
+ function allWebhookEvents() {
62
+ return [...webhook_event_registry_1.webhookEventRegistry.list(), ...bridged()];
63
+ }
64
+ /**
65
+ * Resolves an exact event key: registered first, then a bridged notification.
66
+ *
67
+ * @param key - the emitted key.
68
+ * @returns the definition, or `undefined` for an unknown key.
69
+ *
70
+ * @stability experimental
71
+ */
72
+ function resolveWebhookEvent(key) {
73
+ const registered = webhook_event_registry_1.webhookEventRegistry.get(key);
74
+ if (registered)
75
+ return registered;
76
+ if (!key.startsWith(webhooks_constants_1.WEBHOOK_NOTIFICATION_EVENT_PREFIX))
77
+ return undefined;
78
+ return bridged().find((event) => event.key === key);
79
+ }
80
+ /**
81
+ * The events an endpoint of `scope` may subscribe to (the test ping excluded).
82
+ *
83
+ * @param scope - the endpoint scope.
84
+ * @returns the definitions.
85
+ *
86
+ * @stability experimental
87
+ */
88
+ function subscribableEvents(scope) {
89
+ return allWebhookEvents().filter((event) => event.audience === scope && event.key !== builtin_events_1.WEBHOOK_PING_EVENT_KEY);
90
+ }
91
+ /**
92
+ * Whether a subscription entry names at least one event an endpoint of `scope`
93
+ * can receive.
94
+ *
95
+ * @param pattern - an `eventKeys` entry.
96
+ * @param scope - the endpoint scope.
97
+ * @returns `true` when subscribable.
98
+ *
99
+ * @stability experimental
100
+ */
101
+ function subscriptionIsSubscribable(pattern, scope) {
102
+ return subscribableEvents(scope).some((event) => (0, webhook_event_registry_1.subscriptionMatches)(pattern, event.key));
103
+ }
104
+ /**
105
+ * The catalog entries for `scope`, as the route serves them.
106
+ *
107
+ * @param scope - the endpoint scope.
108
+ * @returns the entries.
109
+ *
110
+ * @stability experimental
111
+ */
112
+ function catalogFor(scope) {
113
+ return subscribableEvents(scope).map((event) => ({
114
+ key: event.key,
115
+ label: event.label,
116
+ description: event.description,
117
+ group: event.group,
118
+ audience: event.audience,
119
+ jsonSchema: (0, webhook_event_registry_1.jsonSchemaOf)(event),
120
+ ...(event.example !== undefined ? { example: event.example } : {}),
121
+ }));
122
+ }
123
+ //# sourceMappingURL=webhook-catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-catalog.js","sourceRoot":"","sources":["../../../src/webhooks/registry/webhook-catalog.ts"],"names":[],"mapp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