@webiny/webhooks 0.0.0-unstable.0156a4c312

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 (577) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/admin/WebhookRoutes.d.ts +2 -0
  4. package/admin/WebhookRoutes.js +78 -0
  5. package/admin/WebhookRoutes.js.map +1 -0
  6. package/admin/Webhooks.d.ts +2 -0
  7. package/admin/Webhooks.js +61 -0
  8. package/admin/Webhooks.js.map +1 -0
  9. package/admin/features/ListWebhooks/ListWebhooksGateway.d.ts +11 -0
  10. package/admin/features/ListWebhooks/ListWebhooksGateway.js +68 -0
  11. package/admin/features/ListWebhooks/ListWebhooksGateway.js.map +1 -0
  12. package/admin/features/ListWebhooks/ListWebhooksRepository.d.ts +10 -0
  13. package/admin/features/ListWebhooks/ListWebhooksRepository.js +18 -0
  14. package/admin/features/ListWebhooks/ListWebhooksRepository.js.map +1 -0
  15. package/admin/features/ListWebhooks/ListWebhooksUseCase.d.ts +10 -0
  16. package/admin/features/ListWebhooks/ListWebhooksUseCase.js +18 -0
  17. package/admin/features/ListWebhooks/ListWebhooksUseCase.js.map +1 -0
  18. package/admin/features/ListWebhooks/abstractions.d.ts +37 -0
  19. package/admin/features/ListWebhooks/abstractions.js +7 -0
  20. package/admin/features/ListWebhooks/abstractions.js.map +1 -0
  21. package/admin/features/ListWebhooks/feature.d.ts +3 -0
  22. package/admin/features/ListWebhooks/feature.js +21 -0
  23. package/admin/features/ListWebhooks/feature.js.map +1 -0
  24. package/admin/features/ListWebhooks/index.d.ts +2 -0
  25. package/admin/features/ListWebhooks/index.js +2 -0
  26. package/admin/features/createWebhook/CreateWebhookGateway.d.ts +12 -0
  27. package/admin/features/createWebhook/CreateWebhookGateway.js +21 -0
  28. package/admin/features/createWebhook/CreateWebhookGateway.js.map +1 -0
  29. package/admin/features/createWebhook/CreateWebhookUseCase.d.ts +11 -0
  30. package/admin/features/createWebhook/CreateWebhookUseCase.js +18 -0
  31. package/admin/features/createWebhook/CreateWebhookUseCase.js.map +1 -0
  32. package/admin/features/createWebhook/abstractions.d.ts +23 -0
  33. package/admin/features/createWebhook/abstractions.js +6 -0
  34. package/admin/features/createWebhook/abstractions.js.map +1 -0
  35. package/admin/features/createWebhook/feature.d.ts +3 -0
  36. package/admin/features/createWebhook/feature.js +19 -0
  37. package/admin/features/createWebhook/feature.js.map +1 -0
  38. package/admin/features/createWebhook/index.d.ts +2 -0
  39. package/admin/features/createWebhook/index.js +2 -0
  40. package/admin/features/deleteWebhook/DeleteWebhookGateway.d.ts +11 -0
  41. package/admin/features/deleteWebhook/DeleteWebhookGateway.js +23 -0
  42. package/admin/features/deleteWebhook/DeleteWebhookGateway.js.map +1 -0
  43. package/admin/features/deleteWebhook/DeleteWebhookUseCase.d.ts +10 -0
  44. package/admin/features/deleteWebhook/DeleteWebhookUseCase.js +18 -0
  45. package/admin/features/deleteWebhook/DeleteWebhookUseCase.js.map +1 -0
  46. package/admin/features/deleteWebhook/abstractions.d.ts +14 -0
  47. package/admin/features/deleteWebhook/abstractions.js +6 -0
  48. package/admin/features/deleteWebhook/abstractions.js.map +1 -0
  49. package/admin/features/deleteWebhook/feature.d.ts +3 -0
  50. package/admin/features/deleteWebhook/feature.js +19 -0
  51. package/admin/features/deleteWebhook/feature.js.map +1 -0
  52. package/admin/features/deleteWebhook/index.d.ts +2 -0
  53. package/admin/features/deleteWebhook/index.js +2 -0
  54. package/admin/features/getWebhook/GetWebhookGateway.d.ts +12 -0
  55. package/admin/features/getWebhook/GetWebhookGateway.js +23 -0
  56. package/admin/features/getWebhook/GetWebhookGateway.js.map +1 -0
  57. package/admin/features/getWebhook/GetWebhookUseCase.d.ts +11 -0
  58. package/admin/features/getWebhook/GetWebhookUseCase.js +18 -0
  59. package/admin/features/getWebhook/GetWebhookUseCase.js.map +1 -0
  60. package/admin/features/getWebhook/abstractions.d.ts +15 -0
  61. package/admin/features/getWebhook/abstractions.js +6 -0
  62. package/admin/features/getWebhook/abstractions.js.map +1 -0
  63. package/admin/features/getWebhook/feature.d.ts +3 -0
  64. package/admin/features/getWebhook/feature.js +19 -0
  65. package/admin/features/getWebhook/feature.js.map +1 -0
  66. package/admin/features/getWebhook/index.d.ts +2 -0
  67. package/admin/features/getWebhook/index.js +2 -0
  68. package/admin/features/getWebhookSettings/GetWebhookSettingsGateway.d.ts +12 -0
  69. package/admin/features/getWebhookSettings/GetWebhookSettingsGateway.js +41 -0
  70. package/admin/features/getWebhookSettings/GetWebhookSettingsGateway.js.map +1 -0
  71. package/admin/features/getWebhookSettings/GetWebhookSettingsUseCase.d.ts +11 -0
  72. package/admin/features/getWebhookSettings/GetWebhookSettingsUseCase.js +18 -0
  73. package/admin/features/getWebhookSettings/GetWebhookSettingsUseCase.js.map +1 -0
  74. package/admin/features/getWebhookSettings/abstractions.d.ts +15 -0
  75. package/admin/features/getWebhookSettings/abstractions.js +6 -0
  76. package/admin/features/getWebhookSettings/abstractions.js.map +1 -0
  77. package/admin/features/getWebhookSettings/feature.d.ts +3 -0
  78. package/admin/features/getWebhookSettings/feature.js +19 -0
  79. package/admin/features/getWebhookSettings/feature.js.map +1 -0
  80. package/admin/features/getWebhookSettings/index.d.ts +2 -0
  81. package/admin/features/getWebhookSettings/index.js +2 -0
  82. package/admin/features/listAvailableEvents/ListAvailableEventsGateway.d.ts +12 -0
  83. package/admin/features/listAvailableEvents/ListAvailableEventsGateway.js +21 -0
  84. package/admin/features/listAvailableEvents/ListAvailableEventsGateway.js.map +1 -0
  85. package/admin/features/listAvailableEvents/ListAvailableEventsUseCase.d.ts +11 -0
  86. package/admin/features/listAvailableEvents/ListAvailableEventsUseCase.js +18 -0
  87. package/admin/features/listAvailableEvents/ListAvailableEventsUseCase.js.map +1 -0
  88. package/admin/features/listAvailableEvents/abstractions.d.ts +15 -0
  89. package/admin/features/listAvailableEvents/abstractions.js +6 -0
  90. package/admin/features/listAvailableEvents/abstractions.js.map +1 -0
  91. package/admin/features/listAvailableEvents/feature.d.ts +3 -0
  92. package/admin/features/listAvailableEvents/feature.js +19 -0
  93. package/admin/features/listAvailableEvents/feature.js.map +1 -0
  94. package/admin/features/listAvailableEvents/index.d.ts +2 -0
  95. package/admin/features/listAvailableEvents/index.js +2 -0
  96. package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesGateway.d.ts +11 -0
  97. package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesGateway.js +28 -0
  98. package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesGateway.js.map +1 -0
  99. package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesUseCase.d.ts +10 -0
  100. package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesUseCase.js +18 -0
  101. package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesUseCase.js.map +1 -0
  102. package/admin/features/listWebhookDeliveries/abstractions.d.ts +33 -0
  103. package/admin/features/listWebhookDeliveries/abstractions.js +6 -0
  104. package/admin/features/listWebhookDeliveries/abstractions.js.map +1 -0
  105. package/admin/features/listWebhookDeliveries/feature.d.ts +3 -0
  106. package/admin/features/listWebhookDeliveries/feature.js +19 -0
  107. package/admin/features/listWebhookDeliveries/feature.js.map +1 -0
  108. package/admin/features/listWebhookDeliveries/index.d.ts +2 -0
  109. package/admin/features/listWebhookDeliveries/index.js +2 -0
  110. package/admin/features/permissions/abstractions.d.ts +17 -0
  111. package/admin/features/permissions/abstractions.js +6 -0
  112. package/admin/features/permissions/abstractions.js.map +1 -0
  113. package/admin/features/permissions/feature.d.ts +14 -0
  114. package/admin/features/permissions/feature.js +7 -0
  115. package/admin/features/permissions/feature.js.map +1 -0
  116. package/admin/features/permissions/index.d.ts +2 -0
  117. package/admin/features/permissions/index.js +2 -0
  118. package/admin/features/resendWebhookDelivery/ResendWebhookDeliveryGateway.d.ts +11 -0
  119. package/admin/features/resendWebhookDelivery/ResendWebhookDeliveryGateway.js +23 -0
  120. package/admin/features/resendWebhookDelivery/ResendWebhookDeliveryGateway.js.map +1 -0
  121. package/admin/features/resendWebhookDelivery/ResendWebhookDeliveryUseCase.d.ts +10 -0
  122. package/admin/features/resendWebhookDelivery/ResendWebhookDeliveryUseCase.js +18 -0
  123. package/admin/features/resendWebhookDelivery/ResendWebhookDeliveryUseCase.js.map +1 -0
  124. package/admin/features/resendWebhookDelivery/abstractions.d.ts +14 -0
  125. package/admin/features/resendWebhookDelivery/abstractions.js +6 -0
  126. package/admin/features/resendWebhookDelivery/abstractions.js.map +1 -0
  127. package/admin/features/resendWebhookDelivery/feature.d.ts +3 -0
  128. package/admin/features/resendWebhookDelivery/feature.js +19 -0
  129. package/admin/features/resendWebhookDelivery/feature.js.map +1 -0
  130. package/admin/features/resendWebhookDelivery/index.d.ts +2 -0
  131. package/admin/features/resendWebhookDelivery/index.js +2 -0
  132. package/admin/features/triggerWebhook/TriggerWebhookGateway.d.ts +12 -0
  133. package/admin/features/triggerWebhook/TriggerWebhookGateway.js +24 -0
  134. package/admin/features/triggerWebhook/TriggerWebhookGateway.js.map +1 -0
  135. package/admin/features/triggerWebhook/TriggerWebhookUseCase.d.ts +11 -0
  136. package/admin/features/triggerWebhook/TriggerWebhookUseCase.js +18 -0
  137. package/admin/features/triggerWebhook/TriggerWebhookUseCase.js.map +1 -0
  138. package/admin/features/triggerWebhook/abstractions.d.ts +15 -0
  139. package/admin/features/triggerWebhook/abstractions.js +6 -0
  140. package/admin/features/triggerWebhook/abstractions.js.map +1 -0
  141. package/admin/features/triggerWebhook/feature.d.ts +3 -0
  142. package/admin/features/triggerWebhook/feature.js +19 -0
  143. package/admin/features/triggerWebhook/feature.js.map +1 -0
  144. package/admin/features/triggerWebhook/index.d.ts +2 -0
  145. package/admin/features/triggerWebhook/index.js +2 -0
  146. package/admin/features/updateWebhook/UpdateWebhookGateway.d.ts +12 -0
  147. package/admin/features/updateWebhook/UpdateWebhookGateway.js +24 -0
  148. package/admin/features/updateWebhook/UpdateWebhookGateway.js.map +1 -0
  149. package/admin/features/updateWebhook/UpdateWebhookUseCase.d.ts +11 -0
  150. package/admin/features/updateWebhook/UpdateWebhookUseCase.js +18 -0
  151. package/admin/features/updateWebhook/UpdateWebhookUseCase.js.map +1 -0
  152. package/admin/features/updateWebhook/abstractions.d.ts +23 -0
  153. package/admin/features/updateWebhook/abstractions.js +6 -0
  154. package/admin/features/updateWebhook/abstractions.js.map +1 -0
  155. package/admin/features/updateWebhook/feature.d.ts +3 -0
  156. package/admin/features/updateWebhook/feature.js +19 -0
  157. package/admin/features/updateWebhook/feature.js.map +1 -0
  158. package/admin/features/updateWebhook/index.d.ts +2 -0
  159. package/admin/features/updateWebhook/index.js +2 -0
  160. package/admin/features/updateWebhookSettings/UpdateWebhookSettingsGateway.d.ts +12 -0
  161. package/admin/features/updateWebhookSettings/UpdateWebhookSettingsGateway.js +44 -0
  162. package/admin/features/updateWebhookSettings/UpdateWebhookSettingsGateway.js.map +1 -0
  163. package/admin/features/updateWebhookSettings/UpdateWebhookSettingsUseCase.d.ts +11 -0
  164. package/admin/features/updateWebhookSettings/UpdateWebhookSettingsUseCase.js +18 -0
  165. package/admin/features/updateWebhookSettings/UpdateWebhookSettingsUseCase.js.map +1 -0
  166. package/admin/features/updateWebhookSettings/abstractions.d.ts +19 -0
  167. package/admin/features/updateWebhookSettings/abstractions.js +6 -0
  168. package/admin/features/updateWebhookSettings/abstractions.js.map +1 -0
  169. package/admin/features/updateWebhookSettings/feature.d.ts +3 -0
  170. package/admin/features/updateWebhookSettings/feature.js +19 -0
  171. package/admin/features/updateWebhookSettings/feature.js.map +1 -0
  172. package/admin/features/updateWebhookSettings/index.d.ts +2 -0
  173. package/admin/features/updateWebhookSettings/index.js +2 -0
  174. package/admin/index.d.ts +2 -0
  175. package/admin/index.js +2 -0
  176. package/admin/permissions.d.ts +12 -0
  177. package/admin/permissions.js +22 -0
  178. package/admin/permissions.js.map +1 -0
  179. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesDataSource.d.ts +15 -0
  180. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesDataSource.js +66 -0
  181. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesDataSource.js.map +1 -0
  182. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.d.ts +41 -0
  183. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js +223 -0
  184. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js.map +1 -0
  185. package/admin/presentation/WebhookDeliveriesPage/abstractions.d.ts +42 -0
  186. package/admin/presentation/WebhookDeliveriesPage/abstractions.js +5 -0
  187. package/admin/presentation/WebhookDeliveriesPage/abstractions.js.map +1 -0
  188. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.d.ts +11 -0
  189. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.js +36 -0
  190. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.js.map +1 -0
  191. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.d.ts +9 -0
  192. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.js +43 -0
  193. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.js.map +1 -0
  194. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.d.ts +7 -0
  195. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.js +76 -0
  196. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.js.map +1 -0
  197. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.d.ts +9 -0
  198. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js +98 -0
  199. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js.map +1 -0
  200. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.d.ts +9 -0
  201. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js +61 -0
  202. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js.map +1 -0
  203. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.d.ts +2 -0
  204. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js +16 -0
  205. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js.map +1 -0
  206. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.d.ts +2 -0
  207. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js +73 -0
  208. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js.map +1 -0
  209. package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.d.ts +1 -0
  210. package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.js +13 -0
  211. package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.js.map +1 -0
  212. package/admin/presentation/WebhookDeliveriesPage/feature.d.ts +3 -0
  213. package/admin/presentation/WebhookDeliveriesPage/feature.js +17 -0
  214. package/admin/presentation/WebhookDeliveriesPage/feature.js.map +1 -0
  215. package/admin/presentation/WebhookDeliveriesPage/index.d.ts +5 -0
  216. package/admin/presentation/WebhookDeliveriesPage/index.js +1 -0
  217. package/admin/presentation/WebhookForm/WebhookFormPresenter.d.ts +39 -0
  218. package/admin/presentation/WebhookForm/WebhookFormPresenter.js +248 -0
  219. package/admin/presentation/WebhookForm/WebhookFormPresenter.js.map +1 -0
  220. package/admin/presentation/WebhookForm/abstractions.d.ts +24 -0
  221. package/admin/presentation/WebhookForm/abstractions.js +5 -0
  222. package/admin/presentation/WebhookForm/abstractions.js.map +1 -0
  223. package/admin/presentation/WebhookForm/components/SigningSecret.d.ts +9 -0
  224. package/admin/presentation/WebhookForm/components/SigningSecret.js +47 -0
  225. package/admin/presentation/WebhookForm/components/SigningSecret.js.map +1 -0
  226. package/admin/presentation/WebhookForm/components/WebhookFormView.d.ts +2 -0
  227. package/admin/presentation/WebhookForm/components/WebhookFormView.js +95 -0
  228. package/admin/presentation/WebhookForm/components/WebhookFormView.js.map +1 -0
  229. package/admin/presentation/WebhookForm/feature.d.ts +3 -0
  230. package/admin/presentation/WebhookForm/feature.js +17 -0
  231. package/admin/presentation/WebhookForm/feature.js.map +1 -0
  232. package/admin/presentation/WebhookForm/index.d.ts +2 -0
  233. package/admin/presentation/WebhookForm/index.js +2 -0
  234. package/admin/presentation/WebhookList/WebhookListDataSource.d.ts +14 -0
  235. package/admin/presentation/WebhookList/WebhookListDataSource.js +40 -0
  236. package/admin/presentation/WebhookList/WebhookListDataSource.js.map +1 -0
  237. package/admin/presentation/WebhookList/WebhookListPresenter.d.ts +46 -0
  238. package/admin/presentation/WebhookList/WebhookListPresenter.js +92 -0
  239. package/admin/presentation/WebhookList/WebhookListPresenter.js.map +1 -0
  240. package/admin/presentation/WebhookList/abstractions.d.ts +45 -0
  241. package/admin/presentation/WebhookList/abstractions.js +5 -0
  242. package/admin/presentation/WebhookList/abstractions.js.map +1 -0
  243. package/admin/presentation/WebhookList/components/CreateWebhookButton.d.ts +2 -0
  244. package/admin/presentation/WebhookList/components/CreateWebhookButton.js +22 -0
  245. package/admin/presentation/WebhookList/components/CreateWebhookButton.js.map +1 -0
  246. package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.d.ts +2 -0
  247. package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.js +16 -0
  248. package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.js.map +1 -0
  249. package/admin/presentation/WebhookList/components/WebhookListContent.d.ts +9 -0
  250. package/admin/presentation/WebhookList/components/WebhookListContent.js +170 -0
  251. package/admin/presentation/WebhookList/components/WebhookListContent.js.map +1 -0
  252. package/admin/presentation/WebhookList/components/WebhookListView.d.ts +2 -0
  253. package/admin/presentation/WebhookList/components/WebhookListView.js +49 -0
  254. package/admin/presentation/WebhookList/components/WebhookListView.js.map +1 -0
  255. package/admin/presentation/WebhookList/feature.d.ts +3 -0
  256. package/admin/presentation/WebhookList/feature.js +17 -0
  257. package/admin/presentation/WebhookList/feature.js.map +1 -0
  258. package/admin/presentation/WebhookList/index.d.ts +2 -0
  259. package/admin/presentation/WebhookList/index.js +2 -0
  260. package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.d.ts +21 -0
  261. package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.js +91 -0
  262. package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.js.map +1 -0
  263. package/admin/presentation/WebhookSettings/abstractions.d.ts +16 -0
  264. package/admin/presentation/WebhookSettings/abstractions.js +5 -0
  265. package/admin/presentation/WebhookSettings/abstractions.js.map +1 -0
  266. package/admin/presentation/WebhookSettings/components/WebhookSettingsView.d.ts +2 -0
  267. package/admin/presentation/WebhookSettings/components/WebhookSettingsView.js +56 -0
  268. package/admin/presentation/WebhookSettings/components/WebhookSettingsView.js.map +1 -0
  269. package/admin/presentation/WebhookSettings/feature.d.ts +3 -0
  270. package/admin/presentation/WebhookSettings/feature.js +17 -0
  271. package/admin/presentation/WebhookSettings/feature.js.map +1 -0
  272. package/admin/presentation/WebhookSettings/index.d.ts +2 -0
  273. package/admin/presentation/WebhookSettings/index.js +2 -0
  274. package/admin/presentation/security/HasPermission.d.ts +12 -0
  275. package/admin/presentation/security/HasPermission.js +6 -0
  276. package/admin/presentation/security/HasPermission.js.map +1 -0
  277. package/admin/presentation/security/usePermissions.d.ts +12 -0
  278. package/admin/presentation/security/usePermissions.js +6 -0
  279. package/admin/presentation/security/usePermissions.js.map +1 -0
  280. package/admin/routes.d.ts +11 -0
  281. package/admin/routes.js +28 -0
  282. package/admin/routes.js.map +1 -0
  283. package/admin/shared/types.d.ts +9 -0
  284. package/admin/shared/types.js +0 -0
  285. package/api/Extension.d.ts +1 -0
  286. package/api/Extension.js +1 -0
  287. package/api/WebhooksFeature.d.ts +4 -0
  288. package/api/WebhooksFeature.js +65 -0
  289. package/api/WebhooksFeature.js.map +1 -0
  290. package/api/domain/Webhook.d.ts +27 -0
  291. package/api/domain/Webhook.js +0 -0
  292. package/api/domain/WebhookDelivery.d.ts +35 -0
  293. package/api/domain/WebhookDelivery.js +0 -0
  294. package/api/domain/WebhookSettings.d.ts +4 -0
  295. package/api/domain/WebhookSettings.js +0 -0
  296. package/api/domain/constants.d.ts +5 -0
  297. package/api/domain/constants.js +8 -0
  298. package/api/domain/constants.js.map +1 -0
  299. package/api/domain/errors.d.ts +41 -0
  300. package/api/domain/errors.js +83 -0
  301. package/api/domain/errors.js.map +1 -0
  302. package/api/features/CreateWebhook/CreateWebhookRepository.d.ts +18 -0
  303. package/api/features/CreateWebhook/CreateWebhookRepository.js +43 -0
  304. package/api/features/CreateWebhook/CreateWebhookRepository.js.map +1 -0
  305. package/api/features/CreateWebhook/CreateWebhookUseCase.d.ts +16 -0
  306. package/api/features/CreateWebhook/CreateWebhookUseCase.js +48 -0
  307. package/api/features/CreateWebhook/CreateWebhookUseCase.js.map +1 -0
  308. package/api/features/CreateWebhook/abstractions.d.ts +33 -0
  309. package/api/features/CreateWebhook/abstractions.js +6 -0
  310. package/api/features/CreateWebhook/abstractions.js.map +1 -0
  311. package/api/features/CreateWebhook/feature.d.ts +4 -0
  312. package/api/features/CreateWebhook/feature.js +13 -0
  313. package/api/features/CreateWebhook/feature.js.map +1 -0
  314. package/api/features/CreateWebhook/schema.d.ts +10 -0
  315. package/api/features/CreateWebhook/schema.js +16 -0
  316. package/api/features/CreateWebhook/schema.js.map +1 -0
  317. package/api/features/CreateWebhookDelivery/CreateWebhookDeliveryRepository.d.ts +20 -0
  318. package/api/features/CreateWebhookDelivery/CreateWebhookDeliveryRepository.js +60 -0
  319. package/api/features/CreateWebhookDelivery/CreateWebhookDeliveryRepository.js.map +1 -0
  320. package/api/features/CreateWebhookDelivery/abstractions.d.ts +21 -0
  321. package/api/features/CreateWebhookDelivery/abstractions.js +5 -0
  322. package/api/features/CreateWebhookDelivery/abstractions.js.map +1 -0
  323. package/api/features/CreateWebhookDelivery/feature.d.ts +4 -0
  324. package/api/features/CreateWebhookDelivery/feature.js +11 -0
  325. package/api/features/CreateWebhookDelivery/feature.js.map +1 -0
  326. package/api/features/DeleteWebhook/DeleteWebhookRepository.d.ts +19 -0
  327. package/api/features/DeleteWebhook/DeleteWebhookRepository.js +67 -0
  328. package/api/features/DeleteWebhook/DeleteWebhookRepository.js.map +1 -0
  329. package/api/features/DeleteWebhook/DeleteWebhookUseCase.d.ts +15 -0
  330. package/api/features/DeleteWebhook/DeleteWebhookUseCase.js +34 -0
  331. package/api/features/DeleteWebhook/DeleteWebhookUseCase.js.map +1 -0
  332. package/api/features/DeleteWebhook/abstractions.d.ts +20 -0
  333. package/api/features/DeleteWebhook/abstractions.js +6 -0
  334. package/api/features/DeleteWebhook/abstractions.js.map +1 -0
  335. package/api/features/DeleteWebhook/feature.d.ts +4 -0
  336. package/api/features/DeleteWebhook/feature.js +13 -0
  337. package/api/features/DeleteWebhook/feature.js.map +1 -0
  338. package/api/features/DeleteWebhook/schema.d.ts +4 -0
  339. package/api/features/DeleteWebhook/schema.js +7 -0
  340. package/api/features/DeleteWebhook/schema.js.map +1 -0
  341. package/api/features/GetWebhook/GetWebhookRepository.d.ts +17 -0
  342. package/api/features/GetWebhook/GetWebhookRepository.js +39 -0
  343. package/api/features/GetWebhook/GetWebhookRepository.js.map +1 -0
  344. package/api/features/GetWebhook/GetWebhookUseCase.d.ts +14 -0
  345. package/api/features/GetWebhook/GetWebhookUseCase.js +29 -0
  346. package/api/features/GetWebhook/GetWebhookUseCase.js.map +1 -0
  347. package/api/features/GetWebhook/abstractions.d.ts +21 -0
  348. package/api/features/GetWebhook/abstractions.js +6 -0
  349. package/api/features/GetWebhook/abstractions.js.map +1 -0
  350. package/api/features/GetWebhook/feature.d.ts +4 -0
  351. package/api/features/GetWebhook/feature.js +13 -0
  352. package/api/features/GetWebhook/feature.js.map +1 -0
  353. package/api/features/GetWebhook/schema.d.ts +4 -0
  354. package/api/features/GetWebhook/schema.js +7 -0
  355. package/api/features/GetWebhook/schema.js.map +1 -0
  356. package/api/features/GetWebhookDelivery/GetWebhookDeliveryRepository.d.ts +17 -0
  357. package/api/features/GetWebhookDelivery/GetWebhookDeliveryRepository.js +39 -0
  358. package/api/features/GetWebhookDelivery/GetWebhookDeliveryRepository.js.map +1 -0
  359. package/api/features/GetWebhookDelivery/GetWebhookDeliveryUseCase.d.ts +14 -0
  360. package/api/features/GetWebhookDelivery/GetWebhookDeliveryUseCase.js +29 -0
  361. package/api/features/GetWebhookDelivery/GetWebhookDeliveryUseCase.js.map +1 -0
  362. package/api/features/GetWebhookDelivery/abstractions.d.ts +21 -0
  363. package/api/features/GetWebhookDelivery/abstractions.js +6 -0
  364. package/api/features/GetWebhookDelivery/abstractions.js.map +1 -0
  365. package/api/features/GetWebhookDelivery/feature.d.ts +4 -0
  366. package/api/features/GetWebhookDelivery/feature.js +13 -0
  367. package/api/features/GetWebhookDelivery/feature.js.map +1 -0
  368. package/api/features/GetWebhookDelivery/schema.d.ts +4 -0
  369. package/api/features/GetWebhookDelivery/schema.js +7 -0
  370. package/api/features/GetWebhookDelivery/schema.js.map +1 -0
  371. package/api/features/GetWebhookSettings/GetWebhookSettingsRepository.d.ts +19 -0
  372. package/api/features/GetWebhookSettings/GetWebhookSettingsRepository.js +57 -0
  373. package/api/features/GetWebhookSettings/GetWebhookSettingsRepository.js.map +1 -0
  374. package/api/features/GetWebhookSettings/abstractions.d.ts +13 -0
  375. package/api/features/GetWebhookSettings/abstractions.js +5 -0
  376. package/api/features/GetWebhookSettings/abstractions.js.map +1 -0
  377. package/api/features/GetWebhookSettings/feature.d.ts +4 -0
  378. package/api/features/GetWebhookSettings/feature.js +11 -0
  379. package/api/features/GetWebhookSettings/feature.js.map +1 -0
  380. package/api/features/ListAvailableWebhookEvents/ListAvailableWebhookEventsUseCase.d.ts +14 -0
  381. package/api/features/ListAvailableWebhookEvents/ListAvailableWebhookEventsUseCase.js +30 -0
  382. package/api/features/ListAvailableWebhookEvents/ListAvailableWebhookEventsUseCase.js.map +1 -0
  383. package/api/features/ListAvailableWebhookEvents/abstractions.d.ts +9 -0
  384. package/api/features/ListAvailableWebhookEvents/abstractions.js +5 -0
  385. package/api/features/ListAvailableWebhookEvents/abstractions.js.map +1 -0
  386. package/api/features/ListAvailableWebhookEvents/feature.d.ts +4 -0
  387. package/api/features/ListAvailableWebhookEvents/feature.js +11 -0
  388. package/api/features/ListAvailableWebhookEvents/feature.js.map +1 -0
  389. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.d.ts +21 -0
  390. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js +66 -0
  391. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js.map +1 -0
  392. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesUseCase.d.ts +14 -0
  393. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesUseCase.js +27 -0
  394. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesUseCase.js.map +1 -0
  395. package/api/features/ListWebhookDeliveries/abstractions.d.ts +40 -0
  396. package/api/features/ListWebhookDeliveries/abstractions.js +6 -0
  397. package/api/features/ListWebhookDeliveries/abstractions.js.map +1 -0
  398. package/api/features/ListWebhookDeliveries/feature.d.ts +4 -0
  399. package/api/features/ListWebhookDeliveries/feature.js +13 -0
  400. package/api/features/ListWebhookDeliveries/feature.js.map +1 -0
  401. package/api/features/ListWebhookDeliveries/schema.d.ts +7 -0
  402. package/api/features/ListWebhookDeliveries/schema.js +10 -0
  403. package/api/features/ListWebhookDeliveries/schema.js.map +1 -0
  404. package/api/features/ListWebhooks/ListWebhooksRepository.d.ts +21 -0
  405. package/api/features/ListWebhooks/ListWebhooksRepository.js +66 -0
  406. package/api/features/ListWebhooks/ListWebhooksRepository.js.map +1 -0
  407. package/api/features/ListWebhooks/ListWebhooksUseCase.d.ts +14 -0
  408. package/api/features/ListWebhooks/ListWebhooksUseCase.js +27 -0
  409. package/api/features/ListWebhooks/ListWebhooksUseCase.js.map +1 -0
  410. package/api/features/ListWebhooks/abstractions.d.ts +41 -0
  411. package/api/features/ListWebhooks/abstractions.js +6 -0
  412. package/api/features/ListWebhooks/abstractions.js.map +1 -0
  413. package/api/features/ListWebhooks/feature.d.ts +4 -0
  414. package/api/features/ListWebhooks/feature.js +13 -0
  415. package/api/features/ListWebhooks/feature.js.map +1 -0
  416. package/api/features/ListWebhooks/schema.d.ts +7 -0
  417. package/api/features/ListWebhooks/schema.js +10 -0
  418. package/api/features/ListWebhooks/schema.js.map +1 -0
  419. package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.d.ts +22 -0
  420. package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.js +70 -0
  421. package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.js.map +1 -0
  422. package/api/features/ResendWebhookDelivery/abstractions.d.ts +12 -0
  423. package/api/features/ResendWebhookDelivery/abstractions.js +5 -0
  424. package/api/features/ResendWebhookDelivery/abstractions.js.map +1 -0
  425. package/api/features/ResendWebhookDelivery/feature.d.ts +4 -0
  426. package/api/features/ResendWebhookDelivery/feature.js +11 -0
  427. package/api/features/ResendWebhookDelivery/feature.js.map +1 -0
  428. package/api/features/ResendWebhookDelivery/schema.d.ts +4 -0
  429. package/api/features/ResendWebhookDelivery/schema.js +7 -0
  430. package/api/features/ResendWebhookDelivery/schema.js.map +1 -0
  431. package/api/features/SendWebhookTask/SendWebhookTask.d.ts +38 -0
  432. package/api/features/SendWebhookTask/SendWebhookTask.js +120 -0
  433. package/api/features/SendWebhookTask/SendWebhookTask.js.map +1 -0
  434. package/api/features/SendWebhookTask/feature.d.ts +4 -0
  435. package/api/features/SendWebhookTask/feature.js +11 -0
  436. package/api/features/SendWebhookTask/feature.js.map +1 -0
  437. package/api/features/SendWebhookTask/types.d.ts +16 -0
  438. package/api/features/SendWebhookTask/types.js +0 -0
  439. package/api/features/Transformers/WebhookDeliveryTransformer.d.ts +13 -0
  440. package/api/features/Transformers/WebhookDeliveryTransformer.js +57 -0
  441. package/api/features/Transformers/WebhookDeliveryTransformer.js.map +1 -0
  442. package/api/features/Transformers/WebhookTransformer.d.ts +11 -0
  443. package/api/features/Transformers/WebhookTransformer.js +35 -0
  444. package/api/features/Transformers/WebhookTransformer.js.map +1 -0
  445. package/api/features/Transformers/abstractions/WebhookDeliveryTransformer.d.ts +10 -0
  446. package/api/features/Transformers/abstractions/WebhookDeliveryTransformer.js +5 -0
  447. package/api/features/Transformers/abstractions/WebhookDeliveryTransformer.js.map +1 -0
  448. package/api/features/Transformers/abstractions/WebhookTransformer.d.ts +10 -0
  449. package/api/features/Transformers/abstractions/WebhookTransformer.js +5 -0
  450. package/api/features/Transformers/abstractions/WebhookTransformer.js.map +1 -0
  451. package/api/features/Transformers/feature.d.ts +4 -0
  452. package/api/features/Transformers/feature.js +13 -0
  453. package/api/features/Transformers/feature.js.map +1 -0
  454. package/api/features/Transformers/index.d.ts +2 -0
  455. package/api/features/Transformers/index.js +2 -0
  456. package/api/features/TriggerWebhook/TriggerWebhookUseCase.d.ts +21 -0
  457. package/api/features/TriggerWebhook/TriggerWebhookUseCase.js +65 -0
  458. package/api/features/TriggerWebhook/TriggerWebhookUseCase.js.map +1 -0
  459. package/api/features/TriggerWebhook/abstractions.d.ts +13 -0
  460. package/api/features/TriggerWebhook/abstractions.js +5 -0
  461. package/api/features/TriggerWebhook/abstractions.js.map +1 -0
  462. package/api/features/TriggerWebhook/feature.d.ts +4 -0
  463. package/api/features/TriggerWebhook/feature.js +11 -0
  464. package/api/features/TriggerWebhook/feature.js.map +1 -0
  465. package/api/features/TriggerWebhook/schema.d.ts +5 -0
  466. package/api/features/TriggerWebhook/schema.js +8 -0
  467. package/api/features/TriggerWebhook/schema.js.map +1 -0
  468. package/api/features/UpdateWebhook/UpdateWebhookRepository.d.ts +21 -0
  469. package/api/features/UpdateWebhook/UpdateWebhookRepository.js +52 -0
  470. package/api/features/UpdateWebhook/UpdateWebhookRepository.js.map +1 -0
  471. package/api/features/UpdateWebhook/UpdateWebhookUseCase.d.ts +16 -0
  472. package/api/features/UpdateWebhook/UpdateWebhookUseCase.js +42 -0
  473. package/api/features/UpdateWebhook/UpdateWebhookUseCase.js.map +1 -0
  474. package/api/features/UpdateWebhook/abstractions.d.ts +30 -0
  475. package/api/features/UpdateWebhook/abstractions.js +6 -0
  476. package/api/features/UpdateWebhook/abstractions.js.map +1 -0
  477. package/api/features/UpdateWebhook/feature.d.ts +4 -0
  478. package/api/features/UpdateWebhook/feature.js +13 -0
  479. package/api/features/UpdateWebhook/feature.js.map +1 -0
  480. package/api/features/UpdateWebhook/schema.d.ts +9 -0
  481. package/api/features/UpdateWebhook/schema.js +15 -0
  482. package/api/features/UpdateWebhook/schema.js.map +1 -0
  483. package/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.d.ts +22 -0
  484. package/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.js +64 -0
  485. package/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.js.map +1 -0
  486. package/api/features/UpdateWebhookDelivery/abstractions.d.ts +23 -0
  487. package/api/features/UpdateWebhookDelivery/abstractions.js +5 -0
  488. package/api/features/UpdateWebhookDelivery/abstractions.js.map +1 -0
  489. package/api/features/UpdateWebhookDelivery/feature.d.ts +4 -0
  490. package/api/features/UpdateWebhookDelivery/feature.js +11 -0
  491. package/api/features/UpdateWebhookDelivery/feature.js.map +1 -0
  492. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.d.ts +21 -0
  493. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js +64 -0
  494. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js.map +1 -0
  495. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsUseCase.d.ts +14 -0
  496. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsUseCase.js +27 -0
  497. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsUseCase.js.map +1 -0
  498. package/api/features/UpdateWebhookSettings/abstractions.d.ts +27 -0
  499. package/api/features/UpdateWebhookSettings/abstractions.js +6 -0
  500. package/api/features/UpdateWebhookSettings/abstractions.js.map +1 -0
  501. package/api/features/UpdateWebhookSettings/feature.d.ts +4 -0
  502. package/api/features/UpdateWebhookSettings/feature.js +13 -0
  503. package/api/features/UpdateWebhookSettings/feature.js.map +1 -0
  504. package/api/features/UpdateWebhookSettings/schema.d.ts +5 -0
  505. package/api/features/UpdateWebhookSettings/schema.js +9 -0
  506. package/api/features/UpdateWebhookSettings/schema.js.map +1 -0
  507. package/api/features/WebhookDeliver/WebhookDeliver.d.ts +13 -0
  508. package/api/features/WebhookDeliver/WebhookDeliver.js +79 -0
  509. package/api/features/WebhookDeliver/WebhookDeliver.js.map +1 -0
  510. package/api/features/WebhookDeliver/abstractions.d.ts +24 -0
  511. package/api/features/WebhookDeliver/abstractions.js +5 -0
  512. package/api/features/WebhookDeliver/abstractions.js.map +1 -0
  513. package/api/features/WebhookDeliver/feature.d.ts +4 -0
  514. package/api/features/WebhookDeliver/feature.js +11 -0
  515. package/api/features/WebhookDeliver/feature.js.map +1 -0
  516. package/api/features/WebhookDeliver/index.d.ts +2 -0
  517. package/api/features/WebhookDeliver/index.js +2 -0
  518. package/api/features/WebhookDispatcher/WebhookDispatcher.d.ts +19 -0
  519. package/api/features/WebhookDispatcher/WebhookDispatcher.js +61 -0
  520. package/api/features/WebhookDispatcher/WebhookDispatcher.js.map +1 -0
  521. package/api/features/WebhookDispatcher/feature.d.ts +4 -0
  522. package/api/features/WebhookDispatcher/feature.js +11 -0
  523. package/api/features/WebhookDispatcher/feature.js.map +1 -0
  524. package/api/features/WebhookPermissions/abstractions.d.ts +17 -0
  525. package/api/features/WebhookPermissions/abstractions.js +6 -0
  526. package/api/features/WebhookPermissions/abstractions.js.map +1 -0
  527. package/api/features/WebhookPermissions/feature.d.ts +4 -0
  528. package/api/features/WebhookPermissions/feature.js +7 -0
  529. package/api/features/WebhookPermissions/feature.js.map +1 -0
  530. package/api/features/WebhookSignPayload/WebhookSignPayload.d.ts +9 -0
  531. package/api/features/WebhookSignPayload/WebhookSignPayload.js +26 -0
  532. package/api/features/WebhookSignPayload/WebhookSignPayload.js.map +1 -0
  533. package/api/features/WebhookSignPayload/feature.d.ts +4 -0
  534. package/api/features/WebhookSignPayload/feature.js +11 -0
  535. package/api/features/WebhookSignPayload/feature.js.map +1 -0
  536. package/api/features/WebhookVerifyPayload/WebhookVerifyPayload.d.ts +10 -0
  537. package/api/features/WebhookVerifyPayload/WebhookVerifyPayload.js +22 -0
  538. package/api/features/WebhookVerifyPayload/WebhookVerifyPayload.js.map +1 -0
  539. package/api/features/WebhookVerifyPayload/feature.d.ts +4 -0
  540. package/api/features/WebhookVerifyPayload/feature.js +11 -0
  541. package/api/features/WebhookVerifyPayload/feature.js.map +1 -0
  542. package/api/graphql/WebhookCrudSchema.d.ts +9 -0
  543. package/api/graphql/WebhookCrudSchema.js +181 -0
  544. package/api/graphql/WebhookCrudSchema.js.map +1 -0
  545. package/api/graphql/WebhookDeliverySchema.d.ts +9 -0
  546. package/api/graphql/WebhookDeliverySchema.js +104 -0
  547. package/api/graphql/WebhookDeliverySchema.js.map +1 -0
  548. package/api/graphql/WebhookEventSchema.d.ts +9 -0
  549. package/api/graphql/WebhookEventSchema.js +49 -0
  550. package/api/graphql/WebhookEventSchema.js.map +1 -0
  551. package/api/graphql/WebhookSettingsSchema.d.ts +9 -0
  552. package/api/graphql/WebhookSettingsSchema.js +66 -0
  553. package/api/graphql/WebhookSettingsSchema.js.map +1 -0
  554. package/api/graphql/WebhookTriggerSchema.d.ts +9 -0
  555. package/api/graphql/WebhookTriggerSchema.js +40 -0
  556. package/api/graphql/WebhookTriggerSchema.js.map +1 -0
  557. package/api/index.d.ts +4 -0
  558. package/api/index.js +12 -0
  559. package/api/index.js.map +1 -0
  560. package/api/models/WebhookDeliveryModel.d.ts +8 -0
  561. package/api/models/WebhookDeliveryModel.js +36 -0
  562. package/api/models/WebhookDeliveryModel.js.map +1 -0
  563. package/api/models/WebhookModel.d.ts +8 -0
  564. package/api/models/WebhookModel.js +33 -0
  565. package/api/models/WebhookModel.js.map +1 -0
  566. package/api/models/WebhookSettingsModel.d.ts +8 -0
  567. package/api/models/WebhookSettingsModel.js +28 -0
  568. package/api/models/WebhookSettingsModel.js.map +1 -0
  569. package/api/permissions.d.ts +12 -0
  570. package/api/permissions.js +22 -0
  571. package/api/permissions.js.map +1 -0
  572. package/api/utils/isValidEndpointUrl.d.ts +1 -0
  573. package/api/utils/isValidEndpointUrl.js +13 -0
  574. package/api/utils/isValidEndpointUrl.js.map +1 -0
  575. package/exports/api/webhooks.d.ts +5 -0
  576. package/exports/api/webhooks.js +1 -0
  577. package/package.json +60 -0
