@webiny/handler-aws 6.0.0 → 6.1.0-beta.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/handler-aws",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.1.0-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -14,23 +14,22 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@fastify/aws-lambda": "6.4.0",
|
|
17
|
-
"@webiny/aws-sdk": "6.0.
|
|
18
|
-
"@webiny/handler": "6.0.
|
|
19
|
-
"@webiny/
|
|
20
|
-
"@webiny/
|
|
21
|
-
"
|
|
22
|
-
"fastify": "5.8.2",
|
|
17
|
+
"@webiny/aws-sdk": "6.1.0-beta.1",
|
|
18
|
+
"@webiny/handler": "6.1.0-beta.1",
|
|
19
|
+
"@webiny/plugins": "6.1.0-beta.1",
|
|
20
|
+
"@webiny/utils": "6.1.0-beta.1",
|
|
21
|
+
"fastify": "5.8.4",
|
|
23
22
|
"pino-lambda": "4.4.1"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
|
-
"@webiny/build-tools": "6.0.
|
|
25
|
+
"@webiny/build-tools": "6.1.0-beta.1",
|
|
27
26
|
"rimraf": "6.1.3",
|
|
28
27
|
"typescript": "5.9.3",
|
|
29
|
-
"vitest": "4.
|
|
28
|
+
"vitest": "4.1.2"
|
|
30
29
|
},
|
|
31
30
|
"publishConfig": {
|
|
32
31
|
"access": "public",
|
|
33
32
|
"directory": "dist"
|
|
34
33
|
},
|
|
35
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "3c1293ba17a14f239fb1cbf5d80cd66846849309"
|
|
36
35
|
}
|
package/plugins/index.js
CHANGED
package/plugins/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["registerDefaultPlugins","context","plugins","register"],"sources":["index.ts"],"sourcesContent":["import type { Context } from \"@webiny/handler/types.js\";\n\nexport const registerDefaultPlugins = (context: Context): void => {\n context.plugins.register([\n //\n ]);\n};\n"],"mappings":"AAEA,OAAO,MAAMA,sBAAsB,GAAIC,OAAgB,IAAW;EAC9DA,OAAO,CAACC,OAAO,CAACC,QAAQ,CAAC;IACrB;EAAA,CACH,CAAC;AACN,CAAC","ignoreList":[]}
|
package/plugins/handlerClient.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { LambdaClient, InvokeCommand } from "@webiny/aws-sdk/client-lambda/index.js";
|
|
2
|
-
import { HandlerClientPlugin } from "@webiny/handler-client";
|
|
3
|
-
export const createHandlerClientPlugin = () => {
|
|
4
|
-
const plugin = new HandlerClientPlugin({
|
|
5
|
-
invoke: async params => {
|
|
6
|
-
const {
|
|
7
|
-
await: useAwait,
|
|
8
|
-
name,
|
|
9
|
-
payload
|
|
10
|
-
} = params;
|
|
11
|
-
const lambdaClient = new LambdaClient({
|
|
12
|
-
region: process.env.AWS_REGION
|
|
13
|
-
});
|
|
14
|
-
const response = await lambdaClient.send(new InvokeCommand({
|
|
15
|
-
FunctionName: name,
|
|
16
|
-
InvocationType: useAwait === false ? "Event" : "RequestResponse",
|
|
17
|
-
Payload: JSON.stringify(payload)
|
|
18
|
-
}));
|
|
19
|
-
if (useAwait === false) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
const decoder = new TextDecoder("utf-8");
|
|
23
|
-
return JSON.parse(decoder.decode(response.Payload));
|
|
24
|
-
},
|
|
25
|
-
canUse: params => {
|
|
26
|
-
if (!params?.name) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
const {
|
|
30
|
-
name
|
|
31
|
-
} = params;
|
|
32
|
-
/**
|
|
33
|
-
* In case we are invoking currently active lambda, let's use this plugin as well.
|
|
34
|
-
* When invoking some other lambda, name starts with arn.
|
|
35
|
-
*/
|
|
36
|
-
if (name === process.env.AWS_LAMBDA_FUNCTION_NAME) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
return name.match("arn:") !== null;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
plugin.name = "handler-client";
|
|
43
|
-
return plugin;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
//# sourceMappingURL=handlerClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["LambdaClient","InvokeCommand","HandlerClientPlugin","createHandlerClientPlugin","plugin","invoke","params","await","useAwait","name","payload","lambdaClient","region","process","env","AWS_REGION","response","send","FunctionName","InvocationType","Payload","JSON","stringify","decoder","TextDecoder","parse","decode","canUse","AWS_LAMBDA_FUNCTION_NAME","match"],"sources":["handlerClient.ts"],"sourcesContent":["import { LambdaClient, InvokeCommand } from \"@webiny/aws-sdk/client-lambda/index.js\";\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.send(\n new InvokeCommand({\n FunctionName: name,\n InvocationType: useAwait === false ? \"Event\" : \"RequestResponse\",\n Payload: JSON.stringify(payload)\n })\n );\n\n if (useAwait === false) {\n return null;\n }\n\n const decoder = new TextDecoder(\"utf-8\");\n return JSON.parse(decoder.decode(response.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"],"mapp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