@webiny/webhooks 6.4.0-beta.2 → 6.4.0-beta.4

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 (297) hide show
  1. package/admin/WebhookRoutes.js +32 -3
  2. package/admin/WebhookRoutes.js.map +1 -1
  3. package/admin/Webhooks.js +10 -2
  4. package/admin/Webhooks.js.map +1 -1
  5. package/admin/features/getWebhookSettings/GetWebhookSettingsGateway.d.ts +12 -0
  6. package/admin/features/getWebhookSettings/GetWebhookSettingsGateway.js +41 -0
  7. package/admin/features/getWebhookSettings/GetWebhookSettingsGateway.js.map +1 -0
  8. package/admin/features/getWebhookSettings/GetWebhookSettingsUseCase.d.ts +11 -0
  9. package/admin/features/getWebhookSettings/GetWebhookSettingsUseCase.js +18 -0
  10. package/admin/features/getWebhookSettings/GetWebhookSettingsUseCase.js.map +1 -0
  11. package/admin/features/getWebhookSettings/abstractions.d.ts +15 -0
  12. package/admin/features/getWebhookSettings/abstractions.js +6 -0
  13. package/admin/features/getWebhookSettings/abstractions.js.map +1 -0
  14. package/admin/features/getWebhookSettings/feature.d.ts +3 -0
  15. package/admin/features/getWebhookSettings/feature.js +19 -0
  16. package/admin/features/getWebhookSettings/feature.js.map +1 -0
  17. package/admin/features/getWebhookSettings/index.d.ts +2 -0
  18. package/admin/features/getWebhookSettings/index.js +2 -0
  19. package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesGateway.js +1 -1
  20. package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesGateway.js.map +1 -1
  21. package/admin/features/listWebhookDeliveries/abstractions.d.ts +6 -1
  22. package/admin/features/listWebhookDeliveries/abstractions.js.map +1 -1
  23. package/admin/features/updateWebhookSettings/UpdateWebhookSettingsGateway.d.ts +12 -0
  24. package/admin/features/updateWebhookSettings/UpdateWebhookSettingsGateway.js +44 -0
  25. package/admin/features/updateWebhookSettings/UpdateWebhookSettingsGateway.js.map +1 -0
  26. package/admin/features/updateWebhookSettings/UpdateWebhookSettingsUseCase.d.ts +11 -0
  27. package/admin/features/updateWebhookSettings/UpdateWebhookSettingsUseCase.js +18 -0
  28. package/admin/features/updateWebhookSettings/UpdateWebhookSettingsUseCase.js.map +1 -0
  29. package/admin/features/updateWebhookSettings/abstractions.d.ts +19 -0
  30. package/admin/features/updateWebhookSettings/abstractions.js +6 -0
  31. package/admin/features/updateWebhookSettings/abstractions.js.map +1 -0
  32. package/admin/features/updateWebhookSettings/feature.d.ts +3 -0
  33. package/admin/features/updateWebhookSettings/feature.js +19 -0
  34. package/admin/features/updateWebhookSettings/feature.js.map +1 -0
  35. package/admin/features/updateWebhookSettings/index.d.ts +2 -0
  36. package/admin/features/updateWebhookSettings/index.js +2 -0
  37. package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/WebhookDeliveriesDataSource.d.ts +1 -2
  38. package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/WebhookDeliveriesDataSource.js +5 -7
  39. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesDataSource.js.map +1 -0
  40. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.d.ts +41 -0
  41. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js +223 -0
  42. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js.map +1 -0
  43. package/admin/presentation/WebhookDeliveriesPage/abstractions.d.ts +42 -0
  44. package/admin/presentation/WebhookDeliveriesPage/abstractions.js +5 -0
  45. package/admin/presentation/WebhookDeliveriesPage/abstractions.js.map +1 -0
  46. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.d.ts +11 -0
  47. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.js +36 -0
  48. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.js.map +1 -0
  49. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.d.ts +9 -0
  50. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.js +43 -0
  51. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.js.map +1 -0
  52. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.d.ts +7 -0
  53. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.js +76 -0
  54. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.js.map +1 -0
  55. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.d.ts +9 -0
  56. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js +85 -0
  57. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js.map +1 -0
  58. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.d.ts +9 -0
  59. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js +61 -0
  60. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js.map +1 -0
  61. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.d.ts +2 -0
  62. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js +16 -0
  63. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js.map +1 -0
  64. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.d.ts +2 -0
  65. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js +73 -0
  66. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js.map +1 -0
  67. package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.d.ts +1 -0
  68. package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.js +13 -0
  69. package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.js.map +1 -0
  70. package/admin/presentation/WebhookDeliveriesPage/feature.d.ts +3 -0
  71. package/admin/presentation/WebhookDeliveriesPage/feature.js +17 -0
  72. package/admin/presentation/WebhookDeliveriesPage/feature.js.map +1 -0
  73. package/admin/presentation/WebhookDeliveriesPage/index.d.ts +5 -0
  74. package/admin/presentation/WebhookDeliveriesPage/index.js +1 -0
  75. package/admin/presentation/WebhookForm/WebhookFormPresenter.d.ts +9 -5
  76. package/admin/presentation/WebhookForm/WebhookFormPresenter.js +144 -60
  77. package/admin/presentation/WebhookForm/WebhookFormPresenter.js.map +1 -1
  78. package/admin/presentation/WebhookForm/abstractions.d.ts +2 -13
  79. package/admin/presentation/WebhookForm/abstractions.js.map +1 -1
  80. package/admin/presentation/WebhookForm/components/SigningSecret.d.ts +5 -2
  81. package/admin/presentation/WebhookForm/components/SigningSecret.js +7 -3
  82. package/admin/presentation/WebhookForm/components/SigningSecret.js.map +1 -1
  83. package/admin/presentation/WebhookForm/components/WebhookFormView.js +49 -41
  84. package/admin/presentation/WebhookForm/components/WebhookFormView.js.map +1 -1
  85. package/admin/presentation/WebhookList/WebhookListPresenter.d.ts +26 -2
  86. package/admin/presentation/WebhookList/WebhookListPresenter.js +36 -34
  87. package/admin/presentation/WebhookList/WebhookListPresenter.js.map +1 -1
  88. package/admin/presentation/WebhookList/abstractions.d.ts +25 -7
  89. package/admin/presentation/WebhookList/abstractions.js.map +1 -1
  90. package/admin/presentation/WebhookList/components/CreateWebhookButton.d.ts +2 -0
  91. package/admin/presentation/WebhookList/components/CreateWebhookButton.js +22 -0
  92. package/admin/presentation/WebhookList/components/CreateWebhookButton.js.map +1 -0
  93. package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.d.ts +2 -0
  94. package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.js +16 -0
  95. package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.js.map +1 -0
  96. package/admin/presentation/WebhookList/components/WebhookListContent.d.ts +9 -0
  97. package/admin/presentation/WebhookList/components/WebhookListContent.js +170 -0
  98. package/admin/presentation/WebhookList/components/WebhookListContent.js.map +1 -0
  99. package/admin/presentation/WebhookList/components/WebhookListView.js +10 -133
  100. package/admin/presentation/WebhookList/components/WebhookListView.js.map +1 -1
  101. package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.d.ts +21 -0
  102. package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.js +91 -0
  103. package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.js.map +1 -0
  104. package/admin/presentation/WebhookSettings/abstractions.d.ts +16 -0
  105. package/admin/presentation/WebhookSettings/abstractions.js +5 -0
  106. package/admin/presentation/WebhookSettings/abstractions.js.map +1 -0
  107. package/admin/presentation/WebhookSettings/components/WebhookSettingsView.d.ts +2 -0
  108. package/admin/presentation/WebhookSettings/components/WebhookSettingsView.js +56 -0
  109. package/admin/presentation/WebhookSettings/components/WebhookSettingsView.js.map +1 -0
  110. package/admin/presentation/WebhookSettings/feature.d.ts +3 -0
  111. package/admin/presentation/WebhookSettings/feature.js +17 -0
  112. package/admin/presentation/WebhookSettings/feature.js.map +1 -0
  113. package/admin/presentation/WebhookSettings/index.d.ts +2 -0
  114. package/admin/presentation/WebhookSettings/index.js +2 -0
  115. package/admin/routes.d.ts +4 -0
  116. package/admin/routes.js +11 -0
  117. package/admin/routes.js.map +1 -1
  118. package/admin/shared/types.d.ts +4 -0
  119. package/api/WebhooksFeature.js +10 -0
  120. package/api/WebhooksFeature.js.map +1 -1
  121. package/api/domain/WebhookDelivery.d.ts +0 -1
  122. package/api/domain/WebhookSettings.d.ts +4 -0
  123. package/api/domain/WebhookSettings.js +0 -0
  124. package/api/domain/constants.d.ts +2 -1
  125. package/api/domain/constants.js +3 -2
  126. package/api/domain/constants.js.map +1 -1
  127. package/api/domain/errors.d.ts +7 -2
  128. package/api/domain/errors.js +16 -3
  129. package/api/domain/errors.js.map +1 -1
  130. package/api/features/CreateWebhook/CreateWebhookUseCase.d.ts +3 -3
  131. package/api/features/CreateWebhook/CreateWebhookUseCase.js +10 -19
  132. package/api/features/CreateWebhook/CreateWebhookUseCase.js.map +1 -1
  133. package/api/features/CreateWebhook/abstractions.d.ts +1 -1
  134. package/api/features/CreateWebhook/abstractions.js.map +1 -1
  135. package/api/features/CreateWebhook/schema.d.ts +10 -0
  136. package/api/features/CreateWebhook/schema.js +16 -0
  137. package/api/features/CreateWebhook/schema.js.map +1 -0
  138. package/api/features/CreateWebhookDelivery/CreateWebhookDeliveryRepository.d.ts +1 -1
  139. package/api/features/CreateWebhookDelivery/CreateWebhookDeliveryRepository.js +3 -1
  140. package/api/features/CreateWebhookDelivery/CreateWebhookDeliveryRepository.js.map +1 -1
  141. package/api/features/CreateWebhookDelivery/abstractions.d.ts +1 -1
  142. package/api/features/CreateWebhookDelivery/abstractions.js.map +1 -1
  143. package/api/features/DeleteWebhook/DeleteWebhookUseCase.d.ts +3 -3
  144. package/api/features/DeleteWebhook/DeleteWebhookUseCase.js +8 -3
  145. package/api/features/DeleteWebhook/DeleteWebhookUseCase.js.map +1 -1
  146. package/api/features/DeleteWebhook/abstractions.d.ts +2 -2
  147. package/api/features/DeleteWebhook/abstractions.js.map +1 -1
  148. package/api/features/DeleteWebhook/schema.d.ts +4 -0
  149. package/api/features/DeleteWebhook/schema.js +7 -0
  150. package/api/features/DeleteWebhook/schema.js.map +1 -0
  151. package/api/features/GetWebhook/GetWebhookUseCase.d.ts +2 -2
  152. package/api/features/GetWebhook/GetWebhookUseCase.js +7 -2
  153. package/api/features/GetWebhook/GetWebhookUseCase.js.map +1 -1
  154. package/api/features/GetWebhook/abstractions.d.ts +2 -2
  155. package/api/features/GetWebhook/abstractions.js.map +1 -1
  156. package/api/features/GetWebhook/schema.d.ts +4 -0
  157. package/api/features/GetWebhook/schema.js +7 -0
  158. package/api/features/GetWebhook/schema.js.map +1 -0
  159. package/api/features/GetWebhookDelivery/GetWebhookDeliveryUseCase.d.ts +2 -2
  160. package/api/features/GetWebhookDelivery/GetWebhookDeliveryUseCase.js +7 -2
  161. package/api/features/GetWebhookDelivery/GetWebhookDeliveryUseCase.js.map +1 -1
  162. package/api/features/GetWebhookDelivery/abstractions.d.ts +2 -2
  163. package/api/features/GetWebhookDelivery/abstractions.js.map +1 -1
  164. package/api/features/GetWebhookDelivery/schema.d.ts +4 -0
  165. package/api/features/GetWebhookDelivery/schema.js +7 -0
  166. package/api/features/GetWebhookDelivery/schema.js.map +1 -0
  167. package/api/features/GetWebhookSettings/GetWebhookSettingsRepository.d.ts +19 -0
  168. package/api/features/GetWebhookSettings/GetWebhookSettingsRepository.js +57 -0
  169. package/api/features/GetWebhookSettings/GetWebhookSettingsRepository.js.map +1 -0
  170. package/api/features/GetWebhookSettings/abstractions.d.ts +13 -0
  171. package/api/features/GetWebhookSettings/abstractions.js +5 -0
  172. package/api/features/GetWebhookSettings/abstractions.js.map +1 -0
  173. package/api/features/GetWebhookSettings/feature.d.ts +4 -0
  174. package/api/features/GetWebhookSettings/feature.js +11 -0
  175. package/api/features/GetWebhookSettings/feature.js.map +1 -0
  176. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesUseCase.d.ts +2 -2
  177. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesUseCase.js +4 -1
  178. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesUseCase.js.map +1 -1
  179. package/api/features/ListWebhookDeliveries/abstractions.d.ts +2 -2
  180. package/api/features/ListWebhookDeliveries/abstractions.js.map +1 -1
  181. package/api/features/ListWebhookDeliveries/schema.d.ts +7 -0
  182. package/api/features/ListWebhookDeliveries/schema.js +10 -0
  183. package/api/features/ListWebhookDeliveries/schema.js.map +1 -0
  184. package/api/features/ListWebhooks/ListWebhooksUseCase.d.ts +2 -2
  185. package/api/features/ListWebhooks/ListWebhooksUseCase.js +4 -1
  186. package/api/features/ListWebhooks/ListWebhooksUseCase.js.map +1 -1
  187. package/api/features/ListWebhooks/abstractions.d.ts +2 -2
  188. package/api/features/ListWebhooks/abstractions.js.map +1 -1
  189. package/api/features/ListWebhooks/schema.d.ts +7 -0
  190. package/api/features/ListWebhooks/schema.js +10 -0
  191. package/api/features/ListWebhooks/schema.js.map +1 -0
  192. package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.d.ts +8 -6
  193. package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.js +16 -6
  194. package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.js.map +1 -1
  195. package/api/features/ResendWebhookDelivery/abstractions.d.ts +2 -2
  196. package/api/features/ResendWebhookDelivery/abstractions.js.map +1 -1
  197. package/api/features/ResendWebhookDelivery/schema.d.ts +4 -0
  198. package/api/features/ResendWebhookDelivery/schema.js +7 -0
  199. package/api/features/ResendWebhookDelivery/schema.js.map +1 -0
  200. package/api/features/SendWebhookTask/SendWebhookTask.d.ts +7 -3
  201. package/api/features/SendWebhookTask/SendWebhookTask.js +46 -34
  202. package/api/features/SendWebhookTask/SendWebhookTask.js.map +1 -1
  203. package/api/features/SendWebhookTask/types.d.ts +1 -0
  204. package/api/features/TriggerWebhook/TriggerWebhookUseCase.d.ts +3 -1
  205. package/api/features/TriggerWebhook/TriggerWebhookUseCase.js +17 -6
  206. package/api/features/TriggerWebhook/TriggerWebhookUseCase.js.map +1 -1
  207. package/api/features/TriggerWebhook/abstractions.d.ts +2 -2
  208. package/api/features/TriggerWebhook/abstractions.js.map +1 -1
  209. package/api/features/TriggerWebhook/schema.d.ts +5 -0
  210. package/api/features/TriggerWebhook/schema.js +8 -0
  211. package/api/features/TriggerWebhook/schema.js.map +1 -0
  212. package/api/features/UpdateWebhook/UpdateWebhookUseCase.d.ts +4 -4
  213. package/api/features/UpdateWebhook/UpdateWebhookUseCase.js +9 -33
  214. package/api/features/UpdateWebhook/UpdateWebhookUseCase.js.map +1 -1
  215. package/api/features/UpdateWebhook/abstractions.d.ts +0 -1
  216. package/api/features/UpdateWebhook/abstractions.js.map +1 -1
  217. package/api/features/UpdateWebhook/schema.d.ts +9 -0
  218. package/api/features/UpdateWebhook/schema.js +15 -0
  219. package/api/features/UpdateWebhook/schema.js.map +1 -0
  220. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.d.ts +21 -0
  221. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js +62 -0
  222. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js.map +1 -0
  223. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsUseCase.d.ts +14 -0
  224. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsUseCase.js +27 -0
  225. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsUseCase.js.map +1 -0
  226. package/api/features/UpdateWebhookSettings/abstractions.d.ts +27 -0
  227. package/api/features/UpdateWebhookSettings/abstractions.js +6 -0
  228. package/api/features/UpdateWebhookSettings/abstractions.js.map +1 -0
  229. package/api/features/UpdateWebhookSettings/feature.d.ts +4 -0
  230. package/api/features/UpdateWebhookSettings/feature.js +13 -0
  231. package/api/features/UpdateWebhookSettings/feature.js.map +1 -0
  232. package/api/features/UpdateWebhookSettings/schema.d.ts +5 -0
  233. package/api/features/UpdateWebhookSettings/schema.js +9 -0
  234. package/api/features/UpdateWebhookSettings/schema.js.map +1 -0
  235. package/api/features/WebhookDeliver/WebhookDeliver.d.ts +13 -0
  236. package/api/features/WebhookDeliver/WebhookDeliver.js +79 -0
  237. package/api/features/WebhookDeliver/WebhookDeliver.js.map +1 -0
  238. package/api/features/WebhookDeliver/abstractions.d.ts +24 -0
  239. package/api/features/WebhookDeliver/abstractions.js +5 -0
  240. package/api/features/WebhookDeliver/abstractions.js.map +1 -0
  241. package/api/features/WebhookDeliver/feature.d.ts +4 -0
  242. package/api/features/WebhookDeliver/feature.js +11 -0
  243. package/api/features/WebhookDeliver/feature.js.map +1 -0
  244. package/api/features/WebhookDeliver/index.d.ts +2 -0
  245. package/api/features/WebhookDeliver/index.js +2 -0
  246. package/api/features/WebhookDispatcher/WebhookDispatcher.d.ts +3 -1
  247. package/api/features/WebhookDispatcher/WebhookDispatcher.js +9 -4
  248. package/api/features/WebhookDispatcher/WebhookDispatcher.js.map +1 -1
  249. package/api/features/WebhookSignPayload/WebhookSignPayload.d.ts +1 -0
  250. package/api/features/WebhookSignPayload/WebhookSignPayload.js +7 -1
  251. package/api/features/WebhookSignPayload/WebhookSignPayload.js.map +1 -1
  252. package/api/graphql/WebhookCrudSchema.js +1 -2
  253. package/api/graphql/WebhookCrudSchema.js.map +1 -1
  254. package/api/graphql/WebhookDeliverySchema.js +12 -8
  255. package/api/graphql/WebhookDeliverySchema.js.map +1 -1
  256. package/api/graphql/WebhookEventSchema.js +2 -0
  257. package/api/graphql/WebhookEventSchema.js.map +1 -1
  258. package/api/graphql/WebhookSettingsSchema.d.ts +8 -0
  259. package/api/graphql/WebhookSettingsSchema.js +62 -0
  260. package/api/graphql/WebhookSettingsSchema.js.map +1 -0
  261. package/api/models/WebhookDeliveryModel.js +4 -4
  262. package/api/models/WebhookDeliveryModel.js.map +1 -1
  263. package/api/models/WebhookModel.js +1 -1
  264. package/api/models/WebhookModel.js.map +1 -1
  265. package/api/models/WebhookSettingsModel.d.ts +8 -0
  266. package/api/models/WebhookSettingsModel.js +28 -0
  267. package/api/models/WebhookSettingsModel.js.map +1 -0
  268. package/api/utils/isValidEndpointUrl.d.ts +1 -0
  269. package/api/utils/isValidEndpointUrl.js +13 -0
  270. package/api/utils/isValidEndpointUrl.js.map +1 -0
  271. package/exports/api/webhooks.d.ts +0 -1
  272. package/exports/api/webhooks.js +0 -1
  273. package/package.json +27 -23
  274. package/admin/SecurityPermission.d.ts +0 -2
  275. package/admin/SecurityPermission.js +0 -15
  276. package/admin/SecurityPermission.js.map +0 -1
  277. package/admin/presentation/WebhookDeliveries/WebhookDeliveriesDataSource.js.map +0 -1
  278. package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.d.ts +0 -19
  279. package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.js +0 -77
  280. package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.js.map +0 -1
  281. package/admin/presentation/WebhookDeliveries/abstractions.d.ts +0 -22
  282. package/admin/presentation/WebhookDeliveries/abstractions.js +0 -5
  283. package/admin/presentation/WebhookDeliveries/abstractions.js.map +0 -1
  284. package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.d.ts +0 -11
  285. package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.js +0 -73
  286. package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.js.map +0 -1
  287. package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.d.ts +0 -8
  288. package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.js +0 -119
  289. package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.js.map +0 -1
  290. package/admin/presentation/WebhookDeliveries/feature.d.ts +0 -3
  291. package/admin/presentation/WebhookDeliveries/feature.js +0 -17
  292. package/admin/presentation/WebhookDeliveries/feature.js.map +0 -1
  293. package/admin/presentation/WebhookDeliveries/index.d.ts +0 -2
  294. package/admin/presentation/WebhookDeliveries/index.js +0 -2
  295. package/admin/presentation/WebhookForm/components/EventsSelector.d.ts +0 -12
  296. package/admin/presentation/WebhookForm/components/EventsSelector.js +0 -44
  297. package/admin/presentation/WebhookForm/components/EventsSelector.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { type Result } from "@webiny/feature/api";
