deep-core
Advanced tools
Comparing version 1.8.2 to 1.8.3
@@ -17,9 +17,9 @@ /** | ||
/** | ||
* @param {Object} options | ||
* @param {Object} lambdaContext | ||
*/ | ||
function Context(options) { | ||
function Context(lambdaContext) { | ||
_classCallCheck(this, Context); | ||
this._options = options; | ||
this._lambdaContext = lambdaContext; | ||
@@ -42,4 +42,4 @@ this._registerDataAsOptions(); | ||
value: function _registerDataAsOptions() { | ||
for (let key in this._options) { | ||
if (!this._options.hasOwnProperty(key)) { | ||
for (let key in this._lambdaContext) { | ||
if (!this._lambdaContext.hasOwnProperty(key)) { | ||
continue; | ||
@@ -49,3 +49,3 @@ } | ||
Object.defineProperty(this, key, { | ||
value: this._options[key], | ||
value: this._lambdaContext[key], | ||
writable: false, | ||
@@ -72,3 +72,3 @@ configurable: false, | ||
value: function has(option) { | ||
return this._options.hasOwnProperty(option); | ||
return this._lambdaContext.hasOwnProperty(option); | ||
} | ||
@@ -87,8 +87,18 @@ | ||
return this._options.hasOwnProperty(option) ? this._options[option] : defaultValue; | ||
return this._lambdaContext.hasOwnProperty(option) ? this._lambdaContext[option] : defaultValue; | ||
} | ||
/** | ||
* Enables Callback wait for empty event loop | ||
*/ | ||
}, { | ||
key: 'waitForEmptyEventLoop', | ||
value: function waitForEmptyEventLoop() { | ||
this._lambdaContext.callbackWaitsForEmptyEventLoop = true; | ||
} | ||
}, { | ||
key: 'options', | ||
get: function get() { | ||
return this._options; | ||
return this._lambdaContext; | ||
} | ||
@@ -95,0 +105,0 @@ }]); |
@@ -69,3 +69,3 @@ /** | ||
this._runtime.context[this.constructor.contextMethod](this.data); | ||
(this._runtime.resolver || this._runtime.context)[this.constructor.contextMethod](this.data); | ||
}); | ||
@@ -72,0 +72,0 @@ |
@@ -29,2 +29,4 @@ /** | ||
var _Resolver = require('./Resolver'); | ||
var _path = require('path'); | ||
@@ -65,2 +67,3 @@ | ||
_this2._context = null; | ||
_this2._resolver = null; | ||
@@ -102,2 +105,3 @@ _this2._loggedUserId = null; | ||
* @param {Object} context | ||
* @param {Function} lambdaCallback | ||
* @returns {Runtime} | ||
@@ -109,5 +113,13 @@ */ | ||
value: function run(event, context) { | ||
let lambdaCallback = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; | ||
this._context = new _Context.Context(context); | ||
this._request = new _Request.Request(event); | ||
if (lambdaCallback) { | ||
this._resolver = new _Resolver.Resolver(lambdaCallback); | ||
} | ||
this._context.waitForEmptyEventLoop(); | ||
this.logService.rumLog({ | ||
@@ -276,2 +288,12 @@ service: 'deep-core', | ||
/** | ||
* @returns {null|Resolver} | ||
*/ | ||
}, { | ||
key: 'resolver', | ||
get: function get() { | ||
return this._resolver; | ||
} | ||
/** | ||
* @returns {Boolean} | ||
@@ -278,0 +300,0 @@ */ |
{ | ||
"name": "deep-core", | ||
"version": "1.8.2", | ||
"version": "1.8.3", | ||
"description": "DEEP Core Library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
110938
38
2703