@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.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/admin/WebhookRoutes.d.ts +2 -0
- package/admin/WebhookRoutes.js +78 -0
- package/admin/WebhookRoutes.js.map +1 -0
- package/admin/Webhooks.d.ts +2 -0
- package/admin/Webhooks.js +61 -0
- package/admin/Webhooks.js.map +1 -0
- package/admin/features/ListWebhooks/ListWebhooksGateway.d.ts +11 -0
- package/admin/features/ListWebhooks/ListWebhooksGateway.js +68 -0
- package/admin/features/ListWebhooks/ListWebhooksGateway.js.map +1 -0
- package/admin/features/ListWebhooks/ListWebhooksRepository.d.ts +10 -0
- package/admin/features/ListWebhooks/ListWebhooksRepository.js +18 -0
- package/admin/features/ListWebhooks/ListWebhooksRepository.js.map +1 -0
- package/admin/features/ListWebhooks/ListWebhooksUseCase.d.ts +10 -0
- package/admin/features/ListWebhooks/ListWebhooksUseCase.js +18 -0
- package/admin/features/ListWebhooks/ListWebhooksUseCase.js.map +1 -0
- package/admin/features/ListWebhooks/abstractions.d.ts +37 -0
- package/admin/features/ListWebhooks/abstractions.js +7 -0
- package/admin/features/ListWebhooks/abstractions.js.map +1 -0
- package/admin/features/ListWebhooks/feature.d.ts +3 -0
- package/admin/features/ListWebhooks/feature.js +21 -0
- package/admin/features/ListWebhooks/feature.js.map +1 -0
- package/admin/features/ListWebhooks/index.d.ts +2 -0
- package/admin/features/ListWebhooks/index.js +2 -0
- package/admin/features/createWebhook/CreateWebhookGateway.d.ts +12 -0
- package/admin/features/createWebhook/CreateWebhookGateway.js +21 -0
- package/admin/features/createWebhook/CreateWebhookGateway.js.map +1 -0
- package/admin/features/createWebhook/CreateWebhookUseCase.d.ts +11 -0
- package/admin/features/createWebhook/CreateWebhookUseCase.js +18 -0
- package/admin/features/createWebhook/CreateWebhookUseCase.js.map +1 -0
- package/admin/features/createWebhook/abstractions.d.ts +23 -0
- package/admin/features/createWebhook/abstractions.js +6 -0
- package/admin/features/createWebhook/abstractions.js.map +1 -0
- package/admin/features/createWebhook/feature.d.ts +3 -0
- package/admin/features/createWebhook/feature.js +19 -0
- package/admin/features/createWebhook/feature.js.map +1 -0
- package/admin/features/createWebhook/index.d.ts +2 -0
- package/admin/features/createWebhook/index.js +2 -0
- package/admin/features/deleteWebhook/DeleteWebhookGateway.d.ts +11 -0
- package/admin/features/deleteWebhook/DeleteWebhookGateway.js +23 -0
- package/admin/features/deleteWebhook/DeleteWebhookGateway.js.map +1 -0
- package/admin/features/deleteWebhook/DeleteWebhookUseCase.d.ts +10 -0
- package/admin/features/deleteWebhook/DeleteWebhookUseCase.js +18 -0
- package/admin/features/deleteWebhook/DeleteWebhookUseCase.js.map +1 -0
- package/admin/features/deleteWebhook/abstractions.d.ts +14 -0
- package/admin/features/deleteWebhook/abstractions.js +6 -0
- package/admin/features/deleteWebhook/abstractions.js.map +1 -0
- package/admin/features/deleteWebhook/feature.d.ts +3 -0
- package/admin/features/deleteWebhook/feature.js +19 -0
- package/admin/features/deleteWebhook/feature.js.map +1 -0
- package/admin/features/deleteWebhook/index.d.ts +2 -0
- package/admin/features/deleteWebhook/index.js +2 -0
- package/admin/features/getWebhook/GetWebhookGateway.d.ts +12 -0
- package/admin/features/getWebhook/GetWebhookGateway.js +23 -0
- package/admin/features/getWebhook/GetWebhookGateway.js.map +1 -0
- package/admin/features/getWebhook/GetWebhookUseCase.d.ts +11 -0
- package/admin/features/getWebhook/GetWebhookUseCase.js +18 -0
- package/admin/features/getWebhook/GetWebhookUseCase.js.map +1 -0
- package/admin/features/getWebhook/abstractions.d.ts +15 -0
- package/admin/features/getWebhook/abstractions.js +6 -0
- package/admin/features/getWebhook/abstractions.js.map +1 -0
- package/admin/features/getWebhook/feature.d.ts +3 -0
- package/admin/features/getWebhook/feature.js +19 -0
- package/admin/features/getWebhook/feature.js.map +1 -0
- package/admin/features/getWebhook/index.d.ts +2 -0
- package/admin/features/getWebhook/index.js +2 -0
- package/admin/features/getWebhookSettings/GetWebhookSettingsGateway.d.ts +12 -0
- package/admin/features/getWebhookSettings/GetWebhookSettingsGateway.js +41 -0
- package/admin/features/getWebhookSettings/GetWebhookSettingsGateway.js.map +1 -0
- package/admin/features/getWebhookSettings/GetWebhookSettingsUseCase.d.ts +11 -0
- package/admin/features/getWebhookSettings/GetWebhookSettingsUseCase.js +18 -0
- package/admin/features/getWebhookSettings/GetWebhookSettingsUseCase.js.map +1 -0
- package/admin/features/getWebhookSettings/abstractions.d.ts +15 -0
- package/admin/features/getWebhookSettings/abstractions.js +6 -0
- package/admin/features/getWebhookSettings/abstractions.js.map +1 -0
- package/admin/features/getWebhookSettings/feature.d.ts +3 -0
- package/admin/features/getWebhookSettings/feature.js +19 -0
- package/admin/features/getWebhookSettings/feature.js.map +1 -0
- package/admin/features/getWebhookSettings/index.d.ts +2 -0
- package/admin/features/getWebhookSettings/index.js +2 -0
- package/admin/features/listAvailableEvents/ListAvailableEventsGateway.d.ts +12 -0
- package/admin/features/listAvailableEvents/ListAvailableEventsGateway.js +21 -0
- package/admin/features/listAvailableEvents/ListAvailableEventsGateway.js.map +1 -0
- package/admin/features/listAvailableEvents/ListAvailableEventsUseCase.d.ts +11 -0
- package/admin/features/listAvailableEvents/ListAvailableEventsUseCase.js +18 -0
- package/admin/features/listAvailableEvents/ListAvailableEventsUseCase.js.map +1 -0
- package/admin/features/listAvailableEvents/abstractions.d.ts +15 -0
- package/admin/features/listAvailableEvents/abstractions.js +6 -0
- package/admin/features/listAvailableEvents/abstractions.js.map +1 -0
- package/admin/features/listAvailableEvents/feature.d.ts +3 -0
- package/admin/features/listAvailableEvents/feature.js +19 -0
- package/admin/features/listAvailableEvents/feature.js.map +1 -0
- package/admin/features/listAvailableEvents/index.d.ts +2 -0
- package/admin/features/listAvailableEvents/index.js +2 -0
- package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesGateway.d.ts +11 -0
- package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesGateway.js +28 -0
- package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesGateway.js.map +1 -0
- package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesUseCase.d.ts +10 -0
- package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesUseCase.js +18 -0
- package/admin/features/listWebhookDeliveries/ListWebhookDeliveriesUseCase.js.map +1 -0
- package/admin/features/listWebhookDeliveries/abstractions.d.ts +33 -0
- package/admin/features/listWebhookDeliveries/abstractions.js +6 -0
- package/admin/features/listWebhookDeliveries/abstractions.js.map +1 -0
- package/admin/features/listWebhookDeliveries/feature.d.ts +3 -0
- package/admin/features/listWebhookDeliveries/feature.js +19 -0
- package/admin/features/listWebhookDeliveries/feature.js.map +1 -0
- package/admin/features/listWebhookDeliveries/index.d.ts +2 -0
- package/admin/features/listWebhookDeliveries/index.js +2 -0
- package/admin/features/permissions/abstractions.d.ts +17 -0
- package/admin/features/permissions/abstractions.js +6 -0
- package/admin/features/permissions/abstractions.js.map +1 -0
- package/admin/features/permissions/feature.d.ts +14 -0
- package/admin/features/permissions/feature.js +7 -0
- package/admin/features/permissions/feature.js.map +1 -0
- package/admin/features/permissions/index.d.ts +2 -0
- package/admin/features/permissions/index.js +2 -0
- package/admin/features/resendWebhookDelivery/ResendWebhookDeliveryGateway.d.ts +11 -0
- package/admin/features/resendWebhookDelivery/ResendWebhookDeliveryGateway.js +23 -0
- package/admin/features/resendWebhookDelivery/ResendWebhookDeliveryGateway.js.map +1 -0
- package/admin/features/resendWebhookDelivery/ResendWebhookDeliveryUseCase.d.ts +10 -0
- package/admin/features/resendWebhookDelivery/ResendWebhookDeliveryUseCase.js +18 -0
- package/admin/features/resendWebhookDelivery/ResendWebhookDeliveryUseCase.js.map +1 -0
- package/admin/features/resendWebhookDelivery/abstractions.d.ts +14 -0
- package/admin/features/resendWebhookDelivery/abstractions.js +6 -0
- package/admin/features/resendWebhookDelivery/abstractions.js.map +1 -0
- package/admin/features/resendWebhookDelivery/feature.d.ts +3 -0
- package/admin/features/resendWebhookDelivery/feature.js +19 -0
- package/admin/features/resendWebhookDelivery/feature.js.map +1 -0
- package/admin/features/resendWebhookDelivery/index.d.ts +2 -0
- package/admin/features/resendWebhookDelivery/index.js +2 -0
- package/admin/features/triggerWebhook/TriggerWebhookGateway.d.ts +12 -0
- package/admin/features/triggerWebhook/TriggerWebhookGateway.js +24 -0
- package/admin/features/triggerWebhook/TriggerWebhookGateway.js.map +1 -0
- package/admin/features/triggerWebhook/TriggerWebhookUseCase.d.ts +11 -0
- package/admin/features/triggerWebhook/TriggerWebhookUseCase.js +18 -0
- package/admin/features/triggerWebhook/TriggerWebhookUseCase.js.map +1 -0
- package/admin/features/triggerWebhook/abstractions.d.ts +15 -0
- package/admin/features/triggerWebhook/abstractions.js +6 -0
- package/admin/features/triggerWebhook/abstractions.js.map +1 -0
- package/admin/features/triggerWebhook/feature.d.ts +3 -0
- package/admin/features/triggerWebhook/feature.js +19 -0
- package/admin/features/triggerWebhook/feature.js.map +1 -0
- package/admin/features/triggerWebhook/index.d.ts +2 -0
- package/admin/features/triggerWebhook/index.js +2 -0
- package/admin/features/updateWebhook/UpdateWebhookGateway.d.ts +12 -0
- package/admin/features/updateWebhook/UpdateWebhookGateway.js +24 -0
- package/admin/features/updateWebhook/UpdateWebhookGateway.js.map +1 -0
- package/admin/features/updateWebhook/UpdateWebhookUseCase.d.ts +11 -0
- package/admin/features/updateWebhook/UpdateWebhookUseCase.js +18 -0
- package/admin/features/updateWebhook/UpdateWebhookUseCase.js.map +1 -0
- package/admin/features/updateWebhook/abstractions.d.ts +23 -0
- package/admin/features/updateWebhook/abstractions.js +6 -0
- package/admin/features/updateWebhook/abstractions.js.map +1 -0
- package/admin/features/updateWebhook/feature.d.ts +3 -0
- package/admin/features/updateWebhook/feature.js +19 -0
- package/admin/features/updateWebhook/feature.js.map +1 -0
- package/admin/features/updateWebhook/index.d.ts +2 -0
- package/admin/features/updateWebhook/index.js +2 -0
- package/admin/features/updateWebhookSettings/UpdateWebhookSettingsGateway.d.ts +12 -0
- package/admin/features/updateWebhookSettings/UpdateWebhookSettingsGateway.js +44 -0
- package/admin/features/updateWebhookSettings/UpdateWebhookSettingsGateway.js.map +1 -0
- package/admin/features/updateWebhookSettings/UpdateWebhookSettingsUseCase.d.ts +11 -0
- package/admin/features/updateWebhookSettings/UpdateWebhookSettingsUseCase.js +18 -0
- package/admin/features/updateWebhookSettings/UpdateWebhookSettingsUseCase.js.map +1 -0
- package/admin/features/updateWebhookSettings/abstractions.d.ts +19 -0
- package/admin/features/updateWebhookSettings/abstractions.js +6 -0
- package/admin/features/updateWebhookSettings/abstractions.js.map +1 -0
- package/admin/features/updateWebhookSettings/feature.d.ts +3 -0
- package/admin/features/updateWebhookSettings/feature.js +19 -0
- package/admin/features/updateWebhookSettings/feature.js.map +1 -0
- package/admin/features/updateWebhookSettings/index.d.ts +2 -0
- package/admin/features/updateWebhookSettings/index.js +2 -0
- package/admin/index.d.ts +2 -0
- package/admin/index.js +2 -0
- package/admin/permissions.d.ts +12 -0
- package/admin/permissions.js +22 -0
- package/admin/permissions.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesDataSource.d.ts +15 -0
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesDataSource.js +66 -0
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesDataSource.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.d.ts +41 -0
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js +223 -0
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/abstractions.d.ts +42 -0
- package/admin/presentation/WebhookDeliveriesPage/abstractions.js +5 -0
- package/admin/presentation/WebhookDeliveriesPage/abstractions.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.d.ts +11 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.js +36 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.d.ts +9 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.js +43 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.d.ts +7 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.js +76 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.d.ts +9 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js +98 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.d.ts +9 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js +61 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.d.ts +2 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js +16 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.d.ts +2 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js +73 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.d.ts +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.js +13 -0
- package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/feature.d.ts +3 -0
- package/admin/presentation/WebhookDeliveriesPage/feature.js +17 -0
- package/admin/presentation/WebhookDeliveriesPage/feature.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/index.d.ts +5 -0
- package/admin/presentation/WebhookDeliveriesPage/index.js +1 -0
- package/admin/presentation/WebhookForm/WebhookFormPresenter.d.ts +39 -0
- package/admin/presentation/WebhookForm/WebhookFormPresenter.js +248 -0
- package/admin/presentation/WebhookForm/WebhookFormPresenter.js.map +1 -0
- package/admin/presentation/WebhookForm/abstractions.d.ts +24 -0
- package/admin/presentation/WebhookForm/abstractions.js +5 -0
- package/admin/presentation/WebhookForm/abstractions.js.map +1 -0
- package/admin/presentation/WebhookForm/components/SigningSecret.d.ts +9 -0
- package/admin/presentation/WebhookForm/components/SigningSecret.js +47 -0
- package/admin/presentation/WebhookForm/components/SigningSecret.js.map +1 -0
- package/admin/presentation/WebhookForm/components/WebhookFormView.d.ts +2 -0
- package/admin/presentation/WebhookForm/components/WebhookFormView.js +95 -0
- package/admin/presentation/WebhookForm/components/WebhookFormView.js.map +1 -0
- package/admin/presentation/WebhookForm/feature.d.ts +3 -0
- package/admin/presentation/WebhookForm/feature.js +17 -0
- package/admin/presentation/WebhookForm/feature.js.map +1 -0
- package/admin/presentation/WebhookForm/index.d.ts +2 -0
- package/admin/presentation/WebhookForm/index.js +2 -0
- package/admin/presentation/WebhookList/WebhookListDataSource.d.ts +14 -0
- package/admin/presentation/WebhookList/WebhookListDataSource.js +40 -0
- package/admin/presentation/WebhookList/WebhookListDataSource.js.map +1 -0
- package/admin/presentation/WebhookList/WebhookListPresenter.d.ts +46 -0
- package/admin/presentation/WebhookList/WebhookListPresenter.js +92 -0
- package/admin/presentation/WebhookList/WebhookListPresenter.js.map +1 -0
- package/admin/presentation/WebhookList/abstractions.d.ts +45 -0
- package/admin/presentation/WebhookList/abstractions.js +5 -0
- package/admin/presentation/WebhookList/abstractions.js.map +1 -0
- package/admin/presentation/WebhookList/components/CreateWebhookButton.d.ts +2 -0
- package/admin/presentation/WebhookList/components/CreateWebhookButton.js +22 -0
- package/admin/presentation/WebhookList/components/CreateWebhookButton.js.map +1 -0
- package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.d.ts +2 -0
- package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.js +16 -0
- package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.js.map +1 -0
- package/admin/presentation/WebhookList/components/WebhookListContent.d.ts +9 -0
- package/admin/presentation/WebhookList/components/WebhookListContent.js +170 -0
- package/admin/presentation/WebhookList/components/WebhookListContent.js.map +1 -0
- package/admin/presentation/WebhookList/components/WebhookListView.d.ts +2 -0
- package/admin/presentation/WebhookList/components/WebhookListView.js +49 -0
- package/admin/presentation/WebhookList/components/WebhookListView.js.map +1 -0
- package/admin/presentation/WebhookList/feature.d.ts +3 -0
- package/admin/presentation/WebhookList/feature.js +17 -0
- package/admin/presentation/WebhookList/feature.js.map +1 -0
- package/admin/presentation/WebhookList/index.d.ts +2 -0
- package/admin/presentation/WebhookList/index.js +2 -0
- package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.d.ts +21 -0
- package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.js +91 -0
- package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.js.map +1 -0
- package/admin/presentation/WebhookSettings/abstractions.d.ts +16 -0
- package/admin/presentation/WebhookSettings/abstractions.js +5 -0
- package/admin/presentation/WebhookSettings/abstractions.js.map +1 -0
- package/admin/presentation/WebhookSettings/components/WebhookSettingsView.d.ts +2 -0
- package/admin/presentation/WebhookSettings/components/WebhookSettingsView.js +56 -0
- package/admin/presentation/WebhookSettings/components/WebhookSettingsView.js.map +1 -0
- package/admin/presentation/WebhookSettings/feature.d.ts +3 -0
- package/admin/presentation/WebhookSettings/feature.js +17 -0
- package/admin/presentation/WebhookSettings/feature.js.map +1 -0
- package/admin/presentation/WebhookSettings/index.d.ts +2 -0
- package/admin/presentation/WebhookSettings/index.js +2 -0
- package/admin/presentation/security/HasPermission.d.ts +12 -0
- package/admin/presentation/security/HasPermission.js +6 -0
- package/admin/presentation/security/HasPermission.js.map +1 -0
- package/admin/presentation/security/usePermissions.d.ts +12 -0
- package/admin/presentation/security/usePermissions.js +6 -0
- package/admin/presentation/security/usePermissions.js.map +1 -0
- package/admin/routes.d.ts +11 -0
- package/admin/routes.js +28 -0
- package/admin/routes.js.map +1 -0
- package/admin/shared/types.d.ts +9 -0
- package/admin/shared/types.js +0 -0
- package/api/Extension.d.ts +1 -0
- package/api/Extension.js +1 -0
- package/api/WebhooksFeature.d.ts +4 -0
- package/api/WebhooksFeature.js +65 -0
- package/api/WebhooksFeature.js.map +1 -0
- package/api/domain/Webhook.d.ts +27 -0
- package/api/domain/Webhook.js +0 -0
- package/api/domain/WebhookDelivery.d.ts +35 -0
- package/api/domain/WebhookDelivery.js +0 -0
- package/api/domain/WebhookSettings.d.ts +4 -0
- package/api/domain/WebhookSettings.js +0 -0
- package/api/domain/constants.d.ts +5 -0
- package/api/domain/constants.js +8 -0
- package/api/domain/constants.js.map +1 -0
- package/api/domain/errors.d.ts +41 -0
- package/api/domain/errors.js +83 -0
- package/api/domain/errors.js.map +1 -0
- package/api/features/CreateWebhook/CreateWebhookRepository.d.ts +18 -0
- package/api/features/CreateWebhook/CreateWebhookRepository.js +43 -0
- package/api/features/CreateWebhook/CreateWebhookRepository.js.map +1 -0
- package/api/features/CreateWebhook/CreateWebhookUseCase.d.ts +16 -0
- package/api/features/CreateWebhook/CreateWebhookUseCase.js +48 -0
- package/api/features/CreateWebhook/CreateWebhookUseCase.js.map +1 -0
- package/api/features/CreateWebhook/abstractions.d.ts +33 -0
- package/api/features/CreateWebhook/abstractions.js +6 -0
- package/api/features/CreateWebhook/abstractions.js.map +1 -0
- package/api/features/CreateWebhook/feature.d.ts +4 -0
- package/api/features/CreateWebhook/feature.js +13 -0
- package/api/features/CreateWebhook/feature.js.map +1 -0
- package/api/features/CreateWebhook/schema.d.ts +10 -0
- package/api/features/CreateWebhook/schema.js +16 -0
- package/api/features/CreateWebhook/schema.js.map +1 -0
- package/api/features/CreateWebhookDelivery/CreateWebhookDeliveryRepository.d.ts +20 -0
- package/api/features/CreateWebhookDelivery/CreateWebhookDeliveryRepository.js +60 -0
- package/api/features/CreateWebhookDelivery/CreateWebhookDeliveryRepository.js.map +1 -0
- package/api/features/CreateWebhookDelivery/abstractions.d.ts +21 -0
- package/api/features/CreateWebhookDelivery/abstractions.js +5 -0
- package/api/features/CreateWebhookDelivery/abstractions.js.map +1 -0
- package/api/features/CreateWebhookDelivery/feature.d.ts +4 -0
- package/api/features/CreateWebhookDelivery/feature.js +11 -0
- package/api/features/CreateWebhookDelivery/feature.js.map +1 -0
- package/api/features/DeleteWebhook/DeleteWebhookRepository.d.ts +19 -0
- package/api/features/DeleteWebhook/DeleteWebhookRepository.js +67 -0
- package/api/features/DeleteWebhook/DeleteWebhookRepository.js.map +1 -0
- package/api/features/DeleteWebhook/DeleteWebhookUseCase.d.ts +15 -0
- package/api/features/DeleteWebhook/DeleteWebhookUseCase.js +34 -0
- package/api/features/DeleteWebhook/DeleteWebhookUseCase.js.map +1 -0
- package/api/features/DeleteWebhook/abstractions.d.ts +20 -0
- package/api/features/DeleteWebhook/abstractions.js +6 -0
- package/api/features/DeleteWebhook/abstractions.js.map +1 -0
- package/api/features/DeleteWebhook/feature.d.ts +4 -0
- package/api/features/DeleteWebhook/feature.js +13 -0
- package/api/features/DeleteWebhook/feature.js.map +1 -0
- package/api/features/DeleteWebhook/schema.d.ts +4 -0
- package/api/features/DeleteWebhook/schema.js +7 -0
- package/api/features/DeleteWebhook/schema.js.map +1 -0
- package/api/features/GetWebhook/GetWebhookRepository.d.ts +17 -0
- package/api/features/GetWebhook/GetWebhookRepository.js +39 -0
- package/api/features/GetWebhook/GetWebhookRepository.js.map +1 -0
- package/api/features/GetWebhook/GetWebhookUseCase.d.ts +14 -0
- package/api/features/GetWebhook/GetWebhookUseCase.js +29 -0
- package/api/features/GetWebhook/GetWebhookUseCase.js.map +1 -0
- package/api/features/GetWebhook/abstractions.d.ts +21 -0
- package/api/features/GetWebhook/abstractions.js +6 -0
- package/api/features/GetWebhook/abstractions.js.map +1 -0
- package/api/features/GetWebhook/feature.d.ts +4 -0
- package/api/features/GetWebhook/feature.js +13 -0
- package/api/features/GetWebhook/feature.js.map +1 -0
- package/api/features/GetWebhook/schema.d.ts +4 -0
- package/api/features/GetWebhook/schema.js +7 -0
- package/api/features/GetWebhook/schema.js.map +1 -0
- package/api/features/GetWebhookDelivery/GetWebhookDeliveryRepository.d.ts +17 -0
- package/api/features/GetWebhookDelivery/GetWebhookDeliveryRepository.js +39 -0
- package/api/features/GetWebhookDelivery/GetWebhookDeliveryRepository.js.map +1 -0
- package/api/features/GetWebhookDelivery/GetWebhookDeliveryUseCase.d.ts +14 -0
- package/api/features/GetWebhookDelivery/GetWebhookDeliveryUseCase.js +29 -0
- package/api/features/GetWebhookDelivery/GetWebhookDeliveryUseCase.js.map +1 -0
- package/api/features/GetWebhookDelivery/abstractions.d.ts +21 -0
- package/api/features/GetWebhookDelivery/abstractions.js +6 -0
- package/api/features/GetWebhookDelivery/abstractions.js.map +1 -0
- package/api/features/GetWebhookDelivery/feature.d.ts +4 -0
- package/api/features/GetWebhookDelivery/feature.js +13 -0
- package/api/features/GetWebhookDelivery/feature.js.map +1 -0
- package/api/features/GetWebhookDelivery/schema.d.ts +4 -0
- package/api/features/GetWebhookDelivery/schema.js +7 -0
- package/api/features/GetWebhookDelivery/schema.js.map +1 -0
- package/api/features/GetWebhookSettings/GetWebhookSettingsRepository.d.ts +19 -0
- package/api/features/GetWebhookSettings/GetWebhookSettingsRepository.js +57 -0
- package/api/features/GetWebhookSettings/GetWebhookSettingsRepository.js.map +1 -0
- package/api/features/GetWebhookSettings/abstractions.d.ts +13 -0
- package/api/features/GetWebhookSettings/abstractions.js +5 -0
- package/api/features/GetWebhookSettings/abstractions.js.map +1 -0
- package/api/features/GetWebhookSettings/feature.d.ts +4 -0
- package/api/features/GetWebhookSettings/feature.js +11 -0
- package/api/features/GetWebhookSettings/feature.js.map +1 -0
- package/api/features/ListAvailableWebhookEvents/ListAvailableWebhookEventsUseCase.d.ts +14 -0
- package/api/features/ListAvailableWebhookEvents/ListAvailableWebhookEventsUseCase.js +30 -0
- package/api/features/ListAvailableWebhookEvents/ListAvailableWebhookEventsUseCase.js.map +1 -0
- package/api/features/ListAvailableWebhookEvents/abstractions.d.ts +9 -0
- package/api/features/ListAvailableWebhookEvents/abstractions.js +5 -0
- package/api/features/ListAvailableWebhookEvents/abstractions.js.map +1 -0
- package/api/features/ListAvailableWebhookEvents/feature.d.ts +4 -0
- package/api/features/ListAvailableWebhookEvents/feature.js +11 -0
- package/api/features/ListAvailableWebhookEvents/feature.js.map +1 -0
- package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.d.ts +21 -0
- package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js +66 -0
- package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js.map +1 -0
- package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesUseCase.d.ts +14 -0
- package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesUseCase.js +27 -0
- package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesUseCase.js.map +1 -0
- package/api/features/ListWebhookDeliveries/abstractions.d.ts +40 -0
- package/api/features/ListWebhookDeliveries/abstractions.js +6 -0
- package/api/features/ListWebhookDeliveries/abstractions.js.map +1 -0
- package/api/features/ListWebhookDeliveries/feature.d.ts +4 -0
- package/api/features/ListWebhookDeliveries/feature.js +13 -0
- package/api/features/ListWebhookDeliveries/feature.js.map +1 -0
- package/api/features/ListWebhookDeliveries/schema.d.ts +7 -0
- package/api/features/ListWebhookDeliveries/schema.js +10 -0
- package/api/features/ListWebhookDeliveries/schema.js.map +1 -0
- package/api/features/ListWebhooks/ListWebhooksRepository.d.ts +21 -0
- package/api/features/ListWebhooks/ListWebhooksRepository.js +66 -0
- package/api/features/ListWebhooks/ListWebhooksRepository.js.map +1 -0
- package/api/features/ListWebhooks/ListWebhooksUseCase.d.ts +14 -0
- package/api/features/ListWebhooks/ListWebhooksUseCase.js +27 -0
- package/api/features/ListWebhooks/ListWebhooksUseCase.js.map +1 -0
- package/api/features/ListWebhooks/abstractions.d.ts +41 -0
- package/api/features/ListWebhooks/abstractions.js +6 -0
- package/api/features/ListWebhooks/abstractions.js.map +1 -0
- package/api/features/ListWebhooks/feature.d.ts +4 -0
- package/api/features/ListWebhooks/feature.js +13 -0
- package/api/features/ListWebhooks/feature.js.map +1 -0
- package/api/features/ListWebhooks/schema.d.ts +7 -0
- package/api/features/ListWebhooks/schema.js +10 -0
- package/api/features/ListWebhooks/schema.js.map +1 -0
- package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.d.ts +22 -0
- package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.js +70 -0
- package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.js.map +1 -0
- package/api/features/ResendWebhookDelivery/abstractions.d.ts +12 -0
- package/api/features/ResendWebhookDelivery/abstractions.js +5 -0
- package/api/features/ResendWebhookDelivery/abstractions.js.map +1 -0
- package/api/features/ResendWebhookDelivery/feature.d.ts +4 -0
- package/api/features/ResendWebhookDelivery/feature.js +11 -0
- package/api/features/ResendWebhookDelivery/feature.js.map +1 -0
- package/api/features/ResendWebhookDelivery/schema.d.ts +4 -0
- package/api/features/ResendWebhookDelivery/schema.js +7 -0
- package/api/features/ResendWebhookDelivery/schema.js.map +1 -0
- package/api/features/SendWebhookTask/SendWebhookTask.d.ts +38 -0
- package/api/features/SendWebhookTask/SendWebhookTask.js +120 -0
- package/api/features/SendWebhookTask/SendWebhookTask.js.map +1 -0
- package/api/features/SendWebhookTask/feature.d.ts +4 -0
- package/api/features/SendWebhookTask/feature.js +11 -0
- package/api/features/SendWebhookTask/feature.js.map +1 -0
- package/api/features/SendWebhookTask/types.d.ts +16 -0
- package/api/features/SendWebhookTask/types.js +0 -0
- package/api/features/Transformers/WebhookDeliveryTransformer.d.ts +13 -0
- package/api/features/Transformers/WebhookDeliveryTransformer.js +57 -0
- package/api/features/Transformers/WebhookDeliveryTransformer.js.map +1 -0
- package/api/features/Transformers/WebhookTransformer.d.ts +11 -0
- package/api/features/Transformers/WebhookTransformer.js +35 -0
- package/api/features/Transformers/WebhookTransformer.js.map +1 -0
- package/api/features/Transformers/abstractions/WebhookDeliveryTransformer.d.ts +10 -0
- package/api/features/Transformers/abstractions/WebhookDeliveryTransformer.js +5 -0
- package/api/features/Transformers/abstractions/WebhookDeliveryTransformer.js.map +1 -0
- package/api/features/Transformers/abstractions/WebhookTransformer.d.ts +10 -0
- package/api/features/Transformers/abstractions/WebhookTransformer.js +5 -0
- package/api/features/Transformers/abstractions/WebhookTransformer.js.map +1 -0
- package/api/features/Transformers/feature.d.ts +4 -0
- package/api/features/Transformers/feature.js +13 -0
- package/api/features/Transformers/feature.js.map +1 -0
- package/api/features/Transformers/index.d.ts +2 -0
- package/api/features/Transformers/index.js +2 -0
- package/api/features/TriggerWebhook/TriggerWebhookUseCase.d.ts +21 -0
- package/api/features/TriggerWebhook/TriggerWebhookUseCase.js +65 -0
- package/api/features/TriggerWebhook/TriggerWebhookUseCase.js.map +1 -0
- package/api/features/TriggerWebhook/abstractions.d.ts +13 -0
- package/api/features/TriggerWebhook/abstractions.js +5 -0
- package/api/features/TriggerWebhook/abstractions.js.map +1 -0
- package/api/features/TriggerWebhook/feature.d.ts +4 -0
- package/api/features/TriggerWebhook/feature.js +11 -0
- package/api/features/TriggerWebhook/feature.js.map +1 -0
- package/api/features/TriggerWebhook/schema.d.ts +5 -0
- package/api/features/TriggerWebhook/schema.js +8 -0
- package/api/features/TriggerWebhook/schema.js.map +1 -0
- package/api/features/UpdateWebhook/UpdateWebhookRepository.d.ts +21 -0
- package/api/features/UpdateWebhook/UpdateWebhookRepository.js +52 -0
- package/api/features/UpdateWebhook/UpdateWebhookRepository.js.map +1 -0
- package/api/features/UpdateWebhook/UpdateWebhookUseCase.d.ts +16 -0
- package/api/features/UpdateWebhook/UpdateWebhookUseCase.js +42 -0
- package/api/features/UpdateWebhook/UpdateWebhookUseCase.js.map +1 -0
- package/api/features/UpdateWebhook/abstractions.d.ts +30 -0
- package/api/features/UpdateWebhook/abstractions.js +6 -0
- package/api/features/UpdateWebhook/abstractions.js.map +1 -0
- package/api/features/UpdateWebhook/feature.d.ts +4 -0
- package/api/features/UpdateWebhook/feature.js +13 -0
- package/api/features/UpdateWebhook/feature.js.map +1 -0
- package/api/features/UpdateWebhook/schema.d.ts +9 -0
- package/api/features/UpdateWebhook/schema.js +15 -0
- package/api/features/UpdateWebhook/schema.js.map +1 -0
- package/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.d.ts +22 -0
- package/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.js +64 -0
- package/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.js.map +1 -0
- package/api/features/UpdateWebhookDelivery/abstractions.d.ts +23 -0
- package/api/features/UpdateWebhookDelivery/abstractions.js +5 -0
- package/api/features/UpdateWebhookDelivery/abstractions.js.map +1 -0
- package/api/features/UpdateWebhookDelivery/feature.d.ts +4 -0
- package/api/features/UpdateWebhookDelivery/feature.js +11 -0
- package/api/features/UpdateWebhookDelivery/feature.js.map +1 -0
- package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.d.ts +21 -0
- package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js +64 -0
- package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js.map +1 -0
- package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsUseCase.d.ts +14 -0
- package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsUseCase.js +27 -0
- package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsUseCase.js.map +1 -0
- package/api/features/UpdateWebhookSettings/abstractions.d.ts +27 -0
- package/api/features/UpdateWebhookSettings/abstractions.js +6 -0
- package/api/features/UpdateWebhookSettings/abstractions.js.map +1 -0
- package/api/features/UpdateWebhookSettings/feature.d.ts +4 -0
- package/api/features/UpdateWebhookSettings/feature.js +13 -0
- package/api/features/UpdateWebhookSettings/feature.js.map +1 -0
- package/api/features/UpdateWebhookSettings/schema.d.ts +5 -0
- package/api/features/UpdateWebhookSettings/schema.js +9 -0
- package/api/features/UpdateWebhookSettings/schema.js.map +1 -0
- package/api/features/WebhookDeliver/WebhookDeliver.d.ts +13 -0
- package/api/features/WebhookDeliver/WebhookDeliver.js +79 -0
- package/api/features/WebhookDeliver/WebhookDeliver.js.map +1 -0
- package/api/features/WebhookDeliver/abstractions.d.ts +24 -0
- package/api/features/WebhookDeliver/abstractions.js +5 -0
- package/api/features/WebhookDeliver/abstractions.js.map +1 -0
- package/api/features/WebhookDeliver/feature.d.ts +4 -0
- package/api/features/WebhookDeliver/feature.js +11 -0
- package/api/features/WebhookDeliver/feature.js.map +1 -0
- package/api/features/WebhookDeliver/index.d.ts +2 -0
- package/api/features/WebhookDeliver/index.js +2 -0
- package/api/features/WebhookDispatcher/WebhookDispatcher.d.ts +19 -0
- package/api/features/WebhookDispatcher/WebhookDispatcher.js +61 -0
- package/api/features/WebhookDispatcher/WebhookDispatcher.js.map +1 -0
- package/api/features/WebhookDispatcher/feature.d.ts +4 -0
- package/api/features/WebhookDispatcher/feature.js +11 -0
- package/api/features/WebhookDispatcher/feature.js.map +1 -0
- package/api/features/WebhookPermissions/abstractions.d.ts +17 -0
- package/api/features/WebhookPermissions/abstractions.js +6 -0
- package/api/features/WebhookPermissions/abstractions.js.map +1 -0
- package/api/features/WebhookPermissions/feature.d.ts +4 -0
- package/api/features/WebhookPermissions/feature.js +7 -0
- package/api/features/WebhookPermissions/feature.js.map +1 -0
- package/api/features/WebhookSignPayload/WebhookSignPayload.d.ts +9 -0
- package/api/features/WebhookSignPayload/WebhookSignPayload.js +26 -0
- package/api/features/WebhookSignPayload/WebhookSignPayload.js.map +1 -0
- package/api/features/WebhookSignPayload/feature.d.ts +4 -0
- package/api/features/WebhookSignPayload/feature.js +11 -0
- package/api/features/WebhookSignPayload/feature.js.map +1 -0
- package/api/features/WebhookVerifyPayload/WebhookVerifyPayload.d.ts +10 -0
- package/api/features/WebhookVerifyPayload/WebhookVerifyPayload.js +22 -0
- package/api/features/WebhookVerifyPayload/WebhookVerifyPayload.js.map +1 -0
- package/api/features/WebhookVerifyPayload/feature.d.ts +4 -0
- package/api/features/WebhookVerifyPayload/feature.js +11 -0
- package/api/features/WebhookVerifyPayload/feature.js.map +1 -0
- package/api/graphql/WebhookCrudSchema.d.ts +9 -0
- package/api/graphql/WebhookCrudSchema.js +181 -0
- package/api/graphql/WebhookCrudSchema.js.map +1 -0
- package/api/graphql/WebhookDeliverySchema.d.ts +9 -0
- package/api/graphql/WebhookDeliverySchema.js +104 -0
- package/api/graphql/WebhookDeliverySchema.js.map +1 -0
- package/api/graphql/WebhookEventSchema.d.ts +9 -0
- package/api/graphql/WebhookEventSchema.js +49 -0
- package/api/graphql/WebhookEventSchema.js.map +1 -0
- package/api/graphql/WebhookSettingsSchema.d.ts +9 -0
- package/api/graphql/WebhookSettingsSchema.js +66 -0
- package/api/graphql/WebhookSettingsSchema.js.map +1 -0
- package/api/graphql/WebhookTriggerSchema.d.ts +9 -0
- package/api/graphql/WebhookTriggerSchema.js +40 -0
- package/api/graphql/WebhookTriggerSchema.js.map +1 -0
- package/api/index.d.ts +4 -0
- package/api/index.js +12 -0
- package/api/index.js.map +1 -0
- package/api/models/WebhookDeliveryModel.d.ts +8 -0
- package/api/models/WebhookDeliveryModel.js +36 -0
- package/api/models/WebhookDeliveryModel.js.map +1 -0
- package/api/models/WebhookModel.d.ts +8 -0
- package/api/models/WebhookModel.js +33 -0
- package/api/models/WebhookModel.js.map +1 -0
- package/api/models/WebhookSettingsModel.d.ts +8 -0
- package/api/models/WebhookSettingsModel.js +28 -0
- package/api/models/WebhookSettingsModel.js.map +1 -0
- package/api/permissions.d.ts +12 -0
- package/api/permissions.js +22 -0
- package/api/permissions.js.map +1 -0
- package/api/utils/isValidEndpointUrl.d.ts +1 -0
- package/api/utils/isValidEndpointUrl.js +13 -0
- package/api/utils/isValidEndpointUrl.js.map +1 -0
- package/exports/api/webhooks.d.ts +5 -0
- package/exports/api/webhooks.js +1 -0
- 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,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,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 @@
|
|
|
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,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 @@
|
|
|
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"}
|