2
2
  import type { WebhookDelivery } from "../../../api/domain/WebhookDelivery.js";
3
- import type { WebhookDeliveryNotFoundError, WebhookPersistenceError, WebhookModelNotFoundError, WebhookNotAuthorizedError } from "../../../api/domain/errors.js";
4
- type IError = WebhookDeliveryNotFoundError | WebhookPersistenceError | WebhookModelNotFoundError | WebhookNotAuthorizedError;
3
+ import type { WebhookDeliveryNotFoundError, WebhookPersistenceError, WebhookModelNotFoundError, WebhookNotAuthorizedError, WebhookValidationError } from "../../../api/domain/errors.js";
4
+ type IError = WebhookDeliveryNotFoundError | WebhookPersistenceError | WebhookModelNotFoundError | WebhookNotAuthorizedError | WebhookValidationError;
5
5
  export interface IGetWebhookDeliveryUseCase {
6
6
  execute(id: string): Promise<Result<WebhookDelivery, IError>>;
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"api/features/GetWebhookDelivery/abstractions.js","sources":["../../../../src/api/features/GetWebhookDelivery/abstractions.ts"],"sourcesContent":["import { createAbstraction, type Result } from \"@webiny/feature/api\";\nimport type { WebhookDelivery } from \"~/api/domain/WebhookDelivery.js\";\nimport type {\n WebhookDeliveryNotFoundError,\n WebhookPersistenceError,\n WebhookModelNotFoundError,\n WebhookNotAuthorizedError\n} from \"~/api/domain/errors.js\";\n\ntype IError =\n | WebhookDeliveryNotFoundError\n | WebhookPersistenceError\n | WebhookModelNotFoundError\n | WebhookNotAuthorizedError;\n\nexport interface IGetWebhookDeliveryUseCase {\n execute(id: string): Promise<Result<WebhookDelivery, IError>>;\n}\n\nexport const GetWebhookDeliveryUseCase = createAbstraction<IGetWebhookDeliveryUseCase>(\n \"Webhooks/GetWebhookDeliveryUseCase\"\n);\n\nexport namespace GetWebhookDeliveryUseCase {\n export type Interface = IGetWebhookDeliveryUseCase;\n export type Error = IError;\n}\n\nexport interface IGetWebhookDeliveryRepository {\n execute(id: string): Promise<Result<WebhookDelivery, IError>>;\n}\n\nexport const GetWebhookDeliveryRepository = createAbstraction<IGetWebhookDeliveryRepository>(\n \"Webhooks/GetWebhookDeliveryRepository\"\n);\n\nexport namespace GetWebhookDeliveryRepository {\n export type Interface = IGetWebhookDeliveryRepository;\n export type Error = IError;\n}\n"],"names":["GetWebhookDeliveryUseCase","createAbstraction","GetWebhookDeliveryRepository"],"mappings":";AAmBO,MAAMA,4BAA4BC,kBACrC;AAYG,MAAMC,+BAA+BD,kBACxC"}
1
+ {"version":3,"file":"api/features/GetWebhookDelivery/abstractions.js","sources":["../../../../src/api/features/GetWebhookDelivery/abstractions.ts"],"sourcesContent":["import { createAbstraction, type Result } from \"@webiny/feature/api\";\nimport type { WebhookDelivery } from \"~/api/domain/WebhookDelivery.js\";\nimport type {\n WebhookDeliveryNotFoundError,\n WebhookPersistenceError,\n WebhookModelNotFoundError,\n WebhookNotAuthorizedError,\n WebhookValidationError\n} from \"~/api/domain/errors.js\";\n\ntype IError =\n | WebhookDeliveryNotFoundError\n | WebhookPersistenceError\n | WebhookModelNotFoundError\n | WebhookNotAuthorizedError\n | WebhookValidationError;\n\nexport interface IGetWebhookDeliveryUseCase {\n execute(id: string): Promise<Result<WebhookDelivery, IError>>;\n}\n\nexport const GetWebhookDeliveryUseCase = createAbstraction<IGetWebhookDeliveryUseCase>(\n \"Webhooks/GetWebhookDeliveryUseCase\"\n);\n\nexport namespace GetWebhookDeliveryUseCase {\n export type Interface = IGetWebhookDeliveryUseCase;\n export type Error = IError;\n}\n\nexport interface IGetWebhookDeliveryRepository {\n execute(id: string): Promise<Result<WebhookDelivery, IError>>;\n}\n\nexport const GetWebhookDeliveryRepository = createAbstraction<IGetWebhookDeliveryRepository>(\n \"Webhooks/GetWebhookDeliveryRepository\"\n);\n\nexport namespace GetWebhookDeliveryRepository {\n export type Interface = IGetWebhookDeliveryRepository;\n export type Error = IError;\n}\n"],"names":["GetWebhookDeliveryUseCase","createAbstraction","GetWebhookDeliveryRepository"],"mappings":";AAqBO,MAAMA,4BAA4BC,kBACrC;AAYG,MAAMC,+BAA+BD,kBACxC"}
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ export declare const GetWebhookDeliveryInputSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ }, z.core.$strip>;
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ const GetWebhookDeliveryInputSchema = z.object({
3
+ id: z.string().min(1, "Delivery ID is required.")
4
+ });
5
+ export { GetWebhookDeliveryInputSchema };
6
+
7
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/GetWebhookDelivery/schema.js","sources":["../../../../src/api/features/GetWebhookDelivery/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const GetWebhookDeliveryInputSchema = z.object({\n id: z.string().min(1, \"Delivery ID is required.\")\n});\n"],"names":["GetWebhookDeliveryInputSchema","z"],"mappings":";AAEO,MAAMA,gCAAgCC,EAAE,MAAM,CAAC;IAClD,IAAIA,EAAE,MAAM,GAAG,GAAG,CAAC,GAAG;AAC1B"}
@@ -0,0 +1,19 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { GetModelRepository } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
3
+ import { GetLatestRevisionByEntryIdRepository } from "@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js";
4
+ import { CreateEntryRepository } from "@webiny/api-headless-cms/features/contentEntry/CreateEntry/index.js";
5
+ import { CreateEntryDataFactory } from "@webiny/api-headless-cms/exports/api/cms/entry.js";
6
+ import { GetWebhookSettingsRepository as RepositoryAbstraction } from "./abstractions.js";
7
+ import type { IWebhookSettings } from "../../../api/domain/WebhookSettings.js";
8
+ declare class GetWebhookSettingsRepositoryImpl implements RepositoryAbstraction.Interface {
9
+ private readonly getModelRepository;
10
+ private readonly getLatestRevisionRepository;
11
+ private readonly createEntryRepository;
12
+ private readonly createEntryDataFactory;
13
+ constructor(getModelRepository: GetModelRepository.Interface, getLatestRevisionRepository: GetLatestRevisionByEntryIdRepository.Interface, createEntryRepository: CreateEntryRepository.Interface, createEntryDataFactory: CreateEntryDataFactory.Interface);
14
+ execute(): Promise<Result<IWebhookSettings, RepositoryAbstraction.Error>>;
15
+ }
16
+ export declare const GetWebhookSettingsRepository: typeof GetWebhookSettingsRepositoryImpl & {
17
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetWebhookSettingsRepository>;
18
+ };
19
+ export {};
@@ -0,0 +1,57 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { createCacheKey } from "@webiny/utils";
3
+ import { GetModelRepository } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
4
+ import { GetLatestRevisionByEntryIdRepository } from "@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js";
5
+ import { CreateEntryRepository } from "@webiny/api-headless-cms/features/contentEntry/CreateEntry/index.js";
6
+ import { CreateEntryDataFactory } from "@webiny/api-headless-cms/exports/api/cms/entry.js";
7
+ import { GetWebhookSettingsRepository } from "./abstractions.js";
8
+ import { WebhookModelNotFoundError, WebhookPersistenceError } from "../../domain/errors.js";
9
+ import { WEBHOOK_SETTINGS_MODEL_ID } from "../../domain/constants.js";
10
+ class GetWebhookSettingsRepositoryImpl {
11
+ constructor(getModelRepository, getLatestRevisionRepository, createEntryRepository, createEntryDataFactory){
12
+ this.getModelRepository = getModelRepository;
13
+ this.getLatestRevisionRepository = getLatestRevisionRepository;
14
+ this.createEntryRepository = createEntryRepository;
15
+ this.createEntryDataFactory = createEntryDataFactory;
16
+ }
17
+ async execute() {
18
+ try {
19
+ const modelResult = await this.getModelRepository.execute(WEBHOOK_SETTINGS_MODEL_ID);
20
+ if (modelResult.isFail()) return Result.fail(new WebhookModelNotFoundError(WEBHOOK_SETTINGS_MODEL_ID));
21
+ const model = modelResult.value;
22
+ const singletonId = createCacheKey(model.modelId);
23
+ const entryId = `${singletonId}#0001`;
24
+ const entryResult = await this.getLatestRevisionRepository.execute(model, {
25
+ id: entryId
26
+ });
27
+ if (entryResult.isOk()) return Result.ok({
28
+ signingSecret: entryResult.value.values.signingSecret,
29
+ deliveryRetentionDays: entryResult.value.values.deliveryRetentionDays
30
+ });
31
+ const { entry } = await this.createEntryDataFactory.create(model, {
32
+ id: singletonId,
33
+ values: {}
34
+ });
35
+ const createResult = await this.createEntryRepository.execute(model, entry);
36
+ if (createResult.isFail()) return Result.fail(WebhookPersistenceError.from(createResult.error));
37
+ return Result.ok({
38
+ signingSecret: void 0,
39
+ deliveryRetentionDays: void 0
40
+ });
41
+ } catch (error) {
42
+ return Result.fail(WebhookPersistenceError.from(error));
43
+ }
44
+ }
45
+ }
46
+ const GetWebhookSettingsRepository_GetWebhookSettingsRepository = GetWebhookSettingsRepository.createImplementation({
47
+ implementation: GetWebhookSettingsRepositoryImpl,
48
+ dependencies: [
49
+ GetModelRepository,
50
+ GetLatestRevisionByEntryIdRepository,
51
+ CreateEntryRepository,
52
+ CreateEntryDataFactory
53
+ ]
54
+ });
55
+ export { GetWebhookSettingsRepository_GetWebhookSettingsRepository as GetWebhookSettingsRepository };
56
+
57
+ //# sourceMappingURL=GetWebhookSettingsRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/GetWebhookSettings/GetWebhookSettingsRepository.js","sources":["../../../../src/api/features/GetWebhookSettings/GetWebhookSettingsRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { createCacheKey } from \"@webiny/utils\";\nimport { GetModelRepository } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { GetLatestRevisionByEntryIdRepository } from \"@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js\";\nimport { CreateEntryRepository } from \"@webiny/api-headless-cms/features/contentEntry/CreateEntry/index.js\";\nimport { CreateEntryDataFactory } from \"@webiny/api-headless-cms/exports/api/cms/entry.js\";\nimport { GetWebhookSettingsRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { WebhookModelNotFoundError, WebhookPersistenceError } from \"~/api/domain/errors.js\";\nimport { WEBHOOK_SETTINGS_MODEL_ID } from \"~/api/domain/constants.js\";\nimport type { IWebhookSettings } from \"~/api/domain/WebhookSettings.js\";\n\ninterface WebhookSettingsValues {\n signingSecret?: string;\n deliveryRetentionDays?: number;\n}\n\nclass GetWebhookSettingsRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private readonly getModelRepository: GetModelRepository.Interface,\n private readonly getLatestRevisionRepository: GetLatestRevisionByEntryIdRepository.Interface,\n private readonly createEntryRepository: CreateEntryRepository.Interface,\n private readonly createEntryDataFactory: CreateEntryDataFactory.Interface\n ) {}\n\n async execute(): Promise<Result<IWebhookSettings, RepositoryAbstraction.Error>> {\n try {\n const modelResult = await this.getModelRepository.execute(WEBHOOK_SETTINGS_MODEL_ID);\n if (modelResult.isFail()) {\n return Result.fail(new WebhookModelNotFoundError(WEBHOOK_SETTINGS_MODEL_ID));\n }\n\n const model = modelResult.value;\n const singletonId = createCacheKey(model.modelId);\n const entryId = `${singletonId}#0001`;\n\n const entryResult =\n await this.getLatestRevisionRepository.execute<WebhookSettingsValues>(model, {\n id: entryId\n });\n\n if (entryResult.isOk()) {\n return Result.ok({\n signingSecret: entryResult.value.values.signingSecret,\n deliveryRetentionDays: entryResult.value.values.deliveryRetentionDays\n });\n }\n\n /* Entry doesn't exist yet — create it with empty values. */\n const { entry } = await this.createEntryDataFactory.create<WebhookSettingsValues>(\n model,\n { id: singletonId, values: {} as WebhookSettingsValues }\n );\n\n const createResult = await this.createEntryRepository.execute(model, entry);\n if (createResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(createResult.error));\n }\n\n return Result.ok({ signingSecret: undefined, deliveryRetentionDays: undefined });\n } catch (error) {\n return Result.fail(WebhookPersistenceError.from(error));\n }\n }\n}\n\nexport const GetWebhookSettingsRepository = RepositoryAbstraction.createImplementation({\n implementation: GetWebhookSettingsRepositoryImpl,\n dependencies: [\n GetModelRepository,\n GetLatestRevisionByEntryIdRepository,\n CreateEntryRepository,\n CreateEntryDataFactory\n ]\n});\n"],"names":["GetWebhookSettingsRepositoryImpl","getModelRepository","getLatestRevisionRepository","createEntryRepository","createEntryDataFactory","modelResult","WEBHOOK_SETTINGS_MODEL_ID","Result","WebhookModelNotFoundError","model","singletonId","createCacheKey","entryId","entryResult","entry","createResult","WebhookPersistenceError","undefined","error","GetWebhookSettingsRepository","RepositoryAbstraction","GetModelRepository","GetLatestRevisionByEntryIdRepository","CreateEntryRepository","CreateEntryDataFactory"],"mappings":";;;;;;;;;AAgBA,MAAMA;IACF,YACqBC,kBAAgD,EAChDC,2BAA2E,EAC3EC,qBAAsD,EACtDC,sBAAwD,CAC3E;aAJmBH,kBAAkB,GAAlBA;aACAC,2BAA2B,GAA3BA;aACAC,qBAAqB,GAArBA;aACAC,sBAAsB,GAAtBA;IAClB;IAEH,MAAM,UAA0E;QAC5E,IAAI;YACA,MAAMC,cAAc,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAACC;YAC1D,IAAID,YAAY,MAAM,IAClB,OAAOE,OAAO,IAAI,CAAC,IAAIC,0BAA0BF;YAGrD,MAAMG,QAAQJ,YAAY,KAAK;YAC/B,MAAMK,cAAcC,eAAeF,MAAM,OAAO;YAChD,MAAMG,UAAU,GAAGF,YAAY,KAAK,CAAC;YAErC,MAAMG,cACF,MAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAwBJ,OAAO;gBACzE,IAAIG;YACR;YAEJ,IAAIC,YAAY,IAAI,IAChB,OAAON,OAAO,EAAE,CAAC;gBACb,eAAeM,YAAY,KAAK,CAAC,MAAM,CAAC,aAAa;gBACrD,uBAAuBA,YAAY,KAAK,CAAC,MAAM,CAAC,qBAAqB;YACzE;YAIJ,MAAM,EAAEC,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,MAAM,CACtDL,OACA;gBAAE,IAAIC;gBAAa,QAAQ,CAAC;YAA2B;YAG3D,MAAMK,eAAe,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAACN,OAAOK;YACrE,IAAIC,aAAa,MAAM,IACnB,OAAOR,OAAO,IAAI,CAACS,wBAAwB,IAAI,CAACD,aAAa,KAAK;YAGtE,OAAOR,OAAO,EAAE,CAAC;gBAAE,eAAeU;gBAAW,uBAAuBA;YAAU;QAClF,EAAE,OAAOC,OAAO;YACZ,OAAOX,OAAO,IAAI,CAACS,wBAAwB,IAAI,CAACE;QACpD;IACJ;AACJ;AAEO,MAAMC,4DAA+BC,6BAAAA,oBAA0C,CAAC;IACnF,gBAAgBpB;IAChB,cAAc;QACVqB;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -0,0 +1,13 @@
1
+ import { type Result } from "@webiny/feature/api";
2
+ import type { IWebhookSettings } from "../../../api/domain/WebhookSettings.js";
3
+ import type { WebhookModelNotFoundError, WebhookPersistenceError } from "../../../api/domain/errors.js";
4
+ type IError = WebhookModelNotFoundError | WebhookPersistenceError;
5
+ export interface IGetWebhookSettingsRepository {
6
+ execute(): Promise<Result<IWebhookSettings, IError>>;
7
+ }
8
+ export declare const GetWebhookSettingsRepository: import("@webiny/di").Abstraction<IGetWebhookSettingsRepository>;
9
+ export declare namespace GetWebhookSettingsRepository {
10
+ type Interface = IGetWebhookSettingsRepository;
11
+ type Error = IError;
12
+ }
13
+ export {};
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const GetWebhookSettingsRepository = createAbstraction("Webhooks/GetWebhookSettingsRepository");
3
+ export { GetWebhookSettingsRepository };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/GetWebhookSettings/abstractions.js","sources":["../../../../src/api/features/GetWebhookSettings/abstractions.ts"],"sourcesContent":["import { createAbstraction, type Result } from \"@webiny/feature/api\";\nimport type { IWebhookSettings } from \"~/api/domain/WebhookSettings.js\";\nimport type { WebhookModelNotFoundError, WebhookPersistenceError } from \"~/api/domain/errors.js\";\n\ntype IError = WebhookModelNotFoundError | WebhookPersistenceError;\n\nexport interface IGetWebhookSettingsRepository {\n execute(): Promise<Result<IWebhookSettings, IError>>;\n}\n\nexport const GetWebhookSettingsRepository = createAbstraction<IGetWebhookSettingsRepository>(\n \"Webhooks/GetWebhookSettingsRepository\"\n);\n\nexport namespace GetWebhookSettingsRepository {\n export type Interface = IGetWebhookSettingsRepository;\n export type Error = IError;\n}\n"],"names":["GetWebhookSettingsRepository","createAbstraction"],"mappings":";AAUO,MAAMA,+BAA+BC,kBACxC"}
@@ -0,0 +1,4 @@
1
+ export declare const GetWebhookSettingsFeature: {
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 { GetWebhookSettingsRepository } from "./GetWebhookSettingsRepository.js";
3
+ const GetWebhookSettingsFeature = createFeature({
4
+ name: "GetWebhookSettings",
5
+ register (container) {
6
+ container.register(GetWebhookSettingsRepository).inSingletonScope();
7
+ }
8
+ });
9
+ export { GetWebhookSettingsFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api/features/GetWebhookSettings/feature.js","sources":["../../../../src/api/features/GetWebhookSettings/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetWebhookSettingsRepository } from \"./GetWebhookSettingsRepository.js\";\n\nexport const GetWebhookSettingsFeature = createFeature({\n name: \"GetWebhookSettings\",\n register(container) {\n container.register(GetWebhookSettingsRepository).inSingletonScope();\n }\n});\n"],"names":["GetWebhookSettingsFeature","createFeature","container","GetWebhookSettingsRepository"],"mappings":";;AAGO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,8BAA8B,gBAAgB;IACrE;AACJ"}
@@ -3,8 +3,8 @@ import { ListWebhookDeliveriesUseCase as UseCaseAbstraction, ListWebhookDeliveri
3
3
  import { WebhookPermissions } from "../../../api/features/WebhookPermissions/abstractions.js";
4
4
  import type { IListWebhookDeliveriesInput } from "./abstractions.js";
5
5
  declare class ListWebhookDeliveriesUseCaseImpl implements UseCaseAbstraction.Interface {
6
- private permissions;
7
- private repository;
6
+ private readonly permissions;
7
+ private readonly repository;
8
8
  constructor(permissions: WebhookPermissions.Interface, repository: ListWebhookDeliveriesRepository.Interface);
9
9
  execute(input: IListWebhookDeliveriesInput): Promise<Result<UseCaseAbstraction.Output, UseCaseAbstraction.Error>>;
10
10
  }
@@ -1,7 +1,8 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { ListWebhookDeliveriesRepository, ListWebhookDeliveriesUseCase } from "./abstractions.js";
3
+ import { ListWebhookDeliveriesInputSchema } from "./schema.js";
3
4
  import { WebhookPermissions } from "../WebhookPermissions/abstractions.js";
4
- import { WebhookNotAuthorizedError } from "../../domain/errors.js";
5
+ import { WebhookNotAuthorizedError, WebhookValidationError } from "../../domain/errors.js";
5
6
  class ListWebhookDeliveriesUseCaseImpl {
6
7
  constructor(permissions, repository){
7
8
  this.permissions = permissions;
@@ -9,6 +10,8 @@ class ListWebhookDeliveriesUseCaseImpl {
9
10
  }
10
11
  async execute(input) {
11
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));
12
15
  return this.repository.execute(input);
13
16
  }
14
17
  }
@@ -1 +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 { WebhookPermissions } from \"~/api/features/WebhookPermissions/abstractions.js\";\nimport { WebhookNotAuthorizedError } from \"~/api/domain/errors.js\";\nimport type { IListWebhookDeliveriesInput } from \"./abstractions.js\";\n\nclass ListWebhookDeliveriesUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private permissions: WebhookPermissions.Interface,\n private 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 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","ListWebhookDeliveriesUseCase","UseCaseAbstraction","WebhookPermissions","ListWebhookDeliveriesRepository"],"mappings":";;;;AASA,MAAMA;IACF,YACYC,WAAyC,EACzCC,UAAqD,CAC/D;aAFUD,WAAW,GAAXA;aACAC,UAAU,GAAVA;IACT;IAEH,MAAM,QACFC,KAAkC,EACkC;QACpE,IAAI,CAAE,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,YACjC,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAE3B,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAACF;IACnC;AACJ;AAEO,MAAMG,4DAA+BC,6BAAAA,oBAAuC,CAAC;IAChF,gBAAgBP;IAChB,cAAc;QAACQ;QAAoBC;KAAgC;AACvE"}
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"}
@@ -1,6 +1,6 @@
1
1
  import { type Result } from "@webiny/feature/api";
2
2
  import type { WebhookDelivery, WebhookDeliveryStatus } from "../../../api/domain/WebhookDelivery.js";
