@webiny/handler-aws 0.0.0-unstable.78f581c1d2 → 0.0.0-unstable.7be00a75a9

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 (101) hide show
  1. package/README.md +10 -14
  2. package/createHandler.d.ts +2 -0
  3. package/createHandler.js +23 -0
  4. package/createHandler.js.map +1 -0
  5. package/dynamodb/index.d.ts +5 -8
  6. package/dynamodb/index.js +41 -87
  7. package/dynamodb/index.js.map +1 -1
  8. package/dynamodb/plugins/DynamoDBEventHandler.d.ts +8 -7
  9. package/dynamodb/plugins/DynamoDBEventHandler.js +12 -28
  10. package/dynamodb/plugins/DynamoDBEventHandler.js.map +1 -1
  11. package/dynamodb/register.d.ts +1 -0
  12. package/dynamodb/register.js +16 -0
  13. package/dynamodb/register.js.map +1 -0
  14. package/eventBridge/index.d.ts +7 -10
  15. package/eventBridge/index.js +42 -88
  16. package/eventBridge/index.js.map +1 -1
  17. package/eventBridge/plugins/EventBridgeEventHandler.d.ts +8 -7
  18. package/eventBridge/plugins/EventBridgeEventHandler.js +12 -28
  19. package/eventBridge/plugins/EventBridgeEventHandler.js.map +1 -1
  20. package/eventBridge/register.d.ts +4 -0
  21. package/eventBridge/register.js +11 -0
  22. package/eventBridge/register.js.map +1 -0
  23. package/execute.d.ts +1 -1
  24. package/execute.js +54 -67
  25. package/execute.js.map +1 -1
  26. package/gateway/index.d.ts +7 -11
  27. package/gateway/index.js +43 -102
  28. package/gateway/index.js.map +1 -1
  29. package/gateway/register.d.ts +1 -0
  30. package/gateway/register.js +11 -0
  31. package/gateway/register.js.map +1 -0
  32. package/index.d.ts +35 -6
  33. package/index.js +17 -245
  34. package/package.json +22 -25
  35. package/plugins/index.d.ts +1 -1
  36. package/plugins/index.js +4 -12
  37. package/plugins/index.js.map +1 -1
  38. package/raw/index.d.ts +5 -10
  39. package/raw/index.js +44 -95
  40. package/raw/index.js.map +1 -1
  41. package/raw/plugins/RawEventHandler.d.ts +17 -6
  42. package/raw/plugins/RawEventHandler.js +14 -21
  43. package/raw/plugins/RawEventHandler.js.map +1 -1
  44. package/registry.d.ts +17 -0
  45. package/registry.js +23 -0
  46. package/registry.js.map +1 -0
  47. package/s3/index.d.ts +6 -9
  48. package/s3/index.js +41 -87
  49. package/s3/index.js.map +1 -1
  50. package/s3/plugins/S3EventHandler.d.ts +8 -7
  51. package/s3/plugins/S3EventHandler.js +12 -28
  52. package/s3/plugins/S3EventHandler.js.map +1 -1
  53. package/s3/register.d.ts +4 -0
  54. package/s3/register.js +15 -0
  55. package/s3/register.js.map +1 -0
  56. package/sns/index.d.ts +8 -0
  57. package/sns/index.js +42 -0
  58. package/sns/index.js.map +1 -0
  59. package/sns/plugins/SNSEventHandler.d.ts +20 -0
  60. package/sns/plugins/SNSEventHandler.js +14 -0
  61. package/sns/plugins/SNSEventHandler.js.map +1 -0
  62. package/sns/register.d.ts +1 -0
  63. package/sns/register.js +15 -0
  64. package/sns/register.js.map +1 -0
  65. package/sourceHandler.d.ts +2 -0
  66. package/sourceHandler.js +4 -0
  67. package/sourceHandler.js.map +1 -0
  68. package/sqs/index.d.ts +6 -9
  69. package/sqs/index.js +42 -87
  70. package/sqs/index.js.map +1 -1
  71. package/sqs/plugins/SQSEventHandler.d.ts +8 -7
  72. package/sqs/plugins/SQSEventHandler.js +12 -28
  73. package/sqs/plugins/SQSEventHandler.js.map +1 -1
  74. package/sqs/register.d.ts +1 -0
  75. package/sqs/register.js +16 -0
  76. package/sqs/register.js.map +1 -0
  77. package/types.d.ts +28 -5
  78. package/types.js +10 -32
  79. package/types.js.map +1 -1
  80. package/utils/composedHandler.d.ts +6 -0
  81. package/utils/composedHandler.js +8 -0
  82. package/utils/composedHandler.js.map +1 -0
  83. package/utils/index.d.ts +2 -0
  84. package/utils/index.js +2 -0
  85. package/utils/timer/CustomTimer.d.ts +5 -0
  86. package/utils/timer/CustomTimer.js +13 -0
  87. package/utils/timer/CustomTimer.js.map +1 -0
  88. package/utils/timer/Timer.d.ts +10 -0
  89. package/utils/timer/Timer.js +16 -0
  90. package/utils/timer/Timer.js.map +1 -0
  91. package/utils/timer/abstractions/ITimer.d.ts +10 -0
  92. package/utils/timer/abstractions/ITimer.js +0 -0
  93. package/utils/timer/factory.d.ts +4 -0
  94. package/utils/timer/factory.js +12 -0
  95. package/utils/timer/factory.js.map +1 -0
  96. package/utils/timer/index.d.ts +4 -0
  97. package/utils/timer/index.js +3 -0
  98. package/index.js.map +0 -1
  99. package/plugins/handlerClient.d.ts +0 -2
  100. package/plugins/handlerClient.js +0 -62
  101. package/plugins/handlerClient.js.map +0 -1
