@webiny/webhooks 0.0.0-unstable.b6d7105cee → 0.0.0-unstable.e1999482d0

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 (109) hide show
  1. package/Webhooks.d.ts +6 -0
  2. package/Webhooks.js +11 -0
  3. package/Webhooks.js.map +1 -0
  4. package/admin/Extension.d.ts +1 -0
  5. package/admin/Extension.js +1 -0
  6. package/admin/WebhookRoutes.js +21 -5
  7. package/admin/WebhookRoutes.js.map +1 -1
  8. package/admin/Webhooks.js +1 -1
  9. package/admin/Webhooks.js.map +1 -1
  10. package/admin/features/permissions/feature.d.ts +1 -1
  11. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.d.ts +8 -0
  12. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js +64 -25
  13. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js.map +1 -1
  14. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.test.d.ts +1 -0
  15. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.test.js +119 -0
  16. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.test.js.map +1 -0
  17. package/admin/presentation/WebhookDeliveriesPage/abstractions.d.ts +2 -0
  18. package/admin/presentation/WebhookDeliveriesPage/abstractions.js.map +1 -1
  19. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.d.ts +2 -2
  20. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.js.map +1 -1
  21. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.d.ts +2 -2
  22. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js +37 -24
  23. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js.map +1 -1
  24. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.d.ts +2 -2
  25. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js +4 -3
  26. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js.map +1 -1
  27. package/admin/presentation/WebhookForm/components/SigningSecret.d.ts +2 -2
  28. package/admin/presentation/WebhookList/WebhookListPresenter.d.ts +1 -0
  29. package/admin/presentation/WebhookList/WebhookListPresenter.js +12 -1
  30. package/admin/presentation/WebhookList/WebhookListPresenter.js.map +1 -1
  31. package/admin/presentation/WebhookList/abstractions.d.ts +2 -0
  32. package/admin/presentation/WebhookList/abstractions.js.map +1 -1
  33. package/admin/presentation/WebhookList/components/WebhookListContent.d.ts +2 -2
  34. package/admin/presentation/WebhookList/components/WebhookListView.js +1 -0
  35. package/admin/presentation/WebhookList/components/WebhookListView.js.map +1 -1
  36. package/api/domain/errors.d.ts +12 -0
  37. package/api/domain/errors.js +12 -1
  38. package/api/domain/errors.js.map +1 -1
  39. package/api/features/CreateWebhook/schema.js +1 -1
  40. package/api/features/CreateWebhook/schema.js.map +1 -1
  41. package/api/features/DeleteWebhook/DeleteWebhookRepository.js +2 -1
  42. package/api/features/DeleteWebhook/DeleteWebhookRepository.js.map +1 -1
  43. package/api/features/GetWebhookSettings/GetWebhookSettingsUseCase.d.ts +14 -0
  44. package/api/features/GetWebhookSettings/GetWebhookSettingsUseCase.js +24 -0
  45. package/api/features/GetWebhookSettings/GetWebhookSettingsUseCase.js.map +1 -0
  46. package/api/features/GetWebhookSettings/abstractions.d.ts +14 -1
  47. package/api/features/GetWebhookSettings/abstractions.js +2 -1
  48. package/api/features/GetWebhookSettings/abstractions.js.map +1 -1
  49. package/api/features/GetWebhookSettings/feature.js +2 -0
  50. package/api/features/GetWebhookSettings/feature.js.map +1 -1
  51. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js +7 -4
  52. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js.map +1 -1
  53. package/api/features/ListWebhooks/ListWebhooksRepository.js +7 -4
  54. package/api/features/ListWebhooks/ListWebhooksRepository.js.map +1 -1
  55. package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.d.ts +3 -1
  56. package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.js +18 -5
  57. package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.js.map +1 -1
  58. package/api/features/ResendWebhookDelivery/abstractions.d.ts +2 -1
  59. package/api/features/ResendWebhookDelivery/abstractions.js.map +1 -1
  60. package/api/features/SendWebhookTask/SendWebhookTask.d.ts +10 -5
  61. package/api/features/SendWebhookTask/SendWebhookTask.js +35 -12
  62. package/api/features/SendWebhookTask/SendWebhookTask.js.map +1 -1
  63. package/api/features/TriggerWebhook/TriggerWebhookUseCase.d.ts +3 -1
  64. package/api/features/TriggerWebhook/TriggerWebhookUseCase.js +18 -5
  65. package/api/features/TriggerWebhook/TriggerWebhookUseCase.js.map +1 -1
  66. package/api/features/TriggerWebhook/abstractions.d.ts +2 -1
  67. package/api/features/TriggerWebhook/abstractions.js.map +1 -1
  68. package/api/features/UpdateWebhook/UpdateWebhookRepository.js +3 -1
  69. package/api/features/UpdateWebhook/UpdateWebhookRepository.js.map +1 -1
  70. package/api/features/UpdateWebhook/schema.js +1 -1
  71. package/api/features/UpdateWebhook/schema.js.map +1 -1
  72. package/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.js +3 -1
  73. package/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.js.map +1 -1
  74. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js +3 -1
  75. package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js.map +1 -1
  76. package/api/features/WebhookDeliver/WebhookDeliver.js +1 -0
  77. package/api/features/WebhookDeliver/WebhookDeliver.js.map +1 -1
  78. package/api/features/WebhookDispatcher/WebhookDispatcher.d.ts +5 -1
  79. package/api/features/WebhookDispatcher/WebhookDispatcher.js +25 -4
  80. package/api/features/WebhookDispatcher/WebhookDispatcher.js.map +1 -1
  81. package/api/graphql/WebhookCrudSchema.d.ts +3 -2
  82. package/api/graphql/WebhookCrudSchema.js +27 -8
  83. package/api/graphql/WebhookCrudSchema.js.map +1 -1
  84. package/api/graphql/WebhookDeliverySchema.d.ts +3 -2
  85. package/api/graphql/WebhookDeliverySchema.js +6 -2
  86. package/api/graphql/WebhookDeliverySchema.js.map +1 -1
  87. package/api/graphql/WebhookEventSchema.d.ts +3 -2
  88. package/api/graphql/WebhookEventSchema.js +6 -2
  89. package/api/graphql/WebhookEventSchema.js.map +1 -1
  90. package/api/graphql/WebhookSettingsSchema.d.ts +3 -2
  91. package/api/graphql/WebhookSettingsSchema.js +8 -4
  92. package/api/graphql/WebhookSettingsSchema.js.map +1 -1
  93. package/api/graphql/WebhookTriggerSchema.d.ts +3 -2
  94. package/api/graphql/WebhookTriggerSchema.js +6 -2
  95. package/api/graphql/WebhookTriggerSchema.js.map +1 -1
  96. package/api/index.d.ts +3 -0
  97. package/api/index.js +1 -1
  98. package/api/index.js.map +1 -1
  99. package/api/models/WebhookDeliveryModel.js +2 -1
  100. package/api/models/WebhookDeliveryModel.js.map +1 -1
  101. package/api/models/WebhookModel.js +2 -1
  102. package/api/models/WebhookModel.js.map +1 -1
  103. package/api/models/WebhookSettingsModel.js +2 -1
  104. package/api/models/WebhookSettingsModel.js.map +1 -1
  105. package/api/utils/isValidEndpointUrl.js +29 -3
  106. package/api/utils/isValidEndpointUrl.js.map +1 -1
  107. package/index.d.ts +1 -0
  108. package/index.js +1 -0
  109. package/package.json +29 -26
