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

baggywrinkle

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baggywrinkle - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

50

index.js

@@ -43,2 +43,5 @@ const machineAsAction = require('machine-as-action');

// Keep a hash of lower-cased headers for `req.get`.
let _lcHeaders = Object.keys(event.headers || {}).reduce((memo, header) => { memo[header.toLowerCase()] = event.headers[header]; return memo }, {});
// Mock up the `req` that the action will use.

@@ -51,3 +54,8 @@ const req = {

method: event.httpMethod,
path: event.path
path: event.path,
headers: event.headers,
get: (header, defaultVal) => _lcHeaders[header.toLowerCase()] || defaultVal,
authorizationToken: event.authorizationToken,
awsEvent: event,
awsContext: context
};

@@ -61,3 +69,6 @@

headers['Content-Type'] = 'application/json';
respond(JSON.stringify(output));
if (!options.noEnvelope) {
output = JSON.stringify(output);
}
respond(output);
},

@@ -73,3 +84,5 @@ send: (output) => {

}
payload = JSON.stringify(payload);
if (!options.noEnvelope) {
payload = JSON.stringify(payload);
}
}

@@ -81,3 +94,5 @@ respond(payload)

return res.json(output.stack, 500);
}
},
// Allow setting context for AWS response (mainly for use in authorizers).
context: {}
}

@@ -100,3 +115,3 @@

headers['Access-Control-Allow-Origin'] = options.cors.origin;
headers['Access-Control-Allow-Headers'] = typeof options.cors.headers === 'string' ? options.cors.headers : options.cors.headers.join(',');
headers['Access-Control-Allow-Headers'] = options.cors.headers && (typeof options.cors.headers === 'string' ? options.cors.headers : options.cors.headers.join(','));
headers['Access-Control-Allow-Credentials'] = options.cors.allowCredentials;

@@ -108,6 +123,11 @@ }

return options.teardown(() => {
if (options.noEnvelope) {
console.log('body', require('util').inspect(body, { depth: null }));
return callback(null, body);
}
callback(null, {
statusCode: statusCode,
headers: headers,
body: body
body: body,
context: res.awsContext
});

@@ -118,6 +138,10 @@ })

// Otherwise just send the response.
if (options.noEnvelope) {
return callback(null, body);
}
callback(null, {
statusCode: statusCode,
headers: headers,
body: body
body: body,
context: res.awsContext
});

@@ -138,2 +162,8 @@ }

if (err) {
if (options.noEnvelope) {
return callback(null, {
event: event,
error: err.stack
})
}
callback(null,{

@@ -163,2 +193,8 @@ statusCode: 500,

catch (e) {
if (options.noEnvelope) {
return callback(null, {
event: event,
error: err.stack
})
}
callback(null,{

@@ -165,0 +201,0 @@ statusCode: 500,

2

package.json
{
"name": "baggywrinkle",
"version": "1.3.0",
"version": "1.4.0",
"description": "Run a machine from an AWS Lambda function.",

@@ -5,0 +5,0 @@ "main": "index.js",

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