@webiny/webhooks 0.0.0-unstable.5387e5f7c8 → 0.0.0-unstable.676006d08e

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 (74) 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 +1 -1
  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/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.d.ts +8 -0
  11. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js +64 -25
  12. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js.map +1 -1
  13. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.test.d.ts +1 -0
  14. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.test.js +119 -0
  15. package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.test.js.map +1 -0
  16. package/admin/presentation/WebhookDeliveriesPage/abstractions.d.ts +2 -0
  17. package/admin/presentation/WebhookDeliveriesPage/abstractions.js.map +1 -1
  18. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.js.map +1 -1
  19. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js +1 -0
  20. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js.map +1 -1
  21. package/admin/presentation/WebhookList/WebhookListPresenter.d.ts +1 -0
  22. package/admin/presentation/WebhookList/WebhookListPresenter.js +12 -1
  23. package/admin/presentation/WebhookList/WebhookListPresenter.js.map +1 -1
  24. package/admin/presentation/WebhookList/abstractions.d.ts +2 -0
  25. package/admin/presentation/WebhookList/abstractions.js.map +1 -1
  26. package/admin/presentation/WebhookList/components/WebhookListView.js +1 -0
  27. package/admin/presentation/WebhookList/components/WebhookListView.js.map +1 -1
  28. package/api/domain/errors.d.ts +12 -0
  29. package/api/domain/errors.js +12 -1
  30. package/api/domain/errors.js.map +1 -1
  31. package/api/features/CreateWebhook/schema.js +1 -1
  32. package/api/features/CreateWebhook/schema.js.map +1 -1
  33. package/api/features/DeleteWebhook/DeleteWebhookRepository.js +2 -1
  34. package/api/features/DeleteWebhook/DeleteWebhookRepository.js.map +1 -1
  35. package/api/features/GetWebhookSettings/GetWebhookSettingsUseCase.d.ts +14 -0
  36. package/api/features/GetWebhookSettings/GetWebhookSettingsUseCase.js +24 -0
  37. package/api/features/GetWebhookSettings/GetWebhookSettingsUseCase.js.map +1 -0
  38. package/api/features/GetWebhookSettings/abstractions.d.ts +14 -1
  39. package/api/features/GetWebhookSettings/abstractions.js +2 -1
  40. package/api/features/GetWebhookSettings/abstractions.js.map +1 -1
  41. package/api/features/GetWebhookSettings/feature.js +2 -0
  42. package/api/features/GetWebhookSettings/feature.js.map +1 -1
  43. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js +7 -4
  44. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js.map +1 -1
  45. package/api/features/ListWebhooks/ListWebhooksRepository.js +7 -4
  46. package/api/features/ListWebhooks/ListWebhooksRepository.js.map +1 -1
  47. package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.d.ts +3 -1
  48. package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.js +18 -5
  49. package/api/features/ResendWebhookDelivery/ResendWebhookDeliveryUseCase.js.map +1 -1
  50. package/api/features/ResendWebhookDelivery/abstractions.d.ts +2 -1
  51. package/api/features/ResendWebhookDelivery/abstractions.js.map +1 -1
  52. package/api/features/SendWebhookTask/SendWebhookTask.js +15 -1
  53. package/api/features/SendWebhookTask/SendWebhookTask.js.map +1 -1
  54. package/api/features/TriggerWebhook/TriggerWebhookUseCase.d.ts +3 -1
  55. package/api/features/TriggerWebhook/TriggerWebhookUseCase.js +18 -5
  56. package/api/features/TriggerWebhook/TriggerWebhookUseCase.js.map +1 -1
  57. package/api/features/TriggerWebhook/abstractions.d.ts +2 -1
  58. package/api/features/TriggerWebhook/abstractions.js.map +1 -1
  59. package/api/features/UpdateWebhook/schema.js +1 -1
  60. package/api/features/UpdateWebhook/schema.js.map +1 -1
  61. package/api/features/WebhookDeliver/WebhookDeliver.js +1 -0
  62. package/api/features/WebhookDeliver/WebhookDeliver.js.map +1 -1
  63. package/api/features/WebhookDispatcher/WebhookDispatcher.d.ts +5 -1
  64. package/api/features/WebhookDispatcher/WebhookDispatcher.js +25 -4
  65. package/api/features/WebhookDispatcher/WebhookDispatcher.js.map +1 -1
  66. package/api/graphql/WebhookCrudSchema.js +21 -6
  67. package/api/graphql/WebhookCrudSchema.js.map +1 -1
  68. package/api/graphql/WebhookSettingsSchema.js +2 -2
  69. package/api/graphql/WebhookSettingsSchema.js.map +1 -1
  70. package/api/utils/isValidEndpointUrl.js +29 -3
  71. package/api/utils/isValidEndpointUrl.js.map +1 -1
  72. package/index.d.ts +1 -0
  73. package/index.js +1 -0
  74. package/package.json +28 -26
