@middy/http-multipart-body-parser 7.3.3 → 7.3.4

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.
Files changed (2) hide show
  1. package/index.js +7 -4
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -3,6 +3,9 @@
3
3
  import BusBoy from "@fastify/busboy";
4
4
  import { createError, validateOptions } from "@middy/util";
5
5
 
6
+ const name = "http-multipart-body-parser";
7
+ const pkg = `@middy/${name}`;
8
+
6
9
  const mimePattern =
7
10
  /^multipart\/form-data; boundary=[a-zA-Z0-9-]{1,70}(; ?charset=[\w-]+)?$/i;
8
11
  const fieldnamePattern = /(.+)\[(.*)]$/;
@@ -44,7 +47,7 @@ const optionSchema = {
44
47
  };
45
48
 
46
49
  export const httpMultipartBodyParserValidateOptions = (options) =>
47
- validateOptions("@middy/http-multipart-body-parser", optionSchema, options);
50
+ validateOptions(pkg, optionSchema, options);
48
51
 
49
52
  const defaults = {
50
53
  // busboy options as per documentation: https://www.npmjs.com/package/busboy#busboy-methods
@@ -68,7 +71,7 @@ const httpMultipartBodyParserMiddleware = (opts = {}) => {
68
71
  }
69
72
  throw createError(415, "Unsupported Media Type", {
70
73
  cause: {
71
- package: "@middy/http-multipart-body-parser",
74
+ package: pkg,
72
75
  data: contentType,
73
76
  },
74
77
  });
@@ -78,7 +81,7 @@ const httpMultipartBodyParserMiddleware = (opts = {}) => {
78
81
  throw createError(
79
82
  422,
80
83
  "Invalid or malformed multipart/form-data was provided",
81
- { cause: { package: "@middy/http-multipart-body-parser", data: body } },
84
+ { cause: { package: pkg, data: body } },
82
85
  );
83
86
  }
84
87
 
@@ -93,7 +96,7 @@ const httpMultipartBodyParserMiddleware = (opts = {}) => {
93
96
  "Invalid or malformed multipart/form-data was provided",
94
97
  {
95
98
  cause: {
96
- package: "@middy/http-multipart-body-parser",
99
+ package: pkg,
97
100
  data: body,
98
101
  message: err.message,
99
102
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/http-multipart-body-parser",
3
- "version": "7.3.3",
3
+ "version": "7.3.4",
4
4
  "description": "HTTP multipart body parser middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -63,10 +63,10 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "@fastify/busboy": "3.2.0",
66
- "@middy/util": "7.3.3"
66
+ "@middy/util": "7.3.4"
67
67
  },
68
68
  "devDependencies": {
69
- "@middy/core": "7.3.3",
69
+ "@middy/core": "7.3.4",
70
70
  "@types/aws-lambda": "^8.0.0",
71
71
  "@types/node": "^22.0.0",
72
72
  "type-fest": "^5.0.0"