3
- import type { WebhookModelNotFoundError, WebhookNotAuthorizedError, WebhookPersistenceError } from "../../../api/domain/errors.js";
3
+ import type { WebhookModelNotFoundError, WebhookNotAuthorizedError, WebhookPersistenceError, WebhookValidationError } from "../../../api/domain/errors.js";
4
4
  import type { DateStringInterfaceGenerator, IdInterfaceGenerator, NumericInterfaceGenerator, TextInterfaceGenerator } from "@webiny/api";
5
5
  export interface IListWebhookDeliveriesInputWhere extends IdInterfaceGenerator<"id">, IdInterfaceGenerator<"webhookId">, IdInterfaceGenerator<"backgroundTaskId">, DateStringInterfaceGenerator<"createdOn">, DateStringInterfaceGenerator<"savedOn">, TextInterfaceGenerator<"eventType">, TextInterfaceGenerator<WebhookDeliveryStatus>, NumericInterfaceGenerator<"responseStatus"> {
6
6
  }
@@ -15,7 +15,7 @@ export interface IListMeta {
15
15
  hasMoreItems: boolean;
16
16
  totalCount: number;
17
17
  }
18
- type IError = WebhookPersistenceError | WebhookModelNotFoundError | WebhookNotAuthorizedError;
18
+ type IError = WebhookPersistenceError | WebhookModelNotFoundError | WebhookNotAuthorizedError | WebhookValidationError;
19
19
  export interface IListWebhookDeliveriesOutput {
20
20
  items: WebhookDelivery[];
21
21
  meta: IListMeta;
@@ -1 +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} 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 = WebhookPersistenceError | WebhookModelNotFoundError | WebhookNotAuthorizedError;\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":";AAqDO,MAAMA,+BAA+BC,kBACxC;AAeG,MAAMC,kCAAkCD,kBAC3C"}
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,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"}
@@ -3,8 +3,8 @@ import { ListWebhooksUseCase as UseCaseAbstraction, ListWebhooksRepository } fro
3
3
  import { WebhookPermissions } from "../../../api/features/WebhookPermissions/abstractions.js";
