@middy/util 7.1.1 → 7.1.2
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/index.d.ts +5 -0
- package/index.js +6 -0
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -156,6 +156,11 @@ declare function jsonSafeStringify(
|
|
|
156
156
|
space?: string | number,
|
|
157
157
|
): string | any;
|
|
158
158
|
|
|
159
|
+
declare function decodeBody(event: {
|
|
160
|
+
body?: string | null;
|
|
161
|
+
isBase64Encoded?: boolean;
|
|
162
|
+
}): string | null | undefined;
|
|
163
|
+
|
|
159
164
|
declare const lambdaContextKeys: string[];
|
|
160
165
|
|
|
161
166
|
declare const executionContextKeys: string[];
|
package/index.js
CHANGED
|
@@ -239,6 +239,12 @@ export const jsonSafeStringify = (value, replacer, space) => {
|
|
|
239
239
|
}
|
|
240
240
|
};
|
|
241
241
|
|
|
242
|
+
export const decodeBody = (event) => {
|
|
243
|
+
const { body, isBase64Encoded } = event;
|
|
244
|
+
if (body === undefined || body === null) return body;
|
|
245
|
+
return isBase64Encoded ? Buffer.from(body, "base64").toString() : body;
|
|
246
|
+
};
|
|
247
|
+
|
|
242
248
|
export const normalizeHttpResponse = (request) => {
|
|
243
249
|
let { response } = request;
|
|
244
250
|
if (typeof response === "undefined") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/util",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.2",
|
|
4
4
|
"description": "🛵 The stylish Node.js middleware engine for AWS Lambda (util package)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@aws-sdk/client-ssm": "^3.0.0",
|
|
63
|
-
"@middy/core": "7.1.
|
|
63
|
+
"@middy/core": "7.1.2",
|
|
64
64
|
"@types/aws-lambda": "^8.0.0",
|
|
65
65
|
"@types/node": "^22.0.0",
|
|
66
66
|
"aws-xray-sdk": "^3.3.3"
|