lambda-wrapper
Advanced tools
Comparing version 0.0.1 to 0.0.2
56
index.js
// Pseudowrapper for AWS Lambda | ||
// | ||
var lambdaModule; | ||
var _runner = function(event, callbackFn) { | ||
if (!lambdaModule) { | ||
return callbackFn('Module not initialized',null); | ||
} | ||
var _runner = function(event, callback) { | ||
if (!lambdaModule) { | ||
return callback('Module not initialized', null); | ||
} | ||
var lambdacontext = { | ||
succeed : function(success) { | ||
return callbackFn(null, success); | ||
}, | ||
fail : function(error) { | ||
return callbackFn(error,null); | ||
} | ||
}; | ||
try { | ||
lambdaModule.handler(event, lambdacontext); | ||
} catch (ex) { | ||
callbackFn('Exception:' + ex.toString()); | ||
} | ||
var lambdacontext = { | ||
succeed: function(success) { | ||
return callback(null, success); | ||
}, | ||
fail: function(error) { | ||
return callback(error, null); | ||
} | ||
}; | ||
try { | ||
lambdaModule.handler(event, lambdacontext); | ||
} catch (ex) { | ||
callback('Exception:' + ex.toString()); | ||
} | ||
}; | ||
@@ -27,18 +27,6 @@ | ||
module.exports = exports = { | ||
init : function(modName) { | ||
if (!modName) { | ||
modName = ''; | ||
} | ||
try { | ||
lambdaModule = require(modName); | ||
// Return the module; | ||
return this; | ||
} catch(ex) { | ||
lambdaModule = require(process.cwd() + '/' + modName); | ||
return this; | ||
} | ||
return null; | ||
}, | ||
run: _runner | ||
init: function(mod) { | ||
lambdaModule = mod; | ||
}, | ||
run: _runner | ||
}; |
{ | ||
"name": "lambda-wrapper", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Wrapper for running Amazon Lambda modules locally", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,7 +8,5 @@ # lambda-wrapper | ||
// Loads the default module defined in package.json | ||
var lambda = require('lambda-wrapper').init(); | ||
// Loads the module in myModule/mymod.js | ||
var lambda = require('lambda-wrapper').init('myModule/mymod.js'); | ||
var lambdaFunc = require('myModule/mymod.js'); | ||
var lambda = require('lambda-wrapper').init(lambdaFunc); | ||
@@ -27,2 +25,4 @@ ### Running the function in the Lambda module | ||
* 2015/09/01 - v0.0.2 - Pass module object rather than path to init(). | ||
Removed automatic loading of module. | ||
* 2015/07/23 - v0.0.1 - Initial version of module | ||
@@ -29,0 +29,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
4866
7
0
27