@webiny/handler-aws 0.0.0-mt-3 → 0.0.0-unstable.06b2ede40f
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/createHandler.d.ts +2 -0
- package/createHandler.js +29 -0
- package/createHandler.js.map +1 -0
- package/dynamodb/index.d.ts +8 -0
- package/dynamodb/index.js +79 -0
- package/dynamodb/index.js.map +1 -0
- package/dynamodb/plugins/DynamoDBEventHandler.d.ts +20 -0
- package/dynamodb/plugins/DynamoDBEventHandler.js +21 -0
- package/dynamodb/plugins/DynamoDBEventHandler.js.map +1 -0
- package/dynamodb/register.d.ts +1 -0
- package/dynamodb/register.js +28 -0
- package/dynamodb/register.js.map +1 -0
- package/eventBridge/index.d.ts +8 -0
- package/eventBridge/index.js +79 -0
- package/eventBridge/index.js.map +1 -0
- package/eventBridge/plugins/EventBridgeEventHandler.d.ts +20 -0
- package/eventBridge/plugins/EventBridgeEventHandler.js +21 -0
- package/eventBridge/plugins/EventBridgeEventHandler.js.map +1 -0
- package/eventBridge/register.d.ts +4 -0
- package/eventBridge/register.js +21 -0
- package/eventBridge/register.js.map +1 -0
- package/execute.d.ts +7 -0
- package/execute.js +73 -0
- package/execute.js.map +1 -0
- package/gateway/index.d.ts +10 -0
- package/gateway/index.js +90 -0
- package/gateway/index.js.map +1 -0
- package/gateway/register.d.ts +1 -0
- package/gateway/register.js +21 -0
- package/gateway/register.js.map +1 -0
- package/index.d.ts +33 -17
- package/index.js +367 -33
- package/index.js.map +1 -0
- package/package.json +16 -24
- package/plugins/handlerClient.d.ts +2 -3
- package/plugins/handlerClient.js +46 -33
- package/plugins/handlerClient.js.map +1 -0
- package/plugins/index.d.ts +2 -0
- package/plugins/index.js +13 -0
- package/plugins/index.js.map +1 -0
- package/raw/index.d.ts +14 -0
- package/raw/index.js +89 -0
- package/raw/index.js.map +1 -0
- package/raw/plugins/RawEventHandler.d.ts +24 -0
- package/raw/plugins/RawEventHandler.js +34 -0
- package/raw/plugins/RawEventHandler.js.map +1 -0
- package/registry.d.ts +17 -0
- package/registry.js +44 -0
- package/registry.js.map +1 -0
- package/s3/index.d.ts +8 -0
- package/s3/index.js +79 -0
- package/s3/index.js.map +1 -0
- package/s3/plugins/S3EventHandler.d.ts +20 -0
- package/s3/plugins/S3EventHandler.js +21 -0
- package/s3/plugins/S3EventHandler.js.map +1 -0
- package/s3/register.d.ts +4 -0
- package/s3/register.js +25 -0
- package/s3/register.js.map +1 -0
- package/sns/index.d.ts +8 -0
- package/sns/index.js +79 -0
- package/sns/index.js.map +1 -0
- package/sns/plugins/SNSEventHandler.d.ts +20 -0
- package/sns/plugins/SNSEventHandler.js +21 -0
- package/sns/plugins/SNSEventHandler.js.map +1 -0
- package/sns/register.d.ts +1 -0
- package/sns/register.js +25 -0
- package/sns/register.js.map +1 -0
- package/sourceHandler.d.ts +2 -0
- package/sourceHandler.js +12 -0
- package/sourceHandler.js.map +1 -0
- package/sqs/index.d.ts +8 -0
- package/sqs/index.js +82 -0
- package/sqs/index.js.map +1 -0
- package/sqs/plugins/SQSEventHandler.d.ts +20 -0
- package/sqs/plugins/SQSEventHandler.js +21 -0
- package/sqs/plugins/SQSEventHandler.js.map +1 -0
- package/sqs/register.d.ts +1 -0
- package/sqs/register.js +28 -0
- package/sqs/register.js.map +1 -0
- package/types.d.ts +41 -0
- package/types.js +37 -0
- package/types.js.map +1 -0
- package/utils/composedHandler.d.ts +6 -0
- package/utils/composedHandler.js +24 -0
- package/utils/composedHandler.js.map +1 -0
- package/utils/index.d.ts +2 -0
- package/utils/index.js +29 -0
- package/utils/index.js.map +1 -0
- package/utils/timer/CustomTimer.d.ts +5 -0
- package/utils/timer/CustomTimer.js +19 -0
- package/utils/timer/CustomTimer.js.map +1 -0
- package/utils/timer/Timer.d.ts +10 -0
- package/utils/timer/Timer.js +24 -0
- package/utils/timer/Timer.js.map +1 -0
- package/utils/timer/abstractions/ITimer.d.ts +10 -0
- package/utils/timer/abstractions/ITimer.js +7 -0
- package/utils/timer/abstractions/ITimer.js.map +1 -0
- package/utils/timer/factory.d.ts +4 -0
- package/utils/timer/factory.js +20 -0
- package/utils/timer/factory.js.map +1 -0
- package/utils/timer/index.d.ts +4 -0
- package/utils/timer/index.js +51 -0
- package/utils/timer/index.js.map +1 -0
- package/plugins/handlerArgs.d.ts +0 -7
- package/plugins/handlerArgs.js +0 -16
- package/plugins/handlerHttp.d.ts +0 -5
- package/plugins/handlerHttp.js +0 -65
package/createHandler.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createHandler = void 0;
|
|
7
|
+
var _plugins = require("@webiny/plugins");
|
|
8
|
+
var _registry = require("./registry");
|
|
9
|
+
const createHandler = ({
|
|
10
|
+
plugins,
|
|
11
|
+
...params
|
|
12
|
+
}) => {
|
|
13
|
+
const pluginsContainer = new _plugins.AsyncPluginsContainer(plugins);
|
|
14
|
+
return async (event, context) => {
|
|
15
|
+
const plugins = await pluginsContainer.init();
|
|
16
|
+
const handler = _registry.registry.getHandler(event, context);
|
|
17
|
+
return handler.handle({
|
|
18
|
+
params: {
|
|
19
|
+
...params,
|
|
20
|
+
plugins
|
|
21
|
+
},
|
|
22
|
+
event,
|
|
23
|
+
context
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
exports.createHandler = createHandler;
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=createHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_plugins","require","_registry","createHandler","plugins","params","pluginsContainer","AsyncPluginsContainer","event","context","init","handler","registry","getHandler","handle","exports"],"sources":["createHandler.ts"],"sourcesContent":["import { AsyncPluginsContainer } from \"@webiny/plugins\";\nimport type { HandlerFactory } from \"~/types\";\nimport { registry } from \"./registry\";\n\nexport const createHandler: HandlerFactory = ({ plugins, ...params }) => {\n const pluginsContainer = new AsyncPluginsContainer(plugins);\n\n return async (event, context) => {\n const plugins = await pluginsContainer.init();\n const handler = registry.getHandler(event, context);\n return handler.handle({\n params: {\n ...params,\n plugins\n },\n event,\n context\n });\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEO,MAAME,aAA6B,GAAGA,CAAC;EAAEC,OAAO;EAAE,GAAGC;AAAO,CAAC,KAAK;EACrE,MAAMC,gBAAgB,GAAG,IAAIC,8BAAqB,CAACH,OAAO,CAAC;EAE3D,OAAO,OAAOI,KAAK,EAAEC,OAAO,KAAK;IAC7B,MAAML,OAAO,GAAG,MAAME,gBAAgB,CAACI,IAAI,CAAC,CAAC;IAC7C,MAAMC,OAAO,GAAGC,kBAAQ,CAACC,UAAU,CAACL,KAAK,EAAEC,OAAO,CAAC;IACnD,OAAOE,OAAO,CAACG,MAAM,CAAC;MAClBT,MAAM,EAAE;QACJ,GAAGA,MAAM;QACTD;MACJ,CAAC;MACDI,KAAK;MACLC;IACJ,CAAC,CAAC;EACN,CAAC;AACL,CAAC;AAACM,OAAA,CAAAZ,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { APIGatewayProxyResult, Context as LambdaContext, DynamoDBStreamEvent } from "@webiny/aws-sdk/types";
|
|
2
|
+
import type { HandlerFactoryParams } from "../types";
|
|
3
|
+
export * from "./plugins/DynamoDBEventHandler";
|
|
4
|
+
export type HandlerParams = HandlerFactoryParams;
|
|
5
|
+
export interface HandlerCallable {
|
|
6
|
+
(event: DynamoDBStreamEvent, context: LambdaContext): Promise<APIGatewayProxyResult>;
|
|
7
|
+
}
|
|
8
|
+
export declare const createHandler: (params: HandlerParams) => HandlerCallable;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
createHandler: true
|
|
9
|
+
};
|
|
10
|
+
exports.createHandler = void 0;
|
|
11
|
+
var _handler = require("@webiny/handler");
|
|
12
|
+
var _plugins = require("../plugins");
|
|
13
|
+
var _DynamoDBEventHandler = require("./plugins/DynamoDBEventHandler");
|
|
14
|
+
Object.keys(_DynamoDBEventHandler).forEach(function (key) {
|
|
15
|
+
if (key === "default" || key === "__esModule") return;
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
17
|
+
if (key in exports && exports[key] === _DynamoDBEventHandler[key]) return;
|
|
18
|
+
Object.defineProperty(exports, key, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _DynamoDBEventHandler[key];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
var _reply = _interopRequireDefault(require("fastify/lib/reply"));
|
|
26
|
+
var _execute = require("../execute");
|
|
27
|
+
var _composedHandler = require("../utils/composedHandler");
|
|
28
|
+
/**
|
|
29
|
+
* We need a class, not an interface exported from types.
|
|
30
|
+
*/
|
|
31
|
+
// @ts-expect-error
|
|
32
|
+
|
|
33
|
+
const url = "/webiny-dynamodb-event";
|
|
34
|
+
const createHandler = params => {
|
|
35
|
+
return (payload, context) => {
|
|
36
|
+
const app = (0, _handler.createHandler)({
|
|
37
|
+
...params,
|
|
38
|
+
options: {
|
|
39
|
+
logger: params.debug === true,
|
|
40
|
+
...(params.options || {})
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* We always must add our default plugins to the app.
|
|
45
|
+
*/
|
|
46
|
+
(0, _plugins.registerDefaultPlugins)(app.webiny);
|
|
47
|
+
/**
|
|
48
|
+
* There must be an event plugin for this handler to work.
|
|
49
|
+
*/
|
|
50
|
+
const plugins = app.webiny.plugins.byType(_DynamoDBEventHandler.DynamoDBEventHandler.type).reverse();
|
|
51
|
+
if (plugins.length === 0) {
|
|
52
|
+
throw new Error(`To run @webiny/handler-aws/dynamodb, you must have DynamoDBHandler set.`);
|
|
53
|
+
}
|
|
54
|
+
const handler = (0, _composedHandler.createComposedHandler)(plugins);
|
|
55
|
+
app.post(url, async (request, reply) => {
|
|
56
|
+
const params = {
|
|
57
|
+
request,
|
|
58
|
+
context: app.webiny,
|
|
59
|
+
event: payload,
|
|
60
|
+
lambdaContext: context,
|
|
61
|
+
reply
|
|
62
|
+
};
|
|
63
|
+
const result = await handler(params);
|
|
64
|
+
if (result instanceof _reply.default) {
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
app.__webiny_raw_result = result;
|
|
68
|
+
return reply.send({});
|
|
69
|
+
});
|
|
70
|
+
return (0, _execute.execute)({
|
|
71
|
+
app,
|
|
72
|
+
url,
|
|
73
|
+
payload
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
exports.createHandler = createHandler;
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_handler","require","_plugins","_DynamoDBEventHandler","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_reply","_interopRequireDefault","_execute","_composedHandler","url","createHandler","params","payload","context","app","createBaseHandler","options","logger","debug","registerDefaultPlugins","webiny","plugins","byType","DynamoDBEventHandler","type","reverse","length","Error","handler","createComposedHandler","post","request","reply","event","lambdaContext","result","Reply","__webiny_raw_result","send","execute"],"sources":["index.ts"],"sourcesContent":["import type {\n APIGatewayProxyResult,\n Context as LambdaContext,\n DynamoDBStreamEvent\n} from \"@webiny/aws-sdk/types\";\nimport type { HandlerFactoryParams } from \"~/types\";\nimport { createHandler as createBaseHandler } from \"@webiny/handler\";\nimport { registerDefaultPlugins } from \"~/plugins\";\nimport type { DynamoDBEventHandlerCallableParams } from \"./plugins/DynamoDBEventHandler\";\nimport { DynamoDBEventHandler } from \"./plugins/DynamoDBEventHandler\";\n/**\n * We need a class, not an interface exported from types.\n */\n// @ts-expect-error\nimport Reply from \"fastify/lib/reply\";\nimport { execute } from \"~/execute\";\nimport { createComposedHandler } from \"~/utils/composedHandler\";\n\nexport * from \"./plugins/DynamoDBEventHandler\";\n\nconst url = \"/webiny-dynamodb-event\";\n\nexport type HandlerParams = HandlerFactoryParams;\n\nexport interface HandlerCallable {\n (event: DynamoDBStreamEvent, context: LambdaContext): Promise<APIGatewayProxyResult>;\n}\n\nexport const createHandler = (params: HandlerParams): HandlerCallable => {\n return (payload, 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\n .byType<DynamoDBEventHandler>(DynamoDBEventHandler.type)\n .reverse();\n if (plugins.length === 0) {\n throw new Error(\n `To run @webiny/handler-aws/dynamodb, you must have DynamoDBHandler set.`\n );\n }\n\n const handler = createComposedHandler<\n DynamoDBEventHandler,\n DynamoDBEventHandlerCallableParams<APIGatewayProxyResult>,\n APIGatewayProxyResult\n >(plugins);\n\n app.post(url, async (request, reply) => {\n const params: Omit<\n DynamoDBEventHandlerCallableParams<APIGatewayProxyResult>,\n \"next\"\n > = {\n request,\n context: app.webiny,\n event: payload,\n lambdaContext: context,\n reply\n };\n const result = await handler(\n params as unknown as DynamoDBEventHandlerCallableParams<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\n });\n };\n};\n"],"mappings":";;;;;;;;;;AAMA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,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C,OAAO,GAAG,IAAAC,sCAAqB,EAInCR,OAAO,CAAC;IAEVP,GAAG,CAACgB,IAAI,CAACrB,GAAG,EAAE,OAAOsB,OAAO,EAAEC,KAAK,KAAK;MACpC,MAAMrB,MAGL,GAAG;QACAoB,OAAO;QACPlB,OAAO,EAAEC,GAAG,CAACM,MAAM;QACnBa,KAAK,EAAErB,OAAO;QACdsB,aAAa,EAAErB,OAAO;QACtBmB;MACJ,CAAC;MACD,MAAMG,MAAM,GAAG,MAAMP,OAAO,CACxBjB,MACJ,CAAC;MAED,IAAIwB,MAAM,YAAYC,cAAK,EAAE;QACzB,OAAOD,MAAM;MACjB;MAEArB,GAAG,CAACuB,mBAAmB,GAAGF,MAAM;MAChC,OAAOH,KAAK,CAACM,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC,CAAC;IACF,OAAO,IAAAC,gBAAO,EAAC;MACXzB,GAAG;MACHL,GAAG;MACHG;IACJ,CAAC,CAAC;EACN,CAAC;AACL,CAAC;AAACX,OAAA,CAAAS,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins/Plugin";
|
|
2
|
+
import type { Context, Reply, Request } from "@webiny/handler/types";
|
|
3
|
+
import type { Context as LambdaContext, DynamoDBStreamEvent } from "@webiny/aws-sdk/types";
|
|
4
|
+
export interface DynamoDBEventHandlerCallableParams<Response = Reply> {
|
|
5
|
+
request: Request;
|
|
6
|
+
context: Context;
|
|
7
|
+
event: DynamoDBStreamEvent;
|
|
8
|
+
lambdaContext: LambdaContext;
|
|
9
|
+
reply: Reply;
|
|
10
|
+
next: () => Promise<Response>;
|
|
11
|
+
}
|
|
12
|
+
export interface DynamoDBEventHandlerCallable<Response = Reply> {
|
|
13
|
+
(params: DynamoDBEventHandlerCallableParams<Response>): Promise<Response>;
|
|
14
|
+
}
|
|
15
|
+
export declare class DynamoDBEventHandler<Response = any> extends Plugin {
|
|
16
|
+
static type: string;
|
|
17
|
+
readonly cb: DynamoDBEventHandlerCallable<Response>;
|
|
18
|
+
constructor(cb: DynamoDBEventHandlerCallable<Response>);
|
|
19
|
+
}
|
|
20
|
+
export declare const createEventHandler: <Response_1>(cb: DynamoDBEventHandlerCallable<Response_1>) => DynamoDBEventHandler<Response_1>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createEventHandler = exports.DynamoDBEventHandler = void 0;
|
|
7
|
+
var _Plugin = require("@webiny/plugins/Plugin");
|
|
8
|
+
class DynamoDBEventHandler extends _Plugin.Plugin {
|
|
9
|
+
static type = "handler.fastify.aws.dynamodb.eventHandler";
|
|
10
|
+
constructor(cb) {
|
|
11
|
+
super();
|
|
12
|
+
this.cb = cb;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.DynamoDBEventHandler = DynamoDBEventHandler;
|
|
16
|
+
const createEventHandler = cb => {
|
|
17
|
+
return new DynamoDBEventHandler(cb);
|
|
18
|
+
};
|
|
19
|
+
exports.createEventHandler = createEventHandler;
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=DynamoDBEventHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_Plugin","require","DynamoDBEventHandler","Plugin","type","constructor","cb","exports","createEventHandler"],"sources":["DynamoDBEventHandler.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport type { Context, Reply, Request } from \"@webiny/handler/types\";\nimport type { Context as LambdaContext, DynamoDBStreamEvent } from \"@webiny/aws-sdk/types\";\n\nexport interface DynamoDBEventHandlerCallableParams<Response = Reply> {\n request: Request;\n context: Context;\n event: DynamoDBStreamEvent;\n lambdaContext: LambdaContext;\n reply: Reply;\n next: () => Promise<Response>;\n}\n\nexport interface DynamoDBEventHandlerCallable<Response = Reply> {\n (params: DynamoDBEventHandlerCallableParams<Response>): Promise<Response>;\n}\n\nexport class DynamoDBEventHandler<Response = any> extends Plugin {\n public static override type = \"handler.fastify.aws.dynamodb.eventHandler\";\n\n public readonly cb: DynamoDBEventHandlerCallable<Response>;\n\n public constructor(cb: DynamoDBEventHandlerCallable<Response>) {\n super();\n this.cb = cb;\n }\n}\n\nexport const createEventHandler = <Response>(cb: DynamoDBEventHandlerCallable<Response>) => {\n return new DynamoDBEventHandler<Response>(cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAiBO,MAAMC,oBAAoB,SAAyBC,cAAM,CAAC;EAC7D,OAAuBC,IAAI,GAAG,2CAA2C;EAIlEC,WAAWA,CAACC,EAA0C,EAAE;IAC3D,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;AACJ;AAACC,OAAA,CAAAL,oBAAA,GAAAA,oBAAA;AAEM,MAAMM,kBAAkB,GAAcF,EAA0C,IAAK;EACxF,OAAO,IAAIJ,oBAAoB,CAAWI,EAAE,CAAC;AACjD,CAAC;AAACC,OAAA,CAAAC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _registry = require("../registry");
|
|
4
|
+
var _sourceHandler = require("../sourceHandler");
|
|
5
|
+
var _index = require("./index");
|
|
6
|
+
const handler = (0, _sourceHandler.createSourceHandler)({
|
|
7
|
+
name: "handler-aws-dynamodb-stream",
|
|
8
|
+
canUse: event => {
|
|
9
|
+
if (!Array.isArray(event.Records) || event.Records.length === 0) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const [record] = event.Records;
|
|
13
|
+
if (typeof record.eventSource !== "string") {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return record.eventSource.toLowerCase() === "aws:dynamodb";
|
|
17
|
+
},
|
|
18
|
+
handle: async ({
|
|
19
|
+
params,
|
|
20
|
+
event,
|
|
21
|
+
context
|
|
22
|
+
}) => {
|
|
23
|
+
return (0, _index.createHandler)(params)(event, context);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
_registry.registry.register(handler);
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_registry","require","_sourceHandler","_index","handler","createSourceHandler","name","canUse","event","Array","isArray","Records","length","record","eventSource","toLowerCase","handle","params","context","createHandler","registry","register"],"sources":["register.ts"],"sourcesContent":["import { registry } from \"~/registry\";\nimport type { DynamoDBStreamEvent } from \"@webiny/aws-sdk/types\";\nimport { createSourceHandler } from \"~/sourceHandler\";\nimport type { HandlerParams } from \"~/dynamodb/index\";\nimport { createHandler } from \"~/dynamodb/index\";\n\nconst handler = createSourceHandler<DynamoDBStreamEvent, HandlerParams>({\n name: \"handler-aws-dynamodb-stream\",\n canUse: event => {\n if (!Array.isArray(event.Records) || event.Records.length === 0) {\n return false;\n }\n const [record] = event.Records;\n if (typeof record.eventSource !== \"string\") {\n return false;\n }\n return record.eventSource.toLowerCase() === \"aws:dynamodb\";\n },\n handle: async ({ params, event, context }) => {\n return createHandler(params)(event, context);\n }\n});\n\nregistry.register(handler);\n"],"mappings":";;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAEA,MAAMG,OAAO,GAAG,IAAAC,kCAAmB,EAAqC;EACpEC,IAAI,EAAE,6BAA6B;EACnCC,MAAM,EAAEC,KAAK,IAAI;IACb,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAACG,OAAO,CAAC,IAAIH,KAAK,CAACG,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;MAC7D,OAAO,KAAK;IAChB;IACA,MAAM,CAACC,MAAM,CAAC,GAAGL,KAAK,CAACG,OAAO;IAC9B,IAAI,OAAOE,MAAM,CAACC,WAAW,KAAK,QAAQ,EAAE;MACxC,OAAO,KAAK;IAChB;IACA,OAAOD,MAAM,CAACC,WAAW,CAACC,WAAW,CAAC,CAAC,KAAK,cAAc;EAC9D,CAAC;EACDC,MAAM,EAAE,MAAAA,CAAO;IAAEC,MAAM;IAAET,KAAK;IAAEU;EAAQ,CAAC,KAAK;IAC1C,OAAO,IAAAC,oBAAa,EAACF,MAAM,CAAC,CAACT,KAAK,EAAEU,OAAO,CAAC;EAChD;AACJ,CAAC,CAAC;AAEFE,kBAAQ,CAACC,QAAQ,CAACjB,OAAO,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HandlerFactoryParams } from "../types";
|
|
2
|
+
import type { APIGatewayProxyResult, Context as LambdaContext, EventBridgeEvent } from "@webiny/aws-sdk/types";
|
|
3
|
+
export * from "./plugins/EventBridgeEventHandler";
|
|
4
|
+
export type HandlerParams = HandlerFactoryParams;
|
|
5
|
+
export interface HandlerCallable {
|
|
6
|
+
(event: EventBridgeEvent<string, string>, context: LambdaContext): Promise<APIGatewayProxyResult>;
|
|
7
|
+
}
|
|
8
|
+
export declare const createHandler: (params: HandlerParams) => HandlerCallable;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
createHandler: true
|
|
9
|
+
};
|
|
10
|
+
exports.createHandler = void 0;
|
|
11
|
+
var _handler = require("@webiny/handler");
|
|
12
|
+
var _plugins = require("../plugins");
|
|
13
|
+
var _EventBridgeEventHandler = require("./plugins/EventBridgeEventHandler");
|
|
14
|
+
Object.keys(_EventBridgeEventHandler).forEach(function (key) {
|
|
15
|
+
if (key === "default" || key === "__esModule") return;
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
17
|
+
if (key in exports && exports[key] === _EventBridgeEventHandler[key]) return;
|
|
18
|
+
Object.defineProperty(exports, key, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _EventBridgeEventHandler[key];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
var _execute = require("../execute");
|
|
26
|
+
var _reply = _interopRequireDefault(require("fastify/lib/reply"));
|
|
27
|
+
var _composedHandler = require("../utils/composedHandler");
|
|
28
|
+
/**
|
|
29
|
+
* We need a class, not an interface exported from types.
|
|
30
|
+
*/
|
|
31
|
+
// @ts-expect-error
|
|
32
|
+
|
|
33
|
+
const url = "/webiny-eventBridge-event";
|
|
34
|
+
const createHandler = params => {
|
|
35
|
+
return (payload, context) => {
|
|
36
|
+
const app = (0, _handler.createHandler)({
|
|
37
|
+
...params,
|
|
38
|
+
options: {
|
|
39
|
+
logger: params.debug === true,
|
|
40
|
+
...(params.options || {})
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* We always must add our default plugins to the app.
|
|
45
|
+
*/
|
|
46
|
+
(0, _plugins.registerDefaultPlugins)(app.webiny);
|
|
47
|
+
/**
|
|
48
|
+
* There must be an event plugin for this handler to work.
|
|
49
|
+
*/
|
|
50
|
+
const plugins = app.webiny.plugins.byType(_EventBridgeEventHandler.EventBridgeEventHandler.type).reverse();
|
|
51
|
+
if (plugins.length === 0) {
|
|
52
|
+
throw new Error(`To run @webiny/handler-aws/eventBridge, you must have EventBridgeEventHandler set.`);
|
|
53
|
+
}
|
|
54
|
+
const handler = (0, _composedHandler.createComposedHandler)(plugins);
|
|
55
|
+
app.post(url, async (request, reply) => {
|
|
56
|
+
const params = {
|
|
57
|
+
request,
|
|
58
|
+
reply,
|
|
59
|
+
context: app.webiny,
|
|
60
|
+
payload,
|
|
61
|
+
lambdaContext: context
|
|
62
|
+
};
|
|
63
|
+
const result = await handler(params);
|
|
64
|
+
if (result instanceof _reply.default) {
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
app.__webiny_raw_result = result;
|
|
68
|
+
return reply.send({});
|
|
69
|
+
});
|
|
70
|
+
return (0, _execute.execute)({
|
|
71
|
+
app,
|
|
72
|
+
url,
|
|
73
|
+
payload
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
exports.createHandler = createHandler;
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_handler","require","_plugins","_EventBridgeEventHandler","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_execute","_reply","_interopRequireDefault","_composedHandler","url","createHandler","params","payload","context","app","createBaseHandler","options","logger","debug","registerDefaultPlugins","webiny","plugins","byType","EventBridgeEventHandler","type","reverse","length","Error","handler","createComposedHandler","post","request","reply","lambdaContext","result","Reply","__webiny_raw_result","send","execute"],"sources":["index.ts"],"sourcesContent":["import { createHandler as createBaseHandler } from \"@webiny/handler\";\nimport { registerDefaultPlugins } from \"~/plugins\";\nimport type { EventBridgeEventHandlerCallableParams } from \"~/eventBridge/plugins/EventBridgeEventHandler\";\nimport { EventBridgeEventHandler } from \"~/eventBridge/plugins/EventBridgeEventHandler\";\nimport { execute } from \"~/execute\";\nimport type { HandlerFactoryParams } from \"~/types\";\nimport type {\n APIGatewayProxyResult,\n Context as LambdaContext,\n EventBridgeEvent\n} from \"@webiny/aws-sdk/types\";\n/**\n * We need a class, not an interface exported from types.\n */\n// @ts-expect-error\nimport Reply from \"fastify/lib/reply\";\nimport { createComposedHandler } from \"~/utils/composedHandler\";\n\nexport * from \"./plugins/EventBridgeEventHandler\";\n\nexport type HandlerParams = HandlerFactoryParams;\n\nexport interface HandlerCallable {\n (\n event: EventBridgeEvent<string, string>,\n context: LambdaContext\n ): Promise<APIGatewayProxyResult>;\n}\n\nconst url = \"/webiny-eventBridge-event\";\n\nexport const createHandler = (params: HandlerParams): HandlerCallable => {\n return (payload, 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\n .byType<EventBridgeEventHandler<string, string>>(EventBridgeEventHandler.type)\n .reverse();\n if (plugins.length === 0) {\n throw new Error(\n `To run @webiny/handler-aws/eventBridge, you must have EventBridgeEventHandler set.`\n );\n }\n\n const handler = createComposedHandler<\n EventBridgeEventHandler<string, string>,\n EventBridgeEventHandlerCallableParams<string, string, APIGatewayProxyResult>,\n APIGatewayProxyResult\n >(plugins);\n\n app.post(url, async (request, reply) => {\n const params: Omit<\n EventBridgeEventHandlerCallableParams<string, string, APIGatewayProxyResult>,\n \"next\"\n > = {\n request,\n reply,\n context: app.webiny,\n payload,\n lambdaContext: context\n };\n const result = await handler(\n params as unknown as EventBridgeEventHandlerCallableParams<\n string,\n string,\n APIGatewayProxyResult\n >\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\n });\n };\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,wBAAA,GAAAF,OAAA;AAeAG,MAAA,CAAAC,IAAA,CAAAF,wBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,wBAAA,CAAAI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AG,MAAMN,OAAO,CACxBjB,MAKJ,CAAC;MAED,IAAIuB,MAAM,YAAYC,cAAK,EAAE;QACzB,OAAOD,MAAM;MACjB;MAEApB,GAAG,CAACsB,mBAAmB,GAAGF,MAAM;MAChC,OAAOF,KAAK,CAACK,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC,CAAC;IACF,OAAO,IAAAC,gBAAO,EAAC;MACXxB,GAAG;MACHL,GAAG;MACHG;IACJ,CAAC,CAAC;EACN,CAAC;AACL,CAAC;AAACX,OAAA,CAAAS,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Context as LambdaContext, EventBridgeEvent } from "@webiny/aws-sdk/types";
|
|
2
|
+
import { Plugin } from "@webiny/plugins/Plugin";
|
|
3
|
+
import type { Context, Reply, Request } from "@webiny/handler/types";
|
|
4
|
+
export interface EventBridgeEventHandlerCallableParams<DetailType extends string, Detail, Response = Reply> {
|
|
5
|
+
request: Request;
|
|
6
|
+
reply: Reply;
|
|
7
|
+
context: Context;
|
|
8
|
+
payload: EventBridgeEvent<DetailType, Detail>;
|
|
9
|
+
lambdaContext: LambdaContext;
|
|
10
|
+
next: () => Promise<Response>;
|
|
11
|
+
}
|
|
12
|
+
export interface EventBridgeEventHandlerCallable<DetailType extends string, Detail, Response = Reply> {
|
|
13
|
+
(params: EventBridgeEventHandlerCallableParams<DetailType, Detail, Response>): Promise<Response>;
|
|
14
|
+
}
|
|
15
|
+
export declare class EventBridgeEventHandler<DetailType extends string, Detail, Response = any> extends Plugin {
|
|
16
|
+
static type: string;
|
|
17
|
+
readonly cb: EventBridgeEventHandlerCallable<DetailType, Detail, Response>;
|
|
18
|
+
constructor(cb: EventBridgeEventHandlerCallable<DetailType, Detail, Response>);
|
|
19
|
+
}
|
|
20
|
+
export declare const createEventHandler: <DetailType extends string, Detail, Response_1 = any>(cb: EventBridgeEventHandlerCallable<DetailType, Detail, Response_1>) => EventBridgeEventHandler<DetailType, Detail, Response_1>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createEventHandler = exports.EventBridgeEventHandler = void 0;
|
|
7
|
+
var _Plugin = require("@webiny/plugins/Plugin");
|
|
8
|
+
class EventBridgeEventHandler extends _Plugin.Plugin {
|
|
9
|
+
static type = "handler.fastify.aws.eventBridge.eventHandler";
|
|
10
|
+
constructor(cb) {
|
|
11
|
+
super();
|
|
12
|
+
this.cb = cb;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.EventBridgeEventHandler = EventBridgeEventHandler;
|
|
16
|
+
const createEventHandler = cb => {
|
|
17
|
+
return new EventBridgeEventHandler(cb);
|
|
18
|
+
};
|
|
19
|
+
exports.createEventHandler = createEventHandler;
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=EventBridgeEventHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_Plugin","require","EventBridgeEventHandler","Plugin","type","constructor","cb","exports","createEventHandler"],"sources":["EventBridgeEventHandler.ts"],"sourcesContent":["import type { Context as LambdaContext, EventBridgeEvent } from \"@webiny/aws-sdk/types\";\nimport { Plugin } from \"@webiny/plugins/Plugin\";\nimport type { Context, Reply, Request } from \"@webiny/handler/types\";\n\nexport interface EventBridgeEventHandlerCallableParams<\n DetailType extends string,\n Detail,\n Response = Reply\n> {\n request: Request;\n reply: Reply;\n context: Context;\n payload: EventBridgeEvent<DetailType, Detail>;\n lambdaContext: LambdaContext;\n next: () => Promise<Response>;\n}\nexport interface EventBridgeEventHandlerCallable<\n DetailType extends string,\n Detail,\n Response = Reply\n> {\n (\n params: EventBridgeEventHandlerCallableParams<DetailType, Detail, Response>\n ): Promise<Response>;\n}\n\nexport class EventBridgeEventHandler<\n DetailType extends string,\n Detail,\n Response = any\n> extends Plugin {\n public static override type = \"handler.fastify.aws.eventBridge.eventHandler\";\n\n public readonly cb: EventBridgeEventHandlerCallable<DetailType, Detail, Response>;\n\n public constructor(cb: EventBridgeEventHandlerCallable<DetailType, Detail, Response>) {\n super();\n this.cb = cb;\n }\n}\n\nexport const createEventHandler = <DetailType extends string, Detail, Response = any>(\n cb: EventBridgeEventHandlerCallable<DetailType, Detail, Response>\n) => {\n return new EventBridgeEventHandler<DetailType, Detail, Response>(cb);\n};\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAyBO,MAAMC,uBAAuB,SAI1BC,cAAM,CAAC;EACb,OAAuBC,IAAI,GAAG,8CAA8C;EAIrEC,WAAWA,CAACC,EAAiE,EAAE;IAClF,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;AACJ;AAACC,OAAA,CAAAL,uBAAA,GAAAA,uBAAA;AAEM,MAAMM,kBAAkB,GAC3BF,EAAiE,IAChE;EACD,OAAO,IAAIJ,uBAAuB,CAA+BI,EAAE,CAAC;AACxE,CAAC;AAACC,OAAA,CAAAC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _registry = require("../registry");
|
|
4
|
+
var _sourceHandler = require("../sourceHandler");
|
|
5
|
+
var _index = require("./index");
|
|
6
|
+
const handler = (0, _sourceHandler.createSourceHandler)({
|
|
7
|
+
name: "handler-aws-event-bridge",
|
|
8
|
+
canUse: event => {
|
|
9
|
+
return !!event.source;
|
|
10
|
+
},
|
|
11
|
+
handle: async ({
|
|
12
|
+
params,
|
|
13
|
+
event,
|
|
14
|
+
context
|
|
15
|
+
}) => {
|
|
16
|
+
return (0, _index.createHandler)(params)(event, context);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
_registry.registry.register(handler);
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_registry","require","_sourceHandler","_index","handler","createSourceHandler","name","canUse","event","source","handle","params","context","createHandler","registry","register"],"sources":["register.ts"],"sourcesContent":["import type { EventBridgeEvent } from \"@webiny/aws-sdk/types\";\nimport { registry } from \"~/registry\";\nimport type { HandlerFactoryParams } from \"~/types\";\nimport { createSourceHandler } from \"~/sourceHandler\";\nimport { createHandler } from \"~/eventBridge/index\";\n\nexport interface HandlerParams extends HandlerFactoryParams {\n debug?: boolean;\n}\n\nconst handler = createSourceHandler<EventBridgeEvent<string, string>, HandlerParams>({\n name: \"handler-aws-event-bridge\",\n canUse: event => {\n return !!event.source;\n },\n handle: async ({ params, event, context }) => {\n return createHandler(params)(event, context);\n }\n});\n\nregistry.register(handler);\n"],"mappings":";;AACA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAMA,MAAMG,OAAO,GAAG,IAAAC,kCAAmB,EAAkD;EACjFC,IAAI,EAAE,0BAA0B;EAChCC,MAAM,EAAEC,KAAK,IAAI;IACb,OAAO,CAAC,CAACA,KAAK,CAACC,MAAM;EACzB,CAAC;EACDC,MAAM,EAAE,MAAAA,CAAO;IAAEC,MAAM;IAAEH,KAAK;IAAEI;EAAQ,CAAC,KAAK;IAC1C,OAAO,IAAAC,oBAAa,EAACF,MAAM,CAAC,CAACH,KAAK,EAAEI,OAAO,CAAC;EAChD;AACJ,CAAC,CAAC;AAEFE,kBAAQ,CAACC,QAAQ,CAACX,OAAO,CAAC","ignoreList":[]}
|
package/execute.d.ts
ADDED
package/execute.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.execute = void 0;
|
|
7
|
+
var _types = require("./types");
|
|
8
|
+
const createHandleResponse = (app, resolve) => {
|
|
9
|
+
return (err, result) => {
|
|
10
|
+
if (err) {
|
|
11
|
+
return resolve({
|
|
12
|
+
statusCode: 500,
|
|
13
|
+
body: JSON.stringify(err),
|
|
14
|
+
headers: {}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (app.__webiny_raw_result) {
|
|
18
|
+
return resolve(app.__webiny_raw_result);
|
|
19
|
+
} else if (!result) {
|
|
20
|
+
const response = {
|
|
21
|
+
statusCode: 200,
|
|
22
|
+
body: "",
|
|
23
|
+
headers: {},
|
|
24
|
+
isBase64Encoded: false
|
|
25
|
+
};
|
|
26
|
+
return resolve(response);
|
|
27
|
+
}
|
|
28
|
+
const isBase64Encoded = !!result.headers[_types.Base64EncodeHeader.encoded] || !!result.headers[_types.Base64EncodeHeader.binary];
|
|
29
|
+
const response = {
|
|
30
|
+
statusCode: result.statusCode,
|
|
31
|
+
body: isBase64Encoded ? result.rawPayload.toString("base64") : result.payload,
|
|
32
|
+
headers: result.headers,
|
|
33
|
+
isBase64Encoded
|
|
34
|
+
};
|
|
35
|
+
return resolve(response);
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const getPayloadProperty = (payload, prop, defaults = {}) => {
|
|
39
|
+
if (payload && typeof payload === "object") {
|
|
40
|
+
const value = payload[prop] ? payload[prop] : {};
|
|
41
|
+
return {
|
|
42
|
+
...defaults,
|
|
43
|
+
...value
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return defaults;
|
|
47
|
+
};
|
|
48
|
+
const execute = params => {
|
|
49
|
+
const {
|
|
50
|
+
app,
|
|
51
|
+
url,
|
|
52
|
+
payload
|
|
53
|
+
} = params;
|
|
54
|
+
const query = getPayloadProperty(payload, "query", {});
|
|
55
|
+
const headers = getPayloadProperty(payload, "headers", {
|
|
56
|
+
["content-type"]: "application/json"
|
|
57
|
+
});
|
|
58
|
+
const cookies = getPayloadProperty(payload, "cookies", {});
|
|
59
|
+
return new Promise(resolve => {
|
|
60
|
+
app.inject({
|
|
61
|
+
method: "POST",
|
|
62
|
+
url,
|
|
63
|
+
payload: payload || {},
|
|
64
|
+
body: payload || {},
|
|
65
|
+
query,
|
|
66
|
+
headers,
|
|
67
|
+
cookies
|
|
68
|
+
}, createHandleResponse(app, resolve));
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
exports.execute = execute;
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=execute.js.map
|
package/execute.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_types","require","createHandleResponse","app","resolve","err","result","statusCode","body","JSON","stringify","headers","__webiny_raw_result","response","isBase64Encoded","Base64EncodeHeader","encoded","binary","rawPayload","toString","payload","getPayloadProperty","prop","defaults","value","execute","params","url","query","cookies","Promise","inject","method","exports"],"sources":["execute.ts"],"sourcesContent":["import type { FastifyInstance } from \"@webiny/handler/types\";\nimport type { APIGatewayProxyResult } from \"@webiny/aws-sdk/types\";\nimport type { LightMyRequestCallback } from \"fastify\";\nimport { Base64EncodeHeader } from \"~/types\";\n\ninterface Resolve {\n (response: APIGatewayProxyResult | any): void;\n}\nconst createHandleResponse = (app: FastifyInstance, resolve: Resolve): LightMyRequestCallback => {\n return (err, result) => {\n if (err) {\n return resolve({\n statusCode: 500,\n body: JSON.stringify(err),\n headers: {}\n });\n }\n if (app.__webiny_raw_result) {\n return resolve(app.__webiny_raw_result);\n } else if (!result) {\n const response: APIGatewayProxyResult = {\n statusCode: 200,\n body: \"\",\n headers: {},\n isBase64Encoded: false\n };\n return resolve(response);\n }\n\n const isBase64Encoded =\n !!result.headers[Base64EncodeHeader.encoded] ||\n !!result.headers[Base64EncodeHeader.binary];\n const response: APIGatewayProxyResult = {\n statusCode: result.statusCode,\n body: isBase64Encoded ? result.rawPayload.toString(\"base64\") : result.payload,\n headers: result.headers as APIGatewayProxyResult[\"headers\"],\n isBase64Encoded\n };\n return resolve(response);\n };\n};\n\nconst getPayloadProperty = (\n payload: any,\n prop: string,\n defaults: Record<string, any> = {}\n): Record<string, any> => {\n if (payload && typeof payload === \"object\") {\n const value = payload[prop] ? payload[prop] : {};\n\n return {\n ...defaults,\n ...value\n };\n }\n return defaults;\n};\n\nexport interface ExecuteParams {\n app: FastifyInstance;\n url: string;\n payload: any;\n}\n\nexport const execute = (params: ExecuteParams): Promise<any> => {\n const { app, url, payload } = params;\n\n const query = getPayloadProperty(payload, \"query\", {});\n const headers = getPayloadProperty(payload, \"headers\", {\n [\"content-type\"]: \"application/json\"\n });\n\n const cookies = getPayloadProperty(payload, \"cookies\", {});\n\n return new Promise(resolve => {\n app.inject(\n {\n method: \"POST\",\n url,\n payload: payload || {},\n body: payload || {},\n query,\n headers,\n cookies\n },\n createHandleResponse(app, resolve)\n );\n });\n};\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,MAAMC,oBAAoB,GAAGA,CAACC,GAAoB,EAAEC,OAAgB,KAA6B;EAC7F,OAAO,CAACC,GAAG,EAAEC,MAAM,KAAK;IACpB,IAAID,GAAG,EAAE;MACL,OAAOD,OAAO,CAAC;QACXG,UAAU,EAAE,GAAG;QACfC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACL,GAAG,CAAC;QACzBM,OAAO,EAAE,CAAC;MACd,CAAC,CAAC;IACN;IACA,IAAIR,GAAG,CAACS,mBAAmB,EAAE;MACzB,OAAOR,OAAO,CAACD,GAAG,CAACS,mBAAmB,CAAC;IAC3C,CAAC,MAAM,IAAI,CAACN,MAAM,EAAE;MAChB,MAAMO,QAA+B,GAAG;QACpCN,UAAU,EAAE,GAAG;QACfC,IAAI,EAAE,EAAE;QACRG,OAAO,EAAE,CAAC,CAAC;QACXG,eAAe,EAAE;MACrB,CAAC;MACD,OAAOV,OAAO,CAACS,QAAQ,CAAC;IAC5B;IAEA,MAAMC,eAAe,GACjB,CAAC,CAACR,MAAM,CAACK,OAAO,CAACI,yBAAkB,CAACC,OAAO,CAAC,IAC5C,CAAC,CAACV,MAAM,CAACK,OAAO,CA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I,EAAEY,OAAO,IAAI,CAAC,CAAC;MACnBQ,KAAK;MACLjB,OAAO;MACPkB;IACJ,CAAC,EACD3B,oBAAoB,CAACC,GAAG,EAAEC,OAAO,CACrC,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAAC6B,OAAA,CAAAR,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { APIGatewayEvent, Context as LambdaContext } from "@webiny/aws-sdk/types";
|
|
2
|
+
import type { LambdaResponse } from "@fastify/aws-lambda";
|
|
3
|
+
import { createRoute, RoutePlugin } from "@webiny/handler";
|
|
4
|
+
import type { HandlerFactoryParams } from "../types";
|
|
5
|
+
export { RoutePlugin, createRoute };
|
|
6
|
+
export type HandlerParams = HandlerFactoryParams;
|
|
7
|
+
export interface HandlerCallable {
|
|
8
|
+
(event: APIGatewayEvent, ctx: LambdaContext): Promise<LambdaResponse>;
|
|
9
|
+
}
|
|
10
|
+
export declare const createHandler: (params: HandlerParams) => HandlerCallable;
|
package/gateway/index.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "RoutePlugin", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _handler.RoutePlugin;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
exports.createHandler = void 0;
|
|
14
|
+
Object.defineProperty(exports, "createRoute", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return _handler.createRoute;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var _awsLambda = _interopRequireDefault(require("@fastify/aws-lambda"));
|
|
21
|
+
var _handler = require("@webiny/handler");
|
|
22
|
+
var _plugins = require("../plugins");
|
|
23
|
+
var _types = require("../types");
|
|
24
|
+
const getHeader = (headers, header) => {
|
|
25
|
+
for (const key in headers) {
|
|
26
|
+
if (key.toLowerCase() !== header) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
return headers[key];
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
};
|
|
33
|
+
const defaultContentType = "application/json";
|
|
34
|
+
const defaultCharset = "utf-8";
|
|
35
|
+
/**
|
|
36
|
+
* We need to attach default headers to the request, so it does not break if there is none sent.
|
|
37
|
+
*/
|
|
38
|
+
const attachRequiredProperties = event => {
|
|
39
|
+
/**
|
|
40
|
+
* A possibility that headers are not defined?
|
|
41
|
+
* Maybe during testing?
|
|
42
|
+
*/
|
|
43
|
+
if (!event.headers) {
|
|
44
|
+
event.headers = {};
|
|
45
|
+
}
|
|
46
|
+
const contentType = getHeader(event.headers, "content-type");
|
|
47
|
+
/**
|
|
48
|
+
* We check the existing content type and add the default one if it does not exist.
|
|
49
|
+
*
|
|
50
|
+
* Also, if the content-type is the application/json, and the body is not sent, we add it.
|
|
51
|
+
*/
|
|
52
|
+
if (!contentType) {
|
|
53
|
+
event.headers["content-type"] = [defaultContentType, `charset=${defaultCharset}`].join(";");
|
|
54
|
+
event.body = "{}";
|
|
55
|
+
} else if (!event.body && contentType.startsWith(defaultContentType)) {
|
|
56
|
+
event.body = "{}";
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const createHandler = params => {
|
|
60
|
+
return async (event, context) => {
|
|
61
|
+
const app = (0, _handler.createHandler)({
|
|
62
|
+
...params,
|
|
63
|
+
options: {
|
|
64
|
+
logger: params.debug === true,
|
|
65
|
+
...(params.options || {})
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* We always must add our default plugins to the app.
|
|
70
|
+
*/
|
|
71
|
+
(0, _plugins.registerDefaultPlugins)(app.webiny);
|
|
72
|
+
if (app.webiny.plugins.byType(_handler.RoutePlugin.type).length === 0) {
|
|
73
|
+
throw new Error(`To run @webiny/handler-aws/gateway, you must have at least one RoutePlugin set.`);
|
|
74
|
+
}
|
|
75
|
+
attachRequiredProperties(event);
|
|
76
|
+
const appLambda = (0, _awsLambda.default)(app, {
|
|
77
|
+
decorateRequest: true,
|
|
78
|
+
serializeLambdaArguments: true,
|
|
79
|
+
decorationPropertyName: "awsLambda",
|
|
80
|
+
enforceBase64: response => {
|
|
81
|
+
return !!response.headers[_types.Base64EncodeHeader.encoded] || !!response.headers[_types.Base64EncodeHeader.binary];
|
|
82
|
+
},
|
|
83
|
+
...(params.lambdaOptions || {})
|
|
84
|
+
});
|
|
85
|
+
return appLambda(event, context);
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
exports.createHandler = createHandler;
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_awsLambda","_interopRequireDefault","require","_handler","_plugins","_types","getHeader","headers","header","key","toLowerCase","undefined","defaultContentType","defaultCharset","attachRequiredProperties","event","contentType","join","body","startsWith","createHandler","params","context","app","createBaseHandler","options","logger","debug","registerDefaultPlugins","webiny","plugins","byType","RoutePlugin","type","length","Error","appLambda","awsLambdaFastify","decorateRequest","serializeLambdaArguments","decorationPropertyName","enforceBase64","response","Base64EncodeHeader","encoded","binary","lambdaOptions","exports"],"sources":["index.ts"],"sourcesContent":["import type {\n APIGatewayEvent,\n APIGatewayProxyEventHeaders,\n Context as LambdaContext\n} from \"@webiny/aws-sdk/types\";\nimport type { LambdaResponse } from \"@fastify/aws-lambda\";\nimport awsLambdaFastify from \"@fastify/aws-lambda\";\nimport { createHandler as createBaseHandler, createRoute, RoutePlugin } from \"@webiny/handler\";\nimport { registerDefaultPlugins } from \"~/plugins\";\nimport type { HandlerFactoryParams } from \"~/types\";\nimport { Base64EncodeHeader } from \"~/types\";\n\nexport { RoutePlugin, createRoute };\n\nexport type HandlerParams = HandlerFactoryParams;\n\nexport interface HandlerCallable {\n (event: APIGatewayEvent, ctx: LambdaContext): Promise<LambdaResponse>;\n}\n\nconst getHeader = (headers: APIGatewayProxyEventHeaders, header: string): string | undefined => {\n for (const key in headers) {\n if (key.toLowerCase() !== header) {\n continue;\n }\n return headers[key];\n }\n return undefined;\n};\n\nconst defaultContentType = \"application/json\";\nconst defaultCharset = \"utf-8\";\n/**\n * We need to attach default headers to the request, so it does not break if there is none sent.\n */\nconst attachRequiredProperties = (event: APIGatewayEvent): void => {\n /**\n * A possibility that headers are not defined?\n * Maybe during testing?\n */\n if (!event.headers) {\n event.headers = {};\n }\n const contentType = getHeader(event.headers, \"content-type\");\n /**\n * We check the existing content type and add the default one if it does not exist.\n *\n * Also, if the content-type is the application/json, and the body is not sent, we add it.\n */\n if (!contentType) {\n event.headers[\"content-type\"] = [defaultContentType, `charset=${defaultCharset}`].join(\";\");\n event.body = \"{}\";\n } else if (!event.body && contentType.startsWith(defaultContentType)) {\n event.body = \"{}\";\n }\n};\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 if (app.webiny.plugins.byType<RoutePlugin>(RoutePlugin.type).length === 0) {\n throw new Error(\n `To run @webiny/handler-aws/gateway, you must have at least one RoutePlugin set.`\n );\n }\n attachRequiredProperties(event);\n\n const appLambda = awsLambdaFastify(app, {\n decorateRequest: true,\n serializeLambdaArguments: true,\n decorationPropertyName: \"awsLambda\",\n enforceBase64: response => {\n return (\n !!response.headers[Base64EncodeHeader.encoded] ||\n !!response.headers[Base64EncodeHeader.binary]\n );\n },\n ...(params.lambdaOptions || {})\n });\n return appLambda(event, context);\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAMA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,Q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