@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/features/SendWebhookTask/SendWebhookTask.js","sources":["../../../../src/api/features/SendWebhookTask/SendWebhookTask.ts"],"sourcesContent":["import \"@webiny/tasks/types.js\";\nimport { TaskDefinition } from \"@webiny/api-core/exports/api/tasks.js\";\nimport { TenantContext } from \"@webiny/api-core/exports/api/tenancy.js\";\nimport { WebhookSignPayload } from \"@webiny/api-core/features/webhooks/index.js\";\nimport { GetWebhookRepository } from \"~/api/features/GetWebhook/abstractions.js\";\nimport { GetWebhookDeliveryRepository } from \"~/api/features/GetWebhookDelivery/abstractions.js\";\nimport { UpdateWebhookDeliveryRepository } from \"~/api/features/UpdateWebhookDelivery/abstractions.js\";\nimport { GetWebhookSettingsRepository } from \"~/api/features/GetWebhookSettings/abstractions.js\";\nimport { WebhookDeliver } from \"~/api/features/WebhookDeliver/abstractions.js\";\nimport { SEND_WEBHOOK_TASK } from \"~/api/domain/constants.js\";\nimport type { ISendWebhookTaskInput, ISendWebhookTaskOutput, IWebhookPayload } from \"./types.js\";\nimport type { IWebhookSignPayloadHeaders } from \"@webiny/api-core/features/webhooks/WebhookSignPayload/abstractions.js\";\n\ntype IRunParams = TaskDefinition.RunParams<ISendWebhookTaskInput, ISendWebhookTaskOutput>;\n\nclass SendWebhookTaskDefinition implements TaskDefinition.Interface<\n ISendWebhookTaskInput,\n ISendWebhookTaskOutput\n> {\n public readonly id = SEND_WEBHOOK_TASK;\n public readonly title = \"Send Webhook\";\n public readonly maxIterations = 1;\n public readonly isPrivate = true;\n public readonly databaseLogs = false;\n public readonly description =\n \"POST a signed event payload to a webhook endpoint and log the delivery.\";\n public readonly selfCleanup = \"always\";\n\n public constructor(\n private readonly getWebhookRepository: GetWebhookRepository.Interface,\n private readonly getWebhookDeliveryRepository: GetWebhookDeliveryRepository.Interface,\n private readonly updateDeliveryRepository: UpdateWebhookDeliveryRepository.Interface,\n private readonly signPayload: WebhookSignPayload.Interface,\n private readonly tenantContext: TenantContext.Interface,\n private readonly getWebhookSettingsRepository: GetWebhookSettingsRepository.Interface,\n private readonly deliver: WebhookDeliver.Interface\n ) {}\n\n public async run(params: IRunParams) {\n const { input, controller } = params;\n const taskId = controller.state.getTask().id;\n\n const delivery = await this.getWebhookDeliveryRepository.execute(input.deliveryId);\n if (delivery.isFail()) {\n return controller.response.error(delivery.error);\n }\n\n await this.updateDeliveryRepository.execute(input.deliveryId, {\n backgroundTaskId: taskId,\n status: \"delivering\"\n });\n\n const webhookResult = await this.getWebhookRepository.execute(input.webhookId);\n if (webhookResult.isFail()) {\n await this.updateDeliveryRepository.execute(input.deliveryId, { status: \"failed\" });\n return controller.response.error(webhookResult.error);\n }\n const webhook = webhookResult.value;\n\n const now = new Date();\n const payload: IWebhookPayload = {\n id: taskId,\n event: input.eventName,\n timestamp: now.toISOString(),\n webhookId: input.webhookId,\n deliveryId: input.deliveryId,\n tenant: this.tenantContext.getTenant().id,\n data: delivery.value.payload\n };\n const rawBody = JSON.stringify(payload);\n let signHeaders: IWebhookSignPayloadHeaders;\n\n const settingsResult = await this.getWebhookSettingsRepository.execute();\n if (settingsResult.isFail()) {\n await this.updateDeliveryRepository.execute(input.deliveryId, { status: \"failed\" });\n return controller.response.error(settingsResult.error);\n }\n const signingSecret = webhook.signingSecret || settingsResult.value.signingSecret || \"\";\n\n try {\n signHeaders = await this.signPayload.sign(taskId, now, rawBody, signingSecret);\n } catch (ex) {\n await this.updateDeliveryRepository.execute(input.deliveryId, { status: \"failed\" });\n return controller.response.error(ex);\n }\n\n const requestHeaders: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n ...signHeaders\n };\n\n const result = await this.deliver.execute({\n url: webhook.endpointUrl,\n headers: requestHeaders,\n body: rawBody,\n timeout: 600_000,\n maxRetries: 3,\n initialDelay: 1000,\n maxDelay: 30_000\n });\n\n await this.updateDeliveryRepository.execute(input.deliveryId, {\n payload,\n requestHeaders,\n responseTime: result.responseTime,\n responseStatus: result.status,\n responseBody: result.body,\n status: result.status > 0 ? \"delivered\" : \"failed\"\n });\n\n return controller.response.done();\n }\n}\n\nexport const SendWebhookTask = TaskDefinition.createImplementation({\n implementation: SendWebhookTaskDefinition,\n dependencies: [\n GetWebhookRepository,\n GetWebhookDeliveryRepository,\n UpdateWebhookDeliveryRepository,\n WebhookSignPayload,\n TenantContext,\n GetWebhookSettingsRepository,\n WebhookDeliver\n ]\n});\n"],"names":["SendWebhookTaskDefinition","getWebhookRepository","getWebhookDeliveryRepository","updateDeliveryRepository","signPayload","tenantContext","getWebhookSettingsRepository","deliver","SEND_WEBHOOK_TASK","params","input","controller","taskId","delivery","webhookResult","webhook","now","Date","payload","rawBody","JSON","signHeaders","settingsResult","signingSecret","ex","requestHeaders","result","SendWebhookTask","TaskDefinition","GetWebhookRepository","GetWebhookDeliveryRepository","UpdateWebhookDeliveryRepository","WebhookSignPayload","TenantContext","GetWebhookSettingsRepository","WebhookDeliver"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"api/features/SendWebhookTask/SendWebhookTask.js","sources":["../../../../src/api/features/SendWebhookTask/SendWebhookTask.ts"],"sourcesContent":["import \"@webiny/background-tasks/api/types.js\";\nimport { TaskDefinition } from \"@webiny/api-core/exports/api/tasks.js\";\nimport { TenantContext } from \"@webiny/api-core/exports/api/tenancy.js\";\nimport { WebhookSignPayload } from \"@webiny/api-core/features/webhooks/index.js\";\nimport { GetWebhookRepository } from \"~/api/features/GetWebhook/abstractions.js\";\nimport { GetWebhookDeliveryRepository } from \"~/api/features/GetWebhookDelivery/abstractions.js\";\nimport { UpdateWebhookDeliveryRepository } from \"~/api/features/UpdateWebhookDelivery/abstractions.js\";\nimport { GetWebhookSettingsRepository } from \"~/api/features/GetWebhookSettings/abstractions.js\";\nimport { WebhookDeliver } from \"~/api/features/WebhookDeliver/abstractions.js\";\nimport { SEND_WEBHOOK_TASK } from \"~/api/domain/constants.js\";\nimport type { ISendWebhookTaskInput, ISendWebhookTaskOutput, IWebhookPayload } from \"./types.js\";\nimport type { IWebhookSignPayloadHeaders } from \"@webiny/api-core/features/webhooks/WebhookSignPayload/abstractions.js\";\n\ntype IRunParams = TaskDefinition.RunParams<ISendWebhookTaskInput, ISendWebhookTaskOutput>;\n\nclass SendWebhookTaskDefinition implements TaskDefinition.Interface<\n ISendWebhookTaskInput,\n ISendWebhookTaskOutput\n> {\n public readonly id = SEND_WEBHOOK_TASK;\n public readonly title = \"Send Webhook\";\n public readonly maxIterations = 1;\n public readonly isPrivate = true;\n public readonly databaseLogs = false;\n public readonly description =\n \"POST a signed event payload to a webhook endpoint and log the delivery.\";\n public readonly selfCleanup = \"always\";\n\n public constructor(\n private readonly getWebhookRepository: GetWebhookRepository.Interface,\n private readonly getWebhookDeliveryRepository: GetWebhookDeliveryRepository.Interface,\n private readonly updateDeliveryRepository: UpdateWebhookDeliveryRepository.Interface,\n private readonly signPayload: WebhookSignPayload.Interface,\n private readonly tenantContext: TenantContext.Interface,\n private readonly getWebhookSettingsRepository: GetWebhookSettingsRepository.Interface,\n private readonly deliver: WebhookDeliver.Interface\n ) {}\n\n public async run(params: IRunParams) {\n const { input, controller } = params;\n const taskId = controller.state.getTask().id;\n\n const delivery = await this.getWebhookDeliveryRepository.execute(input.deliveryId);\n if (delivery.isFail()) {\n return controller.response.error(delivery.error);\n }\n\n await this.updateDeliveryRepository.execute(input.deliveryId, {\n backgroundTaskId: taskId,\n status: \"delivering\"\n });\n\n const webhookResult = await this.getWebhookRepository.execute(input.webhookId);\n if (webhookResult.isFail()) {\n await this.updateDeliveryRepository.execute(input.deliveryId, { status: \"failed\" });\n return controller.response.error(webhookResult.error);\n }\n const webhook = webhookResult.value;\n\n const now = new Date();\n const payload: IWebhookPayload = {\n id: taskId,\n event: input.eventName,\n timestamp: now.toISOString(),\n webhookId: input.webhookId,\n deliveryId: input.deliveryId,\n tenant: this.tenantContext.getTenant().id,\n data: delivery.value.payload\n };\n const rawBody = JSON.stringify(payload);\n let signHeaders: IWebhookSignPayloadHeaders;\n\n const settingsResult = await this.getWebhookSettingsRepository.execute();\n if (settingsResult.isFail()) {\n await this.updateDeliveryRepository.execute(input.deliveryId, { status: \"failed\" });\n return controller.response.error(settingsResult.error);\n }\n const signingSecret = webhook.signingSecret || settingsResult.value.signingSecret || \"\";\n\n try {\n signHeaders = await this.signPayload.sign(taskId, now, rawBody, signingSecret);\n } catch (ex) {\n await this.updateDeliveryRepository.execute(input.deliveryId, { status: \"failed\" });\n return controller.response.error(ex);\n }\n\n const requestHeaders: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n ...signHeaders\n };\n\n const result = await this.deliver.execute({\n url: webhook.endpointUrl,\n headers: requestHeaders,\n body: rawBody,\n timeout: 600_000,\n maxRetries: 3,\n initialDelay: 1000,\n maxDelay: 30_000\n });\n\n await this.updateDeliveryRepository.execute(input.deliveryId, {\n payload,\n requestHeaders,\n responseTime: result.responseTime,\n responseStatus: result.status,\n responseBody: result.body,\n status: result.status > 0 ? \"delivered\" : \"failed\"\n });\n\n return controller.response.done();\n }\n}\n\nexport const SendWebhookTask = TaskDefinition.createImplementation({\n implementation: SendWebhookTaskDefinition,\n dependencies: [\n GetWebhookRepository,\n GetWebhookDeliveryRepository,\n UpdateWebhookDeliveryRepository,\n WebhookSignPayload,\n TenantContext,\n GetWebhookSettingsRepository,\n WebhookDeliver\n ]\n});\n"],"names":["SendWebhookTaskDefinition","getWebhookRepository","getWebhookDeliveryRepository","updateDeliveryRepository","signPayload","tenantContext","getWebhookSettingsRepository","deliver","SEND_WEBHOOK_TASK","params","input","controller","taskId","delivery","webhookResult","webhook","now","Date","payload","rawBody","JSON","signHeaders","settingsResult","signingSecret","ex","requestHeaders","result","SendWebhookTask","TaskDefinition","GetWebhookRepository","GetWebhookDeliveryRepository","UpdateWebhookDeliveryRepository","WebhookSignPayload","TenantContext","GetWebhookSettingsRepository","WebhookDeliver"],"mappings":"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"}
|
|
@@ -12,6 +12,7 @@ class WebhookCrudSchema_ {
|
|
|
12
12
|
code: String
|
|
13
13
|
message: String
|
|
14
14
|
data: JSON
|
|
15
|
+
stack: String
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
type WebhookListMeta {
|
|
@@ -66,9 +67,19 @@ class WebhookCrudSchema_ {
|
|
|
66
67
|
enabled: Boolean
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
enum ListWebhooksSort {
|
|
71
|
+
createdOn_ASC
|
|
72
|
+
createdOn_DESC
|
|
73
|
+
modifiedOn_ASC
|
|
74
|
+
modifiedOn_DESC
|
|
75
|
+
name_ASC
|
|
76
|
+
name_DESC
|
|
77
|
+
}
|
|
78
|
+
|
|
69
79
|
type WebhookQuery {
|
|
70
80
|
listWebhooks(
|
|
71
81
|
where: ListWebhooksWhereInput
|
|
82
|
+
sort: [ListWebhooksSort!]
|
|
72
83
|
limit: Int
|
|
73
84
|
after: String
|
|
74
85
|
): WebhookListResponse!
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/graphql/WebhookCrudSchema.js","sources":["../../../src/api/graphql/WebhookCrudSchema.ts"],"sourcesContent":["import { GraphQLSchemaFactory } from \"@webiny/handler-graphql/graphql/abstractions.js\";\nimport { Response } from \"@webiny/handler-graphql\";\nimport { ErrorResponse } from \"@webiny/handler-graphql\";\nimport { ListResponse } from \"@webiny/handler-graphql\";\nimport { ListErrorResponse } from \"@webiny/handler-graphql\";\nimport { ListWebhooksUseCase } from \"~/api/features/ListWebhooks/abstractions.js\";\nimport type { IListWebhooksInput } from \"~/api/features/ListWebhooks/abstractions.js\";\nimport { GetWebhookUseCase } from \"~/api/features/GetWebhook/abstractions.js\";\nimport { CreateWebhookUseCase } from \"~/api/features/CreateWebhook/abstractions.js\";\nimport { UpdateWebhookUseCase } from \"~/api/features/UpdateWebhook/abstractions.js\";\nimport { DeleteWebhookUseCase } from \"~/api/features/DeleteWebhook/abstractions.js\";\n\ninterface IIdArgs {\n id: string;\n}\n\ninterface ICreateWebhookArgs {\n input: CreateWebhookUseCase.Input;\n}\n\ninterface IUpdateWebhookArgs {\n id: string;\n input: UpdateWebhookUseCase.Input;\n}\n\nclass WebhookCrudSchema_ implements GraphQLSchemaFactory.Interface {\n async execute(\n builder: GraphQLSchemaFactory.SchemaBuilder\n ): Promise<GraphQLSchemaFactory.SchemaBuilder> {\n builder.addTypeDefs(/* GraphQL */ `\n type WebhookError {\n code: String\n message: String\n data: JSON\n }\n\n type WebhookListMeta {\n cursor: String\n hasMoreItems: Boolean!\n totalCount: Int!\n }\n\n type Webhook {\n id: ID!\n name: String!\n slug: String!\n endpointUrl: String!\n description: String\n enabled: Boolean!\n events: [String!]!\n signingSecret: String\n createdOn: DateTime\n modifiedOn: DateTime\n }\n\n type WebhookResponse {\n data: Webhook\n error: WebhookError\n }\n\n type WebhookListResponse {\n data: [Webhook!]\n meta: WebhookListMeta\n error: WebhookError\n }\n\n input CreateWebhookInput {\n name: String!\n slug: String\n endpointUrl: String!\n description: String\n enabled: Boolean\n events: [String!]!\n signingSecret: String\n }\n\n input UpdateWebhookInput {\n name: String\n endpointUrl: String\n description: String\n enabled: Boolean\n events: [String!]\n }\n\n input ListWebhooksWhereInput {\n enabled: Boolean\n }\n\n type WebhookQuery {\n listWebhooks(\n where: ListWebhooksWhereInput\n limit: Int\n after: String\n ): WebhookListResponse!\n getWebhook(id: ID!): WebhookResponse!\n }\n\n type WebhookMutation {\n createWebhook(input: CreateWebhookInput!): WebhookResponse!\n updateWebhook(id: ID!, input: UpdateWebhookInput!): WebhookResponse!\n deleteWebhook(id: ID!): BooleanResponse!\n }\n\n extend type Query {\n webhooks: WebhookQuery!\n }\n\n extend type Mutation {\n webhooks: WebhookMutation!\n }\n `);\n\n builder.addResolver({\n path: \"Query.webhooks\",\n dependencies: [],\n resolver: () => () => ({})\n });\n\n builder.addResolver({\n path: \"Mutation.webhooks\",\n dependencies: [],\n resolver: () => () => ({})\n });\n\n builder.addResolver<IListWebhooksInput>({\n path: \"WebhookQuery.listWebhooks\",\n dependencies: [ListWebhooksUseCase],\n resolver: (listWebhooks: ListWebhooksUseCase.Interface) => {\n return async ({ args }) => {\n const result = await listWebhooks.execute(args);\n if (result.isFail()) {\n return new ListErrorResponse(result.error);\n }\n return new ListResponse(result.value.items, result.value.meta);\n };\n }\n });\n\n builder.addResolver<IIdArgs>({\n path: \"WebhookQuery.getWebhook\",\n dependencies: [GetWebhookUseCase],\n resolver: (getWebhook: GetWebhookUseCase.Interface) => {\n return async ({ args }) => {\n const result = await getWebhook.execute(args.id);\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(result.value);\n };\n }\n });\n\n builder.addResolver<ICreateWebhookArgs>({\n path: \"WebhookMutation.createWebhook\",\n dependencies: [CreateWebhookUseCase],\n resolver: (createWebhook: CreateWebhookUseCase.Interface) => {\n return async ({ args }) => {\n const result = await createWebhook.execute(args.input);\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(result.value);\n };\n }\n });\n\n builder.addResolver<IUpdateWebhookArgs>({\n path: \"WebhookMutation.updateWebhook\",\n dependencies: [UpdateWebhookUseCase],\n resolver: (updateWebhook: UpdateWebhookUseCase.Interface) => {\n return async ({ args }) => {\n const result = await updateWebhook.execute(args.id, args.input);\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(result.value);\n };\n }\n });\n\n builder.addResolver<IIdArgs>({\n path: \"WebhookMutation.deleteWebhook\",\n dependencies: [DeleteWebhookUseCase],\n resolver: (deleteWebhook: DeleteWebhookUseCase.Interface) => {\n return async ({ args }) => {\n const result = await deleteWebhook.execute(args.id);\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(true);\n };\n }\n });\n\n return builder;\n }\n}\n\nexport const WebhookCrudSchema = GraphQLSchemaFactory.createImplementation({\n implementation: WebhookCrudSchema_,\n dependencies: []\n});\n"],"names":["WebhookCrudSchema_","builder","ListWebhooksUseCase","listWebhooks","args","result","ListErrorResponse","ListResponse","GetWebhookUseCase","getWebhook","ErrorResponse","Response","CreateWebhookUseCase","createWebhook","UpdateWebhookUseCase","updateWebhook","DeleteWebhookUseCase","deleteWebhook","WebhookCrudSchema","GraphQLSchemaFactory"],"mappings":";;;;;;;AAyBA,MAAMA;IACF,MAAM,QACFC,OAA2C,EACA;QAC3CA,QAAQ,WAAW,CAAe,CAAC
|
|
1
|
+
{"version":3,"file":"api/graphql/WebhookCrudSchema.js","sources":["../../../src/api/graphql/WebhookCrudSchema.ts"],"sourcesContent":["import { GraphQLSchemaFactory } from \"@webiny/handler-graphql/graphql/abstractions.js\";\nimport { Response } from \"@webiny/handler-graphql\";\nimport { ErrorResponse } from \"@webiny/handler-graphql\";\nimport { ListResponse } from \"@webiny/handler-graphql\";\nimport { ListErrorResponse } from \"@webiny/handler-graphql\";\nimport { ListWebhooksUseCase } from \"~/api/features/ListWebhooks/abstractions.js\";\nimport type { IListWebhooksInput } from \"~/api/features/ListWebhooks/abstractions.js\";\nimport { GetWebhookUseCase } from \"~/api/features/GetWebhook/abstractions.js\";\nimport { CreateWebhookUseCase } from \"~/api/features/CreateWebhook/abstractions.js\";\nimport { UpdateWebhookUseCase } from \"~/api/features/UpdateWebhook/abstractions.js\";\nimport { DeleteWebhookUseCase } from \"~/api/features/DeleteWebhook/abstractions.js\";\n\ninterface IIdArgs {\n id: string;\n}\n\ninterface ICreateWebhookArgs {\n input: CreateWebhookUseCase.Input;\n}\n\ninterface IUpdateWebhookArgs {\n id: string;\n input: UpdateWebhookUseCase.Input;\n}\n\nclass WebhookCrudSchema_ implements GraphQLSchemaFactory.Interface {\n async execute(\n builder: GraphQLSchemaFactory.SchemaBuilder\n ): Promise<GraphQLSchemaFactory.SchemaBuilder> {\n builder.addTypeDefs(/* GraphQL */ `\n type WebhookError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type WebhookListMeta {\n cursor: String\n hasMoreItems: Boolean!\n totalCount: Int!\n }\n\n type Webhook {\n id: ID!\n name: String!\n slug: String!\n endpointUrl: String!\n description: String\n enabled: Boolean!\n events: [String!]!\n signingSecret: String\n createdOn: DateTime\n modifiedOn: DateTime\n }\n\n type WebhookResponse {\n data: Webhook\n error: WebhookError\n }\n\n type WebhookListResponse {\n data: [Webhook!]\n meta: WebhookListMeta\n error: WebhookError\n }\n\n input CreateWebhookInput {\n name: String!\n slug: String\n endpointUrl: String!\n description: String\n enabled: Boolean\n events: [String!]!\n signingSecret: String\n }\n\n input UpdateWebhookInput {\n name: String\n endpointUrl: String\n description: String\n enabled: Boolean\n events: [String!]\n }\n\n input ListWebhooksWhereInput {\n enabled: Boolean\n }\n\n enum ListWebhooksSort {\n createdOn_ASC\n createdOn_DESC\n modifiedOn_ASC\n modifiedOn_DESC\n name_ASC\n name_DESC\n }\n\n type WebhookQuery {\n listWebhooks(\n where: ListWebhooksWhereInput\n sort: [ListWebhooksSort!]\n limit: Int\n after: String\n ): WebhookListResponse!\n getWebhook(id: ID!): WebhookResponse!\n }\n\n type WebhookMutation {\n createWebhook(input: CreateWebhookInput!): WebhookResponse!\n updateWebhook(id: ID!, input: UpdateWebhookInput!): WebhookResponse!\n deleteWebhook(id: ID!): BooleanResponse!\n }\n\n extend type Query {\n webhooks: WebhookQuery!\n }\n\n extend type Mutation {\n webhooks: WebhookMutation!\n }\n `);\n\n builder.addResolver({\n path: \"Query.webhooks\",\n dependencies: [],\n resolver: () => () => ({})\n });\n\n builder.addResolver({\n path: \"Mutation.webhooks\",\n dependencies: [],\n resolver: () => () => ({})\n });\n\n builder.addResolver<IListWebhooksInput>({\n path: \"WebhookQuery.listWebhooks\",\n dependencies: [ListWebhooksUseCase],\n resolver: (listWebhooks: ListWebhooksUseCase.Interface) => {\n return async ({ args }) => {\n const result = await listWebhooks.execute(args);\n if (result.isFail()) {\n return new ListErrorResponse(result.error);\n }\n return new ListResponse(result.value.items, result.value.meta);\n };\n }\n });\n\n builder.addResolver<IIdArgs>({\n path: \"WebhookQuery.getWebhook\",\n dependencies: [GetWebhookUseCase],\n resolver: (getWebhook: GetWebhookUseCase.Interface) => {\n return async ({ args }) => {\n const result = await getWebhook.execute(args.id);\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(result.value);\n };\n }\n });\n\n builder.addResolver<ICreateWebhookArgs>({\n path: \"WebhookMutation.createWebhook\",\n dependencies: [CreateWebhookUseCase],\n resolver: (createWebhook: CreateWebhookUseCase.Interface) => {\n return async ({ args }) => {\n const result = await createWebhook.execute(args.input);\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(result.value);\n };\n }\n });\n\n builder.addResolver<IUpdateWebhookArgs>({\n path: \"WebhookMutation.updateWebhook\",\n dependencies: [UpdateWebhookUseCase],\n resolver: (updateWebhook: UpdateWebhookUseCase.Interface) => {\n return async ({ args }) => {\n const result = await updateWebhook.execute(args.id, args.input);\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(result.value);\n };\n }\n });\n\n builder.addResolver<IIdArgs>({\n path: \"WebhookMutation.deleteWebhook\",\n dependencies: [DeleteWebhookUseCase],\n resolver: (deleteWebhook: DeleteWebhookUseCase.Interface) => {\n return async ({ args }) => {\n const result = await deleteWebhook.execute(args.id);\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(true);\n };\n }\n });\n\n return builder;\n }\n}\n\nexport const WebhookCrudSchema = GraphQLSchemaFactory.createImplementation({\n implementation: WebhookCrudSchema_,\n dependencies: []\n});\n"],"names":["WebhookCrudSchema_","builder","ListWebhooksUseCase","listWebhooks","args","result","ListErrorResponse","ListResponse","GetWebhookUseCase","getWebhook","ErrorResponse","Response","CreateWebhookUseCase","createWebhook","UpdateWebhookUseCase","updateWebhook","DeleteWebhookUseCase","deleteWebhook","WebhookCrudSchema","GraphQLSchemaFactory"],"mappings":";;;;;;;AAyBA,MAAMA;IACF,MAAM,QACFC,OAA2C,EACA;QAC3CA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4FnC,CAAC;QAEDA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,cAAc,EAAE;YAChB,UAAU,IAAM,IAAO,EAAC;QAC5B;QAEAA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,cAAc,EAAE;YAChB,UAAU,IAAM,IAAO,EAAC;QAC5B;QAEAA,QAAQ,WAAW,CAAqB;YACpC,MAAM;YACN,cAAc;gBAACC;aAAoB;YACnC,UAAU,CAACC,eACA,OAAO,EAAEC,IAAI,EAAE;oBAClB,MAAMC,SAAS,MAAMF,aAAa,OAAO,CAACC;oBAC1C,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIC,kBAAkBD,OAAO,KAAK;oBAE7C,OAAO,IAAIE,aAAaF,OAAO,KAAK,CAAC,KAAK,EAAEA,OAAO,KAAK,CAAC,IAAI;gBACjE;QAER;QAEAJ,QAAQ,WAAW,CAAU;YACzB,MAAM;YACN,cAAc;gBAACO;aAAkB;YACjC,UAAU,CAACC,aACA,OAAO,EAAEL,IAAI,EAAE;oBAClB,MAAMC,SAAS,MAAMI,WAAW,OAAO,CAACL,KAAK,EAAE;oBAC/C,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIK,cAAcL,OAAO,KAAK;oBAEzC,OAAO,IAAIM,SAASN,OAAO,KAAK;gBACpC;QAER;QAEAJ,QAAQ,WAAW,CAAqB;YACpC,MAAM;YACN,cAAc;gBAACW;aAAqB;YACpC,UAAU,CAACC,gBACA,OAAO,EAAET,IAAI,EAAE;oBAClB,MAAMC,SAAS,MAAMQ,cAAc,OAAO,CAACT,KAAK,KAAK;oBACrD,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIK,cAAcL,OAAO,KAAK;oBAEzC,OAAO,IAAIM,SAASN,OAAO,KAAK;gBACpC;QAER;QAEAJ,QAAQ,WAAW,CAAqB;YACpC,MAAM;YACN,cAAc;gBAACa;aAAqB;YACpC,UAAU,CAACC,gBACA,OAAO,EAAEX,IAAI,EAAE;oBAClB,MAAMC,SAAS,MAAMU,cAAc,OAAO,CAACX,KAAK,EAAE,EAAEA,KAAK,KAAK;oBAC9D,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIK,cAAcL,OAAO,KAAK;oBAEzC,OAAO,IAAIM,SAASN,OAAO,KAAK;gBACpC;QAER;QAEAJ,QAAQ,WAAW,CAAU;YACzB,MAAM;YACN,cAAc;gBAACe;aAAqB;YACpC,UAAU,CAACC,gBACA,OAAO,EAAEb,IAAI,EAAE;oBAClB,MAAMC,SAAS,MAAMY,cAAc,OAAO,CAACb,KAAK,EAAE;oBAClD,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIK,cAAcL,OAAO,KAAK;oBAEzC,OAAO,IAAIM,SAAS;gBACxB;QAER;QAEA,OAAOV;IACX;AACJ;AAEO,MAAMiB,oBAAoBC,qBAAqB,oBAAoB,CAAC;IACvE,gBAAgBnB;IAChB,cAAc,EAAE;AACpB"}
|
package/api/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { WebhooksFeature } from "./WebhooksFeature.js";
|
|
2
2
|
import { createRegisterExtensionPlugin } from "@webiny/handler";
|
|
3
|
-
const createWebhooks = ()=>
|
|
3
|
+
const createWebhooks = ()=>{
|
|
4
|
+
const plugin = createRegisterExtensionPlugin(async (context)=>{
|
|
4
5
|
WebhooksFeature.register(context.container);
|
|
5
6
|
});
|
|
7
|
+
plugin.name = "webhooks.extension";
|
|
8
|
+
return plugin;
|
|
9
|
+
};
|
|
6
10
|
export { createWebhooks };
|
|
7
11
|
|
|
8
12
|
//# sourceMappingURL=index.js.map
|
package/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/index.js","sources":["../../src/api/index.ts"],"sourcesContent":["import { WebhooksFeature } from \"./WebhooksFeature.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\n\nexport const createWebhooks = () => {\n
|
|
1
|
+
{"version":3,"file":"api/index.js","sources":["../../src/api/index.ts"],"sourcesContent":["import { WebhooksFeature } from \"./WebhooksFeature.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\n\nexport const createWebhooks = () => {\n const plugin = createRegisterExtensionPlugin(async context => {\n WebhooksFeature.register(context.container);\n });\n\n plugin.name = \"webhooks.extension\";\n\n return plugin;\n};\n"],"names":["createWebhooks","plugin","createRegisterExtensionPlugin","context","WebhooksFeature"],"mappings":";;AAGO,MAAMA,iBAAiB;IAC1B,MAAMC,SAASC,8BAA8B,OAAMC;QAC/CC,gBAAgB,QAAQ,CAACD,QAAQ,SAAS;IAC9C;IAEAF,OAAO,IAAI,GAAG;IAEd,OAAOA;AACX"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModelFactory } from "@webiny/api-headless-cms/features/modelBuilder/index.js";
|
|
2
2
|
declare class WebhookDeliveryModelFactory implements ModelFactory.Interface {
|
|
3
|
-
execute(builder: ModelFactory.Builder): Promise<import("@webiny/api-headless-cms/features/modelBuilder/index.js").
|
|
3
|
+
execute(builder: ModelFactory.Builder): Promise<import("@webiny/api-headless-cms/features/modelBuilder/index.js").PrivateModelBuilder[]>;
|
|
4
4
|
}
|
|
5
5
|
export declare const WebhookDeliveryModel: typeof WebhookDeliveryModelFactory & {
|
|
6
6
|
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/modelBuilder/abstractions").IModelFactory>;
|
|
@@ -2,11 +2,10 @@ import { ModelFactory } from "@webiny/api-headless-cms/features/modelBuilder/ind
|
|
|
2
2
|
import { WEBHOOK_DELIVERY_MODEL_ID } from "../domain/constants.js";
|
|
3
3
|
class WebhookDeliveryModelFactory {
|
|
4
4
|
async execute(builder) {
|
|
5
|
-
const model = builder.
|
|
5
|
+
const model = builder.private({
|
|
6
6
|
modelId: WEBHOOK_DELIVERY_MODEL_ID,
|
|
7
|
-
name: "Webhook Delivery"
|
|
8
|
-
|
|
9
|
-
}).description("Stores webhook delivery logs.").singularApiName("WebhookDelivery").pluralApiName("WebhookDeliveries").tags([
|
|
7
|
+
name: "Webhook Delivery"
|
|
8
|
+
}).tags([
|
|
10
9
|
"$publishing:false",
|
|
11
10
|
"$hidden:true"
|
|
12
11
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/models/WebhookDeliveryModel.js","sources":["../../../src/api/models/WebhookDeliveryModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport { WEBHOOK_DELIVERY_MODEL_ID } from \"~/api/domain/constants.js\";\n\nclass WebhookDeliveryModelFactory implements ModelFactory.Interface {\n async execute(builder: ModelFactory.Builder) {\n const model = builder\n .
|
|
1
|
+
{"version":3,"file":"api/models/WebhookDeliveryModel.js","sources":["../../../src/api/models/WebhookDeliveryModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport { WEBHOOK_DELIVERY_MODEL_ID } from \"~/api/domain/constants.js\";\n\nclass WebhookDeliveryModelFactory implements ModelFactory.Interface {\n async execute(builder: ModelFactory.Builder) {\n const model = builder\n .private({\n modelId: WEBHOOK_DELIVERY_MODEL_ID,\n name: \"Webhook Delivery\"\n })\n .tags([\"$publishing:false\", \"$hidden:true\"]);\n\n model.fields(fields => ({\n webhookId: fields.text().label(\"Webhook ID\").required(),\n backgroundTaskId: fields.text().label(\"Background Task ID\"),\n eventType: fields.text().label(\"Event Type\").required(),\n status: fields.text().label(\"Status\").required(),\n payload: fields.text().compress().label(\"Payload\"),\n requestHeaders: fields.text().compress().label(\"Request Headers\"),\n responseTime: fields.number().label(\"Response Time (ms)\"),\n responseStatus: fields.number().label(\"Response Status\"),\n responseHeaders: fields.text().compress().label(\"Response Headers\"),\n responseBody: fields.text().compress().label(\"Response Body\")\n }));\n\n return [model];\n }\n}\n\nexport const WebhookDeliveryModel = ModelFactory.createImplementation({\n implementation: WebhookDeliveryModelFactory,\n dependencies: []\n});\n"],"names":["WebhookDeliveryModelFactory","builder","model","WEBHOOK_DELIVERY_MODEL_ID","fields","WebhookDeliveryModel","ModelFactory"],"mappings":";;AAGA,MAAMA;IACF,MAAM,QAAQC,OAA6B,EAAE;QACzC,MAAMC,QAAQD,QACT,OAAO,CAAC;YACL,SAASE;YACT,MAAM;QACV,GACC,IAAI,CAAC;YAAC;YAAqB;SAAe;QAE/CD,MAAM,MAAM,CAACE,CAAAA,SAAW;gBACpB,WAAWA,OAAO,IAAI,GAAG,KAAK,CAAC,cAAc,QAAQ;gBACrD,kBAAkBA,OAAO,IAAI,GAAG,KAAK,CAAC;gBACtC,WAAWA,OAAO,IAAI,GAAG,KAAK,CAAC,cAAc,QAAQ;gBACrD,QAAQA,OAAO,IAAI,GAAG,KAAK,CAAC,UAAU,QAAQ;gBAC9C,SAASA,OAAO,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAC;gBACxC,gBAAgBA,OAAO,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAC;gBAC/C,cAAcA,OAAO,MAAM,GAAG,KAAK,CAAC;gBACpC,gBAAgBA,OAAO,MAAM,GAAG,KAAK,CAAC;gBACtC,iBAAiBA,OAAO,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAC;gBAChD,cAAcA,OAAO,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAC;YACjD;QAEA,OAAO;YAACF;SAAM;IAClB;AACJ;AAEO,MAAMG,uBAAuBC,aAAa,oBAAoB,CAAC;IAClE,gBAAgBN;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModelFactory } from "@webiny/api-headless-cms/features/modelBuilder/index.js";
|
|
2
2
|
declare class WebhookModelFactory implements ModelFactory.Interface {
|
|
3
|
-
execute(builder: ModelFactory.Builder): Promise<import("@webiny/api-headless-cms/features/modelBuilder/index.js").
|
|
3
|
+
execute(builder: ModelFactory.Builder): Promise<import("@webiny/api-headless-cms/features/modelBuilder/index.js").PrivateModelBuilder[]>;
|
|
4
4
|
}
|
|
5
5
|
export declare const WebhookModel: typeof WebhookModelFactory & {
|
|
6
6
|
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/modelBuilder/abstractions").IModelFactory>;
|
|
@@ -2,16 +2,15 @@ import { ModelFactory } from "@webiny/api-headless-cms/features/modelBuilder/ind
|
|
|
2
2
|
import { WEBHOOK_MODEL_ID } from "../domain/constants.js";
|
|
3
3
|
class WebhookModelFactory {
|
|
4
4
|
async execute(builder) {
|
|
5
|
-
const model = builder.
|
|
5
|
+
const model = builder.private({
|
|
6
6
|
modelId: WEBHOOK_MODEL_ID,
|
|
7
|
-
name: "Webhook"
|
|
8
|
-
|
|
9
|
-
}).description("Stores webhook configurations.").titleFieldId("name").singularApiName("Webhook").pluralApiName("Webhooks").tags([
|
|
7
|
+
name: "Webhook"
|
|
8
|
+
}).tags([
|
|
10
9
|
"$publishing:false",
|
|
11
10
|
"$hidden:true"
|
|
12
11
|
]);
|
|
13
12
|
model.fields((fields)=>({
|
|
14
|
-
name: fields.text().label("Name").required()
|
|
13
|
+
name: fields.text().label("Name").required(),
|
|
15
14
|
slug: fields.text().label("Slug").required().description("URL-safe identifier, unique per tenant.").minLength(3, "Slug must be at least 3 characters long.").pattern("^[a-z0-9]+(?:-[a-z0-9]+)*$", "", "Slug can only contain lowercase letters, numbers, and hyphens, and must start and end with a letter or number."),
|
|
16
15
|
endpointUrl: fields.text().label("Endpoint URL").required().description("HTTPS destination for POST requests.").url("Must be a valid URL starting with https://").minLength(8, "Endpoint URL must be at least 8 characters long.").pattern("^(https:\\/\\/.+|http:\\/\\/localhost.*)", "", "Endpoint URL must start with https://"),
|
|
17
16
|
description: fields.longText().label("Description"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/models/WebhookModel.js","sources":["../../../src/api/models/WebhookModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport { WEBHOOK_MODEL_ID } from \"~/api/domain/constants.js\";\n\nclass WebhookModelFactory implements ModelFactory.Interface {\n async execute(builder: ModelFactory.Builder) {\n const model = builder\n .
|
|
1
|
+
{"version":3,"file":"api/models/WebhookModel.js","sources":["../../../src/api/models/WebhookModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport { WEBHOOK_MODEL_ID } from \"~/api/domain/constants.js\";\n\nclass WebhookModelFactory implements ModelFactory.Interface {\n async execute(builder: ModelFactory.Builder) {\n const model = builder\n .private({ modelId: WEBHOOK_MODEL_ID, name: \"Webhook\" })\n .tags([\"$publishing:false\", \"$hidden:true\"]);\n\n model.fields(fields => ({\n name: fields.text().label(\"Name\").required(),\n slug: fields\n .text()\n .label(\"Slug\")\n .required()\n .description(\"URL-safe identifier, unique per tenant.\")\n .minLength(3, \"Slug must be at least 3 characters long.\")\n .pattern(\n \"^[a-z0-9]+(?:-[a-z0-9]+)*$\",\n \"\",\n \"Slug can only contain lowercase letters, numbers, and hyphens, and must start and end with a letter or number.\"\n ),\n endpointUrl: fields\n .text()\n .label(\"Endpoint URL\")\n .required()\n .description(\"HTTPS destination for POST requests.\")\n .url(\"Must be a valid URL starting with https://\")\n .minLength(8, \"Endpoint URL must be at least 8 characters long.\")\n .pattern(\n \"^(https:\\\\/\\\\/.+|http:\\\\/\\\\/localhost.*)\",\n \"\",\n \"Endpoint URL must start with https://\"\n ),\n description: fields.longText().label(\"Description\"),\n enabled: fields.boolean().label(\"Enabled\").defaultValue(false),\n events: fields\n .text()\n .list()\n .label(\"Events\")\n .defaultValue([])\n .listMinLength(1, \"At least one event must be selected.\"),\n signingSecret: fields\n .text()\n .encrypt()\n .label(\"Signing Secret\")\n .description(\"Signing secret - will be encrypted in the database.\")\n }));\n\n return [model];\n }\n}\n\nexport const WebhookModel = ModelFactory.createImplementation({\n implementation: WebhookModelFactory,\n dependencies: []\n});\n"],"names":["WebhookModelFactory","builder","model","WEBHOOK_MODEL_ID","fields","WebhookModel","ModelFactory"],"mappings":";;AAGA,MAAMA;IACF,MAAM,QAAQC,OAA6B,EAAE;QACzC,MAAMC,QAAQD,QACT,OAAO,CAAC;YAAE,SAASE;YAAkB,MAAM;QAAU,GACrD,IAAI,CAAC;YAAC;YAAqB;SAAe;QAE/CD,MAAM,MAAM,CAACE,CAAAA,SAAW;gBACpB,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC,QAAQ,QAAQ;gBAC1C,MAAMA,OACD,IAAI,GACJ,KAAK,CAAC,QACN,QAAQ,GACR,WAAW,CAAC,2CACZ,SAAS,CAAC,GAAG,4CACb,OAAO,CACJ,8BACA,IACA;gBAER,aAAaA,OACR,IAAI,GACJ,KAAK,CAAC,gBACN,QAAQ,GACR,WAAW,CAAC,wCACZ,GAAG,CAAC,8CACJ,SAAS,CAAC,GAAG,oDACb,OAAO,CACJ,4CACA,IACA;gBAER,aAAaA,OAAO,QAAQ,GAAG,KAAK,CAAC;gBACrC,SAASA,OAAO,OAAO,GAAG,KAAK,CAAC,WAAW,YAAY,CAAC;gBACxD,QAAQA,OACH,IAAI,GACJ,IAAI,GACJ,KAAK,CAAC,UACN,YAAY,CAAC,EAAE,EACf,aAAa,CAAC,GAAG;gBACtB,eAAeA,OACV,IAAI,GACJ,OAAO,GACP,KAAK,CAAC,kBACN,WAAW,CAAC;YACrB;QAEA,OAAO;YAACF;SAAM;IAClB;AACJ;AAEO,MAAMG,eAAeC,aAAa,oBAAoB,CAAC;IAC1D,gBAAgBN;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModelFactory } from "@webiny/api-headless-cms/features/modelBuilder/index.js";
|
|
2
2
|
declare class WebhookSettingsModelFactory implements ModelFactory.Interface {
|
|
3
|
-
execute(builder: ModelFactory.Builder): Promise<import("@webiny/api-headless-cms/features/modelBuilder/index.js").
|
|
3
|
+
execute(builder: ModelFactory.Builder): Promise<import("@webiny/api-headless-cms/features/modelBuilder/index.js").PrivateModelBuilder[]>;
|
|
4
4
|
}
|
|
5
5
|
export declare const WebhookSettingsModel: typeof WebhookSettingsModelFactory & {
|
|
6
6
|
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/modelBuilder/abstractions").IModelFactory>;
|
|
@@ -2,11 +2,10 @@ import { ModelFactory } from "@webiny/api-headless-cms/features/modelBuilder/ind
|
|
|
2
2
|
import { WEBHOOK_DELIVERY_MAX_RETENTION_DAYS, WEBHOOK_SETTINGS_MODEL_ID } from "../domain/constants.js";
|
|
3
3
|
class WebhookSettingsModelFactory {
|
|
4
4
|
async execute(builder) {
|
|
5
|
-
const model = builder.
|
|
5
|
+
const model = builder.private({
|
|
6
6
|
modelId: WEBHOOK_SETTINGS_MODEL_ID,
|
|
7
|
-
name: "Webhook Settings"
|
|
8
|
-
|
|
9
|
-
}).description("Global settings for the webhooks system.").titleFieldId("signingSecret").singularApiName("WebhookSettings").pluralApiName("WebhookSettings").tags([
|
|
7
|
+
name: "Webhook Settings"
|
|
8
|
+
}).tags([
|
|
10
9
|
"$publishing:false",
|
|
11
10
|
"$hidden:true"
|
|
12
11
|
]).singleEntry();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/models/WebhookSettingsModel.js","sources":["../../../src/api/models/WebhookSettingsModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport {\n WEBHOOK_SETTINGS_MODEL_ID,\n WEBHOOK_DELIVERY_MAX_RETENTION_DAYS\n} from \"~/api/domain/constants.js\";\n\nclass WebhookSettingsModelFactory implements ModelFactory.Interface {\n async execute(builder: ModelFactory.Builder) {\n const model = builder\n .
|
|
1
|
+
{"version":3,"file":"api/models/WebhookSettingsModel.js","sources":["../../../src/api/models/WebhookSettingsModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport {\n WEBHOOK_SETTINGS_MODEL_ID,\n WEBHOOK_DELIVERY_MAX_RETENTION_DAYS\n} from \"~/api/domain/constants.js\";\n\nclass WebhookSettingsModelFactory implements ModelFactory.Interface {\n async execute(builder: ModelFactory.Builder) {\n const model = builder\n .private({\n modelId: WEBHOOK_SETTINGS_MODEL_ID,\n name: \"Webhook Settings\"\n })\n .tags([\"$publishing:false\", \"$hidden:true\"])\n .singleEntry();\n\n model.fields(fields => ({\n signingSecret: fields\n .text()\n .label(\"Signing Secret\")\n .encrypt()\n .description(\"Global signing secret used for all webhook deliveries.\"),\n deliveryRetentionDays: fields\n .number()\n .label(\"Delivery Retention (days)\")\n .gte(0, \"Must be 0 or greater.\")\n .lte(\n WEBHOOK_DELIVERY_MAX_RETENTION_DAYS,\n `Must be at most ${WEBHOOK_DELIVERY_MAX_RETENTION_DAYS}.`\n )\n .description(\n `How long to keep delivery logs. 0 = delete immediately. Max ${WEBHOOK_DELIVERY_MAX_RETENTION_DAYS} days.`\n )\n }));\n\n return [model];\n }\n}\n\nexport const WebhookSettingsModel = ModelFactory.createImplementation({\n implementation: WebhookSettingsModelFactory,\n dependencies: []\n});\n"],"names":["WebhookSettingsModelFactory","builder","model","WEBHOOK_SETTINGS_MODEL_ID","fields","WEBHOOK_DELIVERY_MAX_RETENTION_DAYS","WebhookSettingsModel","ModelFactory"],"mappings":";;AAMA,MAAMA;IACF,MAAM,QAAQC,OAA6B,EAAE;QACzC,MAAMC,QAAQD,QACT,OAAO,CAAC;YACL,SAASE;YACT,MAAM;QACV,GACC,IAAI,CAAC;YAAC;YAAqB;SAAe,EAC1C,WAAW;QAEhBD,MAAM,MAAM,CAACE,CAAAA,SAAW;gBACpB,eAAeA,OACV,IAAI,GACJ,KAAK,CAAC,kBACN,OAAO,GACP,WAAW,CAAC;gBACjB,uBAAuBA,OAClB,MAAM,GACN,KAAK,CAAC,6BACN,GAAG,CAAC,GAAG,yBACP,GAAG,CACAC,qCACA,CAAC,gBAAgB,EAAEA,oCAAoC,CAAC,CAAC,EAE5D,WAAW,CACR,CAAC,4DAA4D,EAAEA,oCAAoC,MAAM,CAAC;YAEtH;QAEA,OAAO;YAACH;SAAM;IAClB;AACJ;AAEO,MAAMI,uBAAuBC,aAAa,oBAAoB,CAAC;IAClE,gBAAgBP;IAChB,cAAc,EAAE;AACpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/webhooks",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.9f53ea597d",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@webiny/admin-ui": "0.0.0-unstable.
|
|
23
|
-
"@webiny/api-core": "0.0.0-unstable.
|
|
24
|
-
"@webiny/api-headless-cms": "0.0.0-unstable.
|
|
25
|
-
"@webiny/app": "0.0.0-unstable.
|
|
26
|
-
"@webiny/app-admin": "0.0.0-unstable.
|
|
27
|
-
"@webiny/
|
|
28
|
-
"@webiny/
|
|
29
|
-
"@webiny/
|
|
30
|
-
"@webiny/
|
|
31
|
-
"@webiny/
|
|
32
|
-
"@webiny/utils": "0.0.0-unstable.
|
|
22
|
+
"@webiny/admin-ui": "0.0.0-unstable.9f53ea597d",
|
|
23
|
+
"@webiny/api-core": "0.0.0-unstable.9f53ea597d",
|
|
24
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.9f53ea597d",
|
|
25
|
+
"@webiny/app": "0.0.0-unstable.9f53ea597d",
|
|
26
|
+
"@webiny/app-admin": "0.0.0-unstable.9f53ea597d",
|
|
27
|
+
"@webiny/background-tasks": "0.0.0-unstable.9f53ea597d",
|
|
28
|
+
"@webiny/feature": "0.0.0-unstable.9f53ea597d",
|
|
29
|
+
"@webiny/handler-graphql": "0.0.0-unstable.9f53ea597d",
|
|
30
|
+
"@webiny/icons": "0.0.0-unstable.9f53ea597d",
|
|
31
|
+
"@webiny/sdk": "0.0.0-unstable.9f53ea597d",
|
|
32
|
+
"@webiny/utils": "0.0.0-unstable.9f53ea597d",
|
|
33
33
|
"lodash": "4.18.1",
|
|
34
|
-
"mobx": "6.
|
|
34
|
+
"mobx": "6.16.1",
|
|
35
35
|
"mobx-react-lite": "4.1.1",
|
|
36
36
|
"react": "18.3.1",
|
|
37
37
|
"react-dom": "18.3.1",
|
|
@@ -39,15 +39,15 @@
|
|
|
39
39
|
"zod": "4.4.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@webiny/api": "0.0.0-unstable.
|
|
43
|
-
"@webiny/build-tools": "0.0.0-unstable.
|
|
44
|
-
"@webiny/di": "
|
|
45
|
-
"@webiny/handler": "0.0.0-unstable.
|
|
46
|
-
"@webiny/handler-aws": "0.0.0-unstable.
|
|
47
|
-
"@webiny/plugins": "0.0.0-unstable.
|
|
48
|
-
"@webiny/project-utils": "0.0.0-unstable.
|
|
49
|
-
"typescript": "
|
|
50
|
-
"vitest": "4.1.
|
|
42
|
+
"@webiny/api": "0.0.0-unstable.9f53ea597d",
|
|
43
|
+
"@webiny/build-tools": "0.0.0-unstable.9f53ea597d",
|
|
44
|
+
"@webiny/di": "1.0.2",
|
|
45
|
+
"@webiny/handler": "0.0.0-unstable.9f53ea597d",
|
|
46
|
+
"@webiny/handler-aws": "0.0.0-unstable.9f53ea597d",
|
|
47
|
+
"@webiny/plugins": "0.0.0-unstable.9f53ea597d",
|
|
48
|
+
"@webiny/project-utils": "0.0.0-unstable.9f53ea597d",
|
|
49
|
+
"typescript": "7.0.2",
|
|
50
|
+
"vitest": "4.1.10"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveries/WebhookDeliveriesDataSource.js","sources":["../../../../src/admin/presentation/WebhookDeliveries/WebhookDeliveriesDataSource.ts"],"sourcesContent":["import { makeAutoObservable, runInAction, computed } 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(\n private readonly listDeliveriesUseCase: IListWebhookDeliveriesUseCase,\n private readonly where: ListWebhookDeliveriesWhere\n ) {\n makeAutoObservable<WebhookDeliveriesDataSource, \"listDeliveriesUseCase\">(this, {\n listDeliveriesUseCase: false,\n rows: computed\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: this.where,\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: this.where,\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","where","makeAutoObservable","computed","params","result","runInAction","undefined"],"mappings":";AAYO,MAAMA;IAKT,YACqBC,qBAAoD,EACpDC,KAAiC,CACpD;aAFmBD,qBAAqB,GAArBA;aACAC,KAAK,GAALA;aANb,KAAK,GAAsB,EAAE;aAC7B,KAAK,GAAoB;YAAE,QAAQ;YAAM,cAAc;YAAO,YAAY;QAAE;aAC5E,QAAQ,GAAG;QAMfC,mBAAyE,IAAI,EAAE;YAC3E,uBAAuB;YACvB,MAAMC;QACV;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,OAAO,IAAI,CAAC,KAAK;YACjB,OAAOD,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,OAAO,IAAI,CAAC,KAAK;YACjB,OAAOD,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"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ListPresenter } from "@webiny/app-admin/presentation/listPresenter/abstractions.js";
|
|
2
|
-
import type { WebhookDelivery } from "../../../admin/shared/types.js";
|
|
3
|
-
import { type IWebhookDeliveriesPresenter, type IWebhookDeliveriesViewModel } from "./abstractions.js";
|
|
4
|
-
import { ListWebhookDeliveriesUseCase } from "../../../admin/features/listWebhookDeliveries/abstractions.js";
|
|
5
|
-
import { ResendWebhookDeliveryUseCase } from "../../../admin/features/resendWebhookDelivery/abstractions.js";
|
|
6
|
-
declare class WebhookDeliveriesPresenterImpl implements IWebhookDeliveriesPresenter {
|
|
7
|
-
private readonly listPresenter;
|
|
8
|
-
private readonly listDeliveriesUseCase;
|
|
9
|
-
private readonly resendDeliveryUseCase;
|
|
10
|
-
private _selectedDelivery;
|
|
11
|
-
constructor(listPresenter: ListPresenter.Interface<WebhookDelivery>, listDeliveriesUseCase: ListWebhookDeliveriesUseCase.Interface, resendDeliveryUseCase: ResendWebhookDeliveryUseCase.Interface);
|
|
12
|
-
get vm(): IWebhookDeliveriesViewModel;
|
|
13
|
-
loadMore(): Promise<void>;
|
|
14
|
-
resend(id: string): Promise<void>;
|
|
15
|
-
selectDelivery(delivery: WebhookDelivery | null): void;
|
|
16
|
-
init(webhookId: string): void;
|
|
17
|
-
}
|
|
18
|
-
export declare const WebhookDeliveriesPresenter: typeof WebhookDeliveriesPresenterImpl & {
|
|
19
|
-
__abstraction: import("@webiny/di").Abstraction<IWebhookDeliveriesPresenter>;
|
|
20
|
-
};
|
|
21
|
-
export {};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { computed, makeAutoObservable } from "mobx";
|
|
2
|
-
import { ListPresenter } from "@webiny/app-admin/presentation/listPresenter/abstractions.js";
|
|
3
|
-
import { WebhookDeliveriesPresenter } from "./abstractions.js";
|
|
4
|
-
import { WebhookDeliveriesDataSource } from "./WebhookDeliveriesDataSource.js";
|
|
5
|
-
import { ListWebhookDeliveriesUseCase } from "../../features/listWebhookDeliveries/abstractions.js";
|
|
6
|
-
import { ResendWebhookDeliveryUseCase } from "../../features/resendWebhookDelivery/abstractions.js";
|
|
7
|
-
class WebhookDeliveriesPresenterImpl {
|
|
8
|
-
constructor(listPresenter, listDeliveriesUseCase, resendDeliveryUseCase){
|
|
9
|
-
this.listPresenter = listPresenter;
|
|
10
|
-
this.listDeliveriesUseCase = listDeliveriesUseCase;
|
|
11
|
-
this.resendDeliveryUseCase = resendDeliveryUseCase;
|
|
12
|
-
this._selectedDelivery = null;
|
|
13
|
-
makeAutoObservable(this, {
|
|
14
|
-
vm: computed
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
get vm() {
|
|
18
|
-
return {
|
|
19
|
-
list: this.listPresenter.vm,
|
|
20
|
-
selectedDelivery: this._selectedDelivery
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
async loadMore() {
|
|
24
|
-
await this.listPresenter.actions.loadMore();
|
|
25
|
-
}
|
|
26
|
-
async resend(id) {
|
|
27
|
-
await this.resendDeliveryUseCase.execute(id);
|
|
28
|
-
await this.listPresenter.actions.refresh();
|
|
29
|
-
}
|
|
30
|
-
selectDelivery(delivery) {
|
|
31
|
-
this._selectedDelivery = delivery;
|
|
32
|
-
}
|
|
33
|
-
init(webhookId) {
|
|
34
|
-
const dataSource = new WebhookDeliveriesDataSource(this.listDeliveriesUseCase, {
|
|
35
|
-
webhookId_eq: webhookId
|
|
36
|
-
});
|
|
37
|
-
this.listPresenter.init({
|
|
38
|
-
dataSource,
|
|
39
|
-
initialSort: {
|
|
40
|
-
field: "createdOn",
|
|
41
|
-
direction: "DESC"
|
|
42
|
-
},
|
|
43
|
-
limit: 20
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const WebhookDeliveriesPresenter_WebhookDeliveriesPresenter = WebhookDeliveriesPresenter.createImplementation({
|
|
48
|
-
implementation: WebhookDeliveriesPresenterImpl,
|
|
49
|
-
dependencies: [
|
|
50
|
-
ListPresenter,
|
|
51
|
-
ListWebhookDeliveriesUseCase,
|
|
52
|
-
ResendWebhookDeliveryUseCase
|
|
53
|
-
]
|
|
54
|
-
});
|
|
55
|
-
export { WebhookDeliveriesPresenter_WebhookDeliveriesPresenter as WebhookDeliveriesPresenter };
|
|
56
|
-
|
|
57
|
-
//# sourceMappingURL=WebhookDeliveriesPresenter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.js","sources":["../../../../src/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.ts"],"sourcesContent":["import { makeAutoObservable, computed } from \"mobx\";\nimport { ListPresenter } from \"@webiny/app-admin/presentation/listPresenter/abstractions.js\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\nimport {\n WebhookDeliveriesPresenter as Abstraction,\n type IWebhookDeliveriesPresenter,\n type IWebhookDeliveriesViewModel\n} from \"./abstractions.js\";\nimport { WebhookDeliveriesDataSource } from \"./WebhookDeliveriesDataSource.js\";\nimport { ListWebhookDeliveriesUseCase } from \"~/admin/features/listWebhookDeliveries/abstractions.js\";\nimport { ResendWebhookDeliveryUseCase } from \"~/admin/features/resendWebhookDelivery/abstractions.js\";\n\nclass WebhookDeliveriesPresenterImpl implements IWebhookDeliveriesPresenter {\n private _selectedDelivery: WebhookDelivery | null = null;\n\n constructor(\n private readonly listPresenter: ListPresenter.Interface<WebhookDelivery>,\n private readonly listDeliveriesUseCase: ListWebhookDeliveriesUseCase.Interface,\n private readonly resendDeliveryUseCase: ResendWebhookDeliveryUseCase.Interface\n ) {\n makeAutoObservable(this, { vm: computed });\n }\n\n get vm(): IWebhookDeliveriesViewModel {\n return {\n list: this.listPresenter.vm,\n selectedDelivery: this._selectedDelivery\n };\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 await this.resendDeliveryUseCase.execute(id);\n await this.listPresenter.actions.refresh();\n }\n\n public selectDelivery(delivery: WebhookDelivery | null): void {\n this._selectedDelivery = delivery;\n }\n\n init(webhookId: string): void {\n const dataSource = new WebhookDeliveriesDataSource(this.listDeliveriesUseCase, {\n webhookId_eq: webhookId\n });\n this.listPresenter.init({\n dataSource,\n initialSort: { field: \"createdOn\", direction: \"DESC\" },\n limit: 20\n });\n }\n}\n\nexport const WebhookDeliveriesPresenter = Abstraction.createImplementation({\n implementation: WebhookDeliveriesPresenterImpl,\n dependencies: [ListPresenter, ListWebhookDeliveriesUseCase, ResendWebhookDeliveryUseCase]\n});\n"],"names":["WebhookDeliveriesPresenterImpl","listPresenter","listDeliveriesUseCase","resendDeliveryUseCase","makeAutoObservable","computed","id","delivery","webhookId","dataSource","WebhookDeliveriesDataSource","WebhookDeliveriesPresenter","Abstraction","ListPresenter","ListWebhookDeliveriesUseCase","ResendWebhookDeliveryUseCase"],"mappings":";;;;;;AAYA,MAAMA;IAGF,YACqBC,aAAuD,EACvDC,qBAA6D,EAC7DC,qBAA6D,CAChF;aAHmBF,aAAa,GAAbA;aACAC,qBAAqB,GAArBA;aACAC,qBAAqB,GAArBA;aALb,iBAAiB,GAA2B;QAOhDC,mBAAmB,IAAI,EAAE;YAAE,IAAIC;QAAS;IAC5C;IAEA,IAAI,KAAkC;QAClC,OAAO;YACH,MAAM,IAAI,CAAC,aAAa,CAAC,EAAE;YAC3B,kBAAkB,IAAI,CAAC,iBAAiB;QAC5C;IACJ;IAEA,MAAa,WAA0B;QACnC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ;IAC7C;IAEA,MAAa,OAAOC,EAAU,EAAiB;QAC3C,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAACA;QACzC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO;IAC5C;IAEO,eAAeC,QAAgC,EAAQ;QAC1D,IAAI,CAAC,iBAAiB,GAAGA;IAC7B;IAEA,KAAKC,SAAiB,EAAQ;QAC1B,MAAMC,aAAa,IAAIC,4BAA4B,IAAI,CAAC,qBAAqB,EAAE;YAC3E,cAAcF;QAClB;QACA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YACpBC;YACA,aAAa;gBAAE,OAAO;gBAAa,WAAW;YAAO;YACrD,OAAO;QACX;IACJ;AACJ;AAEO,MAAME,wDAA6BC,2BAAAA,oBAAgC,CAAC;IACvE,gBAAgBZ;IAChB,cAAc;QAACa;QAAeC;QAA8BC;KAA6B;AAC7F"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { WebhookDelivery } from "../../../admin/shared/types.js";
|
|
2
|
-
import type { IListViewModel } from "@webiny/app-admin/presentation/listPresenter/abstractions.js";
|
|
3
|
-
export interface IWebhookDeliveriesViewModel {
|
|
4
|
-
list: IListViewModel<WebhookDelivery>;
|
|
5
|
-
selectedDelivery: WebhookDelivery | null;
|
|
6
|
-
}
|
|
7
|
-
export interface IWebhookDeliveriesPresenter {
|
|
8
|
-
vm: IWebhookDeliveriesViewModel;
|
|
9
|
-
init(webhookId: string): void;
|
|
10
|
-
loadMore(): Promise<void>;
|
|
11
|
-
resend(id: string): Promise<void>;
|
|
12
|
-
selectDelivery(delivery: WebhookDelivery | null): void;
|
|
13
|
-
}
|
|
14
|
-
export declare const WebhookDeliveriesPresenter: import("@webiny/di").Abstraction<IWebhookDeliveriesPresenter>;
|
|
15
|
-
export declare namespace WebhookDeliveriesPresenter {
|
|
16
|
-
type Interface = IWebhookDeliveriesPresenter;
|
|
17
|
-
type ViewModel = IWebhookDeliveriesViewModel;
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveries/abstractions.js","sources":["../../../../src/admin/presentation/WebhookDeliveries/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 IWebhookDeliveriesViewModel {\n list: IListViewModel<WebhookDelivery>;\n selectedDelivery: WebhookDelivery | null;\n}\n\nexport interface IWebhookDeliveriesPresenter {\n vm: IWebhookDeliveriesViewModel;\n init(webhookId: string): void;\n loadMore(): Promise<void>;\n resend(id: string): Promise<void>;\n selectDelivery(delivery: WebhookDelivery | null): void;\n}\n\nexport const WebhookDeliveriesPresenter = createAbstraction<IWebhookDeliveriesPresenter>(\n \"WebhookDeliveriesPresenter\"\n);\n\nexport namespace WebhookDeliveriesPresenter {\n export type Interface = IWebhookDeliveriesPresenter;\n export type ViewModel = IWebhookDeliveriesViewModel;\n}\n"],"names":["WebhookDeliveriesPresenter","createAbstraction"],"mappings":";AAiBO,MAAMA,6BAA6BC,kBACtC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveries/components/DeliveryAccordionRow.js","sources":["../../../../../src/admin/presentation/WebhookDeliveries/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"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { WebhookDelivery } from "../../../../admin/shared/types.js";
|
|
3
|
-
interface DeliveryDetailProps {
|
|
4
|
-
delivery: WebhookDelivery;
|
|
5
|
-
onClose: () => void;
|
|
6
|
-
onResend: (id: string) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare const DeliveryDetail: (({ delivery, onClose, onResend }: DeliveryDetailProps) => React.JSX.Element) & {
|
|
9
|
-
displayName: string;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import react from "react";
|
|
2
|
-
import { observer } from "mobx-react-lite";
|
|
3
|
-
import { Button, Heading, IconButton, Separator } from "@webiny/admin-ui";
|
|
4
|
-
import { ReactComponent } from "@webiny/icons/close.svg";
|
|
5
|
-
import { DeliveryDetailContent } from "./DeliveryDetailContent.js";
|
|
6
|
-
const DeliveryDetail_DeliveryDetail = observer(function({ delivery, onClose, onResend }) {
|
|
7
|
-
return /*#__PURE__*/ react.createElement("div", {
|
|
8
|
-
className: "flex flex-col h-full overflow-auto"
|
|
9
|
-
}, /*#__PURE__*/ react.createElement("div", {
|
|
10
|
-
className: "flex items-center justify-between px-md py-sm"
|
|
11
|
-
}, /*#__PURE__*/ react.createElement(Heading, {
|
|
12
|
-
level: 6
|
|
13
|
-
}, delivery.eventType), /*#__PURE__*/ react.createElement(IconButton, {
|
|
14
|
-
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
15
|
-
variant: "ghost",
|
|
16
|
-
size: "sm",
|
|
17
|
-
onClick: onClose,
|
|
18
|
-
"aria-label": "Close detail"
|
|
19
|
-
})), /*#__PURE__*/ react.createElement(Separator, null), /*#__PURE__*/ react.createElement("div", {
|
|
20
|
-
className: "flex-1 overflow-auto px-md py-sm"
|
|
21
|
-
}, /*#__PURE__*/ react.createElement(DeliveryDetailContent, {
|
|
22
|
-
delivery: delivery
|
|
23
|
-
})), /*#__PURE__*/ react.createElement(Separator, null), /*#__PURE__*/ react.createElement("div", {
|
|
24
|
-
className: "px-md py-sm"
|
|
25
|
-
}, /*#__PURE__*/ react.createElement(Button, {
|
|
26
|
-
variant: "secondary",
|
|
27
|
-
onClick: ()=>onResend(delivery.id)
|
|
28
|
-
}, "Resend")));
|
|
29
|
-
});
|
|
30
|
-
export { DeliveryDetail_DeliveryDetail as DeliveryDetail };
|
|
31
|
-
|
|
32
|
-
//# sourceMappingURL=DeliveryDetail.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveries/components/DeliveryDetail.js","sources":["../../../../../src/admin/presentation/WebhookDeliveries/components/DeliveryDetail.tsx"],"sourcesContent":["import React from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { Button } from \"@webiny/admin-ui\";\nimport { Heading } from \"@webiny/admin-ui\";\nimport { IconButton } from \"@webiny/admin-ui\";\nimport { Separator } from \"@webiny/admin-ui\";\nimport { ReactComponent as CloseIcon } from \"@webiny/icons/close.svg\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\nimport { DeliveryDetailContent } from \"./DeliveryDetailContent.js\";\n\ninterface DeliveryDetailProps {\n delivery: WebhookDelivery;\n onClose: () => void;\n onResend: (id: string) => void;\n}\n\nexport const DeliveryDetail = observer(function DeliveryDetail({\n delivery,\n onClose,\n onResend\n}: DeliveryDetailProps) {\n return (\n <div className=\"flex flex-col h-full overflow-auto\">\n <div className=\"flex items-center justify-between px-md py-sm\">\n <Heading level={6}>{delivery.eventType}</Heading>\n <IconButton\n icon={<CloseIcon />}\n variant=\"ghost\"\n size=\"sm\"\n onClick={onClose}\n aria-label=\"Close detail\"\n />\n </div>\n <Separator />\n <div className=\"flex-1 overflow-auto px-md py-sm\">\n <DeliveryDetailContent delivery={delivery} />\n </div>\n <Separator />\n <div className=\"px-md py-sm\">\n <Button variant=\"secondary\" onClick={() => onResend(delivery.id)}>\n Resend\n </Button>\n </div>\n </div>\n );\n});\n"],"names":["DeliveryDetail","observer","delivery","onClose","onResend","Heading","IconButton","CloseIcon","Separator","DeliveryDetailContent","Button"],"mappings":";;;;;AAgBO,MAAMA,gCAAiBC,SAAS,SAAwB,EAC3DC,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACU;IAClB,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAAC;QAAI,WAAU;qBACX,oBAACC,SAAOA;QAAC,OAAO;OAAIH,SAAS,SAAS,iBACtC,oBAACI,YAAUA;QACP,oBAAM,oBAACC,gBAASA;QAChB,SAAQ;QACR,MAAK;QACL,SAASJ;QACT,cAAW;uBAGnB,oBAACK,WAASA,OAAAA,WAAAA,GACV,oBAAC;QAAI,WAAU;qBACX,oBAACC,uBAAqBA;QAAC,UAAUP;uBAErC,oBAACM,WAASA,OAAAA,WAAAA,GACV,oBAAC;QAAI,WAAU;qBACX,oBAACE,QAAMA;QAAC,SAAQ;QAAY,SAAS,IAAMN,SAASF,SAAS,EAAE;OAAG;AAMlF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveries/components/DeliveryDetailContent.js","sources":["../../../../../src/admin/presentation/WebhookDeliveries/components/DeliveryDetailContent.tsx"],"sourcesContent":["import React from \"react\";\nimport { Separator, Tabs } from \"@webiny/admin-ui\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\n\ninterface DeliveryDetailContentProps {\n delivery: WebhookDelivery;\n}\n\nconst formatJson = (value: unknown): string => {\n if (value === null || value === undefined) {\n return \"—\";\n }\n if (typeof value === \"string\") {\n try {\n return JSON.stringify(JSON.parse(value), null, 2);\n } catch {\n return value;\n }\n }\n return JSON.stringify(value, null, 2);\n};\n\nconst getContentType = (responseHeaders: unknown): string | null => {\n if (!responseHeaders || typeof responseHeaders !== \"object\") {\n return null;\n }\n const headers = responseHeaders as Record<string, string>;\n const key = Object.keys(headers).find(k => k.toLowerCase() === \"content-type\");\n if (!key) {\n return null;\n }\n return headers[key].split(\";\")[0].trim().toLowerCase();\n};\n\nconst getContentTypeLabel = (contentType: string | null): string | null => {\n if (!contentType) {\n return null;\n }\n if (contentType.includes(\"json\")) {\n return \"JSON\";\n }\n if (contentType.includes(\"html\")) {\n return \"HTML\";\n }\n if (contentType.includes(\"xml\")) {\n return \"XML\";\n }\n if (contentType.includes(\"plain\")) {\n return \"TEXT\";\n }\n return null;\n};\n\nconst renderResponseBody = (body: string | null, contentType: string | null): string => {\n if (body === null) {\n return \"—\";\n }\n if (!contentType || contentType.includes(\"json\")) {\n return formatJson(body);\n }\n return body;\n};\n\nexport const DeliveryDetailContent = ({ delivery }: DeliveryDetailContentProps) => {\n const contentType = getContentType(delivery.responseHeaders);\n const contentTypeLabel = getContentTypeLabel(contentType);\n\n return (\n <div className=\"flex flex-col gap-md\">\n <Separator />\n <Tabs\n tabs={[\n <Tabs.Tab\n key=\"payload\"\n value=\"payload\"\n trigger=\"Payload\"\n content={\n <pre className=\"bg-neutral-light rounded-sm p-sm text-xs overflow-auto max-h-[250px]\">\n {formatJson(delivery.payload)}\n </pre>\n }\n />,\n <Tabs.Tab\n key=\"req-headers\"\n value=\"req-headers\"\n trigger=\"Request Headers\"\n content={\n <pre className=\"bg-neutral-light rounded-sm p-sm text-xs overflow-auto max-h-[200px]\">\n {formatJson(delivery.requestHeaders)}\n </pre>\n }\n />,\n <Tabs.Tab\n key=\"resp-headers\"\n value=\"resp-headers\"\n trigger=\"Response Headers\"\n content={\n <pre className=\"bg-neutral-light rounded-sm p-sm text-xs overflow-auto max-h-[200px]\">\n {formatJson(delivery.responseHeaders)}\n </pre>\n }\n />,\n <Tabs.Tab\n key=\"resp-body\"\n value=\"resp-body\"\n trigger={\n contentTypeLabel\n ? `Response Body (${contentTypeLabel})`\n : \"Response Body\"\n }\n content={\n <pre className=\"bg-neutral-light rounded-sm p-sm text-xs overflow-auto max-h-[200px]\">\n {renderResponseBody(delivery.responseBody, contentType)}\n </pre>\n }\n />\n ]}\n />\n </div>\n );\n};\n"],"names":["formatJson","value","JSON","getContentType","responseHeaders","headers","key","Object","k","getContentTypeLabel","contentType","renderResponseBody","body","DeliveryDetailContent","delivery","contentTypeLabel","Separator","Tabs"],"mappings":";;AAQA,MAAMA,aAAa,CAACC;IAChB,IAAIA,QAAAA,OACA,OAAO;IAEX,IAAI,AAAiB,YAAjB,OAAOA,OACP,IAAI;QACA,OAAOC,KAAK,SAAS,CAACA,KAAK,KAAK,CAACD,QAAQ,MAAM;IACnD,EAAE,OAAM;QACJ,OAAOA;IACX;IAEJ,OAAOC,KAAK,SAAS,CAACD,OAAO,MAAM;AACvC;AAEA,MAAME,iBAAiB,CAACC;IACpB,IAAI,CAACA,mBAAmB,AAA2B,YAA3B,OAAOA,iBAC3B,OAAO;IAEX,MAAMC,UAAUD;IAChB,MAAME,MAAMC,OAAO,IAAI,CAACF,SAAS,IAAI,CAACG,CAAAA,IAAKA,AAAoB,mBAApBA,EAAE,WAAW;IACxD,IAAI,CAACF,KACD,OAAO;IAEX,OAAOD,OAAO,CAACC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,GAAG,WAAW;AACxD;AAEA,MAAMG,sBAAsB,CAACC;IACzB,IAAI,CAACA,aACD,OAAO;IAEX,IAAIA,YAAY,QAAQ,CAAC,SACrB,OAAO;IAEX,IAAIA,YAAY,QAAQ,CAAC,SACrB,OAAO;IAEX,IAAIA,YAAY,QAAQ,CAAC,QACrB,OAAO;IAEX,IAAIA,YAAY,QAAQ,CAAC,UACrB,OAAO;IAEX,OAAO;AACX;AAEA,MAAMC,qBAAqB,CAACC,MAAqBF;IAC7C,IAAIE,AAAS,SAATA,MACA,OAAO;IAEX,IAAI,CAACF,eAAeA,YAAY,QAAQ,CAAC,SACrC,OAAOV,WAAWY;IAEtB,OAAOA;AACX;AAEO,MAAMC,wBAAwB,CAAC,EAAEC,QAAQ,EAA8B;IAC1E,MAAMJ,cAAcP,eAAeW,SAAS,eAAe;IAC3D,MAAMC,mBAAmBN,oBAAoBC;IAE7C,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAACM,WAASA,OAAAA,WAAAA,GACV,oBAACC,MAAIA;QACD,MAAM;0BACF,oBAACA,KAAK,GAAG;gBACL,KAAI;gBACJ,OAAM;gBACN,SAAQ;gBACR,uBACI,oBAAC;oBAAI,WAAU;mBACVjB,WAAWc,SAAS,OAAO;;0BAIxC,oBAACG,KAAK,GAAG;gBACL,KAAI;gBACJ,OAAM;gBACN,SAAQ;gBACR,uBACI,oBAAC;oBAAI,WAAU;mBACVjB,WAAWc,SAAS,cAAc;;0BAI/C,oBAACG,KAAK,GAAG;gBACL,KAAI;gBACJ,OAAM;gBACN,SAAQ;gBACR,uBACI,oBAAC;oBAAI,WAAU;mBACVjB,WAAWc,SAAS,eAAe;;0BAIhD,oBAACG,KAAK,GAAG;gBACL,KAAI;gBACJ,OAAM;gBACN,SACIF,mBACM,CAAC,eAAe,EAAEA,iBAAiB,CAAC,CAAC,GACrC;gBAEV,uBACI,oBAAC;oBAAI,WAAU;mBACVJ,mBAAmBG,SAAS,YAAY,EAAEJ;;SAI1D;;AAIjB"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { IWebhookDeliveriesPresenter } from "../abstractions.js";
|
|
3
|
-
interface DeliveryDetailPanelProps {
|
|
4
|
-
presenter: IWebhookDeliveriesPresenter;
|
|
5
|
-
}
|
|
6
|
-
export declare const DeliveryDetailPanel: (({ presenter }: DeliveryDetailPanelProps) => React.JSX.Element | null) & {
|
|
7
|
-
displayName: string;
|
|
8
|
-
};
|
|
9
|
-
export {};
|