deep-core
Advanced tools
Comparing version 1.9.12 to 1.9.13
@@ -107,3 +107,3 @@ /** | ||
this._resolver.registerSucceedCallback(() => { | ||
let db = this._kernel.get('db'); | ||
let db = this.dbService; | ||
let vogelsDynamoDriver = db.vogelsDynamoDriver; | ||
@@ -129,15 +129,17 @@ | ||
new _Sandbox.Sandbox(() => { | ||
this._fillUserContext(); | ||
this._fillUserContext().then(() => { | ||
if (!this._loggedUserId && this._forceUserIdentity) { | ||
throw new _MissingUserContextException.MissingUserContextException(); | ||
} | ||
if (!this._loggedUserId && this._forceUserIdentity) { | ||
throw new _MissingUserContextException.MissingUserContextException(); | ||
} | ||
this._initDBPartitionKey(); | ||
let validationSchema = this.validationSchema; | ||
let validationSchema = this.validationSchema; | ||
if (validationSchema) { | ||
this._runValidate(validationSchema); | ||
} else { | ||
this.handle(this._request); | ||
} | ||
if (validationSchema) { | ||
this._runValidate(validationSchema); | ||
} else { | ||
this.handle(this._request); | ||
} | ||
}).catch(e => this.createError(e).send()); | ||
}).fail(error => { | ||
@@ -251,5 +253,31 @@ this.createError(error).send(); | ||
/** | ||
* @returns {Runtime} | ||
* @private | ||
*/ | ||
}, { | ||
key: '_initDBPartitionKey', | ||
value: function _initDBPartitionKey() { | ||
if (!this.kernel.accountMicroservice) { | ||
return this; | ||
} | ||
let db = this.dbService; | ||
let user = this.securityService.token.user; | ||
let partitionKey = Runtime.DB_ANONYMOUS_PARTITION; | ||
if (user && user.ActiveAccount) { | ||
partitionKey = user.ActiveAccount.Id; | ||
} | ||
db.setDynamoDBPartitionKey(partitionKey); | ||
return this; | ||
} | ||
/** | ||
* Retrieves logged user id from lambda context | ||
* | ||
* @private | ||
* @returns {Promise} | ||
*/ | ||
@@ -264,11 +292,13 @@ | ||
if (this.securityService.identityPoolId !== identityPoolId) { | ||
throw new _InvalidCognitoIdentityException.InvalidCognitoIdentityException(identityPoolId); | ||
return Promise.reject(new _InvalidCognitoIdentityException.InvalidCognitoIdentityException(identityPoolId)); | ||
} | ||
// inject lambda context into security service | ||
// and instantiate security token without loading credentials | ||
this.securityService.warmupBackendLogin(this._context); | ||
// and instantiate security token without loading user credentials | ||
return this.securityService.warmupBackendLogin(this._context).then(() => { | ||
this._loggedUserId = this._context.identity.cognitoIdentityId; | ||
}); | ||
} | ||
this._loggedUserId = this._context.identity.cognitoIdentityId; | ||
} | ||
return Promise.resolve(null); | ||
} | ||
@@ -410,2 +440,12 @@ | ||
/** | ||
* @returns {DB} | ||
*/ | ||
}, { | ||
key: 'dbService', | ||
get: function get() { | ||
return this.kernel.get('db'); | ||
} | ||
/** | ||
* @returns {Object} | ||
@@ -420,2 +460,12 @@ */ | ||
}], [{ | ||
key: 'DB_ANONYMOUS_PARTITION', | ||
get: function get() { | ||
return 'anonymous'; | ||
} | ||
/** | ||
* @returns {String} | ||
*/ | ||
}, { | ||
key: 'VALIDATION_SCHEMAS_DIR', | ||
@@ -422,0 +472,0 @@ get: function get() { |
{ | ||
"name": "deep-core", | ||
"version": "1.9.12", | ||
"version": "1.9.13", | ||
"description": "DEEP Core Library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
116701
2865