@nxtedition/lib 19.0.1 → 19.0.3
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 +1 -1
- package/couch.js +11 -10
- package/package.json +12 -12
- package/trace.js +3 -3
package/app.js
CHANGED
|
@@ -665,7 +665,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
665
665
|
if (appConfig.trace) {
|
|
666
666
|
const traceConfig = { ...appConfig.trace, ...config.trace }
|
|
667
667
|
if (traceConfig.url) {
|
|
668
|
-
trace = makeTrace({ ...traceConfig, appDestroyers, logger, serviceName })
|
|
668
|
+
trace = makeTrace({ ...traceConfig, destroyers: appDestroyers, logger, serviceName })
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
671
|
|
package/couch.js
CHANGED
|
@@ -6,6 +6,7 @@ import { defaultDelay as delay } from './http.js'
|
|
|
6
6
|
import querystring from 'querystring'
|
|
7
7
|
import urljoin from 'url-join'
|
|
8
8
|
import undici from 'undici'
|
|
9
|
+
import { AbortError } from './errors.js'
|
|
9
10
|
|
|
10
11
|
// https://github.com/fastify/fastify/blob/main/lib/reqIdGenFactory.js
|
|
11
12
|
// 2,147,483,647 (2^31 − 1) stands for max SMI value (an internal optimization of V8).
|
|
@@ -114,7 +115,6 @@ export function makeCouch(opts) {
|
|
|
114
115
|
return createError(res.status, {
|
|
115
116
|
reason,
|
|
116
117
|
error,
|
|
117
|
-
body: req.body ? JSON.stringify(req.body).slice(0, 4096) : null,
|
|
118
118
|
data: {
|
|
119
119
|
req: {
|
|
120
120
|
origin: dbOrigin,
|
|
@@ -216,13 +216,13 @@ export function makeCouch(opts) {
|
|
|
216
216
|
|
|
217
217
|
if (signal) {
|
|
218
218
|
if (signal.aborted) {
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
219
|
+
throw signal.reason ?? new AbortError()
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (signal.on) {
|
|
223
|
+
signal.on('abort', onAbort)
|
|
224
|
+
} else if (signal.addEventListener) {
|
|
225
|
+
signal.addEventListener('abort', onAbort)
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
|
|
@@ -251,7 +251,6 @@ export function makeCouch(opts) {
|
|
|
251
251
|
'request-id': genReqId(),
|
|
252
252
|
...(body ? { 'content-type': 'application/json' } : {}),
|
|
253
253
|
},
|
|
254
|
-
throwOnError: true,
|
|
255
254
|
highWaterMark: 256 * 1024, // TODO (fix): Needs support in undici...
|
|
256
255
|
bodyTimeout: 2 * (params.heartbeat || 60e3),
|
|
257
256
|
}
|
|
@@ -290,8 +289,8 @@ export function makeCouch(opts) {
|
|
|
290
289
|
if (live) {
|
|
291
290
|
const data = JSON.parse(line)
|
|
292
291
|
if (data.last_seq) {
|
|
292
|
+
assert(data.last_seq, 'invalid last_seq: ' + data.last_seq)
|
|
293
293
|
params.since = data.last_seq
|
|
294
|
-
assert(params.since, 'invalid last_seq: ' + params.since)
|
|
295
294
|
} else {
|
|
296
295
|
params.since = data.seq || params.since
|
|
297
296
|
changes.push(data)
|
|
@@ -335,6 +334,8 @@ export function makeCouch(opts) {
|
|
|
335
334
|
remaining -= changes.length
|
|
336
335
|
assert(remaining >= 0, 'invalid remaining: ' + remaining)
|
|
337
336
|
}
|
|
337
|
+
|
|
338
|
+
assert(live || state === 3, 'invalid state: ' + state)
|
|
338
339
|
} catch (err) {
|
|
339
340
|
Object.assign(err, { data: req })
|
|
340
341
|
throw err
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/lib",
|
|
3
|
-
"version": "19.0.
|
|
3
|
+
"version": "19.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"type": "module",
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
"/__tests__"
|
|
75
75
|
],
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@elastic/elasticsearch": "^8.12.
|
|
78
|
-
"@elastic/transport": "^8.4.
|
|
79
|
-
"@nxtedition/nxt-undici": "^2.0.
|
|
80
|
-
"date-fns": "^3.
|
|
77
|
+
"@elastic/elasticsearch": "^8.12.2",
|
|
78
|
+
"@elastic/transport": "^8.4.1",
|
|
79
|
+
"@nxtedition/nxt-undici": "^2.0.41",
|
|
80
|
+
"date-fns": "^3.4.0",
|
|
81
81
|
"fast-querystring": "^1.1.1",
|
|
82
82
|
"hasha": "^6.0.0",
|
|
83
83
|
"http-errors": "^2.0.0",
|
|
@@ -89,29 +89,29 @@
|
|
|
89
89
|
"nconf": "^0.12.1",
|
|
90
90
|
"nested-error-stacks": "^2.1.1",
|
|
91
91
|
"object-hash": "^3.0.0",
|
|
92
|
-
"pino": "^8.
|
|
92
|
+
"pino": "^8.19.0",
|
|
93
93
|
"pino-std-serializers": "^6.2.2",
|
|
94
|
-
"qs": "^6.
|
|
94
|
+
"qs": "^6.12.0",
|
|
95
95
|
"request-target": "^1.0.2",
|
|
96
96
|
"smpte-timecode": "^1.3.5",
|
|
97
97
|
"split-string": "^6.0.0",
|
|
98
98
|
"split2": "^4.2.0",
|
|
99
99
|
"toobusy-js": "^0.5.1",
|
|
100
|
-
"undici": "^6.
|
|
100
|
+
"undici": "^6.7.1",
|
|
101
101
|
"url-join": "^5.0.0"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@nxtedition/deepstream.io-client-js": ">=24.1.
|
|
104
|
+
"@nxtedition/deepstream.io-client-js": ">=24.1.6",
|
|
105
105
|
"@types/lodash": "^4.14.202",
|
|
106
|
-
"@types/node": "^20.11.
|
|
107
|
-
"eslint": "^8.
|
|
106
|
+
"@types/node": "^20.11.26",
|
|
107
|
+
"eslint": "^8.57.0",
|
|
108
108
|
"eslint-config-prettier": "^9.1.0",
|
|
109
109
|
"eslint-config-standard": "^17.0.0",
|
|
110
110
|
"eslint-plugin-import": "^2.29.1",
|
|
111
111
|
"eslint-plugin-n": "^16.6.1",
|
|
112
112
|
"eslint-plugin-node": "^11.1.0",
|
|
113
113
|
"eslint-plugin-promise": "^6.0.0",
|
|
114
|
-
"husky": "^9.0.
|
|
114
|
+
"husky": "^9.0.11",
|
|
115
115
|
"lint-staged": "^15.2.2",
|
|
116
116
|
"pinst": "^3.0.0",
|
|
117
117
|
"prettier": "^3.2.5",
|
package/trace.js
CHANGED
|
@@ -6,7 +6,7 @@ export function makeTrace({
|
|
|
6
6
|
stringify = JSON.stringify,
|
|
7
7
|
index,
|
|
8
8
|
batch = 128e3,
|
|
9
|
-
limit =
|
|
9
|
+
limit = 16e6,
|
|
10
10
|
destroyers,
|
|
11
11
|
logger,
|
|
12
12
|
serviceName,
|
|
@@ -49,7 +49,8 @@ export function makeTrace({
|
|
|
49
49
|
method: 'POST',
|
|
50
50
|
idempotent: true,
|
|
51
51
|
headers: HEADERS,
|
|
52
|
-
headersTimeout:
|
|
52
|
+
headersTimeout: 60e3,
|
|
53
|
+
bodyTimeout: 60e3,
|
|
53
54
|
body: data,
|
|
54
55
|
})
|
|
55
56
|
.then(({ body }) => body.dump())
|
|
@@ -73,7 +74,6 @@ export function makeTrace({
|
|
|
73
74
|
if (obj.op) {
|
|
74
75
|
throw new Error('invalid property `op`')
|
|
75
76
|
}
|
|
76
|
-
|
|
77
77
|
if (obj['@timestamp']) {
|
|
78
78
|
throw new Error('invalid property `@timestamp`')
|
|
79
79
|
}
|