@@ -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.5387e5f7c8",
3
+ "version": "0.0.0-unstable.676006d08e",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -19,36 +19,38 @@
19
19
  },
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@webiny/admin-ui": "0.0.0-unstable.5387e5f7c8",
23
- "@webiny/api-core": "0.0.0-unstable.5387e5f7c8",
24
- "@webiny/api-graphql": "0.0.0-unstable.5387e5f7c8",
25
- "@webiny/api-headless-cms": "0.0.0-unstable.5387e5f7c8",
26
- "@webiny/app": "0.0.0-unstable.5387e5f7c8",
27
- "@webiny/app-admin": "0.0.0-unstable.5387e5f7c8",
28
- "@webiny/background-tasks": "0.0.0-unstable.5387e5f7c8",
29
- "@webiny/feature": "0.0.0-unstable.5387e5f7c8",
30
- "@webiny/icons": "0.0.0-unstable.5387e5f7c8",
31
- "@webiny/sdk": "0.0.0-unstable.5387e5f7c8",
32
- "@webiny/utils": "0.0.0-unstable.5387e5f7c8",
33
- "graphql": "16.14.2",
22
+ "@webiny/admin-ui": "0.0.0-unstable.676006d08e",
23
+ "@webiny/api-core": "0.0.0-unstable.676006d08e",
24
+ "@webiny/api-graphql": "0.0.0-unstable.676006d08e",
25
+ "@webiny/api-headless-cms": "0.0.0-unstable.676006d08e",
26
+ "@webiny/app": "0.0.0-unstable.676006d08e",
27
+ "@webiny/app-admin": "0.0.0-unstable.676006d08e",
28
+ "@webiny/background-tasks": "0.0.0-unstable.676006d08e",
29
+ "@webiny/feature": "0.0.0-unstable.676006d08e",
30
+ "@webiny/icons": "0.0.0-unstable.676006d08e",
31
+ "@webiny/project": "0.0.0-unstable.676006d08e",
32
+ "@webiny/project-extensions": "0.0.0-unstable.676006d08e",
33
+ "@webiny/sdk": "0.0.0-unstable.676006d08e",
34
+ "@webiny/utils": "0.0.0-unstable.676006d08e",
35
+ "graphql": "16.15.0",
34
36
  "lodash": "4.18.1",
35
- "mobx": "7.0.3",
36
- "mobx-react-lite": "5.0.3",
37
- "react": "18.3.1",
38
- "react-dom": "18.3.1",
39
- "standardwebhooks": "1.0.0",
40
- "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"
41
43
  },
42
44
  "devDependencies": {
43
- "@webiny/api": "0.0.0-unstable.5387e5f7c8",
44
- "@webiny/api-core-testing": "0.0.0-unstable.5387e5f7c8",
45
- "@webiny/build-tools": "0.0.0-unstable.5387e5f7c8",
45
+ "@webiny/api": "0.0.0-unstable.676006d08e",
46
+ "@webiny/api-core-testing": "0.0.0-unstable.676006d08e",
47
+ "@webiny/api-kernel-core": "0.0.0-unstable.676006d08e",
48
+ "@webiny/build-tools": "0.0.0-unstable.676006d08e",
46
49
  "@webiny/di": "2.0.0",
47
- "@webiny/event-handler-core": "0.0.0-unstable.5387e5f7c8",
48
- "@webiny/handler": "0.0.0-unstable.5387e5f7c8",
49
- "@webiny/wcp": "0.0.0-unstable.5387e5f7c8",
50
+ "@webiny/handler": "0.0.0-unstable.676006d08e",
51
+ "@webiny/wcp": "0.0.0-unstable.676006d08e",
50
52
  "typescript": "7.0.2",
51
- "vitest": "4.1.11"
53
+ "vitest": "5.1.1"
52
54
  },
53
55
  "publishConfig": {
54
56
  "access": "public"