@nxtedition/lib 15.0.24 → 15.0.26

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
@@ -495,6 +495,7 @@ module.exports = function (appConfig, onTerminate) {
495
495
  id: 'app:ds_connection_state',
496
496
  level: 30,
497
497
  msg: 'ds: connected',
498
+ data: { connectionState },
498
499
  },
499
500
  ]
500
501
  : [
@@ -502,6 +503,7 @@ module.exports = function (appConfig, onTerminate) {
502
503
  id: 'app:ds_connection_state',
503
504
  level: 40,
504
505
  msg: 'ds: connecting',
506
+ data: { connectionState },
505
507
  },
506
508
  ],
507
509
  ),
package/http.js CHANGED
@@ -331,11 +331,11 @@ module.exports.delay = defaultDelay
331
331
  module.exports.isConnectionError = isConnectionError
332
332
 
333
333
  module.exports.retry = async function _retry(fn, options) {
334
- const { maxRetries = 8, count = maxRetries, delay = defaultDelay } = options ?? {}
334
+ const { maxRetries = 8, count = maxRetries, delay = defaultDelay, signal } = options ?? {}
335
335
 
336
336
  for (let retryCount = 0; true; ++retryCount) {
337
337
  try {
338
- return await fn()
338
+ return await fn({ retryCount, signal })
339
339
  } catch (err) {
340
340
  if (retryCount >= count) {
341
341
  throw err
package/logger.js CHANGED
@@ -42,14 +42,6 @@ module.exports.createLogger = function (
42
42
  stream,
43
43
  )
44
44
 
45
- function flush() {
46
- if (!stream.destroyed) {
47
- stream?.end?.()
48
- stream?.flush?.()
49
- stream?.flushSync?.()
50
- }
51
- }
52
-
53
45
  let called = false
54
46
  const finalHandler = async (err, evt) => {
55
47
  if (called) {
@@ -63,7 +55,7 @@ module.exports.createLogger = function (
63
55
  }
64
56
  logger.fatal({ err }, evt || 'error caused exit')
65
57
 
66
- flush()
58
+ logger.flush()
67
59
 
68
60
  process.exit(1)
69
61
  } else {
@@ -76,7 +68,7 @@ module.exports.createLogger = function (
76
68
  logger.warn({ err })
77
69
  }
78
70
 
79
- flush()
71
+ logger.flush()
80
72
 
81
73
  logger.info({ exitSignal }, 'exit')
82
74
  process.exit(!exitSignal ? 0 : exitSignal)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "15.0.24",
3
+ "version": "15.0.26",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "files": [
package/stream.js CHANGED
@@ -22,7 +22,9 @@ function readableStreamLength(stream) {
22
22
  return null
23
23
  }
24
24
 
25
- stream.read(0)
25
+ if (stream.read) {
26
+ stream.read(0)
27
+ }
26
28
 
27
29
  const state = stream._readableState
28
30
  return state && state.ended === true && Number.isFinite(state.length) ? state.length : null