@webiny/webhooks 0.0.0-unstable.9f53ea597d → 0.0.0-unstable.a85ef555b2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/admin/WebhookRoutes.js +20 -4
  2. package/admin/WebhookRoutes.js.map +1 -1
  3. package/admin/features/permissions/feature.d.ts +1 -1
  4. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.d.ts +2 -2
  5. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.d.ts +2 -2
  6. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js +37 -24
  7. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js.map +1 -1
  8. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.d.ts +2 -2
  9. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js +3 -3
  10. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js.map +1 -1
  11. package/admin/presentation/WebhookForm/components/SigningSecret.d.ts +2 -2
  12. package/admin/presentation/WebhookList/components/WebhookListContent.d.ts +2 -2
  13. package/api/features/DeleteWebhook/DeleteWebhookRepository.js +2 -1
  14. package/api/features/DeleteWebhook/DeleteWebhookRepository.js.map +1 -1
  15. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js +7 -4
  16. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js.map +1 -1
  17. package/api/features/ListWebhooks/ListWebhooksRepository.js +7 -4
  18. package/api/features/ListWebhooks/ListWebhooksRepository.js.map +1 -1
  19. package/api/features/SendWebhookTask/SendWebhookTask.d.ts +10 -5
  20. package/api/features/SendWebhookTask/SendWebhookTask.js +20 -11
  21. package/api/features/SendWebhookTask/SendWebhookTask.js.map +1 -1
  22. package/api/features/UpdateWebhook/UpdateWebhookRepository.js +3 -1
  23. package/api/features/UpdateWebhook/UpdateWebhookRepository.js.map +1 -1
  24. package/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.js +3 -1
  25. package/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.js.map +1 -1
  26. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js +3 -1
  27. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js.map +1 -1
  28. package/api/graphql/WebhookCrudSchema.d.ts +3 -2
  29. package/api/graphql/WebhookCrudSchema.js +6 -2
  30. package/api/graphql/WebhookCrudSchema.js.map +1 -1
  31. package/api/graphql/WebhookDeliverySchema.d.ts +3 -2
  32. package/api/graphql/WebhookDeliverySchema.js +6 -2
  33. package/api/graphql/WebhookDeliverySchema.js.map +1 -1
  34. package/api/graphql/WebhookEventSchema.d.ts +3 -2
  35. package/api/graphql/WebhookEventSchema.js +6 -2
  36. package/api/graphql/WebhookEventSchema.js.map +1 -1
  37. package/api/graphql/WebhookSettingsSchema.d.ts +3 -2
  38. package/api/graphql/WebhookSettingsSchema.js +6 -2
  39. package/api/graphql/WebhookSettingsSchema.js.map +1 -1
  40. package/api/graphql/WebhookTriggerSchema.d.ts +3 -2
  41. package/api/graphql/WebhookTriggerSchema.js +6 -2
  42. package/api/graphql/WebhookTriggerSchema.js.map +1 -1
  43. package/api/index.d.ts +3 -0
  44. package/api/index.js +1 -1
  45. package/api/index.js.map +1 -1
  46. package/api/models/WebhookDeliveryModel.js +2 -1
  47. package/api/models/WebhookDeliveryModel.js.map +1 -1
  48. package/api/models/WebhookModel.js +2 -1
  49. package/api/models/WebhookModel.js.map +1 -1
  50. package/api/models/WebhookSettingsModel.js +2 -1
  51. package/api/models/WebhookSettingsModel.js.map +1 -1
  52. package/package.json +23 -22
@@ -1 +1 @@
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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"}
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, TaskHandler } 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 = TaskHandler.RunParams<ISendWebhookTaskInput, ISendWebhookTaskOutput>;\n\nclass SendWebhookTaskHandlerImpl implements TaskHandler.Interface<\n ISendWebhookTaskInput,\n ISendWebhookTaskOutput\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\nconst SendWebhookTaskHandler = TaskHandler.createImplementation({\n implementation: SendWebhookTaskHandlerImpl,\n dependencies: [\n GetWebhookRepository,\n GetWebhookDeliveryRepository,\n UpdateWebhookDeliveryRepository,\n WebhookSignPayload,\n TenantContext,\n GetWebhookSettingsRepository,\n WebhookDeliver\n ]\n});\n\nclass SendWebhookTaskDefinition implements TaskDefinition.Interface {\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 handler = SendWebhookTaskHandler;\n}\n\nexport const SendWebhookTask = TaskDefinition.createImplementation({\n implementation: SendWebhookTaskDefinition,\n dependencies: []\n});\n"],"names":["SendWebhookTaskHandlerImpl","getWebhookRepository","getWebhookDeliveryRepository","updateDeliveryRepository","signPayload","tenantContext","getWebhookSettingsRepository","deliver","params","input","controller","taskId","delivery","webhookResult","webhook","now","Date","payload","rawBody","JSON","signHeaders","settingsResult","signingSecret","ex","requestHeaders","result","SendWebhookTaskHandler","TaskHandler","GetWebhookRepository","GetWebhookDeliveryRepository","UpdateWebhookDeliveryRepository","WebhookSignPayload","TenantContext","GetWebhookSettingsRepository","WebhookDeliver","SendWebhookTaskDefinition","SEND_WEBHOOK_TASK","SendWebhookTask","TaskDefinition"],"mappings":"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"}
@@ -24,9 +24,11 @@ class UpdateWebhookRepositoryImpl {
24
24
  });
25
25
  if (entryResult.isFail()) return Result.fail(WebhookPersistenceError.from(entryResult.error));
26
26
  const values = this.transformer.toStorage(webhook);
