nats-hemera
Advanced tools
Comparing version 5.8.9 to 6.0.0
@@ -13,3 +13,5 @@ const Joi = require('joi') | ||
// Enables pretty log formatter in Pino default logger | ||
prettyLog: Joi.boolean().default(true), | ||
prettyLog: Joi.alternatives() | ||
.try(Joi.boolean(), Joi.object()) | ||
.default(false), | ||
// The name of the instance | ||
@@ -27,17 +29,3 @@ name: Joi.string().default(`hemera-${Os.hostname()}-${Util.randomId()}`), | ||
// Custom logger | ||
logger: Joi.alternatives().try( | ||
Joi.object() | ||
.keys({ | ||
info: Joi.func(), | ||
error: Joi.func(), | ||
debug: Joi.func(), | ||
fatal: Joi.func(), | ||
warn: Joi.func(), | ||
trace: Joi.func(), | ||
child: Joi.func() | ||
}) | ||
.requiredKeys('info', 'error', 'debug', 'fatal', 'warn', 'trace') | ||
.unknown(), | ||
Joi.object().type(Stream) | ||
), | ||
logger: Joi.alternatives().try(Joi.object(), Joi.object().type(Stream)), | ||
// Attach trace and request informations to the logs. It costs ~10% perf | ||
@@ -44,0 +32,0 @@ traceLog: Joi.boolean().default(false), |
@@ -216,3 +216,3 @@ 'use strict' | ||
name: this._config.name, | ||
safe: true, // handle circular refs | ||
prettyPrint: this._config.prettyLog, | ||
level: this._config.logLevel | ||
@@ -225,8 +225,3 @@ } | ||
} else { | ||
const pretty = this._config.prettyLog ? Pino.pretty() : undefined | ||
this.log = Pino(loggerOpts, pretty) | ||
// Leads to too much listeners in tests | ||
if (pretty && this._config.logLevel !== 'silent') { | ||
pretty.pipe(process.stdout) | ||
} | ||
this.log = Pino(loggerOpts) | ||
} | ||
@@ -882,2 +877,3 @@ } | ||
self.emit('serverResponseError', extensionError) | ||
self.reply.isError = true | ||
self.reply.send(extensionError) | ||
@@ -907,2 +903,3 @@ return | ||
self.emit('serverResponseError', internalError) | ||
self.reply.isError = true | ||
self.reply.send(internalError) | ||
@@ -928,2 +925,3 @@ } | ||
self.emit('serverResponseError', extensionError) | ||
self.reply.isError = true | ||
self.reply.send(extensionError) | ||
@@ -955,2 +953,3 @@ return | ||
self.emit('serverResponseError', err) | ||
self.reply.isError = true | ||
self.reply.send(err) | ||
@@ -969,3 +968,3 @@ return | ||
err => { | ||
self._isValidError(err) | ||
self.reply.isError = true | ||
self.reply.send(err) | ||
@@ -996,3 +995,3 @@ } | ||
if (err) { | ||
self._isValidError(err) | ||
self.reply.isError = true | ||
self.reply.send(err) | ||
@@ -1006,16 +1005,2 @@ return | ||
/** | ||
* | ||
* @param {*} err | ||
*/ | ||
_isValidError(err) { | ||
if (!(err instanceof Error)) { | ||
this.log.error( | ||
new Errors.HemeraError( | ||
`Response error must be derivated from type 'Error' but got '${typeof err}'` | ||
) | ||
) | ||
} | ||
} | ||
/** | ||
* Unsubscribe a topic or subscription id from NATS and Hemera | ||
@@ -1022,0 +1007,0 @@ * |
@@ -38,2 +38,3 @@ 'use strict' | ||
this.sent = false | ||
this.isError = false | ||
} | ||
@@ -106,2 +107,10 @@ | ||
if (!(msg instanceof Error) && self.isError === true) { | ||
const internalError = new Errors.HemeraError( | ||
`Response error must be derivated from type 'Error' but got '${typeof msg}'` | ||
) | ||
self.log.error(internalError) | ||
return | ||
} | ||
self.sent = true | ||
@@ -113,3 +122,5 @@ | ||
self.error = msg | ||
self.payload = null | ||
} else { | ||
self.error = null | ||
self.payload = msg | ||
@@ -116,0 +127,0 @@ } |
{ | ||
"name": "nats-hemera", | ||
"author": "Dustin Deus (https://github.com/StarpTech)", | ||
"version": "5.8.9", | ||
"version": "6.0.0", | ||
"main": "lib/index.js", | ||
@@ -52,3 +52,3 @@ "homepage": "https://hemerajs.github.io/hemera/", | ||
"joi": "11.1.x", | ||
"pino": "4.17.x", | ||
"pino": "5.0.x", | ||
"super-error": "2.2.x", | ||
@@ -55,0 +55,0 @@ "tinysonic": "1.3.x" |
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
83360
3178
+ Addedfast-redact@1.5.0(transitive)
+ Addedpino@5.0.5(transitive)
+ Addedquick-format-unescaped@3.0.3(transitive)
+ Addedsonic-boom@0.6.3(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedfast-safe-stringify@1.2.3(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@1.0.0(transitive)
- Removedpino@4.17.6(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedquick-format-unescaped@1.1.2(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsplit2@2.2.0(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedthrough2@2.0.5(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedxtend@4.0.2(transitive)
Updatedpino@5.0.x