4
4
  import type { IListWebhooksInput } from "./abstractions.js";
5
5
  declare class ListWebhooksUseCaseImpl implements UseCaseAbstraction.Interface {
6
- private permissions;
7
- private repository;
6
+ private readonly permissions;
7
+ private readonly repository;
8
8
  constructor(permissions: WebhookPermissions.Interface, repository: ListWebhooksRepository.Interface);
9
9
  execute(input?: IListWebhooksInput): Promise<Result<UseCaseAbstraction.Output, UseCaseAbstraction.Error>>;
10
10
  }
@@ -1,7 +1,8 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { ListWebhooksRepository, ListWebhooksUseCase } from "./abstractions.js";
3
+ import { ListWebhooksInputSchema } from "./schema.js";
3
4
  import { WebhookPermissions } from "../WebhookPermissions/abstractions.js";
4
- import { WebhookNotAuthorizedError } from "../../domain/errors.js";
5
+ import { WebhookNotAuthorizedError, WebhookValidationError } from "../../domain/errors.js";
5
6
  class ListWebhooksUseCaseImpl {
6
7
  constructor(permissions, repository){
7
8
  this.permissions = permissions;
@@ -9,6 +10,8 @@ class ListWebhooksUseCaseImpl {
9
10
  }
10
11
  async execute(input) {
11
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));
12
15
  return this.repository.execute(input);
13
16
  }
14
17
  }
@@ -1 +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 { WebhookPermissions } from \"~/api/features/WebhookPermissions/abstractions.js\";\nimport { WebhookNotAuthorizedError } from \"~/api/domain/errors.js\";\nimport type { IListWebhooksInput } from \"./abstractions.js\";\n\nclass ListWebhooksUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private permissions: WebhookPermissions.Interface,\n private 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 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","ListWebhooksUseCase","UseCaseAbstraction","WebhookPermissions","ListWebhooksRepository"],"mappings":";;;;AASA,MAAMA;IACF,YACYC,WAAyC,EACzCC,UAA4C,CACtD;aAFUD,WAAW,GAAXA;aACAC,UAAU,GAAVA;IACT;IAEH,MAAM,QACFC,KAA0B,EAC0C;QACpE,IAAI,CAAE,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,YACjC,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAE3B,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAACF;IACnC;AACJ;AAEO,MAAMG,0CAAsBC,oBAAAA,oBAAuC,CAAC;IACvE,gBAAgBP;IAChB,cAAc;QAACQ;QAAoBC;KAAuB;AAC9D"}
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"}
@@ -1,6 +1,6 @@
1
1
  import { type Result } from "@webiny/feature/api";
2
2
  import type { Webhook } from "../../../api/domain/Webhook.js";