package/registry.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * TODO: refactor this to use a proper DI container
3
+ */
4
+ import type { HandlerEvent, SourceHandler } from "./types.js";
5
+ import type { Context as LambdaContext } from "@webiny/aws-sdk/types/index.js";
6
+ interface RegisterOptions {
7
+ silent?: boolean;
8
+ }
9
+ declare class HandlerRegistry {
10
+ private readonly handlers;
11
+ private constructor();
12
+ static create(): HandlerRegistry;
13
+ register(handler: SourceHandler<any>, options?: RegisterOptions): void;
14
+ getHandler(event: HandlerEvent, context: LambdaContext): SourceHandler;
15
+ }
16
+ export type { HandlerRegistry };
17
+ export declare const registry: HandlerRegistry;
package/registry.js ADDED
@@ -0,0 +1,23 @@
1
+ class HandlerRegistry {
2
+ constructor(){
3
+ this.handlers = new Map();
4
+ }
5
+ static create() {
6
+ return new HandlerRegistry();
7
+ }
8
+ register(handler, options) {
9
+ if (this.handlers.has(handler.name)) {
10
+ if (options?.silent) return;
11
+ throw new Error(`Handler "${handler.name}" is already registered.`);
12
+ }
13
+ this.handlers.set(handler.name, handler);
14
+ }
15
+ getHandler(event, context) {
16
+ for (const handler of this.handlers.values())if (handler.canUse(event, context)) return handler;
17
+ throw new Error(`There is no handler for the event: ${JSON.stringify(event)}`);
18
+ }
19
+ }
20
+ const registry = HandlerRegistry.create();
21
+ export { registry };
22
+
23
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sources":["../src/registry.ts"],"sourcesContent":["/**\n * TODO: refactor this to use a proper DI container\n */\nimport type { HandlerEvent, SourceHandler } from \"~/types.js\";\nimport type { Context as LambdaContext } from \"@webiny/aws-sdk/types/index.js\";\n\ninterface RegisterOptions {\n silent?: boolean;\n}\n\nclass HandlerRegistry {\n private readonly handlers = new Map<string, SourceHandler>();\n\n private constructor() {\n /**\n * We don't want this class to be constructed outside the static create() method\n */\n }\n\n public static create() {\n return new HandlerRegistry();\n }\n\n public register(handler: SourceHandler<any>, options?: RegisterOptions) {\n if (this.handlers.has(handler.name)) {\n if (options?.silent) {\n return;\n }\n /**\n * This should only happen during the development phase.\n */\n throw new Error(`Handler \"${handler.name}\" is already registered.`);\n }\n this.handlers.set(handler.name, handler);\n }\n\n public getHandler(event: HandlerEvent, context: LambdaContext): SourceHandler {\n for (const handler of this.handlers.values()) {\n if (handler.canUse(event, context)) {\n return handler;\n }\n }\n throw new Error(`There is no handler for the event: ${JSON.stringify(event)}`);\n }\n}\n\nexport type { HandlerRegistry };\n\nexport const registry = HandlerRegistry.create();\n"],"names":["HandlerRegistry","Map","handler","options","Error","event","context","JSON","registry"],"mappings":"AAUA,MAAMA;IAGF,aAAsB;aAFL,QAAQ,GAAG,IAAIC;IAMhC;IAEA,OAAc,SAAS;QACnB,OAAO,IAAID;IACf;IAEO,SAASE,OAA2B,EAAEC,OAAyB,EAAE;QACpE,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAACD,QAAQ,IAAI,GAAG;YACjC,IAAIC,SAAS,QACT;YAKJ,MAAM,IAAIC,MAAM,CAAC,SAAS,EAAEF,QAAQ,IAAI,CAAC,wBAAwB,CAAC;QACtE;QACA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAACA,QAAQ,IAAI,EAAEA;IACpC;IAEO,WAAWG,KAAmB,EAAEC,OAAsB,EAAiB;QAC1E,KAAK,MAAMJ,WAAW,IAAI,CAAC,QAAQ,CAAC,MAAM,GACtC,IAAIA,QAAQ,MAAM,CAACG,OAAOC,UACtB,OAAOJ;QAGf,MAAM,IAAIE,MAAM,CAAC,mCAAmC,EAAEG,KAAK,SAAS,CAACF,QAAQ;IACjF;AACJ;AAIO,MAAMG,WAAWR,gBAAgB,MAAM"}
package/s3/index.d.ts CHANGED
@@ -1,11 +1,8 @@
1
- import { CreateHandlerParams as BaseCreateHandlerParams } from "@webiny/handler";
2
- import { S3Event, Context as LambdaContext } from "aws-lambda";
3
- import { APIGatewayProxyResult } from "aws-lambda/trigger/api-gateway-proxy";
1
+ import type { HandlerFactoryParams } from "../types.js";
2
+ import type { APIGatewayProxyResult, Context as LambdaContext, S3Event } from "@webiny/aws-sdk/types/index.js";
3
+ export * from "./plugins/S3EventHandler.js";
4
4
  export interface HandlerCallable {
5
- (payload: S3Event, context: LambdaContext): Promise<APIGatewayProxyResult>;
5
+ (event: S3Event, context: LambdaContext): Promise<APIGatewayProxyResult>;
6
6
  }
7
- export interface CreateHandlerParams extends BaseCreateHandlerParams {
8
- debug?: boolean;
9
- }
10
- export declare const createHandler: (params: CreateHandlerParams) => HandlerCallable;
11
- export * from "./plugins/S3EventHandler";
7
+ export type HandlerParams = HandlerFactoryParams;
8
+ export declare const createHandler: (params: HandlerParams) => HandlerCallable;
package/s3/index.js CHANGED
@@ -1,88 +1,42 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- var _exportNames = {
9
- createHandler: true
10
- };
11
- exports.createHandler = void 0;
12
-
13
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
14
-
15
- var _handler = require("@webiny/handler");
16
-
17
- var _S3EventHandler = require("./plugins/S3EventHandler");
18
-
19
- Object.keys(_S3EventHandler).forEach(function (key) {
20
- if (key === "default" || key === "__esModule") return;
21
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
22
- if (key in exports && exports[key] === _S3EventHandler[key]) return;
23
- Object.defineProperty(exports, key, {
24
- enumerable: true,
25
- get: function () {
26
- return _S3EventHandler[key];
27
- }
28
- });
29
- });
30
-
31
- var _plugins = require("../plugins");
32
-
33
- var _execute = require("../execute");
34
-
35
- const Reply = require("fastify/lib/reply");
36
-
1
+ import { createHandler } from "@webiny/handler";
2
+ import { registerDefaultPlugins } from "../plugins/index.js";
3
+ import { S3EventHandler } from "./plugins/S3EventHandler.js";
4
+ import { execute } from "../execute.js";
5
+ import lib_reply from "fastify/lib/reply.js";
6
+ import { createComposedHandler } from "../utils/composedHandler.js";
7
+ export * from "./plugins/S3EventHandler.js";
37
8
  const url = "/webiny-s3-event";
