@nxtedition/lib 15.0.20 → 15.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app.js CHANGED
@@ -98,14 +98,13 @@ module.exports = function (appConfig, onTerminate) {
98
98
  // process.env.name is the pm2 name of the process
99
99
  appConfig.instanceId ?? appConfig.containerId ?? process.env.name ?? os.hostname()
100
100
 
101
- const userAgent = globalThis.userAgent = (
101
+ const userAgent = (globalThis.userAgent =
102
102
  appConfig.userAgent ??
103
103
  (serviceName &&
104
104
  `${serviceName}/${
105
105
  serviceVersion || '*'
106
106
  } (module:${serviceModule}; instance:${serviceInstanceId}) Node/${process.version}`) ??
107
- null
108
- )
107
+ null)
109
108
 
110
109
  const terminate = async (finalLogger) => {
111
110
  finalLogger ??= logger
@@ -685,7 +684,6 @@ module.exports = function (appConfig, onTerminate) {
685
684
  // const undici = require('undici')
686
685
  const compose = require('koa-compose')
687
686
  const { createServer } = require('./http')
688
- const createError = require('http-errors')
689
687
 
690
688
  const httpConfig = { ...appConfig.http, ...config.http }
691
689
 
@@ -731,12 +729,6 @@ module.exports = function (appConfig, onTerminate) {
731
729
  return next()
732
730
  }
733
731
  },
734
- (ctx, next) => {
735
- if (toobusy && toobusy()) {
736
- throw new createError.ServiceUnavailable('too busy')
737
- }
738
- return next()
739
- },
740
732
  appConfig.http.request
741
733
  ? appConfig.http.request
742
734
  : typeof appConfig.http === 'function'
package/errors.js CHANGED
@@ -50,6 +50,10 @@ module.exports.serializeError = function serializeError(error) {
50
50
  return serializeError({ message: error })
51
51
  }
52
52
 
53
+ if (Buffer.isBuffer(error)) {
54
+ return null
55
+ }
56
+
53
57
  if (Array.isArray(error)) {
54
58
  const errors = error.map(serializeError).filter(Boolean)
55
59
  return errors.length === 0 ? null : errors.length === 1 ? errors[0] : errors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "15.0.20",
3
+ "version": "15.0.22",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "files": [
package/serializers.js CHANGED
@@ -32,9 +32,14 @@ module.exports = {
32
32
  err: (err) => {
33
33
  // TODO (fix): Merge with errors/serializeError?
34
34
 
35
+ if (Buffer.isBuffer(err)) {
36
+ err = new Error('unexpected buffer error')
37
+ }
38
+
35
39
  if (Array.isArray(err)) {
36
40
  err = err.length === 1 ? err[0] : new AggregateError(err)
37
41
  }
42
+
38
43
  const ret = serializers.err(err)
39
44
 
40
45
  if (ret.data !== null && typeof ret.data === 'object') {