3
- import type { WebhookModelNotFoundError, WebhookPersistenceError, WebhookNotAuthorizedError } from "../../../api/domain/errors.js";
3
+ import type { WebhookModelNotFoundError, WebhookPersistenceError, WebhookNotAuthorizedError, WebhookValidationError } from "../../../api/domain/errors.js";
4
4
  import type { DateStringInterfaceGenerator, IdInterfaceGenerator, TextInterfaceGenerator, TruthfulInterfaceGenerator } from "@webiny/api";
5
5
  export interface IListWebhooksInputWhere extends IdInterfaceGenerator<"id">, DateStringInterfaceGenerator<"createdOn">, DateStringInterfaceGenerator<"savedOn">, TextInterfaceGenerator<"name">, TextInterfaceGenerator<"slug">, TextInterfaceGenerator<"endpointUrl">, TextInterfaceGenerator<"events">, TruthfulInterfaceGenerator<"enabled"> {
6
6
  }
@@ -15,7 +15,7 @@ export interface IListMeta {
15
15
  hasMoreItems: boolean;
16
16
  totalCount: number;
17
17
  }
18
- type IError = WebhookModelNotFoundError | WebhookPersistenceError | WebhookNotAuthorizedError;
18
+ type IError = WebhookModelNotFoundError | WebhookPersistenceError | WebhookNotAuthorizedError | WebhookValidationError;
19
19
  export interface IListWebhooksOutput {
20
20
  items: Webhook[];
21
21
  meta: IListMeta;
@@ -1 +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} 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 = WebhookModelNotFoundError | WebhookPersistenceError | WebhookNotAuthorizedError;\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":";AAmDO,MAAMA,sBAAsBC,kBAC/B;AAaG,MAAMC,yBAAyBD,kBAClC"}
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,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"}
@@ -3,15 +3,17 @@ import { ResendWebhookDeliveryUseCase as UseCaseAbstraction } from "./abstractio
3
3
  import { GetWebhookDeliveryRepository } from "../../../api/features/GetWebhookDelivery/abstractions.js";
4
4
  import { GetWebhookRepository } from "../../../api/features/GetWebhook/abstractions.js";
5
5
  import { CreateWebhookDeliveryRepository } from "../../../api/features/CreateWebhookDelivery/abstractions.js";
6
+ import { GetWebhookSettingsRepository } from "../../../api/features/GetWebhookSettings/abstractions.js";
6
7
  import { WebhookPermissions } from "../../../api/features/WebhookPermissions/abstractions.js";
7
8
  import { TaskService } from "@webiny/api-core/exports/api/tasks.js";
8
9
  declare class ResendWebhookDeliveryUseCaseImpl implements UseCaseAbstraction.Interface {
9
- private permissions;
10
- private getDeliveryRepository;
11
- private getWebhookRepository;
12
- private createDeliveryRepository;
13
- private taskService;
14
- constructor(permissions: WebhookPermissions.Interface, getDeliveryRepository: GetWebhookDeliveryRepository.Interface, getWebhookRepository: GetWebhookRepository.Interface, createDeliveryRepository: CreateWebhookDeliveryRepository.Interface, taskService: TaskService.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);
15
17
  execute(deliveryId: string): Promise<Result<boolean, UseCaseAbstraction.Error>>;
16
18
  }
