@middy/http-multipart-body-parser 7.2.2 → 7.3.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/index.d.ts +4 -0
- package/index.js +11 -1
- package/package.json +3 -6
package/index.d.ts
CHANGED
|
@@ -40,4 +40,8 @@ declare function multipartBodyParser<
|
|
|
40
40
|
EventType extends RequestEvent = RequestEvent,
|
|
41
41
|
>(options?: Options): middy.MiddlewareObj<Event<EventType>, unknown, Error>;
|
|
42
42
|
|
|
43
|
+
export declare function httpMultipartBodyParserValidateOptions(
|
|
44
|
+
options?: Record<string, unknown>,
|
|
45
|
+
): void;
|
|
46
|
+
|
|
43
47
|
export default multipartBodyParser;
|
package/index.js
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
// Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import BusBoy from "@fastify/busboy";
|
|
4
|
-
import { createError } from "@middy/util";
|
|
4
|
+
import { createError, validateOptions } from "@middy/util";
|
|
5
5
|
|
|
6
6
|
const mimePattern =
|
|
7
7
|
/^multipart\/form-data; boundary=[a-zA-Z0-9-]{1,70}(; ?charset=[\w-]+)?$/i;
|
|
8
8
|
const fieldnamePattern = /(.+)\[(.*)]$/;
|
|
9
9
|
|
|
10
|
+
const optionSchema = {
|
|
11
|
+
busboy: "object?",
|
|
12
|
+
charset: "string?",
|
|
13
|
+
disableContentTypeCheck: "boolean?",
|
|
14
|
+
disableContentTypeError: "boolean?",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const httpMultipartBodyParserValidateOptions = (options) =>
|
|
18
|
+
validateOptions("@middy/http-multipart-body-parser", optionSchema, options);
|
|
19
|
+
|
|
10
20
|
const defaults = {
|
|
11
21
|
// busboy options as per documentation: https://www.npmjs.com/package/busboy#busboy-methods
|
|
12
22
|
busboy: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/http-multipart-body-parser",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "HTTP multipart body parser middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -17,9 +17,6 @@
|
|
|
17
17
|
"import": {
|
|
18
18
|
"types": "./index.d.ts",
|
|
19
19
|
"default": "./index.js"
|
|
20
|
-
},
|
|
21
|
-
"require": {
|
|
22
|
-
"default": "./index.js"
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
22
|
},
|
|
@@ -66,10 +63,10 @@
|
|
|
66
63
|
},
|
|
67
64
|
"dependencies": {
|
|
68
65
|
"@fastify/busboy": "3.2.0",
|
|
69
|
-
"@middy/util": "7.
|
|
66
|
+
"@middy/util": "7.3.0"
|
|
70
67
|
},
|
|
71
68
|
"devDependencies": {
|
|
72
|
-
"@middy/core": "7.
|
|
69
|
+
"@middy/core": "7.3.0",
|
|
73
70
|
"@types/aws-lambda": "^8.0.0",
|
|
74
71
|
"@types/node": "^22.0.0",
|
|
75
72
|
"type-fest": "^5.0.0"
|