@webiny/webhooks 0.0.0-unstable.7be00a75a9 → 0.0.0-unstable.9f53ea597d
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/admin/WebhookRoutes.js +7 -13
- package/admin/WebhookRoutes.js.map +1 -1
- package/admin/Webhooks.js +0 -3
- package/admin/Webhooks.js.map +1 -1
- package/admin/features/ListWebhooks/ListWebhooksGateway.js +8 -2
- package/admin/features/ListWebhooks/ListWebhooksGateway.js.map +1 -1
- package/admin/features/ListWebhooks/abstractions.d.ts +1 -0
- package/admin/features/ListWebhooks/abstractions.js.map +1 -1
- package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/WebhookDeliveriesDataSource.d.ts +2 -3
- package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/WebhookDeliveriesDataSource.js +5 -7
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesDataSource.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.d.ts +9 -5
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js +67 -40
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/abstractions.d.ts +6 -3
- package/admin/presentation/WebhookDeliveriesPage/abstractions.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js +26 -7
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js +24 -8
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.d.ts +2 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js +16 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js +26 -17
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.d.ts +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.js.map +1 -0
- package/admin/presentation/WebhookForm/WebhookFormPresenter.d.ts +1 -4
- package/admin/presentation/WebhookForm/WebhookFormPresenter.js +8 -12
- package/admin/presentation/WebhookForm/WebhookFormPresenter.js.map +1 -1
- package/admin/presentation/WebhookForm/abstractions.d.ts +1 -4
- package/admin/presentation/WebhookForm/abstractions.js.map +1 -1
- package/admin/presentation/WebhookForm/components/WebhookFormView.js +34 -36
- package/admin/presentation/WebhookForm/components/WebhookFormView.js.map +1 -1
- package/admin/presentation/WebhookList/WebhookListDataSource.d.ts +7 -8
- package/admin/presentation/WebhookList/WebhookListDataSource.js +23 -50
- package/admin/presentation/WebhookList/WebhookListDataSource.js.map +1 -1
- package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.d.ts +2 -0
- package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.js +16 -0
- package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.js.map +1 -0
- package/admin/presentation/WebhookList/components/WebhookListContent.js +20 -8
- package/admin/presentation/WebhookList/components/WebhookListContent.js.map +1 -1
- package/admin/presentation/WebhookList/components/WebhookListView.js +4 -1
- package/admin/presentation/WebhookList/components/WebhookListView.js.map +1 -1
- package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.js +3 -1
- package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.js.map +1 -1
- package/admin/routes.d.ts +3 -1
- package/admin/routes.js +4 -1
- package/admin/routes.js.map +1 -1
- package/api/features/SendWebhookTask/SendWebhookTask.d.ts +1 -1
- package/api/features/SendWebhookTask/SendWebhookTask.js +1 -1
- package/api/features/SendWebhookTask/SendWebhookTask.js.map +1 -1
- package/api/graphql/WebhookCrudSchema.js +11 -0
- package/api/graphql/WebhookCrudSchema.js.map +1 -1
- package/api/index.js +5 -1
- package/api/index.js.map +1 -1
- package/api/models/WebhookDeliveryModel.d.ts +1 -1
- package/api/models/WebhookDeliveryModel.js +3 -4
- package/api/models/WebhookDeliveryModel.js.map +1 -1
- package/api/models/WebhookModel.d.ts +1 -1
- package/api/models/WebhookModel.js +4 -5
- package/api/models/WebhookModel.js.map +1 -1
- package/api/models/WebhookSettingsModel.d.ts +1 -1
- package/api/models/WebhookSettingsModel.js +3 -4
- package/api/models/WebhookSettingsModel.js.map +1 -1
- package/package.json +22 -22
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesDataSource.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.d.ts +0 -21
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.js +0 -57
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/abstractions.d.ts +0 -18
- package/admin/presentation/WebhookDeliveries/abstractions.js +0 -5
- package/admin/presentation/WebhookDeliveries/abstractions.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/DeliveryAccordionRow.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.d.ts +0 -11
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.js +0 -32
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailContent.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailPanel.d.ts +0 -9
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailPanel.js +0 -22
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailPanel.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.d.ts +0 -8
- package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.js +0 -119
- package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/statusVariant.d.ts +0 -1
- package/admin/presentation/WebhookDeliveries/components/statusVariant.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/feature.d.ts +0 -3
- package/admin/presentation/WebhookDeliveries/feature.js +0 -17
- package/admin/presentation/WebhookDeliveries/feature.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/index.d.ts +0 -2
- package/admin/presentation/WebhookDeliveries/index.js +0 -2
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/DeliveryAccordionRow.d.ts +0 -0
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/DeliveryAccordionRow.js +0 -0
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/DeliveryDetailContent.d.ts +0 -0
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/DeliveryDetailContent.js +0 -0
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/statusVariant.js +0 -0
package/admin/WebhookRoutes.js
CHANGED
|
@@ -8,6 +8,9 @@ import { WebhookSettingsView } from "./presentation/WebhookSettings/components/W
|
|
|
8
8
|
import { WebhookDeliveriesPage } from "./presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js";
|
|
9
9
|
import { Routes } from "./routes.js";
|
|
10
10
|
const { Menu: Menu, Route: Route } = AdminConfig;
|
|
11
|
+
const beta = /*#__PURE__*/ react.createElement(Menu.Link.Badge, {
|
|
12
|
+
text: "BETA"
|
|
13
|
+
});
|
|
11
14
|
const WebhookRoutes = ()=>{
|
|
12
15
|
const { getLink } = useRouter();
|
|
13
16
|
return /*#__PURE__*/ react.createElement(AdminConfig, null, /*#__PURE__*/ react.createElement(HasPermission, {
|
|
@@ -32,25 +35,15 @@ const WebhookRoutes = ()=>{
|
|
|
32
35
|
element: /*#__PURE__*/ react.createElement(AdminLayout, {
|
|
33
36
|
title: "Webhooks"
|
|
34
37
|
}, /*#__PURE__*/ react.createElement(WebhookFormView, null))
|
|
35
|
-
}), /*#__PURE__*/ react.createElement(Menu, {
|
|
36
|
-
name: "webhooks.list",
|
|
37
|
-
parent: "dev-tools",
|
|
38
|
-
element: /*#__PURE__*/ react.createElement(Menu.Link, {
|
|
39
|
-
text: "Webhooks",
|
|
40
|
-
to: getLink(Routes.List),
|
|
41
|
-
icon: /*#__PURE__*/ react.createElement(Menu.Link.Icon, {
|
|
42
|
-
label: "Webhooks",
|
|
43
|
-
element: /*#__PURE__*/ react.createElement(ReactComponent, null)
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
38
|
}), /*#__PURE__*/ react.createElement(Menu, {
|
|
47
39
|
name: "webhooks.deliveries",
|
|
48
40
|
parent: "dev-tools",
|
|
49
41
|
element: /*#__PURE__*/ react.createElement(Menu.Link, {
|
|
50
|
-
text: "Webhooks
|
|
42
|
+
text: "Webhooks",
|
|
43
|
+
badge: beta,
|
|
51
44
|
to: getLink(Routes.Deliveries),
|
|
52
45
|
icon: /*#__PURE__*/ react.createElement(Menu.Link.Icon, {
|
|
53
|
-
label: "Webhooks
|
|
46
|
+
label: "Webhooks",
|
|
54
47
|
element: /*#__PURE__*/ react.createElement(ReactComponent, null)
|
|
55
48
|
})
|
|
56
49
|
})
|
|
@@ -58,6 +51,7 @@ const WebhookRoutes = ()=>{
|
|
|
58
51
|
name: "webhooks.settings",
|
|
59
52
|
parent: "settings.system",
|
|
60
53
|
element: /*#__PURE__*/ react.createElement(Menu.Link, {
|
|
54
|
+
badge: beta,
|
|
61
55
|
text: "Webhooks",
|
|
62
56
|
to: getLink(Routes.Settings)
|
|
63
57
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/WebhookRoutes.js","sources":["../../src/admin/WebhookRoutes.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig } from \"@webiny/app-admin\";\nimport { useRouter } from \"@webiny/app-admin\";\nimport { AdminLayout } from \"@webiny/app-admin\";\nimport { ReactComponent as
|
|
1
|
+
{"version":3,"file":"admin/WebhookRoutes.js","sources":["../../src/admin/WebhookRoutes.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig } from \"@webiny/app-admin\";\nimport { useRouter } from \"@webiny/app-admin\";\nimport { AdminLayout } from \"@webiny/app-admin\";\nimport { ReactComponent as WebhookDeliveryIcon } from \"@webiny/icons/webhook.svg\";\nimport { HasPermission } from \"./presentation/security/HasPermission.js\";\nimport { WebhookListView } from \"./presentation/WebhookList/components/WebhookListView.js\";\nimport { WebhookFormView } from \"./presentation/WebhookForm/components/WebhookFormView.js\";\nimport { WebhookSettingsView } from \"./presentation/WebhookSettings/components/WebhookSettingsView.js\";\nimport { WebhookDeliveriesPage } from \"./presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js\";\nimport { Routes } from \"./routes.js\";\n\nconst { Menu, Route } = AdminConfig;\n\nconst beta = <Menu.Link.Badge text=\"BETA\" />;\n\nexport const WebhookRoutes = () => {\n const { getLink } = useRouter();\n\n return (\n <AdminConfig>\n <HasPermission entity=\"webhook\">\n <Route\n route={Routes.List}\n element={\n <AdminLayout title=\"Webhooks\">\n <WebhookListView />\n </AdminLayout>\n }\n />\n <Route\n route={Routes.Deliveries}\n element={\n <AdminLayout title=\"Delivery Log\">\n <WebhookDeliveriesPage />\n </AdminLayout>\n }\n />\n <Route\n route={Routes.Settings}\n element={\n <AdminLayout title=\"Webhook Settings\">\n <WebhookSettingsView />\n </AdminLayout>\n }\n />\n <Route\n route={Routes.Form}\n element={\n <AdminLayout title=\"Webhooks\">\n <WebhookFormView />\n </AdminLayout>\n }\n />\n <Menu\n name=\"webhooks.deliveries\"\n parent=\"dev-tools\"\n element={\n <Menu.Link\n text=\"Webhooks\"\n badge={beta}\n to={getLink(Routes.Deliveries)}\n icon={\n <Menu.Link.Icon\n label=\"Webhooks\"\n element={<WebhookDeliveryIcon />}\n />\n }\n />\n }\n />\n <Menu\n name=\"webhooks.settings\"\n parent=\"settings.system\"\n element={\n <Menu.Link badge={beta} text=\"Webhooks\" to={getLink(Routes.Settings)} />\n }\n />\n </HasPermission>\n </AdminConfig>\n );\n};\n"],"names":["Menu","Route","AdminConfig","beta","WebhookRoutes","getLink","useRouter","HasPermission","Routes","AdminLayout","WebhookListView","WebhookDeliveriesPage","WebhookSettingsView","WebhookFormView","WebhookDeliveryIcon"],"mappings":";;;;;;;;;AAYA,MAAM,EAAEA,MAAAA,IAAI,EAAEC,OAAAA,KAAK,EAAE,GAAGC;AAExB,MAAMC,OAAO,WAAHA,GAAG,oBAACH,KAAK,IAAI,CAAC,KAAK;IAAC,MAAK;;AAE5B,MAAMI,gBAAgB;IACzB,MAAM,EAAEC,OAAO,EAAE,GAAGC;IAEpB,OAAO,WAAP,GACI,oBAACJ,aAAWA,MAAAA,WAAAA,GACR,oBAACK,eAAaA;QAAC,QAAO;qBAClB,oBAACN,OAAKA;QACF,OAAOO,OAAO,IAAI;QAClB,uBACI,oBAACC,aAAWA;YAAC,OAAM;yBACf,oBAACC,iBAAeA;sBAI5B,oBAACT,OAAKA;QACF,OAAOO,OAAO,UAAU;QACxB,uBACI,oBAACC,aAAWA;YAAC,OAAM;yBACf,oBAACE,uBAAqBA;sBAIlC,oBAACV,OAAKA;QACF,OAAOO,OAAO,QAAQ;QACtB,uBACI,oBAACC,aAAWA;YAAC,OAAM;yBACf,oBAACG,qBAAmBA;sBAIhC,oBAACX,OAAKA;QACF,OAAOO,OAAO,IAAI;QAClB,uBACI,oBAACC,aAAWA;YAAC,OAAM;yBACf,oBAACI,iBAAeA;sBAI5B,oBAACb,MAAIA;QACD,MAAK;QACL,QAAO;QACP,uBACI,oBAACA,KAAK,IAAI;YACN,MAAK;YACL,OAAOG;YACP,IAAIE,QAAQG,OAAO,UAAU;YAC7B,oBACI,oBAACR,KAAK,IAAI,CAAC,IAAI;gBACX,OAAM;gBACN,uBAAS,oBAACc,gBAAmBA;;;sBAMjD,oBAACd,MAAIA;QACD,MAAK;QACL,QAAO;QACP,uBACI,oBAACA,KAAK,IAAI;YAAC,OAAOG;YAAM,MAAK;YAAW,IAAIE,QAAQG,OAAO,QAAQ;;;AAM3F"}
|
package/admin/Webhooks.js
CHANGED
|
@@ -15,7 +15,6 @@ import { UpdateWebhookSettingsFeature } from "./features/updateWebhookSettings/i
|
|
|
15
15
|
import { WebhookPermissionsFeature } from "./features/permissions/index.js";
|
|
16
16
|
import { WebhookListPresenterFeature } from "./presentation/WebhookList/index.js";
|
|
17
17
|
import { WebhookFormPresenterFeature } from "./presentation/WebhookForm/index.js";
|
|
18
|
-
import { WebhookDeliveriesPresenterFeature } from "./presentation/WebhookDeliveries/index.js";
|
|
19
18
|
import { WebhookSettingsPresenterFeature } from "./presentation/WebhookSettings/index.js";
|
|
20
19
|
import { WebhookRoutes } from "./WebhookRoutes.js";
|
|
21
20
|
import { WEBHOOK_PERMISSIONS_SCHEMA } from "./permissions.js";
|
|
@@ -48,8 +47,6 @@ const Webhooks = ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#
|
|
|
48
47
|
feature: WebhookListPresenterFeature
|
|
49
48
|
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
50
49
|
feature: WebhookFormPresenterFeature
|
|
51
|
-
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
52
|
-
feature: WebhookDeliveriesPresenterFeature
|
|
53
50
|
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
54
51
|
feature: WebhookSettingsPresenterFeature
|
|
55
52
|
}), /*#__PURE__*/ react.createElement(WebhookRoutes, null), /*#__PURE__*/ react.createElement(AdminConfig, null, /*#__PURE__*/ react.createElement(Security.Permissions, {
|
package/admin/Webhooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/Webhooks.js","sources":["../../src/admin/Webhooks.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig } from \"@webiny/app-admin\";\nimport { RegisterFeature } from \"@webiny/app-admin\";\nimport { ReactComponent as WebhookIcon } from \"@webiny/icons/webhook.svg\";\nimport { ListWebhooksFeature } from \"./features/ListWebhooks/index.js\";\nimport { GetWebhookFeature } from \"./features/getWebhook/index.js\";\nimport { CreateWebhookFeature } from \"./features/createWebhook/index.js\";\nimport { UpdateWebhookFeature } from \"./features/updateWebhook/index.js\";\nimport { DeleteWebhookFeature } from \"./features/deleteWebhook/index.js\";\nimport { ListWebhookDeliveriesFeature } from \"./features/listWebhookDeliveries/index.js\";\nimport { TriggerWebhookFeature } from \"./features/triggerWebhook/index.js\";\nimport { ResendWebhookDeliveryFeature } from \"./features/resendWebhookDelivery/index.js\";\nimport { ListAvailableEventsFeature } from \"./features/listAvailableEvents/index.js\";\nimport { GetWebhookSettingsFeature } from \"./features/getWebhookSettings/index.js\";\nimport { UpdateWebhookSettingsFeature } from \"./features/updateWebhookSettings/index.js\";\nimport { WebhookPermissionsFeature } from \"./features/permissions/index.js\";\nimport { WebhookListPresenterFeature } from \"./presentation/WebhookList/index.js\";\nimport { WebhookFormPresenterFeature } from \"./presentation/WebhookForm/index.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"admin/Webhooks.js","sources":["../../src/admin/Webhooks.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig } from \"@webiny/app-admin\";\nimport { RegisterFeature } from \"@webiny/app-admin\";\nimport { ReactComponent as WebhookIcon } from \"@webiny/icons/webhook.svg\";\nimport { ListWebhooksFeature } from \"./features/ListWebhooks/index.js\";\nimport { GetWebhookFeature } from \"./features/getWebhook/index.js\";\nimport { CreateWebhookFeature } from \"./features/createWebhook/index.js\";\nimport { UpdateWebhookFeature } from \"./features/updateWebhook/index.js\";\nimport { DeleteWebhookFeature } from \"./features/deleteWebhook/index.js\";\nimport { ListWebhookDeliveriesFeature } from \"./features/listWebhookDeliveries/index.js\";\nimport { TriggerWebhookFeature } from \"./features/triggerWebhook/index.js\";\nimport { ResendWebhookDeliveryFeature } from \"./features/resendWebhookDelivery/index.js\";\nimport { ListAvailableEventsFeature } from \"./features/listAvailableEvents/index.js\";\nimport { GetWebhookSettingsFeature } from \"./features/getWebhookSettings/index.js\";\nimport { UpdateWebhookSettingsFeature } from \"./features/updateWebhookSettings/index.js\";\nimport { WebhookPermissionsFeature } from \"./features/permissions/index.js\";\nimport { WebhookListPresenterFeature } from \"./presentation/WebhookList/index.js\";\nimport { WebhookFormPresenterFeature } from \"./presentation/WebhookForm/index.js\";\nimport { WebhookSettingsPresenterFeature } from \"./presentation/WebhookSettings/index.js\";\nimport { WebhookRoutes } from \"./WebhookRoutes.js\";\nimport { WEBHOOK_PERMISSIONS_SCHEMA } from \"~/admin/permissions.js\";\n\nconst { Security } = AdminConfig;\n\nexport const Webhooks = () => {\n return (\n <>\n {/* Headless features. */}\n <RegisterFeature feature={ListWebhooksFeature} />\n <RegisterFeature feature={GetWebhookFeature} />\n <RegisterFeature feature={CreateWebhookFeature} />\n <RegisterFeature feature={UpdateWebhookFeature} />\n <RegisterFeature feature={DeleteWebhookFeature} />\n <RegisterFeature feature={ListWebhookDeliveriesFeature} />\n <RegisterFeature feature={TriggerWebhookFeature} />\n <RegisterFeature feature={ResendWebhookDeliveryFeature} />\n <RegisterFeature feature={ListAvailableEventsFeature} />\n <RegisterFeature feature={GetWebhookSettingsFeature} />\n <RegisterFeature feature={UpdateWebhookSettingsFeature} />\n <RegisterFeature feature={WebhookPermissionsFeature} />\n {/* Presentation features. */}\n <RegisterFeature feature={WebhookListPresenterFeature} />\n <RegisterFeature feature={WebhookFormPresenterFeature} />\n <RegisterFeature feature={WebhookSettingsPresenterFeature} />\n {/* Routes + menu. */}\n <WebhookRoutes />\n {/* Security permissions UI. */}\n <AdminConfig>\n <Security.Permissions\n name=\"webhooks\"\n title=\"Webhooks\"\n description=\"Manage webhook permissions.\"\n icon={<WebhookIcon />}\n schema={WEBHOOK_PERMISSIONS_SCHEMA}\n />\n </AdminConfig>\n </>\n );\n};\n"],"names":["Security","AdminConfig","Webhooks","RegisterFeature","ListWebhooksFeature","GetWebhookFeature","CreateWebhookFeature","UpdateWebhookFeature","DeleteWebhookFeature","ListWebhookDeliveriesFeature","TriggerWebhookFeature","ResendWebhookDeliveryFeature","ListAvailableEventsFeature","GetWebhookSettingsFeature","UpdateWebhookSettingsFeature","WebhookPermissionsFeature","WebhookListPresenterFeature","WebhookFormPresenterFeature","WebhookSettingsPresenterFeature","WebhookRoutes","WebhookIcon","WEBHOOK_PERMISSIONS_SCHEMA"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,EAAEA,UAAAA,QAAQ,EAAE,GAAGC;AAEd,MAAMC,WAAW,IACb,WAAP,GACI,wDAEI,oBAACC,iBAAeA;QAAC,SAASC;sBAC1B,oBAACD,iBAAeA;QAAC,SAASE;sBAC1B,oBAACF,iBAAeA;QAAC,SAASG;sBAC1B,oBAACH,iBAAeA;QAAC,SAASI;sBAC1B,oBAACJ,iBAAeA;QAAC,SAASK;sBAC1B,oBAACL,iBAAeA;QAAC,SAASM;sBAC1B,oBAACN,iBAAeA;QAAC,SAASO;sBAC1B,oBAACP,iBAAeA;QAAC,SAASQ;sBAC1B,oBAACR,iBAAeA;QAAC,SAASS;sBAC1B,oBAACT,iBAAeA;QAAC,SAASU;sBAC1B,oBAACV,iBAAeA;QAAC,SAASW;sBAC1B,oBAACX,iBAAeA;QAAC,SAASY;sBAE1B,oBAACZ,iBAAeA;QAAC,SAASa;sBAC1B,oBAACb,iBAAeA;QAAC,SAASc;sBAC1B,oBAACd,iBAAeA;QAAC,SAASe;sBAE1B,oBAACC,eAAaA,OAAAA,WAAAA,GAEd,oBAAClB,aAAWA,MAAAA,WAAAA,GACR,oBAACD,SAAS,WAAW;QACjB,MAAK;QACL,OAAM;QACN,aAAY;QACZ,oBAAM,oBAACoB,gBAAWA;QAClB,QAAQC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
|
|
2
2
|
import { ListWebhooksGateway } from "./abstractions.js";
|
|
3
3
|
const LIST_WEBHOOKS = `
|
|
4
|
-
query ListWebhooks(
|
|
4
|
+
query ListWebhooks(
|
|
5
|
+
$where: ListWebhooksWhereInput
|
|
6
|
+
$sort: [ListWebhooksSort!]
|
|
7
|
+
$limit: Int
|
|
8
|
+
$after: String
|
|
9
|
+
) {
|
|
5
10
|
webhooks {
|
|
6
|
-
listWebhooks(where: $where, limit: $limit, after: $after) {
|
|
11
|
+
listWebhooks(where: $where, sort: $sort, limit: $limit, after: $after) {
|
|
7
12
|
data {
|
|
8
13
|
id
|
|
9
14
|
name
|
|
@@ -39,6 +44,7 @@ class ListWebhooksGraphQLGateway {
|
|
|
39
44
|
query: LIST_WEBHOOKS,
|
|
40
45
|
variables: {
|
|
41
46
|
where: input.where,
|
|
47
|
+
sort: input.sort,
|
|
42
48
|
limit: input.limit,
|
|
43
49
|
after: input.after
|
|
44
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/features/ListWebhooks/ListWebhooksGateway.js","sources":["../../../../src/admin/features/ListWebhooks/ListWebhooksGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport {\n ListWebhooksGateway as GatewayAbstraction,\n type IListWebhooksInput,\n type IListWebhooksOutput\n} from \"./abstractions.js\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\n\nconst LIST_WEBHOOKS = /* GraphQL */ `\n query ListWebhooks($where: ListWebhooksWhereInput
|
|
1
|
+
{"version":3,"file":"admin/features/ListWebhooks/ListWebhooksGateway.js","sources":["../../../../src/admin/features/ListWebhooks/ListWebhooksGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport {\n ListWebhooksGateway as GatewayAbstraction,\n type IListWebhooksInput,\n type IListWebhooksOutput\n} from \"./abstractions.js\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\n\nconst LIST_WEBHOOKS = /* GraphQL */ `\n query ListWebhooks(\n $where: ListWebhooksWhereInput\n $sort: [ListWebhooksSort!]\n $limit: Int\n $after: String\n ) {\n webhooks {\n listWebhooks(where: $where, sort: $sort, limit: $limit, after: $after) {\n data {\n id\n name\n slug\n endpointUrl\n description\n enabled\n events\n signingSecret\n createdOn\n modifiedOn\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n\ntype ListWebhooksResponse = {\n webhooks: {\n listWebhooks:\n | {\n data: Webhook[];\n meta: { cursor: string | null; hasMoreItems: boolean; totalCount: number };\n error: null;\n }\n | {\n data: null;\n meta: null;\n error: { code: string; message: string; data: unknown };\n };\n };\n};\n\nclass ListWebhooksGraphQLGateway implements GatewayAbstraction.Interface {\n constructor(private client: MainGraphQLClient.Interface) {}\n\n async execute(input: IListWebhooksInput): Promise<IListWebhooksOutput> {\n const response = await this.client.execute<ListWebhooksResponse>({\n query: LIST_WEBHOOKS,\n variables: {\n where: input.where,\n sort: input.sort,\n limit: input.limit,\n after: input.after\n }\n });\n\n const envelope = response.webhooks.listWebhooks;\n if (envelope.error) {\n throw new Error(envelope.error.message);\n }\n\n return {\n items: envelope.data,\n meta: envelope.meta\n };\n }\n}\n\nexport const ListWebhooksGateway = GatewayAbstraction.createImplementation({\n implementation: ListWebhooksGraphQLGateway,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["LIST_WEBHOOKS","ListWebhooksGraphQLGateway","client","input","response","envelope","Error","ListWebhooksGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAQA,MAAMA,gBAA8B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCrC,CAAC;AAkBD,MAAMC;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,KAAyB,EAAgC;QACnE,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAuB;YAC7D,OAAOJ;YACP,WAAW;gBACP,OAAOG,MAAM,KAAK;gBAClB,MAAMA,MAAM,IAAI;gBAChB,OAAOA,MAAM,KAAK;gBAClB,OAAOA,MAAM,KAAK;YACtB;QACJ;QAEA,MAAME,WAAWD,SAAS,QAAQ,CAAC,YAAY;QAC/C,IAAIC,SAAS,KAAK,EACd,MAAM,IAAIC,MAAMD,SAAS,KAAK,CAAC,OAAO;QAG1C,OAAO;YACH,OAAOA,SAAS,IAAI;YACpB,MAAMA,SAAS,IAAI;QACvB;IACJ;AACJ;AAEO,MAAME,0CAAsBC,oBAAAA,oBAAuC,CAAC;IACvE,gBAAgBP;IAChB,cAAc;QAACQ;KAAkB;AACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/features/ListWebhooks/abstractions.js","sources":["../../../../src/admin/features/ListWebhooks/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\n\nexport interface IListWebhooksInput {\n where?: Record<string, unknown>;\n limit?: number;\n after?: string;\n}\n\nexport interface IListWebhooksMeta {\n cursor: string | null;\n hasMoreItems: boolean;\n totalCount: number;\n}\n\nexport interface IListWebhooksOutput {\n items: Webhook[];\n meta: IListWebhooksMeta;\n}\n\nexport interface IListWebhooksGateway {\n execute(input: IListWebhooksInput): Promise<IListWebhooksOutput>;\n}\n\nexport const ListWebhooksGateway = createAbstraction<IListWebhooksGateway>(\"ListWebhooksGateway\");\n\nexport namespace ListWebhooksGateway {\n export type Interface = IListWebhooksGateway;\n}\n\nexport interface IListWebhooksRepository {\n execute(input: IListWebhooksInput): Promise<IListWebhooksOutput>;\n}\n\nexport const ListWebhooksRepository =\n createAbstraction<IListWebhooksRepository>(\"ListWebhooksRepository\");\n\nexport namespace ListWebhooksRepository {\n export type Interface = IListWebhooksRepository;\n}\n\nexport interface IListWebhooksUseCase {\n execute(input: IListWebhooksInput): Promise<IListWebhooksOutput>;\n}\n\nexport const ListWebhooksUseCase = createAbstraction<IListWebhooksUseCase>(\"ListWebhooksUseCase\");\n\nexport namespace ListWebhooksUseCase {\n export type Interface = IListWebhooksUseCase;\n}\n"],"names":["ListWebhooksGateway","createAbstraction","ListWebhooksRepository","ListWebhooksUseCase"],"mappings":";
|
|
1
|
+
{"version":3,"file":"admin/features/ListWebhooks/abstractions.js","sources":["../../../../src/admin/features/ListWebhooks/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\n\nexport interface IListWebhooksInput {\n where?: Record<string, unknown>;\n sort?: string[];\n limit?: number;\n after?: string;\n}\n\nexport interface IListWebhooksMeta {\n cursor: string | null;\n hasMoreItems: boolean;\n totalCount: number;\n}\n\nexport interface IListWebhooksOutput {\n items: Webhook[];\n meta: IListWebhooksMeta;\n}\n\nexport interface IListWebhooksGateway {\n execute(input: IListWebhooksInput): Promise<IListWebhooksOutput>;\n}\n\nexport const ListWebhooksGateway = createAbstraction<IListWebhooksGateway>(\"ListWebhooksGateway\");\n\nexport namespace ListWebhooksGateway {\n export type Interface = IListWebhooksGateway;\n}\n\nexport interface IListWebhooksRepository {\n execute(input: IListWebhooksInput): Promise<IListWebhooksOutput>;\n}\n\nexport const ListWebhooksRepository =\n createAbstraction<IListWebhooksRepository>(\"ListWebhooksRepository\");\n\nexport namespace ListWebhooksRepository {\n export type Interface = IListWebhooksRepository;\n}\n\nexport interface IListWebhooksUseCase {\n execute(input: IListWebhooksInput): Promise<IListWebhooksOutput>;\n}\n\nexport const ListWebhooksUseCase = createAbstraction<IListWebhooksUseCase>(\"ListWebhooksUseCase\");\n\nexport namespace ListWebhooksUseCase {\n export type Interface = IListWebhooksUseCase;\n}\n"],"names":["ListWebhooksGateway","createAbstraction","ListWebhooksRepository","ListWebhooksUseCase"],"mappings":";AAyBO,MAAMA,sBAAsBC,kBAAwC;AAUpE,MAAMC,yBACTD,kBAA2C;AAUxC,MAAME,sBAAsBF,kBAAwC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { IDataSource, IDataSourceQuery, IDataSourceMeta } from "@webiny/app-admin/presentation/listPresenter/abstractions.js";
|
|
2
2
|
import type { WebhookDelivery } from "../../../admin/shared/types.js";
|
|
3
|
-
import type { IListWebhookDeliveriesUseCase
|
|
3
|
+
import type { IListWebhookDeliveriesUseCase } from "../../../admin/features/listWebhookDeliveries/abstractions.js";
|
|
4
4
|
export declare class WebhookDeliveriesDataSource implements IDataSource<WebhookDelivery> {
|
|
5
5
|
private readonly listDeliveriesUseCase;
|
|
6
|
-
private readonly where;
|
|
7
6
|
private _rows;
|
|
8
7
|
private _meta;
|
|
9
8
|
private _loading;
|
|
10
|
-
constructor(listDeliveriesUseCase: IListWebhookDeliveriesUseCase
|
|
9
|
+
constructor(listDeliveriesUseCase: IListWebhookDeliveriesUseCase);
|
|
11
10
|
get rows(): WebhookDelivery[];
|
|
12
11
|
get meta(): IDataSourceMeta;
|
|
13
12
|
get loading(): boolean;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { makeAutoObservable, runInAction } from "mobx";
|
|
2
2
|
class WebhookDeliveriesDataSource {
|
|
3
|
-
constructor(listDeliveriesUseCase
|
|
3
|
+
constructor(listDeliveriesUseCase){
|
|
4
4
|
this.listDeliveriesUseCase = listDeliveriesUseCase;
|
|
5
|
-
this.where = where;
|
|
6
5
|
this._rows = [];
|
|
7
6
|
this._meta = {
|
|
8
7
|
cursor: null,
|
|
@@ -11,8 +10,7 @@ class WebhookDeliveriesDataSource {
|
|
|
11
10
|
};
|
|
12
11
|
this._loading = false;
|
|
13
12
|
makeAutoObservable(this, {
|
|
14
|
-
listDeliveriesUseCase: false
|
|
15
|
-
rows: computed
|
|
13
|
+
listDeliveriesUseCase: false
|
|
16
14
|
});
|
|
17
15
|
}
|
|
18
16
|
get rows() {
|
|
@@ -27,7 +25,7 @@ class WebhookDeliveriesDataSource {
|
|
|
27
25
|
async query(params) {
|
|
28
26
|
this._loading = true;
|
|
29
27
|
const result = await this.listDeliveriesUseCase.execute({
|
|
30
|
-
where:
|
|
28
|
+
where: params.filters ?? {},
|
|
31
29
|
limit: params.limit,
|
|
32
30
|
after: params.cursor
|
|
33
31
|
});
|
|
@@ -45,7 +43,7 @@ class WebhookDeliveriesDataSource {
|
|
|
45
43
|
if (!this._meta.hasMoreItems || this._loading) return;
|
|
46
44
|
this._loading = true;
|
|
47
45
|
const result = await this.listDeliveriesUseCase.execute({
|
|
48
|
-
where:
|
|
46
|
+
where: params.filters ?? {},
|
|
49
47
|
limit: params.limit,
|
|
50
48
|
after: this._meta.cursor ?? void 0
|
|
51
49
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesDataSource.js","sources":["../../../../src/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesDataSource.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from \"mobx\";\nimport type {\n IDataSource,\n IDataSourceQuery,\n IDataSourceMeta\n} from \"@webiny/app-admin/presentation/listPresenter/abstractions.js\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\nimport type {\n IListWebhookDeliveriesUseCase,\n ListWebhookDeliveriesWhere\n} from \"~/admin/features/listWebhookDeliveries/abstractions.js\";\n\nexport class WebhookDeliveriesDataSource implements IDataSource<WebhookDelivery> {\n private _rows: WebhookDelivery[] = [];\n private _meta: IDataSourceMeta = { cursor: null, hasMoreItems: false, totalCount: 0 };\n private _loading = false;\n\n constructor(private readonly listDeliveriesUseCase: IListWebhookDeliveriesUseCase) {\n makeAutoObservable<WebhookDeliveriesDataSource, \"listDeliveriesUseCase\">(this, {\n listDeliveriesUseCase: false\n });\n }\n\n get rows(): WebhookDelivery[] {\n return this._rows;\n }\n\n get meta(): IDataSourceMeta {\n return this._meta;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n async query(params: IDataSourceQuery): Promise<void> {\n this._loading = true;\n const result = await this.listDeliveriesUseCase.execute({\n where: (params.filters ?? {}) as ListWebhookDeliveriesWhere,\n limit: params.limit,\n after: params.cursor\n });\n runInAction(() => {\n this._rows = result.data;\n this._meta = {\n cursor: result.meta.cursor,\n hasMoreItems: result.meta.hasMoreItems,\n totalCount: result.meta.totalCount\n };\n this._loading = false;\n });\n }\n\n async loadMore(params: IDataSourceQuery): Promise<void> {\n if (!this._meta.hasMoreItems || this._loading) {\n return;\n }\n this._loading = true;\n const result = await this.listDeliveriesUseCase.execute({\n where: (params.filters ?? {}) as ListWebhookDeliveriesWhere,\n limit: params.limit,\n after: this._meta.cursor ?? undefined\n });\n runInAction(() => {\n this._rows = [...this._rows, ...result.data];\n this._meta = {\n cursor: result.meta.cursor,\n hasMoreItems: result.meta.hasMoreItems,\n totalCount: result.meta.totalCount\n };\n this._loading = false;\n });\n }\n}\n"],"names":["WebhookDeliveriesDataSource","listDeliveriesUseCase","makeAutoObservable","params","result","runInAction","undefined"],"mappings":";AAYO,MAAMA;IAKT,YAA6BC,qBAAoD,CAAE;aAAtDA,qBAAqB,GAArBA;aAJrB,KAAK,GAAsB,EAAE;aAC7B,KAAK,GAAoB;YAAE,QAAQ;YAAM,cAAc;YAAO,YAAY;QAAE;aAC5E,QAAQ,GAAG;QAGfC,mBAAyE,IAAI,EAAE;YAC3E,uBAAuB;QAC3B;IACJ;IAEA,IAAI,OAA0B;QAC1B,OAAO,IAAI,CAAC,KAAK;IACrB;IAEA,IAAI,OAAwB;QACxB,OAAO,IAAI,CAAC,KAAK;IACrB;IAEA,IAAI,UAAmB;QACnB,OAAO,IAAI,CAAC,QAAQ;IACxB;IAEA,MAAM,MAAMC,MAAwB,EAAiB;QACjD,IAAI,CAAC,QAAQ,GAAG;QAChB,MAAMC,SAAS,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC;YACpD,OAAQD,OAAO,OAAO,IAAI,CAAC;YAC3B,OAAOA,OAAO,KAAK;YACnB,OAAOA,OAAO,MAAM;QACxB;QACAE,YAAY;YACR,IAAI,CAAC,KAAK,GAAGD,OAAO,IAAI;YACxB,IAAI,CAAC,KAAK,GAAG;gBACT,QAAQA,OAAO,IAAI,CAAC,MAAM;gBAC1B,cAAcA,OAAO,IAAI,CAAC,YAAY;gBACtC,YAAYA,OAAO,IAAI,CAAC,UAAU;YACtC;YACA,IAAI,CAAC,QAAQ,GAAG;QACpB;IACJ;IAEA,MAAM,SAASD,MAAwB,EAAiB;QACpD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,QAAQ,EACzC;QAEJ,IAAI,CAAC,QAAQ,GAAG;QAChB,MAAMC,SAAS,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC;YACpD,OAAQD,OAAO,OAAO,IAAI,CAAC;YAC3B,OAAOA,OAAO,KAAK;YACnB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAIG;QAChC;QACAD,YAAY;YACR,IAAI,CAAC,KAAK,GAAG;mBAAI,IAAI,CAAC,KAAK;mBAAKD,OAAO,IAAI;aAAC;YAC5C,IAAI,CAAC,KAAK,GAAG;gBACT,QAAQA,OAAO,IAAI,CAAC,MAAM;gBAC1B,cAAcA,OAAO,IAAI,CAAC,YAAY;gBACtC,YAAYA,OAAO,IAAI,CAAC,UAAU;YACtC;YACA,IAAI,CAAC,QAAQ,GAAG;QACpB;IACJ;AACJ"}
|
|
@@ -3,29 +3,33 @@ import type { WebhookDelivery } from "../../../admin/shared/types.js";
|
|
|
3
3
|
import { ListWebhookDeliveriesUseCase } from "../../../admin/features/listWebhookDeliveries/abstractions.js";
|
|
4
4
|
import { ResendWebhookDeliveryUseCase } from "../../../admin/features/resendWebhookDelivery/abstractions.js";
|
|
5
5
|
import { ListAvailableEventsUseCase } from "../../../admin/features/listAvailableEvents/abstractions.js";
|
|
6
|
+
import { ListWebhooksUseCase } from "../../../admin/features/ListWebhooks/abstractions.js";
|
|
6
7
|
import { type IWebhookDeliveriesPagePresenter, type IWebhookDeliveriesPageViewModel } from "./abstractions.js";
|
|
7
8
|
declare class WebhookDeliveriesPagePresenterImpl implements IWebhookDeliveriesPagePresenter {
|
|
8
9
|
private readonly listPresenter;
|
|
9
10
|
private readonly listDeliveriesUseCase;
|
|
10
11
|
private readonly listAvailableEventsUseCase;
|
|
11
12
|
private readonly resendDeliveryUseCase;
|
|
13
|
+
private readonly listWebhooksUseCase;
|
|
12
14
|
private _availableEvents;
|
|
15
|
+
private _availableWebhooks;
|
|
13
16
|
private _filters;
|
|
14
|
-
private _expandedDeliveryId;
|
|
15
17
|
private _resendingIds;
|
|
16
18
|
private _loading;
|
|
17
19
|
private _error;
|
|
18
|
-
constructor(listPresenter: ListPresenter.Interface<WebhookDelivery>, listDeliveriesUseCase: ListWebhookDeliveriesUseCase.Interface, listAvailableEventsUseCase: ListAvailableEventsUseCase.Interface, resendDeliveryUseCase: ResendWebhookDeliveryUseCase.Interface);
|
|
20
|
+
constructor(listPresenter: ListPresenter.Interface<WebhookDelivery>, listDeliveriesUseCase: ListWebhookDeliveriesUseCase.Interface, listAvailableEventsUseCase: ListAvailableEventsUseCase.Interface, resendDeliveryUseCase: ResendWebhookDeliveryUseCase.Interface, listWebhooksUseCase: ListWebhooksUseCase.Interface);
|
|
19
21
|
get vm(): IWebhookDeliveriesPageViewModel;
|
|
20
|
-
init(): Promise<void>;
|
|
22
|
+
init(webhookId?: string): Promise<void>;
|
|
23
|
+
clearFilters(): void;
|
|
24
|
+
setWebhookFilter(webhookId: string | null): void;
|
|
21
25
|
setAppFilter(app: string | null): void;
|
|
22
26
|
setEntityFilter(entity: string | null): void;
|
|
23
27
|
setEventFilter(eventName: string | null): void;
|
|
24
28
|
setStatusFilter(status: string[]): void;
|
|
25
|
-
expandDelivery(id: string | null): void;
|
|
26
29
|
loadMore(): Promise<void>;
|
|
27
30
|
resend(id: string): Promise<void>;
|
|
28
|
-
private
|
|
31
|
+
private _hasFilters;
|
|
32
|
+
private _syncFilters;
|
|
29
33
|
private _buildWhere;
|
|
30
34
|
private _computeAvailableApps;
|
|
31
35
|
private _computeAvailableEntities;
|
|
@@ -3,22 +3,26 @@ import { ListPresenter } from "@webiny/app-admin/presentation/listPresenter/abst
|
|
|
3
3
|
import { ListWebhookDeliveriesUseCase } from "../../features/listWebhookDeliveries/abstractions.js";
|
|
4
4
|
import { ResendWebhookDeliveryUseCase } from "../../features/resendWebhookDelivery/abstractions.js";
|
|
5
5
|
import { ListAvailableEventsUseCase } from "../../features/listAvailableEvents/abstractions.js";
|
|
6
|
-
import {
|
|
6
|
+
import { ListWebhooksUseCase } from "../../features/ListWebhooks/abstractions.js";
|
|
7
|
+
import { WebhookDeliveriesDataSource } from "./WebhookDeliveriesDataSource.js";
|
|
7
8
|
import { WebhookDeliveriesPagePresenter } from "./abstractions.js";
|
|
9
|
+
const createEmptyFilters = ()=>({
|
|
10
|
+
webhookId: null,
|
|
11
|
+
app: null,
|
|
12
|
+
entity: null,
|
|
13
|
+
eventName: null,
|
|
14
|
+
status: []
|
|
15
|
+
});
|
|
8
16
|
class WebhookDeliveriesPagePresenterImpl {
|
|
9
|
-
constructor(listPresenter, listDeliveriesUseCase, listAvailableEventsUseCase, resendDeliveryUseCase){
|
|
17
|
+
constructor(listPresenter, listDeliveriesUseCase, listAvailableEventsUseCase, resendDeliveryUseCase, listWebhooksUseCase){
|
|
10
18
|
this.listPresenter = listPresenter;
|
|
11
19
|
this.listDeliveriesUseCase = listDeliveriesUseCase;
|
|
12
20
|
this.listAvailableEventsUseCase = listAvailableEventsUseCase;
|
|
13
21
|
this.resendDeliveryUseCase = resendDeliveryUseCase;
|
|
22
|
+
this.listWebhooksUseCase = listWebhooksUseCase;
|
|
14
23
|
this._availableEvents = [];
|
|
15
|
-
this.
|
|
16
|
-
|
|
17
|
-
entity: null,
|
|
18
|
-
eventName: null,
|
|
19
|
-
status: []
|
|
20
|
-
};
|
|
21
|
-
this._expandedDeliveryId = null;
|
|
24
|
+
this._availableWebhooks = [];
|
|
25
|
+
this._filters = createEmptyFilters();
|
|
22
26
|
this._resendingIds = new Set();
|
|
23
27
|
this._loading = false;
|
|
24
28
|
this._error = null;
|
|
@@ -28,51 +32,82 @@ class WebhookDeliveriesPagePresenterImpl {
|
|
|
28
32
|
}
|
|
29
33
|
get vm() {
|
|
30
34
|
return {
|
|
35
|
+
availableWebhooks: this._availableWebhooks,
|
|
31
36
|
availableApps: this._computeAvailableApps(),
|
|
32
37
|
availableEntities: this._computeAvailableEntities(),
|
|
33
38
|
availableEventNames: this._computeAvailableEventNames(),
|
|
34
39
|
filters: {
|
|
35
40
|
...this._filters
|
|
36
41
|
},
|
|
42
|
+
hasFilters: this._hasFilters(),
|
|
37
43
|
list: this.listPresenter.vm,
|
|
38
|
-
expandedDeliveryId: this._expandedDeliveryId,
|
|
39
44
|
resendingIds: new Set(this._resendingIds),
|
|
40
|
-
loading: this._loading,
|
|
45
|
+
loading: this._loading || this.listPresenter.vm.pagination.loading,
|
|
41
46
|
error: this._error
|
|
42
47
|
};
|
|
43
48
|
}
|
|
44
|
-
async init() {
|
|
49
|
+
async init(webhookId) {
|
|
45
50
|
runInAction(()=>{
|
|
46
51
|
this._loading = true;
|
|
47
52
|
this._error = null;
|
|
53
|
+
if (webhookId) this._filters = {
|
|
54
|
+
...this._filters,
|
|
55
|
+
webhookId
|
|
56
|
+
};
|
|
48
57
|
});
|
|
49
58
|
try {
|
|
50
|
-
const events = await
|
|
59
|
+
const [events, webhooksResult] = await Promise.all([
|
|
60
|
+
this.listAvailableEventsUseCase.execute(),
|
|
61
|
+
this.listWebhooksUseCase.execute({
|
|
62
|
+
limit: 1000
|
|
63
|
+
})
|
|
64
|
+
]);
|
|
51
65
|
runInAction(()=>{
|
|
52
66
|
this._availableEvents = events;
|
|
67
|
+
this._availableWebhooks = webhooksResult.items.map((w)=>({
|
|
68
|
+
value: w.id,
|
|
69
|
+
label: w.name
|
|
70
|
+
}));
|
|
53
71
|
});
|
|
54
72
|
} catch (err) {
|
|
55
73
|
runInAction(()=>{
|
|
56
|
-
this._error = err instanceof Error ? err.message : "Failed to load
|
|
74
|
+
this._error = err instanceof Error ? err.message : "Failed to load data.";
|
|
57
75
|
});
|
|
58
76
|
} finally{
|
|
59
77
|
runInAction(()=>{
|
|
60
78
|
this._loading = false;
|
|
61
79
|
});
|
|
62
80
|
}
|
|
63
|
-
|
|
64
|
-
|
|
81
|
+
const dataSource = new WebhookDeliveriesDataSource(this.listDeliveriesUseCase);
|
|
82
|
+
this.listPresenter.init({
|
|
83
|
+
dataSource,
|
|
84
|
+
initialSort: {
|
|
85
|
+
field: "createdOn",
|
|
86
|
+
direction: "DESC"
|
|
87
|
+
},
|
|
88
|
+
initialFilters: this._buildWhere(),
|
|
89
|
+
limit: 20
|
|
65
90
|
});
|
|
66
91
|
}
|
|
92
|
+
clearFilters() {
|
|
93
|
+
this._filters = createEmptyFilters();
|
|
94
|
+
this.listPresenter.actions.filter.clearAll();
|
|
95
|
+
}
|
|
96
|
+
setWebhookFilter(webhookId) {
|
|
97
|
+
this._filters = {
|
|
98
|
+
...this._filters,
|
|
99
|
+
webhookId
|
|
100
|
+
};
|
|
101
|
+
this._syncFilters();
|
|
102
|
+
}
|
|
67
103
|
setAppFilter(app) {
|
|
68
104
|
this._filters = {
|
|
105
|
+
...this._filters,
|
|
69
106
|
app,
|
|
70
107
|
entity: null,
|
|
71
|
-
eventName: null
|
|
72
|
-
status: this._filters.status
|
|
108
|
+
eventName: null
|
|
73
109
|
};
|
|
74
|
-
this.
|
|
75
|
-
this._applyFilters();
|
|
110
|
+
this._syncFilters();
|
|
76
111
|
}
|
|
77
112
|
setEntityFilter(entity) {
|
|
78
113
|
this._filters = {
|
|
@@ -80,27 +115,21 @@ class WebhookDeliveriesPagePresenterImpl {
|
|
|
80
115
|
entity,
|
|
81
116
|
eventName: null
|
|
82
117
|
};
|
|
83
|
-
this.
|
|
84
|
-
this._applyFilters();
|
|
118
|
+
this._syncFilters();
|
|
85
119
|
}
|
|
86
120
|
setEventFilter(eventName) {
|
|
87
121
|
this._filters = {
|
|
88
122
|
...this._filters,
|
|
89
123
|
eventName
|
|
90
124
|
};
|
|
91
|
-
this.
|
|
92
|
-
this._applyFilters();
|
|
125
|
+
this._syncFilters();
|
|
93
126
|
}
|
|
94
127
|
setStatusFilter(status) {
|
|
95
128
|
this._filters = {
|
|
96
129
|
...this._filters,
|
|
97
130
|
status
|
|
98
131
|
};
|
|
99
|
-
this.
|
|
100
|
-
this._applyFilters();
|
|
101
|
-
}
|
|
102
|
-
expandDelivery(id) {
|
|
103
|
-
this._expandedDeliveryId = this._expandedDeliveryId === id ? null : id;
|
|
132
|
+
this._syncFilters();
|
|
104
133
|
}
|
|
105
134
|
async loadMore() {
|
|
106
135
|
await this.listPresenter.actions.loadMore();
|
|
@@ -118,20 +147,17 @@ class WebhookDeliveriesPagePresenterImpl {
|
|
|
118
147
|
});
|
|
119
148
|
}
|
|
120
149
|
}
|
|
121
|
-
|
|
150
|
+
_hasFilters() {
|
|
151
|
+
return null !== this._filters.webhookId || null !== this._filters.app || null !== this._filters.entity || null !== this._filters.eventName || this._filters.status.length > 0;
|
|
152
|
+
}
|
|
153
|
+
_syncFilters() {
|
|
122
154
|
const where = this._buildWhere();
|
|
123
|
-
|
|
124
|
-
this.listPresenter.
|
|
125
|
-
dataSource,
|
|
126
|
-
initialSort: {
|
|
127
|
-
field: "createdOn",
|
|
128
|
-
direction: "DESC"
|
|
129
|
-
},
|
|
130
|
-
limit: 20
|
|
131
|
-
});
|
|
155
|
+
this.listPresenter.actions.filter.clearAll();
|
|
156
|
+
for (const [key, value] of Object.entries(where))this.listPresenter.actions.filter.set(key, value);
|
|
132
157
|
}
|
|
133
158
|
_buildWhere() {
|
|
134
159
|
const where = {};
|
|
160
|
+
if (this._filters.webhookId) where.webhookId_eq = this._filters.webhookId;
|
|
135
161
|
const { app, entity, eventName } = this._filters;
|
|
136
162
|
if (app || entity || eventName) {
|
|
137
163
|
const matching = this._availableEvents.filter((event)=>{
|
|
@@ -188,7 +214,8 @@ const WebhookDeliveriesPagePresenter_WebhookDeliveriesPagePresenter = WebhookDel
|
|
|
188
214
|
ListPresenter,
|
|
189
215
|
ListWebhookDeliveriesUseCase,
|
|
190
216
|
ListAvailableEventsUseCase,
|
|
191
|
-
ResendWebhookDeliveryUseCase
|
|
217
|
+
ResendWebhookDeliveryUseCase,
|
|
218
|
+
ListWebhooksUseCase
|
|
192
219
|
]
|
|
193
220
|
});
|
|
194
221
|
export { WebhookDeliveriesPagePresenter_WebhookDeliveriesPagePresenter as WebhookDeliveriesPagePresenter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js","sources":["../../../../src/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.ts"],"sourcesContent":["import { makeAutoObservable, computed, runInAction } from \"mobx\";\nimport { ListPresenter } from \"@webiny/app-admin/presentation/listPresenter/abstractions.js\";\nimport type { WebhookDelivery, WebhookEvent } from \"~/admin/shared/types.js\";\nimport {\n ListWebhookDeliveriesUseCase,\n type ListWebhookDeliveriesWhere\n} from \"~/admin/features/listWebhookDeliveries/abstractions.js\";\nimport { ResendWebhookDeliveryUseCase } from \"~/admin/features/resendWebhookDelivery/abstractions.js\";\nimport { ListAvailableEventsUseCase } from \"~/admin/features/listAvailableEvents/abstractions.js\";\nimport { WebhookDeliveriesDataSource } from \"~/admin/presentation/WebhookDeliveries/WebhookDeliveriesDataSource.js\";\nimport {\n WebhookDeliveriesPagePresenter as Abstraction,\n type IWebhookDeliveriesPagePresenter,\n type IWebhookDeliveriesPageViewModel,\n type IDeliveryFilterOption,\n type IDeliveryPageFilters\n} from \"./abstractions.js\";\n\nclass WebhookDeliveriesPagePresenterImpl implements IWebhookDeliveriesPagePresenter {\n private _availableEvents: WebhookEvent[] = [];\n private _filters: IDeliveryPageFilters = {\n app: null,\n entity: null,\n eventName: null,\n status: []\n };\n private _expandedDeliveryId: string | null = null;\n private _resendingIds: Set<string> = new Set();\n private _loading = false;\n private _error: string | null = null;\n\n constructor(\n private readonly listPresenter: ListPresenter.Interface<WebhookDelivery>,\n private readonly listDeliveriesUseCase: ListWebhookDeliveriesUseCase.Interface,\n private readonly listAvailableEventsUseCase: ListAvailableEventsUseCase.Interface,\n private readonly resendDeliveryUseCase: ResendWebhookDeliveryUseCase.Interface\n ) {\n makeAutoObservable(this, { vm: computed });\n }\n\n get vm(): IWebhookDeliveriesPageViewModel {\n return {\n availableApps: this._computeAvailableApps(),\n availableEntities: this._computeAvailableEntities(),\n availableEventNames: this._computeAvailableEventNames(),\n filters: { ...this._filters },\n list: this.listPresenter.vm,\n expandedDeliveryId: this._expandedDeliveryId,\n resendingIds: new Set(this._resendingIds),\n loading: this._loading,\n error: this._error\n };\n }\n\n public async init(): Promise<void> {\n runInAction(() => {\n this._loading = true;\n this._error = null;\n });\n try {\n const events = await this.listAvailableEventsUseCase.execute();\n runInAction(() => {\n this._availableEvents = events;\n });\n } catch (err) {\n runInAction(() => {\n this._error = err instanceof Error ? err.message : \"Failed to load events.\";\n });\n } finally {\n runInAction(() => {\n this._loading = false;\n });\n }\n runInAction(() => {\n this._applyFilters();\n });\n }\n\n public setAppFilter(app: string | null): void {\n this._filters = { app, entity: null, eventName: null, status: this._filters.status };\n this._expandedDeliveryId = null;\n this._applyFilters();\n }\n\n public setEntityFilter(entity: string | null): void {\n this._filters = { ...this._filters, entity, eventName: null };\n this._expandedDeliveryId = null;\n this._applyFilters();\n }\n\n public setEventFilter(eventName: string | null): void {\n this._filters = { ...this._filters, eventName };\n this._expandedDeliveryId = null;\n this._applyFilters();\n }\n\n public setStatusFilter(status: string[]): void {\n this._filters = { ...this._filters, status };\n this._expandedDeliveryId = null;\n this._applyFilters();\n }\n\n public expandDelivery(id: string | null): void {\n this._expandedDeliveryId = this._expandedDeliveryId === id ? null : id;\n }\n\n public async loadMore(): Promise<void> {\n await this.listPresenter.actions.loadMore();\n }\n\n public async resend(id: string): Promise<void> {\n runInAction(() => {\n this._resendingIds.add(id);\n });\n try {\n await this.resendDeliveryUseCase.execute(id);\n await this.listPresenter.actions.refresh();\n } finally {\n runInAction(() => {\n this._resendingIds.delete(id);\n });\n }\n }\n\n private _applyFilters(): void {\n const where = this._buildWhere();\n const dataSource = new WebhookDeliveriesDataSource(this.listDeliveriesUseCase, where);\n this.listPresenter.init({\n dataSource,\n initialSort: { field: \"createdOn\", direction: \"DESC\" },\n limit: 20\n });\n }\n\n private _buildWhere(): ListWebhookDeliveriesWhere {\n const where: ListWebhookDeliveriesWhere = {};\n const { app, entity, eventName } = this._filters;\n\n if (app || entity || eventName) {\n const matching = this._availableEvents.filter(event => {\n if (app && event.app !== app) {\n return false;\n }\n if (entity && event.entity !== entity) {\n return false;\n }\n if (eventName && event.eventName !== eventName) {\n return false;\n }\n return true;\n });\n if (matching.length > 0) {\n where.eventType_in = matching.map(e => e.eventName);\n }\n }\n\n if (this._filters.status.length > 0) {\n where.status_in = this._filters.status;\n }\n\n return where;\n }\n\n private _computeAvailableApps(): IDeliveryFilterOption[] {\n const seen = new Set<string>();\n const result: IDeliveryFilterOption[] = [];\n for (const event of this._availableEvents) {\n if (!seen.has(event.app)) {\n seen.add(event.app);\n result.push({ value: event.app, label: event.appLabel });\n }\n }\n return result;\n }\n\n private _computeAvailableEntities(): IDeliveryFilterOption[] {\n if (!this._filters.app) {\n return [];\n }\n const seen = new Set<string>();\n const result: IDeliveryFilterOption[] = [];\n for (const event of this._availableEvents) {\n if (event.app === this._filters.app && !seen.has(event.entity)) {\n seen.add(event.entity);\n result.push({ value: event.entity, label: event.entityLabel });\n }\n }\n return result;\n }\n\n private _computeAvailableEventNames(): IDeliveryFilterOption[] {\n if (!this._filters.app) {\n return [];\n }\n return this._availableEvents\n .filter(event => {\n if (event.app !== this._filters.app) {\n return false;\n }\n if (this._filters.entity && event.entity !== this._filters.entity) {\n return false;\n }\n return true;\n })\n .map(event => ({ value: event.eventName, label: event.label }));\n }\n}\n\nexport const WebhookDeliveriesPagePresenter = Abstraction.createImplementation({\n implementation: WebhookDeliveriesPagePresenterImpl,\n dependencies: [\n ListPresenter,\n ListWebhookDeliveriesUseCase,\n ListAvailableEventsUseCase,\n ResendWebhookDeliveryUseCase\n ]\n});\n"],"names":["WebhookDeliveriesPagePresenterImpl","listPresenter","listDeliveriesUseCase","listAvailableEventsUseCase","resendDeliveryUseCase","Set","makeAutoObservable","computed","runInAction","events","err","Error","app","entity","eventName","status","id","where","dataSource","WebhookDeliveriesDataSource","matching","event","e","seen","result","WebhookDeliveriesPagePresenter","Abstraction","ListPresenter","ListWebhookDeliveriesUseCase","ListAvailableEventsUseCase","ResendWebhookDeliveryUseCase"],"mappings":";;;;;;;AAkBA,MAAMA;IAaF,YACqBC,aAAuD,EACvDC,qBAA6D,EAC7DC,0BAAgE,EAChEC,qBAA6D,CAChF;aAJmBH,aAAa,GAAbA;aACAC,qBAAqB,GAArBA;aACAC,0BAA0B,GAA1BA;aACAC,qBAAqB,GAArBA;aAhBb,gBAAgB,GAAmB,EAAE;aACrC,QAAQ,GAAyB;YACrC,KAAK;YACL,QAAQ;YACR,WAAW;YACX,QAAQ,EAAE;QACd;aACQ,mBAAmB,GAAkB;aACrC,aAAa,GAAgB,IAAIC;aACjC,QAAQ,GAAG;aACX,MAAM,GAAkB;QAQ5BC,mBAAmB,IAAI,EAAE;YAAE,IAAIC;QAAS;IAC5C;IAEA,IAAI,KAAsC;QACtC,OAAO;YACH,eAAe,IAAI,CAAC,qBAAqB;YACzC,mBAAmB,IAAI,CAAC,yBAAyB;YACjD,qBAAqB,IAAI,CAAC,2BAA2B;YACrD,SAAS;gBAAE,GAAG,IAAI,CAAC,QAAQ;YAAC;YAC5B,MAAM,IAAI,CAAC,aAAa,CAAC,EAAE;YAC3B,oBAAoB,IAAI,CAAC,mBAAmB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AM,IAAIA,MAAM,MAAM,KAAK,IAAI,CAAC,QAAQ,CAAC,MAAM,EAC7D,OAAO;YAEX,OAAO;QACX,GACC,GAAG,CAACA,CAAAA,QAAU;gBAAE,OAAOA,MAAM,SAAS;gBAAE,OAAOA,MAAM,KAAK;YAAC;IACpE;AACJ;AAEO,MAAMI,gEAAiCC,+BAAAA,oBAAgC,CAAC;IAC3E,gBAAgB1B;IAChB,cAAc;QACV2B;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js","sources":["../../../../src/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.ts"],"sourcesContent":["import { makeAutoObservable, computed, runInAction } from \"mobx\";\nimport { ListPresenter } from \"@webiny/app-admin/presentation/listPresenter/abstractions.js\";\nimport type { WebhookDelivery, WebhookEvent } from \"~/admin/shared/types.js\";\nimport { ListWebhookDeliveriesUseCase } from \"~/admin/features/listWebhookDeliveries/abstractions.js\";\nimport { ResendWebhookDeliveryUseCase } from \"~/admin/features/resendWebhookDelivery/abstractions.js\";\nimport { ListAvailableEventsUseCase } from \"~/admin/features/listAvailableEvents/abstractions.js\";\nimport { ListWebhooksUseCase } from \"~/admin/features/ListWebhooks/abstractions.js\";\nimport { WebhookDeliveriesDataSource } from \"./WebhookDeliveriesDataSource.js\";\nimport {\n WebhookDeliveriesPagePresenter as Abstraction,\n type IWebhookDeliveriesPagePresenter,\n type IWebhookDeliveriesPageViewModel,\n type IDeliveryFilterOption,\n type IDeliveryPageFilters\n} from \"./abstractions.js\";\n\nconst createEmptyFilters = (): IDeliveryPageFilters => {\n return {\n webhookId: null,\n app: null,\n entity: null,\n eventName: null,\n status: []\n };\n};\n\nclass WebhookDeliveriesPagePresenterImpl implements IWebhookDeliveriesPagePresenter {\n private _availableEvents: WebhookEvent[] = [];\n private _availableWebhooks: IDeliveryFilterOption[] = [];\n private _filters: IDeliveryPageFilters = createEmptyFilters();\n private _resendingIds: Set<string> = new Set();\n private _loading = false;\n private _error: string | null = null;\n\n constructor(\n private readonly listPresenter: ListPresenter.Interface<WebhookDelivery>,\n private readonly listDeliveriesUseCase: ListWebhookDeliveriesUseCase.Interface,\n private readonly listAvailableEventsUseCase: ListAvailableEventsUseCase.Interface,\n private readonly resendDeliveryUseCase: ResendWebhookDeliveryUseCase.Interface,\n private readonly listWebhooksUseCase: ListWebhooksUseCase.Interface\n ) {\n makeAutoObservable(this, { vm: computed });\n }\n\n get vm(): IWebhookDeliveriesPageViewModel {\n return {\n availableWebhooks: this._availableWebhooks,\n availableApps: this._computeAvailableApps(),\n availableEntities: this._computeAvailableEntities(),\n availableEventNames: this._computeAvailableEventNames(),\n filters: { ...this._filters },\n hasFilters: this._hasFilters(),\n list: this.listPresenter.vm,\n resendingIds: new Set(this._resendingIds),\n loading: this._loading || this.listPresenter.vm.pagination.loading,\n error: this._error\n };\n }\n\n public async init(webhookId?: string): Promise<void> {\n runInAction(() => {\n this._loading = true;\n this._error = null;\n if (webhookId) {\n this._filters = { ...this._filters, webhookId };\n }\n });\n try {\n const [events, webhooksResult] = await Promise.all([\n this.listAvailableEventsUseCase.execute(),\n this.listWebhooksUseCase.execute({ limit: 1000 })\n ]);\n runInAction(() => {\n this._availableEvents = events;\n this._availableWebhooks = webhooksResult.items.map(w => ({\n value: w.id,\n label: w.name\n }));\n });\n } catch (err) {\n runInAction(() => {\n this._error = err instanceof Error ? err.message : \"Failed to load data.\";\n });\n } finally {\n runInAction(() => {\n this._loading = false;\n });\n }\n\n const dataSource = new WebhookDeliveriesDataSource(this.listDeliveriesUseCase);\n this.listPresenter.init({\n dataSource,\n initialSort: { field: \"createdOn\", direction: \"DESC\" },\n initialFilters: this._buildWhere(),\n limit: 20\n });\n }\n\n public clearFilters(): void {\n this._filters = createEmptyFilters();\n this.listPresenter.actions.filter.clearAll();\n }\n\n public setWebhookFilter(webhookId: string | null): void {\n this._filters = { ...this._filters, webhookId };\n this._syncFilters();\n }\n\n public setAppFilter(app: string | null): void {\n this._filters = { ...this._filters, app, entity: null, eventName: null };\n this._syncFilters();\n }\n\n public setEntityFilter(entity: string | null): void {\n this._filters = { ...this._filters, entity, eventName: null };\n this._syncFilters();\n }\n\n public setEventFilter(eventName: string | null): void {\n this._filters = { ...this._filters, eventName };\n this._syncFilters();\n }\n\n public setStatusFilter(status: string[]): void {\n this._filters = { ...this._filters, status };\n this._syncFilters();\n }\n\n public async loadMore(): Promise<void> {\n await this.listPresenter.actions.loadMore();\n }\n\n public async resend(id: string): Promise<void> {\n runInAction(() => {\n this._resendingIds.add(id);\n });\n try {\n await this.resendDeliveryUseCase.execute(id);\n await this.listPresenter.actions.refresh();\n } finally {\n runInAction(() => {\n this._resendingIds.delete(id);\n });\n }\n }\n\n private _hasFilters(): boolean {\n return (\n this._filters.webhookId !== null ||\n this._filters.app !== null ||\n this._filters.entity !== null ||\n this._filters.eventName !== null ||\n this._filters.status.length > 0\n );\n }\n\n private _syncFilters(): void {\n const where = this._buildWhere();\n this.listPresenter.actions.filter.clearAll();\n for (const [key, value] of Object.entries(where)) {\n this.listPresenter.actions.filter.set(key, value);\n }\n }\n\n private _buildWhere(): Record<string, unknown> {\n const where: Record<string, unknown> = {};\n\n if (this._filters.webhookId) {\n where.webhookId_eq = this._filters.webhookId;\n }\n\n const { app, entity, eventName } = this._filters;\n\n if (app || entity || eventName) {\n const matching = this._availableEvents.filter(event => {\n if (app && event.app !== app) {\n return false;\n }\n if (entity && event.entity !== entity) {\n return false;\n }\n if (eventName && event.eventName !== eventName) {\n return false;\n }\n return true;\n });\n if (matching.length > 0) {\n where.eventType_in = matching.map(e => e.eventName);\n }\n }\n\n if (this._filters.status.length > 0) {\n where.status_in = this._filters.status;\n }\n\n return where;\n }\n\n private _computeAvailableApps(): IDeliveryFilterOption[] {\n const seen = new Set<string>();\n const result: IDeliveryFilterOption[] = [];\n for (const event of this._availableEvents) {\n if (!seen.has(event.app)) {\n seen.add(event.app);\n result.push({ value: event.app, label: event.appLabel });\n }\n }\n return result;\n }\n\n private _computeAvailableEntities(): IDeliveryFilterOption[] {\n if (!this._filters.app) {\n return [];\n }\n const seen = new Set<string>();\n const result: IDeliveryFilterOption[] = [];\n for (const event of this._availableEvents) {\n if (event.app === this._filters.app && !seen.has(event.entity)) {\n seen.add(event.entity);\n result.push({ value: event.entity, label: event.entityLabel });\n }\n }\n return result;\n }\n\n private _computeAvailableEventNames(): IDeliveryFilterOption[] {\n if (!this._filters.app) {\n return [];\n }\n return this._availableEvents\n .filter(event => {\n if (event.app !== this._filters.app) {\n return false;\n }\n if (this._filters.entity && event.entity !== this._filters.entity) {\n return false;\n }\n return true;\n })\n .map(event => ({ value: event.eventName, label: event.label }));\n }\n}\n\nexport const WebhookDeliveriesPagePresenter = Abstraction.createImplementation({\n implementation: WebhookDeliveriesPagePresenterImpl,\n dependencies: [\n ListPresenter,\n ListWebhookDeliveriesUseCase,\n ListAvailableEventsUseCase,\n ResendWebhookDeliveryUseCase,\n ListWebhooksUseCase\n ]\n});\n"],"names":["createEmptyFilters","WebhookDeliveriesPagePresenterImpl","listPresenter","listDeliveriesUseCase","listAvailableEventsUseCase","resendDeliveryUseCase","listWebhooksUseCase","Set","makeAutoObservable","computed","webhookId","runInAction","events","webhooksResult","Promise","w","err","Error","dataSource","WebhookDeliveriesDataSource","app","entity","eventName","status","id","where","key","value","Object","matching","event","e","seen","result","WebhookDeliveriesPagePresenter","Abstraction","ListPresenter","ListWebhookDeliveriesUseCase","ListAvailableEventsUseCase","ResendWebhookDeliveryUseCase","ListWebhooksUseCase"],"mappings":";;;;;;;;AAgBA,MAAMA,qBAAqB,IAChB;QACH,WAAW;QACX,KAAK;QACL,QAAQ;QACR,WAAW;QACX,QAAQ,EAAE;IACd;AAGJ,MAAMC;IAQF,YACqBC,aAAuD,EACvDC,qBAA6D,EAC7DC,0BAAgE,EAChEC,qBAA6D,EAC7DC,mBAAkD,CACrE;aALmBJ,aAAa,GAAbA;aACAC,qBAAqB,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BAAE,OAAOA,MAAM,WAAW;YAAC;QAChE;QAEJ,OAAOG;IACX;IAEQ,8BAAuD;QAC3D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAClB,OAAO,EAAE;QAEb,OAAO,IAAI,CAAC,gBAAgB,CACvB,MAAM,CAACH,CAAAA;YACJ,IAAIA,MAAM,GAAG,KAAK,IAAI,CAAC,QAAQ,CAAC,GAAG,EAC/B,OAAO;YAEX,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAIA,MAAM,MAAM,KAAK,IAAI,CAAC,QAAQ,CAAC,MAAM,EAC7D,OAAO;YAEX,OAAO;QACX,GACC,GAAG,CAACA,CAAAA,QAAU;gBAAE,OAAOA,MAAM,SAAS;gBAAE,OAAOA,MAAM,KAAK;YAAC;IACpE;AACJ;AAEO,MAAMI,gEAAiCC,+BAAAA,oBAAgC,CAAC;IAC3E,gBAAgBlC;IAChB,cAAc;QACVmC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { WebhookDelivery } from "../../../admin/shared/types.js";
|
|
2
2
|
import type { IListViewModel } from "@webiny/app-admin/presentation/listPresenter/abstractions.js";
|
|
3
3
|
export interface IDeliveryPageFilters {
|
|
4
|
+
webhookId: string | null;
|
|
4
5
|
app: string | null;
|
|
5
6
|
entity: string | null;
|
|
6
7
|
eventName: string | null;
|
|
@@ -11,24 +12,26 @@ export interface IDeliveryFilterOption {
|
|
|
11
12
|
label: string;
|
|
12
13
|
}
|
|
13
14
|
export interface IWebhookDeliveriesPageViewModel {
|
|
15
|
+
availableWebhooks: IDeliveryFilterOption[];
|
|
14
16
|
availableApps: IDeliveryFilterOption[];
|
|
15
17
|
availableEntities: IDeliveryFilterOption[];
|
|
16
18
|
availableEventNames: IDeliveryFilterOption[];
|
|
17
19
|
filters: IDeliveryPageFilters;
|
|
18
20
|
list: IListViewModel<WebhookDelivery>;
|
|
19
|
-
expandedDeliveryId: string | null;
|
|
20
21
|
resendingIds: Set<string>;
|
|
22
|
+
hasFilters: boolean;
|
|
21
23
|
loading: boolean;
|
|
22
24
|
error: string | null;
|
|
23
25
|
}
|
|
24
26
|
export interface IWebhookDeliveriesPagePresenter {
|
|
25
27
|
vm: IWebhookDeliveriesPageViewModel;
|
|
26
|
-
init(): Promise<void>;
|
|
28
|
+
init(webhookId?: string): Promise<void>;
|
|
29
|
+
setWebhookFilter(webhookId: string | null): void;
|
|
27
30
|
setAppFilter(app: string | null): void;
|
|
28
31
|
setEntityFilter(entity: string | null): void;
|
|
29
32
|
setEventFilter(eventName: string | null): void;
|
|
30
33
|
setStatusFilter(status: string[]): void;
|
|
31
|
-
|
|
34
|
+
clearFilters(): void;
|
|
32
35
|
loadMore(): Promise<void>;
|
|
33
36
|
resend(id: string): Promise<void>;
|
|
34
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/abstractions.js","sources":["../../../../src/admin/presentation/WebhookDeliveriesPage/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\nimport type { IListViewModel } from \"@webiny/app-admin/presentation/listPresenter/abstractions.js\";\n\nexport interface IDeliveryPageFilters {\n app: string | null;\n entity: string | null;\n eventName: string | null;\n status: string[];\n}\n\nexport interface IDeliveryFilterOption {\n value: string;\n label: string;\n}\n\nexport interface IWebhookDeliveriesPageViewModel {\n availableApps: IDeliveryFilterOption[];\n availableEntities: IDeliveryFilterOption[];\n availableEventNames: IDeliveryFilterOption[];\n filters: IDeliveryPageFilters;\n list: IListViewModel<WebhookDelivery>;\n
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/abstractions.js","sources":["../../../../src/admin/presentation/WebhookDeliveriesPage/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\nimport type { IListViewModel } from \"@webiny/app-admin/presentation/listPresenter/abstractions.js\";\n\nexport interface IDeliveryPageFilters {\n webhookId: string | null;\n app: string | null;\n entity: string | null;\n eventName: string | null;\n status: string[];\n}\n\nexport interface IDeliveryFilterOption {\n value: string;\n label: string;\n}\n\nexport interface IWebhookDeliveriesPageViewModel {\n availableWebhooks: IDeliveryFilterOption[];\n availableApps: IDeliveryFilterOption[];\n availableEntities: IDeliveryFilterOption[];\n availableEventNames: IDeliveryFilterOption[];\n filters: IDeliveryPageFilters;\n list: IListViewModel<WebhookDelivery>;\n resendingIds: Set<string>;\n hasFilters: boolean;\n loading: boolean;\n error: string | null;\n}\n\nexport interface IWebhookDeliveriesPagePresenter {\n vm: IWebhookDeliveriesPageViewModel;\n init(webhookId?: string): Promise<void>;\n setWebhookFilter(webhookId: string | null): void;\n setAppFilter(app: string | null): void;\n setEntityFilter(entity: string | null): void;\n setEventFilter(eventName: string | null): void;\n setStatusFilter(status: string[]): void;\n clearFilters(): void;\n loadMore(): Promise<void>;\n resend(id: string): Promise<void>;\n}\n\nexport const WebhookDeliveriesPagePresenter = createAbstraction<IWebhookDeliveriesPagePresenter>(\n \"WebhookDeliveriesPagePresenter\"\n);\n\nexport namespace WebhookDeliveriesPagePresenter {\n export type Interface = IWebhookDeliveriesPagePresenter;\n export type ViewModel = IWebhookDeliveriesPageViewModel;\n}\n"],"names":["WebhookDeliveriesPagePresenter","createAbstraction"],"mappings":";AA2CO,MAAMA,iCAAiCC,kBAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.tsx"],"sourcesContent":["import React from \"react\";\nimport { Accordion, Tag, Text, TimeAgo } from \"@webiny/admin-ui\";\nimport { ReactComponent as ReplayIcon } from \"@webiny/icons/replay.svg\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\nimport { DeliveryDetailContent } from \"./DeliveryDetailContent.js\";\nimport { statusVariant } from \"./statusVariant.js\";\n\ninterface DeliveryAccordionRowProps {\n delivery: WebhookDelivery;\n open: boolean;\n resending: boolean;\n onOpenChange: (open: boolean) => void;\n onResend: (id: string) => void;\n}\n\nexport const DeliveryAccordionRow = ({\n delivery,\n open,\n resending,\n onOpenChange,\n onResend\n}: DeliveryAccordionRowProps) => {\n return (\n <Accordion.Item\n open={open}\n onOpenChange={onOpenChange}\n title={delivery.eventType}\n description={\n <div className=\"flex items-center gap-sm\">\n <Tag variant={statusVariant(delivery.status)} content={delivery.status} />\n {delivery.responseStatus !== null ? (\n <Text size=\"sm\">HTTP {delivery.responseStatus}</Text>\n ) : null}\n {delivery.responseTime ? (\n <Text size=\"sm\">{delivery.responseTime}ms</Text>\n ) : null}\n <Text size=\"sm\" className=\"text-neutral-strong\">\n <TimeAgo datetime={delivery.createdOn} />\n </Text>\n </div>\n }\n actions={\n <Accordion.Item.Action\n icon={<ReplayIcon />}\n onClick={() => onResend(delivery.id)}\n aria-label=\"Resend delivery\"\n disabled={resending}\n />\n }\n >\n <DeliveryDetailContent delivery={delivery} />\n </Accordion.Item>\n );\n};\n"],"names":["DeliveryAccordionRow","delivery","open","resending","onOpenChange","onResend","Accordion","Tag","statusVariant","Text","TimeAgo","ReplayIcon","DeliveryDetailContent"],"mappings":";;;;;AAeO,MAAMA,uBAAuB,CAAC,EACjCC,QAAQ,EACRC,IAAI,EACJC,SAAS,EACTC,YAAY,EACZC,QAAQ,EACgB,GACjB,WAAP,GACI,oBAACC,UAAU,IAAI;QACX,MAAMJ;QACN,cAAcE;QACd,OAAOH,SAAS,SAAS;QACzB,2BACI,oBAAC;YAAI,WAAU;yBACX,oBAACM,KAAGA;YAAC,SAASC,cAAcP,SAAS,MAAM;YAAG,SAASA,SAAS,MAAM;YACrEA,AAA4B,SAA5BA,SAAS,cAAc,GAAY,WAAP,GACzB,oBAACQ,MAAIA;YAAC,MAAK;WAAK,SAAMR,SAAS,cAAc,IAC7C,MACHA,SAAS,YAAY,GAAG,WAAH,GAClB,oBAACQ,MAAIA;YAAC,MAAK;WAAMR,SAAS,YAAY,EAAC,QACvC,oBACJ,oBAACQ,MAAIA;YAAC,MAAK;YAAK,WAAU;yBACtB,oBAACC,SAAOA;YAAC,UAAUT,SAAS,SAAS;;QAIjD,uBACI,oBAACK,UAAU,IAAI,CAAC,MAAM;YAClB,oBAAM,oBAACK,gBAAUA;YACjB,SAAS,IAAMN,SAASJ,SAAS,EAAE;YACnC,cAAW;YACX,UAAUE;;qBAIlB,oBAACS,uBAAqBA;QAAC,UAAUX"}
|