@nxtedition/lib 23.3.1 → 23.3.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 +4 -9
- package/http.js +3 -1
- package/package.json +13 -13
- package/s3.js +13 -4
package/app.js
CHANGED
|
@@ -866,9 +866,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
866
866
|
}
|
|
867
867
|
|
|
868
868
|
// TODO (fix): Determinisitc port also in dev mode... hash of something?
|
|
869
|
-
const port =
|
|
870
|
-
appConfig.inspect?.port ??
|
|
871
|
-
(isProduction ? 38603 : Math.floor(38000 + Math.random() * 10000))
|
|
869
|
+
const port = appConfig.inspect?.port ?? (isProduction ? 38603 : 0)
|
|
872
870
|
const server = http
|
|
873
871
|
.createServer(async (req, res) => {
|
|
874
872
|
try {
|
|
@@ -924,10 +922,9 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
924
922
|
}
|
|
925
923
|
})
|
|
926
924
|
.listen(port)
|
|
925
|
+
.once('listening', () => logger.debug({ port: server.address().port }, 'inspect listening'))
|
|
927
926
|
.unref()
|
|
928
927
|
|
|
929
|
-
logger.debug({ port }, 'inspect listening')
|
|
930
|
-
|
|
931
928
|
destroyers.unshift(() => new Promise((resolve) => server.close(resolve)))
|
|
932
929
|
}
|
|
933
930
|
|
|
@@ -985,8 +982,7 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
985
982
|
|
|
986
983
|
if (isMainThread) {
|
|
987
984
|
// TODO (fix): Determinisitc port also in dev mode... hash of something?
|
|
988
|
-
const port =
|
|
989
|
-
appConfig.utils?.port ?? (isProduction ? 38604 : Math.floor(38000 + Math.random() * 10000))
|
|
985
|
+
const port = appConfig.utils?.port ?? (isProduction ? 38604 : 0)
|
|
990
986
|
|
|
991
987
|
const server = http
|
|
992
988
|
.createServer(async (req, res) => {
|
|
@@ -1029,10 +1025,9 @@ export function makeApp(appConfig, onTerminate) {
|
|
|
1029
1025
|
}
|
|
1030
1026
|
})
|
|
1031
1027
|
.listen(port)
|
|
1028
|
+
.once('listening', () => logger.debug({ port: server.address().port }, 'utils listening'))
|
|
1032
1029
|
.unref()
|
|
1033
1030
|
|
|
1034
|
-
logger.debug({ port }, 'utils listening')
|
|
1035
|
-
|
|
1036
1031
|
destroyers.unshift(() => new Promise((resolve) => server.close(resolve)))
|
|
1037
1032
|
}
|
|
1038
1033
|
}
|
package/http.js
CHANGED
|
@@ -48,7 +48,9 @@ export class Context {
|
|
|
48
48
|
assert(res)
|
|
49
49
|
assert(logger)
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
const id = req.headers['request-id'] || req.headers['Request-Id']
|
|
52
|
+
|
|
53
|
+
this.#id = (id ? `${id},` : '') + genReqId()
|
|
52
54
|
this.#userAgent = req.headers['user-agent'] || req.headers['User-Agent'] || ''
|
|
53
55
|
this.#req = req
|
|
54
56
|
this.#res = res
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/lib",
|
|
3
|
-
"version": "23.3.
|
|
3
|
+
"version": "23.3.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"type": "module",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"scripts": {
|
|
47
47
|
"prepublishOnly": "pinst --disable",
|
|
48
48
|
"postpublish": "pinst --enable",
|
|
49
|
-
"test": "node --test",
|
|
49
|
+
"test": "node --test-timeout 60000 --test",
|
|
50
50
|
"prepare": "husky"
|
|
51
51
|
},
|
|
52
52
|
"lint-staged": {
|
|
@@ -61,14 +61,14 @@
|
|
|
61
61
|
"singleQuote": true
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aws-sdk/client-s3": "^3.
|
|
64
|
+
"@aws-sdk/client-s3": "^3.749.0",
|
|
65
65
|
"@elastic/elasticsearch": "^8.16.1",
|
|
66
66
|
"@elastic/transport": "^8.9.3",
|
|
67
|
-
"@nxtedition/nxt-undici": "^6.
|
|
68
|
-
"@swc/wasm-web": "^1.10.
|
|
67
|
+
"@nxtedition/nxt-undici": "^6.1.2",
|
|
68
|
+
"@swc/wasm-web": "^1.10.16",
|
|
69
69
|
"canvas": "^3.1.0",
|
|
70
70
|
"content-type": "^1.0.5",
|
|
71
|
-
"date-fns": "^
|
|
71
|
+
"date-fns": "^4.1.0",
|
|
72
72
|
"fast-querystring": "^1.1.1",
|
|
73
73
|
"hasha": "^6.0.0",
|
|
74
74
|
"http-errors": "^2.0.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"lodash": "^4.17.21",
|
|
78
78
|
"lru-cache": "^11.0.2",
|
|
79
79
|
"mime": "^4.0.6",
|
|
80
|
-
"mitata": "^1.0.
|
|
80
|
+
"mitata": "^1.0.34",
|
|
81
81
|
"moment-timezone": "^0.5.46",
|
|
82
82
|
"nconf": "^0.12.1",
|
|
83
83
|
"nested-error-stacks": "^2.1.1",
|
|
@@ -94,10 +94,10 @@
|
|
|
94
94
|
"yocto-queue": "^1.1.1"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@nxtedition/deepstream.io-client-js": ">=28.1.
|
|
97
|
+
"@nxtedition/deepstream.io-client-js": ">=28.1.6",
|
|
98
98
|
"@types/lodash": "^4.17.14",
|
|
99
|
-
"@types/node": "^22.
|
|
100
|
-
"eslint": "^9.
|
|
99
|
+
"@types/node": "^22.13.4",
|
|
100
|
+
"eslint": "^9.20.1",
|
|
101
101
|
"eslint-config-prettier": "^10.0.1",
|
|
102
102
|
"eslint-config-standard": "^17.0.0",
|
|
103
103
|
"eslint-plugin-import": "^2.31.0",
|
|
@@ -107,11 +107,11 @@
|
|
|
107
107
|
"husky": "^9.1.7",
|
|
108
108
|
"lint-staged": "^15.3.0",
|
|
109
109
|
"pinst": "^3.0.0",
|
|
110
|
-
"prettier": "^3.
|
|
110
|
+
"prettier": "^3.5.1",
|
|
111
111
|
"rxjs": "^7.5.6",
|
|
112
112
|
"send": "^1.1.0",
|
|
113
|
-
"tap": "^21.0.
|
|
114
|
-
"typescript-eslint": "^8.
|
|
113
|
+
"tap": "^21.0.2",
|
|
114
|
+
"typescript-eslint": "^8.24.0"
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
|
117
117
|
"@elastic/elasticsearch": "^8.6.0",
|
package/s3.js
CHANGED
|
@@ -4,7 +4,7 @@ import tp from 'node:timers/promises'
|
|
|
4
4
|
import AWS from '@aws-sdk/client-s3'
|
|
5
5
|
import PQueue from 'p-queue'
|
|
6
6
|
import { NodeHttpHandler } from '@smithy/node-http-handler'
|
|
7
|
-
import
|
|
7
|
+
import { request as undiciRequest, parseHeaders } from '@nxtedition/nxt-undici'
|
|
8
8
|
|
|
9
9
|
const QUEUE = new PQueue({ concurrency: 8 })
|
|
10
10
|
const MD5_HEX_EXPR = /^[A-F0-9]{32}$/i
|
|
@@ -46,19 +46,28 @@ class UndiciRequestHandler extends NodeHttpHandler {
|
|
|
46
46
|
const abortSignal = options?.abortSignal
|
|
47
47
|
|
|
48
48
|
const { protocol, hostname, port, path, ...requestOptions } = request
|
|
49
|
-
// NOTE: Expect header is not supported by undici
|
|
50
|
-
const {
|
|
49
|
+
// NOTE: Expect & Transfer-Encoding header is not supported by undici
|
|
50
|
+
const {
|
|
51
|
+
expect,
|
|
52
|
+
'transfer-encoding': transferEncoding,
|
|
53
|
+
...headers
|
|
54
|
+
} = parseHeaders(request.headers)
|
|
51
55
|
const typedMethod = /** @type {import('undici').Dispatcher.HttpMethod} */ (request.method)
|
|
52
56
|
|
|
53
57
|
const url = `${request.protocol}//${request.hostname}${request.port ? `:${request.port}` : ''}${request.path}`
|
|
54
58
|
|
|
55
|
-
const response = await
|
|
59
|
+
const response = await undiciRequest(url, {
|
|
56
60
|
...requestOptions,
|
|
57
61
|
method: typedMethod,
|
|
58
62
|
signal: abortSignal,
|
|
59
63
|
dispatcher: this.#dispatcher,
|
|
60
64
|
headers,
|
|
61
65
|
body: request.body,
|
|
66
|
+
// nxt-undici
|
|
67
|
+
error: false,
|
|
68
|
+
dns: false,
|
|
69
|
+
retry: false,
|
|
70
|
+
follow: false,
|
|
62
71
|
})
|
|
63
72
|
|
|
64
73
|
return {
|