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

lambda-local

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-local - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

test/test.js

10

CHANGELOG.md
# ChangeLog
## 0.0.8 (2016/4/9)
* Added support for all propertiesin the Context object.
Supporting everything in here:
https://docs.aws.amazon.com/en_us/lambda/latest/dg/nodejs-prog-model-context.html
* Wrote a mocha unit test for the Context object.
## 0.0.7 (2016/2/21)
* Minor bug fix: Now correctly outputs the error object when Context.done() has an error.
## 0.0.6 (2015/11/13)

@@ -4,0 +14,0 @@ * Added support for `fail` and `succeed` methods

54

lib/context.js
/*
* Creating Lambda's context object
* Lambda's Context object.
* Refer to this documentation:
* https://docs.aws.amazon.com/en_us/lambda/latest/dg/nodejs-prog-model-context.html
*/

@@ -13,2 +15,8 @@

/*
* Used to determine the getRemainingTimeInMillis()
*/
var start_time;
var timeout;
function Context () {};

@@ -20,3 +28,17 @@

module.exports = Context;
/*
* Context object properties
*/
Context.functionName = '';
Context.functionVersion = '1';
Context.invokedFunctionArn = 'a';
Context.memoryLimitInMB = 1;
Context.awsRequestId = '';
Context.logGroupName = 'a';
Context.logStreamName = null;
Context.identity = null;
Context.clientContext = null;
/*
* create random invokeid.

@@ -26,3 +48,3 @@ * Assuming that invokeid follows the format:

*/
Context.invokeid = (function(){
Context.createInvokeId = (function(){
return [

@@ -38,2 +60,19 @@ utils.generateRandomHex(8),

/*
* Context initialization.
* Called from lambda-local
*/
Context._initialize = function(options){
/* set time */
start_time = new Date().getTime();
timeout = options.timeoutMs;
/* set function name */
Context.functionName = options.functionName;
/* set requestid */
Context.awsRequestId = options.awsRequestId;
return;
}
/*
* This `done` method is directly extracted from source.

@@ -62,2 +101,3 @@ */

Context.fail = function (err) {
console.log("FAILING!!");
Context.done(err);

@@ -72,1 +112,11 @@ };

};
/*
* 'getRemainingTimeInMillis' method return time before task is killed
*/
Context.getRemainingTimeInMillis = function () {
var now = new Date().getTime();
return (timeout + start_time - now);
};

5

package.json
{
"name": "lambda-local",
"version": "0.0.7",
"version": "0.0.8",
"description": "Commandline tool to run Lambda functions on your local machine.",

@@ -11,3 +11,4 @@ "author": "ashiina",

"aws-sdk": "^2.1.6",
"commander": "^2.6.0"
"commander": "^2.6.0",
"mocha": "^2.4.5"
},

@@ -14,0 +15,0 @@ "preferGlobal": true,

Sorry, the diff of this file is not supported yet

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