@webiny/handler-aws 6.0.0-alpha.5 → 6.0.0-rc.0
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/README.md +10 -14
- package/createHandler.d.ts +1 -1
- package/createHandler.js +12 -12
- package/createHandler.js.map +1 -1
- package/dynamodb/index.d.ts +3 -3
- package/dynamodb/index.js +14 -36
- package/dynamodb/index.js.map +1 -1
- package/dynamodb/plugins/DynamoDBEventHandler.d.ts +4 -4
- package/dynamodb/plugins/DynamoDBEventHandler.js +3 -11
- package/dynamodb/plugins/DynamoDBEventHandler.js.map +1 -1
- package/dynamodb/register.js +6 -8
- package/dynamodb/register.js.map +1 -1
- package/eventBridge/index.d.ts +3 -3
- package/eventBridge/index.js +14 -36
- package/eventBridge/index.js.map +1 -1
- package/eventBridge/plugins/EventBridgeEventHandler.d.ts +4 -4
- package/eventBridge/plugins/EventBridgeEventHandler.js +3 -11
- package/eventBridge/plugins/EventBridgeEventHandler.js.map +1 -1
- package/eventBridge/register.d.ts +1 -1
- package/eventBridge/register.js +6 -8
- package/eventBridge/register.js.map +1 -1
- package/execute.d.ts +1 -1
- package/execute.js +3 -10
- package/execute.js.map +1 -1
- package/gateway/index.d.ts +2 -2
- package/gateway/index.js +16 -30
- package/gateway/index.js.map +1 -1
- package/gateway/register.js +6 -8
- package/gateway/register.js.map +1 -1
- package/index.d.ts +17 -17
- package/index.js +45 -371
- package/index.js.map +1 -1
- package/package.json +15 -16
- package/plugins/handlerClient.js +6 -13
- package/plugins/handlerClient.js.map +1 -1
- package/plugins/index.d.ts +1 -1
- package/plugins/index.js +3 -10
- package/plugins/index.js.map +1 -1
- package/raw/index.d.ts +3 -3
- package/raw/index.js +14 -33
- package/raw/index.js.map +1 -1
- package/raw/plugins/RawEventHandler.d.ts +3 -3
- package/raw/plugins/RawEventHandler.js +3 -11
- package/raw/plugins/RawEventHandler.js.map +1 -1
- package/registry.d.ts +2 -2
- package/registry.js +1 -7
- package/registry.js.map +1 -1
- package/s3/index.d.ts +3 -3
- package/s3/index.js +14 -36
- package/s3/index.js.map +1 -1
- package/s3/plugins/S3EventHandler.d.ts +4 -4
- package/s3/plugins/S3EventHandler.js +3 -11
- package/s3/plugins/S3EventHandler.js.map +1 -1
- package/s3/register.d.ts +1 -1
- package/s3/register.js +6 -8
- package/s3/register.js.map +1 -1
- package/sns/index.d.ts +3 -3
- package/sns/index.js +14 -36
- package/sns/index.js.map +1 -1
- package/sns/plugins/SNSEventHandler.d.ts +4 -4
- package/sns/plugins/SNSEventHandler.js +3 -11
- package/sns/plugins/SNSEventHandler.js.map +1 -1
- package/sns/register.js +6 -8
- package/sns/register.js.map +1 -1
- package/sourceHandler.d.ts +2 -2
- package/sourceHandler.js +1 -8
- package/sourceHandler.js.map +1 -1
- package/sqs/index.d.ts +3 -3
- package/sqs/index.js +14 -36
- package/sqs/index.js.map +1 -1
- package/sqs/plugins/SQSEventHandler.d.ts +4 -4
- package/sqs/plugins/SQSEventHandler.js +3 -11
- package/sqs/plugins/SQSEventHandler.js.map +1 -1
- package/sqs/register.js +6 -8
- package/sqs/register.js.map +1 -1
- package/types.d.ts +3 -3
- package/types.js +3 -31
- package/types.js.map +1 -1
- package/utils/composedHandler.d.ts +1 -1
- package/utils/composedHandler.js +3 -10
- package/utils/composedHandler.js.map +1 -1
- package/utils/index.d.ts +2 -2
- package/utils/index.js +2 -27
- package/utils/index.js.map +1 -1
- package/utils/timer/CustomTimer.js +1 -8
- package/utils/timer/CustomTimer.js.map +1 -1
- package/utils/timer/Timer.d.ts +1 -1
- package/utils/timer/Timer.js +1 -8
- package/utils/timer/Timer.js.map +1 -1
- package/utils/timer/abstractions/ITimer.js +1 -5
- package/utils/timer/factory.d.ts +2 -2
- package/utils/timer/factory.js +5 -12
- package/utils/timer/factory.js.map +1 -1
- package/utils/timer/index.d.ts +4 -4
- package/utils/timer/index.js +3 -49
- package/utils/timer/index.js.map +1 -1
package/execute.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Base64EncodeHeader","createHandleResponse","app","resolve","err","result","statusCode","body","JSON","stringify","headers","__webiny_raw_result","response","isBase64Encoded","encoded","binary","rawPayload","toString","payload","getPayloadProperty","prop","defaults","value","execute","params","url","query","cookies","Promise","inject","method"],"sources":["execute.ts"],"sourcesContent":["import type { FastifyInstance } from \"@webiny/handler/types.js\";\nimport type { APIGatewayProxyResult } from \"@webiny/aws-sdk/types/index.js\";\nimport type { LightMyRequestCallback } from \"fastify\";\nimport { Base64EncodeHeader } from \"~/types.js\";\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,SAASA,kBAAkB;AAK3B,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,CAACV,kBAAkB,CAACc,OAAO,CAAC,IAC5C,CAAC,CAACT,MAAM,CAACK,OAAO,CAACV,kBAAkB,CAACe,MAAM,CAAC;IAC/C,MAAMH,QAA+B,GAAG;MACpCN,UAAU,EAAED,MAAM,CAACC,UAAU;MAC7BC,IAAI,EAAEM,eAAe,GAAGR,MAAM,CAACW,UAAU,CAACC,QAAQ,CAAC,QAAQ,CAAC,GAAGZ,MAAM,CAACa,OAAO;MAC7ER,OAAO,EAAEL,MAAM,CAACK,OAA2C;MAC3DG;IACJ,CAAC;IACD,OAAOV,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/types";
|
|
1
|
+
import type { APIGatewayEvent, Context as LambdaContext } from "@webiny/aws-sdk/types/index.js";
|
|
2
2
|
import type { LambdaResponse } from "@fastify/aws-lambda";
|
|
3
3
|
import { createRoute, RoutePlugin } from "@webiny/handler";
|
|
4
|
-
import type { HandlerFactoryParams } from "../types";
|
|
4
|
+
import type { HandlerFactoryParams } from "../types.js";
|
|
5
5
|
export { RoutePlugin, createRoute };
|
|
6
6
|
export type HandlerParams = HandlerFactoryParams;
|
|
7
7
|
export interface HandlerCallable {
|
package/gateway/index.js
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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");
|
|
1
|
+
import awsLambdaFastify from "@fastify/aws-lambda";
|
|
2
|
+
import { createHandler as createBaseHandler, createRoute, RoutePlugin } from "@webiny/handler";
|
|
3
|
+
import { registerDefaultPlugins } from "../plugins/index.js";
|
|
4
|
+
import { Base64EncodeHeader } from "../types.js";
|
|
5
|
+
export { RoutePlugin, createRoute };
|
|
24
6
|
const getHeader = (headers, header) => {
|
|
25
7
|
for (const key in headers) {
|
|
26
8
|
if (key.toLowerCase() !== header) {
|
|
@@ -36,6 +18,7 @@ const defaultCharset = "utf-8";
|
|
|
36
18
|
* We need to attach default headers to the request, so it does not break if there is none sent.
|
|
37
19
|
*/
|
|
38
20
|
const attachRequiredProperties = event => {
|
|
21
|
+
const isOptions = event.httpMethod.toLowerCase() === "options";
|
|
39
22
|
/**
|
|
40
23
|
* A possibility that headers are not defined?
|
|
41
24
|
* Maybe during testing?
|
|
@@ -55,10 +38,14 @@ const attachRequiredProperties = event => {
|
|
|
55
38
|
} else if (!event.body && contentType.startsWith(defaultContentType)) {
|
|
56
39
|
event.body = "{}";
|
|
57
40
|
}
|
|
41
|
+
if (!isOptions) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
event.body = null;
|
|
58
45
|
};
|
|
59
|
-
const createHandler = params => {
|
|
46
|
+
export const createHandler = params => {
|
|
60
47
|
return async (event, context) => {
|
|
61
|
-
const app = (
|
|
48
|
+
const app = createBaseHandler({
|
|
62
49
|
...params,
|
|
63
50
|
options: {
|
|
64
51
|
logger: params.debug === true,
|
|
@@ -68,23 +55,22 @@ const createHandler = params => {
|
|
|
68
55
|
/**
|
|
69
56
|
* We always must add our default plugins to the app.
|
|
70
57
|
*/
|
|
71
|
-
|
|
72
|
-
if (app.webiny.plugins.byType(
|
|
58
|
+
registerDefaultPlugins(app.webiny);
|
|
59
|
+
if (app.webiny.plugins.byType(RoutePlugin.type).length === 0) {
|
|
73
60
|
throw new Error(`To run @webiny/handler-aws/gateway, you must have at least one RoutePlugin set.`);
|
|
74
61
|
}
|
|
75
62
|
attachRequiredProperties(event);
|
|
76
|
-
const appLambda = (
|
|
63
|
+
const appLambda = awsLambdaFastify(app, {
|
|
77
64
|
decorateRequest: true,
|
|
78
65
|
serializeLambdaArguments: true,
|
|
79
66
|
decorationPropertyName: "awsLambda",
|
|
80
67
|
enforceBase64: response => {
|
|
81
|
-
return !!response.headers[
|
|
68
|
+
return !!response.headers[Base64EncodeHeader.encoded] || !!response.headers[Base64EncodeHeader.binary];
|
|
82
69
|
},
|
|
83
70
|
...(params.lambdaOptions || {})
|
|
84
71
|
});
|
|
85
72
|
return appLambda(event, context);
|
|
86
73
|
};
|
|
87
74
|
};
|
|
88
|
-
exports.createHandler = createHandler;
|
|
89
75
|
|
|
90
76
|
//# sourceMappingURL=index.js.map
|
package/gateway/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["awsLambdaFastify","createHandler","createBaseHandler","createRoute","RoutePlugin","registerDefaultPlugins","Base64EncodeHeader","getHeader","headers","header","key","toLowerCase","undefined","defaultContentType","defaultCharset","attachRequiredProperties","event","isOptions","httpMethod","contentType","join","body","startsWith","params","context","app","options","logger","debug","webiny","plugins","byType","type","length","Error","appLambda","decorateRequest","serializeLambdaArguments","decorationPropertyName","enforceBase64","response","encoded","binary","lambdaOptions"],"sources":["index.ts"],"sourcesContent":["import type {\n APIGatewayEvent,\n APIGatewayProxyEventHeaders,\n Context as LambdaContext\n} from \"@webiny/aws-sdk/types/index.js\";\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/index.js\";\nimport type { HandlerFactoryParams } from \"~/types.js\";\nimport { Base64EncodeHeader } from \"~/types.js\";\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 const isOptions = event.httpMethod.toLowerCase() === \"options\";\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 if (!isOptions) {\n return;\n }\n event.body = null;\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,OAAOA,gBAAgB,MAAM,qBAAqB;AAClD,SAASC,aAAa,IAAIC,iBAAiB,EAAEC,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC9F,SAASC,sBAAsB;AAE/B,SAASC,kBAAkB;AAE3B,SAASF,WAAW,EAAED,WAAW;AAQjC,MAAMI,SAAS,GAAGA,CAACC,OAAoC,EAAEC,MAAc,KAAyB;EAC5F,KAAK,MAAMC,GAAG,IAAIF,OAAO,EAAE;IACvB,IAAIE,GAAG,CAACC,WAAW,CAAC,CAAC,KAAKF,MAAM,EAAE;MAC9B;IACJ;IACA,OAAOD,OAA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BAAsB,CAACoB,GAAG,CAACI,MAAM,CAAC;IAElC,IAAIJ,GAAG,CAACI,MAAM,CAACC,OAAO,CAACC,MAAM,CAAc3B,WAAW,CAAC4B,IAAI,CAAC,CAACC,MAAM,KAAK,CAAC,EAAE;MACvE,MAAM,IAAIC,KAAK,CACX,iFACJ,CAAC;IACL;IACAnB,wBAAwB,CAACC,KAAK,CAAC;IAE/B,MAAMmB,SAAS,GAAGnC,gBAAgB,CAACyB,GAAG,EAAE;MACpCW,eAAe,EAAE,IAAI;MACrBC,wBAAwB,EAAE,IAAI;MAC9BC,sBAAsB,EAAE,WAAW;MACnCC,aAAa,EAAEC,QAAQ,IAAI;QACvB,OACI,CAAC,CAACA,QAAQ,CAAChC,OAAO,CAACF,kBAAkB,CAACmC,OAAO,CAAC,IAC9C,CAAC,CAACD,QAAQ,CAAChC,OAAO,CAACF,kBAAkB,CAACoC,MAAM,CAAC;MAErD,CAAC;MACD,IAAInB,MAAM,CAACoB,aAAa,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC;IACF,OAAOR,SAAS,CAACnB,KAAK,EAAEQ,OAAO,CAAC;EACpC,CAAC;AACL,CAAC","ignoreList":[]}
|
package/gateway/register.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _index = require("./index");
|
|
6
|
-
const handler = (0, _sourceHandler.createSourceHandler)({
|
|
1
|
+
import { registry } from "../registry.js";
|
|
2
|
+
import { createSourceHandler } from "../sourceHandler.js";
|
|
3
|
+
import { createHandler } from "./index.js";
|
|
4
|
+
const handler = createSourceHandler({
|
|
7
5
|
name: "handler-aws-api-gateway",
|
|
8
6
|
canUse: event => {
|
|
9
7
|
return !!event.httpMethod;
|
|
@@ -13,9 +11,9 @@ const handler = (0, _sourceHandler.createSourceHandler)({
|
|
|
13
11
|
event,
|
|
14
12
|
context
|
|
15
13
|
}) => {
|
|
16
|
-
return
|
|
14
|
+
return createHandler(params)(event, context);
|
|
17
15
|
}
|
|
18
16
|
});
|
|
19
|
-
|
|
17
|
+
registry.register(handler);
|
|
20
18
|
|
|
21
19
|
//# sourceMappingURL=register.js.map
|
package/gateway/register.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["registry","createSourceHandler","createHandler","handler","name","canUse","event","httpMethod","handle","params","context","register"],"sources":["register.ts"],"sourcesContent":["import type { APIGatewayEvent } from \"@webiny/aws-sdk/types/index.js\";\nimport { registry } from \"~/registry.js\";\nimport { createSourceHandler } from \"~/sourceHandler.js\";\nimport type { HandlerParams } from \"./index.js\";\nimport { createHandler } from \"./index.js\";\n\nconst handler = createSourceHandler<APIGatewayEvent, HandlerParams>({\n name: \"handler-aws-api-gateway\",\n canUse: event => {\n return !!event.httpMethod;\n },\n handle: async ({ params, event, context }) => {\n return createHandler(params)(event, context);\n }\n});\n\nregistry.register(handler);\n"],"mappings":"AACA,SAASA,QAAQ;AACjB,SAASC,mBAAmB;AAE5B,SAASC,aAAa;AAEtB,MAAMC,OAAO,GAAGF,mBAAmB,CAAiC;EAChEG,IAAI,EAAE,yBAAyB;EAC/BC,MAAM,EAAEC,KAAK,IAAI;IACb,OAAO,CAAC,CAACA,KAAK,CAACC,UAAU;EAC7B,CAAC;EACDC,MAAM,EAAE,MAAAA,CAAO;IAAEC,MAAM;IAAEH,KAAK;IAAEI;EAAQ,CAAC,KAAK;IAC1C,OAAOR,aAAa,CAACO,MAAM,CAAC,CAACH,KAAK,EAAEI,OAAO,CAAC;EAChD;AACJ,CAAC,CAAC;AAEFV,QAAQ,CAACW,QAAQ,CAACR,OAAO,CAAC","ignoreList":[]}
|
package/index.d.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import "./gateway/register";
|
|
2
|
-
import "./s3/register";
|
|
3
|
-
import "./dynamodb/register";
|
|
4
|
-
import "./sqs/register";
|
|
5
|
-
import "./eventBridge/register";
|
|
6
|
-
import "./sns/register";
|
|
7
|
-
export * from "./utils";
|
|
1
|
+
import "./gateway/register.js";
|
|
2
|
+
import "./s3/register.js";
|
|
3
|
+
import "./dynamodb/register.js";
|
|
4
|
+
import "./sqs/register.js";
|
|
5
|
+
import "./eventBridge/register.js";
|
|
6
|
+
import "./sns/register.js";
|
|
7
|
+
export * from "./utils/index.js";
|
|
8
8
|
/**
|
|
9
9
|
* API Gateway
|
|
10
10
|
*/
|
|
11
|
-
export { createHandler as createApiGatewayHandler, HandlerParams as CreateApiGatewayHandlerParams, HandlerCallable as ApiGatewayHandlerCallable, RoutePlugin, createRoute as createApiGatewayRoute } from "./gateway";
|
|
11
|
+
export { createHandler as createApiGatewayHandler, type HandlerParams as CreateApiGatewayHandlerParams, type HandlerCallable as ApiGatewayHandlerCallable, RoutePlugin, createRoute as createApiGatewayRoute } from "./gateway/index.js";
|
|
12
12
|
/**
|
|
13
13
|
* S3
|
|
14
14
|
*/
|
|
15
|
-
export { createHandler as createS3Handler, HandlerParams as CreateS3HandlerParams, S3EventHandler, S3EventHandlerCallable, S3EventHandlerCallableParams, createEventHandler as createS3EventHandler } from "./s3";
|
|
15
|
+
export { createHandler as createS3Handler, type HandlerParams as CreateS3HandlerParams, S3EventHandler, type S3EventHandlerCallable, type S3EventHandlerCallableParams, createEventHandler as createS3EventHandler } from "./s3/index.js";
|
|
16
16
|
/**
|
|
17
17
|
* DynamoDB Stream
|
|
18
18
|
*/
|
|
19
|
-
export { createHandler as createDynamoDBHandler, HandlerParams as CreateDynamoDBHandlerParams, DynamoDBEventHandler, DynamoDBEventHandlerCallable, DynamoDBEventHandlerCallableParams, createEventHandler as createDynamoDBEventHandler } from "./dynamodb";
|
|
19
|
+
export { createHandler as createDynamoDBHandler, type HandlerParams as CreateDynamoDBHandlerParams, DynamoDBEventHandler, type DynamoDBEventHandlerCallable, type DynamoDBEventHandlerCallableParams, createEventHandler as createDynamoDBEventHandler } from "./dynamodb/index.js";
|
|
20
20
|
/**
|
|
21
21
|
* SQS
|
|
22
22
|
*/
|
|
23
|
-
export { createHandler as createSQSHandler, HandlerParams as CreateSQSHandlerParams, SQSEventHandler, SQSEventHandlerCallable, SQSEventHandlerCallableParams, createEventHandler as createSQSEventHandler } from "./sqs";
|
|
23
|
+
export { createHandler as createSQSHandler, type HandlerParams as CreateSQSHandlerParams, SQSEventHandler, type SQSEventHandlerCallable, type SQSEventHandlerCallableParams, createEventHandler as createSQSEventHandler } from "./sqs/index.js";
|
|
24
24
|
/**
|
|
25
25
|
* SNS
|
|
26
26
|
*/
|
|
27
|
-
export { createHandler as createSNSHandler, HandlerParams as CreateSNSHandlerParams, SNSEventHandler, SNSEventHandlerCallable, SNSEventHandlerCallableParams, createEventHandler as createSNSEventHandler } from "./sns";
|
|
27
|
+
export { createHandler as createSNSHandler, type HandlerParams as CreateSNSHandlerParams, SNSEventHandler, type SNSEventHandlerCallable, type SNSEventHandlerCallableParams, createEventHandler as createSNSEventHandler } from "./sns/index.js";
|
|
28
28
|
/**
|
|
29
29
|
* EventBridge
|
|
30
30
|
*/
|
|
31
|
-
export { createHandler as createEventBridgeHandler, HandlerParams as CreateEventBridgeHandlerParams, EventBridgeEventHandler, EventBridgeEventHandlerCallable, EventBridgeEventHandlerCallableParams, createEventHandler as createEventBridgeEventHandler } from "./eventBridge";
|
|
32
|
-
export { createHandler as createRawHandler, CreateHandlerParams as CreateRawHandlerParams, HandlerCallable as RawHandlerCallable, createEventHandler as createRawEventHandler, RawEventHandlerCallableParams, RawEventHandlerCallable, RawEventHandler } from "./raw";
|
|
33
|
-
export { ContextPlugin, createContextPlugin, ContextPluginCallable } from "@webiny/handler";
|
|
34
|
-
export * from "./createHandler";
|
|
35
|
-
export * from "./sourceHandler";
|
|
31
|
+
export { createHandler as createEventBridgeHandler, type HandlerParams as CreateEventBridgeHandlerParams, EventBridgeEventHandler, type EventBridgeEventHandlerCallable, type EventBridgeEventHandlerCallableParams, createEventHandler as createEventBridgeEventHandler } from "./eventBridge/index.js";
|
|
32
|
+
export { createHandler as createRawHandler, type CreateHandlerParams as CreateRawHandlerParams, type HandlerCallable as RawHandlerCallable, createEventHandler as createRawEventHandler, type RawEventHandlerCallableParams, type RawEventHandlerCallable, RawEventHandler } from "./raw/index.js";
|
|
33
|
+
export { ContextPlugin, createContextPlugin, type ContextPluginCallable } from "@webiny/handler";
|
|
34
|
+
export * from "./createHandler.js";
|
|
35
|
+
export * from "./sourceHandler.js";
|