Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@middy/core

Package Overview
Dependencies
Maintainers
3
Versions
226
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@middy/core - npm Package Compare versions

Comparing version 2.0.0-beta.0 to 2.0.0-beta.1

1

index.d.ts

@@ -49,2 +49,3 @@ import {

}
(event: TEvent, context: LambdaContext): Promise<TResult>
}

@@ -51,0 +52,0 @@

42

index.js

@@ -25,22 +25,14 @@ "use strict";

try {
var _plugin$beforeHandler, _plugin$afterHandler, _plugin$requestEnd2;
await runMiddlewares(beforeMiddlewares, request, plugin); // Check if before stack doesn't need to exit early
await runMiddlewares(beforeMiddlewares, request, plugin); // catch short circuit
if (request.response === undefined) {
var _plugin$beforeHandler, _plugin$afterHandler;
if (request.response !== undefined) {
var _plugin$requestEnd;
await (plugin === null || plugin === void 0 ? void 0 : (_plugin$requestEnd = plugin.requestEnd) === null || _plugin$requestEnd === void 0 ? void 0 : _plugin$requestEnd.call(plugin));
return request.response;
plugin === null || plugin === void 0 ? void 0 : (_plugin$beforeHandler = plugin.beforeHandler) === null || _plugin$beforeHandler === void 0 ? void 0 : _plugin$beforeHandler.call(plugin);
request.response = await handler(request.event, request.context);
plugin === null || plugin === void 0 ? void 0 : (_plugin$afterHandler = plugin.afterHandler) === null || _plugin$afterHandler === void 0 ? void 0 : _plugin$afterHandler.call(plugin);
await runMiddlewares(afterMiddlewares, request, plugin);
}
plugin === null || plugin === void 0 ? void 0 : (_plugin$beforeHandler = plugin.beforeHandler) === null || _plugin$beforeHandler === void 0 ? void 0 : _plugin$beforeHandler.call(plugin);
request.response = await handler(request.event, request.context);
plugin === null || plugin === void 0 ? void 0 : (_plugin$afterHandler = plugin.afterHandler) === null || _plugin$afterHandler === void 0 ? void 0 : _plugin$afterHandler.call(plugin);
await runMiddlewares(afterMiddlewares, request, plugin);
await (plugin === null || plugin === void 0 ? void 0 : (_plugin$requestEnd2 = plugin.requestEnd) === null || _plugin$requestEnd2 === void 0 ? void 0 : _plugin$requestEnd2.call(plugin));
return request.response;
} catch (e) {
var _plugin$requestEnd4;
// Reset response changes made by after stack before error thrown
request.response = undefined;

@@ -50,18 +42,20 @@ request.error = e;

try {
await runMiddlewares(onErrorMiddlewares, request, plugin);
await runMiddlewares(onErrorMiddlewares, request, plugin); // Catch if onError stack hasn't handled the error
if (request.response !== undefined) {
var _plugin$requestEnd3;
await (plugin === null || plugin === void 0 ? void 0 : (_plugin$requestEnd3 = plugin.requestEnd) === null || _plugin$requestEnd3 === void 0 ? void 0 : _plugin$requestEnd3.call(plugin));
return request.response;
if (request.response === undefined) {
throw request.error;
}
} catch (e) {
// Save error that wasn't handled
e.originalError = request.error;
request.error = e;
throw request.error;
}
} finally {
var _plugin$requestEnd;
await (plugin === null || plugin === void 0 ? void 0 : (_plugin$requestEnd4 = plugin.requestEnd) === null || _plugin$requestEnd4 === void 0 ? void 0 : _plugin$requestEnd4.call(plugin));
throw request.error;
await (plugin === null || plugin === void 0 ? void 0 : (_plugin$requestEnd = plugin.requestEnd) === null || _plugin$requestEnd === void 0 ? void 0 : _plugin$requestEnd.call(plugin));
}
return request.response;
};

@@ -68,0 +62,0 @@

{
"name": "@middy/core",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "🛵 The stylish Node.js middleware engine for AWS Lambda (core package)",

@@ -45,5 +45,6 @@ "type": "commonjs",

"devDependencies": {
"@types/aws-lambda": "^8.10.3"
"@types/aws-lambda": "^8.10.73",
"@types/node": "^14.14.37"
},
"gitHead": "cf78e46ea77bf8feb3ae6061d8e8e9a02f8eeb2e"
"gitHead": "d42f78b1b87143672f0743160a8b3f579b4dff8e"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc