@ampless/plugin-webhook 0.2.0-alpha.15 → 0.2.0-alpha.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -29,16 +29,13 @@ interface WebhookEndpoint {
29
29
  timeoutMs?: number;
30
30
  }
31
31
  interface WebhookPluginOptions {
32
- endpoints?: WebhookEndpoint[];
33
- /** Backwards-compatible single-endpoint shortcut. */
34
- url?: string;
35
- secret?: string;
32
+ endpoints: WebhookEndpoint[];
36
33
  }
37
34
  /**
38
35
  * Webhook plugin. Posts a JSON envelope to one or more external URLs
39
36
  * whenever a subscribed event fires. Runs in the untrusted Lambda — it
40
37
  * needs no AWS data access, only outbound HTTPS.
41
38
  */
42
- declare function webhookPlugin(options?: WebhookPluginOptions): AmplessPlugin;
39
+ declare function webhookPlugin(options: WebhookPluginOptions): AmplessPlugin;
43
40
 
44
41
  export { type WebhookEndpoint, type WebhookPluginOptions, webhookPlugin as default, signPayload };
package/dist/index.js CHANGED
@@ -15,8 +15,8 @@ var ALL_CONTENT_EVENTS = [
15
15
  "content.unpublished",
16
16
  "content.deleted"
17
17
  ];
18
- function webhookPlugin(options = {}) {
19
- const endpoints = normalizeEndpoints(options);
18
+ function webhookPlugin(options) {
19
+ const endpoints = options.endpoints;
20
20
  const subscribed = /* @__PURE__ */ new Set();
21
21
  for (const ep of endpoints) {
22
22
  const events = ep.events ?? ALL_CONTENT_EVENTS;
@@ -35,12 +35,6 @@ function webhookPlugin(options = {}) {
35
35
  hooks
36
36
  });
37
37
  }
38
- function normalizeEndpoints(options) {
39
- const list = [];
40
- if (options.url) list.push({ url: options.url, secret: options.secret });
41
- if (options.endpoints) list.push(...options.endpoints);
42
- return list;
43
- }
44
38
  async function dispatch(endpoints, event) {
45
39
  const body = JSON.stringify({
46
40
  type: event.type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampless/plugin-webhook",
3
- "version": "0.2.0-alpha.15",
3
+ "version": "0.2.0-alpha.17",
4
4
  "description": "Webhook plugin for ampless — POST events to external URLs",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  "homepage": "https://github.com/heavymoons/ampless/tree/main/packages/plugin-webhook#readme",
26
26
  "bugs": "https://github.com/heavymoons/ampless/issues",
27
27
  "dependencies": {
28
- "ampless": "1.0.0-alpha.15"
28
+ "ampless": "1.0.0-alpha.17"
29
29
  },
30
30
  "keywords": [
31
31
  "ampless",