27
- const { entry } = await this.updateEntryDataFactory.create(modelResult.value, {
27
+ const dataResult = await this.updateEntryDataFactory.create(modelResult.value, {
28
28
  values
29
29
  }, entryResult.value);
30
+ if (dataResult.isFail()) return Result.fail(WebhookPersistenceError.from(dataResult.error));
31
+ const { entry } = dataResult.value;
30
32
  const updateResult = await this.updateEntryRepository.execute(modelResult.value, entry);
31
33
  if (updateResult.isFail()) return Result.fail(WebhookPersistenceError.from(updateResult.error));
32
34
  return Result.ok(webhook);
@@ -1 +1 @@
1
- {"version":3,"file":"api/features/UpdateWebhook/UpdateWebhookRepository.js","sources":["../../../../src/api/features/UpdateWebhook/UpdateWebhookRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { GetModelRepository } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { GetLatestRevisionByEntryIdRepository } from \"@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js\";\nimport { UpdateEntryRepository } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry/index.js\";\nimport { UpdateEntryDataFactory } from \"@webiny/api-headless-cms/exports/api/cms/entry.js\";\nimport { WebhookTransformer } from \"~/api/features/Transformers/abstractions/WebhookTransformer.js\";\nimport { UpdateWebhookRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { WebhookModelNotFoundError, WebhookPersistenceError } from \"~/api/domain/errors.js\";\nimport { WEBHOOK_MODEL_ID } from \"~/api/domain/constants.js\";\nimport type { Webhook, WebhookCmsEntryValues } from \"~/api/domain/Webhook.js\";\n\nclass UpdateWebhookRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private readonly getModelRepository: GetModelRepository.Interface,\n private readonly getLatestRevisionRepository: GetLatestRevisionByEntryIdRepository.Interface,\n private readonly updateEntryDataFactory: UpdateEntryDataFactory.Interface,\n private readonly updateEntryRepository: UpdateEntryRepository.Interface,\n private readonly transformer: WebhookTransformer.Interface\n ) {}\n\n async execute(webhook: Webhook): Promise<Result<Webhook, RepositoryAbstraction.Error>> {\n try {\n const modelResult = await this.getModelRepository.execute(WEBHOOK_MODEL_ID);\n if (modelResult.isFail()) {\n return Result.fail(new WebhookModelNotFoundError(WEBHOOK_MODEL_ID));\n }\n\n const entryResult =\n await this.getLatestRevisionRepository.execute<WebhookCmsEntryValues>(\n modelResult.value,\n { id: webhook.id }\n );\n if (entryResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(entryResult.error));\n }\n\n const values = this.transformer.toStorage(webhook);\n\n const { entry } = await this.updateEntryDataFactory.create<WebhookCmsEntryValues>(\n modelResult.value,\n { values },\n entryResult.value\n );\n\n const updateResult = await this.updateEntryRepository.execute(modelResult.value, entry);\n\n if (updateResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(updateResult.error));\n }\n\n return Result.ok(webhook);\n } catch (error) {\n return Result.fail(WebhookPersistenceError.from(error));\n }\n }\n}\n\nexport const UpdateWebhookRepository = RepositoryAbstraction.createImplementation({\n implementation: UpdateWebhookRepositoryImpl,\n dependencies: [\n GetModelRepository,\n GetLatestRevisionByEntryIdRepository,\n UpdateEntryDataFactory,\n UpdateEntryRepository,\n WebhookTransformer\n ]\n});\n"],"names":["UpdateWebhookRepositoryImpl","getModelRepository","getLatestRevisionRepository","updateEntryDataFactory","updateEntryRepository","transformer","webhook","modelResult","WEBHOOK_MODEL_ID","Result","WebhookModelNotFoundError","entryResult","WebhookPersistenceError","values","entry","updateResult","error","UpdateWebhookRepository","RepositoryAbstraction","GetModelRepository","GetLatestRevisionByEntryIdRepository","UpdateEntryDataFactory","UpdateEntryRepository","WebhookTransformer"],"mappings":";;;;;;;;;AAWA,MAAMA;IACF,YACqBC,kBAAgD,EAChDC,2BAA2E,EAC3EC,sBAAwD,EACxDC,qBAAsD,EACtDC,WAAyC,CAC5D;aALmBJ,kBAAkB,GAAlBA;aACAC,2BAA2B,GAA3BA;aACAC,sBAAsB,GAAtBA;aACAC,qBAAqB,GAArBA;aACAC,WAAW,GAAXA;IAClB;IAEH,MAAM,QAAQC,OAAgB,EAAyD;QACnF,IAAI;YACA,MAAMC,cAAc,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAACC;YAC1D,IAAID,YAAY,MAAM,IAClB,OAAOE,OAAO,IAAI,CAAC,IAAIC,0BAA0BF;YAGrD,MAAMG,cACF,MAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAC1CJ,YAAY,KAAK,EACjB;gBAAE,IAAID,QAAQ,EAAE;YAAC;YAEzB,IAAIK,YAAY,MAAM,IAClB,OAAOF,OAAO,IAAI,CAACG,wBAAwB,IAAI,CAACD,YAAY,KAAK;YAGrE,MAAME,SAAS,IAAI,CAAC,WAAW,CAAC,SAAS,CAACP;YAE1C,MAAM,EAAEQ,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,MAAM,CACtDP,YAAY,KAAK,EACjB;gBAAEM;YAAO,GACTF,YAAY,KAAK;YAGrB,MAAMI,eAAe,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAACR,YAAY,KAAK,EAAEO;YAEjF,IAAIC,aAAa,MAAM,IACnB,OAAON,OAAO,IAAI,CAACG,wBAAwB,IAAI,CAACG,aAAa,KAAK;YAGtE,OAAON,OAAO,EAAE,CAACH;QACrB,EAAE,OAAOU,OAAO;YACZ,OAAOP,OAAO,IAAI,CAACG,wBAAwB,IAAI,CAACI;QACpD;IACJ;AACJ;AAEO,MAAMC,kDAA0BC,wBAAAA,oBAA0C,CAAC;IAC9E,gBAAgBlB;IAChB,cAAc;QACVmB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
1
+ {"version":3,"file":"api/features/UpdateWebhook/UpdateWebhookRepository.js","sources":["../../../../src/api/features/UpdateWebhook/UpdateWebhookRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { GetModelRepository } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { GetLatestRevisionByEntryIdRepository } from \"@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js\";\nimport { UpdateEntryRepository } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry/index.js\";\nimport { UpdateEntryDataFactory } from \"@webiny/api-headless-cms/exports/api/cms/entry.js\";\nimport { WebhookTransformer } from \"~/api/features/Transformers/abstractions/WebhookTransformer.js\";\nimport { UpdateWebhookRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { WebhookModelNotFoundError, WebhookPersistenceError } from \"~/api/domain/errors.js\";\nimport { WEBHOOK_MODEL_ID } from \"~/api/domain/constants.js\";\nimport type { Webhook, WebhookCmsEntryValues } from \"~/api/domain/Webhook.js\";\n\nclass UpdateWebhookRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private readonly getModelRepository: GetModelRepository.Interface,\n private readonly getLatestRevisionRepository: GetLatestRevisionByEntryIdRepository.Interface,\n private readonly updateEntryDataFactory: UpdateEntryDataFactory.Interface,\n private readonly updateEntryRepository: UpdateEntryRepository.Interface,\n private readonly transformer: WebhookTransformer.Interface\n ) {}\n\n async execute(webhook: Webhook): Promise<Result<Webhook, RepositoryAbstraction.Error>> {\n try {\n const modelResult = await this.getModelRepository.execute(WEBHOOK_MODEL_ID);\n if (modelResult.isFail()) {\n return Result.fail(new WebhookModelNotFoundError(WEBHOOK_MODEL_ID));\n }\n\n const entryResult =\n await this.getLatestRevisionRepository.execute<WebhookCmsEntryValues>(\n modelResult.value,\n { id: webhook.id }\n );\n if (entryResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(entryResult.error));\n }\n\n const values = this.transformer.toStorage(webhook);\n\n const dataResult = await this.updateEntryDataFactory.create<WebhookCmsEntryValues>(\n modelResult.value,\n { values },\n entryResult.value\n );\n if (dataResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(dataResult.error));\n }\n const { entry } = dataResult.value;\n\n const updateResult = await this.updateEntryRepository.execute(modelResult.value, entry);\n\n if (updateResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(updateResult.error));\n }\n\n return Result.ok(webhook);\n } catch (error) {\n return Result.fail(WebhookPersistenceError.from(error));\n }\n }\n}\n\nexport const UpdateWebhookRepository = RepositoryAbstraction.createImplementation({\n implementation: UpdateWebhookRepositoryImpl,\n dependencies: [\n GetModelRepository,\n GetLatestRevisionByEntryIdRepository,\n UpdateEntryDataFactory,\n UpdateEntryRepository,\n WebhookTransformer\n ]\n});\n"],"names":["UpdateWebhookRepositoryImpl","getModelRepository","getLatestRevisionRepository","updateEntryDataFactory","updateEntryRepository","transformer","webhook","modelResult","WEBHOOK_MODEL_ID","Result","WebhookModelNotFoundError","entryResult","WebhookPersistenceError","values","dataResult","entry","updateResult","error","UpdateWebhookRepository","RepositoryAbstraction","GetModelRepository","GetLatestRevisionByEntryIdRepository","UpdateEntryDataFactory","UpdateEntryRepository","WebhookTransformer"],"mappings":";;;;;;;;;AAWA,MAAMA;IACF,YACqBC,kBAAgD,EAChDC,2BAA2E,EAC3EC,sBAAwD,EACxDC,qBAAsD,EACtDC,WAAyC,CAC5D;aALmBJ,kBAAkB,GAAlBA;aACAC,2BAA2B,GAA3BA;aACAC,sBAAsB,GAAtBA;aACAC,qBAAqB,GAArBA;aACAC,WAAW,GAAXA;IAClB;IAEH,MAAM,QAAQC,OAAgB,EAAyD;QACnF,IAAI;YACA,MAAMC,cAAc,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAACC;YAC1D,IAAID,YAAY,MAAM,IAClB,OAAOE,OAAO,IAAI,CAAC,IAAIC,0BAA0BF;YAGrD,MAAMG,cACF,MAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAC1CJ,YAAY,KAAK,EACjB;gBAAE,IAAID,QAAQ,EAAE;YAAC;YAEzB,IAAIK,YAAY,MAAM,IAClB,OAAOF,OAAO,IAAI,CAACG,wBAAwB,IAAI,CAACD,YAAY,KAAK;YAGrE,MAAME,SAAS,IAAI,CAAC,WAAW,CAAC,SAAS,CAACP;YAE1C,MAAMQ,aAAa,MAAM,IAAI,CAAC,sBAAsB,CAAC,MAAM,CACvDP,YAAY,KAAK,EACjB;gBAAEM;YAAO,GACTF,YAAY,KAAK;YAErB,IAAIG,WAAW,MAAM,IACjB,OAAOL,OAAO,IAAI,CAACG,wBAAwB,IAAI,CAACE,WAAW,KAAK;YAEpE,MAAM,EAAEC,KAAK,EAAE,GAAGD,WAAW,KAAK;YAElC,MAAME,eAAe,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAACT,YAAY,KAAK,EAAEQ;YAEjF,IAAIC,aAAa,MAAM,IACnB,OAAOP,OAAO,IAAI,CAACG,wBAAwB,IAAI,CAACI,aAAa,KAAK;YAGtE,OAAOP,OAAO,EAAE,CAACH;QACrB,EAAE,OAAOW,OAAO;YACZ,OAAOR,OAAO,IAAI,CAACG,wBAAwB,IAAI,CAACK;QACpD;IACJ;AACJ;AAEO,MAAMC,kDAA0BC,wBAAAA,oBAA0C,CAAC;IAC9E,gBAAgBnB;IAChB,cAAc;QACVoB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -36,9 +36,11 @@ class UpdateWebhookDeliveryRepositoryImpl {
36
36
  responseBody: input.responseBody ?? existing.responseBody
37
37
  };
38
38
  const storageValues = this.transformer.toStorage(updated);
39
- const { entry } = await this.updateEntryDataFactory.create(modelResult.value, {
39
+ const dataResult = await this.updateEntryDataFactory.create(modelResult.value, {
40
40
  values: storageValues
41
41
  }, originalEntry);
42
+ if (dataResult.isFail()) return Result.fail(WebhookPersistenceError.from(dataResult.error));
43
+ const { entry } = dataResult.value;
42
44
  const updateResult = await this.updateEntryRepository.execute(modelResult.value, entry);
43
45
  if (updateResult.isFail()) return Result.fail(WebhookPersistenceError.from(updateResult.error));
44
46
  return Result.ok(updated);
@@ -1 +1 @@
1
- {"version":3,"file":"api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.js","sources":["../../../../src/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { GetModelRepository } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { GetLatestRevisionByEntryIdRepository } from \"@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js\";\nimport { UpdateEntryDataFactory } from \"@webiny/api-headless-cms/exports/api/cms/entry.js\";\nimport { UpdateEntryRepository } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry/index.js\";\nimport { WebhookDeliveryTransformer } from \"~/api/features/Transformers/abstractions/WebhookDeliveryTransformer.js\";\nimport { UpdateWebhookDeliveryRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport {\n WebhookDeliveryNotFoundError,\n WebhookModelNotFoundError,\n WebhookPersistenceError\n} from \"~/api/domain/errors.js\";\nimport { WEBHOOK_DELIVERY_MODEL_ID } from \"~/api/domain/constants.js\";\nimport type { IUpdateDeliveryInput } from \"./abstractions.js\";\nimport type {\n WebhookDelivery,\n WebhookDeliveryCmsEntryValues\n} from \"~/api/domain/WebhookDelivery.js\";\n\nclass UpdateWebhookDeliveryRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private readonly getModelRepository: GetModelRepository.Interface,\n private readonly getLatestRevisionRepository: GetLatestRevisionByEntryIdRepository.Interface,\n private readonly updateEntryDataFactory: UpdateEntryDataFactory.Interface,\n private readonly updateEntryRepository: UpdateEntryRepository.Interface,\n private readonly transformer: WebhookDeliveryTransformer.Interface\n ) {}\n\n async execute(\n id: string,\n input: IUpdateDeliveryInput\n ): Promise<Result<WebhookDelivery, RepositoryAbstraction.Error>> {\n try {\n const modelResult = await this.getModelRepository.execute(WEBHOOK_DELIVERY_MODEL_ID);\n if (modelResult.isFail()) {\n return Result.fail(new WebhookModelNotFoundError(WEBHOOK_DELIVERY_MODEL_ID));\n }\n\n const entryResult =\n await this.getLatestRevisionRepository.execute<WebhookDeliveryCmsEntryValues>(\n modelResult.value,\n { id }\n );\n\n if (entryResult.isFail()) {\n return Result.fail(new WebhookDeliveryNotFoundError(id));\n }\n\n const originalEntry = entryResult.value;\n const existing = this.transformer.fromStorage(originalEntry);\n\n const updated: WebhookDelivery = {\n ...existing,\n backgroundTaskId: input.backgroundTaskId ?? existing.backgroundTaskId,\n status: input.status ?? existing.status,\n payload: input.payload ?? existing.payload,\n requestHeaders: input.requestHeaders ?? existing.requestHeaders,\n responseTime: input.responseTime ?? existing.responseTime,\n responseStatus: input.responseStatus ?? existing.responseStatus,\n responseBody: input.responseBody ?? existing.responseBody\n };\n\n const storageValues = this.transformer.toStorage(updated);\n\n const { entry } =\n await this.updateEntryDataFactory.create<WebhookDeliveryCmsEntryValues>(\n modelResult.value,\n { values: storageValues },\n originalEntry\n );\n\n const updateResult = await this.updateEntryRepository.execute(modelResult.value, entry);\n\n if (updateResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(updateResult.error));\n }\n\n return Result.ok(updated);\n } catch (error) {\n return Result.fail(WebhookPersistenceError.from(error));\n }\n }\n}\n\nexport const UpdateWebhookDeliveryRepository = RepositoryAbstraction.createImplementation({\n implementation: UpdateWebhookDeliveryRepositoryImpl,\n dependencies: [\n GetModelRepository,\n GetLatestRevisionByEntryIdRepository,\n UpdateEntryDataFactory,\n UpdateEntryRepository,\n WebhookDeliveryTransformer\n ]\n});\n"],"names":["UpdateWebhookDeliveryRepositoryImpl","getModelRepository","getLatestRevisionRepository","updateEntryDataFactory","updateEntryRepository","transformer","id","input","modelResult","WEBHOOK_DELIVERY_MODEL_ID","Result","WebhookModelNotFoundError","entryResult","WebhookDeliveryNotFoundError","originalEntry","existing","updated","storageValues","entry","updateResult","WebhookPersistenceError","error","UpdateWebhookDeliveryRepository","RepositoryAbstraction","GetModelRepository","GetLatestRevisionByEntryIdRepository","UpdateEntryDataFactory","UpdateEntryRepository","WebhookDeliveryTransformer"],"mappings":";;;;;;;;;AAmBA,MAAMA;IACF,YACqBC,kBAAgD,EAChDC,2BAA2E,EAC3EC,sBAAwD,EACxDC,qBAAsD,EACtDC,WAAiD,CACpE;aALmBJ,kBAAkB,GAAlBA;aACAC,2BAA2B,GAA3BA;aACAC,sBAAsB,GAAtBA;aACAC,qBAAqB,GAArBA;aACAC,WAAW,GAAXA;IAClB;IAEH,MAAM,QACFC,EAAU,EACVC,KAA2B,EACkC;QAC7D,IAAI;YACA,MAAMC,cAAc,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAACC;YAC1D,IAAID,YAAY,MAAM,IAClB,OAAOE,OAAO,IAAI,CAAC,IAAIC,0BAA0BF;YAGrD,MAAMG,cACF,MAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAC1CJ,YAAY,KAAK,EACjB;gBAAEF;YAAG;YAGb,IAAIM,YAAY,MAAM,IAClB,OAAOF,OAAO,IAAI,CAAC,IAAIG,6BAA6BP;YAGxD,MAAMQ,gBAAgBF,YAAY,KAAK;YACvC,MAAMG,WAAW,IAAI,CAAC,WAAW,CAAC,WAAW,CAACD;YAE9C,MAAME,UAA2B;gBAC7B,GAAGD,QAAQ;gBACX,kBAAkBR,MAAM,gBAAgB,IAAIQ,SAAS,gBAAgB;gBACrE,QAAQR,MAAM,MAAM,IAAIQ,SAAS,MAAM;gBACvC,SAASR,MAAM,OAAO,IAAIQ,SAAS,OAAO;gBAC1C,gBAAgBR,MAAM,cAAc,IAAIQ,SAAS,cAAc;gBAC/D,cAAcR,MAAM,YAAY,IAAIQ,SAAS,YAAY;gBACzD,gBAAgBR,MAAM,cAAc,IAAIQ,SAAS,cAAc;gBAC/D,cAAcR,MAAM,YAAY,IAAIQ,SAAS,YAAY;YAC7D;YAEA,MAAME,gBAAgB,IAAI,CAAC,WAAW,CAAC,SAAS,CAACD;YAEjD,MAAM,EAAEE,KAAK,EAAE,GACX,MAAM,IAAI,CAAC,sBAAsB,CAAC,MAAM,CACpCV,YAAY,KAAK,EACjB;gBAAE,QAAQS;YAAc,GACxBH;YAGR,MAAMK,eAAe,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAACX,YAAY,KAAK,EAAEU;YAEjF,IAAIC,aAAa,MAAM,IACnB,OAAOT,OAAO,IAAI,CAACU,wBAAwB,IAAI,CAACD,aAAa,KAAK;YAGtE,OAAOT,OAAO,EAAE,CAACM;QACrB,EAAE,OAAOK,OAAO;YACZ,OAAOX,OAAO,IAAI,CAACU,wBAAwB,IAAI,CAACC;QACpD;IACJ;AACJ;AAEO,MAAMC,kEAAkCC,gCAAAA,oBAA0C,CAAC;IACtF,gBAAgBvB;IAChB,cAAc;QACVwB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
1
+ {"version":3,"file":"api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.js","sources":["../../../../src/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { GetModelRepository } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { GetLatestRevisionByEntryIdRepository } from \"@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js\";\nimport { UpdateEntryDataFactory } from \"@webiny/api-headless-cms/exports/api/cms/entry.js\";\nimport { UpdateEntryRepository } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry/index.js\";\nimport { WebhookDeliveryTransformer } from \"~/api/features/Transformers/abstractions/WebhookDeliveryTransformer.js\";\nimport { UpdateWebhookDeliveryRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport {\n WebhookDeliveryNotFoundError,\n WebhookModelNotFoundError,\n WebhookPersistenceError\n} from \"~/api/domain/errors.js\";\nimport { WEBHOOK_DELIVERY_MODEL_ID } from \"~/api/domain/constants.js\";\nimport type { IUpdateDeliveryInput } from \"./abstractions.js\";\nimport type {\n WebhookDelivery,\n WebhookDeliveryCmsEntryValues\n} from \"~/api/domain/WebhookDelivery.js\";\n\nclass UpdateWebhookDeliveryRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private readonly getModelRepository: GetModelRepository.Interface,\n private readonly getLatestRevisionRepository: GetLatestRevisionByEntryIdRepository.Interface,\n private readonly updateEntryDataFactory: UpdateEntryDataFactory.Interface,\n private readonly updateEntryRepository: UpdateEntryRepository.Interface,\n private readonly transformer: WebhookDeliveryTransformer.Interface\n ) {}\n\n async execute(\n id: string,\n input: IUpdateDeliveryInput\n ): Promise<Result<WebhookDelivery, RepositoryAbstraction.Error>> {\n try {\n const modelResult = await this.getModelRepository.execute(WEBHOOK_DELIVERY_MODEL_ID);\n if (modelResult.isFail()) {\n return Result.fail(new WebhookModelNotFoundError(WEBHOOK_DELIVERY_MODEL_ID));\n }\n\n const entryResult =\n await this.getLatestRevisionRepository.execute<WebhookDeliveryCmsEntryValues>(\n modelResult.value,\n { id }\n );\n\n if (entryResult.isFail()) {\n return Result.fail(new WebhookDeliveryNotFoundError(id));\n }\n\n const originalEntry = entryResult.value;\n const existing = this.transformer.fromStorage(originalEntry);\n\n const updated: WebhookDelivery = {\n ...existing,\n backgroundTaskId: input.backgroundTaskId ?? existing.backgroundTaskId,\n status: input.status ?? existing.status,\n payload: input.payload ?? existing.payload,\n requestHeaders: input.requestHeaders ?? existing.requestHeaders,\n responseTime: input.responseTime ?? existing.responseTime,\n responseStatus: input.responseStatus ?? existing.responseStatus,\n responseBody: input.responseBody ?? existing.responseBody\n };\n\n const storageValues = this.transformer.toStorage(updated);\n\n const dataResult =\n await this.updateEntryDataFactory.create<WebhookDeliveryCmsEntryValues>(\n modelResult.value,\n { values: storageValues },\n originalEntry\n );\n if (dataResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(dataResult.error));\n }\n const { entry } = dataResult.value;\n\n const updateResult = await this.updateEntryRepository.execute(modelResult.value, entry);\n\n if (updateResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(updateResult.error));\n }\n\n return Result.ok(updated);\n } catch (error) {\n return Result.fail(WebhookPersistenceError.from(error));\n }\n }\n}\n\nexport const UpdateWebhookDeliveryRepository = RepositoryAbstraction.createImplementation({\n implementation: UpdateWebhookDeliveryRepositoryImpl,\n dependencies: [\n GetModelRepository,\n GetLatestRevisionByEntryIdRepository,\n UpdateEntryDataFactory,\n UpdateEntryRepository,\n WebhookDeliveryTransformer\n ]\n});\n"],"names":["UpdateWebhookDeliveryRepositoryImpl","getModelRepository","getLatestRevisionRepository","updateEntryDataFactory","updateEntryRepository","transformer","id","input","modelResult","WEBHOOK_DELIVERY_MODEL_ID","Result","WebhookModelNotFoundError","entryResult","WebhookDeliveryNotFoundError","originalEntry","existing","updated","storageValues","dataResult","WebhookPersistenceError","entry","updateResult","error","UpdateWebhookDeliveryRepository","RepositoryAbstraction","GetModelRepository","GetLatestRevisionByEntryIdRepository","UpdateEntryDataFactory","UpdateEntryRepository","WebhookDeliveryTransformer"],"mappings":";;;;;;;;;AAmBA,MAAMA;IACF,YACqBC,kBAAgD,EAChDC,2BAA2E,EAC3EC,sBAAwD,EACxDC,qBAAsD,EACtDC,WAAiD,CACpE;aALmBJ,kBAAkB,GAAlBA;aACAC,2BAA2B,GAA3BA;aACAC,sBAAsB,GAAtBA;aACAC,qBAAqB,GAArBA;aACAC,WAAW,GAAXA;IAClB;IAEH,MAAM,QACFC,EAAU,EACVC,KAA2B,EACkC;QAC7D,IAAI;YACA,MAAMC,cAAc,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAACC;YAC1D,IAAID,YAAY,MAAM,IAClB,OAAOE,OAAO,IAAI,CAAC,IAAIC,0BAA0BF;YAGrD,MAAMG,cACF,MAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAC1CJ,YAAY,KAAK,EACjB;gBAAEF;YAAG;YAGb,IAAIM,YAAY,MAAM,IAClB,OAAOF,OAAO,IAAI,CAAC,IAAIG,6BAA6BP;YAGxD,MAAMQ,gBAAgBF,YAAY,KAAK;YACvC,MAAMG,WAAW,IAAI,CAAC,WAAW,CAAC,WAAW,CAACD;YAE9C,MAAME,UAA2B;gBAC7B,GAAGD,QAAQ;gBACX,kBAAkBR,MAAM,gBAAgB,IAAIQ,SAAS,gBAAgB;gBACrE,QAAQR,MAAM,MAAM,IAAIQ,SAAS,MAAM;gBACvC,SAASR,MAAM,OAAO,IAAIQ,SAAS,OAAO;gBAC1C,gBAAgBR,MAAM,cAAc,IAAIQ,SAAS,cAAc;gBAC/D,cAAcR,MAAM,YAAY,IAAIQ,SAAS,YAAY;gBACzD,gBAAgBR,MAAM,cAAc,IAAIQ,SAAS,cAAc;gBAC/D,cAAcR,MAAM,YAAY,IAAIQ,SAAS,YAAY;YAC7D;YAEA,MAAME,gBAAgB,IAAI,CAAC,WAAW,CAAC,SAAS,CAACD;YAEjD,MAAME,aACF,MAAM,IAAI,CAAC,sBAAsB,CAAC,MAAM,CACpCV,YAAY,KAAK,EACjB;gBAAE,QAAQS;YAAc,GACxBH;YAER,IAAII,WAAW,MAAM,IACjB,OAAOR,OAAO,IAAI,CAACS,wBAAwB,IAAI,CAACD,WAAW,KAAK;YAEpE,MAAM,EAAEE,KAAK,EAAE,GAAGF,WAAW,KAAK;YAElC,MAAMG,eAAe,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAACb,YAAY,KAAK,EAAEY;YAEjF,IAAIC,aAAa,MAAM,IACnB,OAAOX,OAAO,IAAI,CAACS,wBAAwB,IAAI,CAACE,aAAa,KAAK;YAGtE,OAAOX,OAAO,EAAE,CAACM;QACrB,EAAE,OAAOM,OAAO;YACZ,OAAOZ,OAAO,IAAI,CAACS,wBAAwB,IAAI,CAACG;QACpD;IACJ;AACJ;AAEO,MAAMC,kEAAkCC,gCAAAA,oBAA0C,CAAC;IACtF,gBAAgBxB;IAChB,cAAc;QACVyB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -29,12 +29,14 @@ class UpdateWebhookSettingsRepositoryImpl {
29
29
  id: entryId
30
30
  });
31
31
  if (entryResult.isFail()) return Result.fail(WebhookPersistenceError.from(entryResult.error));
32
- const { entry } = await this.updateEntryDataFactory.create(model, {
32
+ const dataResult = await this.updateEntryDataFactory.create(model, {
33
33
  values: {
34
34
  signingSecret: input.signingSecret,
35
35
  deliveryRetentionDays: input.deliveryRetentionDays
36
36
  }
37
37
  }, entryResult.value);
38
+ if (dataResult.isFail()) return Result.fail(WebhookPersistenceError.from(dataResult.error));
39
+ const { entry } = dataResult.value;
38
40
  const updateResult = await this.updateEntryRepository.execute(model, entry);
39
41
  if (updateResult.isFail()) return Result.fail(WebhookPersistenceError.from(updateResult.error));
40
42
  const settings = {
@@ -1 +1 @@
1
- {"version":3,"file":"api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js","sources":["../../../../src/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { createCacheKey } from \"@webiny/utils\";\nimport { GetModelRepository } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { GetLatestRevisionByEntryIdRepository } from \"@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js\";\nimport { UpdateEntryRepository } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry/index.js\";\nimport { UpdateEntryDataFactory } from \"@webiny/api-headless-cms/exports/api/cms/entry.js\";\nimport { GetWebhookSettingsRepository } from \"~/api/features/GetWebhookSettings/abstractions.js\";\nimport {\n UpdateWebhookSettingsRepository as RepositoryAbstraction,\n type IUpdateWebhookSettingsInput\n} from \"./abstractions.js\";\nimport { WebhookModelNotFoundError, WebhookPersistenceError } from \"~/api/domain/errors.js\";\nimport { WEBHOOK_SETTINGS_MODEL_ID } from \"~/api/domain/constants.js\";\nimport type { IWebhookSettings } from \"~/api/domain/WebhookSettings.js\";\n\ninterface WebhookSettingsValues {\n signingSecret?: string;\n deliveryRetentionDays?: number;\n}\n\nclass UpdateWebhookSettingsRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private readonly getModelRepository: GetModelRepository.Interface,\n private readonly getWebhookSettingsRepository: GetWebhookSettingsRepository.Interface,\n private readonly getLatestRevisionRepository: GetLatestRevisionByEntryIdRepository.Interface,\n private readonly updateEntryRepository: UpdateEntryRepository.Interface,\n private readonly updateEntryDataFactory: UpdateEntryDataFactory.Interface\n ) {}\n\n async execute(\n input: IUpdateWebhookSettingsInput\n ): Promise<Result<IWebhookSettings, RepositoryAbstraction.Error>> {\n try {\n /* Ensure the singleton entry exists (creates if missing). */\n const getResult = await this.getWebhookSettingsRepository.execute();\n if (getResult.isFail()) {\n return getResult;\n }\n\n const modelResult = await this.getModelRepository.execute(WEBHOOK_SETTINGS_MODEL_ID);\n if (modelResult.isFail()) {\n return Result.fail(new WebhookModelNotFoundError(WEBHOOK_SETTINGS_MODEL_ID));\n }\n\n const model = modelResult.value;\n const singletonId = createCacheKey(model.modelId);\n const entryId = `${singletonId}#0001`;\n\n const entryResult =\n await this.getLatestRevisionRepository.execute<WebhookSettingsValues>(model, {\n id: entryId\n });\n\n if (entryResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(entryResult.error));\n }\n\n const { entry } = await this.updateEntryDataFactory.create<WebhookSettingsValues>(\n model,\n {\n values: {\n signingSecret: input.signingSecret,\n deliveryRetentionDays: input.deliveryRetentionDays\n }\n },\n entryResult.value\n );\n\n const updateResult = await this.updateEntryRepository.execute(model, entry);\n if (updateResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(updateResult.error));\n }\n\n const settings: IWebhookSettings = {\n signingSecret: entry.values.signingSecret,\n deliveryRetentionDays: entry.values.deliveryRetentionDays\n };\n\n return Result.ok(settings);\n } catch (error) {\n return Result.fail(WebhookPersistenceError.from(error));\n }\n }\n}\n\nexport const UpdateWebhookSettingsRepository = RepositoryAbstraction.createImplementation({\n implementation: UpdateWebhookSettingsRepositoryImpl,\n dependencies: [\n GetModelRepository,\n GetWebhookSettingsRepository,\n GetLatestRevisionByEntryIdRepository,\n UpdateEntryRepository,\n UpdateEntryDataFactory\n ]\n});\n"],"names":["UpdateWebhookSettingsRepositoryImpl","getModelRepository","getWebhookSettingsRepository","getLatestRevisionRepository","updateEntryRepository","updateEntryDataFactory","input","getResult","modelResult","WEBHOOK_SETTINGS_MODEL_ID","Result","WebhookModelNotFoundError","model","singletonId","createCacheKey","entryId","entryResult","WebhookPersistenceError","entry","updateResult","settings","error","UpdateWebhookSettingsRepository","RepositoryAbstraction","GetModelRepository","GetWebhookSettingsRepository","GetLatestRevisionByEntryIdRepository","UpdateEntryRepository","UpdateEntryDataFactory"],"mappings":";;;;;;;;;;AAoBA,MAAMA;IACF,YACqBC,kBAAgD,EAChDC,4BAAoE,EACpEC,2BAA2E,EAC3EC,qBAAsD,EACtDC,sBAAwD,CAC3E;aALmBJ,kBAAkB,GAAlBA;aACAC,4BAA4B,GAA5BA;aACAC,2BAA2B,GAA3BA;aACAC,qBAAqB,GAArBA;aACAC,sBAAsB,GAAtBA;IAClB;IAEH,MAAM,QACFC,KAAkC,EAC4B;QAC9D,IAAI;YAEA,MAAMC,YAAY,MAAM,IAAI,CAAC,4BAA4B,CAAC,OAAO;YACjE,IAAIA,UAAU,MAAM,IAChB,OAAOA;YAGX,MAAMC,cAAc,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAACC;YAC1D,IAAID,YAAY,MAAM,IAClB,OAAOE,OAAO,IAAI,CAAC,IAAIC,0BAA0BF;YAGrD,MAAMG,QAAQJ,YAAY,KAAK;YAC/B,MAAMK,cAAcC,eAAeF,MAAM,OAAO;YAChD,MAAMG,UAAU,GAAGF,YAAY,KAAK,CAAC;YAErC,MAAMG,cACF,MAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAwBJ,OAAO;gBACzE,IAAIG;YACR;YAEJ,IAAIC,YAAY,MAAM,IAClB,OAAON,OAAO,IAAI,CAACO,wBAAwB,IAAI,CAACD,YAAY,KAAK;YAGrE,MAAM,EAAEE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,MAAM,CACtDN,OACA;gBACI,QAAQ;oBACJ,eAAeN,MAAM,aAAa;oBAClC,uBAAuBA,MAAM,qBAAqB;gBACtD;YACJ,GACAU,YAAY,KAAK;YAGrB,MAAMG,eAAe,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAACP,OAAOM;YACrE,IAAIC,aAAa,MAAM,IACnB,OAAOT,OAAO,IAAI,CAACO,wBAAwB,IAAI,CAACE,aAAa,KAAK;YAGtE,MAAMC,WAA6B;gBAC/B,eAAeF,MAAM,MAAM,CAAC,aAAa;gBACzC,uBAAuBA,MAAM,MAAM,CAAC,qBAAqB;YAC7D;YAEA,OAAOR,OAAO,EAAE,CAACU;QACrB,EAAE,OAAOC,OAAO;YACZ,OAAOX,OAAO,IAAI,CAACO,wBAAwB,IAAI,CAACI;QACpD;IACJ;AACJ;AAEO,MAAMC,kEAAkCC,gCAAAA,oBAA0C,CAAC;IACtF,gBAAgBvB;IAChB,cAAc;QACVwB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
1
+ {"version":3,"file":"api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js","sources":["../../../../src/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { createCacheKey } from \"@webiny/utils\";\nimport { GetModelRepository } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { GetLatestRevisionByEntryIdRepository } from \"@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js\";\nimport { UpdateEntryRepository } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry/index.js\";\nimport { UpdateEntryDataFactory } from \"@webiny/api-headless-cms/exports/api/cms/entry.js\";\nimport { GetWebhookSettingsRepository } from \"~/api/features/GetWebhookSettings/abstractions.js\";\nimport {\n UpdateWebhookSettingsRepository as RepositoryAbstraction,\n type IUpdateWebhookSettingsInput\n} from \"./abstractions.js\";\nimport { WebhookModelNotFoundError, WebhookPersistenceError } from \"~/api/domain/errors.js\";\nimport { WEBHOOK_SETTINGS_MODEL_ID } from \"~/api/domain/constants.js\";\nimport type { IWebhookSettings } from \"~/api/domain/WebhookSettings.js\";\n\ninterface WebhookSettingsValues {\n signingSecret?: string;\n deliveryRetentionDays?: number;\n}\n\nclass UpdateWebhookSettingsRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private readonly getModelRepository: GetModelRepository.Interface,\n private readonly getWebhookSettingsRepository: GetWebhookSettingsRepository.Interface,\n private readonly getLatestRevisionRepository: GetLatestRevisionByEntryIdRepository.Interface,\n private readonly updateEntryRepository: UpdateEntryRepository.Interface,\n private readonly updateEntryDataFactory: UpdateEntryDataFactory.Interface\n ) {}\n\n async execute(\n input: IUpdateWebhookSettingsInput\n ): Promise<Result<IWebhookSettings, RepositoryAbstraction.Error>> {\n try {\n /* Ensure the singleton entry exists (creates if missing). */\n const getResult = await this.getWebhookSettingsRepository.execute();\n if (getResult.isFail()) {\n return getResult;\n }\n\n const modelResult = await this.getModelRepository.execute(WEBHOOK_SETTINGS_MODEL_ID);\n if (modelResult.isFail()) {\n return Result.fail(new WebhookModelNotFoundError(WEBHOOK_SETTINGS_MODEL_ID));\n }\n\n const model = modelResult.value;\n const singletonId = createCacheKey(model.modelId);\n const entryId = `${singletonId}#0001`;\n\n const entryResult =\n await this.getLatestRevisionRepository.execute<WebhookSettingsValues>(model, {\n id: entryId\n });\n\n if (entryResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(entryResult.error));\n }\n\n const dataResult = await this.updateEntryDataFactory.create<WebhookSettingsValues>(\n model,\n {\n values: {\n signingSecret: input.signingSecret,\n deliveryRetentionDays: input.deliveryRetentionDays\n }\n },\n entryResult.value\n );\n if (dataResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(dataResult.error));\n }\n const { entry } = dataResult.value;\n\n const updateResult = await this.updateEntryRepository.execute(model, entry);\n if (updateResult.isFail()) {\n return Result.fail(WebhookPersistenceError.from(updateResult.error));\n }\n\n const settings: IWebhookSettings = {\n signingSecret: entry.values.signingSecret,\n deliveryRetentionDays: entry.values.deliveryRetentionDays\n };\n\n return Result.ok(settings);\n } catch (error) {\n return Result.fail(WebhookPersistenceError.from(error));\n }\n }\n}\n\nexport const UpdateWebhookSettingsRepository = RepositoryAbstraction.createImplementation({\n implementation: UpdateWebhookSettingsRepositoryImpl,\n dependencies: [\n GetModelRepository,\n GetWebhookSettingsRepository,\n GetLatestRevisionByEntryIdRepository,\n UpdateEntryRepository,\n UpdateEntryDataFactory\n ]\n});\n"],"names":["UpdateWebhookSettingsRepositoryImpl","getModelRepository","getWebhookSettingsRepository","getLatestRevisionRepository","updateEntryRepository","updateEntryDataFactory","input","getResult","modelResult","WEBHOOK_SETTINGS_MODEL_ID","Result","WebhookModelNotFoundError","model","singletonId","createCacheKey","entryId","entryResult","WebhookPersistenceError","dataResult","entry","updateResult","settings","error","UpdateWebhookSettingsRepository","RepositoryAbstraction","GetModelRepository","GetWebhookSettingsRepository","GetLatestRevisionByEntryIdRepository","UpdateEntryRepository","UpdateEntryDataFactory"],"mappings":";;;;;;;;;;AAoBA,MAAMA;IACF,YACqBC,kBAAgD,EAChDC,4BAAoE,EACpEC,2BAA2E,EAC3EC,qBAAsD,EACtDC,sBAAwD,CAC3E;aALmBJ,kBAAkB,GAAlBA;aACAC,4BAA4B,GAA5BA;aACAC,2BAA2B,GAA3BA;aACAC,qBAAqB,GAArBA;aACAC,sBAAsB,GAAtBA;IAClB;IAEH,MAAM,QACFC,KAAkC,EAC4B;QAC9D,IAAI;YAEA,MAAMC,YAAY,MAAM,IAAI,CAAC,4BAA4B,CAAC,OAAO;YACjE,IAAIA,UAAU,MAAM,IAChB,OAAOA;YAGX,MAAMC,cAAc,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAACC;YAC1D,IAAID,YAAY,MAAM,IAClB,OAAOE,OAAO,IAAI,CAAC,IAAIC,0BAA0BF;YAGrD,MAAMG,QAAQJ,YAAY,KAAK;YAC/B,MAAMK,cAAcC,eAAeF,MAAM,OAAO;YAChD,MAAMG,UAAU,GAAGF,YAAY,KAAK,CAAC;YAErC,MAAMG,cACF,MAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAwBJ,OAAO;gBACzE,IAAIG;YACR;YAEJ,IAAIC,YAAY,MAAM,IAClB,OAAON,OAAO,IAAI,CAACO,wBAAwB,IAAI,CAACD,YAAY,KAAK;YAGrE,MAAME,aAAa,MAAM,IAAI,CAAC,sBAAsB,CAAC,MAAM,CACvDN,OACA;gBACI,QAAQ;oBACJ,eAAeN,MAAM,aAAa;oBAClC,uBAAuBA,MAAM,qBAAqB;gBACtD;YACJ,GACAU,YAAY,KAAK;YAErB,IAAIE,WAAW,MAAM,IACjB,OAAOR,OAAO,IAAI,CAACO,wBAAwB,IAAI,CAACC,WAAW,KAAK;YAEpE,MAAM,EAAEC,KAAK,EAAE,GAAGD,WAAW,KAAK;YAElC,MAAME,eAAe,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAACR,OAAOO;YACrE,IAAIC,aAAa,MAAM,IACnB,OAAOV,OAAO,IAAI,CAACO,wBAAwB,IAAI,CAACG,aAAa,KAAK;YAGtE,MAAMC,WAA6B;gBAC/B,eAAeF,MAAM,MAAM,CAAC,aAAa;gBACzC,uBAAuBA,MAAM,MAAM,CAAC,qBAAqB;YAC7D;YAEA,OAAOT,OAAO,EAAE,CAACW;QACrB,EAAE,OAAOC,OAAO;YACZ,OAAOZ,OAAO,IAAI,CAACO,wBAAwB,IAAI,CAACK;QACpD;IACJ;AACJ;AAEO,MAAMC,kEAAkCC,gCAAAA,oBAA0C,CAAC;IACtF,gBAAgBxB;IAChB,cAAc;QACVyB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -1,8 +1,9 @@
1
- import { GraphQLSchemaFactory } from "@webiny/handler-graphql/graphql/abstractions.js";
1
+ import { GraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
2
2
  declare class WebhookCrudSchema_ implements GraphQLSchemaFactory.Interface {
3
+ getSchemaKey: () => string;
3
4
  execute(builder: GraphQLSchemaFactory.SchemaBuilder): Promise<GraphQLSchemaFactory.SchemaBuilder>;
4
5
  }
5
6
  export declare const WebhookCrudSchema: typeof WebhookCrudSchema_ & {
6
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/handler-graphql/graphql/abstractions.public").IGraphQLSchemaFactory>;
7
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-graphql/graphql/abstractions.public").IGraphQLSchemaFactory>;
7
8
  };
8
9
  export {};
@@ -1,5 +1,6 @@
1
- import { GraphQLSchemaFactory } from "@webiny/handler-graphql/graphql/abstractions.js";
2
- import { ErrorResponse, ListErrorResponse, ListResponse, Response } from "@webiny/handler-graphql";
1
+ import { GraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
2
+ import { staticSchemaKey } from "@webiny/api-graphql/graphql/staticSchemaKey.js";
3
+ import { ErrorResponse, ListErrorResponse, ListResponse, Response } from "@webiny/api-graphql";
3
4
  import { ListWebhooksUseCase } from "../features/ListWebhooks/abstractions.js";
4
5
  import { GetWebhookUseCase } from "../features/GetWebhook/abstractions.js";
5
6
  import { CreateWebhookUseCase } from "../features/CreateWebhook/abstractions.js";
@@ -167,6 +168,9 @@ class WebhookCrudSchema_ {
167
168
  });
168
169
  return builder;
169
170
  }
171
+ constructor(){
172
+ this.getSchemaKey = staticSchemaKey("webhooks/WebhookCrudSchema_");
173
+ }
170
174
  }
171
175
  const WebhookCrudSchema = GraphQLSchemaFactory.createImplementation({
172
176
  implementation: WebhookCrudSchema_,
@@ -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 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"}
1
+ {"version":3,"file":"api/graphql/WebhookCrudSchema.js","sources":["../../../src/api/graphql/WebhookCrudSchema.ts"],"sourcesContent":["import { GraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport { staticSchemaKey } from \"@webiny/api-graphql/graphql/staticSchemaKey.js\";\nimport { Response } from \"@webiny/api-graphql\";\nimport { ErrorResponse } from \"@webiny/api-graphql\";\nimport { ListResponse } from \"@webiny/api-graphql\";\nimport { ListErrorResponse } from \"@webiny/api-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 public getSchemaKey = staticSchemaKey(\"webhooks/WebhookCrudSchema_\");\n\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","staticSchemaKey","WebhookCrudSchema","GraphQLSchemaFactory"],"mappings":";;;;;;;;AA0BA,MAAMA;IAGF,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;;aAtLO,YAAY,GAAGiB,gBAAgB;;AAuL1C;AAEO,MAAMC,oBAAoBC,qBAAqB,oBAAoB,CAAC;IACvE,gBAAgBpB;IAChB,cAAc,EAAE;AACpB"}
@@ -1,8 +1,9 @@
1
- import { GraphQLSchemaFactory } from "@webiny/handler-graphql/graphql/abstractions.js";
1
+ import { GraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
2
2
  declare class WebhookDeliverySchema_ implements GraphQLSchemaFactory.Interface {
3
+ getSchemaKey: () => string;
3
4
  execute(builder: GraphQLSchemaFactory.SchemaBuilder): Promise<GraphQLSchemaFactory.SchemaBuilder>;
4
5
  }
5
6
  export declare const WebhookDeliverySchema: typeof WebhookDeliverySchema_ & {
6
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/handler-graphql/graphql/abstractions.public").IGraphQLSchemaFactory>;
7
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-graphql/graphql/abstractions.public").IGraphQLSchemaFactory>;
7
8
  };
8
9
  export {};
@@ -1,5 +1,6 @@
1
- import { GraphQLSchemaFactory } from "@webiny/handler-graphql/graphql/abstractions.js";
2
- import { ErrorResponse, ListErrorResponse, ListResponse, Response } from "@webiny/handler-graphql";
1
+ import { GraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
2
+ import { staticSchemaKey } from "@webiny/api-graphql/graphql/staticSchemaKey.js";
3
+ import { ErrorResponse, ListErrorResponse, ListResponse, Response } from "@webiny/api-graphql";
3
4
  import { ListWebhookDeliveriesUseCase } from "../features/ListWebhookDeliveries/abstractions.js";
4
5
  import { GetWebhookDeliveryUseCase } from "../features/GetWebhookDelivery/abstractions.js";
5
6
  import { ResendWebhookDeliveryUseCase } from "../features/ResendWebhookDelivery/abstractions.js";
@@ -90,6 +91,9 @@ class WebhookDeliverySchema_ {
90
91
  });
91
92
  return builder;
92
93
  }
94
+ constructor(){
95
+ this.getSchemaKey = staticSchemaKey("webhooks/WebhookDeliverySchema_");
96
+ }
93
97
  }
94
98
  const WebhookDeliverySchema = GraphQLSchemaFactory.createImplementation({
95
99
  implementation: WebhookDeliverySchema_,
@@ -1 +1 @@
1
- {"version":3,"file":"api/graphql/WebhookDeliverySchema.js","sources":["../../../src/api/graphql/WebhookDeliverySchema.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 { ListWebhookDeliveriesUseCase } from \"~/api/features/ListWebhookDeliveries/abstractions.js\";\nimport { GetWebhookDeliveryUseCase } from \"~/api/features/GetWebhookDelivery/abstractions.js\";\nimport { ResendWebhookDeliveryUseCase } from \"~/api/features/ResendWebhookDelivery/abstractions.js\";\n\ninterface IListDeliveriesArgs {\n where?: {\n webhookId_eq?: string;\n eventType_in?: string[];\n status_in?: string[];\n };\n limit?: number;\n after?: string;\n}\n\ninterface IIdArgs {\n id: string;\n}\n\nclass WebhookDeliverySchema_ implements GraphQLSchemaFactory.Interface {\n async execute(\n builder: GraphQLSchemaFactory.SchemaBuilder\n ): Promise<GraphQLSchemaFactory.SchemaBuilder> {\n builder.addTypeDefs(/* GraphQL */ `\n type WebhookDelivery {\n id: ID!\n webhookId: ID!\n backgroundTaskId: String\n eventType: String!\n status: String!\n payload: JSON\n requestHeaders: JSON\n responseHeaders: JSON\n responseTime: Int\n responseStatus: Int\n responseBody: String\n createdOn: DateTime!\n }\n\n input WebhookDeliveryListWhereInput {\n webhookId_eq: ID\n eventType_in: [String!]\n status_in: [String!]\n }\n\n type WebhookDeliveryResponse {\n data: WebhookDelivery\n error: WebhookError\n }\n\n type WebhookDeliveryListResponse {\n data: [WebhookDelivery!]\n meta: WebhookListMeta\n error: WebhookError\n }\n\n extend type WebhookQuery {\n listWebhookDeliveries(\n where: WebhookDeliveryListWhereInput\n limit: Int\n after: String\n ): WebhookDeliveryListResponse!\n getWebhookDelivery(id: ID!): WebhookDeliveryResponse!\n }\n\n extend type WebhookMutation {\n resendWebhookDelivery(id: ID!): BooleanResponse!\n }\n `);\n\n builder.addResolver<IListDeliveriesArgs>({\n path: \"WebhookQuery.listWebhookDeliveries\",\n dependencies: [ListWebhookDeliveriesUseCase],\n resolver: (listDeliveries: ListWebhookDeliveriesUseCase.Interface) => {\n return async ({ args }) => {\n const result = await listDeliveries.execute({\n where: args.where,\n limit: args.limit,\n after: args.after\n });\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.getWebhookDelivery\",\n dependencies: [GetWebhookDeliveryUseCase],\n resolver: (getDelivery: GetWebhookDeliveryUseCase.Interface) => {\n return async ({ args }) => {\n const result = await getDelivery.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<IIdArgs>({\n path: \"WebhookMutation.resendWebhookDelivery\",\n dependencies: [ResendWebhookDeliveryUseCase],\n resolver: (resend: ResendWebhookDeliveryUseCase.Interface) => {\n return async ({ args }) => {\n const result = await resend.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 WebhookDeliverySchema = GraphQLSchemaFactory.createImplementation({\n implementation: WebhookDeliverySchema_,\n dependencies: []\n});\n"],"names":["WebhookDeliverySchema_","builder","ListWebhookDeliveriesUseCase","listDeliveries","args","result","ListErrorResponse","ListResponse","GetWebhookDeliveryUseCase","getDelivery","ErrorResponse","Response","ResendWebhookDeliveryUseCase","resend","WebhookDeliverySchema","GraphQLSchemaFactory"],"mappings":";;;;;AAuBA,MAAMA;IACF,MAAM,QACFC,OAA2C,EACA;QAC3CA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA6CnC,CAAC;QAEDA,QAAQ,WAAW,CAAsB;YACrC,MAAM;YACN,cAAc;gBAACC;aAA6B;YAC5C,UAAU,CAACC,iBACA,OAAO,EAAEC,IAAI,EAAE;oBAClB,MAAMC,SAAS,MAAMF,eAAe,OAAO,CAAC;wBACxC,OAAOC,KAAK,KAAK;wBACjB,OAAOA,KAAK,KAAK;wBACjB,OAAOA,KAAK,KAAK;oBACrB;oBACA,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;aAA0B;YACzC,UAAU,CAACC,cACA,OAAO,EAAEL,IAAI,EAAE;oBAClB,MAAMC,SAAS,MAAMI,YAAY,OAAO,CAACL,KAAK,EAAE;oBAChD,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;gBAACW;aAA6B;YAC5C,UAAU,CAACC,SACA,OAAO,EAAET,IAAI,EAAE;oBAClB,MAAMC,SAAS,MAAMQ,OAAO,OAAO,CAACT,KAAK,EAAE;oBAC3C,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIK,cAAcL,OAAO,KAAK;oBAEzC,OAAO,IAAIM,SAAS;gBACxB;QAER;QAEA,OAAOV;IACX;AACJ;AAEO,MAAMa,wBAAwBC,qBAAqB,oBAAoB,CAAC;IAC3E,gBAAgBf;IAChB,cAAc,EAAE;AACpB"}
1
+ {"version":3,"file":"api/graphql/WebhookDeliverySchema.js","sources":["../../../src/api/graphql/WebhookDeliverySchema.ts"],"sourcesContent":["import { GraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport { staticSchemaKey } from \"@webiny/api-graphql/graphql/staticSchemaKey.js\";\nimport { Response } from \"@webiny/api-graphql\";\nimport { ErrorResponse } from \"@webiny/api-graphql\";\nimport { ListResponse } from \"@webiny/api-graphql\";\nimport { ListErrorResponse } from \"@webiny/api-graphql\";\nimport { ListWebhookDeliveriesUseCase } from \"~/api/features/ListWebhookDeliveries/abstractions.js\";\nimport { GetWebhookDeliveryUseCase } from \"~/api/features/GetWebhookDelivery/abstractions.js\";\nimport { ResendWebhookDeliveryUseCase } from \"~/api/features/ResendWebhookDelivery/abstractions.js\";\n\ninterface IListDeliveriesArgs {\n where?: {\n webhookId_eq?: string;\n eventType_in?: string[];\n status_in?: string[];\n };\n limit?: number;\n after?: string;\n}\n\ninterface IIdArgs {\n id: string;\n}\n\nclass WebhookDeliverySchema_ implements GraphQLSchemaFactory.Interface {\n public getSchemaKey = staticSchemaKey(\"webhooks/WebhookDeliverySchema_\");\n\n async execute(\n builder: GraphQLSchemaFactory.SchemaBuilder\n ): Promise<GraphQLSchemaFactory.SchemaBuilder> {\n builder.addTypeDefs(/* GraphQL */ `\n type WebhookDelivery {\n id: ID!\n webhookId: ID!\n backgroundTaskId: String\n eventType: String!\n status: String!\n payload: JSON\n requestHeaders: JSON\n responseHeaders: JSON\n responseTime: Int\n responseStatus: Int\n responseBody: String\n createdOn: DateTime!\n }\n\n input WebhookDeliveryListWhereInput {\n webhookId_eq: ID\n eventType_in: [String!]\n status_in: [String!]\n }\n\n type WebhookDeliveryResponse {\n data: WebhookDelivery\n error: WebhookError\n }\n\n type WebhookDeliveryListResponse {\n data: [WebhookDelivery!]\n meta: WebhookListMeta\n error: WebhookError\n }\n\n extend type WebhookQuery {\n listWebhookDeliveries(\n where: WebhookDeliveryListWhereInput\n limit: Int\n after: String\n ): WebhookDeliveryListResponse!\n getWebhookDelivery(id: ID!): WebhookDeliveryResponse!\n }\n\n extend type WebhookMutation {\n resendWebhookDelivery(id: ID!): BooleanResponse!\n }\n `);\n\n builder.addResolver<IListDeliveriesArgs>({\n path: \"WebhookQuery.listWebhookDeliveries\",\n dependencies: [ListWebhookDeliveriesUseCase],\n resolver: (listDeliveries: ListWebhookDeliveriesUseCase.Interface) => {\n return async ({ args }) => {\n const result = await listDeliveries.execute({\n where: args.where,\n limit: args.limit,\n after: args.after\n });\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.getWebhookDelivery\",\n dependencies: [GetWebhookDeliveryUseCase],\n resolver: (getDelivery: GetWebhookDeliveryUseCase.Interface) => {\n return async ({ args }) => {\n const result = await getDelivery.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<IIdArgs>({\n path: \"WebhookMutation.resendWebhookDelivery\",\n dependencies: [ResendWebhookDeliveryUseCase],\n resolver: (resend: ResendWebhookDeliveryUseCase.Interface) => {\n return async ({ args }) => {\n const result = await resend.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 WebhookDeliverySchema = GraphQLSchemaFactory.createImplementation({\n implementation: WebhookDeliverySchema_,\n dependencies: []\n});\n"],"names":["WebhookDeliverySchema_","builder","ListWebhookDeliveriesUseCase","listDeliveries","args","result","ListErrorResponse","ListResponse","GetWebhookDeliveryUseCase","getDelivery","ErrorResponse","Response","ResendWebhookDeliveryUseCase","resend","staticSchemaKey","WebhookDeliverySchema","GraphQLSchemaFactory"],"mappings":";;;;;;AAwBA,MAAMA;IAGF,MAAM,QACFC,OAA2C,EACA;QAC3CA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA6CnC,CAAC;QAEDA,QAAQ,WAAW,CAAsB;YACrC,MAAM;YACN,cAAc;gBAACC;aAA6B;YAC5C,UAAU,CAACC,iBACA,OAAO,EAAEC,IAAI,EAAE;oBAClB,MAAMC,SAAS,MAAMF,eAAe,OAAO,CAAC;wBACxC,OAAOC,KAAK,KAAK;wBACjB,OAAOA,KAAK,KAAK;wBACjB,OAAOA,KAAK,KAAK;oBACrB;oBACA,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;aAA0B;YACzC,UAAU,CAACC,cACA,OAAO,EAAEL,IAAI,EAAE;oBAClB,MAAMC,SAAS,MAAMI,YAAY,OAAO,CAACL,KAAK,EAAE;oBAChD,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;gBAACW;aAA6B;YAC5C,UAAU,CAACC,SACA,OAAO,EAAET,IAAI,EAAE;oBAClB,MAAMC,SAAS,MAAMQ,OAAO,OAAO,CAACT,KAAK,EAAE;oBAC3C,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIK,cAAcL,OAAO,KAAK;oBAEzC,OAAO,IAAIM,SAAS;gBACxB;QAER;QAEA,OAAOV;IACX;;aAnGO,YAAY,GAAGa,gBAAgB;;AAoG1C;AAEO,MAAMC,wBAAwBC,qBAAqB,oBAAoB,CAAC;IAC3E,gBAAgBhB;IAChB,cAAc,EAAE;AACpB"}
@@ -1,8 +1,9 @@
1
- import { GraphQLSchemaFactory } from "@webiny/handler-graphql/graphql/abstractions.js";
1
+ import { GraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
2
2
  declare class WebhookEventSchema_ implements GraphQLSchemaFactory.Interface {
3
+ getSchemaKey: () => string;
3
4
  execute(builder: GraphQLSchemaFactory.SchemaBuilder): Promise<GraphQLSchemaFactory.SchemaBuilder>;
4
5
  }
5
6
  export declare const WebhookEventSchema: typeof WebhookEventSchema_ & {
6
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/handler-graphql/graphql/abstractions.public").IGraphQLSchemaFactory>;
7
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-graphql/graphql/abstractions.public").IGraphQLSchemaFactory>;
7
8
  };
8
9
  export {};
@@ -1,5 +1,6 @@
1
- import { GraphQLSchemaFactory } from "@webiny/handler-graphql/graphql/abstractions.js";
2
- import { ErrorResponse, Response } from "@webiny/handler-graphql";
1
+ import { GraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
2
+ import { staticSchemaKey } from "@webiny/api-graphql/graphql/staticSchemaKey.js";
3
+ import { ErrorResponse, Response } from "@webiny/api-graphql";
3
4
  import { ListAvailableWebhookEventsUseCase } from "../features/ListAvailableWebhookEvents/abstractions.js";
4
5
  class WebhookEventSchema_ {
5
6
  async execute(builder) {
@@ -35,6 +36,9 @@ class WebhookEventSchema_ {
35
36
  });
36
37
  return builder;
37
38
  }
39
+ constructor(){
40
+ this.getSchemaKey = staticSchemaKey("webhooks/WebhookEventSchema_");
41
+ }
38
42
  }
39
43
  const WebhookEventSchema = GraphQLSchemaFactory.createImplementation({
40
44
  implementation: WebhookEventSchema_,
@@ -1 +1 @@
1
- {"version":3,"file":"api/graphql/WebhookEventSchema.js","sources":["../../../src/api/graphql/WebhookEventSchema.ts"],"sourcesContent":["import { GraphQLSchemaFactory } from \"@webiny/handler-graphql/graphql/abstractions.js\";\nimport { Response } from \"@webiny/handler-graphql\";\nimport { ErrorResponse } from \"@webiny/handler-graphql\";\nimport { ListAvailableWebhookEventsUseCase } from \"~/api/features/ListAvailableWebhookEvents/abstractions.js\";\n\nclass WebhookEventSchema_ implements GraphQLSchemaFactory.Interface {\n async execute(\n builder: GraphQLSchemaFactory.SchemaBuilder\n ): Promise<GraphQLSchemaFactory.SchemaBuilder> {\n builder.addTypeDefs(/* GraphQL */ `\n type WebhookEvent {\n app: String!\n appLabel: String!\n entity: String!\n entityLabel: String!\n eventName: String!\n label: String!\n }\n\n type WebhookEventListResponse {\n data: [WebhookEvent!]\n error: WebhookError\n }\n\n extend type WebhookQuery {\n listAvailableWebhookEvents: WebhookEventListResponse!\n }\n `);\n\n builder.addResolver({\n path: \"WebhookQuery.listAvailableWebhookEvents\",\n dependencies: [ListAvailableWebhookEventsUseCase],\n resolver: (listEvents: ListAvailableWebhookEventsUseCase.Interface) => {\n return async () => {\n const result = await listEvents.execute();\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(result.value);\n };\n }\n });\n\n return builder;\n }\n}\n\nexport const WebhookEventSchema = GraphQLSchemaFactory.createImplementation({\n implementation: WebhookEventSchema_,\n dependencies: []\n});\n"],"names":["WebhookEventSchema_","builder","ListAvailableWebhookEventsUseCase","listEvents","result","ErrorResponse","Response","WebhookEventSchema","GraphQLSchemaFactory"],"mappings":";;;AAKA,MAAMA;IACF,MAAM,QACFC,OAA2C,EACA;QAC3CA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;QAkBnC,CAAC;QAEDA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,cAAc;gBAACC;aAAkC;YACjD,UAAU,CAACC,aACA;oBACH,MAAMC,SAAS,MAAMD,WAAW,OAAO;oBACvC,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIC,cAAcD,OAAO,KAAK;oBAEzC,OAAO,IAAIE,SAASF,OAAO,KAAK;gBACpC;QAER;QAEA,OAAOH;IACX;AACJ;AAEO,MAAMM,qBAAqBC,qBAAqB,oBAAoB,CAAC;IACxE,gBAAgBR;IAChB,cAAc,EAAE;AACpB"}
1
+ {"version":3,"file":"api/graphql/WebhookEventSchema.js","sources":["../../../src/api/graphql/WebhookEventSchema.ts"],"sourcesContent":["import { GraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport { staticSchemaKey } from \"@webiny/api-graphql/graphql/staticSchemaKey.js\";\nimport { Response } from \"@webiny/api-graphql\";\nimport { ErrorResponse } from \"@webiny/api-graphql\";\nimport { ListAvailableWebhookEventsUseCase } from \"~/api/features/ListAvailableWebhookEvents/abstractions.js\";\n\nclass WebhookEventSchema_ implements GraphQLSchemaFactory.Interface {\n public getSchemaKey = staticSchemaKey(\"webhooks/WebhookEventSchema_\");\n\n async execute(\n builder: GraphQLSchemaFactory.SchemaBuilder\n ): Promise<GraphQLSchemaFactory.SchemaBuilder> {\n builder.addTypeDefs(/* GraphQL */ `\n type WebhookEvent {\n app: String!\n appLabel: String!\n entity: String!\n entityLabel: String!\n eventName: String!\n label: String!\n }\n\n type WebhookEventListResponse {\n data: [WebhookEvent!]\n error: WebhookError\n }\n\n extend type WebhookQuery {\n listAvailableWebhookEvents: WebhookEventListResponse!\n }\n `);\n\n builder.addResolver({\n path: \"WebhookQuery.listAvailableWebhookEvents\",\n dependencies: [ListAvailableWebhookEventsUseCase],\n resolver: (listEvents: ListAvailableWebhookEventsUseCase.Interface) => {\n return async () => {\n const result = await listEvents.execute();\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(result.value);\n };\n }\n });\n\n return builder;\n }\n}\n\nexport const WebhookEventSchema = GraphQLSchemaFactory.createImplementation({\n implementation: WebhookEventSchema_,\n dependencies: []\n});\n"],"names":["WebhookEventSchema_","builder","ListAvailableWebhookEventsUseCase","listEvents","result","ErrorResponse","Response","staticSchemaKey","WebhookEventSchema","GraphQLSchemaFactory"],"mappings":";;;;AAMA,MAAMA;IAGF,MAAM,QACFC,OAA2C,EACA;QAC3CA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;QAkBnC,CAAC;QAEDA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,cAAc;gBAACC;aAAkC;YACjD,UAAU,CAACC,aACA;oBACH,MAAMC,SAAS,MAAMD,WAAW,OAAO;oBACvC,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIC,cAAcD,OAAO,KAAK;oBAEzC,OAAO,IAAIE,SAASF,OAAO,KAAK;gBACpC;QAER;QAEA,OAAOH;IACX;;aAxCO,YAAY,GAAGM,gBAAgB;;AAyC1C;AAEO,MAAMC,qBAAqBC,qBAAqB,oBAAoB,CAAC;IACxE,gBAAgBT;IAChB,cAAc,EAAE;AACpB"}
@@ -1,8 +1,9 @@
1
- import { GraphQLSchemaFactory } from "@webiny/handler-graphql/graphql/abstractions.js";
1
+ import { GraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
2
2
  declare class WebhookSettingsSchema_ implements GraphQLSchemaFactory.Interface {
3
+ getSchemaKey: () => string;
3
4
  execute(builder: GraphQLSchemaFactory.SchemaBuilder): Promise<GraphQLSchemaFactory.SchemaBuilder>;
4
5
  }
5
6
  export declare const WebhookSettingsSchema: typeof WebhookSettingsSchema_ & {
6
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/handler-graphql/graphql/abstractions.public").IGraphQLSchemaFactory>;
7
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-graphql/graphql/abstractions.public").IGraphQLSchemaFactory>;
7
8
  };
8
9
  export {};
@@ -1,5 +1,6 @@
1
- import { GraphQLSchemaFactory } from "@webiny/handler-graphql/graphql/abstractions.js";
2
- import { ErrorResponse, Response } from "@webiny/handler-graphql";
1
+ import { GraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
2
+ import { staticSchemaKey } from "@webiny/api-graphql/graphql/staticSchemaKey.js";
3
+ import { ErrorResponse, Response } from "@webiny/api-graphql";
3
4
  import { GetWebhookSettingsRepository } from "../features/GetWebhookSettings/abstractions.js";
4
5
  import { UpdateWebhookSettingsUseCase } from "../features/UpdateWebhookSettings/abstractions.js";
5
6
  class WebhookSettingsSchema_ {
@@ -52,6 +53,9 @@ class WebhookSettingsSchema_ {
52
53
  });
53
54
  return builder;
54
55
  }
56
+ constructor(){
57
+ this.getSchemaKey = staticSchemaKey("webhooks/WebhookSettingsSchema_");
58
+ }
55
59
  }
56
60
  const WebhookSettingsSchema = GraphQLSchemaFactory.createImplementation({
57
61
  implementation: WebhookSettingsSchema_,
@@ -1 +1 @@
1
- {"version":3,"file":"api/graphql/WebhookSettingsSchema.js","sources":["../../../src/api/graphql/WebhookSettingsSchema.ts"],"sourcesContent":["import { GraphQLSchemaFactory } from \"@webiny/handler-graphql/graphql/abstractions.js\";\nimport { Response } from \"@webiny/handler-graphql\";\nimport { ErrorResponse } from \"@webiny/handler-graphql\";\nimport { GetWebhookSettingsRepository } from \"~/api/features/GetWebhookSettings/abstractions.js\";\nimport { UpdateWebhookSettingsUseCase } from \"~/api/features/UpdateWebhookSettings/abstractions.js\";\nimport type { IUpdateWebhookSettingsInput } from \"~/api/features/UpdateWebhookSettings/abstractions.js\";\n\ninterface IUpdateWebhookSettingsArgs {\n input: IUpdateWebhookSettingsInput;\n}\n\nclass WebhookSettingsSchema_ implements GraphQLSchemaFactory.Interface {\n async execute(\n builder: GraphQLSchemaFactory.SchemaBuilder\n ): Promise<GraphQLSchemaFactory.SchemaBuilder> {\n builder.addTypeDefs(/* GraphQL */ `\n type WebhookSettings {\n signingSecret: String\n deliveryRetentionDays: Int\n }\n\n type WebhookSettingsResponse {\n data: WebhookSettings\n error: WebhookError\n }\n\n input UpdateWebhookSettingsInput {\n signingSecret: String\n deliveryRetentionDays: Int\n }\n\n extend type WebhookQuery {\n getSettings: WebhookSettingsResponse\n }\n\n extend type WebhookMutation {\n updateSettings(input: UpdateWebhookSettingsInput!): WebhookSettingsResponse\n }\n `);\n\n builder.addResolver({\n path: \"WebhookQuery.getSettings\",\n dependencies: [GetWebhookSettingsRepository],\n resolver: (getSettings: GetWebhookSettingsRepository.Interface) => {\n return async () => {\n const result = await getSettings.execute();\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(result.value);\n };\n }\n });\n\n builder.addResolver<IUpdateWebhookSettingsArgs>({\n path: \"WebhookMutation.updateSettings\",\n dependencies: [UpdateWebhookSettingsUseCase],\n resolver: (updateSettings: UpdateWebhookSettingsUseCase.Interface) => {\n return async ({ args }) => {\n const result = await updateSettings.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 return builder;\n }\n}\n\nexport const WebhookSettingsSchema = GraphQLSchemaFactory.createImplementation({\n implementation: WebhookSettingsSchema_,\n dependencies: []\n});\n"],"names":["WebhookSettingsSchema_","builder","GetWebhookSettingsRepository","getSettings","result","ErrorResponse","Response","UpdateWebhookSettingsUseCase","updateSettings","args","WebhookSettingsSchema","GraphQLSchemaFactory"],"mappings":";;;;AAWA,MAAMA;IACF,MAAM,QACFC,OAA2C,EACA;QAC3CA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;QAuBnC,CAAC;QAEDA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,cAAc;gBAACC;aAA6B;YAC5C,UAAU,CAACC,cACA;oBACH,MAAMC,SAAS,MAAMD,YAAY,OAAO;oBACxC,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIC,cAAcD,OAAO,KAAK;oBAEzC,OAAO,IAAIE,SAASF,OAAO,KAAK;gBACpC;QAER;QAEAH,QAAQ,WAAW,CAA6B;YAC5C,MAAM;YACN,cAAc;gBAACM;aAA6B;YAC5C,UAAU,CAACC,iBACA,OAAO,EAAEC,IAAI,EAAE;oBAClB,MAAML,SAAS,MAAMI,eAAe,OAAO,CAACC,KAAK,KAAK;oBACtD,IAAIL,OAAO,MAAM,IACb,OAAO,IAAIC,cAAcD,OAAO,KAAK;oBAEzC,OAAO,IAAIE,SAASF,OAAO,KAAK;gBACpC;QAER;QAEA,OAAOH;IACX;AACJ;AAEO,MAAMS,wBAAwBC,qBAAqB,oBAAoB,CAAC;IAC3E,gBAAgBX;IAChB,cAAc,EAAE;AACpB"}
1
+ {"version":3,"file":"api/graphql/WebhookSettingsSchema.js","sources":["../../../src/api/graphql/WebhookSettingsSchema.ts"],"sourcesContent":["import { GraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport { staticSchemaKey } from \"@webiny/api-graphql/graphql/staticSchemaKey.js\";\nimport { Response } from \"@webiny/api-graphql\";\nimport { ErrorResponse } from \"@webiny/api-graphql\";\nimport { GetWebhookSettingsRepository } from \"~/api/features/GetWebhookSettings/abstractions.js\";\nimport { UpdateWebhookSettingsUseCase } from \"~/api/features/UpdateWebhookSettings/abstractions.js\";\nimport type { IUpdateWebhookSettingsInput } from \"~/api/features/UpdateWebhookSettings/abstractions.js\";\n\ninterface IUpdateWebhookSettingsArgs {\n input: IUpdateWebhookSettingsInput;\n}\n\nclass WebhookSettingsSchema_ implements GraphQLSchemaFactory.Interface {\n public getSchemaKey = staticSchemaKey(\"webhooks/WebhookSettingsSchema_\");\n\n async execute(\n builder: GraphQLSchemaFactory.SchemaBuilder\n ): Promise<GraphQLSchemaFactory.SchemaBuilder> {\n builder.addTypeDefs(/* GraphQL */ `\n type WebhookSettings {\n signingSecret: String\n deliveryRetentionDays: Int\n }\n\n type WebhookSettingsResponse {\n data: WebhookSettings\n error: WebhookError\n }\n\n input UpdateWebhookSettingsInput {\n signingSecret: String\n deliveryRetentionDays: Int\n }\n\n extend type WebhookQuery {\n getSettings: WebhookSettingsResponse\n }\n\n extend type WebhookMutation {\n updateSettings(input: UpdateWebhookSettingsInput!): WebhookSettingsResponse\n }\n `);\n\n builder.addResolver({\n path: \"WebhookQuery.getSettings\",\n dependencies: [GetWebhookSettingsRepository],\n resolver: (getSettings: GetWebhookSettingsRepository.Interface) => {\n return async () => {\n const result = await getSettings.execute();\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(result.value);\n };\n }\n });\n\n builder.addResolver<IUpdateWebhookSettingsArgs>({\n path: \"WebhookMutation.updateSettings\",\n dependencies: [UpdateWebhookSettingsUseCase],\n resolver: (updateSettings: UpdateWebhookSettingsUseCase.Interface) => {\n return async ({ args }) => {\n const result = await updateSettings.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 return builder;\n }\n}\n\nexport const WebhookSettingsSchema = GraphQLSchemaFactory.createImplementation({\n implementation: WebhookSettingsSchema_,\n dependencies: []\n});\n"],"names":["WebhookSettingsSchema_","builder","GetWebhookSettingsRepository","getSettings","result","ErrorResponse","Response","UpdateWebhookSettingsUseCase","updateSettings","args","staticSchemaKey","WebhookSettingsSchema","GraphQLSchemaFactory"],"mappings":";;;;;AAYA,MAAMA;IAGF,MAAM,QACFC,OAA2C,EACA;QAC3CA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;QAuBnC,CAAC;QAEDA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,cAAc;gBAACC;aAA6B;YAC5C,UAAU,CAACC,cACA;oBACH,MAAMC,SAAS,MAAMD,YAAY,OAAO;oBACxC,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIC,cAAcD,OAAO,KAAK;oBAEzC,OAAO,IAAIE,SAASF,OAAO,KAAK;gBACpC;QAER;QAEAH,QAAQ,WAAW,CAA6B;YAC5C,MAAM;YACN,cAAc;gBAACM;aAA6B;YAC5C,UAAU,CAACC,iBACA,OAAO,EAAEC,IAAI,EAAE;oBAClB,MAAML,SAAS,MAAMI,eAAe,OAAO,CAACC,KAAK,KAAK;oBACtD,IAAIL,OAAO,MAAM,IACb,OAAO,IAAIC,cAAcD,OAAO,KAAK;oBAEzC,OAAO,IAAIE,SAASF,OAAO,KAAK;gBACpC;QAER;QAEA,OAAOH;IACX;;aA3DO,YAAY,GAAGS,gBAAgB;;AA4D1C;AAEO,MAAMC,wBAAwBC,qBAAqB,oBAAoB,CAAC;IAC3E,gBAAgBZ;IAChB,cAAc,EAAE;AACpB"}
@@ -1,8 +1,9 @@
1
- import { GraphQLSchemaFactory } from "@webiny/handler-graphql/graphql/abstractions.js";
1
+ import { GraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
2
2
  declare class WebhookTriggerSchema_ implements GraphQLSchemaFactory.Interface {
3
+ getSchemaKey: () => string;
3
4
  execute(builder: GraphQLSchemaFactory.SchemaBuilder): Promise<GraphQLSchemaFactory.SchemaBuilder>;
4
5
  }
5
6
  export declare const WebhookTriggerSchema: typeof WebhookTriggerSchema_ & {
6
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/handler-graphql/graphql/abstractions.public").IGraphQLSchemaFactory>;
7
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-graphql/graphql/abstractions.public").IGraphQLSchemaFactory>;
7
8
  };
8
9
  export {};
@@ -1,5 +1,6 @@
1
- import { GraphQLSchemaFactory } from "@webiny/handler-graphql/graphql/abstractions.js";
2
- import { ErrorResponse, Response } from "@webiny/handler-graphql";
1
+ import { GraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
2
+ import { staticSchemaKey } from "@webiny/api-graphql/graphql/staticSchemaKey.js";
3
+ import { ErrorResponse, Response } from "@webiny/api-graphql";
3
4
  import { TriggerWebhookUseCase } from "../features/TriggerWebhook/abstractions.js";
4
5
  class WebhookTriggerSchema_ {
5
6
  async execute(builder) {
@@ -26,6 +27,9 @@ class WebhookTriggerSchema_ {
26
27
  });
27
28
  return builder;
28
29
  }
30
+ constructor(){
31
+ this.getSchemaKey = staticSchemaKey("webhooks/WebhookTriggerSchema_");
32
+ }
29
33
  }
30
34
  const WebhookTriggerSchema = GraphQLSchemaFactory.createImplementation({
31
35
  implementation: WebhookTriggerSchema_,
@@ -1 +1 @@
1
- {"version":3,"file":"api/graphql/WebhookTriggerSchema.js","sources":["../../../src/api/graphql/WebhookTriggerSchema.ts"],"sourcesContent":["import { GraphQLSchemaFactory } from \"@webiny/handler-graphql/graphql/abstractions.js\";\nimport { Response } from \"@webiny/handler-graphql\";\nimport { ErrorResponse } from \"@webiny/handler-graphql\";\nimport { TriggerWebhookUseCase } from \"~/api/features/TriggerWebhook/abstractions.js\";\n\ninterface ITriggerWebhookArgs {\n id: string;\n payload: Record<string, unknown>;\n}\n\nclass WebhookTriggerSchema_ implements GraphQLSchemaFactory.Interface {\n async execute(\n builder: GraphQLSchemaFactory.SchemaBuilder\n ): Promise<GraphQLSchemaFactory.SchemaBuilder> {\n builder.addTypeDefs(/* GraphQL */ `\n type WebhookTriggerResponse {\n data: WebhookDelivery\n error: WebhookError\n }\n\n extend type WebhookMutation {\n triggerWebhook(id: ID!, payload: JSON!): WebhookTriggerResponse!\n }\n `);\n\n builder.addResolver<ITriggerWebhookArgs>({\n path: \"WebhookMutation.triggerWebhook\",\n dependencies: [TriggerWebhookUseCase],\n resolver: (triggerWebhook: TriggerWebhookUseCase.Interface) => {\n return async ({ args }) => {\n const result = await triggerWebhook.execute(args.id, args.payload);\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(result.value);\n };\n }\n });\n\n return builder;\n }\n}\n\nexport const WebhookTriggerSchema = GraphQLSchemaFactory.createImplementation({\n implementation: WebhookTriggerSchema_,\n dependencies: []\n});\n"],"names":["WebhookTriggerSchema_","builder","TriggerWebhookUseCase","triggerWebhook","args","result","ErrorResponse","Response","WebhookTriggerSchema","GraphQLSchemaFactory"],"mappings":";;;AAUA,MAAMA;IACF,MAAM,QACFC,OAA2C,EACA;QAC3CA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;QASnC,CAAC;QAEDA,QAAQ,WAAW,CAAsB;YACrC,MAAM;YACN,cAAc;gBAACC;aAAsB;YACrC,UAAU,CAACC,iBACA,OAAO,EAAEC,IAAI,EAAE;oBAClB,MAAMC,SAAS,MAAMF,eAAe,OAAO,CAACC,KAAK,EAAE,EAAEA,KAAK,OAAO;oBACjE,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIC,cAAcD,OAAO,KAAK;oBAEzC,OAAO,IAAIE,SAASF,OAAO,KAAK;gBACpC;QAER;QAEA,OAAOJ;IACX;AACJ;AAEO,MAAMO,uBAAuBC,qBAAqB,oBAAoB,CAAC;IAC1E,gBAAgBT;IAChB,cAAc,EAAE;AACpB"}
1
+ {"version":3,"file":"api/graphql/WebhookTriggerSchema.js","sources":["../../../src/api/graphql/WebhookTriggerSchema.ts"],"sourcesContent":["import { GraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport { staticSchemaKey } from \"@webiny/api-graphql/graphql/staticSchemaKey.js\";\nimport { Response } from \"@webiny/api-graphql\";\nimport { ErrorResponse } from \"@webiny/api-graphql\";\nimport { TriggerWebhookUseCase } from \"~/api/features/TriggerWebhook/abstractions.js\";\n\ninterface ITriggerWebhookArgs {\n id: string;\n payload: Record<string, unknown>;\n}\n\nclass WebhookTriggerSchema_ implements GraphQLSchemaFactory.Interface {\n public getSchemaKey = staticSchemaKey(\"webhooks/WebhookTriggerSchema_\");\n\n async execute(\n builder: GraphQLSchemaFactory.SchemaBuilder\n ): Promise<GraphQLSchemaFactory.SchemaBuilder> {\n builder.addTypeDefs(/* GraphQL */ `\n type WebhookTriggerResponse {\n data: WebhookDelivery\n error: WebhookError\n }\n\n extend type WebhookMutation {\n triggerWebhook(id: ID!, payload: JSON!): WebhookTriggerResponse!\n }\n `);\n\n builder.addResolver<ITriggerWebhookArgs>({\n path: \"WebhookMutation.triggerWebhook\",\n dependencies: [TriggerWebhookUseCase],\n resolver: (triggerWebhook: TriggerWebhookUseCase.Interface) => {\n return async ({ args }) => {\n const result = await triggerWebhook.execute(args.id, args.payload);\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n return new Response(result.value);\n };\n }\n });\n\n return builder;\n }\n}\n\nexport const WebhookTriggerSchema = GraphQLSchemaFactory.createImplementation({\n implementation: WebhookTriggerSchema_,\n dependencies: []\n});\n"],"names":["WebhookTriggerSchema_","builder","TriggerWebhookUseCase","triggerWebhook","args","result","ErrorResponse","Response","staticSchemaKey","WebhookTriggerSchema","GraphQLSchemaFactory"],"mappings":";;;;AAWA,MAAMA;IAGF,MAAM,QACFC,OAA2C,EACA;QAC3CA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;QASnC,CAAC;QAEDA,QAAQ,WAAW,CAAsB;YACrC,MAAM;YACN,cAAc;gBAACC;aAAsB;YACrC,UAAU,CAACC,iBACA,OAAO,EAAEC,IAAI,EAAE;oBAClB,MAAMC,SAAS,MAAMF,eAAe,OAAO,CAACC,KAAK,EAAE,EAAEA,KAAK,OAAO;oBACjE,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIC,cAAcD,OAAO,KAAK;oBAEzC,OAAO,IAAIE,SAASF,OAAO,KAAK;gBACpC;QAER;QAEA,OAAOJ;IACX;;aA/BO,YAAY,GAAGO,gBAAgB;;AAgC1C;AAEO,MAAMC,uBAAuBC,qBAAqB,oBAAoB,CAAC;IAC1E,gBAAgBV;IAChB,cAAc,EAAE;AACpB"}
package/api/index.d.ts CHANGED
@@ -1 +1,4 @@
1
+ import { WebhooksFeature } from "./WebhooksFeature.js";
2
+ export { WebhooksFeature };
3
+ /** @deprecated use WebhooksFeature instead */
1
4
  export declare const createWebhooks: () => import("@webiny/handler").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context>;
package/api/index.js CHANGED
@@ -7,6 +7,6 @@ const createWebhooks = ()=>{
7
7
  plugin.name = "webhooks.extension";
8
8
  return plugin;
9
9
  };
10
- export { createWebhooks };
10
+ export { WebhooksFeature, createWebhooks };
11
11
 
12
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 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
+ {"version":3,"file":"api/index.js","sources":["../../src/api/index.ts"],"sourcesContent":["import { WebhooksFeature } from \"./WebhooksFeature.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\n\nexport { WebhooksFeature };\n\n/** @deprecated use WebhooksFeature instead */\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":";;AAMO,MAAMA,iBAAiB;IAC1B,MAAMC,SAASC,8BAA8B,OAAMC;QAC/CC,gBAAgB,QAAQ,CAACD,QAAQ,SAAS;IAC9C;IAEAF,OAAO,IAAI,GAAG;IAEd,OAAOA;AACX"}
@@ -4,7 +4,8 @@ class WebhookDeliveryModelFactory {
4
4
  async execute(builder) {
5
5
  const model = builder.private({
6
6
  modelId: WEBHOOK_DELIVERY_MODEL_ID,
7
- name: "Webhook Delivery"
7
+ name: "Webhook Delivery",
8
+ lifecycleEvents: false
8
9
  }).tags([
9
10
  "$publishing:false",
10
11
  "$hidden:true"
@@ -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 .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
+ {"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 lifecycleEvents: false\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;YACN,iBAAiB;QACrB,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"}
@@ -4,7 +4,8 @@ class WebhookModelFactory {
4
4
  async execute(builder) {
5
5
  const model = builder.private({
6
6
  modelId: WEBHOOK_MODEL_ID,
7
- name: "Webhook"
7
+ name: "Webhook",
8
+ lifecycleEvents: false
8
9
  }).tags([
9
10
  "$publishing:false",
10
11
  "$hidden:true"