@@ -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,6 +1,7 @@
1
- import { GraphQLSchemaFactory } from "@webiny/handler-graphql/graphql/abstractions.js";
2
- import { ErrorResponse, Response } from "@webiny/handler-graphql";
3
- import { GetWebhookSettingsRepository } from "../features/GetWebhookSettings/abstractions.js";
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";
4
+ import { GetWebhookSettingsUseCase } from "../features/GetWebhookSettings/abstractions.js";
4
5
  import { UpdateWebhookSettingsUseCase } from "../features/UpdateWebhookSettings/abstractions.js";
5
6
  class WebhookSettingsSchema_ {
6
7
  async execute(builder) {
@@ -31,7 +32,7 @@ class WebhookSettingsSchema_ {
31
32
  builder.addResolver({
32
33
  path: "WebhookQuery.getSettings",
33
34
  dependencies: [
34
- GetWebhookSettingsRepository
35
+ GetWebhookSettingsUseCase
35
36
  ],
36
37
  resolver: (getSettings)=>async ()=>{
37
38
  const result = await getSettings.execute();
@@ -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 { GetWebhookSettingsUseCase } 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: [GetWebhookSettingsUseCase],\n resolver: (getSettings: GetWebhookSettingsUseCase.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","GetWebhookSettingsUseCase","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;aAA0B;YACzC,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"
@@ -1 +1 @@
1
- {"version":3,"file":"api/models/WebhookModel.js","sources":["../../../src/api/models/WebhookModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport { WEBHOOK_MODEL_ID } from \"~/api/domain/constants.js\";\n\nclass WebhookModelFactory implements ModelFactory.Interface {\n async execute(builder: ModelFactory.Builder) {\n const model = builder\n .private({ modelId: WEBHOOK_MODEL_ID, name: \"Webhook\" })\n .tags([\"$publishing:false\", \"$hidden:true\"]);\n\n model.fields(fields => ({\n name: fields.text().label(\"Name\").required(),\n slug: fields\n .text()\n .label(\"Slug\")\n .required()\n .description(\"URL-safe identifier, unique per tenant.\")\n .minLength(3, \"Slug must be at least 3 characters long.\")\n .pattern(\n \"^[a-z0-9]+(?:-[a-z0-9]+)*$\",\n \"\",\n \"Slug can only contain lowercase letters, numbers, and hyphens, and must start and end with a letter or number.\"\n ),\n endpointUrl: fields\n .text()\n .label(\"Endpoint URL\")\n .required()\n .description(\"HTTPS destination for POST requests.\")\n .url(\"Must be a valid URL starting with https://\")\n .minLength(8, \"Endpoint URL must be at least 8 characters long.\")\n .pattern(\n \"^(https:\\\\/\\\\/.+|http:\\\\/\\\\/localhost.*)\",\n \"\",\n \"Endpoint URL must start with https://\"\n ),\n description: fields.longText().label(\"Description\"),\n enabled: fields.boolean().label(\"Enabled\").defaultValue(false),\n events: fields\n .text()\n .list()\n .label(\"Events\")\n .defaultValue([])\n .listMinLength(1, \"At least one event must be selected.\"),\n signingSecret: fields\n .text()\n .encrypt()\n .label(\"Signing Secret\")\n .description(\"Signing secret - will be encrypted in the database.\")\n }));\n\n return [model];\n }\n}\n\nexport const WebhookModel = ModelFactory.createImplementation({\n implementation: WebhookModelFactory,\n dependencies: []\n});\n"],"names":["WebhookModelFactory","builder","model","WEBHOOK_MODEL_ID","fields","WebhookModel","ModelFactory"],"mappings":";;AAGA,MAAMA;IACF,MAAM,QAAQC,OAA6B,EAAE;QACzC,MAAMC,QAAQD,QACT,OAAO,CAAC;YAAE,SAASE;YAAkB,MAAM;QAAU,GACrD,IAAI,CAAC;YAAC;YAAqB;SAAe;QAE/CD,MAAM,MAAM,CAACE,CAAAA,SAAW;gBACpB,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC,QAAQ,QAAQ;gBAC1C,MAAMA,OACD,IAAI,GACJ,KAAK,CAAC,QACN,QAAQ,GACR,WAAW,CAAC,2CACZ,SAAS,CAAC,GAAG,4CACb,OAAO,CACJ,8BACA,IACA;gBAER,aAAaA,OACR,IAAI,GACJ,KAAK,CAAC,gBACN,QAAQ,GACR,WAAW,CAAC,wCACZ,GAAG,CAAC,8CACJ,SAAS,CAAC,GAAG,oDACb,OAAO,CACJ,4CACA,IACA;gBAER,aAAaA,OAAO,QAAQ,GAAG,KAAK,CAAC;gBACrC,SAASA,OAAO,OAAO,GAAG,KAAK,CAAC,WAAW,YAAY,CAAC;gBACxD,QAAQA,OACH,IAAI,GACJ,IAAI,GACJ,KAAK,CAAC,UACN,YAAY,CAAC,EAAE,EACf,aAAa,CAAC,GAAG;gBACtB,eAAeA,OACV,IAAI,GACJ,OAAO,GACP,KAAK,CAAC,kBACN,WAAW,CAAC;YACrB;QAEA,OAAO;YAACF;SAAM;IAClB;AACJ;AAEO,MAAMG,eAAeC,aAAa,oBAAoB,CAAC;IAC1D,gBAAgBN;IAChB,cAAc,EAAE;AACpB"}
1
+ {"version":3,"file":"api/models/WebhookModel.js","sources":["../../../src/api/models/WebhookModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport { WEBHOOK_MODEL_ID } from \"~/api/domain/constants.js\";\n\nclass WebhookModelFactory implements ModelFactory.Interface {\n async execute(builder: ModelFactory.Builder) {\n const model = builder\n .private({ modelId: WEBHOOK_MODEL_ID, name: \"Webhook\", lifecycleEvents: false })\n .tags([\"$publishing:false\", \"$hidden:true\"]);\n\n model.fields(fields => ({\n name: fields.text().label(\"Name\").required(),\n slug: fields\n .text()\n .label(\"Slug\")\n .required()\n .description(\"URL-safe identifier, unique per tenant.\")\n .minLength(3, \"Slug must be at least 3 characters long.\")\n .pattern(\n \"^[a-z0-9]+(?:-[a-z0-9]+)*$\",\n \"\",\n \"Slug can only contain lowercase letters, numbers, and hyphens, and must start and end with a letter or number.\"\n ),\n endpointUrl: fields\n .text()\n .label(\"Endpoint URL\")\n .required()\n .description(\"HTTPS destination for POST requests.\")\n .url(\"Must be a valid URL starting with https://\")\n .minLength(8, \"Endpoint URL must be at least 8 characters long.\")\n .pattern(\n \"^(https:\\\\/\\\\/.+|http:\\\\/\\\\/localhost.*)\",\n \"\",\n \"Endpoint URL must start with https://\"\n ),\n description: fields.longText().label(\"Description\"),\n enabled: fields.boolean().label(\"Enabled\").defaultValue(false),\n events: fields\n .text()\n .list()\n .label(\"Events\")\n .defaultValue([])\n .listMinLength(1, \"At least one event must be selected.\"),\n signingSecret: fields\n .text()\n .encrypt()\n .label(\"Signing Secret\")\n .description(\"Signing secret - will be encrypted in the database.\")\n }));\n\n return [model];\n }\n}\n\nexport const WebhookModel = ModelFactory.createImplementation({\n implementation: WebhookModelFactory,\n dependencies: []\n});\n"],"names":["WebhookModelFactory","builder","model","WEBHOOK_MODEL_ID","fields","WebhookModel","ModelFactory"],"mappings":";;AAGA,MAAMA;IACF,MAAM,QAAQC,OAA6B,EAAE;QACzC,MAAMC,QAAQD,QACT,OAAO,CAAC;YAAE,SAASE;YAAkB,MAAM;YAAW,iBAAiB;QAAM,GAC7E,IAAI,CAAC;YAAC;YAAqB;SAAe;QAE/CD,MAAM,MAAM,CAACE,CAAAA,SAAW;gBACpB,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC,QAAQ,QAAQ;gBAC1C,MAAMA,OACD,IAAI,GACJ,KAAK,CAAC,QACN,QAAQ,GACR,WAAW,CAAC,2CACZ,SAAS,CAAC,GAAG,4CACb,OAAO,CACJ,8BACA,IACA;gBAER,aAAaA,OACR,IAAI,GACJ,KAAK,CAAC,gBACN,QAAQ,GACR,WAAW,CAAC,wCACZ,GAAG,CAAC,8CACJ,SAAS,CAAC,GAAG,oDACb,OAAO,CACJ,4CACA,IACA;gBAER,aAAaA,OAAO,QAAQ,GAAG,KAAK,CAAC;gBACrC,SAASA,OAAO,OAAO,GAAG,KAAK,CAAC,WAAW,YAAY,CAAC;gBACxD,QAAQA,OACH,IAAI,GACJ,IAAI,GACJ,KAAK,CAAC,UACN,YAAY,CAAC,EAAE,EACf,aAAa,CAAC,GAAG;gBACtB,eAAeA,OACV,IAAI,GACJ,OAAO,GACP,KAAK,CAAC,kBACN,WAAW,CAAC;YACrB;QAEA,OAAO;YAACF;SAAM;IAClB;AACJ;AAEO,MAAMG,eAAeC,aAAa,oBAAoB,CAAC;IAC1D,gBAAgBN;IAChB,cAAc,EAAE;AACpB"}
@@ -4,7 +4,8 @@ class WebhookSettingsModelFactory {
4
4
  async execute(builder) {
5
5
  const model = builder.private({
6
6
  modelId: WEBHOOK_SETTINGS_MODEL_ID,
7
- name: "Webhook Settings"
7
+ name: "Webhook Settings",
8
+ lifecycleEvents: false
8
9
  }).tags([
9
10
  "$publishing:false",
10
11
  "$hidden:true"
@@ -1 +1 @@
1
- {"version":3,"file":"api/models/WebhookSettingsModel.js","sources":["../../../src/api/models/WebhookSettingsModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport {\n WEBHOOK_SETTINGS_MODEL_ID,\n WEBHOOK_DELIVERY_MAX_RETENTION_DAYS\n} from \"~/api/domain/constants.js\";\n\nclass WebhookSettingsModelFactory implements ModelFactory.Interface {\n async execute(builder: ModelFactory.Builder) {\n const model = builder\n .private({\n modelId: WEBHOOK_SETTINGS_MODEL_ID,\n name: \"Webhook Settings\"\n })\n .tags([\"$publishing:false\", \"$hidden:true\"])\n .singleEntry();\n\n model.fields(fields => ({\n signingSecret: fields\n .text()\n .label(\"Signing Secret\")\n .encrypt()\n .description(\"Global signing secret used for all webhook deliveries.\"),\n deliveryRetentionDays: fields\n .number()\n .label(\"Delivery Retention (days)\")\n .gte(0, \"Must be 0 or greater.\")\n .lte(\n WEBHOOK_DELIVERY_MAX_RETENTION_DAYS,\n `Must be at most ${WEBHOOK_DELIVERY_MAX_RETENTION_DAYS}.`\n )\n .description(\n `How long to keep delivery logs. 0 = delete immediately. Max ${WEBHOOK_DELIVERY_MAX_RETENTION_DAYS} days.`\n )\n }));\n\n return [model];\n }\n}\n\nexport const WebhookSettingsModel = ModelFactory.createImplementation({\n implementation: WebhookSettingsModelFactory,\n dependencies: []\n});\n"],"names":["WebhookSettingsModelFactory","builder","model","WEBHOOK_SETTINGS_MODEL_ID","fields","WEBHOOK_DELIVERY_MAX_RETENTION_DAYS","WebhookSettingsModel","ModelFactory"],"mappings":";;AAMA,MAAMA;IACF,MAAM,QAAQC,OAA6B,EAAE;QACzC,MAAMC,QAAQD,QACT,OAAO,CAAC;YACL,SAASE;YACT,MAAM;QACV,GACC,IAAI,CAAC;YAAC;YAAqB;SAAe,EAC1C,WAAW;QAEhBD,MAAM,MAAM,CAACE,CAAAA,SAAW;gBACpB,eAAeA,OACV,IAAI,GACJ,KAAK,CAAC,kBACN,OAAO,GACP,WAAW,CAAC;gBACjB,uBAAuBA,OAClB,MAAM,GACN,KAAK,CAAC,6BACN,GAAG,CAAC,GAAG,yBACP,GAAG,CACAC,qCACA,CAAC,gBAAgB,EAAEA,oCAAoC,CAAC,CAAC,EAE5D,WAAW,CACR,CAAC,4DAA4D,EAAEA,oCAAoC,MAAM,CAAC;YAEtH;QAEA,OAAO;YAACH;SAAM;IAClB;AACJ;AAEO,MAAMI,uBAAuBC,aAAa,oBAAoB,CAAC;IAClE,gBAAgBP;IAChB,cAAc,EAAE;AACpB"}
1
+ {"version":3,"file":"api/models/WebhookSettingsModel.js","sources":["../../../src/api/models/WebhookSettingsModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport {\n WEBHOOK_SETTINGS_MODEL_ID,\n WEBHOOK_DELIVERY_MAX_RETENTION_DAYS\n} from \"~/api/domain/constants.js\";\n\nclass WebhookSettingsModelFactory implements ModelFactory.Interface {\n async execute(builder: ModelFactory.Builder) {\n const model = builder\n .private({\n modelId: WEBHOOK_SETTINGS_MODEL_ID,\n name: \"Webhook Settings\",\n lifecycleEvents: false\n })\n .tags([\"$publishing:false\", \"$hidden:true\"])\n .singleEntry();\n\n model.fields(fields => ({\n signingSecret: fields\n .text()\n .label(\"Signing Secret\")\n .encrypt()\n .description(\"Global signing secret used for all webhook deliveries.\"),\n deliveryRetentionDays: fields\n .number()\n .label(\"Delivery Retention (days)\")\n .gte(0, \"Must be 0 or greater.\")\n .lte(\n WEBHOOK_DELIVERY_MAX_RETENTION_DAYS,\n `Must be at most ${WEBHOOK_DELIVERY_MAX_RETENTION_DAYS}.`\n )\n .description(\n `How long to keep delivery logs. 0 = delete immediately. Max ${WEBHOOK_DELIVERY_MAX_RETENTION_DAYS} days.`\n )\n }));\n\n return [model];\n }\n}\n\nexport const WebhookSettingsModel = ModelFactory.createImplementation({\n implementation: WebhookSettingsModelFactory,\n dependencies: []\n});\n"],"names":["WebhookSettingsModelFactory","builder","model","WEBHOOK_SETTINGS_MODEL_ID","fields","WEBHOOK_DELIVERY_MAX_RETENTION_DAYS","WebhookSettingsModel","ModelFactory"],"mappings":";;AAMA,MAAMA;IACF,MAAM,QAAQC,OAA6B,EAAE;QACzC,MAAMC,QAAQD,QACT,OAAO,CAAC;YACL,SAASE;YACT,MAAM;YACN,iBAAiB;QACrB,GACC,IAAI,CAAC;YAAC;YAAqB;SAAe,EAC1C,WAAW;QAEhBD,MAAM,MAAM,CAACE,CAAAA,SAAW;gBACpB,eAAeA,OACV,IAAI,GACJ,KAAK,CAAC,kBACN,OAAO,GACP,WAAW,CAAC;gBACjB,uBAAuBA,OAClB,MAAM,GACN,KAAK,CAAC,6BACN,GAAG,CAAC,GAAG,yBACP,GAAG,CACAC,qCACA,CAAC,gBAAgB,EAAEA,oCAAoC,CAAC,CAAC,EAE5D,WAAW,CACR,CAAC,4DAA4D,EAAEA,oCAAoC,MAAM,CAAC;YAEtH;QAEA,OAAO;YAACH;SAAM;IAClB;AACJ;AAEO,MAAMI,uBAAuBC,aAAa,oBAAoB,CAAC;IAClE,gBAAgBP;IAChB,cAAc,EAAE;AACpB"}
@@ -1,9 +1,35 @@
1
+ const isLocalDevelopment = ()=>"1" === process.env.WEBINY_WATCH_LOCAL_INVOCATION;
2
+ const isLocalhostName = (hostname)=>"localhost" === hostname || hostname.endsWith(".localhost");
3
+ const isLoopbackOrLinkLocal = (hostname)=>{
4
+ const host = hostname.replace(/^\[|\]$/g, "").replace(/\.+$/, "").toLowerCase();
5
+ if (isLocalhostName(host)) return true;
6
+ if (host.includes(":")) {
7
+ if ("::1" === host || "::" === host) return true;
8
+ if (/^fe[89ab][0-9a-f]:/.test(host)) return true;
9
+ const dotted = host.match(/^::(?:ffff:(?:0:)?)?(\d+\.\d+\.\d+\.\d+)$/);
10
+ if (dotted) return isLoopbackOrLinkLocal(dotted[1]);
11
+ const hex = host.match(/^::(?:ffff:(?:0:)?)?([0-9a-f]{1,4}):([0-9a-f]{1,4})$/);
12
+ if (hex) {
13
+ const high = parseInt(hex[1], 16);
14
+ const low = parseInt(hex[2], 16);
15
+ return isLoopbackOrLinkLocal(`${high >> 8}.${255 & high}.${low >> 8}.${255 & low}`);
16
+ }
17
+ return false;
18
+ }
19
+ const ipv4 = host.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
20
+ if (!ipv4) return false;
21
+ const [a, b] = [
22
+ Number(ipv4[1]),
23
+ Number(ipv4[2])
24
+ ];
25
+ return 0 === a || 127 === a || 169 === a && 254 === b;
26
+ };
1
27
  const isValidEndpointUrl = (url)=>{
2
28
  try {
3
29
  const parsed = new URL(url);
4
- if ("https:" === parsed.protocol) return true;
5
- if ("http:" === parsed.protocol && ("localhost" === parsed.hostname || "127.0.0.1" === parsed.hostname)) return true;
6
- return false;
30
+ const isLocalTarget = isLoopbackOrLinkLocal(parsed.hostname);
31
+ if (isLocalTarget) return isLocalDevelopment() && (isLocalhostName(parsed.hostname) || "127.0.0.1" === parsed.hostname);
32
+ return "https:" === parsed.protocol;
7
33
  } catch {
8
34
  return false;
9
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"api/utils/isValidEndpointUrl.js","sources":["../../../src/api/utils/isValidEndpointUrl.ts"],"sourcesContent":["export const isValidEndpointUrl = (url: string): boolean => {\n try {\n const parsed = new URL(url);\n if (parsed.protocol === \"https:\") {\n return true;\n } else if (\n parsed.protocol === \"http:\" &&\n (parsed.hostname === \"localhost\" || parsed.hostname === \"127.0.0.1\")\n ) {\n return true;\n }\n return false;\n } catch {\n return false;\n }\n};\n"],"names":["isValidEndpointUrl","url","parsed","URL"],"mappings":"AAAO,MAAMA,qBAAqB,CAACC;IAC/B,IAAI;QACA,MAAMC,SAAS,IAAIC,IAAIF;QACvB,IAAIC,AAAoB,aAApBA,OAAO,QAAQ,EACf,OAAO;QACJ,IACHA,AAAoB,YAApBA,OAAO,QAAQ,IACdA,CAAAA,AAAoB,gBAApBA,OAAO,QAAQ,IAAoBA,AAAoB,gBAApBA,OAAO,QAAQ,AAAe,GAElE,OAAO;QAEX,OAAO;IACX,EAAE,OAAM;QACJ,OAAO;IACX;AACJ"}
1
+ {"version":3,"file":"api/utils/isValidEndpointUrl.js","sources":["../../../src/api/utils/isValidEndpointUrl.ts"],"sourcesContent":["/**\n * Webhook endpoints are called from the API (Lambda). Loopback and link-local addresses point\n * at the Lambda environment itself (e.g. the Lambda Runtime API on 127.0.0.1:9001), never at a\n * real receiver, and the delivery log stores the response body: refuse them.\n *\n * During local development (`webiny watch` runs invocations on the developer's machine) a local\n * receiver is a valid target, so localhost over HTTP is allowed there.\n *\n * TODO: private ranges (10/8, 172.16/12, 192.168/16, 100.64/10, fc00::/7) are still allowed,\n * because projects deployed in a VPC may call internal receivers. Refuse them by default with\n * an allowlist setting for VPC receivers. Also resolve DNS at delivery time (a public hostname\n * can point to a private address). Redirects are never followed (see WebhookDeliver).\n */\nconst isLocalDevelopment = () => process.env.WEBINY_WATCH_LOCAL_INVOCATION === \"1\";\n\nconst isLocalhostName = (hostname: string) => {\n return hostname === \"localhost\" || hostname.endsWith(\".localhost\");\n};\n\nconst isLoopbackOrLinkLocal = (hostname: string): boolean => {\n // A trailing dot (\"localhost.\", \"127.0.0.1.\") names the same host.\n const host = hostname\n .replace(/^\\[|\\]$/g, \"\")\n .replace(/\\.+$/, \"\")\n .toLowerCase();\n\n if (isLocalhostName(host)) {\n return true;\n }\n\n // IPv6: loopback, unspecified, link-local, IPv4-mapped.\n if (host.includes(\":\")) {\n if (host === \"::1\" || host === \"::\") {\n return true;\n }\n if (/^fe[89ab][0-9a-f]:/.test(host)) {\n return true;\n }\n // IPv4-mapped / IPv4-translated / IPv4-compatible addresses. `new URL()` normalizes them\n // to hex (e.g. \"::ffff:127.0.0.1\" becomes \"::ffff:7f00:1\"), so handle both forms.\n const dotted = host.match(/^::(?:ffff:(?:0:)?)?(\\d+\\.\\d+\\.\\d+\\.\\d+)$/);\n if (dotted) {\n return isLoopbackOrLinkLocal(dotted[1]);\n }\n const hex = host.match(/^::(?:ffff:(?:0:)?)?([0-9a-f]{1,4}):([0-9a-f]{1,4})$/);\n if (hex) {\n const high = parseInt(hex[1], 16);\n const low = parseInt(hex[2], 16);\n return isLoopbackOrLinkLocal(`${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`);\n }\n return false;\n }\n\n // IPv4: 0.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16.\n const ipv4 = host.match(/^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$/);\n if (!ipv4) {\n return false;\n }\n const [a, b] = [Number(ipv4[1]), Number(ipv4[2])];\n return a === 0 || a === 127 || (a === 169 && b === 254);\n};\n\nexport const isValidEndpointUrl = (url: string): boolean => {\n try {\n const parsed = new URL(url);\n const isLocalTarget = isLoopbackOrLinkLocal(parsed.hostname);\n\n if (isLocalTarget) {\n // Only a local receiver during local development, never link-local addresses.\n return (\n isLocalDevelopment() &&\n (isLocalhostName(parsed.hostname) || parsed.hostname === \"127.0.0.1\")\n );\n }\n\n return parsed.protocol === \"https:\";\n } catch {\n return false;\n }\n};\n"],"names":["isLocalDevelopment","process","isLocalhostName","hostname","isLoopbackOrLinkLocal","host","dotted","hex","high","parseInt","low","ipv4","a","b","Number","isValidEndpointUrl","url","parsed","URL","isLocalTarget"],"mappings":"AAaA,MAAMA,qBAAqB,IAAMC,AAA8C,QAA9CA,QAAQ,GAAG,CAAC,6BAA6B;AAE1E,MAAMC,kBAAkB,CAACC,WACdA,AAAa,gBAAbA,YAA4BA,SAAS,QAAQ,CAAC;AAGzD,MAAMC,wBAAwB,CAACD;IAE3B,MAAME,OAAOF,SACR,OAAO,CAAC,YAAY,IACpB,OAAO,CAAC,QAAQ,IAChB,WAAW;IAEhB,IAAID,gBAAgBG,OAChB,OAAO;IAIX,IAAIA,KAAK,QAAQ,CAAC,MAAM;QACpB,IAAIA,AAAS,UAATA,QAAkBA,AAAS,SAATA,MAClB,OAAO;QAEX,IAAI,qBAAqB,IAAI,CAACA,OAC1B,OAAO;QAIX,MAAMC,SAASD,KAAK,KAAK,CAAC;QAC1B,IAAIC,QACA,OAAOF,sBAAsBE,MAAM,CAAC,EAAE;QAE1C,MAAMC,MAAMF,KAAK,KAAK,CAAC;QACvB,IAAIE,KAAK;YACL,MAAMC,OAAOC,SAASF,GAAG,CAAC,EAAE,EAAE;YAC9B,MAAMG,MAAMD,SAASF,GAAG,CAAC,EAAE,EAAE;YAC7B,OAAOH,sBAAsB,GAAGI,QAAQ,EAAE,CAAC,EAAEA,AAAO,MAAPA,KAAW,CAAC,EAAEE,OAAO,EAAE,CAAC,EAAEA,AAAM,MAANA,KAAW;QACtF;QACA,OAAO;IACX;IAGA,MAAMC,OAAON,KAAK,KAAK,CAAC;IACxB,IAAI,CAACM,MACD,OAAO;IAEX,MAAM,CAACC,GAAGC,EAAE,GAAG;QAACC,OAAOH,IAAI,CAAC,EAAE;QAAGG,OAAOH,IAAI,CAAC,EAAE;KAAE;IACjD,OAAOC,AAAM,MAANA,KAAWA,AAAM,QAANA,KAAcA,AAAM,QAANA,KAAaC,AAAM,QAANA;AACjD;AAEO,MAAME,qBAAqB,CAACC;IAC/B,IAAI;QACA,MAAMC,SAAS,IAAIC,IAAIF;QACvB,MAAMG,gBAAgBf,sBAAsBa,OAAO,QAAQ;QAE3D,IAAIE,eAEA,OACInB,wBACCE,CAAAA,gBAAgBe,OAAO,QAAQ,KAAKA,AAAoB,gBAApBA,OAAO,QAAQ,AAAe;QAI3E,OAAOA,AAAoB,aAApBA,OAAO,QAAQ;IAC1B,EAAE,OAAM;QACJ,OAAO;IACX;AACJ"}
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { Webhooks } from "./Webhooks.js";
package/index.js ADDED
@@ -0,0 +1 @@
1
+ export { Webhooks } from "./Webhooks.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/webhooks",
3
- "version": "0.0.0-unstable.b6d7105cee",
3
+ "version": "0.0.0-unstable.e1999482d0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -19,35 +19,38 @@
19
19
  },
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@webiny/admin-ui": "0.0.0-unstable.b6d7105cee",
23
- "@webiny/api-core": "0.0.0-unstable.b6d7105cee",
24
- "@webiny/api-headless-cms": "0.0.0-unstable.b6d7105cee",
25
- "@webiny/app": "0.0.0-unstable.b6d7105cee",
26
- "@webiny/app-admin": "0.0.0-unstable.b6d7105cee",
27
- "@webiny/background-tasks": "0.0.0-unstable.b6d7105cee",
28
- "@webiny/feature": "0.0.0-unstable.b6d7105cee",
29
- "@webiny/handler-graphql": "0.0.0-unstable.b6d7105cee",
30
- "@webiny/icons": "0.0.0-unstable.b6d7105cee",
31
- "@webiny/sdk": "0.0.0-unstable.b6d7105cee",
32
- "@webiny/utils": "0.0.0-unstable.b6d7105cee",
22
+ "@webiny/admin-ui": "0.0.0-unstable.e1999482d0",
23
+ "@webiny/api-core": "0.0.0-unstable.e1999482d0",
24
+ "@webiny/api-graphql": "0.0.0-unstable.e1999482d0",
25
+ "@webiny/api-headless-cms": "0.0.0-unstable.e1999482d0",
26
+ "@webiny/app": "0.0.0-unstable.e1999482d0",
27
+ "@webiny/app-admin": "0.0.0-unstable.e1999482d0",
28
+ "@webiny/background-tasks": "0.0.0-unstable.e1999482d0",
29
+ "@webiny/feature": "0.0.0-unstable.e1999482d0",
30
+ "@webiny/icons": "0.0.0-unstable.e1999482d0",
31
+ "@webiny/project": "0.0.0-unstable.e1999482d0",
32
+ "@webiny/project-extensions": "0.0.0-unstable.e1999482d0",
33
+ "@webiny/sdk": "0.0.0-unstable.e1999482d0",
34
+ "@webiny/utils": "0.0.0-unstable.e1999482d0",
35
+ "graphql": "16.15.0",
33
36
  "lodash": "4.18.1",
34
- "mobx": "6.16.1",
35
- "mobx-react-lite": "4.1.1",
36
- "react": "18.3.1",
37
- "react-dom": "18.3.1",
38
- "standardwebhooks": "1.0.0",
39
- "zod": "4.4.3"
37
+ "mobx": "7.1.7",
38
+ "mobx-react-lite": "5.1.3",
39
+ "react": "19.3.1",
40
+ "react-dom": "19.3.1",
41
+ "standardwebhooks": "1.3.0",
42
+ "zod": "4.6.7"
40
43
  },
41
44
  "devDependencies": {
42
- "@webiny/api": "0.0.0-unstable.b6d7105cee",
43
- "@webiny/build-tools": "0.0.0-unstable.b6d7105cee",
44
- "@webiny/di": "1.0.2",
45
- "@webiny/handler": "0.0.0-unstable.b6d7105cee",
46
- "@webiny/handler-aws": "0.0.0-unstable.b6d7105cee",
47
- "@webiny/plugins": "0.0.0-unstable.b6d7105cee",
48
- "@webiny/project-utils": "0.0.0-unstable.b6d7105cee",
45
+ "@webiny/api": "0.0.0-unstable.e1999482d0",
46
+ "@webiny/api-core-testing": "0.0.0-unstable.e1999482d0",
47
+ "@webiny/api-kernel-core": "0.0.0-unstable.e1999482d0",
48
+ "@webiny/build-tools": "0.0.0-unstable.e1999482d0",
49
+ "@webiny/di": "2.0.0",
50
+ "@webiny/handler": "0.0.0-unstable.e1999482d0",
51
+ "@webiny/wcp": "0.0.0-unstable.e1999482d0",
49
52
  "typescript": "7.0.2",
50
- "vitest": "4.1.10"
53
+ "vitest": "5.1.1"
51
54
  },
52
55
  "publishConfig": {
53
56
  "access": "public"