@webiny/webhooks 0.0.0-unstable.7be00a75a9
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 +68 -0
- package/admin/WebhookRoutes.js.map +1 -0
- package/admin/Webhooks.d.ts +2 -0
- package/admin/Webhooks.js +64 -0
- package/admin/Webhooks.js.map +1 -0
- package/admin/features/ListWebhooks/ListWebhooksGateway.d.ts +11 -0
- package/admin/features/ListWebhooks/ListWebhooksGateway.js +62 -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 +36 -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/WebhookDeliveries/WebhookDeliveriesDataSource.d.ts +16 -0
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesDataSource.js +68 -0
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesDataSource.js.map +1 -0
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.d.ts +21 -0
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.js +57 -0
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.js.map +1 -0
- package/admin/presentation/WebhookDeliveries/abstractions.d.ts +18 -0
- package/admin/presentation/WebhookDeliveries/abstractions.js +5 -0
- package/admin/presentation/WebhookDeliveries/abstractions.js.map +1 -0
- package/admin/presentation/WebhookDeliveries/components/DeliveryAccordionRow.d.ts +11 -0
- package/admin/presentation/WebhookDeliveries/components/DeliveryAccordionRow.js +36 -0
- package/admin/presentation/WebhookDeliveries/components/DeliveryAccordionRow.js.map +1 -0
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.d.ts +11 -0
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.js +32 -0
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.js.map +1 -0
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailContent.d.ts +7 -0
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailContent.js +76 -0
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailContent.js.map +1 -0
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailPanel.d.ts +9 -0
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailPanel.js +22 -0
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailPanel.js.map +1 -0
- package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.d.ts +8 -0
- package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.js +119 -0
- package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.js.map +1 -0
- package/admin/presentation/WebhookDeliveries/components/statusVariant.d.ts +1 -0
- package/admin/presentation/WebhookDeliveries/components/statusVariant.js +13 -0
- package/admin/presentation/WebhookDeliveries/components/statusVariant.js.map +1 -0
- package/admin/presentation/WebhookDeliveries/feature.d.ts +3 -0
- package/admin/presentation/WebhookDeliveries/feature.js +17 -0
- package/admin/presentation/WebhookDeliveries/feature.js.map +1 -0
- package/admin/presentation/WebhookDeliveries/index.d.ts +2 -0
- package/admin/presentation/WebhookDeliveries/index.js +2 -0
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.d.ts +37 -0
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js +196 -0
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/abstractions.d.ts +39 -0
- package/admin/presentation/WebhookDeliveriesPage/abstractions.js +5 -0
- package/admin/presentation/WebhookDeliveriesPage/abstractions.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/DeliveryFilters.d.ts +9 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js +66 -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 +45 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.d.ts +2 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js +64 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.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 +42 -0
- package/admin/presentation/WebhookForm/WebhookFormPresenter.js +252 -0
- package/admin/presentation/WebhookForm/WebhookFormPresenter.js.map +1 -0
- package/admin/presentation/WebhookForm/abstractions.d.ts +27 -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 +97 -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 +15 -0
- package/admin/presentation/WebhookList/WebhookListDataSource.js +67 -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/WebhookListContent.d.ts +9 -0
- package/admin/presentation/WebhookList/components/WebhookListContent.js +158 -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 +46 -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 +89 -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 +9 -0
- package/admin/routes.js +25 -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 +66 -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 +63 -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 +63 -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 +33 -0
- package/api/features/SendWebhookTask/SendWebhookTask.js +111 -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 +50 -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 +62 -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 +62 -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 +8 -0
- package/api/graphql/WebhookCrudSchema.js +166 -0
- package/api/graphql/WebhookCrudSchema.js.map +1 -0
- package/api/graphql/WebhookDeliverySchema.d.ts +8 -0
- package/api/graphql/WebhookDeliverySchema.js +100 -0
- package/api/graphql/WebhookDeliverySchema.js.map +1 -0
- package/api/graphql/WebhookEventSchema.d.ts +8 -0
- package/api/graphql/WebhookEventSchema.js +45 -0
- package/api/graphql/WebhookEventSchema.js.map +1 -0
- package/api/graphql/WebhookSettingsSchema.d.ts +8 -0
- package/api/graphql/WebhookSettingsSchema.js +62 -0
- package/api/graphql/WebhookSettingsSchema.js.map +1 -0
- package/api/graphql/WebhookTriggerSchema.d.ts +8 -0
- package/api/graphql/WebhookTriggerSchema.js +36 -0
- package/api/graphql/WebhookTriggerSchema.js.map +1 -0
- package/api/index.d.ts +1 -0
- package/api/index.js +8 -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 +58 -0
|
@@ -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 @@
|
|
|
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,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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { ListAvailableWebhookEventsUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
3
|
+
import { WebhookPermissions } from "../../../api/features/WebhookPermissions/abstractions.js";
|
|
4
|
+
import { WebhookProvider } from "@webiny/api-core/features/webhooks/index.js";
|
|
5
|
+
declare class ListAvailableWebhookEventsUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
6
|
+
private readonly provider;
|
|
7
|
+
private readonly permissions;
|
|
8
|
+
constructor(provider: WebhookProvider.Interface, permissions: WebhookPermissions.Interface);
|
|
9
|
+
execute(): Promise<Result<WebhookProvider.Response, Error>>;
|
|
10
|
+
}
|
|
11
|
+
export declare const ListAvailableWebhookEventsUseCase: typeof ListAvailableWebhookEventsUseCaseImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListAvailableWebhookEventsUseCase>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { ListAvailableWebhookEventsUseCase } from "./abstractions.js";
|
|
3
|
+
import { WebhookPermissions } from "../WebhookPermissions/abstractions.js";
|
|
4
|
+
import { WebhookNotAuthorizedError } from "../../domain/errors.js";
|
|
5
|
+
import { WebhookProvider } from "@webiny/api-core/features/webhooks/index.js";
|
|
6
|
+
class ListAvailableWebhookEventsUseCaseImpl {
|
|
7
|
+
constructor(provider, permissions){
|
|
8
|
+
this.provider = provider;
|
|
9
|
+
this.permissions = permissions;
|
|
10
|
+
}
|
|
11
|
+
async execute() {
|
|
12
|
+
if (!await this.permissions.canRead("webhook")) return Result.fail(new WebhookNotAuthorizedError());
|
|
13
|
+
try {
|
|
14
|
+
const events = await this.provider.execute();
|
|
15
|
+
return Result.ok(events);
|
|
16
|
+
} catch (ex) {
|
|
17
|
+
return Result.fail(ex);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const ListAvailableWebhookEventsUseCase_ListAvailableWebhookEventsUseCase = ListAvailableWebhookEventsUseCase.createImplementation({
|
|
22
|
+
implementation: ListAvailableWebhookEventsUseCaseImpl,
|
|
23
|
+
dependencies: [
|
|
24
|
+
WebhookProvider,
|
|
25
|
+
WebhookPermissions
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
export { ListAvailableWebhookEventsUseCase_ListAvailableWebhookEventsUseCase as ListAvailableWebhookEventsUseCase };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=ListAvailableWebhookEventsUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/ListAvailableWebhookEvents/ListAvailableWebhookEventsUseCase.js","sources":["../../../../src/api/features/ListAvailableWebhookEvents/ListAvailableWebhookEventsUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { ListAvailableWebhookEventsUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { WebhookPermissions } from \"~/api/features/WebhookPermissions/abstractions.js\";\nimport { WebhookNotAuthorizedError } from \"~/api/domain/errors.js\";\nimport { WebhookProvider } from \"@webiny/api-core/features/webhooks/index.js\";\n\nclass ListAvailableWebhookEventsUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private readonly provider: WebhookProvider.Interface,\n private readonly permissions: WebhookPermissions.Interface\n ) {}\n\n public async execute(): Promise<Result<WebhookProvider.Response, Error>> {\n if (!(await this.permissions.canRead(\"webhook\"))) {\n return Result.fail(new WebhookNotAuthorizedError());\n }\n\n try {\n const events = await this.provider.execute();\n return Result.ok(events);\n } catch (ex) {\n return Result.fail(ex);\n }\n }\n}\n\nexport const ListAvailableWebhookEventsUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListAvailableWebhookEventsUseCaseImpl,\n dependencies: [WebhookProvider, WebhookPermissions]\n});\n"],"names":["ListAvailableWebhookEventsUseCaseImpl","provider","permissions","Result","WebhookNotAuthorizedError","events","ex","ListAvailableWebhookEventsUseCase","UseCaseAbstraction","WebhookProvider","WebhookPermissions"],"mappings":";;;;;AAMA,MAAMA;IACF,YACqBC,QAAmC,EACnCC,WAAyC,CAC5D;aAFmBD,QAAQ,GAARA;aACAC,WAAW,GAAXA;IAClB;IAEH,MAAa,UAA4D;QACrE,IAAI,CAAE,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,YACjC,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAG3B,IAAI;YACA,MAAMC,SAAS,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO;YAC1C,OAAOF,OAAO,EAAE,CAACE;QACrB,EAAE,OAAOC,IAAI;YACT,OAAOH,OAAO,IAAI,CAACG;QACvB;IACJ;AACJ;AAEO,MAAMC,sEAAoCC,kCAAAA,oBAAuC,CAAC;IACrF,gBAAgBR;IAChB,cAAc;QAACS;QAAiBC;KAAmB;AACvD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Result } from "@webiny/feature/api";
|
|
2
|
+
import type { IWebhookFactoryDefinition } from "@webiny/api-core/features/webhooks/Webhook/abstractions/WebhookFactory.js";
|
|
3
|
+
export interface IListAvailableWebhookEventsUseCase {
|
|
4
|
+
execute(): Promise<Result<IWebhookFactoryDefinition[], Error>>;
|
|
5
|
+
}
|
|
6
|
+
export declare const ListAvailableWebhookEventsUseCase: import("@webiny/di").Abstraction<IListAvailableWebhookEventsUseCase>;
|
|
7
|
+
export declare namespace ListAvailableWebhookEventsUseCase {
|
|
8
|
+
type Interface = IListAvailableWebhookEventsUseCase;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/ListAvailableWebhookEvents/abstractions.js","sources":["../../../../src/api/features/ListAvailableWebhookEvents/abstractions.ts"],"sourcesContent":["import { createAbstraction, type Result } from \"@webiny/feature/api\";\nimport type { IWebhookFactoryDefinition } from \"@webiny/api-core/features/webhooks/Webhook/abstractions/WebhookFactory.js\";\n\nexport interface IListAvailableWebhookEventsUseCase {\n execute(): Promise<Result<IWebhookFactoryDefinition[], Error>>;\n}\n\nexport const ListAvailableWebhookEventsUseCase =\n createAbstraction<IListAvailableWebhookEventsUseCase>(\n \"Webhooks/ListAvailableWebhookEventsUseCase\"\n );\n\nexport namespace ListAvailableWebhookEventsUseCase {\n export type Interface = IListAvailableWebhookEventsUseCase;\n}\n"],"names":["ListAvailableWebhookEventsUseCase","createAbstraction"],"mappings":";AAOO,MAAMA,oCACTC,kBACI"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { ListAvailableWebhookEventsUseCase } from "./ListAvailableWebhookEventsUseCase.js";
|
|
3
|
+
const ListAvailableWebhookEventsFeature = createFeature({
|
|
4
|
+
name: "ListAvailableWebhookEvents",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(ListAvailableWebhookEventsUseCase);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { ListAvailableWebhookEventsFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/ListAvailableWebhookEvents/feature.js","sources":["../../../../src/api/features/ListAvailableWebhookEvents/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListAvailableWebhookEventsUseCase } from \"./ListAvailableWebhookEventsUseCase.js\";\n\nexport const ListAvailableWebhookEventsFeature = createFeature({\n name: \"ListAvailableWebhookEvents\",\n register(container) {\n container.register(ListAvailableWebhookEventsUseCase);\n }\n});\n"],"names":["ListAvailableWebhookEventsFeature","createFeature","container","ListAvailableWebhookEventsUseCase"],"mappings":";;AAGO,MAAMA,oCAAoCC,cAAc;IAC3D,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -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 { WebhookDeliveryTransformer } from "../../../api/features/Transformers/abstractions/WebhookDeliveryTransformer.js";
|
|
5
|
+
import { ListWebhookDeliveriesRepository as RepositoryAbstraction, type IListWebhookDeliveriesOutput } from "./abstractions.js";
|
|
6
|
+
import type { IListWebhookDeliveriesInput } 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 ListWebhookDeliveriesRepositoryImpl implements RepositoryAbstraction.Interface {
|
|
10
|
+
private readonly getModelRepository;
|
|
11
|
+
private readonly listEntriesRepository;
|
|
12
|
+
private readonly transformer;
|
|
13
|
+
private readonly whereMapper;
|
|
14
|
+
private readonly sortMapper;
|
|
15
|
+
constructor(getModelRepository: GetModelRepository.Interface, listEntriesRepository: ListEntriesRepository.Interface, transformer: WebhookDeliveryTransformer.Interface, whereMapper: CmsWhereMapper.Interface, sortMapper: CmsSortMapper.Interface);
|
|
16
|
+
execute(params: IListWebhookDeliveriesInput): Promise<Result<IListWebhookDeliveriesOutput, RepositoryAbstraction.Error>>;
|
|
17
|
+
}
|
|
18
|
+
export declare const ListWebhookDeliveriesRepository: typeof ListWebhookDeliveriesRepositoryImpl & {
|
|
19
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListWebhookDeliveriesRepository>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
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 { WebhookDeliveryTransformer } from "../Transformers/abstractions/WebhookDeliveryTransformer.js";
|
|
5
|
+
import { ListWebhookDeliveriesRepository } from "./abstractions.js";
|
|
6
|
+
import { WebhookModelNotFoundError, WebhookPersistenceError } from "../../domain/errors.js";
|
|
7
|
+
import { WEBHOOK_DELIVERY_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 ListWebhookDeliveriesRepositoryImpl {
|
|
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_DELIVERY_MODEL_ID);
|
|
21
|
+
if (modelResult.isFail()) return Result.fail(new WebhookModelNotFoundError(WEBHOOK_DELIVERY_MODEL_ID));
|
|
22
|
+
const model = modelResult.value;
|
|
23
|
+
const listResult = await this.listEntriesRepository.execute(model, {
|
|
24
|
+
where: this.whereMapper.map({
|
|
25
|
+
fields: model.fields,
|
|
26
|
+
input: params.where
|
|
27
|
+
}),
|
|
28
|
+
sort: this.sortMapper.map({
|
|
29
|
+
fields: model.fields,
|
|
30
|
+
input: params.sort
|
|
31
|
+
}),
|
|
32
|
+
limit: params.limit ?? 100,
|
|
33
|
+
after: params.after
|
|
34
|
+
});
|
|
35
|
+
if (listResult.isFail()) return Result.fail(WebhookPersistenceError.from(listResult.error));
|
|
36
|
+
const { entries, meta } = listResult.value;
|
|
37
|
+
const items = entries.map((entry)=>this.transformer.fromStorage(entry));
|
|
38
|
+
return Result.ok({
|
|
39
|
+
items,
|
|
40
|
+
meta: {
|
|
41
|
+
cursor: meta.cursor,
|
|
42
|
+
hasMoreItems: meta.hasMoreItems,
|
|
43
|
+
totalCount: meta.totalCount
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
} catch (error) {
|
|
47
|
+
return Result.fail(WebhookPersistenceError.from(error));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const ListWebhookDeliveriesRepository_ListWebhookDeliveriesRepository = ListWebhookDeliveriesRepository.createImplementation({
|
|
52
|
+
implementation: ListWebhookDeliveriesRepositoryImpl,
|
|
53
|
+
dependencies: [
|
|
54
|
+
GetModelRepository,
|
|
55
|
+
ListEntriesRepository,
|
|
56
|
+
WebhookDeliveryTransformer,
|
|
57
|
+
CmsWhereMapper,
|
|
58
|
+
CmsSortMapper
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
export { ListWebhookDeliveriesRepository_ListWebhookDeliveriesRepository as ListWebhookDeliveriesRepository };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=ListWebhookDeliveriesRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js","sources":["../../../../src/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.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 { WebhookDeliveryTransformer } from \"~/api/features/Transformers/abstractions/WebhookDeliveryTransformer.js\";\nimport {\n ListWebhookDeliveriesRepository as RepositoryAbstraction,\n type IListWebhookDeliveriesOutput\n} from \"./abstractions.js\";\nimport { WebhookModelNotFoundError, WebhookPersistenceError } from \"~/api/domain/errors.js\";\nimport { WEBHOOK_DELIVERY_MODEL_ID } from \"~/api/domain/constants.js\";\nimport type { IListWebhookDeliveriesInput } from \"./abstractions.js\";\nimport type { WebhookDeliveryCmsEntryValues } from \"~/api/domain/WebhookDelivery.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 ListWebhookDeliveriesRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private readonly getModelRepository: GetModelRepository.Interface,\n private readonly listEntriesRepository: ListEntriesRepository.Interface,\n private readonly transformer: WebhookDeliveryTransformer.Interface,\n private readonly whereMapper: CmsWhereMapper.Interface,\n private readonly sortMapper: CmsSortMapper.Interface\n ) {}\n\n async execute(\n params: IListWebhookDeliveriesInput\n ): Promise<Result<IListWebhookDeliveriesOutput, RepositoryAbstraction.Error>> {\n try {\n const modelResult = await this.getModelRepository.execute(WEBHOOK_DELIVERY_MODEL_ID);\n if (modelResult.isFail()) {\n return Result.fail(new WebhookModelNotFoundError(WEBHOOK_DELIVERY_MODEL_ID));\n }\n\n const model = modelResult.value;\n\n const listResult =\n await this.listEntriesRepository.execute<WebhookDeliveryCmsEntryValues>(model, {\n where: this.whereMapper.map({\n fields: model.fields,\n input: params.where\n }),\n sort: this.sortMapper.map({\n fields: model.fields,\n input: params.sort\n }),\n limit: params.limit ?? 100,\n after: params.after\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 ListWebhookDeliveriesRepository = RepositoryAbstraction.createImplementation({\n implementation: ListWebhookDeliveriesRepositoryImpl,\n dependencies: [\n GetModelRepository,\n ListEntriesRepository,\n WebhookDeliveryTransformer,\n CmsWhereMapper,\n CmsSortMapper\n ]\n});\n"],"names":["ListWebhookDeliveriesRepositoryImpl","getModelRepository","listEntriesRepository","transformer","whereMapper","sortMapper","params","modelResult","WEBHOOK_DELIVERY_MODEL_ID","Result","WebhookModelNotFoundError","model","listResult","WebhookPersistenceError","entries","meta","items","entry","error","ListWebhookDeliveriesRepository","RepositoryAbstraction","GetModelRepository","ListEntriesRepository","WebhookDeliveryTransformer","CmsWhereMapper","CmsSortMapper"],"mappings":";;;;;;;;;AAeA,MAAMA;IACF,YACqBC,kBAAgD,EAChDC,qBAAsD,EACtDC,WAAiD,EACjDC,WAAqC,EACrCC,UAAmC,CACtD;aALmBJ,kBAAkB,GAAlBA;aACAC,qBAAqB,GAArBA;aACAC,WAAW,GAAXA;aACAC,WAAW,GAAXA;aACAC,UAAU,GAAVA;IAClB;IAEH,MAAM,QACFC,MAAmC,EACuC;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,QAAQJ,YAAY,KAAK;YAE/B,MAAMK,aACF,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAgCD,OAAO;gBAC3E,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;oBACxB,QAAQA,MAAM,MAAM;oBACpB,OAAOL,OAAO,KAAK;gBACvB;gBACA,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;oBACtB,QAAQK,MAAM,MAAM;oBACpB,OAAOL,OAAO,IAAI;gBACtB;gBACA,OAAOA,OAAO,KAAK,IAAI;gBACvB,OAAOA,OAAO,KAAK;YACvB;YAEJ,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,kEAAkCC,gCAAAA,oBAA0C,CAAC;IACtF,gBAAgBpB;IAChB,cAAc;QACVqB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -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,63 @@
|
|
|
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: this.whereMapper.map({
|
|
25
|
+
fields: webhookModel.fields,
|
|
26
|
+
input: params?.where
|
|
27
|
+
}),
|
|
28
|
+
sort: this.sortMapper.map({
|
|
29
|
+
fields: webhookModel.fields,
|
|
30
|
+
input: params?.sort
|
|
31
|
+
}),
|
|
32
|
+
limit: params?.limit ?? 100,
|
|
33
|
+
after: params?.after
|
|
34
|
+
});
|
|
35
|
+
if (listResult.isFail()) return Result.fail(WebhookPersistenceError.from(listResult.error));
|
|
36
|
+
const { entries, meta } = listResult.value;
|
|
37
|
+
const items = entries.map((entry)=>this.transformer.fromStorage(entry));
|
|
38
|
+
return Result.ok({
|
|
39
|
+
items,
|
|
40
|
+
meta: {
|
|
41
|
+
cursor: meta.cursor,
|
|
42
|
+
hasMoreItems: meta.hasMoreItems,
|
|
43
|
+
totalCount: meta.totalCount
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
} catch (error) {
|
|
47
|
+
return Result.fail(WebhookPersistenceError.from(error));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const ListWebhooksRepository_ListWebhooksRepository = ListWebhooksRepository.createImplementation({
|
|
52
|
+
implementation: ListWebhooksRepositoryImpl,
|
|
53
|
+
dependencies: [
|
|
54
|
+
GetModelRepository,
|
|
55
|
+
ListEntriesRepository,
|
|
56
|
+
WebhookTransformer,
|
|
57
|
+
CmsWhereMapper,
|
|
58
|
+
CmsSortMapper
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
export { ListWebhooksRepository_ListWebhooksRepository as ListWebhooksRepository };
|
|
62
|
+
|
|
63
|
+
//# 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: this.whereMapper.map({\n fields: webhookModel.fields,\n input: params?.where\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,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;oBACxB,QAAQI,aAAa,MAAM;oBAC3B,OAAOL,QAAQ;gBACnB;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 {};
|