17
19
  export declare const ResendWebhookDeliveryUseCase: typeof ResendWebhookDeliveryUseCaseImpl & {
@@ -1,30 +1,39 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { ResendWebhookDeliveryUseCase } from "./abstractions.js";
3
+ import { ResendWebhookDeliveryInputSchema } from "./schema.js";
3
4
  import { GetWebhookDeliveryRepository } from "../GetWebhookDelivery/abstractions.js";
4
5
  import { GetWebhookRepository } from "../GetWebhook/abstractions.js";
5
6
  import { CreateWebhookDeliveryRepository } from "../CreateWebhookDelivery/abstractions.js";
7
+ import { GetWebhookSettingsRepository } from "../GetWebhookSettings/abstractions.js";
6
8
  import { WebhookPermissions } from "../WebhookPermissions/abstractions.js";
7
- import { WebhookNotAuthorizedError } from "../../domain/errors.js";
9
+ import { WebhookNotAuthorizedError, WebhookValidationError } from "../../domain/errors.js";
8
10
  import { TaskService } from "@webiny/api-core/exports/api/tasks.js";
9
- import { SEND_WEBHOOK_TASK, WEBHOOK_DELIVERY_RETENTION_DAYS } from "../../domain/constants.js";
11
+ import { SEND_WEBHOOK_TASK, WEBHOOK_DELIVERY_MAX_RETENTION_DAYS } from "../../domain/constants.js";
10
12
  class ResendWebhookDeliveryUseCaseImpl {
11
- constructor(permissions, getDeliveryRepository, getWebhookRepository, createDeliveryRepository, taskService){
13
+ constructor(permissions, getDeliveryRepository, getWebhookRepository, createDeliveryRepository, taskService, getSettingsRepository){
12
14
  this.permissions = permissions;
13
15
  this.getDeliveryRepository = getDeliveryRepository;
14
16
  this.getWebhookRepository = getWebhookRepository;
15
17
  this.createDeliveryRepository = createDeliveryRepository;
16
18
  this.taskService = taskService;
19
+ this.getSettingsRepository = getSettingsRepository;
17
20
  }
18
21
  async execute(deliveryId) {
19
22
  if (!await this.permissions.canEdit("webhook")) return Result.fail(new WebhookNotAuthorizedError());
20
- const deliveryResult = await this.getDeliveryRepository.execute(deliveryId);
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);
21
28
  if (deliveryResult.isFail()) return Result.fail(deliveryResult.error);
22
29
  const delivery = deliveryResult.value;
23
30
  const webhookResult = await this.getWebhookRepository.execute(delivery.webhookId);
24
31
  if (webhookResult.isFail()) return Result.fail(webhookResult.error);
25
32
  const originalPayload = delivery.payload;
26
33
  const data = originalPayload?.data ?? {};
27
- const expiresAt = new Date(Date.now() + 24 * WEBHOOK_DELIVERY_RETENTION_DAYS * 3600000).toISOString();
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);
28
37
  const newDeliveryResult = await this.createDeliveryRepository.execute({
29
38
  webhookId: delivery.webhookId,
30
39
  eventType: delivery.eventType,
@@ -52,7 +61,8 @@ const ResendWebhookDeliveryUseCase_ResendWebhookDeliveryUseCase = ResendWebhookD
52
61
  GetWebhookDeliveryRepository,
53
62
  GetWebhookRepository,
54
63
  CreateWebhookDeliveryRepository,
55
- TaskService
64
+ TaskService,
65
+ GetWebhookSettingsRepository
56
66
  ]
57
67
  });
58
68
  export { ResendWebhookDeliveryUseCase_ResendWebhookDeliveryUseCase as ResendWebhookDeliveryUseCase };
@@ -1 +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 { GetWebhookDeliveryRepository } from \"~/api/features/GetWebhookDelivery/abstractions.js\";\nimport { GetWebhookRepository } from \"~/api/features/GetWebhook/abstractions.js\";\nimport { CreateWebhookDeliveryRepository } from \"~/api/features/CreateWebhookDelivery/abstractions.js\";\nimport { WebhookPermissions } from \"~/api/features/WebhookPermissions/abstractions.js\";\nimport { WebhookNotAuthorizedError } from \"~/api/domain/errors.js\";\nimport { TaskService } from \"@webiny/api-core/exports/api/tasks.js\";\nimport { SEND_WEBHOOK_TASK, WEBHOOK_DELIVERY_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 permissions: WebhookPermissions.Interface,\n private getDeliveryRepository: GetWebhookDeliveryRepository.Interface,\n private getWebhookRepository: GetWebhookRepository.Interface,\n private createDeliveryRepository: CreateWebhookDeliveryRepository.Interface,\n private taskService: TaskService.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 deliveryResult = await this.getDeliveryRepository.execute(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 expiresAt = new Date(\n Date.now() + WEBHOOK_DELIVERY_RETENTION_DAYS * 24 * 60 * 60 * 1000\n ).toISOString();\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 ]\n});\n"],"names":["ResendWebhookDeliveryUseCaseImpl","permissions","getDeliveryRepository","getWebhookRepository","createDeliveryRepository","taskService","deliveryId","Result","WebhookNotAuthorizedError","deliveryResult","delivery","webhookResult","originalPayload","data","expiresAt","Date","WEBHOOK_DELIVERY_RETENTION_DAYS","newDeliveryResult","SEND_WEBHOOK_TASK","ResendWebhookDeliveryUseCase","UseCaseAbstraction","WebhookPermissions","GetWebhookDeliveryRepository","GetWebhookRepository","CreateWebhookDeliveryRepository","TaskService"],"mappings":";;;;;;;;;AAWA,MAAMA;IACF,YACYC,WAAyC,EACzCC,qBAA6D,EAC7DC,oBAAoD,EACpDC,wBAAmE,EACnEC,WAAkC,CAC5C;aALUJ,WAAW,GAAXA;aACAC,qBAAqB,GAArBA;aACAC,oBAAoB,GAApBA;aACAC,wBAAwB,GAAxBA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,QAAQC,UAAkB,EAAsD;QAClF,IAAI,CAAE,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,YACjC,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,iBAAiB,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAACH;QAChE,IAAIG,eAAe,MAAM,IACrB,OAAOF,OAAO,IAAI,CAACE,eAAe,KAAK;QAG3C,MAAMC,WAAWD,eAAe,KAAK;QAErC,MAAME,gBAAgB,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAACD,SAAS,SAAS;QAChF,IAAIC,cAAc,MAAM,IACpB,OAAOJ,OAAO,IAAI,CAACI,cAAc,KAAK;QAG1C,MAAMC,kBAAkBF,SAAS,OAAO;QACxC,MAAMG,OAAOD,iBAAiB,QAAQ,CAAC;QAEvC,MAAME,YAAY,IAAIC,KAClBA,KAAK,GAAG,KAAKC,AAAkC,KAAlCA,kCAAAA,SACf,WAAW;QAEb,MAAMC,oBAAoB,MAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC;YAClE,WAAWP,SAAS,SAAS;YAC7B,WAAWA,SAAS,SAAS;YAC7B,QAAQ;YACR,SAASG;YACTC;QACJ;QAEA,IAAIG,kBAAkB,MAAM,IACxB,OAAOV,OAAO,IAAI,CAACU,kBAAkB,KAAK;QAG9C,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;YAC3B,YAAYC;YACZ,MAAM,CAAC,gBAAgB,EAAER,SAAS,SAAS,EAAE;YAC7C,OAAO;gBACH,WAAWA,SAAS,SAAS;gBAC7B,WAAWA,SAAS,SAAS;gBAC7B,YAAYO,kBAAkB,KAAK,CAAC,EAAE;YAC1C;QACJ;QAEA,OAAOV,OAAO,EAAE,CAAC;IACrB;AACJ;AAEO,MAAMY,4DAA+BC,6BAAAA,oBAAuC,CAAC;IAChF,gBAAgBpB;IAChB,cAAc;QACVqB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
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"}
@@ -1,6 +1,6 @@
1
1
  import { type Result } from "@webiny/feature/api";
2
- import type { WebhookDeliveryNotFoundError, WebhookNotFoundError, WebhookPersistenceError, WebhookModelNotFoundError, WebhookNotAuthorizedError } from "../../../api/domain/errors.js";
3
- type IError = WebhookDeliveryNotFoundError | WebhookNotFoundError | WebhookPersistenceError | WebhookModelNotFoundError | WebhookNotAuthorizedError;
2
+ import type { WebhookDeliveryNotFoundError, WebhookNotFoundError, WebhookPersistenceError, WebhookModelNotFoundError, WebhookNotAuthorizedError, WebhookValidationError } from "../../../api/domain/errors.js";
3
+ type IError = WebhookDeliveryNotFoundError | WebhookNotFoundError | WebhookPersistenceError | WebhookModelNotFoundError | WebhookNotAuthorizedError | WebhookValidationError;
4
4
  export interface IResendWebhookDeliveryUseCase {
5
5
  execute(deliveryId: string): Promise<Result<boolean, IError>>;
6
6
  }
@@ -1 +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} from \"~/api/domain/errors.js\";\n\ntype IError =\n | WebhookDeliveryNotFoundError\n | WebhookNotFoundError\n | WebhookPersistenceError\n | WebhookModelNotFoundError\n | WebhookNotAuthorizedError;\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":";AAoBO,MAAMA,+BAA+BC,kBACxC"}
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
+ 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"}