@haventech/supertype
Advanced tools
Comparing version 6.0.1 to 6.1.0-beta.0
@@ -119,3 +119,6 @@ "use strict"; | ||
} | ||
this.setLogsAmorphicContext(logObj.context); | ||
if (!logObj.request) { | ||
logObj.request = {}; | ||
} | ||
this.setLogsAmorphicContext(logObj.context, logObj.request); | ||
logObj['level'] = level; | ||
@@ -133,17 +136,24 @@ if (this.isEnabled(levelToStr[logObj['level']], logObj)) { | ||
}; | ||
//This method extracts sessionId from the each request's context | ||
//and places it in the context.sessionId. All other context properties are | ||
//placed in context.data object. | ||
SupertypeLogger.prototype.setLogsAmorphicContext = function (object) { | ||
//This method extracts sessionId from the each request's context | ||
// and places it in the context.sessionId. All other context properties are | ||
// placed in context.data object. | ||
SupertypeLogger.prototype.setLogsAmorphicContext = function (context, request) { | ||
if (this.context && Object.keys(this.context).length > 0) { | ||
if (!object.data) { | ||
object.data = {}; | ||
if (!context.data) { | ||
context.data = {}; | ||
} | ||
if (typeof object.data === 'object') { | ||
if (typeof context.data === 'object') { | ||
var sessionId = this.context.session; | ||
object.data[this._amorphicContext] = __assign({}, this.context); | ||
if (object.data[this._amorphicContext] && sessionId) { | ||
object.data[this._amorphicContext].session = sessionId; | ||
delete object.data[this._amorphicContext].session; | ||
if (!context.sessionId) { | ||
context.sessionId = sessionId; | ||
} | ||
context.data[this._amorphicContext] = __assign({}, this.context); | ||
if (context.data[this._amorphicContext] && sessionId) { | ||
context.data[this._amorphicContext].session = sessionId; | ||
delete context.data[this._amorphicContext].session; | ||
} | ||
if (context.data[this._amorphicContext] && context.data[this._amorphicContext].ipaddress) { | ||
request.clientIpAddress = context.data[this._amorphicContext].ipaddress; | ||
delete context.data[this._amorphicContext].ipaddress; | ||
} | ||
} | ||
@@ -334,2 +344,2 @@ } | ||
exports.SupertypeLogger = SupertypeLogger; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU3VwZXJ0eXBlTG9nZ2VyLmpzIiwic291cmNlUm9vdCI6I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IGFuZCB0aGUgc2Vjb25kIG9uZSBtaWdodCBiZSBhbiBvYmplY3QgKHNpbWlsYXIgdG8gYmFueWFuKVxuICAgIHByaXZhdGUgbG9nKGxldmVsOiBudW1iZXIsIC4uLmFyZ3M6IGFueVtdKTogdm9pZCB7XG4gICAgICAgIGNvbnN0IHByb3BlcnRpZXM6IGFueVtdID0gYXJncyAmJiBBcnJheS5pc0FycmF5KGFyZ3MpID8gYXJncy5zbGljZSgpIDogYXJncztcblxuICAgICAgICBpZiAodHlwZW9mIHByb3BlcnRpZXNbMF0gPT09ICdvYmplY3QnKSAge1xuICAgICAgICAgICAgbGV0IGxvZ09iaiA9IHByb3BlcnRpZXNbMF07XG4gICAgICAgICAgICBpZiAoIWxvZ09iai5kYXRhKSB7XG4gICAgICAgICAgICAgICAgbG9nT2JqLmRhdGEgPSB7fTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICghbG9nT2JqLmNvbnRleHQpIHtcbiAgICAgICAgICAgICAgICBsb2dPYmouY29udGV4dCA9IHt9O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aGlzLnNldExvZ3NBbW9ycGhpY0NvbnRleHQobG9nT2JqLmNvbnRleHQpO1xuXG4gICAgICAgICAgICBsb2dPYmpbJ2xldmVsJ10gPSBsZXZlbDtcbiAgICAgICAgICAgIGlmICh0aGlzLmlzRW5hYmxlZChsZXZlbFRvU3RyW2xvZ09ialsnbGV2ZWwnXV0sIGxvZ09iaikpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnNlbmRUb0xvZyhsZXZlbFRvU3RyW2xvZ09ialsnbGV2ZWwnXV0sIGxvZ09iaiwgLi4ucHJvcGVydGllcy5zbGljZSgxKSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBwcm9wZXJ0aWVzWydsZXZlbCddID0gbGV2ZWw7XG4gICAgICAgIGlmICh0aGlzLmlzRW5hYmxlZChsZXZlbF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ZW5ndGg7ICsraXgpIHtcbiAgICAgICAgICAgIHZhciBsZXZlbGEgPSBsZXZlbHNbaXhdO1xuXG4gICAgICAgICAgICBpZiAobGV2ZWxhLm1hdGNoKC86LykpIHtcbiAgICAgICAgICAgICAgICBpZiAobGV2ZWxzW2l4XS5tYXRjaCgvKC4qKTooLiopLykpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5ncmFudWxhckxldmVsc1tSZWdFeHAuJDFdID0gdGhpcy5ncmFudWxhckxldmVsc1tSZWdFeHAuJDFdIHx8IHt9O1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmdyYW51bGFyTGV2ZWxzW1JlZ0V4cC4kMV0gPSBSZWdFeHAuJDI7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxldmVsID0gbGV2ZWxzW2l4XTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aGlzLmxldmVsID0gbGV2ZWxhO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgLy8gUmVtb3ZlIGFueSBwcm9wZXJ0aWVzIHJlY29yZGVkIGJ5IHNldENvbnRleHRcbiAgICBjbGVhckNvbnRleHRQcm9wcyhjb250ZXh0VG9DbGVhcikge1xuICAgICAgICBmb3IgKGNvbnN0IHByb3AgaW4gY29udGV4dFRvQ2xlYXIpIHtcbiAgICAgICAgICAgIGRlbGV0ZSB0aGlzLmNvbnRleHRbcHJvcF07XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICAvLyBDcmVhdGUgYSBuZXcgbG9nZ2VyIGFuZCBjb3B5IG92ZXIgaXQncyBjb250ZXh0XG4gICAgY3JlYXRlQ2hpbGRMb2dnZXIoY29udGV4dCwgcm9vdFZhbHVlcz8sIGRhdGFWYWx1ZXM/KTogU3VwZXJ0eXBlTG9nZ2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AgICAgICAgICAgICAgdGhpcy5fY2xpZW50TG9nZ2VyLmluZm8obG9nT2JqZWN0LCAuLi5yYXdMb2dEYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIGNhc2UgNDA6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX2NsaWVudExvZ2dlci53YXJuKGxvZ09iamVjdCwgLi4ucmF3TG9nRGF0YSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICBjYXNlIDYwOlxuICAgICAgICAgICAgICAgIGNhc2UgNTA6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX2NsaWVudExvZ2dlci5lcnJvcihsb2dPYmplY3QsIC4uLnJhd0xvZ0RhdGEpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgZGVmYXVsdDogXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX2NsaWVudExvZ2dlci5lcnJvcih7XG4gICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGU6IFN1cGVydHlwZUxvZ2dlci5tb2R1bGVOYW1lLFxuICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb246IGZ1bmN0aW9uTmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVnb3J5OiAnbWlsZXN0b25lJyxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdpbnZhbGlkIGxldmVsIHVzZWQnLFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YToge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZ0xldmVsOiBsb2dMZXZlbCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2dPYmplY3Q6IGxvZ09iamVjdFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGNvbnNvbGUubG9nKHRoaXMucHJldHR5UHJpbnQobG9nTGV2ZWwsIGxvZ09iamVjdCkpOyAgICAgLy8gZXNsaW50LWRpc2FibGUtbGluZSBuby1jb25zb2xlXG4gICAgfVxuXG4gICAgcHJldHR5UHJpbnQobGV2ZWwsIGpzb24pIHtcbiAgICAgICAgbGV0IHNwbGl0ID0gdGhpcy5zcGxpdChqc29uLCB7dGltZTogMSwgbXNnOiAxLCBsZXZlbDogMSwgbmFtZTogMX0pO1xuXG4gICAgICAgIHJldHVybiB0aGlzLmZvcm1hdERhdGVUaW1lKGpzb24udGltZSA/IG5ldyBEYXRlKGpzb24udGltZSkgOiBuZXcgRGF0ZSgpKSArICc6ICcgK1xuICAgICAgICAgICAgbGV2ZWwudG9VcHBlckNhc2UoKSArICc6ICcgK1xuICAgICAgICAgICAgYWRkQ29sb25JZlRva2VuKHNwbGl0WzFdLm5hbWUsICc6ICcpICtcbiAgICAgICAgICAgIGFkZENvbG9uSWZUb2tlbihzcGxpdFsxXS5tc2csICc6ICcpICtcbiAgICAgICAgICAgIHh5KHNwbGl0WzBdKTtcblxuICAgICAgICBmdW5jdGlvbiBhZGRDb2xvbklmVG9rZW4gKHRva2VuLCBjb2xvbkFuZFNwYWNlKSB7XG4gICAgICAgICAgICBpZiAodG9rZW4pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdG9rZW4gKyBjb2xvbkFuZFNwYWNlO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gJyc7XG4gICAgICAgIH1cblxuICAgICAgICBmdW5jdGlvbiB4eShqKSB7XG4gICAgICAgICAgICB2YXIgc3RyID0gJyc7XG4gICAgICAgICAgICB2YXIgc2VwID0gJyc7XG5cbiAgICAgICAgICAgIGZvciAodmFyIHByb3AgaW4gaikge1xuICAgICAgICAgICAgICAgIHN0ciArPSBzZXAgKyBwcm9wICsgJz0nICsgSlNPTi5zdHJpbmdpZnkoaltwcm9wXSk7XG4gICAgICAgICAgICAgICAgc2VwID0gJyAnO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoc3RyLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gJygnICsgc3RyICsgJyknO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gJyc7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIHNwbGl0KGpzb24sIHByb3BzKTogYW55W10ge1xuICAgICAgICBjb25zdCBhID0ge307XG4gICAgICAgIGNvbnN0IGIgPSB7fTtcblxuICAgICAgICBmb3IgKGNvbnN0IHByb3AgaW4ganNvbikge1xuICAgICAgICAgICAgKHByb3BzW3Byb3BdID8gYiA6IGEpW3Byb3BdID0ganNvbltwcm9wXTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBbYSwgYl07XG4gICAgfVxuXG4gICAgLy8gTG9nZ2luZyBpcyBlbmFibGVkIGlmIGVpdGhlciB0aGUgbGV2ZWwgdGhyZXNob2xkIGlzIG1ldCBvciB0aGUgZ3JhbnVsYXIgbGV2ZWwgbWF0Y2hlc1xuICAgIHByaXZhdGUgaXNFbmFibGVkKGxldmVsLCBvYmopIHtcbiAgICAgICAgbGV2ZWwgPSBzdHJUb0xldmVsW2xldmVsXTtcblxuICAgICAgICBpZiAobGV2ZWwgPj0gc3RyVG9MZXZlbFt0aGlzLmxldmVsXSkge1xuICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodGhpcy5ncmFudWxhckxldmVscykge1xuICAgICAgICAgICAgZm9yIChsZXQgbGV2ZWxyIGluIHRoaXMuZ3JhbnVsYXJMZXZlbHMpIHtcbiAgICAgICAgICAgICAgICBpZiAob2JqW2xldmVscl0gJiYgb2JqW2xldmVscl0gPT0gdGhpcy5ncmFudWxhckxldmVsc1tsZXZlbHJdKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB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XG5cbiAgICAgICAgaWYgKHR5cGVvZiBwcm9wZXJ0aWVzWzBdID09PSAnb2JqZWN0JykgIHtcbiAgICAgICAgICAgIGxldCBsb2dPYmogPSBwcm9wZXJ0aWVzWzBdO1xuICAgICAgICAgICAgaWYgKCFsb2dPYmouZGF0YSkge1xuICAgICAgICAgICAgICAgIGxvZ09iai5kYXRhID0ge307XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIWxvZ09iai5jb250ZXh0KSB7XG4gICAgICAgICAgICAgICAgbG9nT2JqLmNvbnRleHQgPSB7fTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKCFsb2dPYmoucmVxdWVzdCkge1xuICAgICAgICAgICAgICAgIGxvZ09iai5yZXF1ZXN0ID0ge307XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRoaXMuc2V0TG9nc0Ftb3JwaGljQ29udGV4dChsb2dPYmouY29udGV4dCwgbG9nT2JqLnJlcXVlc3QpO1xuXG4gICAgICAgICAgICBsb2dPYmpbJ2xldmVsJ10gPSBsZXZlbDtcbiAgICAgICAgICAgIGlmICh0aGlzLmlzRW5hYmxlZChsZXZlbFRvU3RyW2xvZ09ialsnbGV2ZWwnXV0sIGxvZ09iaikpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnNlbmRUb0xvZyhsZXZlbFRvU3RyW2xvZ09ialsnbGV2ZWwnXV0sIGxvZ09iaiwgLi4ucHJvcGVydGllcy5zbGljZSgxKSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBwcm9wZXJ0aWVzWydsZXZlbCddID0gbGV2ZWw7XG4gICAgICAgIGlmICh0aGlzLmlzRW5hYmxlZChsZXZlbFRvU3RyW3Byb3BlcnRpZXNbJ2xldmVsJ11dLCBwcm9wZXJ0aWVzKSkge1xuICAgICAgICAgICAgdGhpcy5zZW5kVG9Mb2cobGV2ZWxUb1N0cltwcm9wZXJ0aWVzWydsZXZlbCddXSwgcHJvcGVydGllcyk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuO1xuICAgIH1cblxuICAgIC8vVGhpcyBtZXRob2QgZXh0cmFjdHMgc2Vzc2lvbklkIGZyb20gdGhlIGVhY2ggcmVxdWVzdCdzIGNvbnRleHQgXG4gICAgLy8gYW5kIHBsYWNlcyBpdCBpbiB0aGUgY29udGV4dC5zZXNzaW9uSWQuIEFsbCBvdGhlciBjb250ZXh0IHByb3BlcnRpZXMgYXJlIFxuICAgIC8vIHBsYWNlZCBpbiBjb250ZXh0LmRhdGEgb2JqZWN0LlxuICAgIHByaXZhdGUgc2V0TG9nc0Ftb3JwaGljQ29udGV4dChjb250ZXh0OiBhbnksIHJlcXVlc3Q6IGFueSkge1xuICAgICAgICBpZiAodGhpcy5jb250ZXh0ICYmIE9iamVjdC5rZXlzKHRoaXMuY29udGV4dCkubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgaWYgKCFjb250ZXh0LmRhdGEpIHtcbiAgICAgICAgICAgICAgICBjb250ZXh0LmRhdGEgPSB7fTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh0eXBlb2YgY29udGV4dC5kYXRhID09PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgIGNvbnN0IHNlc3Npb25JZCA9IHRoaXMuY29udGV4dC5zZXNzaW9uO1xuICAgICAgICAgICAgICAgIGlmICghY29udGV4dC5zZXNzaW9uSWQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29udGV4dC5zZXNzaW9uSWQgPSBzZXNzaW9uSWQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvbnRleHQuZGF0YVt0aGlzLl9hbW9ycGhpY0NvbnRleHRdID0geyAuLi50aGlzLmNvbnRleHQgfTtcbiAgICAgICAgICAgICAgICBpZiAoY29udGV4dC5kYXRhW3RoaXMuX2Ftb3JwaGljQ29udGV4dF0gJiYgc2Vzc2lvbklkKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnRleHQuZGF0YVt0aGlzLl9hbW9ycGhpY0NvbnRleHRdLnNlc3Npb24gPSBzZXNzaW9uSWQ7XG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBjb250ZXh0LmRhdGFbdGhpcy5fYW1vcnBoaWNDb250ZXh0XS5zZXNzaW9uO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoY29udGV4dC5kYXRhW3RoaXMuX2Ftb3JwaGljQ29udGV4dF0gJiYgY29udGV4dC5kYXRhW3RoaXMuX2Ftb3JwaGljQ29udGV4dF0uaXBhZGRyZXNzKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlcXVlc3QuY2xpZW50SXBBZGRyZXNzID0gY29udGV4dC5kYXRhW3RoaXMuX2Ftb3JwaGljQ29udGV4dF0uaXBhZGRyZXNzO1xuICAgICAgICAgICAgICAgICAgICBkZWxldGUgY29udGV4dC5kYXRhW3RoaXMuX2Ftb3JwaGljQ29udGV4dF0uaXBhZGRyZXNzO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGdldEFtb3JwaGljQ29udGV4dCgpOiBhbnkge1xuICAgICAgICByZXR1cm4geyBfX2Ftb3JwaGljQ29udGV4dDogeyAuLi50aGlzLmNvbnRleHQgfSB9O1xuICAgIH1cblxuICAgIHN0YXJ0Q29udGV4dChjb250ZXh0KSB7XG4gICAgICAgIHRoaXMuY29udGV4dCA9IGNvbnRleHQ7XG4gICAgfVxuXG4gICAgLy8gU2F2ZSB0aGUgcHJvcGVydGllcyBpbiB0aGUgY29udGV4dCBhbmQgcmV0dXJuIGEgbmV3IG9iamVjdCB0aGF0IGhhcyB0aGUgcHJvcGVydGllcyBvbmx5IHNvIHRoZXkgY2FuIGJlIGNsZWFyZWRcbiAgICBzZXRDb250ZXh0UHJvcHMoY29udGV4dCkge1xuICAgICAgICBjb25zdCByZXZlcnNlID0ge307XG5cbiAgICAgICAgZm9yIChjb25zdCBwcm9wIGluIGNvbnRleHQpIHtcbiAgICAgICAgICAgIHJldmVyc2VbcHJvcF0gPSB0cnVlO1xuICAgICAgICAgICAgdGhpcy5jb250ZXh0W3Byb3BdID0gY29udGV4dFtwcm9wXTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiByZXZlcnNlO1xuICAgIH1cbiAgICAvLyBQYXJzZSBsb2cgbGV2ZWxzIHN1Y2ggYXMgd2Fybi5hY3Rpdml0eVxuICAgIHNldExldmVsKGxldmVsKSB7XG4gICAgICAgIHZhciBsZXZlbHMgPSBsZXZlbC5zcGxpdCgnOycpO1xuXG4gICAgICAgIGZvciAodmFyIGl4ID0gMDsgaXggPCBsZXZlbHMubGVuZ3RoOyArK2l4KSB7XG4gICAgICAgICAgICB2YXIgbGV2ZWxhID0gbGV2ZWxzW2l4XTtcblxuICAgICAgICAgICAgaWYgKGxldmVsYS5tYXRjaCgvOi8pKSB7XG4gICAgICAgICAgICAgICAgaWYgKGxldmVsc1tpeF0ubWF0Y2goLyguKik6KC4qKS8pKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZ3JhbnVsYXJMZXZlbHNbUmVnRXhwLiQxXSA9IHRoaXMuZ3JhbnVsYXJMZXZlbHNbUmVnRXhwLiQxXSB8fCB7fTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5ncmFudWxhckxldmVsc1tSZWdFeHAuJDFdID0gUmVnRXhwLiQyO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sZXZlbCA9IGxldmVsc1tpeF07XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgdGhpcy5sZXZlbCA9IGxldmVsYTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8vIFJlb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AgICAgICAgICAgIGNoaWxkID0gY2hpbGRMb2dnZXI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIGlmICh0aGlzLl9jbGllbnRMb2dnZXIuY2hpbGQgPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgICAgICBjaGlsZExvZ2dlciA9IHRoaXMuX2NsaWVudExvZ2dlci5jaGlsZCh7Li4ucm9vdFZhbHVlcywgZGF0YToge2RhdGFWYWx1ZXN9fSk7XG4gICAgICAgICAgICAgICAgY2hpbGQgPSBjaGlsZExvZ2dlcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBjaGlsZCBhcyBTdXBlcnR5cGVMb2dnZXI7IC8vIGJhZCBwcmFjdGljZSBidXQgc2hvdWxkIGZpeFxuICAgIH1cblxuICAgIGZvcm1hdERhdGVUaW1lKGRhdGUpOiBzdHJpbmcge1xuICAgICAgICByZXR1cm4gZigyLCAoZGF0ZS5nZXRNb250aCgpICsgMSksICcvJykgKyBmKDIsIGRhdGUuZ2V0RGF0ZSgpLCAnLycpICsgZig0LCBkYXRlLmdldEZ1bGxZZWFyKCksICcgJykgK1xuICAgICAgICAgICAgZigyLCBkYXRlLmdldEhvdXJzKCksICc6JykgKyBmKDIsIGRhdGUuZ2V0TWludXRlcygpLCAnOicpICsgZigyLCBkYXRlLmdldFNlY29uZHMoKSwgJzonKSArXG4gICAgICAgICAgICBmKDMsIGRhdGUuZ2V0TWlsbGlzZWNvbmRzKCkpICsgJyBHTVQnICsgKDAgLSBkYXRlLmdldFRpbWV6b25lT2Zmc2V0KCkgLyA2MCk7XG5cbiAgICAgICAgZnVuY3Rpb24gZih6LCBkLCBzPykge1xuICAgICAgICAgICAgd2hpbGUgKFN0cmluZyhkKS5sZW5ndGggPCB6KSB7XG4gICAgICAgICAgICAgICAgZCA9ICcwJyArIGQ7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBkICsgKHMgfHwgJ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bGV0IGxldmVsRm9yTG9nID0gdHlwZW9mIGxvZ0xldmVsID09PSAnc3RyaW5nJyA/IHN0clRvTGV2ZWxbbG9nTGV2ZWxdIDogbG9nTGV2ZWw7XG4gICAgICAgICAgICBzd2l0Y2ggKGxldmVsRm9yTG9nKSB7XG4gICAgICAgICAgICAgICAgY2FzZSAxMDpcbiAgICAgICAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLl9jbGllbnRMb2dnZXIuZGVidWcobG9nT2JqZWN0LCAuLi5yYXdMb2dEYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIGNhc2UgMzA6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX2NsaWVudExvZ2dlci5pbmZvKGxvZ09iamVjdCwgLi4ucmF3TG9nRGF0YSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICBjYXNlIDQwOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLl9jbGllbnRMb2dnZXIud2Fybihsb2dPYmplY3QsIC4uLnJhd0xvZ0RhdGEpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgY2FzZSA2MDpcbiAgICAgICAgICAgICAgICBjYXNlIDUwOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLl9jbGllbnRMb2dnZXIuZXJyb3IobG9nT2JqZWN0LCAuLi5yYXdMb2dEYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIGRlZmF1bHQ6IFxuICAgICAgICAgICAgICAgICAgICB0aGlzLl9jbGllbnRMb2dnZXIuZXJyb3Ioe1xuICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlOiBTdXBlcnR5cGVMb2dnZXIubW9kdWxlTmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uOiBmdW5jdGlvbk5hbWUsXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXRlZ29yeTogJ21pbGVzdG9uZScsXG4gICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiAnaW52YWxpZCBsZXZlbCB1c2VkJyxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2dMZXZlbDogbG9nTGV2ZWwsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nT2JqZWN0OiBsb2dPYmplY3RcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBjb25zb2xlLmxvZyh0aGlzLnByZXR0eVByaW50KGxvZ0xldmVsLCBsb2dPYmplY3QpKTsgICAgIC8vIGVzbGludC1kaXNhYmxlLWxpbmUgbm8tY29uc29sZVxuICAgIH1cblxuICAgIHByZXR0eVByaW50KGxldmVsLCBqc29uKSB7XG4gICAgICAgIGxldCBzcGxpdCA9IHRoaXMuc3BsaXQoanNvbiwge3RpbWU6IDEsIG1zZzogMSwgbGV2ZWw6IDEsIG5hbWU6IDF9KTtcblxuICAgICAgICByZXR1cm4gdGhpcy5mb3JtYXREYXRlVGltZShqc29uLnRpbWUgPyBuZXcgRGF0ZShqc29uLnRpbWUpIDogbmV3IERhdGUoKSkgKyAnOiAnICtcbiAgICAgICAgICAgIGxldmVsLnRvVXBwZXJDYXNlKCkgKyAnOiAnICtcbiAgICAgICAgICAgIGFkZENvbG9uSWZUb2tlbihzcGxpdFsxXS5uYW1lLCAnOiAnKSArXG4gICAgICAgICAgICBhZGRDb2xvbklmVG9rZW4oc3BsaXRbMV0ubXNnLCAnOiAnKSArXG4gICAgICAgICAgICB4eShzcGxpdFswXSk7XG5cbiAgICAgICAgZnVuY3Rpb24gYWRkQ29sb25JZlRva2VuICh0b2tlbiwgY29sb25BbmRTcGFjZSkge1xuICAgICAgICAgICAgaWYgKHRva2VuKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRva2VuICsgY29sb25BbmRTcGFjZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuICcnO1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuY3Rpb24geHkoaikge1xuICAgICAgICAgICAgdmFyIHN0ciA9ICcnO1xuICAgICAgICAgICAgdmFyIHNlcCA9ICcnO1xuXG4gICAgICAgICAgICBmb3IgKHZhciBwcm9wIGluIGopIHtcbiAgICAgICAgICAgICAgICBzdHIgKz0gc2VwICsgcHJvcCArICc9JyArIEpTT04uc3RyaW5naWZ5KGpbcHJvcF0pO1xuICAgICAgICAgICAgICAgIHNlcCA9ICcgJztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKHN0ci5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuICcoJyArIHN0ciArICcpJztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuICcnO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBzcGxpdChqc29uLCBwcm9wcyk6IGFueVtdIHtcbiAgICAgICAgY29uc3QgYSA9IHt9O1xuICAgICAgICBjb25zdCBiID0ge307XG5cbiAgICAgICAgZm9yIChjb25zdCBwcm9wIGluIGpzb24pIHtcbiAgICAgICAgICAgIChwcm9wc1twcm9wXSA/IGIgOiBhKVtwcm9wXSA9IGpzb25bcHJvcF07XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gW2EsIGJdO1xuICAgIH1cblxuICAgIC8vIExvZ2dpbmcgaXMgZW5hYmxlZCBpZiBlaXRoZXIgdGhlIGxldmVsIHRocmVzaG9sZCBpcyBtZXQgb3IgdGhlIGdyYW51bGFyIGxldmVsIG1hdGNoZXNcbiAgICBwcml2YXRlIGlzRW5hYmxlZChsZXZlbCwgb2JqKSB7XG4gICAgICAgIGxldmVsID0gc3RyVG9MZXZlbFtsZXZlbF07XG5cbiAgICAgICAgaWYgKGxldmVsID49IHN0clRvTGV2ZWxbdGhpcy5sZXZlbF0pIHtcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHRoaXMuZ3JhbnVsYXJMZXZlbHMpIHtcbiAgICAgICAgICAgIGZvciAobGV0IGxldmVsciBpbiB0aGlzLmdyYW51bGFyTGV2ZWxzKSB7XG4gICAgICAgICAgICAgICAgaWYgKG9ialtsZXZlbHJdICYmIG9ialtsZXZlbHJdID09IHRoaXMuZ3JhbnVsYXJMZXZlbHNbbGV2ZWxyXSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59Il19 |
{ | ||
"name": "@haventech/supertype", | ||
"description": "A type system for classical inheritence, mix-ins and composition.", | ||
"version": "6.0.1", | ||
"version": "6.1.0-beta.0", | ||
"main": "dist/index.js", | ||
@@ -20,3 +20,3 @@ "types": "dist/index.d.ts", | ||
"eslint": "8.8.0", | ||
"mocha": "9.2.0", | ||
"mocha": "10.0.0", | ||
"mock-fs": "5.1.2", | ||
@@ -23,0 +23,0 @@ "nyc": "15.1.0", |
@@ -86,4 +86,8 @@ const levelToStr = { 60: 'fatal', 50: 'error', 40: 'warn', 30: 'info', 20: 'debug', 10: 'trace' }; | ||
this.setLogsAmorphicContext(logObj.context); | ||
if (!logObj.request) { | ||
logObj.request = {}; | ||
} | ||
this.setLogsAmorphicContext(logObj.context, logObj.request); | ||
logObj['level'] = level; | ||
@@ -103,17 +107,24 @@ if (this.isEnabled(levelToStr[logObj['level']], logObj)) { | ||
//This method extracts sessionId from the each request's context | ||
//and places it in the context.sessionId. All other context properties are | ||
//placed in context.data object. | ||
private setLogsAmorphicContext(object) { | ||
//This method extracts sessionId from the each request's context | ||
// and places it in the context.sessionId. All other context properties are | ||
// placed in context.data object. | ||
private setLogsAmorphicContext(context: any, request: any) { | ||
if (this.context && Object.keys(this.context).length > 0) { | ||
if (!object.data) { | ||
object.data = {}; | ||
if (!context.data) { | ||
context.data = {}; | ||
} | ||
if (typeof object.data === 'object'){ | ||
if (typeof context.data === 'object') { | ||
const sessionId = this.context.session; | ||
object.data[this._amorphicContext] = { ...this.context }; | ||
if (object.data[this._amorphicContext] && sessionId) { | ||
object.data[this._amorphicContext].session = sessionId; | ||
delete object.data[this._amorphicContext].session; | ||
if (!context.sessionId) { | ||
context.sessionId = sessionId; | ||
} | ||
context.data[this._amorphicContext] = { ...this.context }; | ||
if (context.data[this._amorphicContext] && sessionId) { | ||
context.data[this._amorphicContext].session = sessionId; | ||
delete context.data[this._amorphicContext].session; | ||
} | ||
if (context.data[this._amorphicContext] && context.data[this._amorphicContext].ipaddress) { | ||
request.clientIpAddress = context.data[this._amorphicContext].ipaddress; | ||
delete context.data[this._amorphicContext].ipaddress; | ||
} | ||
} | ||
@@ -120,0 +131,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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
391654
4744
1