@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.
- package/README.md +10 -14
- package/createHandler.d.ts +2 -0
- package/createHandler.js +23 -0
- package/createHandler.js.map +1 -0
- package/dynamodb/index.d.ts +5 -8
- package/dynamodb/index.js +41 -87
- package/dynamodb/index.js.map +1 -1
- package/dynamodb/plugins/DynamoDBEventHandler.d.ts +8 -7
- package/dynamodb/plugins/DynamoDBEventHandler.js +12 -28
- package/dynamodb/plugins/DynamoDBEventHandler.js.map +1 -1
- package/dynamodb/register.d.ts +1 -0
- package/dynamodb/register.js +16 -0
- package/dynamodb/register.js.map +1 -0
- package/eventBridge/index.d.ts +7 -10
- package/eventBridge/index.js +42 -88
- package/eventBridge/index.js.map +1 -1
- package/eventBridge/plugins/EventBridgeEventHandler.d.ts +8 -7
- package/eventBridge/plugins/EventBridgeEventHandler.js +12 -28
- package/eventBridge/plugins/EventBridgeEventHandler.js.map +1 -1
- package/eventBridge/register.d.ts +4 -0
- package/eventBridge/register.js +11 -0
- package/eventBridge/register.js.map +1 -0
- package/execute.d.ts +1 -1
- package/execute.js +54 -67
- package/execute.js.map +1 -1
- package/gateway/index.d.ts +7 -11
- package/gateway/index.js +43 -102
- package/gateway/index.js.map +1 -1
- package/gateway/register.d.ts +1 -0
- package/gateway/register.js +11 -0
- package/gateway/register.js.map +1 -0
- package/index.d.ts +35 -6
- package/index.js +17 -245
- package/package.json +22 -25
- package/plugins/index.d.ts +1 -1
- package/plugins/index.js +4 -12
- package/plugins/index.js.map +1 -1
- package/raw/index.d.ts +5 -10
- package/raw/index.js +44 -95
- package/raw/index.js.map +1 -1
- package/raw/plugins/RawEventHandler.d.ts +17 -6
- package/raw/plugins/RawEventHandler.js +14 -21
- package/raw/plugins/RawEventHandler.js.map +1 -1
- package/registry.d.ts +17 -0
- package/registry.js +23 -0
- package/registry.js.map +1 -0
- package/s3/index.d.ts +6 -9
- package/s3/index.js +41 -87
- package/s3/index.js.map +1 -1
- package/s3/plugins/S3EventHandler.d.ts +8 -7
- package/s3/plugins/S3EventHandler.js +12 -28
- package/s3/plugins/S3EventHandler.js.map +1 -1
- package/s3/register.d.ts +4 -0
- package/s3/register.js +15 -0
- package/s3/register.js.map +1 -0
- package/sns/index.d.ts +8 -0
- package/sns/index.js +42 -0
- package/sns/index.js.map +1 -0
- package/sns/plugins/SNSEventHandler.d.ts +20 -0
- package/sns/plugins/SNSEventHandler.js +14 -0
- package/sns/plugins/SNSEventHandler.js.map +1 -0
- package/sns/register.d.ts +1 -0
- package/sns/register.js +15 -0
- package/sns/register.js.map +1 -0
- package/sourceHandler.d.ts +2 -0
- package/sourceHandler.js +4 -0
- package/sourceHandler.js.map +1 -0
- package/sqs/index.d.ts +6 -9
- package/sqs/index.js +42 -87
- package/sqs/index.js.map +1 -1
- package/sqs/plugins/SQSEventHandler.d.ts +8 -7
- package/sqs/plugins/SQSEventHandler.js +12 -28
- package/sqs/plugins/SQSEventHandler.js.map +1 -1
- package/sqs/register.d.ts +1 -0
- package/sqs/register.js +16 -0
- package/sqs/register.js.map +1 -0
- package/types.d.ts +28 -5
- package/types.js +10 -32
- package/types.js.map +1 -1
- package/utils/composedHandler.d.ts +6 -0
- package/utils/composedHandler.js +8 -0
- package/utils/composedHandler.js.map +1 -0
- package/utils/index.d.ts +2 -0
- package/utils/index.js +2 -0
- package/utils/timer/CustomTimer.d.ts +5 -0
- package/utils/timer/CustomTimer.js +13 -0
- package/utils/timer/CustomTimer.js.map +1 -0
- package/utils/timer/Timer.d.ts +10 -0
- package/utils/timer/Timer.js +16 -0
- package/utils/timer/Timer.js.map +1 -0
- package/utils/timer/abstractions/ITimer.d.ts +10 -0
- package/utils/timer/abstractions/ITimer.js +0 -0
- package/utils/timer/factory.d.ts +4 -0
- package/utils/timer/factory.js +12 -0
- package/utils/timer/factory.js.map +1 -0
- package/utils/timer/index.d.ts +4 -0
- package/utils/timer/index.js +3 -0
- package/index.js.map +0 -1
- package/plugins/handlerClient.d.ts +0 -2
- package/plugins/handlerClient.js +0 -62
- package/plugins/handlerClient.js.map +0 -1
package/sqs/index.js
CHANGED
|
@@ -1,88 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 _SQSEventHandler = require("./plugins/SQSEventHandler");
|
|
18
|
-
|
|
19
|
-
Object.keys(_SQSEventHandler).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] === _SQSEventHandler[key]) return;
|
|
23
|
-
Object.defineProperty(exports, key, {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
get: function () {
|
|
26
|
-
return _SQSEventHandler[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 { SQSEventHandler } from "./plugins/SQSEventHandler.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/SQSEventHandler.js";
|
|
37
8
|
const url = "/webiny-sqs-event";
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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 sqs_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(SQSEventHandler.type).reverse();
|
|
19
|
+
if (0 === plugins.length) throw new Error("To run @webiny/handler-aws/sqs, you must have SQSEventHandler 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
|
+
if (!reply.sent) reply.send({});
|
|
33
|
+
return reply;
|
|
34
|
+
});
|
|
35
|
+
return execute({
|
|
36
|
+
app,
|
|
37
|
+
url: url,
|
|
38
|
+
payload: event
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
export { sqs_createHandler as createHandler };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
package/sqs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"sqs/index.js","sources":["../../src/sqs/index.ts"],"sourcesContent":["import type {\n APIGatewayProxyResult,\n Context as LambdaContext,\n SQSEvent\n} from \"@webiny/aws-sdk/types/index.js\";\nimport { createHandler as createBaseHandler } from \"@webiny/handler\";\nimport { registerDefaultPlugins } from \"~/plugins/index.js\";\nimport type { SQSEventHandlerCallableParams } from \"~/sqs/plugins/SQSEventHandler.js\";\nimport { SQSEventHandler } from \"~/sqs/plugins/SQSEventHandler.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/SQSEventHandler.js\";\n\nexport interface HandlerCallable {\n (event: SQSEvent, context: LambdaContext): Promise<APIGatewayProxyResult>;\n}\n\nexport type HandlerParams = HandlerFactoryParams;\n\nconst url = \"/webiny-sqs-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<SQSEventHandler>(SQSEventHandler.type).reverse();\n if (plugins.length === 0) {\n throw new Error(`To run @webiny/handler-aws/sqs, you must have SQSEventHandler set.`);\n }\n\n const handler = createComposedHandler<\n SQSEventHandler,\n SQSEventHandlerCallableParams<APIGatewayProxyResult>,\n APIGatewayProxyResult\n >(plugins);\n\n app.post(url, async (request, reply) => {\n const params: Omit<SQSEventHandlerCallableParams<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 SQSEventHandlerCallableParams<APIGatewayProxyResult>\n );\n\n if (result instanceof Reply) {\n return result;\n }\n\n app.__webiny_raw_result = result;\n if (!reply.sent) {\n reply.send({});\n }\n return reply;\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","SQSEventHandler","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,IAAI,CAACD,MAAM,IAAI,EACXA,MAAM,IAAI,CAAC,CAAC;YAEhB,OAAOA;QACX;QACA,OAAOG,QAAQ;YACXZ;YACAL,KAAAA;YACA,SAASG;QACb;IACJ"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export interface SQSEventHandlerCallableParams {
|
|
1
|
+
import type { Context as LambdaContext, SQSEvent } 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 SQSEventHandlerCallableParams<Response = Reply> {
|
|
5
5
|
request: Request;
|
|
6
6
|
reply: Reply;
|
|
7
7
|
context: Context;
|
|
8
8
|
event: SQSEvent;
|
|
9
9
|
lambdaContext: LambdaContext;
|
|
10
|
+
next: () => Promise<Response>;
|
|
10
11
|
}
|
|
11
|
-
export interface SQSEventHandlerCallable<Response> {
|
|
12
|
-
(params: SQSEventHandlerCallableParams): Promise<Response
|
|
12
|
+
export interface SQSEventHandlerCallable<Response = Reply> {
|
|
13
|
+
(params: SQSEventHandlerCallableParams<Response>): Promise<Response>;
|
|
13
14
|
}
|
|
14
15
|
export declare class SQSEventHandler<Response = any> extends Plugin {
|
|
15
16
|
static type: string;
|
|
16
17
|
readonly cb: SQSEventHandlerCallable<Response>;
|
|
17
18
|
constructor(cb: SQSEventHandlerCallable<Response>);
|
|
18
19
|
}
|
|
19
|
-
export declare const createEventHandler: <
|
|
20
|
+
export declare const createEventHandler: <Response>(cb: SQSEventHandlerCallable<Response>) => SQSEventHandler<Response>;
|
|
@@ -1,30 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _Plugin = require("@webiny/plugins/Plugin");
|
|
13
|
-
|
|
14
|
-
class SQSEventHandler 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 SQSEventHandler extends Plugin {
|
|
3
|
+
static{
|
|
4
|
+
this.type = "handler.fastify.aws.sqs.eventHandler";
|
|
5
|
+
}
|
|
6
|
+
constructor(cb){
|
|
7
|
+
super();
|
|
8
|
+
this.cb = cb;
|
|
9
|
+
}
|
|
21
10
|
}
|
|
11
|
+
const createEventHandler = (cb)=>new SQSEventHandler(cb);
|
|
12
|
+
export { SQSEventHandler, createEventHandler };
|
|
22
13
|
|
|
23
|
-
|
|
24
|
-
(0, _defineProperty2.default)(SQSEventHandler, "type", "handler.fastify.aws.sqs.eventHandler");
|
|
25
|
-
|
|
26
|
-
const createEventHandler = cb => {
|
|
27
|
-
return new SQSEventHandler(cb);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
exports.createEventHandler = createEventHandler;
|
|
14
|
+
//# sourceMappingURL=SQSEventHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"sqs/plugins/SQSEventHandler.js","sources":["../../../src/sqs/plugins/SQSEventHandler.ts"],"sourcesContent":["import type { Context as LambdaContext, SQSEvent } 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 SQSEventHandlerCallableParams<Response = Reply> {\n request: Request;\n reply: Reply;\n context: Context;\n event: SQSEvent;\n lambdaContext: LambdaContext;\n next: () => Promise<Response>;\n}\n\nexport interface SQSEventHandlerCallable<Response = Reply> {\n (params: SQSEventHandlerCallableParams<Response>): Promise<Response>;\n}\n\nexport class SQSEventHandler<Response = any> extends Plugin {\n public static override type = \"handler.fastify.aws.sqs.eventHandler\";\n\n public readonly cb: SQSEventHandlerCallable<Response>;\n\n public constructor(cb: SQSEventHandlerCallable<Response>) {\n super();\n this.cb = cb;\n }\n}\n\nexport const createEventHandler = <Response>(cb: SQSEventHandlerCallable<Response>) => {\n return new SQSEventHandler<Response>(cb);\n};\n"],"names":["SQSEventHandler","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 {};
|
package/sqs/register.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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-sqs",
|
|
6
|
+
canUse: (event)=>{
|
|
7
|
+
if (!Array.isArray(event.Records) || 0 === event.Records.length) return false;
|
|
8
|
+
const [record] = event.Records;
|
|
9
|
+
if ("string" != typeof record.eventSource) return false;
|
|
10
|
+
return "aws:sqs" === record.eventSource.toLowerCase();
|
|
11
|
+
},
|
|
12
|
+
handle: async ({ params, event, context })=>createHandler(params)(event, context)
|
|
13
|
+
});
|
|
14
|
+
registry.register(handler);
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqs/register.js","sources":["../../src/sqs/register.ts"],"sourcesContent":["import type { SQSEvent } 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<SQSEvent, HandlerParams>({\n name: \"handler-aws-sqs\",\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:sqs\";\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,IAAI,AAA8B,YAA9B,OAAOE,OAAO,WAAW,EACzB,OAAO;QAEX,OAAOA,AAAqC,cAArCA,OAAO,WAAW,CAAC,WAAW;IACzC;IACA,QAAQ,OAAO,EAAEC,MAAM,EAAEH,KAAK,EAAEI,OAAO,EAAE,GAC9BC,cAAcF,QAAQH,OAAOI;AAE5C;AAEAE,SAAS,QAAQ,CAACR"}
|
package/types.d.ts
CHANGED
|
@@ -1,14 +1,37 @@
|
|
|
1
|
-
import { APIGatewayEvent, Context as LambdaContext } from "aws-
|
|
1
|
+
import type { APIGatewayEvent, APIGatewayEventRequestContextWithAuthorizer, AttributeValue, Context as LambdaContext, DynamoDBRecord, DynamoDBStreamEvent, EventBridgeEvent, S3Event, SNSEvent, SQSEvent } from "@webiny/aws-sdk/types/index.js";
|
|
2
2
|
import "fastify";
|
|
3
|
-
|
|
3
|
+
import type { CreateHandlerParams as BaseCreateHandlerParams } from "@webiny/handler";
|
|
4
|
+
import type { LambdaFastifyOptions as LambdaOptions } from "@fastify/aws-lambda";
|
|
5
|
+
import type { GenericRecord } from "@webiny/utils";
|
|
6
|
+
export type { AttributeValue, DynamoDBRecord };
|
|
7
|
+
export type { HandlerRegistry } from "./registry.js";
|
|
8
|
+
export * from "@webiny/handler/types.js";
|
|
9
|
+
export type { APIGatewayEvent, LambdaContext, APIGatewayEventRequestContextWithAuthorizer };
|
|
10
|
+
export type HandlerEvent = APIGatewayEvent | SNSEvent | SQSEvent | S3Event | EventBridgeEvent<string, string> | DynamoDBStreamEvent | GenericRecord<string>;
|
|
11
|
+
export interface EventResolver<T = any> {
|
|
12
|
+
(event: HandlerEvent, context: LambdaContext): T;
|
|
13
|
+
}
|
|
14
|
+
export interface HandlerFactoryParams extends BaseCreateHandlerParams {
|
|
15
|
+
lambdaOptions?: LambdaOptions;
|
|
16
|
+
}
|
|
17
|
+
export interface HandlerFactory<T extends HandlerFactoryParams = HandlerFactoryParams, R = any> {
|
|
18
|
+
(params: T): EventResolver<R>;
|
|
19
|
+
}
|
|
20
|
+
export interface HandlerParams<E, P extends HandlerFactoryParams> {
|
|
21
|
+
params: P;
|
|
22
|
+
event: E;
|
|
23
|
+
context: LambdaContext;
|
|
24
|
+
}
|
|
25
|
+
export interface SourceHandler<E = HandlerEvent, P extends HandlerFactoryParams = HandlerFactoryParams, T = any> {
|
|
26
|
+
name: string;
|
|
27
|
+
canUse: (event: Partial<E>, context: LambdaContext) => boolean;
|
|
28
|
+
handle: (params: HandlerParams<E, P>) => Promise<T>;
|
|
29
|
+
}
|
|
4
30
|
export declare enum Base64EncodeHeader {
|
|
5
31
|
encoded = "x-webiny-base64-encoded",
|
|
6
32
|
binary = "x-webiny-binary"
|
|
7
33
|
}
|
|
8
34
|
declare module "fastify" {
|
|
9
|
-
interface FastifyInstance {
|
|
10
|
-
__webiny_raw_result: any;
|
|
11
|
-
}
|
|
12
35
|
interface FastifyRequest {
|
|
13
36
|
awsLambda: {
|
|
14
37
|
event: APIGatewayEvent;
|
package/types.js
CHANGED
|
@@ -1,32 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
require("fastify");
|
|
12
|
-
|
|
13
|
-
var _types = require("@webiny/handler/types");
|
|
14
|
-
|
|
15
|
-
Object.keys(_types).forEach(function (key) {
|
|
16
|
-
if (key === "default" || key === "__esModule") return;
|
|
17
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
18
|
-
if (key in exports && exports[key] === _types[key]) return;
|
|
19
|
-
Object.defineProperty(exports, key, {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return _types[key];
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
let Base64EncodeHeader;
|
|
27
|
-
exports.Base64EncodeHeader = Base64EncodeHeader;
|
|
28
|
-
|
|
29
|
-
(function (Base64EncodeHeader) {
|
|
30
|
-
Base64EncodeHeader["encoded"] = "x-webiny-base64-encoded";
|
|
31
|
-
Base64EncodeHeader["binary"] = "x-webiny-binary";
|
|
32
|
-
})(Base64EncodeHeader || (exports.Base64EncodeHeader = Base64EncodeHeader = {}));
|
|
1
|
+
import "fastify";
|
|
2
|
+
export * from "@webiny/handler/types.js";
|
|
3
|
+
var types_Base64EncodeHeader = /*#__PURE__*/ function(Base64EncodeHeader) {
|
|
4
|
+
Base64EncodeHeader["encoded"] = "x-webiny-base64-encoded";
|
|
5
|
+
Base64EncodeHeader["binary"] = "x-webiny-binary";
|
|
6
|
+
return Base64EncodeHeader;
|
|
7
|
+
}({});
|
|
8
|
+
export { types_Base64EncodeHeader as Base64EncodeHeader };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type {\n APIGatewayEvent,\n APIGatewayEventRequestContextWithAuthorizer,\n AttributeValue,\n Context as LambdaContext,\n DynamoDBRecord,\n DynamoDBStreamEvent,\n EventBridgeEvent,\n S3Event,\n SNSEvent,\n SQSEvent\n} from \"@webiny/aws-sdk/types/index.js\";\nimport \"fastify\";\nimport type { CreateHandlerParams as BaseCreateHandlerParams } from \"@webiny/handler\";\nimport type { LambdaFastifyOptions as LambdaOptions } from \"@fastify/aws-lambda\";\nimport type { GenericRecord } from \"@webiny/utils\";\n\nexport type { AttributeValue, DynamoDBRecord };\n\nexport type { HandlerRegistry } from \"~/registry.js\";\n\nexport * from \"@webiny/handler/types.js\";\n\nexport type { APIGatewayEvent, LambdaContext, APIGatewayEventRequestContextWithAuthorizer };\n\nexport type HandlerEvent =\n | APIGatewayEvent\n | SNSEvent\n | SQSEvent\n | S3Event\n | EventBridgeEvent<string, string>\n | DynamoDBStreamEvent\n | GenericRecord<string>;\n\nexport interface EventResolver<T = any> {\n (event: HandlerEvent, context: LambdaContext): T;\n}\n\nexport interface HandlerFactoryParams extends BaseCreateHandlerParams {\n lambdaOptions?: LambdaOptions;\n}\n\nexport interface HandlerFactory<T extends HandlerFactoryParams = HandlerFactoryParams, R = any> {\n (params: T): EventResolver<R>;\n}\n\nexport interface HandlerParams<E, P extends HandlerFactoryParams> {\n params: P;\n event: E;\n context: LambdaContext;\n}\n\nexport interface SourceHandler<\n E = HandlerEvent,\n P extends HandlerFactoryParams = HandlerFactoryParams,\n T = any\n> {\n name: string;\n canUse: (event: Partial<E>, context: LambdaContext) => boolean;\n handle: (params: HandlerParams<E, P>) => Promise<T>;\n}\n\nexport enum Base64EncodeHeader {\n encoded = \"x-webiny-base64-encoded\",\n binary = \"x-webiny-binary\"\n}\n\ndeclare module \"fastify\" {\n interface FastifyRequest {\n awsLambda: {\n event: APIGatewayEvent;\n context: LambdaContext;\n };\n }\n}\n"],"names":["Base64EncodeHeader"],"mappings":";;AA8DO,IAAKA,2BAAkBA,WAAAA,GAAAA,SAAlBA,kBAAkB;;;WAAlBA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Plugin } from "@webiny/plugins/types.js";
|
|
2
|
+
type WrappedInput<TInput, TOutput> = TInput & {
|
|
3
|
+
next: () => Promise<TOutput>;
|
|
4
|
+
};
|
|
5
|
+
export declare const createComposedHandler: <P extends Plugin, TInput, TOutput>(plugins: P[]) => import("@webiny/utils").NextAsyncProcessor<WrappedInput<TInput, TOutput>, TOutput>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { composeAsync } from "@webiny/utils";
|
|
2
|
+
const createComposedHandler = (plugins)=>composeAsync(plugins.map((plugin)=>(next)=>async (params)=>plugin.cb({
|
|
3
|
+
...params,
|
|
4
|
+
next: ()=>next(params)
|
|
5
|
+
})));
|
|
6
|
+
export { createComposedHandler };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=composedHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/composedHandler.js","sources":["../../src/utils/composedHandler.ts"],"sourcesContent":["import type { Plugin } from \"@webiny/plugins/types.js\";\nimport { composeAsync } from \"@webiny/utils\";\n\ntype WrappedInput<TInput, TOutput> = TInput & {\n next: () => Promise<TOutput>;\n};\n\nexport const createComposedHandler = <P extends Plugin, TInput, TOutput>(plugins: P[]) => {\n return composeAsync<WrappedInput<TInput, TOutput>, TOutput>(\n plugins.map(plugin => {\n return next => {\n return async params => {\n return plugin.cb({\n ...params,\n next: () => {\n return next(params);\n }\n });\n };\n };\n })\n );\n};\n"],"names":["createComposedHandler","plugins","composeAsync","plugin","next","params"],"mappings":";AAOO,MAAMA,wBAAwB,CAAoCC,UAC9DC,aACHD,QAAQ,GAAG,CAACE,CAAAA,SACDC,CAAAA,OACI,OAAMC,SACFF,OAAO,EAAE,CAAC;oBACb,GAAGE,MAAM;oBACT,MAAM,IACKD,KAAKC;gBAEpB"}
|
package/utils/index.d.ts
ADDED
package/utils/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const MAX_RUNNING_MINUTES = 14;
|
|
2
|
+
const MAX_RUNNING_MILLISECONDS = 60 * MAX_RUNNING_MINUTES * 1000;
|
|
3
|
+
class CustomTimer {
|
|
4
|
+
constructor(){
|
|
5
|
+
this.startTime = Date.now();
|
|
6
|
+
}
|
|
7
|
+
getRemainingMilliseconds() {
|
|
8
|
+
return this.startTime + MAX_RUNNING_MILLISECONDS - Date.now();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export { CustomTimer };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=CustomTimer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/timer/CustomTimer.js","sources":["../../../src/utils/timer/CustomTimer.ts"],"sourcesContent":["const MAX_RUNNING_MINUTES = 14;\nconst MAX_RUNNING_MILLISECONDS = MAX_RUNNING_MINUTES * 60 * 1000;\n\nexport class CustomTimer {\n private readonly startTime: number;\n\n public constructor() {\n this.startTime = Date.now();\n }\n\n public getRemainingMilliseconds(): number {\n return this.startTime + MAX_RUNNING_MILLISECONDS - Date.now(); // 14 minutes\n }\n}\n"],"names":["MAX_RUNNING_MINUTES","MAX_RUNNING_MILLISECONDS","CustomTimer","Date"],"mappings":"AAAA,MAAMA,sBAAsB;AAC5B,MAAMC,2BAA2BD,AAAsB,KAAtBA,sBAA2B;AAErD,MAAME;IAGT,aAAqB;QACjB,IAAI,CAAC,SAAS,GAAGC,KAAK,GAAG;IAC7B;IAEO,2BAAmC;QACtC,OAAO,IAAI,CAAC,SAAS,GAAGF,2BAA2BE,KAAK,GAAG;IAC/D;AACJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ITimer } from "./abstractions/ITimer.js";
|
|
2
|
+
export interface ITimerCb {
|
|
3
|
+
(): number;
|
|
4
|
+
}
|
|
5
|
+
export declare class Timer implements ITimer {
|
|
6
|
+
private readonly cb;
|
|
7
|
+
constructor(cb: ITimerCb);
|
|
8
|
+
getRemainingMilliseconds(): number;
|
|
9
|
+
getRemainingSeconds(): number;
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class Timer {
|
|
2
|
+
constructor(cb){
|
|
3
|
+
this.cb = cb;
|
|
4
|
+
}
|
|
5
|
+
getRemainingMilliseconds() {
|
|
6
|
+
return this.cb();
|
|
7
|
+
}
|
|
8
|
+
getRemainingSeconds() {
|
|
9
|
+
const result = this.cb();
|
|
10
|
+
if (result > 0) return Math.floor(result / 1000);
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export { Timer };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=Timer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/timer/Timer.js","sources":["../../../src/utils/timer/Timer.ts"],"sourcesContent":["import type { ITimer } from \"./abstractions/ITimer.js\";\n\nexport interface ITimerCb {\n (): number;\n}\n\nexport class Timer implements ITimer {\n private readonly cb: ITimerCb;\n\n public constructor(cb: ITimerCb) {\n this.cb = cb;\n }\n public getRemainingMilliseconds(): number {\n return this.cb();\n }\n\n public getRemainingSeconds(): number {\n const result = this.cb();\n if (result > 0) {\n return Math.floor(result / 1000);\n }\n return 0;\n }\n}\n"],"names":["Timer","cb","result","Math"],"mappings":"AAMO,MAAMA;IAGT,YAAmBC,EAAY,CAAE;QAC7B,IAAI,CAAC,EAAE,GAAGA;IACd;IACO,2BAAmC;QACtC,OAAO,IAAI,CAAC,EAAE;IAClB;IAEO,sBAA8B;QACjC,MAAMC,SAAS,IAAI,CAAC,EAAE;QACtB,IAAIA,SAAS,GACT,OAAOC,KAAK,KAAK,CAACD,SAAS;QAE/B,OAAO;IACX;AACJ"}
|
|
File without changes
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ITimer } from "./abstractions/ITimer.js";
|
|
2
|
+
import type { Context as LambdaContext } from "@webiny/aws-sdk/types/index.js";
|
|
3
|
+
export type ITimerFactoryParams = Pick<LambdaContext, "getRemainingTimeInMillis">;
|
|
4
|
+
export declare const timerFactory: (params?: Partial<ITimerFactoryParams>) => ITimer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CustomTimer } from "./CustomTimer.js";
|
|
2
|
+
import { Timer } from "./Timer.js";
|
|
3
|
+
const timerFactory = (params)=>{
|
|
4
|
+
const customTimer = new CustomTimer();
|
|
5
|
+
return new Timer(()=>{
|
|
6
|
+
if (params?.getRemainingTimeInMillis) return params.getRemainingTimeInMillis();
|
|
7
|
+
return customTimer.getRemainingMilliseconds();
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export { timerFactory };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/timer/factory.js","sources":["../../../src/utils/timer/factory.ts"],"sourcesContent":["import type { ITimer } from \"./abstractions/ITimer.js\";\nimport { CustomTimer } from \"./CustomTimer.js\";\nimport type { Context as LambdaContext } from \"@webiny/aws-sdk/types/index.js\";\nimport { Timer } from \"./Timer.js\";\n\nexport type ITimerFactoryParams = Pick<LambdaContext, \"getRemainingTimeInMillis\">;\n\nexport const timerFactory = (params?: Partial<ITimerFactoryParams>): ITimer => {\n const customTimer = new CustomTimer();\n\n return new Timer(() => {\n if (params?.getRemainingTimeInMillis) {\n return params.getRemainingTimeInMillis();\n }\n return customTimer.getRemainingMilliseconds();\n });\n};\n"],"names":["timerFactory","params","customTimer","CustomTimer","Timer"],"mappings":";;AAOO,MAAMA,eAAe,CAACC;IACzB,MAAMC,cAAc,IAAIC;IAExB,OAAO,IAAIC,MAAM;QACb,IAAIH,QAAQ,0BACR,OAAOA,OAAO,wBAAwB;QAE1C,OAAOC,YAAY,wBAAwB;IAC/C;AACJ"}
|
package/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export {\n createHandler as createApiGatewayHandler,\n CreateHandlerParams as CreateApiGatewayHandlerParams,\n RoutePlugin,\n createRoute as createApiGatewayRoute\n} from \"~/gateway\";\n\nexport {\n createHandler as createS3Handler,\n CreateHandlerParams as CreateS3HandlerParams,\n S3EventHandler,\n S3EventHandlerCallable,\n S3EventHandlerCallableParams,\n createEventHandler as createS3EventHandler\n} from \"~/s3\";\n\nexport {\n createHandler as createDynamoDBHandler,\n CreateHandlerParams as CreateDynamoDBHandlerParams,\n DynamoDBEventHandler,\n DynamoDBEventHandlerCallable,\n DynamoDBEventHandlerCallableParams,\n createEventHandler as createDynamoDBEventHandler,\n HandlerCallable as DynamoDBHandlerCallable\n} from \"~/dynamodb\";\n\nexport {\n createHandler as createSQSHandler,\n CreateHandlerParams as CreateSQSHandlerParams,\n SQSEventHandler,\n SQSEventHandlerCallable,\n SQSEventHandlerCallableParams,\n createEventHandler as createSQSEventHandler,\n HandlerCallable as SQSHandlerCallable\n} from \"~/sqs\";\n\nexport {\n createHandler as createEventBridgeHandler,\n CreateHandlerParams as CreateEventBridgeHandlerParams,\n EventBridgeEventHandler,\n EventBridgeEventHandlerCallable,\n EventBridgeEventHandlerCallableParams,\n createEventHandler as createEventBridgeEventHandler,\n HandlerCallable as EventBridgeHandlerCallable\n} from \"~/eventBridge\";\n\nexport {\n createHandler as createRawHandler,\n CreateHandlerParams as CreateRawHandlerParams,\n HandlerCallable as RawHandlerCallable,\n createEventHandler as createRawEventHandler,\n RawEventHandlerCallableParams,\n RawEventHandlerCallable,\n RawEventHandler\n} from \"~/raw\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAOA;;AASA;;AAUA;;AAUA;;AAUA"}
|
package/plugins/handlerClient.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
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.createHandlerClientPlugin = void 0;
|
|
9
|
-
|
|
10
|
-
var _lambda = _interopRequireDefault(require("aws-sdk/clients/lambda"));
|
|
11
|
-
|
|
12
|
-
var _handlerClient = require("@webiny/handler-client");
|
|
13
|
-
|
|
14
|
-
const createHandlerClientPlugin = () => {
|
|
15
|
-
const plugin = new _handlerClient.HandlerClientPlugin({
|
|
16
|
-
invoke: async params => {
|
|
17
|
-
const {
|
|
18
|
-
await: useAwait,
|
|
19
|
-
name,
|
|
20
|
-
payload
|
|
21
|
-
} = params;
|
|
22
|
-
const lambdaClient = new _lambda.default({
|
|
23
|
-
region: process.env.AWS_REGION
|
|
24
|
-
});
|
|
25
|
-
const response = await lambdaClient.invoke({
|
|
26
|
-
FunctionName: name,
|
|
27
|
-
InvocationType: useAwait === false ? "Event" : "RequestResponse",
|
|
28
|
-
Payload: JSON.stringify(payload)
|
|
29
|
-
}).promise();
|
|
30
|
-
|
|
31
|
-
if (useAwait === false) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const Payload = response.Payload;
|
|
36
|
-
return JSON.parse(Payload);
|
|
37
|
-
},
|
|
38
|
-
canUse: params => {
|
|
39
|
-
if (!(params !== null && params !== void 0 && params.name)) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const {
|
|
44
|
-
name
|
|
45
|
-
} = params;
|
|
46
|
-
/**
|
|
47
|
-
* In case we are invoking currently active lambda, let's use this plugin as well.
|
|
48
|
-
* When invoking some other lambda, name starts with arn.
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
if (name === process.env.AWS_LAMBDA_FUNCTION_NAME) {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return name.match("arn:") !== null;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
plugin.name = "handler-client";
|
|
59
|
-
return plugin;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
exports.createHandlerClientPlugin = createHandlerClientPlugin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createHandlerClientPlugin","plugin","HandlerClientPlugin","invoke","params","await","useAwait","name","payload","lambdaClient","LambdaClient","region","process","env","AWS_REGION","response","FunctionName","InvocationType","Payload","JSON","stringify","promise","parse","canUse","AWS_LAMBDA_FUNCTION_NAME","match"],"sources":["handlerClient.ts"],"sourcesContent":["import LambdaClient from \"aws-sdk/clients/lambda\";\nimport { HandlerClientPlugin } from \"@webiny/handler-client\";\n\nexport const createHandlerClientPlugin = () => {\n const plugin = new HandlerClientPlugin({\n invoke: async params => {\n const { await: useAwait, name, payload } = params;\n const lambdaClient = new LambdaClient({\n region: process.env.AWS_REGION\n });\n const response = await lambdaClient\n .invoke({\n FunctionName: name,\n InvocationType: useAwait === false ? \"Event\" : \"RequestResponse\",\n Payload: JSON.stringify(payload)\n })\n .promise();\n\n if (useAwait === false) {\n return null;\n }\n\n const Payload = response.Payload as string;\n return JSON.parse(Payload);\n },\n canUse: params => {\n if (!params?.name) {\n return true;\n }\n const { name } = params;\n /**\n * In case we are invoking currently active lambda, let's use this plugin as well.\n * When invoking some other lambda, name starts with arn.\n */\n if (name === process.env.AWS_LAMBDA_FUNCTION_NAME) {\n return true;\n }\n return name.match(\"arn:\") !== null;\n }\n });\n\n plugin.name = \"handler-client\";\n\n return plugin;\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEO,MAAMA,yBAAyB,GAAG,MAAM;EAC3C,MAAMC,MAAM,GAAG,IAAIC,kCAAJ,CAAwB;IACnCC,MAAM,EAAE,MAAMC,MAAN,IAAgB;MACpB,MAAM;QAAEC,KAAK,EAAEC,QAAT;QAAmBC,IAAnB;QAAyBC;MAAzB,IAAqCJ,MAA3C;MACA,MAAMK,YAAY,GAAG,IAAIC,eAAJ,CAAiB;QAClCC,MAAM,EAAEC,OAAO,CAACC,GAAR,CAAYC;MADc,CAAjB,CAArB;MAGA,MAAMC,QAAQ,GAAG,MAAMN,YAAY,CAC9BN,MADkB,CACX;QACJa,YAAY,EAAET,IADV;QAEJU,cAAc,EAAEX,QAAQ,KAAK,KAAb,GAAqB,OAArB,GAA+B,iBAF3C;QAGJY,OAAO,EAAEC,IAAI,CAACC,SAAL,CAAeZ,OAAf;MAHL,CADW,EAMlBa,OANkB,EAAvB;;MAQA,IAAIf,QAAQ,KAAK,KAAjB,EAAwB;QACpB,OAAO,IAAP;MACH;;MAED,MAAMY,OAAO,GAAGH,QAAQ,CAACG,OAAzB;MACA,OAAOC,IAAI,CAACG,KAAL,CAAWJ,OAAX,CAAP;IACH,CApBkC;IAqBnCK,MAAM,EAAEnB,MAAM,IAAI;MACd,IAAI,EAACA,MAAD,aAACA,MAAD,eAACA,MAAM,CAAEG,IAAT,CAAJ,EAAmB;QACf,OAAO,IAAP;MACH;;MACD,MAAM;QAAEA;MAAF,IAAWH,MAAjB;MACA;AACZ;AACA;AACA;;MACY,IAAIG,IAAI,KAAKK,OAAO,CAACC,GAAR,CAAYW,wBAAzB,EAAmD;QAC/C,OAAO,IAAP;MACH;;MACD,OAAOjB,IAAI,CAACkB,KAAL,CAAW,MAAX,MAAuB,IAA9B;IACH;EAlCkC,CAAxB,CAAf;EAqCAxB,MAAM,CAACM,IAAP,GAAc,gBAAd;EAEA,OAAON,MAAP;AACH,CAzCM"}
|