@@ -0,0 +1,14 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { ListWebhookDeliveriesUseCase as UseCaseAbstraction, ListWebhookDeliveriesRepository } from "./abstractions.js";
3
+ import { WebhookPermissions } from "../../../api/features/WebhookPermissions/abstractions.js";
4
+ import type { IListWebhookDeliveriesInput } from "./abstractions.js";
5
+ declare class ListWebhookDeliveriesUseCaseImpl implements UseCaseAbstraction.Interface {
6
+ private readonly permissions;
7
+ private readonly repository;
8
+ constructor(permissions: WebhookPermissions.Interface, repository: ListWebhookDeliveriesRepository.Interface);
9
+ execute(input: IListWebhookDeliveriesInput): Promise<Result<UseCaseAbstraction.Output, UseCaseAbstraction.Error>>;
10
+ }
11
+ export declare const ListWebhookDeliveriesUseCase: typeof ListWebhookDeliveriesUseCaseImpl & {
12
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListWebhookDeliveriesUseCase>;
13
+ };
14
+ export {};
@@ -0,0 +1,27 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { ListWebhookDeliveriesRepository, ListWebhookDeliveriesUseCase } from "./abstractions.js";
3
+ import { ListWebhookDeliveriesInputSchema } from "./schema.js";
4
+ import { WebhookPermissions } from "../WebhookPermissions/abstractions.js";
5
+ import { WebhookNotAuthorizedError, WebhookValidationError } from "../../domain/errors.js";
6
+ class ListWebhookDeliveriesUseCaseImpl {
7
+ constructor(permissions, repository){
8
+ this.permissions = permissions;
9
+ this.repository = repository;
10
+ }
11
+ async execute(input) {
12
+ if (!await this.permissions.canRead("webhook")) return Result.fail(new WebhookNotAuthorizedError());
13
+ const parsed = ListWebhookDeliveriesInputSchema.safeParse(input);
14
+ if (!parsed.success) return Result.fail(new WebhookValidationError(parsed.error));
15
+ return this.repository.execute(input);
16
+ }
17
+ }
18
+ const ListWebhookDeliveriesUseCase_ListWebhookDeliveriesUseCase = ListWebhookDeliveriesUseCase.createImplementation({
19
+ implementation: ListWebhookDeliveriesUseCaseImpl,
20
+ dependencies: [
21
+ WebhookPermissions,
22
+ ListWebhookDeliveriesRepository
23
+ ]
24
+ });
25
+ export { ListWebhookDeliveriesUseCase_ListWebhookDeliveriesUseCase as ListWebhookDeliveriesUseCase };
26
+
27
+ //# sourceMappingURL=ListWebhookDeliveriesUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/ListWebhookDeliveries/ListWebhookDeliveriesUseCase.js","sources":["../../../../src/api/features/ListWebhookDeliveries/ListWebhookDeliveriesUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n ListWebhookDeliveriesUseCase as UseCaseAbstraction,\n ListWebhookDeliveriesRepository\n} from \"./abstractions.js\";\nimport { ListWebhookDeliveriesInputSchema } from \"./schema.js\";\nimport { WebhookPermissions } from \"~/api/features/WebhookPermissions/abstractions.js\";\nimport { WebhookNotAuthorizedError, WebhookValidationError } from \"~/api/domain/errors.js\";\nimport type { IListWebhookDeliveriesInput } from \"./abstractions.js\";\n\nclass ListWebhookDeliveriesUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private readonly permissions: WebhookPermissions.Interface,\n private readonly repository: ListWebhookDeliveriesRepository.Interface\n ) {}\n\n async execute(\n input: IListWebhookDeliveriesInput\n ): Promise<Result<UseCaseAbstraction.Output, UseCaseAbstraction.Error>> {\n if (!(await this.permissions.canRead(\"webhook\"))) {\n return Result.fail(new WebhookNotAuthorizedError());\n }\n\n const parsed = ListWebhookDeliveriesInputSchema.safeParse(input);\n if (!parsed.success) {\n return Result.fail(new WebhookValidationError(parsed.error));\n }\n\n return this.repository.execute(input);\n }\n}\n\nexport const ListWebhookDeliveriesUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListWebhookDeliveriesUseCaseImpl,\n dependencies: [WebhookPermissions, ListWebhookDeliveriesRepository]\n});\n"],"names":["ListWebhookDeliveriesUseCaseImpl","permissions","repository","input","Result","WebhookNotAuthorizedError","parsed","ListWebhookDeliveriesInputSchema","WebhookValidationError","ListWebhookDeliveriesUseCase","UseCaseAbstraction","WebhookPermissions","ListWebhookDeliveriesRepository"],"mappings":";;;;;AAUA,MAAMA;IACF,YACqBC,WAAyC,EACzCC,UAAqD,CACxE;aAFmBD,WAAW,GAAXA;aACAC,UAAU,GAAVA;IAClB;IAEH,MAAM,QACFC,KAAkC,EACkC;QACpE,IAAI,CAAE,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,YACjC,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,SAASC,iCAAiC,SAAS,CAACJ;QAC1D,IAAI,CAACG,OAAO,OAAO,EACf,OAAOF,OAAO,IAAI,CAAC,IAAII,uBAAuBF,OAAO,KAAK;QAG9D,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAACH;IACnC;AACJ;AAEO,MAAMM,4DAA+BC,6BAAAA,oBAAuC,CAAC;IAChF,gBAAgBV;IAChB,cAAc;QAACW;QAAoBC;KAAgC;AACvE"}
@@ -0,0 +1,40 @@
1
+ import { type Result } from "@webiny/feature/api";
2
+ import type { WebhookDelivery, WebhookDeliveryStatus } from "../../../api/domain/WebhookDelivery.js";
3
+ import type { WebhookModelNotFoundError, WebhookNotAuthorizedError, WebhookPersistenceError, WebhookValidationError } from "../../../api/domain/errors.js";
4
+ import type { DateStringInterfaceGenerator, IdInterfaceGenerator, NumericInterfaceGenerator, TextInterfaceGenerator } from "@webiny/api";
5
+ export interface IListWebhookDeliveriesInputWhere extends IdInterfaceGenerator<"id">, IdInterfaceGenerator<"webhookId">, IdInterfaceGenerator<"backgroundTaskId">, DateStringInterfaceGenerator<"createdOn">, DateStringInterfaceGenerator<"savedOn">, TextInterfaceGenerator<"eventType">, TextInterfaceGenerator<WebhookDeliveryStatus>, NumericInterfaceGenerator<"responseStatus"> {
6
+ }
7
+ export interface IListWebhookDeliveriesInput {
8
+ where?: IListWebhookDeliveriesInputWhere;
9
+ limit?: number;
10
+ after?: string;
11
+ sort?: (`${string}_ASC` | `${string}_DESC`)[];
12
+ }
13
+ export interface IListMeta {
14
+ cursor: string | null;
15
+ hasMoreItems: boolean;
16
+ totalCount: number;
17
+ }
18
+ type IError = WebhookPersistenceError | WebhookModelNotFoundError | WebhookNotAuthorizedError | WebhookValidationError;
19
+ export interface IListWebhookDeliveriesOutput {
20
+ items: WebhookDelivery[];
21
+ meta: IListMeta;
22
+ }
23
+ export interface IListWebhookDeliveriesUseCase {
24
+ execute(input: IListWebhookDeliveriesInput): Promise<Result<IListWebhookDeliveriesOutput, IError>>;
25
+ }
26
+ export declare const ListWebhookDeliveriesUseCase: import("@webiny/di").Abstraction<IListWebhookDeliveriesUseCase>;
27
+ export declare namespace ListWebhookDeliveriesUseCase {
28
+ type Interface = IListWebhookDeliveriesUseCase;
29
+ type Output = IListWebhookDeliveriesOutput;
30
+ type Error = IError;
31
+ }
32
+ export interface IListWebhookDeliveriesRepository {
33
+ execute(input: IListWebhookDeliveriesInput): Promise<Result<IListWebhookDeliveriesOutput, IError>>;
34
+ }
35
+ export declare const ListWebhookDeliveriesRepository: import("@webiny/di").Abstraction<IListWebhookDeliveriesRepository>;
36
+ export declare namespace ListWebhookDeliveriesRepository {
37
+ type Interface = IListWebhookDeliveriesRepository;
38
+ type Error = IError;
39
+ }
40
+ export {};
@@ -0,0 +1,6 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const ListWebhookDeliveriesUseCase = createAbstraction("Webhooks/ListWebhookDeliveriesUseCase");
3
+ const ListWebhookDeliveriesRepository = createAbstraction("Webhooks/ListWebhookDeliveriesRepository");
4
+ export { ListWebhookDeliveriesRepository, ListWebhookDeliveriesUseCase };
5
+
6
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/ListWebhookDeliveries/abstractions.js","sources":["../../../../src/api/features/ListWebhookDeliveries/abstractions.ts"],"sourcesContent":["import { createAbstraction, type Result } from \"@webiny/feature/api\";\nimport type { WebhookDelivery, WebhookDeliveryStatus } from \"~/api/domain/WebhookDelivery.js\";\nimport type {\n WebhookModelNotFoundError,\n WebhookNotAuthorizedError,\n WebhookPersistenceError,\n WebhookValidationError\n} from \"~/api/domain/errors.js\";\nimport type {\n DateStringInterfaceGenerator,\n IdInterfaceGenerator,\n NumericInterfaceGenerator,\n TextInterfaceGenerator\n} from \"@webiny/api\";\n\nexport interface IListWebhookDeliveriesInputWhere\n extends\n IdInterfaceGenerator<\"id\">,\n IdInterfaceGenerator<\"webhookId\">,\n IdInterfaceGenerator<\"backgroundTaskId\">,\n DateStringInterfaceGenerator<\"createdOn\">,\n DateStringInterfaceGenerator<\"savedOn\">,\n TextInterfaceGenerator<\"eventType\">,\n TextInterfaceGenerator<WebhookDeliveryStatus>,\n NumericInterfaceGenerator<\"responseStatus\"> {\n //\n}\n\nexport interface IListWebhookDeliveriesInput {\n where?: IListWebhookDeliveriesInputWhere;\n limit?: number;\n after?: string;\n sort?: (`${string}_ASC` | `${string}_DESC`)[];\n}\n\nexport interface IListMeta {\n cursor: string | null;\n hasMoreItems: boolean;\n totalCount: number;\n}\n\ntype IError =\n | WebhookPersistenceError\n | WebhookModelNotFoundError\n | WebhookNotAuthorizedError\n | WebhookValidationError;\n\nexport interface IListWebhookDeliveriesOutput {\n items: WebhookDelivery[];\n meta: IListMeta;\n}\n\nexport interface IListWebhookDeliveriesUseCase {\n execute(\n input: IListWebhookDeliveriesInput\n ): Promise<Result<IListWebhookDeliveriesOutput, IError>>;\n}\n\nexport const ListWebhookDeliveriesUseCase = createAbstraction<IListWebhookDeliveriesUseCase>(\n \"Webhooks/ListWebhookDeliveriesUseCase\"\n);\n\nexport namespace ListWebhookDeliveriesUseCase {\n export type Interface = IListWebhookDeliveriesUseCase;\n export type Output = IListWebhookDeliveriesOutput;\n export type Error = IError;\n}\n\nexport interface IListWebhookDeliveriesRepository {\n execute(\n input: IListWebhookDeliveriesInput\n ): Promise<Result<IListWebhookDeliveriesOutput, IError>>;\n}\n\nexport const ListWebhookDeliveriesRepository = createAbstraction<IListWebhookDeliveriesRepository>(\n \"Webhooks/ListWebhookDeliveriesRepository\"\n);\n\nexport namespace ListWebhookDeliveriesRepository {\n export type Interface = IListWebhookDeliveriesRepository;\n export type Error = IError;\n}\n"],"names":["ListWebhookDeliveriesUseCase","createAbstraction","ListWebhookDeliveriesRepository"],"mappings":";AA0DO,MAAMA,+BAA+BC,kBACxC;AAeG,MAAMC,kCAAkCD,kBAC3C"}
@@ -0,0 +1,4 @@
1
+ export declare const ListWebhookDeliveriesFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,13 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { ListWebhookDeliveriesUseCase } from "./ListWebhookDeliveriesUseCase.js";
3
+ import { ListWebhookDeliveriesRepository } from "./ListWebhookDeliveriesRepository.js";
4
+ const ListWebhookDeliveriesFeature = createFeature({
5
+ name: "ListWebhookDeliveries",
6
+ register (container) {
7
+ container.register(ListWebhookDeliveriesUseCase);
8
+ container.register(ListWebhookDeliveriesRepository).inSingletonScope();
9
+ }
10
+ });
11
+ export { ListWebhookDeliveriesFeature };
12
+
13
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/ListWebhookDeliveries/feature.js","sources":["../../../../src/api/features/ListWebhookDeliveries/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListWebhookDeliveriesUseCase } from \"./ListWebhookDeliveriesUseCase.js\";\nimport { ListWebhookDeliveriesRepository } from \"./ListWebhookDeliveriesRepository.js\";\n\nexport const ListWebhookDeliveriesFeature = createFeature({\n name: \"ListWebhookDeliveries\",\n register(container) {\n container.register(ListWebhookDeliveriesUseCase);\n container.register(ListWebhookDeliveriesRepository).inSingletonScope();\n }\n});\n"],"names":["ListWebhookDeliveriesFeature","createFeature","container","ListWebhookDeliveriesUseCase","ListWebhookDeliveriesRepository"],"mappings":";;;AAIO,MAAMA,+BAA+BC,cAAc;IACtD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,iCAAiC,gBAAgB;IACxE;AACJ"}
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ export declare const ListWebhookDeliveriesInputSchema: z.ZodObject<{
3
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4
+ limit: z.ZodOptional<z.ZodNumber>;
5
+ after: z.ZodOptional<z.ZodString>;
6
+ sort: z.ZodOptional<z.ZodArray<z.ZodString>>;
7
+ }, z.core.$strip>;
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ const ListWebhookDeliveriesInputSchema = z.object({
3
+ where: z.record(z.string(), z.unknown()).optional(),
4
+ limit: z.number().int().positive("Limit must be a positive integer.").optional(),
5
+ after: z.string().optional(),
6
+ sort: z.array(z.string()).optional()
7
+ });
8
+ export { ListWebhookDeliveriesInputSchema };
9
+
10
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/ListWebhookDeliveries/schema.js","sources":["../../../../src/api/features/ListWebhookDeliveries/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const ListWebhookDeliveriesInputSchema = z.object({\n where: z.record(z.string(), z.unknown()).optional(),\n limit: z.number().int().positive(\"Limit must be a positive integer.\").optional(),\n after: z.string().optional(),\n sort: z.array(z.string()).optional()\n});\n"],"names":["ListWebhookDeliveriesInputSchema","z"],"mappings":";AAEO,MAAMA,mCAAmCC,EAAE,MAAM,CAAC;IACrD,OAAOA,EAAE,MAAM,CAACA,EAAE,MAAM,IAAIA,EAAE,OAAO,IAAI,QAAQ;IACjD,OAAOA,EAAE,MAAM,GAAG,GAAG,GAAG,QAAQ,CAAC,qCAAqC,QAAQ;IAC9E,OAAOA,EAAE,MAAM,GAAG,QAAQ;IAC1B,MAAMA,EAAE,KAAK,CAACA,EAAE,MAAM,IAAI,QAAQ;AACtC"}
@@ -0,0 +1,21 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { GetModelRepository } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
3
+ import { ListEntriesRepository } from "@webiny/api-headless-cms/features/contentEntry/ListEntries/index.js";
4
+ import { WebhookTransformer } from "../../../api/features/Transformers/abstractions/WebhookTransformer.js";
5
+ import { ListWebhooksRepository as RepositoryAbstraction } from "./abstractions.js";
6
+ import type { IListWebhooksInput } from "./abstractions.js";
7
+ import { CmsWhereMapper } from "@webiny/api-headless-cms/features/whereMapper/abstractions.js";
8
+ import { CmsSortMapper } from "@webiny/api-headless-cms/features/sortMapper/abstractions.js";
9
+ declare class ListWebhooksRepositoryImpl implements RepositoryAbstraction.Interface {
10
+ private readonly getModelRepository;
11
+ private readonly listEntriesRepository;
12
+ private readonly transformer;
13
+ private whereMapper;
14
+ private sortMapper;
15
+ constructor(getModelRepository: GetModelRepository.Interface, listEntriesRepository: ListEntriesRepository.Interface, transformer: WebhookTransformer.Interface, whereMapper: CmsWhereMapper.Interface, sortMapper: CmsSortMapper.Interface);
16
+ execute(params?: IListWebhooksInput): Promise<Result<RepositoryAbstraction.Output, RepositoryAbstraction.Error>>;
17
+ }
18
+ export declare const ListWebhooksRepository: typeof ListWebhooksRepositoryImpl & {
19
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListWebhooksRepository>;
20
+ };
21
+ export {};
@@ -0,0 +1,66 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { GetModelRepository } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
3
+ import { ListEntriesRepository } from "@webiny/api-headless-cms/features/contentEntry/ListEntries/index.js";
4
+ import { WebhookTransformer } from "../Transformers/abstractions/WebhookTransformer.js";
5
+ import { ListWebhooksRepository } from "./abstractions.js";
6
+ import { WebhookModelNotFoundError, WebhookPersistenceError } from "../../domain/errors.js";
7
+ import { WEBHOOK_MODEL_ID } from "../../domain/constants.js";
8
+ import { CmsWhereMapper } from "@webiny/api-headless-cms/features/whereMapper/abstractions.js";
9
+ import { CmsSortMapper } from "@webiny/api-headless-cms/features/sortMapper/abstractions.js";
10
+ class ListWebhooksRepositoryImpl {
11
+ constructor(getModelRepository, listEntriesRepository, transformer, whereMapper, sortMapper){
12
+ this.getModelRepository = getModelRepository;
13
+ this.listEntriesRepository = listEntriesRepository;
14
+ this.transformer = transformer;
15
+ this.whereMapper = whereMapper;
16
+ this.sortMapper = sortMapper;
17
+ }
18
+ async execute(params) {
19
+ try {
20
+ const modelResult = await this.getModelRepository.execute(WEBHOOK_MODEL_ID);
21
+ if (modelResult.isFail()) return Result.fail(new WebhookModelNotFoundError(WEBHOOK_MODEL_ID));
22
+ const webhookModel = modelResult.value;
23
+ const listResult = await this.listEntriesRepository.execute(modelResult.value, {
24
+ where: {
25
+ ...this.whereMapper.map({
26
+ fields: webhookModel.fields,
27
+ input: params?.where
28
+ }),
29
+ latest: true
30
+ },
31
+ sort: this.sortMapper.map({
32
+ fields: webhookModel.fields,
33
+ input: params?.sort
34
+ }),
35
+ limit: params?.limit ?? 100,
36
+ after: params?.after
37
+ });
38
+ if (listResult.isFail()) return Result.fail(WebhookPersistenceError.from(listResult.error));
39
+ const { entries, meta } = listResult.value;
40
+ const items = entries.map((entry)=>this.transformer.fromStorage(entry));
41
+ return Result.ok({
42
+ items,
43
+ meta: {
44
+ cursor: meta.cursor,
45
+ hasMoreItems: meta.hasMoreItems,
46
+ totalCount: meta.totalCount
47
+ }
48
+ });
49
+ } catch (error) {
50
+ return Result.fail(WebhookPersistenceError.from(error));
51
+ }
52
+ }
53
+ }
54
+ const ListWebhooksRepository_ListWebhooksRepository = ListWebhooksRepository.createImplementation({
55
+ implementation: ListWebhooksRepositoryImpl,
56
+ dependencies: [
57
+ GetModelRepository,
58
+ ListEntriesRepository,
59
+ WebhookTransformer,
60
+ CmsWhereMapper,
61
+ CmsSortMapper
62
+ ]
63
+ });
64
+ export { ListWebhooksRepository_ListWebhooksRepository as ListWebhooksRepository };
65
+
66
+ //# sourceMappingURL=ListWebhooksRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/ListWebhooks/ListWebhooksRepository.js","sources":["../../../../src/api/features/ListWebhooks/ListWebhooksRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { GetModelRepository } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { ListEntriesRepository } from \"@webiny/api-headless-cms/features/contentEntry/ListEntries/index.js\";\nimport { WebhookTransformer } from \"~/api/features/Transformers/abstractions/WebhookTransformer.js\";\nimport { ListWebhooksRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { WebhookModelNotFoundError, WebhookPersistenceError } from \"~/api/domain/errors.js\";\nimport { WEBHOOK_MODEL_ID } from \"~/api/domain/constants.js\";\nimport type { IListWebhooksInput } from \"./abstractions.js\";\nimport type { WebhookCmsEntryValues } from \"~/api/domain/Webhook.js\";\nimport { CmsWhereMapper } from \"@webiny/api-headless-cms/features/whereMapper/abstractions.js\";\nimport { CmsSortMapper } from \"@webiny/api-headless-cms/features/sortMapper/abstractions.js\";\n\nclass ListWebhooksRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private readonly getModelRepository: GetModelRepository.Interface,\n private readonly listEntriesRepository: ListEntriesRepository.Interface,\n private readonly transformer: WebhookTransformer.Interface,\n private whereMapper: CmsWhereMapper.Interface,\n private sortMapper: CmsSortMapper.Interface\n ) {}\n\n async execute(\n params?: IListWebhooksInput\n ): Promise<Result<RepositoryAbstraction.Output, RepositoryAbstraction.Error>> {\n try {\n const modelResult = await this.getModelRepository.execute(WEBHOOK_MODEL_ID);\n if (modelResult.isFail()) {\n return Result.fail(new WebhookModelNotFoundError(WEBHOOK_MODEL_ID));\n }\n\n const webhookModel = modelResult.value;\n\n const listResult = await this.listEntriesRepository.execute<WebhookCmsEntryValues>(\n modelResult.value,\n {\n where: {\n ...this.whereMapper.map({\n fields: webhookModel.fields,\n input: params?.where\n }),\n latest: true\n },\n sort: this.sortMapper.map({\n fields: webhookModel.fields,\n input: params?.sort\n }),\n limit: params?.limit ?? 100,\n after: params?.after\n }\n );\n\n if (listResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(listResult.error));\n }\n\n const { entries, meta } = listResult.value;\n const items = entries.map(entry => this.transformer.fromStorage(entry));\n\n return Result.ok({\n items,\n meta: {\n cursor: meta.cursor,\n hasMoreItems: meta.hasMoreItems,\n totalCount: meta.totalCount\n }\n });\n } catch (error) {\n return Result.fail(WebhookPersistenceError.from(error));\n }\n }\n}\n\nexport const ListWebhooksRepository = RepositoryAbstraction.createImplementation({\n implementation: ListWebhooksRepositoryImpl,\n dependencies: [\n GetModelRepository,\n ListEntriesRepository,\n WebhookTransformer,\n CmsWhereMapper,\n CmsSortMapper\n ]\n});\n"],"names":["ListWebhooksRepositoryImpl","getModelRepository","listEntriesRepository","transformer","whereMapper","sortMapper","params","modelResult","WEBHOOK_MODEL_ID","Result","WebhookModelNotFoundError","webhookModel","listResult","WebhookPersistenceError","entries","meta","items","entry","error","ListWebhooksRepository","RepositoryAbstraction","GetModelRepository","ListEntriesRepository","WebhookTransformer","CmsWhereMapper","CmsSortMapper"],"mappings":";;;;;;;;;AAYA,MAAMA;IACF,YACqBC,kBAAgD,EAChDC,qBAAsD,EACtDC,WAAyC,EAClDC,WAAqC,EACrCC,UAAmC,CAC7C;aALmBJ,kBAAkB,GAAlBA;aACAC,qBAAqB,GAArBA;aACAC,WAAW,GAAXA;aACTC,WAAW,GAAXA;aACAC,UAAU,GAAVA;IACT;IAEH,MAAM,QACFC,MAA2B,EAC+C;QAC1E,IAAI;YACA,MAAMC,cAAc,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAACC;YAC1D,IAAID,YAAY,MAAM,IAClB,OAAOE,OAAO,IAAI,CAAC,IAAIC,0BAA0BF;YAGrD,MAAMG,eAAeJ,YAAY,KAAK;YAEtC,MAAMK,aAAa,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CACvDL,YAAY,KAAK,EACjB;gBACI,OAAO;oBACH,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;wBACpB,QAAQI,aAAa,MAAM;wBAC3B,OAAOL,QAAQ;oBACnB,EAAE;oBACF,QAAQ;gBACZ;gBACA,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;oBACtB,QAAQK,aAAa,MAAM;oBAC3B,OAAOL,QAAQ;gBACnB;gBACA,OAAOA,QAAQ,SAAS;gBACxB,OAAOA,QAAQ;YACnB;YAGJ,IAAIM,WAAW,MAAM,IACjB,OAAOH,OAAO,IAAI,CAACI,wBAAwB,IAAI,CAACD,WAAW,KAAK;YAGpE,MAAM,EAAEE,OAAO,EAAEC,IAAI,EAAE,GAAGH,WAAW,KAAK;YAC1C,MAAMI,QAAQF,QAAQ,GAAG,CAACG,CAAAA,QAAS,IAAI,CAAC,WAAW,CAAC,WAAW,CAACA;YAEhE,OAAOR,OAAO,EAAE,CAAC;gBACbO;gBACA,MAAM;oBACF,QAAQD,KAAK,MAAM;oBACnB,cAAcA,KAAK,YAAY;oBAC/B,YAAYA,KAAK,UAAU;gBAC/B;YACJ;QACJ,EAAE,OAAOG,OAAO;YACZ,OAAOT,OAAO,IAAI,CAACI,wBAAwB,IAAI,CAACK;QACpD;IACJ;AACJ;AAEO,MAAMC,gDAAyBC,uBAAAA,oBAA0C,CAAC;IAC7E,gBAAgBpB;IAChB,cAAc;QACVqB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -0,0 +1,14 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { ListWebhooksUseCase as UseCaseAbstraction, ListWebhooksRepository } from "./abstractions.js";
3
+ import { WebhookPermissions } from "../../../api/features/WebhookPermissions/abstractions.js";
4
+ import type { IListWebhooksInput } from "./abstractions.js";
5
+ declare class ListWebhooksUseCaseImpl implements UseCaseAbstraction.Interface {
6
+ private readonly permissions;
7
+ private readonly repository;
8
+ constructor(permissions: WebhookPermissions.Interface, repository: ListWebhooksRepository.Interface);
9
+ execute(input?: IListWebhooksInput): Promise<Result<UseCaseAbstraction.Output, UseCaseAbstraction.Error>>;
10
+ }
11
+ export declare const ListWebhooksUseCase: typeof ListWebhooksUseCaseImpl & {
12
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListWebhooksUseCase>;
13
+ };
14
+ export {};
@@ -0,0 +1,27 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { ListWebhooksRepository, ListWebhooksUseCase } from "./abstractions.js";
3
+ import { ListWebhooksInputSchema } from "./schema.js";
4
+ import { WebhookPermissions } from "../WebhookPermissions/abstractions.js";
5
+ import { WebhookNotAuthorizedError, WebhookValidationError } from "../../domain/errors.js";
6
+ class ListWebhooksUseCaseImpl {
7
+ constructor(permissions, repository){
8
+ this.permissions = permissions;
9
+ this.repository = repository;
10
+ }
11
+ async execute(input) {
12
+ if (!await this.permissions.canRead("webhook")) return Result.fail(new WebhookNotAuthorizedError());
13
+ const parsed = ListWebhooksInputSchema.safeParse(input ?? {});
14
+ if (!parsed.success) return Result.fail(new WebhookValidationError(parsed.error));
15
+ return this.repository.execute(input);
16
+ }
17
+ }
18
+ const ListWebhooksUseCase_ListWebhooksUseCase = ListWebhooksUseCase.createImplementation({
19
+ implementation: ListWebhooksUseCaseImpl,
20
+ dependencies: [
21
+ WebhookPermissions,
22
+ ListWebhooksRepository
23
+ ]
24
+ });
25
+ export { ListWebhooksUseCase_ListWebhooksUseCase as ListWebhooksUseCase };
26
+
27
+ //# sourceMappingURL=ListWebhooksUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/ListWebhooks/ListWebhooksUseCase.js","sources":["../../../../src/api/features/ListWebhooks/ListWebhooksUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n ListWebhooksUseCase as UseCaseAbstraction,\n ListWebhooksRepository\n} from \"./abstractions.js\";\nimport { ListWebhooksInputSchema } from \"./schema.js\";\nimport { WebhookPermissions } from \"~/api/features/WebhookPermissions/abstractions.js\";\nimport { WebhookNotAuthorizedError, WebhookValidationError } from \"~/api/domain/errors.js\";\nimport type { IListWebhooksInput } from \"./abstractions.js\";\n\nclass ListWebhooksUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private readonly permissions: WebhookPermissions.Interface,\n private readonly repository: ListWebhooksRepository.Interface\n ) {}\n\n async execute(\n input?: IListWebhooksInput\n ): Promise<Result<UseCaseAbstraction.Output, UseCaseAbstraction.Error>> {\n if (!(await this.permissions.canRead(\"webhook\"))) {\n return Result.fail(new WebhookNotAuthorizedError());\n }\n\n const parsed = ListWebhooksInputSchema.safeParse(input ?? {});\n if (!parsed.success) {\n return Result.fail(new WebhookValidationError(parsed.error));\n }\n\n return this.repository.execute(input);\n }\n}\n\nexport const ListWebhooksUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListWebhooksUseCaseImpl,\n dependencies: [WebhookPermissions, ListWebhooksRepository]\n});\n"],"names":["ListWebhooksUseCaseImpl","permissions","repository","input","Result","WebhookNotAuthorizedError","parsed","ListWebhooksInputSchema","WebhookValidationError","ListWebhooksUseCase","UseCaseAbstraction","WebhookPermissions","ListWebhooksRepository"],"mappings":";;;;;AAUA,MAAMA;IACF,YACqBC,WAAyC,EACzCC,UAA4C,CAC/D;aAFmBD,WAAW,GAAXA;aACAC,UAAU,GAAVA;IAClB;IAEH,MAAM,QACFC,KAA0B,EAC0C;QACpE,IAAI,CAAE,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,YACjC,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,SAASC,wBAAwB,SAAS,CAACJ,SAAS,CAAC;QAC3D,IAAI,CAACG,OAAO,OAAO,EACf,OAAOF,OAAO,IAAI,CAAC,IAAII,uBAAuBF,OAAO,KAAK;QAG9D,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAACH;IACnC;AACJ;AAEO,MAAMM,0CAAsBC,oBAAAA,oBAAuC,CAAC;IACvE,gBAAgBV;IAChB,cAAc;QAACW;QAAoBC;KAAuB;AAC9D"}
@@ -0,0 +1,41 @@
1
+ import { type Result } from "@webiny/feature/api";
2
+ import type { Webhook } from "../../../api/domain/Webhook.js";
3
+ import type { WebhookModelNotFoundError, WebhookPersistenceError, WebhookNotAuthorizedError, WebhookValidationError } from "../../../api/domain/errors.js";
4
+ import type { DateStringInterfaceGenerator, IdInterfaceGenerator, TextInterfaceGenerator, TruthfulInterfaceGenerator } from "@webiny/api";
5
+ export interface IListWebhooksInputWhere extends IdInterfaceGenerator<"id">, DateStringInterfaceGenerator<"createdOn">, DateStringInterfaceGenerator<"savedOn">, TextInterfaceGenerator<"name">, TextInterfaceGenerator<"slug">, TextInterfaceGenerator<"endpointUrl">, TextInterfaceGenerator<"events">, TruthfulInterfaceGenerator<"enabled"> {
6
+ }
7
+ export interface IListWebhooksInput {
8
+ where?: IListWebhooksInputWhere;
9
+ limit?: number;
10
+ after?: string;
11
+ sort?: (`${string}_ASC` | `${string}_DESC`)[];
12
+ }
13
+ export interface IListMeta {
14
+ cursor: string | null;
15
+ hasMoreItems: boolean;
16
+ totalCount: number;
17
+ }
18
+ type IError = WebhookModelNotFoundError | WebhookPersistenceError | WebhookNotAuthorizedError | WebhookValidationError;
19
+ export interface IListWebhooksOutput {
20
+ items: Webhook[];
21
+ meta: IListMeta;
22
+ }
23
+ export interface IListWebhooksUseCase {
24
+ execute(input?: IListWebhooksInput): Promise<Result<IListWebhooksOutput, IError>>;
25
+ }
26
+ export declare const ListWebhooksUseCase: import("@webiny/di").Abstraction<IListWebhooksUseCase>;
27
+ export declare namespace ListWebhooksUseCase {
28
+ type Interface = IListWebhooksUseCase;
29
+ type Output = IListWebhooksOutput;
30
+ type Error = IError;
31
+ }
32
+ export interface IListWebhooksRepository {
33
+ execute(input?: IListWebhooksInput): Promise<Result<IListWebhooksOutput, IError>>;
34
+ }
35
+ export declare const ListWebhooksRepository: import("@webiny/di").Abstraction<IListWebhooksRepository>;
36
+ export declare namespace ListWebhooksRepository {
37
+ type Interface = IListWebhooksRepository;
38
+ type Output = IListWebhooksOutput;
39
+ type Error = IError;
40
+ }
41
+ export {};
@@ -0,0 +1,6 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const ListWebhooksUseCase = createAbstraction("Webhooks/ListWebhooksUseCase");
3
+ const ListWebhooksRepository = createAbstraction("Webhooks/ListWebhooksRepository");
4
+ export { ListWebhooksRepository, ListWebhooksUseCase };
5
+
6
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/ListWebhooks/abstractions.js","sources":["../../../../src/api/features/ListWebhooks/abstractions.ts"],"sourcesContent":["import { createAbstraction, type Result } from \"@webiny/feature/api\";\nimport type { Webhook } from \"~/api/domain/Webhook.js\";\nimport type {\n WebhookModelNotFoundError,\n WebhookPersistenceError,\n WebhookNotAuthorizedError,\n WebhookValidationError\n} from \"~/api/domain/errors.js\";\nimport type {\n DateStringInterfaceGenerator,\n IdInterfaceGenerator,\n TextInterfaceGenerator,\n TruthfulInterfaceGenerator\n} from \"@webiny/api\";\n\nexport interface IListWebhooksInputWhere\n extends\n IdInterfaceGenerator<\"id\">,\n DateStringInterfaceGenerator<\"createdOn\">,\n DateStringInterfaceGenerator<\"savedOn\">,\n TextInterfaceGenerator<\"name\">,\n TextInterfaceGenerator<\"slug\">,\n TextInterfaceGenerator<\"endpointUrl\">,\n TextInterfaceGenerator<\"events\">,\n TruthfulInterfaceGenerator<\"enabled\"> {\n //\n}\n\nexport interface IListWebhooksInput {\n where?: IListWebhooksInputWhere;\n limit?: number;\n after?: string;\n sort?: (`${string}_ASC` | `${string}_DESC`)[];\n}\n\nexport interface IListMeta {\n cursor: string | null;\n hasMoreItems: boolean;\n totalCount: number;\n}\n\ntype IError =\n | WebhookModelNotFoundError\n | WebhookPersistenceError\n | WebhookNotAuthorizedError\n | WebhookValidationError;\n\nexport interface IListWebhooksOutput {\n items: Webhook[];\n meta: IListMeta;\n}\n\nexport interface IListWebhooksUseCase {\n execute(input?: IListWebhooksInput): Promise<Result<IListWebhooksOutput, IError>>;\n}\n\nexport const ListWebhooksUseCase = createAbstraction<IListWebhooksUseCase>(\n \"Webhooks/ListWebhooksUseCase\"\n);\n\nexport namespace ListWebhooksUseCase {\n export type Interface = IListWebhooksUseCase;\n export type Output = IListWebhooksOutput;\n export type Error = IError;\n}\n\nexport interface IListWebhooksRepository {\n execute(input?: IListWebhooksInput): Promise<Result<IListWebhooksOutput, IError>>;\n}\n\nexport const ListWebhooksRepository = createAbstraction<IListWebhooksRepository>(\n \"Webhooks/ListWebhooksRepository\"\n);\n\nexport namespace ListWebhooksRepository {\n export type Interface = IListWebhooksRepository;\n export type Output = IListWebhooksOutput;\n export type Error = IError;\n}\n"],"names":["ListWebhooksUseCase","createAbstraction","ListWebhooksRepository"],"mappings":";AAwDO,MAAMA,sBAAsBC,kBAC/B;AAaG,MAAMC,yBAAyBD,kBAClC"}
@@ -0,0 +1,4 @@
1
+ export declare const ListWebhooksFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,13 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { ListWebhooksUseCase } from "./ListWebhooksUseCase.js";
3
+ import { ListWebhooksRepository } from "./ListWebhooksRepository.js";
4
+ const ListWebhooksFeature = createFeature({
5
+ name: "ListWebhooks",
6
+ register (container) {
7
+ container.register(ListWebhooksUseCase);
8
+ container.register(ListWebhooksRepository).inSingletonScope();
9
+ }
10
+ });
11
+ export { ListWebhooksFeature };
12
+
13
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/ListWebhooks/feature.js","sources":["../../../../src/api/features/ListWebhooks/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListWebhooksUseCase } from \"./ListWebhooksUseCase.js\";\nimport { ListWebhooksRepository } from \"./ListWebhooksRepository.js\";\n\nexport const ListWebhooksFeature = createFeature({\n name: \"ListWebhooks\",\n register(container) {\n container.register(ListWebhooksUseCase);\n container.register(ListWebhooksRepository).inSingletonScope();\n }\n});\n"],"names":["ListWebhooksFeature","createFeature","container","ListWebhooksUseCase","ListWebhooksRepository"],"mappings":";;;AAIO,MAAMA,sBAAsBC,cAAc;IAC7C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,wBAAwB,gBAAgB;IAC/D;AACJ"}
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ export declare const ListWebhooksInputSchema: z.ZodObject<{
3
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4
+ limit: z.ZodOptional<z.ZodNumber>;
5
+ after: z.ZodOptional<z.ZodString>;
6
+ sort: z.ZodOptional<z.ZodArray<z.ZodString>>;
7
+ }, z.core.$strip>;
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ const ListWebhooksInputSchema = z.object({
3
+ where: z.record(z.string(), z.unknown()).optional(),
4
+ limit: z.number().int().positive("Limit must be a positive integer.").optional(),
5
+ after: z.string().optional(),
6
+ sort: z.array(z.string()).optional()
7
+ });
8
+ export { ListWebhooksInputSchema };
9
+
10
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/ListWebhooks/schema.js","sources":["../../../../src/api/features/ListWebhooks/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const ListWebhooksInputSchema = z.object({\n where: z.record(z.string(), z.unknown()).optional(),\n limit: z.number().int().positive(\"Limit must be a positive integer.\").optional(),\n after: z.string().optional(),\n sort: z.array(z.string()).optional()\n});\n"],"names":["ListWebhooksInputSchema","z"],"mappings":";AAEO,MAAMA,0BAA0BC,EAAE,MAAM,CAAC;IAC5C,OAAOA,EAAE,MAAM,CAACA,EAAE,MAAM,IAAIA,EAAE,OAAO,IAAI,QAAQ;IACjD,OAAOA,EAAE,MAAM,GAAG,GAAG,GAAG,QAAQ,CAAC,qCAAqC,QAAQ;IAC9E,OAAOA,EAAE,MAAM,GAAG,QAAQ;IAC1B,MAAMA,EAAE,KAAK,CAACA,EAAE,MAAM,IAAI,QAAQ;AACtC"}
@@ -0,0 +1,22 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { ResendWebhookDeliveryUseCase as UseCaseAbstraction } from "./abstractions.js";
3
+ import { GetWebhookDeliveryRepository } from "../../../api/features/GetWebhookDelivery/abstractions.js";
4
+ import { GetWebhookRepository } from "../../../api/features/GetWebhook/abstractions.js";
5
+ import { CreateWebhookDeliveryRepository } from "../../../api/features/CreateWebhookDelivery/abstractions.js";
6
+ import { GetWebhookSettingsRepository } from "../../../api/features/GetWebhookSettings/abstractions.js";
7
+ import { WebhookPermissions } from "../../../api/features/WebhookPermissions/abstractions.js";
8
+ import { TaskService } from "@webiny/api-core/exports/api/tasks.js";
9
+ declare class ResendWebhookDeliveryUseCaseImpl implements UseCaseAbstraction.Interface {
10
+ private readonly permissions;
11
+ private readonly getDeliveryRepository;
12
+ private readonly getWebhookRepository;
13
+ private readonly createDeliveryRepository;
14
+ private readonly taskService;
15
+ private readonly getSettingsRepository;
16
+ constructor(permissions: WebhookPermissions.Interface, getDeliveryRepository: GetWebhookDeliveryRepository.Interface, getWebhookRepository: GetWebhookRepository.Interface, createDeliveryRepository: CreateWebhookDeliveryRepository.Interface, taskService: TaskService.Interface, getSettingsRepository: GetWebhookSettingsRepository.Interface);
17
+ execute(deliveryId: string): Promise<Result<boolean, UseCaseAbstraction.Error>>;
18
+ }
19
+ export declare const ResendWebhookDeliveryUseCase: typeof ResendWebhookDeliveryUseCaseImpl & {
20
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IResendWebhookDeliveryUseCase>;
21
+ };
22
+ export {};
@@ -0,0 +1,70 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { ResendWebhookDeliveryUseCase } from "./abstractions.js";
3
+ import { ResendWebhookDeliveryInputSchema } from "./schema.js";
4
+ import { GetWebhookDeliveryRepository } from "../GetWebhookDelivery/abstractions.js";
5
+ import { GetWebhookRepository } from "../GetWebhook/abstractions.js";
6
+ import { CreateWebhookDeliveryRepository } from "../CreateWebhookDelivery/abstractions.js";
7
+ import { GetWebhookSettingsRepository } from "../GetWebhookSettings/abstractions.js";
8
+ import { WebhookPermissions } from "../WebhookPermissions/abstractions.js";
9
+ import { WebhookNotAuthorizedError, WebhookValidationError } from "../../domain/errors.js";
10
+ import { TaskService } from "@webiny/api-core/exports/api/tasks.js";
11
+ import { SEND_WEBHOOK_TASK, WEBHOOK_DELIVERY_MAX_RETENTION_DAYS } from "../../domain/constants.js";
12
+ class ResendWebhookDeliveryUseCaseImpl {
13
+ constructor(permissions, getDeliveryRepository, getWebhookRepository, createDeliveryRepository, taskService, getSettingsRepository){
14
+ this.permissions = permissions;
15
+ this.getDeliveryRepository = getDeliveryRepository;
16
+ this.getWebhookRepository = getWebhookRepository;
17
+ this.createDeliveryRepository = createDeliveryRepository;
18
+ this.taskService = taskService;
19
+ this.getSettingsRepository = getSettingsRepository;
20
+ }
21
+ async execute(deliveryId) {
22
+ if (!await this.permissions.canEdit("webhook")) return Result.fail(new WebhookNotAuthorizedError());
23
+ const parsed = ResendWebhookDeliveryInputSchema.safeParse({
24
+ deliveryId
25
+ });
26
+ if (!parsed.success) return Result.fail(new WebhookValidationError(parsed.error));
27
+ const deliveryResult = await this.getDeliveryRepository.execute(parsed.data.deliveryId);
28
+ if (deliveryResult.isFail()) return Result.fail(deliveryResult.error);
29
+ const delivery = deliveryResult.value;
30
+ const webhookResult = await this.getWebhookRepository.execute(delivery.webhookId);
31
+ if (webhookResult.isFail()) return Result.fail(webhookResult.error);
32
+ const originalPayload = delivery.payload;
33
+ const data = originalPayload?.data ?? {};
34
+ const settingsResult = await this.getSettingsRepository.execute();
35
+ const retentionDays = settingsResult.isOk() ? settingsResult.value.deliveryRetentionDays ?? WEBHOOK_DELIVERY_MAX_RETENTION_DAYS : WEBHOOK_DELIVERY_MAX_RETENTION_DAYS;
36
+ const expiresAt = new Date(Date.now() + 24 * retentionDays * 3600000);
37
+ const newDeliveryResult = await this.createDeliveryRepository.execute({
38
+ webhookId: delivery.webhookId,
39
+ eventType: delivery.eventType,
40
+ status: "pending",
41
+ payload: data,
42
+ expiresAt
43
+ });
44
+ if (newDeliveryResult.isFail()) return Result.fail(newDeliveryResult.error);
45
+ await this.taskService.trigger({
46
+ definition: SEND_WEBHOOK_TASK,
47
+ name: `Resend webhook: ${delivery.eventType}`,
48
+ input: {
49
+ webhookId: delivery.webhookId,
50
+ eventName: delivery.eventType,
51
+ deliveryId: newDeliveryResult.value.id
52
+ }
53
+ });
54
+ return Result.ok(true);
55
+ }
56
+ }
57
+ const ResendWebhookDeliveryUseCase_ResendWebhookDeliveryUseCase = ResendWebhookDeliveryUseCase.createImplementation({
58
+ implementation: ResendWebhookDeliveryUseCaseImpl,
59
+ dependencies: [
60
+ WebhookPermissions,
61
+ GetWebhookDeliveryRepository,
62
+ GetWebhookRepository,
63
+ CreateWebhookDeliveryRepository,
64
+ TaskService,
65
+ GetWebhookSettingsRepository
66
+ ]
67
+ });
68
+ export { ResendWebhookDeliveryUseCase_ResendWebhookDeliveryUseCase as ResendWebhookDeliveryUseCase };
69
+
70
+ //# sourceMappingURL=ResendWebhookDeliveryUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.js","sources":["../../../../src/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { ResendWebhookDeliveryUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { ResendWebhookDeliveryInputSchema } from \"./schema.js\";\nimport { GetWebhookDeliveryRepository } from \"~/api/features/GetWebhookDelivery/abstractions.js\";\nimport { GetWebhookRepository } from \"~/api/features/GetWebhook/abstractions.js\";\nimport { CreateWebhookDeliveryRepository } from \"~/api/features/CreateWebhookDelivery/abstractions.js\";\nimport { GetWebhookSettingsRepository } from \"~/api/features/GetWebhookSettings/abstractions.js\";\nimport { WebhookPermissions } from \"~/api/features/WebhookPermissions/abstractions.js\";\nimport { WebhookNotAuthorizedError, WebhookValidationError } from \"~/api/domain/errors.js\";\nimport { TaskService } from \"@webiny/api-core/exports/api/tasks.js\";\nimport { SEND_WEBHOOK_TASK, WEBHOOK_DELIVERY_MAX_RETENTION_DAYS } from \"~/api/domain/constants.js\";\nimport type { IWebhookPayload } from \"~/api/features/SendWebhookTask/types.js\";\n\nclass ResendWebhookDeliveryUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private readonly permissions: WebhookPermissions.Interface,\n private readonly getDeliveryRepository: GetWebhookDeliveryRepository.Interface,\n private readonly getWebhookRepository: GetWebhookRepository.Interface,\n private readonly createDeliveryRepository: CreateWebhookDeliveryRepository.Interface,\n private readonly taskService: TaskService.Interface,\n private readonly getSettingsRepository: GetWebhookSettingsRepository.Interface\n ) {}\n\n async execute(deliveryId: string): Promise<Result<boolean, UseCaseAbstraction.Error>> {\n if (!(await this.permissions.canEdit(\"webhook\"))) {\n return Result.fail(new WebhookNotAuthorizedError());\n }\n\n const parsed = ResendWebhookDeliveryInputSchema.safeParse({ deliveryId });\n if (!parsed.success) {\n return Result.fail(new WebhookValidationError(parsed.error));\n }\n\n const deliveryResult = await this.getDeliveryRepository.execute(parsed.data.deliveryId);\n if (deliveryResult.isFail()) {\n return Result.fail(deliveryResult.error);\n }\n\n const delivery = deliveryResult.value;\n\n const webhookResult = await this.getWebhookRepository.execute(delivery.webhookId);\n if (webhookResult.isFail()) {\n return Result.fail(webhookResult.error);\n }\n\n const originalPayload = delivery.payload as IWebhookPayload | null;\n const data = originalPayload?.data ?? {};\n\n const settingsResult = await this.getSettingsRepository.execute();\n const retentionDays = settingsResult.isOk()\n ? (settingsResult.value.deliveryRetentionDays ?? WEBHOOK_DELIVERY_MAX_RETENTION_DAYS)\n : WEBHOOK_DELIVERY_MAX_RETENTION_DAYS;\n\n const expiresAt = new Date(Date.now() + retentionDays * 24 * 60 * 60 * 1000);\n\n const newDeliveryResult = await this.createDeliveryRepository.execute({\n webhookId: delivery.webhookId,\n eventType: delivery.eventType,\n status: \"pending\",\n payload: data as Record<string, unknown>,\n expiresAt\n });\n\n if (newDeliveryResult.isFail()) {\n return Result.fail(newDeliveryResult.error);\n }\n\n await this.taskService.trigger({\n definition: SEND_WEBHOOK_TASK,\n name: `Resend webhook: ${delivery.eventType}`,\n input: {\n webhookId: delivery.webhookId,\n eventName: delivery.eventType,\n deliveryId: newDeliveryResult.value.id\n }\n });\n\n return Result.ok(true);\n }\n}\n\nexport const ResendWebhookDeliveryUseCase = UseCaseAbstraction.createImplementation({\n implementation: ResendWebhookDeliveryUseCaseImpl,\n dependencies: [\n WebhookPermissions,\n GetWebhookDeliveryRepository,\n GetWebhookRepository,\n CreateWebhookDeliveryRepository,\n TaskService,\n GetWebhookSettingsRepository\n ]\n});\n"],"names":["ResendWebhookDeliveryUseCaseImpl","permissions","getDeliveryRepository","getWebhookRepository","createDeliveryRepository","taskService","getSettingsRepository","deliveryId","Result","WebhookNotAuthorizedError","parsed","ResendWebhookDeliveryInputSchema","WebhookValidationError","deliveryResult","delivery","webhookResult","originalPayload","data","settingsResult","retentionDays","WEBHOOK_DELIVERY_MAX_RETENTION_DAYS","expiresAt","Date","newDeliveryResult","SEND_WEBHOOK_TASK","ResendWebhookDeliveryUseCase","UseCaseAbstraction","WebhookPermissions","GetWebhookDeliveryRepository","GetWebhookRepository","CreateWebhookDeliveryRepository","TaskService","GetWebhookSettingsRepository"],"mappings":";;;;;;;;;;;AAaA,MAAMA;IACF,YACqBC,WAAyC,EACzCC,qBAA6D,EAC7DC,oBAAoD,EACpDC,wBAAmE,EACnEC,WAAkC,EAClCC,qBAA6D,CAChF;aANmBL,WAAW,GAAXA;aACAC,qBAAqB,GAArBA;aACAC,oBAAoB,GAApBA;aACAC,wBAAwB,GAAxBA;aACAC,WAAW,GAAXA;aACAC,qBAAqB,GAArBA;IAClB;IAEH,MAAM,QAAQC,UAAkB,EAAsD;QAClF,IAAI,CAAE,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,YACjC,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,SAASC,iCAAiC,SAAS,CAAC;YAAEJ;QAAW;QACvE,IAAI,CAACG,OAAO,OAAO,EACf,OAAOF,OAAO,IAAI,CAAC,IAAII,uBAAuBF,OAAO,KAAK;QAG9D,MAAMG,iBAAiB,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAACH,OAAO,IAAI,CAAC,UAAU;QACtF,IAAIG,eAAe,MAAM,IACrB,OAAOL,OAAO,IAAI,CAACK,eAAe,KAAK;QAG3C,MAAMC,WAAWD,eAAe,KAAK;QAErC,MAAME,gBAAgB,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAACD,SAAS,SAAS;QAChF,IAAIC,cAAc,MAAM,IACpB,OAAOP,OAAO,IAAI,CAACO,cAAc,KAAK;QAG1C,MAAMC,kBAAkBF,SAAS,OAAO;QACxC,MAAMG,OAAOD,iBAAiB,QAAQ,CAAC;QAEvC,MAAME,iBAAiB,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO;QAC/D,MAAMC,gBAAgBD,eAAe,IAAI,KAClCA,eAAe,KAAK,CAAC,qBAAqB,IAAIE,sCAC/CA;QAEN,MAAMC,YAAY,IAAIC,KAAKA,KAAK,GAAG,KAAKH,AAAgB,KAAhBA,gBAAAA;QAExC,MAAMI,oBAAoB,MAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC;YAClE,WAAWT,SAAS,SAAS;YAC7B,WAAWA,SAAS,SAAS;YAC7B,QAAQ;YACR,SAASG;YACTI;QACJ;QAEA,IAAIE,kBAAkB,MAAM,IACxB,OAAOf,OAAO,IAAI,CAACe,kBAAkB,KAAK;QAG9C,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;YAC3B,YAAYC;YACZ,MAAM,CAAC,gBAAgB,EAAEV,SAAS,SAAS,EAAE;YAC7C,OAAO;gBACH,WAAWA,SAAS,SAAS;gBAC7B,WAAWA,SAAS,SAAS;gBAC7B,YAAYS,kBAAkB,KAAK,CAAC,EAAE;YAC1C;QACJ;QAEA,OAAOf,OAAO,EAAE,CAAC;IACrB;AACJ;AAEO,MAAMiB,4DAA+BC,6BAAAA,oBAAuC,CAAC;IAChF,gBAAgB1B;IAChB,cAAc;QACV2B;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -0,0 +1,12 @@
1
+ import { type Result } from "@webiny/feature/api";
2
+ import type { WebhookDeliveryNotFoundError, WebhookNotFoundError, WebhookPersistenceError, WebhookModelNotFoundError, WebhookNotAuthorizedError, WebhookValidationError } from "../../../api/domain/errors.js";
3
+ type IError = WebhookDeliveryNotFoundError | WebhookNotFoundError | WebhookPersistenceError | WebhookModelNotFoundError | WebhookNotAuthorizedError | WebhookValidationError;
4
+ export interface IResendWebhookDeliveryUseCase {
5
+ execute(deliveryId: string): Promise<Result<boolean, IError>>;
6
+ }
7
+ export declare const ResendWebhookDeliveryUseCase: import("@webiny/di").Abstraction<IResendWebhookDeliveryUseCase>;
8
+ export declare namespace ResendWebhookDeliveryUseCase {
9
+ type Interface = IResendWebhookDeliveryUseCase;
10
+ type Error = IError;
11
+ }
12
+ export {};
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const ResendWebhookDeliveryUseCase = createAbstraction("Webhooks/ResendWebhookDeliveryUseCase");
3
+ export { ResendWebhookDeliveryUseCase };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/ResendWebhookDelivery/abstractions.js","sources":["../../../../src/api/features/ResendWebhookDelivery/abstractions.ts"],"sourcesContent":["import { createAbstraction, type Result } from \"@webiny/feature/api\";\nimport type {\n WebhookDeliveryNotFoundError,\n WebhookNotFoundError,\n WebhookPersistenceError,\n WebhookModelNotFoundError,\n WebhookNotAuthorizedError,\n WebhookValidationError\n} from \"~/api/domain/errors.js\";\n\ntype IError =\n | WebhookDeliveryNotFoundError\n | WebhookNotFoundError\n | WebhookPersistenceError\n | WebhookModelNotFoundError\n | WebhookNotAuthorizedError\n | WebhookValidationError;\n\nexport interface IResendWebhookDeliveryUseCase {\n execute(deliveryId: string): Promise<Result<boolean, IError>>;\n}\n\nexport const ResendWebhookDeliveryUseCase = createAbstraction<IResendWebhookDeliveryUseCase>(\n \"Webhooks/ResendWebhookDeliveryUseCase\"\n);\n\nexport namespace ResendWebhookDeliveryUseCase {\n export type Interface = IResendWebhookDeliveryUseCase;\n export type Error = IError;\n}\n"],"names":["ResendWebhookDeliveryUseCase","createAbstraction"],"mappings":";AAsBO,MAAMA,+BAA+BC,kBACxC"}
@@ -0,0 +1,4 @@
1
+ export declare const ResendWebhookDeliveryFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { ResendWebhookDeliveryUseCase } from "./ResendWebhookDeliveryUseCase.js";
3
+ const ResendWebhookDeliveryFeature = createFeature({
4
+ name: "ResendWebhookDelivery",
5
+ register (container) {
6
+ container.register(ResendWebhookDeliveryUseCase);
7
+ }
8
+ });
9
+ export { ResendWebhookDeliveryFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/ResendWebhookDelivery/feature.js","sources":["../../../../src/api/features/ResendWebhookDelivery/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ResendWebhookDeliveryUseCase } from \"./ResendWebhookDeliveryUseCase.js\";\n\nexport const ResendWebhookDeliveryFeature = createFeature({\n name: \"ResendWebhookDelivery\",\n register(container) {\n container.register(ResendWebhookDeliveryUseCase);\n }\n});\n"],"names":["ResendWebhookDeliveryFeature","createFeature","container","ResendWebhookDeliveryUseCase"],"mappings":";;AAGO,MAAMA,+BAA+BC,cAAc;IACtD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ export declare const ResendWebhookDeliveryInputSchema: z.ZodObject<{
3
+ deliveryId: z.ZodString;
4
+ }, z.core.$strip>;
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ const ResendWebhookDeliveryInputSchema = z.object({
3
+ deliveryId: z.string().min(1, "Delivery ID is required.")
4
+ });
5
+ export { ResendWebhookDeliveryInputSchema };
6
+
7
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/ResendWebhookDelivery/schema.js","sources":["../../../../src/api/features/ResendWebhookDelivery/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const ResendWebhookDeliveryInputSchema = z.object({\n deliveryId: z.string().min(1, \"Delivery ID is required.\")\n});\n"],"names":["ResendWebhookDeliveryInputSchema","z"],"mappings":";AAEO,MAAMA,mCAAmCC,EAAE,MAAM,CAAC;IACrD,YAAYA,EAAE,MAAM,GAAG,GAAG,CAAC,GAAG;AAClC"}