@middy/core 6.3.1 → 6.4.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.
Files changed (2) hide show
  1. package/index.js +4 -4
  2. package/package.json +5 -2
package/index.js CHANGED
@@ -47,8 +47,8 @@ const middy = (setupLambdaHandler, pluginConfig) => {
47
47
  const middy = plugin.streamifyResponse
48
48
  ? awslambda.streamifyResponse(
49
49
  async (event, lambdaResponseStream, context) => {
50
- plugin.requestStart?.();
51
50
  const request = middyRequest(event, context);
51
+ plugin.requestStart?.(request);
52
52
  const handlerResponse = await runRequest(
53
53
  request,
54
54
  beforeMiddlewares,
@@ -92,8 +92,8 @@ const middy = (setupLambdaHandler, pluginConfig) => {
92
92
  },
93
93
  )
94
94
  : async (event, context) => {
95
- plugin.requestStart?.();
96
95
  const request = middyRequest(event, context);
96
+ plugin.requestStart?.(request);
97
97
 
98
98
  const response = await runRequest(
99
99
  request,
@@ -177,7 +177,7 @@ const runRequest = async (
177
177
  await runMiddlewares(request, beforeMiddlewares, plugin);
178
178
 
179
179
  // Check if before stack hasn't exit early
180
- if (!Object.prototype.hasOwnProperty.call(request, "earlyResponse")) {
180
+ if (!Object.hasOwn(request, "earlyResponse")) {
181
181
  plugin.beforeHandler?.();
182
182
 
183
183
  // Can't manually abort and timeout with same AbortSignal
@@ -255,7 +255,7 @@ const runMiddlewares = async (request, middlewares, plugin) => {
255
255
  request.earlyResponse = res;
256
256
  }
257
257
  // earlyResponse pattern added in 6.0.0 to handle undefined values
258
- if (Object.prototype.hasOwnProperty.call(request, "earlyResponse")) {
258
+ if (Object.hasOwn(request, "earlyResponse")) {
259
259
  request.response = request.earlyResponse;
260
260
  return;
261
261
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/core",
3
- "version": "6.3.1",
3
+ "version": "6.4.0",
4
4
  "description": "🛵 The stylish Node.js middleware engine for AWS Lambda (core package)",
5
5
  "type": "module",
6
6
  "engines": {
@@ -23,7 +23,10 @@
23
23
  }
24
24
  },
25
25
  "types": "index.d.ts",
26
- "files": ["index.js", "index.d.ts"],
26
+ "files": [
27
+ "index.js",
28
+ "index.d.ts"
29
+ ],
27
30
  "scripts": {
28
31
  "test": "npm run test:unit && npm run test:fuzz",
29
32
  "test:unit": "node --test",