38
-
39
- const createHandler = params => {
40
- return (payload, context) => {
41
- const app = (0, _handler.createHandler)({
42
- plugins: params.plugins,
43
- options: (0, _objectSpread2.default)({
44
- logger: params.debug === true
45
- }, params.options || {})
46
- });
47
- /**
48
- * We always must add our default plugins to the app.
49
- */
50
-
51
- (0, _plugins.registerDefaultPlugins)(app.webiny);
52
- /**
53
- * There must be an event plugin for this handler to work.
54
- */
55
-
56
- const plugins = app.webiny.plugins.byType(_S3EventHandler.S3EventHandler.type);
57
- const handler = plugins.shift();
58
-
59
- if (!handler) {
60
- throw new Error(`To run @webiny/handler-aws/s3, you must have S3EventHandler set.`);
61
- }
62
-
63
- app.post(url, async (request, reply) => {
64
- const params = {
65
- request,
66
- reply,
67
- context: app.webiny,
68
- event: payload,
69
- lambdaContext: context
70
- };
71
- const result = await handler.cb(params);
72
-
73
- if (result instanceof Reply) {
74
- return result;
75
- }
76
-
77
- app.__webiny_raw_result = result;
78
- return reply.send({});
79
- });
80
- return (0, _execute.execute)({
81
- app,
82
- url,
83
- payload
84
- });
85
- };
86
- };
87
-
88
- exports.createHandler = createHandler;
9
+ const s3_createHandler = (params)=>async (event, context)=>{
10
+ const app = createHandler({
11
+ ...params,
12
+ options: {
13
+ logger: true === params.debug,
14
+ ...params.options || {}
15
+ }
16
+ });
17
+ registerDefaultPlugins(app.webiny);
18
+ const plugins = app.webiny.plugins.byType(S3EventHandler.type).reverse();
19
+ if (0 === plugins.length) throw new Error("To run @webiny/handler-aws/s3, you must have S3EventHandler set.");
20
+ const handler = createComposedHandler(plugins);
21
+ app.post(url, async (request, reply)=>{
22
+ const params = {
23
+ request,
24
+ reply,
25
+ context: app.webiny,
26
+ event,
27
+ lambdaContext: context
28
+ };
29
+ const result = await handler(params);
30
+ if (result instanceof lib_reply) return result;
31
+ app.__webiny_raw_result = result;
32
+ return reply.send({});
33
+ });
34
+ return execute({
35
+ app,
36
+ url: url,
37
+ payload: event
38
+ });
39
+ };
40
+ export { s3_createHandler as createHandler };
41
+
42
+ //# sourceMappingURL=index.js.map
package/s3/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["Reply","require","url","createHandler","params","payload","context","app","createBaseHandler","plugins","options","logger","debug","registerDefaultPlugins","webiny","byType","S3EventHandler","type","handler","shift","Error","post","request","reply","event","lambdaContext","result","cb","__webiny_raw_result","send","execute"],"sources":["index.ts"],"sourcesContent":["import {\n createHandler as createBaseHandler,\n CreateHandlerParams as BaseCreateHandlerParams\n} from \"@webiny/handler\";\nconst Reply = require(\"fastify/lib/reply\");\nimport { S3Event, Context as LambdaContext } from \"aws-lambda\";\nimport { S3EventHandler, S3EventHandlerCallableParams } from \"./plugins/S3EventHandler\";\nimport { APIGatewayProxyResult } from \"aws-lambda/trigger/api-gateway-proxy\";\nimport { registerDefaultPlugins } from \"~/plugins\";\nimport { execute } from \"~/execute\";\n\nconst url = \"/webiny-s3-event\";\n\nexport interface HandlerCallable {\n (payload: S3Event, context: LambdaContext): Promise<APIGatewayProxyResult>;\n}\n\nexport interface CreateHandlerParams extends BaseCreateHandlerParams {\n debug?: boolean;\n}\n\nexport const createHandler = (params: CreateHandlerParams): HandlerCallable => {\n return (payload, context) => {\n const app = createBaseHandler({\n plugins: params.plugins,\n options: {\n logger: params.debug === true,\n ...(params.options || {})\n }\n });\n /**\n * We always must add our default plugins to the app.\n */\n registerDefaultPlugins(app.webiny);\n /**\n * There must be an event plugin for this handler to work.\n */\n const plugins = app.webiny.plugins.byType<S3EventHandler>(S3EventHandler.type);\n const handler = plugins.shift();\n if (!handler) {\n throw new Error(`To run @webiny/handler-aws/s3, you must have S3EventHandler set.`);\n }\n\n app.post(url, async (request, reply) => {\n const params: S3EventHandlerCallableParams = {\n request,\n reply,\n context: app.webiny,\n event: payload,\n lambdaContext: context\n };\n const result = await handler.cb(params);\n\n if (result instanceof Reply) {\n return result;\n }\n\n (app as any).__webiny_raw_result = result;\n return reply.send({});\n });\n return execute({\n app,\n url,\n payload\n });\n };\n};\n\nexport * from \"./plugins/S3EventHandler\";\n"],"mappings":";;;;;;;;;;;;;;AAAA;;AAMA;;AA8DA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AA5DA;;AACA;;AALA,MAAMA,KAAK,GAAGC,OAAO,CAAC,mBAAD,CAArB;;AAOA,MAAMC,GAAG,GAAG,kBAAZ;;AAUO,MAAMC,aAAa,GAAIC,MAAD,IAAkD;EAC3E,OAAO,CAACC,OAAD,EAAUC,OAAV,KAAsB;IACzB,MAAMC,GAAG,GAAG,IAAAC,sBAAA,EAAkB;MAC1BC,OAAO,EAAEL,MAAM,CAACK,OADU;MAE1BC,OAAO;QACHC,MAAM,EAAEP,MAAM,CAACQ,KAAP,KAAiB;MADtB,GAECR,MAAM,CAACM,OAAP,IAAkB,EAFnB;IAFmB,CAAlB,CAAZ;IAOA;AACR;AACA;;IACQ,IAAAG,+BAAA,EAAuBN,GAAG,CAACO,MAA3B;IACA;AACR;AACA;;IACQ,MAAML,OAAO,GAAGF,GAAG,CAACO,MAAJ,CAAWL,OAAX,CAAmBM,MAAnB,CAA0CC,8BAAA,CAAeC,IAAzD,CAAhB;IACA,MAAMC,OAAO,GAAGT,OAAO,CAACU,KAAR,EAAhB;;IACA,IAAI,CAACD,OAAL,EAAc;MACV,MAAM,IAAIE,KAAJ,CAAW,kEAAX,CAAN;IACH;;IAEDb,GAAG,CAACc,IAAJ,CAASnB,GAAT,EAAc,OAAOoB,OAAP,EAAgBC,KAAhB,KAA0B;MACpC,MAAMnB,MAAoC,GAAG;QACzCkB,OADyC;QAEzCC,KAFyC;QAGzCjB,OAAO,EAAEC,GAAG,CAACO,MAH4B;QAIzCU,KAAK,EAAEnB,OAJkC;QAKzCoB,aAAa,EAAEnB;MAL0B,CAA7C;MAOA,MAAMoB,MAAM,GAAG,MAAMR,OAAO,CAACS,EAAR,CAAWvB,MAAX,CAArB;;MAEA,IAAIsB,MAAM,YAAY1B,KAAtB,EAA6B;QACzB,OAAO0B,MAAP;MACH;;MAEAnB,GAAD,CAAaqB,mBAAb,GAAmCF,MAAnC;MACA,OAAOH,KAAK,CAACM,IAAN,CAAW,EAAX,CAAP;IACH,CAhBD;IAiBA,OAAO,IAAAC,gBAAA,EAAQ;MACXvB,GADW;MAEXL,GAFW;MAGXG;IAHW,CAAR,CAAP;EAKH,CA3CD;AA4CH,CA7CM"}
1
+ {"version":3,"file":"s3/index.js","sources":["../../src/s3/index.ts"],"sourcesContent":["import { createHandler as createBaseHandler } from \"@webiny/handler\";\nimport { registerDefaultPlugins } from \"~/plugins/index.js\";\nimport type { S3EventHandlerCallableParams } from \"~/s3/plugins/S3EventHandler.js\";\nimport { S3EventHandler } from \"~/s3/plugins/S3EventHandler.js\";\nimport { execute } from \"~/execute.js\";\nimport type { HandlerFactoryParams } from \"~/types.js\";\n/**\n * We need a class, not an interface exported from types.\n */\n// @ts-expect-error\nimport Reply from \"fastify/lib/reply.js\";\nimport type {\n APIGatewayProxyResult,\n Context as LambdaContext,\n S3Event\n} from \"@webiny/aws-sdk/types/index.js\";\nimport { createComposedHandler } from \"~/utils/composedHandler.js\";\n\nexport * from \"./plugins/S3EventHandler.js\";\n\nexport interface HandlerCallable {\n (event: S3Event, context: LambdaContext): Promise<APIGatewayProxyResult>;\n}\n\nexport type HandlerParams = HandlerFactoryParams;\n\nconst url = \"/webiny-s3-event\";\n\nexport const createHandler = (params: HandlerParams): HandlerCallable => {\n return async (event, context) => {\n const app = createBaseHandler({\n ...params,\n options: {\n logger: params.debug === true,\n ...(params.options || {})\n }\n });\n /**\n * We always must add our default plugins to the app.\n */\n registerDefaultPlugins(app.webiny);\n /**\n * There must be an event plugin for this handler to work.\n */\n const plugins = app.webiny.plugins.byType<S3EventHandler>(S3EventHandler.type).reverse();\n if (plugins.length === 0) {\n throw new Error(`To run @webiny/handler-aws/s3, you must have S3EventHandler set.`);\n }\n\n const handler = createComposedHandler<\n S3EventHandler,\n S3EventHandlerCallableParams<APIGatewayProxyResult>,\n APIGatewayProxyResult\n >(plugins);\n\n app.post(url, async (request, reply) => {\n const params: Omit<S3EventHandlerCallableParams<APIGatewayProxyResult>, \"next\"> = {\n request,\n reply,\n context: app.webiny,\n event,\n lambdaContext: context\n };\n const result = await handler(\n params as unknown as S3EventHandlerCallableParams<APIGatewayProxyResult>\n );\n\n if (result instanceof Reply) {\n return result;\n }\n\n app.__webiny_raw_result = result;\n return reply.send({});\n });\n return execute({\n app,\n url,\n payload: event\n });\n };\n};\n"],"names":["url","createHandler","params","event","context","app","createBaseHandler","registerDefaultPlugins","plugins","S3EventHandler","Error","handler","createComposedHandler","request","reply","result","Reply","execute"],"mappings":";;;;;;;AA0BA,MAAMA,MAAM;AAEL,MAAMC,mBAAgB,CAACC,SACnB,OAAOC,OAAOC;QACjB,MAAMC,MAAMC,cAAkB;YAC1B,GAAGJ,MAAM;YACT,SAAS;gBACL,QAAQA,AAAiB,SAAjBA,OAAO,KAAK;gBACpB,GAAIA,OAAO,OAAO,IAAI,CAAC,CAAC;YAC5B;QACJ;QAIAK,uBAAuBF,IAAI,MAAM;QAIjC,MAAMG,UAAUH,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAiBI,eAAe,IAAI,EAAE,OAAO;QACtF,IAAID,AAAmB,MAAnBA,QAAQ,MAAM,EACd,MAAM,IAAIE,MAAM;QAGpB,MAAMC,UAAUC,sBAIdJ;QAEFH,IAAI,IAAI,CAACL,KAAK,OAAOa,SAASC;YAC1B,MAAMZ,SAA4E;gBAC9EW;gBACAC;gBACA,SAAST,IAAI,MAAM;gBACnBF;gBACA,eAAeC;YACnB;YACA,MAAMW,SAAS,MAAMJ,QACjBT;YAGJ,IAAIa,kBAAkBC,WAClB,OAAOD;YAGXV,IAAI,mBAAmB,GAAGU;YAC1B,OAAOD,MAAM,IAAI,CAAC,CAAC;QACvB;QACA,OAAOG,QAAQ;YACXZ;YACAL,KAAAA;YACA,SAASG;QACb;IACJ"}
@@ -1,19 +1,20 @@
1
- import { Plugin } from "@webiny/plugins/Plugin";
2
- import { Request, Reply, Context } from "@webiny/handler/types";
3
- import { S3Event, Context as LambdaContext } from "aws-lambda";
4
- export interface S3EventHandlerCallableParams {
1
+ import type { Context as LambdaContext, S3Event } from "@webiny/aws-sdk/types/index.js";
2
+ import { Plugin } from "@webiny/plugins/Plugin.js";
3
+ import type { Context, Reply, Request } from "@webiny/handler/types.js";
4
+ export interface S3EventHandlerCallableParams<Response = Reply> {
5
5
  request: Request;
6
6
  context: Context;
7
7
  event: S3Event;
8
8
  lambdaContext: LambdaContext;
9
9
  reply: Reply;
10
+ next: () => Promise<Response>;
10
11
  }
11
- export interface S3EventHandlerCallable<Response> {
12
- (params: S3EventHandlerCallableParams): Promise<Response | Reply>;
12
+ export interface S3EventHandlerCallable<Response = Reply> {
13
+ (params: S3EventHandlerCallableParams<Response>): Promise<Response>;
13
14
  }
14
15
  export declare class S3EventHandler<Response = any> extends Plugin {
15
16
  static type: string;
16
17
  readonly cb: S3EventHandlerCallable<Response>;
17
18
  constructor(cb: S3EventHandlerCallable<Response>);
18
19
  }
19
- export declare const createEventHandler: <Response_1>(cb: S3EventHandlerCallable<Response_1>) => S3EventHandler<Response_1>;
20
+ export declare const createEventHandler: <Response>(cb: S3EventHandlerCallable<Response>) => S3EventHandler<Response>;
@@ -1,30 +1,14 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.createEventHandler = exports.S3EventHandler = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _Plugin = require("@webiny/plugins/Plugin");
13
-
14
- class S3EventHandler extends _Plugin.Plugin {
15
- constructor(cb) {
16
- super();
17
- (0, _defineProperty2.default)(this, "cb", void 0);
18
- this.cb = cb;
19
- }
20
-
1
+ import { Plugin } from "@webiny/plugins/Plugin.js";
2
+ class S3EventHandler extends Plugin {
3
+ static{
4
+ this.type = "handler.fastify.aws.s3.eventHandler";
5
+ }
6
+ constructor(cb){
7
+ super();
8
+ this.cb = cb;
9
+ }
21
10
  }
11
+ const createEventHandler = (cb)=>new S3EventHandler(cb);
12
+ export { S3EventHandler, createEventHandler };
22
13
 
23
- exports.S3EventHandler = S3EventHandler;
24
- (0, _defineProperty2.default)(S3EventHandler, "type", "handler.fastify.aws.s3.eventHandler");
25
-
26
- const createEventHandler = cb => {
27
- return new S3EventHandler(cb);
28
- };
29
-
30
- exports.createEventHandler = createEventHandler;
14
+ //# sourceMappingURL=S3EventHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["S3EventHandler","Plugin","constructor","cb","createEventHandler"],"sources":["S3EventHandler.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { Request, Reply, Context } from \"@webiny/handler/types\";\nimport { S3Event, Context as LambdaContext } from \"aws-lambda\";\n\nexport interface S3EventHandlerCallableParams {\n request: Request;\n context: Context;\n event: S3Event;\n lambdaContext: LambdaContext;\n reply: Reply;\n}\nexport interface S3EventHandlerCallable<Response> {\n (params: S3EventHandlerCallableParams): Promise<Response | Reply>;\n}\n\nexport class S3EventHandler<Response = any> extends Plugin {\n public static override type = \"handler.fastify.aws.s3.eventHandler\";\n\n public readonly cb: S3EventHandlerCallable<Response>;\n\n public constructor(cb: S3EventHandlerCallable<Response>) {\n super();\n this.cb = cb;\n }\n}\n\nexport const createEventHandler = <Response>(cb: S3EventHandlerCallable<Response>) => {\n return new S3EventHandler<Response>(cb);\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAeO,MAAMA,cAAN,SAA6CC,cAA7C,CAAoD;EAKhDC,WAAW,CAACC,EAAD,EAAuC;IACrD;IADqD;IAErD,KAAKA,EAAL,GAAUA,EAAV;EACH;;AARsD;;;8BAA9CH,c,UACqB,qC;;AAU3B,MAAMI,kBAAkB,GAAcD,EAAX,IAAoD;EAClF,OAAO,IAAIH,cAAJ,CAA6BG,EAA7B,CAAP;AACH,CAFM"}
1
+ {"version":3,"file":"s3/plugins/S3EventHandler.js","sources":["../../../src/s3/plugins/S3EventHandler.ts"],"sourcesContent":["import type { Context as LambdaContext, S3Event } from \"@webiny/aws-sdk/types/index.js\";\nimport { Plugin } from \"@webiny/plugins/Plugin.js\";\nimport type { Context, Reply, Request } from \"@webiny/handler/types.js\";\n\nexport interface S3EventHandlerCallableParams<Response = Reply> {\n request: Request;\n context: Context;\n event: S3Event;\n lambdaContext: LambdaContext;\n reply: Reply;\n next: () => Promise<Response>;\n}\n\nexport interface S3EventHandlerCallable<Response = Reply> {\n (params: S3EventHandlerCallableParams<Response>): Promise<Response>;\n}\n\nexport class S3EventHandler<Response = any> extends Plugin {\n public static override type = \"handler.fastify.aws.s3.eventHandler\";\n\n public readonly cb: S3EventHandlerCallable<Response>;\n\n public constructor(cb: S3EventHandlerCallable<Response>) {\n super();\n this.cb = cb;\n }\n}\n\nexport const createEventHandler = <Response>(cb: S3EventHandlerCallable<Response>) => {\n return new S3EventHandler<Response>(cb);\n};\n"],"names":["S3EventHandler","Plugin","cb","createEventHandler"],"mappings":";AAiBO,MAAMA,uBAAuCC;;aACzB,IAAI,GAAG;;IAI9B,YAAmBC,EAAoC,CAAE;QACrD,KAAK;QACL,IAAI,CAAC,EAAE,GAAGA;IACd;AACJ;AAEO,MAAMC,qBAAqB,CAAWD,KAClC,IAAIF,eAAyBE"}
@@ -0,0 +1,4 @@
1
+ import type { HandlerFactoryParams } from "../types.js";
2
+ export interface HandlerParams extends HandlerFactoryParams {
3
+ debug?: boolean;
4
+ }
package/s3/register.js ADDED
@@ -0,0 +1,15 @@
1
+ import { registry } from "../registry.js";
2
+ import { createSourceHandler } from "../sourceHandler.js";
3
+ import { createHandler } from "./index.js";
4
+ const handler = createSourceHandler({
5
+ name: "handler-aws-s3",
6
+ canUse: (event)=>{
7
+ if (!Array.isArray(event.Records) || 0 === event.Records.length) return false;
8
+ const [record] = event.Records;
9
+ return !!record.s3;
10
+ },
11
+ handle: async ({ params, event, context })=>createHandler(params)(event, context)
12
+ });
13
+ registry.register(handler);
14
+
15
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3/register.js","sources":["../../src/s3/register.ts"],"sourcesContent":["import type { S3Event } from \"@webiny/aws-sdk/types/index.js\";\nimport { registry } from \"~/registry.js\";\nimport type { HandlerFactoryParams } from \"~/types.js\";\nimport { createSourceHandler } from \"~/sourceHandler.js\";\nimport { createHandler } from \"./index.js\";\n\nexport interface HandlerParams extends HandlerFactoryParams {\n debug?: boolean;\n}\n\nconst handler = createSourceHandler<S3Event, HandlerParams>({\n name: \"handler-aws-s3\",\n canUse: event => {\n if (!Array.isArray(event.Records) || event.Records.length === 0) {\n return false;\n }\n const [record] = event.Records;\n return !!record.s3;\n },\n handle: async ({ params, event, context }) => {\n return createHandler(params)(event, context);\n }\n});\n\nregistry.register(handler);\n"],"names":["handler","createSourceHandler","event","Array","record","params","context","createHandler","registry"],"mappings":";;;AAUA,MAAMA,UAAUC,oBAA4C;IACxD,MAAM;IACN,QAAQC,CAAAA;QACJ,IAAI,CAACC,MAAM,OAAO,CAACD,MAAM,OAAO,KAAKA,AAAyB,MAAzBA,MAAM,OAAO,CAAC,MAAM,EACrD,OAAO;QAEX,MAAM,CAACE,OAAO,GAAGF,MAAM,OAAO;QAC9B,OAAO,CAAC,CAACE,OAAO,EAAE;IACtB;IACA,QAAQ,OAAO,EAAEC,MAAM,EAAEH,KAAK,EAAEI,OAAO,EAAE,GAC9BC,cAAcF,QAAQH,OAAOI;AAE5C;AAEAE,SAAS,QAAQ,CAACR"}
package/sns/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import type { APIGatewayProxyResult, SNSEvent, Context as LambdaContext } from "@webiny/aws-sdk/types/index.js";
2
+ import type { HandlerFactoryParams } from "../types.js";
3
+ export * from "./plugins/SNSEventHandler.js";
4
+ export interface HandlerCallable {
5
+ (event: SNSEvent, context: LambdaContext): Promise<APIGatewayProxyResult>;
6
+ }
7
+ export type HandlerParams = HandlerFactoryParams;
8
+ export declare const createHandler: (params: HandlerParams) => HandlerCallable;
package/sns/index.js ADDED
@@ -0,0 +1,42 @@
1
+ import { createHandler } from "@webiny/handler";
2
+ import { registerDefaultPlugins } from "../plugins/index.js";
3
+ import { SNSEventHandler } from "./plugins/SNSEventHandler.js";
4
+ import { execute } from "../execute.js";
5
+ import lib_reply from "fastify/lib/reply.js";
6
+ import { createComposedHandler } from "../utils/composedHandler.js";
7
+ export * from "./plugins/SNSEventHandler.js";
8
+ const url = "/webiny-sns-event";
9
+ const sns_createHandler = (params)=>async (event, context)=>{
10
+ const app = createHandler({
11
+ ...params,
12
+ options: {
13
+ logger: true === params.debug,
14
+ ...params.options || {}
15
+ }
16
+ });
17
+ registerDefaultPlugins(app.webiny);
18
+ const plugins = app.webiny.plugins.byType(SNSEventHandler.type).reverse();
19
+ if (0 === plugins.length) throw new Error("To run @webiny/handler-aws/sns, you must have SNSEventHandler set.");
20
+ const handler = createComposedHandler(plugins);
21
+ app.post(url, async (request, reply)=>{
22
+ const params = {
23
+ request,
24
+ reply,
25
+ context: app.webiny,
26
+ event,
27
+ lambdaContext: context
28
+ };
29
+ const result = await handler(params);
30
+ if (result instanceof lib_reply) return result;
31
+ app.__webiny_raw_result = result;
32
+ return reply.send({});
33
+ });
34
+ return execute({
35
+ app,
36
+ url: url,
37
+ payload: event
38
+ });
39
+ };
40
+ export { sns_createHandler as createHandler };
41
+
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sns/index.js","sources":["../../src/sns/index.ts"],"sourcesContent":["import type {\n APIGatewayProxyResult,\n SNSEvent,\n Context as LambdaContext\n} from \"@webiny/aws-sdk/types/index.js\";\nimport { createHandler as createBaseHandler } from \"@webiny/handler\";\nimport { registerDefaultPlugins } from \"~/plugins/index.js\";\nimport type { SNSEventHandlerCallableParams } from \"./plugins/SNSEventHandler.js\";\nimport { SNSEventHandler } from \"./plugins/SNSEventHandler.js\";\nimport { execute } from \"~/execute.js\";\nimport type { HandlerFactoryParams } from \"~/types.js\";\n/**\n * We need a class, not an interface exported from types.\n */\n// @ts-expect-error\nimport Reply from \"fastify/lib/reply.js\";\nimport { createComposedHandler } from \"~/utils/composedHandler.js\";\n\nexport * from \"./plugins/SNSEventHandler.js\";\n\nexport interface HandlerCallable {\n (event: SNSEvent, context: LambdaContext): Promise<APIGatewayProxyResult>;\n}\n\nexport type HandlerParams = HandlerFactoryParams;\n\nconst url = \"/webiny-sns-event\";\n\nexport const createHandler = (params: HandlerParams): HandlerCallable => {\n return async (event, context) => {\n const app = createBaseHandler({\n ...params,\n options: {\n logger: params.debug === true,\n ...(params.options || {})\n }\n });\n /**\n * We always must add our default plugins to the app.\n */\n registerDefaultPlugins(app.webiny);\n /**\n * There must be an event plugin for this handler to work.\n */\n const plugins = app.webiny.plugins.byType<SNSEventHandler>(SNSEventHandler.type).reverse();\n if (plugins.length === 0) {\n throw new Error(`To run @webiny/handler-aws/sns, you must have SNSEventHandler set.`);\n }\n\n const handler = createComposedHandler<\n SNSEventHandler,\n SNSEventHandlerCallableParams<APIGatewayProxyResult>,\n APIGatewayProxyResult\n >(plugins);\n\n app.post(url, async (request, reply) => {\n const params: Omit<SNSEventHandlerCallableParams<APIGatewayProxyResult>, \"next\"> = {\n request,\n reply,\n context: app.webiny,\n event,\n lambdaContext: context\n };\n\n const result = await handler(\n params as unknown as SNSEventHandlerCallableParams<APIGatewayProxyResult>\n );\n\n if (result instanceof Reply) {\n return result;\n }\n\n app.__webiny_raw_result = result;\n return reply.send({});\n });\n return execute({\n app,\n url,\n payload: event\n });\n };\n};\n"],"names":["url","createHandler","params","event","context","app","createBaseHandler","registerDefaultPlugins","plugins","SNSEventHandler","Error","handler","createComposedHandler","request","reply","result","Reply","execute"],"mappings":";;;;;;;AA0BA,MAAMA,MAAM;AAEL,MAAMC,oBAAgB,CAACC,SACnB,OAAOC,OAAOC;QACjB,MAAMC,MAAMC,cAAkB;YAC1B,GAAGJ,MAAM;YACT,SAAS;gBACL,QAAQA,AAAiB,SAAjBA,OAAO,KAAK;gBACpB,GAAIA,OAAO,OAAO,IAAI,CAAC,CAAC;YAC5B;QACJ;QAIAK,uBAAuBF,IAAI,MAAM;QAIjC,MAAMG,UAAUH,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAkBI,gBAAgB,IAAI,EAAE,OAAO;QACxF,IAAID,AAAmB,MAAnBA,QAAQ,MAAM,EACd,MAAM,IAAIE,MAAM;QAGpB,MAAMC,UAAUC,sBAIdJ;QAEFH,IAAI,IAAI,CAACL,KAAK,OAAOa,SAASC;YAC1B,MAAMZ,SAA6E;gBAC/EW;gBACAC;gBACA,SAAST,IAAI,MAAM;gBACnBF;gBACA,eAAeC;YACnB;YAEA,MAAMW,SAAS,MAAMJ,QACjBT;YAGJ,IAAIa,kBAAkBC,WAClB,OAAOD;YAGXV,IAAI,mBAAmB,GAAGU;YAC1B,OAAOD,MAAM,IAAI,CAAC,CAAC;QACvB;QACA,OAAOG,QAAQ;YACXZ;YACAL,KAAAA;YACA,SAASG;QACb;IACJ"}
@@ -0,0 +1,20 @@
1
+ import type { Context as LambdaContext, SNSEvent } from "@webiny/aws-sdk/types/index.js";
2
+ import { Plugin } from "@webiny/plugins/Plugin.js";
3
+ import type { Context, Reply, Request } from "@webiny/handler/types.js";
4
+ export interface SNSEventHandlerCallableParams<Response = Reply> {
5
+ request: Request;
6
+ reply: Reply;
7
+ context: Context;
8
+ event: SNSEvent;
9
+ lambdaContext: LambdaContext;
10
+ next: () => Promise<Response>;
11
+ }
12
+ export interface SNSEventHandlerCallable<Response = Reply> {
13
+ (params: SNSEventHandlerCallableParams<Response>): Promise<Response>;
14
+ }
15
+ export declare class SNSEventHandler<Response = any> extends Plugin {
16
+ static type: string;
17
+ readonly cb: SNSEventHandlerCallable<Response>;
18
+ constructor(cb: SNSEventHandlerCallable<Response>);
19
+ }
20
+ export declare const createEventHandler: <Response>(cb: SNSEventHandlerCallable<Response>) => SNSEventHandler<Response>;
@@ -0,0 +1,14 @@
1
+ import { Plugin } from "@webiny/plugins/Plugin.js";
2
+ class SNSEventHandler extends Plugin {
3
+ static{
4
+ this.type = "handler.fastify.aws.sns.eventHandler";
5
+ }
6
+ constructor(cb){
7
+ super();
8
+ this.cb = cb;
9
+ }
10
+ }
11
+ const createEventHandler = (cb)=>new SNSEventHandler(cb);
12
+ export { SNSEventHandler, createEventHandler };
13
+
14
+ //# sourceMappingURL=SNSEventHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sns/plugins/SNSEventHandler.js","sources":["../../../src/sns/plugins/SNSEventHandler.ts"],"sourcesContent":["import type { Context as LambdaContext, SNSEvent } from \"@webiny/aws-sdk/types/index.js\";\nimport { Plugin } from \"@webiny/plugins/Plugin.js\";\nimport type { Context, Reply, Request } from \"@webiny/handler/types.js\";\n\nexport interface SNSEventHandlerCallableParams<Response = Reply> {\n request: Request;\n reply: Reply;\n context: Context;\n event: SNSEvent;\n lambdaContext: LambdaContext;\n next: () => Promise<Response>;\n}\n\nexport interface SNSEventHandlerCallable<Response = Reply> {\n (params: SNSEventHandlerCallableParams<Response>): Promise<Response>;\n}\n\nexport class SNSEventHandler<Response = any> extends Plugin {\n public static override type = \"handler.fastify.aws.sns.eventHandler\";\n\n public readonly cb: SNSEventHandlerCallable<Response>;\n\n public constructor(cb: SNSEventHandlerCallable<Response>) {\n super();\n this.cb = cb;\n }\n}\n\nexport const createEventHandler = <Response>(cb: SNSEventHandlerCallable<Response>) => {\n return new SNSEventHandler<Response>(cb);\n};\n"],"names":["SNSEventHandler","Plugin","cb","createEventHandler"],"mappings":";AAiBO,MAAMA,wBAAwCC;;aAC1B,IAAI,GAAG;;IAI9B,YAAmBC,EAAqC,CAAE;QACtD,KAAK;QACL,IAAI,CAAC,EAAE,GAAGA;IACd;AACJ;AAEO,MAAMC,qBAAqB,CAAWD,KAClC,IAAIF,gBAA0BE"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { registry } from "../registry.js";
2
+ import { createHandler } from "./index.js";
3
+ import { createSourceHandler } from "../sourceHandler.js";
4
+ const handler = createSourceHandler({
5
+ name: "handler-aws-sns",
6
+ canUse: (event)=>{
7
+ if (!Array.isArray(event.Records) || 0 === event.Records.length) return false;
8
+ const [record] = event.Records;
9
+ return !!record.Sns;
10
+ },
11
+ handle: async ({ params, event, context })=>createHandler(params)(event, context)
12
+ });
13
+ registry.register(handler);
14
+
15
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sns/register.js","sources":["../../src/sns/register.ts"],"sourcesContent":["import type { SNSEvent } from \"@webiny/aws-sdk/types/index.js\";\nimport { registry } from \"~/registry.js\";\nimport type { HandlerParams } from \"./index.js\";\nimport { createHandler } from \"./index.js\";\nimport { createSourceHandler } from \"~/sourceHandler.js\";\n\nconst handler = createSourceHandler<SNSEvent, HandlerParams>({\n name: \"handler-aws-sns\",\n canUse: event => {\n if (!Array.isArray(event.Records) || event.Records.length === 0) {\n return false;\n }\n const [record] = event.Records;\n return !!record.Sns;\n },\n handle: async ({ params, event, context }) => {\n return createHandler(params)(event, context);\n }\n});\n\nregistry.register(handler);\n"],"names":["handler","createSourceHandler","event","Array","record","params","context","createHandler","registry"],"mappings":";;;AAMA,MAAMA,UAAUC,oBAA6C;IACzD,MAAM;IACN,QAAQC,CAAAA;QACJ,IAAI,CAACC,MAAM,OAAO,CAACD,MAAM,OAAO,KAAKA,AAAyB,MAAzBA,MAAM,OAAO,CAAC,MAAM,EACrD,OAAO;QAEX,MAAM,CAACE,OAAO,GAAGF,MAAM,OAAO;QAC9B,OAAO,CAAC,CAACE,OAAO,GAAG;IACvB;IACA,QAAQ,OAAO,EAAEC,MAAM,EAAEH,KAAK,EAAEI,OAAO,EAAE,GAC9BC,cAAcF,QAAQH,OAAOI;AAE5C;AAEAE,SAAS,QAAQ,CAACR"}
@@ -0,0 +1,2 @@
1
+ import type { SourceHandler, HandlerEvent, HandlerFactoryParams } from "./types.js";
2
+ export declare const createSourceHandler: <TEvent = HandlerEvent, TParams extends HandlerFactoryParams = HandlerFactoryParams>(handler: SourceHandler<TEvent, TParams>) => SourceHandler<TEvent, TParams, any>;
@@ -0,0 +1,4 @@
1
+ const createSourceHandler = (handler)=>handler;
2
+ export { createSourceHandler };
3
+
4
+ //# sourceMappingURL=sourceHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceHandler.js","sources":["../src/sourceHandler.ts"],"sourcesContent":["import type { SourceHandler, HandlerEvent, HandlerFactoryParams } from \"~/types.js\";\n\nexport const createSourceHandler = <\n TEvent = HandlerEvent,\n TParams extends HandlerFactoryParams = HandlerFactoryParams\n>(\n handler: SourceHandler<TEvent, TParams>\n) => {\n return handler;\n};\n"],"names":["createSourceHandler","handler"],"mappings":"AAEO,MAAMA,sBAAsB,CAI/BC,UAEOA"}
package/sqs/index.d.ts CHANGED
@@ -1,11 +1,8 @@
1
- import { CreateHandlerParams as BaseCreateHandlerParams } from "@webiny/handler";
2
- import { SQSEvent, Context as LambdaContext } from "aws-lambda";
3
- import { APIGatewayProxyResult } from "aws-lambda/trigger/api-gateway-proxy";
1
+ import type { APIGatewayProxyResult, Context as LambdaContext, SQSEvent } from "@webiny/aws-sdk/types/index.js";
2
+ import type { HandlerFactoryParams } from "../types.js";
3
+ export * from "./plugins/SQSEventHandler.js";
4
4
  export interface HandlerCallable {
5
- (payload: SQSEvent, context: LambdaContext): Promise<APIGatewayProxyResult>;
5
+ (event: SQSEvent, context: LambdaContext): Promise<APIGatewayProxyResult>;
6
6
  }
7
- export interface CreateHandlerParams extends BaseCreateHandlerParams {
8
- debug?: boolean;
9
- }
10
- export declare const createHandler: (params: CreateHandlerParams) => HandlerCallable;
11
- export * from "./plugins/SQSEventHandler";
7
+ export type HandlerParams = HandlerFactoryParams;
8
+ export declare const createHandler: (params: HandlerParams) => HandlerCallable;