Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nats-hemera

Package Overview
Dependencies
Maintainers
1
Versions
279
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nats-hemera - npm Package Compare versions

Comparing version 5.8.9 to 6.0.0

20

lib/configScheme.js

@@ -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),

31

lib/index.js

@@ -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"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc