@nxtedition/nxt-undici 4.2.12 → 4.2.14
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/lib/interceptor/dns.js +7 -3
- package/lib/interceptor/log.js +14 -7
- package/package.json +11 -12
package/lib/interceptor/dns.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import assert from 'node:assert'
|
|
2
|
+
import net from 'node:net'
|
|
3
|
+
import dns from 'node:dns'
|
|
2
4
|
import { DecoratorHandler } from '../utils.js'
|
|
3
|
-
import CacheableLookup from 'cacheable-lookup'
|
|
4
|
-
import net from 'net'
|
|
5
5
|
|
|
6
|
-
const DEFAULT_RESOLVER =
|
|
6
|
+
const DEFAULT_RESOLVER = {
|
|
7
|
+
lookup(hostname, options, callback) {
|
|
8
|
+
dns.lookup(hostname, options, callback)
|
|
9
|
+
},
|
|
10
|
+
}
|
|
7
11
|
|
|
8
12
|
class Handler extends DecoratorHandler {
|
|
9
13
|
#handler
|
package/lib/interceptor/log.js
CHANGED
|
@@ -23,7 +23,7 @@ class Handler extends DecoratorHandler {
|
|
|
23
23
|
|
|
24
24
|
this.#handler = handler
|
|
25
25
|
this.#opts = opts
|
|
26
|
-
this.#logger = opts.logger
|
|
26
|
+
this.#logger = opts.logger
|
|
27
27
|
|
|
28
28
|
this.#created = performance.now()
|
|
29
29
|
this.#now += this.#created
|
|
@@ -61,8 +61,14 @@ class Handler extends DecoratorHandler {
|
|
|
61
61
|
this.#timing.headers = performance.now() - this.#now
|
|
62
62
|
this.#now += this.#timing.headers
|
|
63
63
|
|
|
64
|
-
this.#logger
|
|
65
|
-
|
|
64
|
+
this.#logger.debug(
|
|
65
|
+
{
|
|
66
|
+
ureq: { id: this.#opts.id, url: this.#opts.url },
|
|
67
|
+
ures: { statusCode, headers },
|
|
68
|
+
elapsedTime: this.#timing.headers,
|
|
69
|
+
},
|
|
70
|
+
'upstream request response',
|
|
71
|
+
)
|
|
66
72
|
|
|
67
73
|
return this.#handler.onHeaders(statusCode, rawHeaders, resume, statusMessage, headers)
|
|
68
74
|
}
|
|
@@ -83,6 +89,7 @@ class Handler extends DecoratorHandler {
|
|
|
83
89
|
|
|
84
90
|
this.#logger.debug(
|
|
85
91
|
{
|
|
92
|
+
ureq: { id: this.#opts.id, url: this.#opts.url },
|
|
86
93
|
ures: {
|
|
87
94
|
bytesRead: this.#pos,
|
|
88
95
|
bytesReadPerSecond: (this.#pos * 1e3) / this.#timing.complete,
|
|
@@ -99,7 +106,7 @@ class Handler extends DecoratorHandler {
|
|
|
99
106
|
onError(err) {
|
|
100
107
|
this.#timing.complete = performance.now() - this.#created
|
|
101
108
|
|
|
102
|
-
const
|
|
109
|
+
const data = {
|
|
103
110
|
ureq: this.#opts,
|
|
104
111
|
ures: {
|
|
105
112
|
bytesRead: this.#pos,
|
|
@@ -108,12 +115,12 @@ class Handler extends DecoratorHandler {
|
|
|
108
115
|
},
|
|
109
116
|
elapsedTime: this.#timing.complete,
|
|
110
117
|
err,
|
|
111
|
-
}
|
|
118
|
+
}
|
|
112
119
|
|
|
113
120
|
if (this.#aborted) {
|
|
114
|
-
logger.debug('upstream request aborted')
|
|
121
|
+
this.#logger.debug(data, 'upstream request aborted')
|
|
115
122
|
} else {
|
|
116
|
-
logger.error('upstream request failed')
|
|
123
|
+
this.#logger.error(data, 'upstream request failed')
|
|
117
124
|
}
|
|
118
125
|
|
|
119
126
|
return this.#handler.onError(err)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/nxt-undici",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -10,24 +10,23 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"cache-control-parser": "^2.0.6",
|
|
13
|
-
"cacheable-lookup": "^7.0.0",
|
|
14
13
|
"http-errors": "^2.0.0",
|
|
15
|
-
"lru-cache": "^11.0.
|
|
16
|
-
"undici": "^6.19.
|
|
14
|
+
"lru-cache": "^11.0.1",
|
|
15
|
+
"undici": "^6.19.8"
|
|
17
16
|
},
|
|
18
17
|
"devDependencies": {
|
|
19
|
-
"@types/node": "^22.
|
|
20
|
-
"eslint": "^
|
|
18
|
+
"@types/node": "^22.7.4",
|
|
19
|
+
"eslint": "^9.12.0",
|
|
21
20
|
"eslint-config-prettier": "^9.1.0",
|
|
22
21
|
"eslint-config-standard": "^17.0.0",
|
|
23
|
-
"eslint-plugin-import": "^2.
|
|
24
|
-
"eslint-plugin-n": "^17.10.
|
|
25
|
-
"eslint-plugin-promise": "^7.
|
|
26
|
-
"husky": "^9.1.
|
|
27
|
-
"lint-staged": "^15.2.
|
|
22
|
+
"eslint-plugin-import": "^2.31.0",
|
|
23
|
+
"eslint-plugin-n": "^17.10.3",
|
|
24
|
+
"eslint-plugin-promise": "^7.1.0",
|
|
25
|
+
"husky": "^9.1.6",
|
|
26
|
+
"lint-staged": "^15.2.10",
|
|
28
27
|
"pinst": "^3.0.0",
|
|
29
28
|
"prettier": "^3.3.3",
|
|
30
|
-
"tap": "^21.0.
|
|
29
|
+
"tap": "^21.0.1"
|
|
31
30
|
},
|
|
32
31
|
"scripts": {
|
|
33
32
|
"prepare": "husky",
|