@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,51 @@
1
+ "use strict";
2
+ // =============================================================================
3
+ // The signing-secret credential purpose (issue #1046)
4
+ // =============================================================================
5
+ //
6
+ // `webhook_signing` in all three tiers of the credentials store: a user's own
7
+ // store (user scope), the organization's (org scope) and the deployment's
8
+ // (system scope). The app registers both definitions from its credential
9
+ // manifest; the slice only declares them. A secret is addressed
10
+ // `endpoint:<endpointId>:v<version>` (see `webhook-secrets.service.ts`).
11
+ // =============================================================================
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.WEBHOOK_SIGNING_USER_CREDENTIAL_PURPOSE_DEF = exports.WEBHOOK_SIGNING_CREDENTIAL_PURPOSE_DEF = void 0;
14
+ const webhooks_constants_1 = require("./webhooks.constants");
15
+ /**
16
+ * The organization and deployment tiers of `webhook_signing`, for
17
+ * `registerCredentialPurpose`.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * registerCredentialPurpose(WEBHOOK_SIGNING_CREDENTIAL_PURPOSE_DEF);
22
+ * ```
23
+ *
24
+ * @extensionPoint registry
25
+ * @stability experimental
26
+ */
27
+ exports.WEBHOOK_SIGNING_CREDENTIAL_PURPOSE_DEF = Object.freeze({
28
+ purpose: webhooks_constants_1.WEBHOOK_SIGNING_PURPOSE,
29
+ owner: 'webhooks',
30
+ label: 'Webhook signing secrets',
31
+ tiers: ['system', 'org'],
32
+ });
33
+ /**
34
+ * The user tier of `webhook_signing`, for `registerUserCredentialPurpose`. No
35
+ * deployment or organization fallback: a member's secret is theirs alone.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * registerUserCredentialPurpose(WEBHOOK_SIGNING_USER_CREDENTIAL_PURPOSE_DEF);
40
+ * ```
41
+ *
42
+ * @extensionPoint registry
43
+ * @stability experimental
44
+ */
45
+ exports.WEBHOOK_SIGNING_USER_CREDENTIAL_PURPOSE_DEF = Object.freeze({
46
+ purpose: webhooks_constants_1.WEBHOOK_SIGNING_PURPOSE,
47
+ label: 'Webhook signing secret',
48
+ description: 'Signs the webhooks this application sends to your endpoints, so your receiver can verify them.',
49
+ system: null,
50
+ });
51
+ //# sourceMappingURL=webhooks.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.credentials.js","sourceRoot":"","sources":["../../src/webhooks/webhooks.credentials.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,sDAAsD;AACtD,gFAAgF;AAChF,EAAE;AACF,8EAA8E;AAC9E,0EAA0E;AAC1E,yEAAyE;AACzE,gEAAgE;AAChE,yEAAyE;AACzE,gFAAgF;;;AAGhF,6DAA+D;AAE/D;;;;;;;;;;;GAWG;AACU,QAAA,sCAAsC,GAAyB,MAAM,CAAC,MAAM,CAAC;IACxF,OAAO,EAAE,4CAAuB;IAChC,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,yBAAyB;IAChC,KAAK,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAU;CAClC,CAAC,CAAC;AAEH;;;;;;;;;;;GAWG;AACU,QAAA,2CAA2C,GAA6B,MAAM,CAAC,MAAM,CAAC;IACjG,OAAO,EAAE,4CAAuB;IAChC,KAAK,EAAE,wBAAwB;IAC/B,WAAW,EAAE,gGAAgG;IAC7G,MAAM,EAAE,IAAI;CACb,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { HttpException, NotFoundException, UnprocessableEntityException } from '@nestjs/common';
2
+ import { type WebhookErrorCode } from '@marinoscar/platform-contract/webhooks';
3
+ /**
4
+ * Registers the slice's error codes with the filter. Idempotent.
5
+ *
6
+ * @stability experimental
7
+ */
8
+ export declare function registerWebhookErrorCodes(): void;
9
+ /** The endpoint is not there, or not the caller's. @stability experimental */
10
+ export declare class WebhookNotFoundError extends NotFoundException {
11
+ constructor();
12
+ }
13
+ /** The delivery is not there, or not the caller's. @stability experimental */
14
+ export declare class WebhookDeliveryNotFoundError extends NotFoundException {
15
+ constructor();
16
+ }
17
+ /** A 422 with one of the slice's codes. @stability experimental */
18
+ export declare class WebhookRequestError extends UnprocessableEntityException {
19
+ constructor(code: WebhookErrorCode, message: string);
20
+ }
21
+ /** The endpoint is switched off and the action needs it on. @stability experimental */
22
+ export declare class WebhookDisabledError extends HttpException {
23
+ constructor();
24
+ }
25
+ //# sourceMappingURL=webhooks.errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.errors.d.ts","sourceRoot":"","sources":["../../src/webhooks/webhooks.errors.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,aAAa,EAAc,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAC5G,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAcpG;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAED,8EAA8E;AAC9E,qBAAa,oBAAqB,SAAQ,iBAAiB;;CAI1D;AAED,8EAA8E;AAC9E,qBAAa,4BAA6B,SAAQ,iBAAiB;;CAIlE;AAED,mEAAmE;AACnE,qBAAa,mBAAoB,SAAQ,4BAA4B;gBACvD,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM;CAGpD;AAED,uFAAuF;AACvF,qBAAa,oBAAqB,SAAQ,aAAa;;CAItD"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ // =============================================================================
3
+ // The webhooks slice's errors (issue #1046)
4
+ // =============================================================================
5
+ //
6
+ // Each is an `HttpException` carrying one of the contract's
7
+ // `WEBHOOK_ERROR_CODES`. The filter publishes a payload `code` only when it is
8
+ // registered for the response's own status, so `registerWebhookErrorCodes()`
9
+ // (called by `WebhooksModule.forRoot()`) registers them. A not-found error is a
10
+ // 404 for "does not exist" AND "is not yours": the id is never an oracle.
11
+ // =============================================================================
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.WebhookDisabledError = exports.WebhookRequestError = exports.WebhookDeliveryNotFoundError = exports.WebhookNotFoundError = void 0;
14
+ exports.registerWebhookErrorCodes = registerWebhookErrorCodes;
15
+ const common_1 = require("@nestjs/common");
16
+ const webhooks_1 = require("@marinoscar/platform-contract/webhooks");
17
+ const index_1 = require("../core/index");
18
+ const CODES = [
19
+ { code: webhooks_1.WEBHOOK_ERROR_CODES.WEBHOOK_NOT_FOUND, status: 404, description: 'The webhook endpoint does not exist, or is not visible to the caller.' },
20
+ { code: webhooks_1.WEBHOOK_ERROR_CODES.WEBHOOK_DELIVERY_NOT_FOUND, status: 404, description: 'The webhook delivery does not exist, or is not visible to the caller.' },
21
+ { code: webhooks_1.WEBHOOK_ERROR_CODES.WEBHOOK_URL_INVALID, status: 422, description: 'The webhook URL is not a valid URL.' },
22
+ { code: webhooks_1.WEBHOOK_ERROR_CODES.WEBHOOK_URL_FORBIDDEN, status: 422, description: 'The webhook URL targets a scheme, port or address the server will not call.' },
23
+ { code: webhooks_1.WEBHOOK_ERROR_CODES.WEBHOOK_EVENT_UNKNOWN, status: 422, description: 'A subscription names no event an endpoint of this kind can receive.' },
24
+ { code: webhooks_1.WEBHOOK_ERROR_CODES.WEBHOOK_EVENT_NOT_PERMITTED, status: 422, description: 'The caller may not subscribe to a requested event.' },
25
+ { code: webhooks_1.WEBHOOK_ERROR_CODES.WEBHOOK_LIMIT_REACHED, status: 422, description: 'The owner already has the most webhook endpoints allowed.' },
26
+ ];
27
+ /**
28
+ * Registers the slice's error codes with the filter. Idempotent.
29
+ *
30
+ * @stability experimental
31
+ */
32
+ function registerWebhookErrorCodes() {
33
+ for (const def of CODES)
34
+ if (!index_1.errorCodeRegistry.has(def.code))
35
+ (0, index_1.registerErrorCode)(def);
36
+ }
37
+ /** The endpoint is not there, or not the caller's. @stability experimental */
38
+ class WebhookNotFoundError extends common_1.NotFoundException {
39
+ constructor() {
40
+ super({ statusCode: 404, code: webhooks_1.WEBHOOK_ERROR_CODES.WEBHOOK_NOT_FOUND, message: 'Webhook endpoint not found' });
41
+ }
42
+ }
43
+ exports.WebhookNotFoundError = WebhookNotFoundError;
44
+ /** The delivery is not there, or not the caller's. @stability experimental */
45
+ class WebhookDeliveryNotFoundError extends common_1.NotFoundException {
46
+ constructor() {
47
+ super({ statusCode: 404, code: webhooks_1.WEBHOOK_ERROR_CODES.WEBHOOK_DELIVERY_NOT_FOUND, message: 'Webhook delivery not found' });
48
+ }
49
+ }
50
+ exports.WebhookDeliveryNotFoundError = WebhookDeliveryNotFoundError;
51
+ /** A 422 with one of the slice's codes. @stability experimental */
52
+ class WebhookRequestError extends common_1.UnprocessableEntityException {
53
+ constructor(code, message) {
54
+ super({ statusCode: 422, code, message });
55
+ }
56
+ }
57
+ exports.WebhookRequestError = WebhookRequestError;
58
+ /** The endpoint is switched off and the action needs it on. @stability experimental */
59
+ class WebhookDisabledError extends common_1.HttpException {
60
+ constructor() {
61
+ super({ statusCode: 409, message: 'The endpoint is disabled. Enable it first.' }, common_1.HttpStatus.CONFLICT);
62
+ }
63
+ }
64
+ exports.WebhookDisabledError = WebhookDisabledError;
65
+ //# sourceMappingURL=webhooks.errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.errors.js","sourceRoot":"","sources":["../../src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,MAAa,oBAAqB,SAAQ,0BAAiB;IACzD;QACE,KAAK,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,8BAAmB,CAAC,iBAAiB,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC,CAAC;IACjH,CAAC;CACF;AAJD,oDAIC;AAED,8EAA8E;AAC9E,MAAa,4BAA6B,SAAQ,0BAAiB;IACjE;QACE,KAAK,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,8BAAmB,CAAC,0BAA0B,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC,CAAC;IAC1H,CAAC;CACF;AAJD,oEAIC;AAED,mEAAmE;AACnE,MAAa,mBAAoB,SAAQ,qCAA4B;IACnE,YAAY,IAAsB,EAAE,OAAe;QACjD,KAAK,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF;AAJD,kDAIC;AAED,uFAAuF;AACvF,MAAa,oBAAqB,SAAQ,sBAAa;IACrD;QACE,KAAK,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,4CAA4C,EAAE,EAAE,mBAAU,CAAC,QAAQ,CAAC,CAAC;IACzG,CAAC;CACF;AAJD,oDAIC"}
@@ -0,0 +1,24 @@
1
+ import type { AppMetricDef } from '../otel-core/index';
2
+ /** What a delivery attempt ended as. @stability experimental */
3
+ export declare const WEBHOOK_DELIVERY_OUTCOMES: readonly ["succeeded", "failed", "dead", "blocked"];
4
+ /** What one emitted event ended as. @stability experimental */
5
+ export declare const WEBHOOK_EMIT_OUTCOMES: readonly ["queued", "no_match", "invalid", "unknown"];
6
+ /** Code key of `app.webhooks.deliveries`. @stability experimental */
7
+ export declare const WEBHOOK_DELIVERIES_METRIC = "webhookDeliveries";
8
+ /** Code key of `app.webhooks.delivery.duration`. @stability experimental */
9
+ export declare const WEBHOOK_DELIVERY_DURATION_METRIC = "webhookDeliveryDuration";
10
+ /** Code key of `app.webhooks.events`. @stability experimental */
11
+ export declare const WEBHOOK_EVENTS_METRIC = "webhookEvents";
12
+ /**
13
+ * The slice's metrics, for `registerPlatformHostAppMetrics`.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * registerPlatformHostAppMetrics(WEBHOOKS_APP_METRICS);
18
+ * ```
19
+ *
20
+ * @extensionPoint registry
21
+ * @stability experimental
22
+ */
23
+ export declare const WEBHOOKS_APP_METRICS: readonly AppMetricDef[];
24
+ //# sourceMappingURL=webhooks.metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.metrics.d.ts","sourceRoot":"","sources":["../../src/webhooks/webhooks.metrics.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,gEAAgE;AAChE,eAAO,MAAM,yBAAyB,qDAAsD,CAAC;AAC7F,+DAA+D;AAC/D,eAAO,MAAM,qBAAqB,uDAAwD,CAAC;AAE3F,qEAAqE;AACrE,eAAO,MAAM,yBAAyB,sBAAsB,CAAC;AAC7D,4EAA4E;AAC5E,eAAO,MAAM,gCAAgC,4BAA4B,CAAC;AAC1E,iEAAiE;AACjE,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,YAAY,EAmCvD,CAAC"}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ // =============================================================================
3
+ // Webhook metrics (issue #1046)
4
+ // =============================================================================
5
+ //
6
+ // Declared for the app's metric-name registry and emitted through
7
+ // `MetricsHostService`. BOUNDED LABELS ONLY: `outcome` is a closed list and
8
+ // `event_group` is the first segment of the event key when it is a registered
9
+ // group, else `other`. Never an endpoint, URL, user or organization.
10
+ // =============================================================================
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.WEBHOOKS_APP_METRICS = exports.WEBHOOK_EVENTS_METRIC = exports.WEBHOOK_DELIVERY_DURATION_METRIC = exports.WEBHOOK_DELIVERIES_METRIC = exports.WEBHOOK_EMIT_OUTCOMES = exports.WEBHOOK_DELIVERY_OUTCOMES = void 0;
13
+ /** What a delivery attempt ended as. @stability experimental */
14
+ exports.WEBHOOK_DELIVERY_OUTCOMES = ['succeeded', 'failed', 'dead', 'blocked'];
15
+ /** What one emitted event ended as. @stability experimental */
16
+ exports.WEBHOOK_EMIT_OUTCOMES = ['queued', 'no_match', 'invalid', 'unknown'];
17
+ /** Code key of `app.webhooks.deliveries`. @stability experimental */
18
+ exports.WEBHOOK_DELIVERIES_METRIC = 'webhookDeliveries';
19
+ /** Code key of `app.webhooks.delivery.duration`. @stability experimental */
20
+ exports.WEBHOOK_DELIVERY_DURATION_METRIC = 'webhookDeliveryDuration';
21
+ /** Code key of `app.webhooks.events`. @stability experimental */
22
+ exports.WEBHOOK_EVENTS_METRIC = 'webhookEvents';
23
+ /**
24
+ * The slice's metrics, for `registerPlatformHostAppMetrics`.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * registerPlatformHostAppMetrics(WEBHOOKS_APP_METRICS);
29
+ * ```
30
+ *
31
+ * @extensionPoint registry
32
+ * @stability experimental
33
+ */
34
+ exports.WEBHOOKS_APP_METRICS = [
35
+ {
36
+ key: exports.WEBHOOK_DELIVERIES_METRIC,
37
+ name: 'app.webhooks.deliveries',
38
+ kind: 'counter',
39
+ unit: '{delivery}',
40
+ description: 'Webhook delivery attempts, by outcome and event group.',
41
+ attributes: {
42
+ outcome: { kind: 'enum', values: exports.WEBHOOK_DELIVERY_OUTCOMES },
43
+ event_group: { kind: 'free' },
44
+ },
45
+ },
46
+ {
47
+ key: exports.WEBHOOK_DELIVERY_DURATION_METRIC,
48
+ name: 'app.webhooks.delivery.duration',
49
+ kind: 'histogram',
50
+ unit: 's',
51
+ description: 'How long one webhook delivery attempt took, from connecting to the answer.',
52
+ buckets: [0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10],
53
+ attributes: {
54
+ outcome: { kind: 'enum', values: exports.WEBHOOK_DELIVERY_OUTCOMES },
55
+ event_group: { kind: 'free' },
56
+ },
57
+ },
58
+ {
59
+ key: exports.WEBHOOK_EVENTS_METRIC,
60
+ name: 'app.webhooks.events',
61
+ kind: 'counter',
62
+ unit: '{event}',
63
+ description: 'Events emitted to the webhook fan-out, by outcome and event group.',
64
+ attributes: {
65
+ outcome: { kind: 'enum', values: exports.WEBHOOK_EMIT_OUTCOMES },
66
+ event_group: { kind: 'free' },
67
+ },
68
+ },
69
+ ];
70
+ //# sourceMappingURL=webhooks.metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.metrics.js","sourceRoot":"","sources":["../../src/webhooks/webhooks.metrics.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,gCAAgC;AAChC,gFAAgF;AAChF,EAAE;AACF,kEAAkE;AAClE,4EAA4E;AAC5E,8EAA8E;AAC9E,qEAAqE;AACrE,gFAAgF;;;AAIhF,gEAAgE;AACnD,QAAA,yBAAyB,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AAC7F,+DAA+D;AAClD,QAAA,qBAAqB,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AAE3F,qEAAqE;AACxD,QAAA,yBAAyB,GAAG,mBAAmB,CAAC;AAC7D,4EAA4E;AAC/D,QAAA,gCAAgC,GAAG,yBAAyB,CAAC;AAC1E,iEAAiE;AACpD,QAAA,qBAAqB,GAAG,eAAe,CAAC;AAErD;;;;;;;;;;GAUG;AACU,QAAA,oBAAoB,GAA4B;IAC3D;QACE,GAAG,EAAE,iCAAyB;QAC9B,IAAI,EAAE,yBAAyB;QAC/B,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,wDAAwD;QACrE,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iCAAyB,EAAE;YAC5D,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SAC9B;KACF;IACD;QACE,GAAG,EAAE,wCAAgC;QACrC,IAAI,EAAE,gCAAgC;QACtC,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,4EAA4E;QACzF,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iCAAyB,EAAE;YAC5D,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SAC9B;KACF;IACD;QACE,GAAG,EAAE,6BAAqB;QAC1B,IAAI,EAAE,qBAAqB;QAC3B,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,oEAAoE;QACjF,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,6BAAqB,EAAE;YACxD,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SAC9B;KACF;CACF,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { type DynamicModule } from '@nestjs/common';
2
+ import { type WebhooksModuleOptions } from './webhooks.options';
3
+ /**
4
+ * The webhooks slice for one app.
5
+ *
6
+ * @stability experimental
7
+ */
8
+ export declare class WebhooksModule {
9
+ /**
10
+ * The slice for one app. Call once, before bootstrap. Registers the platform's
11
+ * webhook events, the slice's error codes and (when the app's manifest has not
12
+ * already) the `webhook` notification channel; each registration is
13
+ * idempotent.
14
+ *
15
+ * @param options - see {@link WebhooksModuleOptions}; all optional.
16
+ * @returns the dynamic module. It exports `WebhooksService`, `WebhookEndpointsService` and `WEBHOOKS_OPTIONS`.
17
+ * @throws Error when an option is invalid.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * export const webhooksModule = WebhooksModule.forRoot({ appName: APP_NAME, imports: [WebhooksHostModule] });
22
+ * ```
23
+ *
24
+ * @extensionPoint option
25
+ * @stability experimental
26
+ */
27
+ static forRoot(options?: WebhooksModuleOptions): DynamicModule;
28
+ }
29
+ //# sourceMappingURL=webhooks.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.module.d.ts","sourceRoot":"","sources":["../../src/webhooks/webhooks.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAoB5D,OAAO,EAAkD,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAsBhH;;;;GAIG;AACH,qBACa,cAAc;IACzB;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,qBAA0B,GAAG,aAAa;CA6BnE"}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var WebhooksModule_1;
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.WebhooksModule = void 0;
11
+ const common_1 = require("@nestjs/common");
12
+ const index_1 = require("../credentials/index");
13
+ const index_2 = require("../notifications/index");
14
+ const egress_guard_1 = require("./egress/egress-guard");
15
+ const transport_1 = require("./egress/transport");
16
+ const webhook_deliver_handler_1 = require("./handlers/webhook-deliver.handler");
17
+ const webhook_fanout_handler_1 = require("./handlers/webhook-fanout.handler");
18
+ const webhook_purge_handler_1 = require("./handlers/webhook-purge.handler");
19
+ const admin_webhooks_controller_1 = require("./http/admin-webhooks.controller");
20
+ const org_webhooks_controller_1 = require("./http/org-webhooks.controller");
21
+ const webhooks_controller_1 = require("./http/webhooks.controller");
22
+ const webhook_event_listeners_1 = require("./listeners/webhook-event.listeners");
23
+ const webhook_notification_channel_1 = require("./notifications/webhook-notification.channel");
24
+ const webhook_notifications_1 = require("./notifications/webhook-notifications");
25
+ const builtin_events_1 = require("./registry/builtin-events");
26
+ const webhook_purge_task_1 = require("./tasks/webhook-purge.task");
27
+ const webhook_endpoints_service_1 = require("./webhook-endpoints.service");
28
+ const webhook_secrets_service_1 = require("./webhook-secrets.service");
29
+ const webhooks_constants_1 = require("./webhooks.constants");
30
+ const webhooks_options_1 = require("./webhooks.options");
31
+ const webhooks_errors_1 = require("./webhooks.errors");
32
+ const webhooks_repository_1 = require("./webhooks.repository");
33
+ const webhooks_service_1 = require("./webhooks.service");
34
+ // =============================================================================
35
+ // WebhooksModule (issue #1046)
36
+ // =============================================================================
37
+ //
38
+ // Outbound, signed webhooks: endpoints a member, an organization or the
39
+ // deployment registers; an event catalog; a fan-out; one delivery job per
40
+ // (event, endpoint) with retries and a circuit breaker; and a notification
41
+ // channel that forwards a member's notifications to their own endpoints.
42
+ //
43
+ // `JobsModule.forRoot()` and `NotificationsModule.forRoot()` are GLOBAL, so
44
+ // `JobsService`, `JobHandlerRegistry`, `NotificationsService` and
45
+ // `NotificationChannelSenderRegistry` need no import; the core host module
46
+ // provides `PLATFORM_PRISMA` and `AUDIT_SINK`; the three credential stores are
47
+ // imported here (they are deliberately not global). The app binds
48
+ // `WEBHOOKS_SYSTEM_PRISMA` (the bypass client) in a module it passes as `imports`.
49
+ // =============================================================================
50
+ /**
51
+ * The webhooks slice for one app.
52
+ *
53
+ * @stability experimental
54
+ */
55
+ let WebhooksModule = WebhooksModule_1 = class WebhooksModule {
56
+ /**
57
+ * The slice for one app. Call once, before bootstrap. Registers the platform's
58
+ * webhook events, the slice's error codes and (when the app's manifest has not
59
+ * already) the `webhook` notification channel; each registration is
60
+ * idempotent.
61
+ *
62
+ * @param options - see {@link WebhooksModuleOptions}; all optional.
63
+ * @returns the dynamic module. It exports `WebhooksService`, `WebhookEndpointsService` and `WEBHOOKS_OPTIONS`.
64
+ * @throws Error when an option is invalid.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * export const webhooksModule = WebhooksModule.forRoot({ appName: APP_NAME, imports: [WebhooksHostModule] });
69
+ * ```
70
+ *
71
+ * @extensionPoint option
72
+ * @stability experimental
73
+ */
74
+ static forRoot(options = {}) {
75
+ const resolved = (0, webhooks_options_1.resolveWebhooksModuleOptions)(options);
76
+ (0, builtin_events_1.registerBuiltinWebhookEvents)();
77
+ (0, webhooks_errors_1.registerWebhookErrorCodes)();
78
+ (0, webhooks_constants_1.registerWebhooksSystemAccessReason)();
79
+ if (!(0, index_2.isRegisteredNotificationChannel)(webhook_notifications_1.WEBHOOK_NOTIFICATION_CHANNEL.id))
80
+ (0, index_2.registerNotificationChannel)(webhook_notifications_1.WEBHOOK_NOTIFICATION_CHANNEL);
81
+ return {
82
+ module: WebhooksModule_1,
83
+ imports: [index_1.CredentialsModule, index_1.UserCredentialsModule, index_1.OrgCredentialsModule, ...resolved.imports],
84
+ controllers: [webhooks_controller_1.WebhooksController, org_webhooks_controller_1.OrgWebhooksController, admin_webhooks_controller_1.AdminWebhooksController],
85
+ providers: [
86
+ { provide: webhooks_options_1.WEBHOOKS_OPTIONS, useValue: resolved },
87
+ { provide: transport_1.WEBHOOKS_TRANSPORT, useValue: resolved.transport ?? transport_1.nodeWebhookTransport },
88
+ { provide: transport_1.WEBHOOKS_RESOLVER, useValue: resolved.resolver ?? egress_guard_1.systemHostResolver },
89
+ { provide: webhooks_repository_1.WebhooksRepository, useClass: webhooks_repository_1.PrismaWebhooksRepository },
90
+ { provide: webhook_secrets_service_1.WebhookSecrets, useClass: webhook_secrets_service_1.CredentialsWebhookSecrets },
91
+ webhooks_service_1.WebhooksService,
92
+ webhook_endpoints_service_1.WebhookEndpointsService,
93
+ webhook_deliver_handler_1.WebhookDeliverHandler,
94
+ webhook_fanout_handler_1.WebhookFanoutHandler,
95
+ webhook_purge_handler_1.WebhookPurgeHandler,
96
+ webhook_event_listeners_1.WebhookEventListeners,
97
+ webhook_notification_channel_1.WebhookNotificationChannel,
98
+ ...(resolved.tasks.purge ? [webhook_purge_task_1.WebhookPurgeTask] : []),
99
+ ],
100
+ exports: [webhooks_options_1.WEBHOOKS_OPTIONS, webhooks_service_1.WebhooksService, webhook_endpoints_service_1.WebhookEndpointsService],
101
+ };
102
+ }
103
+ };
104
+ exports.WebhooksModule = WebhooksModule;
105
+ exports.WebhooksModule = WebhooksModule = WebhooksModule_1 = __decorate([
106
+ (0, common_1.Module)({})
107
+ ], WebhooksModule);
108
+ //# sourceMappingURL=webhooks.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.module.js","sourceRoot":"","sources":["../../src/webhooks/webhooks.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA4D;AAE5D,gDAAsG;AACtG,kDAAsG;AACtG,wDAA2D;AAC3D,kDAAiG;AACjG,gFAA2E;AAC3E,8EAAyE;AACzE,4EAAuE;AACvE,gFAA2E;AAC3E,4EAAuE;AACvE,oEAAgE;AAChE,iFAA4E;AAC5E,+FAA0F;AAC1F,iFAAqF;AACrF,8DAAyE;AACzE,mEAA8D;AAC9D,2EAAsE;AACtE,uEAAsF;AACtF,6DAA0E;AAC1E,yDAAgH;AAChH,uDAA8D;AAC9D,+DAAqF;AACrF,yDAAqD;AAErD,gFAAgF;AAChF,+BAA+B;AAC/B,gFAAgF;AAChF,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AACzE,EAAE;AACF,4EAA4E;AAC5E,kEAAkE;AAClE,2EAA2E;AAC3E,+EAA+E;AAC/E,kEAAkE;AAClE,mFAAmF;AACnF,gFAAgF;AAEhF;;;;GAI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ACD,OAAO,EAAE,CAAC,mCAAgB,EAAE,kCAAe,EAAE,mDAAuB,CAAC;SACtE,CAAC;IACJ,CAAC;CACF,CAAA;AAhDY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,cAAc,CAgD1B"}
@@ -0,0 +1,119 @@
1
+ import type { ModuleMetadata } from '@nestjs/common';
2
+ import type { HostResolver } from './egress/egress-guard';
3
+ import type { WebhookTransport } from './egress/transport';
4
+ /**
5
+ * Injection token of the resolved {@link WebhooksModuleOptions}.
6
+ *
7
+ * @stability experimental
8
+ */
9
+ export declare const WEBHOOKS_OPTIONS: unique symbol;
10
+ /**
11
+ * Options of `WebhooksModule.forRoot()`; every field is optional.
12
+ *
13
+ * @stability experimental
14
+ */
15
+ export interface WebhooksModuleOptions {
16
+ /** The product name in the `User-Agent` (`<name>-Webhooks/1.0`); a function is read per request. Default `App`. */
17
+ appName?: string | (() => string);
18
+ /** Allow `http:` targets. Development only. Default `false`. */
19
+ allowInsecureHttp?: boolean;
20
+ /** Allow private, loopback and link-local targets and ports below 1024. On-premises and development only. Default `false`. */
21
+ allowPrivateTargets?: boolean;
22
+ /** Host names exempt from the private-address check (an internal receiver an operator vouches for). Default none. */
23
+ allowedHosts?: readonly string[];
24
+ /** Consecutive failed deliveries that switch an endpoint off. Default 20. */
25
+ circuitBreakerThreshold?: number;
26
+ /** Hours the previous secret keeps signing after a rotation. Default 24. */
27
+ rotationOverlapHours?: number;
28
+ /** Days a delivery row is kept. Default 30. */
29
+ deliveryRetentionDays?: number;
30
+ /** The most endpoints one owner may have, per scope. Defaults 20 user, 50 org, 50 system. */
31
+ limits?: {
32
+ /** The most endpoints one member may own. */
33
+ user?: number;
34
+ /** The most endpoints one organization may have. */
35
+ org?: number;
36
+ /** The most endpoints the deployment may have. */
37
+ system?: number;
38
+ };
39
+ /** The deadline of one delivery request, in milliseconds. Default 10000. */
40
+ requestTimeoutMs?: number;
41
+ /** Attempts before a delivery is `dead`. Default 10. */
42
+ maxDeliveryAttempts?: number;
43
+ /** The slice's cron tasks. */
44
+ tasks?: {
45
+ /** Register the daily retention purge cron. Default `true`. */
46
+ purge?: boolean;
47
+ };
48
+ /** Replace the HTTP transport (tests, a proxy). Default: Node's `http(s).request` to the pinned address. */
49
+ transport?: WebhookTransport;
50
+ /** Replace the DNS resolver (tests). Default: the operating system's. */
51
+ resolver?: HostResolver;
52
+ /** Modules imported next to the slice: the app's host module binding `WEBHOOKS_SYSTEM_PRISMA`. */
53
+ imports?: ModuleMetadata['imports'];
54
+ }
55
+ /**
56
+ * {@link WebhooksModuleOptions} with every default applied.
57
+ *
58
+ * @stability experimental
59
+ */
60
+ export interface ResolvedWebhooksModuleOptions {
61
+ /** Reads the product name. */
62
+ readonly appName: () => string;
63
+ /** See the option. */
64
+ readonly allowInsecureHttp: boolean;
65
+ /** See the option. */
66
+ readonly allowPrivateTargets: boolean;
67
+ /** See the option. */
68
+ readonly allowedHosts: readonly string[];
69
+ /** See the option. */
70
+ readonly circuitBreakerThreshold: number;
71
+ /** See the option. */
72
+ readonly rotationOverlapHours: number;
73
+ /** See the option. */
74
+ readonly deliveryRetentionDays: number;
75
+ /** See the option. */
76
+ readonly limits: {
77
+ /** The most endpoints one member may own. */
78
+ readonly user: number;
79
+ /** The most endpoints one organization may have. */
80
+ readonly org: number;
81
+ /** The most endpoints the deployment may have. */
82
+ readonly system: number;
83
+ };
84
+ /** See the option. */
85
+ readonly requestTimeoutMs: number;
86
+ /** See the option. */
87
+ readonly maxDeliveryAttempts: number;
88
+ /** See the option. */
89
+ readonly tasks: {
90
+ /** Whether the daily purge cron is registered. */
91
+ readonly purge: boolean;
92
+ };
93
+ /** The transport override, when given. */
94
+ readonly transport: WebhookTransport | undefined;
95
+ /** The resolver override, when given. */
96
+ readonly resolver: HostResolver | undefined;
97
+ /** The modules imported next to the slice. */
98
+ readonly imports: NonNullable<ModuleMetadata['imports']>;
99
+ }
100
+ /**
101
+ * The product token of a `User-Agent`: letters, digits and `-`.
102
+ *
103
+ * @param name - the application name.
104
+ * @returns the token, `App` when nothing survives.
105
+ *
106
+ * @stability experimental
107
+ */
108
+ export declare function userAgentToken(name: string): string;
109
+ /**
110
+ * Validates `options` and applies the defaults.
111
+ *
112
+ * @param options - what the app passed.
113
+ * @returns the resolved options (frozen).
114
+ * @throws Error when a number is not a positive integer.
115
+ *
116
+ * @stability experimental
117
+ */
118
+ export declare function resolveWebhooksModuleOptions(options?: WebhooksModuleOptions): ResolvedWebhooksModuleOptions;
119
+ //# sourceMappingURL=webhooks.options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.options.d.ts","sourceRoot":"","sources":["../../src/webhooks/webhooks.options.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAAO,MAA4D,CAAC;AAEnG;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,mHAAmH;IACnH,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IAClC,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,8HAA8H;IAC9H,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,qHAAqH;IACrH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,6EAA6E;IAC7E,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,4EAA4E;IAC5E,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,+CAA+C;IAC/C,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6FAA6F;IAC7F,MAAM,CAAC,EAAE;QACP,6CAA6C;QAC7C,IAAI,CAAC,EAA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AAsB;IACtB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,sBAAsB;IACtB,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,sBAAsB;IACtB,QAAQ,CAAC,KAAK,EAAE;QACd,kDAAkD;QAClD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,0CAA0C;IAC1C,QAAQ,CAAC,SAAS,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACjD,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IAC5C,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;CAC1D;AASD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,GAAE,qBAA0B,GAAG,6BAA6B,CA8B/G"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ // =============================================================================
3
+ // WebhooksModule.forRoot() options (issue #1046)
4
+ // =============================================================================
5
+ //
6
+ // CODE OPTIONS, not environment variables or system settings: a retry ceiling
7
+ // or an endpoint limit is a product decision an app makes once. Nothing here
8
+ // holds a secret; signing secrets live in the encrypted credentials store.
9
+ // =============================================================================
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.WEBHOOKS_OPTIONS = void 0;
12
+ exports.userAgentToken = userAgentToken;
13
+ exports.resolveWebhooksModuleOptions = resolveWebhooksModuleOptions;
14
+ const webhooks_constants_1 = require("./webhooks.constants");
15
+ /**
16
+ * Injection token of the resolved {@link WebhooksModuleOptions}.
17
+ *
18
+ * @stability experimental
19
+ */
20
+ exports.WEBHOOKS_OPTIONS = Symbol.for('@marinoscar/platform/webhooks/OPTIONS');
21
+ function positiveInt(name, value) {
22
+ if (value === undefined)
23
+ return;
24
+ if (typeof value !== 'number' || !Number.isInteger(value) || value < 1) {
25
+ throw new Error(`WebhooksModule.forRoot(): ${name} must be a positive integer (got ${String(value)})`);
26
+ }
27
+ }
28
+ /**
29
+ * The product token of a `User-Agent`: letters, digits and `-`.
30
+ *
31
+ * @param name - the application name.
32
+ * @returns the token, `App` when nothing survives.
33
+ *
34
+ * @stability experimental
35
+ */
36
+ function userAgentToken(name) {
37
+ const token = name.replace(/[^A-Za-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 40);
38
+ return token || 'App';
39
+ }
40
+ /**
41
+ * Validates `options` and applies the defaults.
42
+ *
43
+ * @param options - what the app passed.
44
+ * @returns the resolved options (frozen).
45
+ * @throws Error when a number is not a positive integer.
46
+ *
47
+ * @stability experimental
48
+ */
49
+ function resolveWebhooksModuleOptions(options = {}) {
50
+ positiveInt('circuitBreakerThreshold', options.circuitBreakerThreshold);
51
+ positiveInt('rotationOverlapHours', options.rotationOverlapHours);
52
+ positiveInt('deliveryRetentionDays', options.deliveryRetentionDays);
53
+ positiveInt('requestTimeoutMs', options.requestTimeoutMs);
54
+ positiveInt('maxDeliveryAttempts', options.maxDeliveryAttempts);
55
+ positiveInt('limits.user', options.limits?.user);
56
+ positiveInt('limits.org', options.limits?.org);
57
+ positiveInt('limits.system', options.limits?.system);
58
+ const name = options.appName;
59
+ return Object.freeze({
60
+ appName: typeof name === 'function' ? () => userAgentToken(name()) : () => userAgentToken(name ?? 'App'),
61
+ allowInsecureHttp: options.allowInsecureHttp ?? false,
62
+ allowPrivateTargets: options.allowPrivateTargets ?? false,
63
+ allowedHosts: Object.freeze([...(options.allowedHosts ?? [])]),
64
+ circuitBreakerThreshold: options.circuitBreakerThreshold ?? webhooks_constants_1.WEBHOOK_DEFAULTS.circuitBreakerThreshold,
65
+ rotationOverlapHours: options.rotationOverlapHours ?? webhooks_constants_1.WEBHOOK_DEFAULTS.rotationOverlapHours,
66
+ deliveryRetentionDays: options.deliveryRetentionDays ?? webhooks_constants_1.WEBHOOK_DEFAULTS.deliveryRetentionDays,
67
+ limits: Object.freeze({
68
+ user: options.limits?.user ?? webhooks_constants_1.WEBHOOK_DEFAULTS.limits.user,
69
+ org: options.limits?.org ?? webhooks_constants_1.WEBHOOK_DEFAULTS.limits.org,
70
+ system: options.limits?.system ?? webhooks_constants_1.WEBHOOK_DEFAULTS.limits.system,
71
+ }),
72
+ requestTimeoutMs: options.requestTimeoutMs ?? webhooks_constants_1.WEBHOOK_DEFAULTS.requestTimeoutMs,
73
+ maxDeliveryAttempts: options.maxDeliveryAttempts ?? webhooks_constants_1.WEBHOOK_DEFAULTS.maxDeliveryAttempts,
74
+ tasks: Object.freeze({ purge: options.tasks?.purge ?? true }),
75
+ transport: options.transport,
76
+ resolver: options.resolver,
77
+ imports: [...(options.imports ?? [])],
78
+ });
79
+ }
80
+ //# sourceMappingURL=webhooks.options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.options.js","sourceRoot":"","sources":["../../src/webhooks/webhooks.options.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,iDAAiD;AACjD,gFAAgF;AAChF,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,2EAA2E;AAC3E,gFAAgF;;;AA0HhF,wCAGC;AAWD,oEA8BC;AAhKD,6DAAwD;AAExD;;;;GAIG;AACU,QAAA,gBAAgB,GAAkB,MAAM,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;AA8FnG,SAAS,WAAW,CAAC,IAAY,EAAE,KAAyB;IAC1D,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,oCAAoC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzG,CAAC;AACH,CAAC;AAED;;;;;;;G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