@nxtedition/nxt-undici 7.2.9 → 7.2.11
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/index.js +20 -0
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import undici from '@nxtedition/undici'
|
|
2
|
+
import { Scheduler } from '@nxtedition/scheduler'
|
|
2
3
|
import { parseHeaders } from './utils.js'
|
|
3
4
|
import { request as _request } from './request.js'
|
|
4
5
|
import { SqliteCacheStore } from './sqlite-cache-store.js'
|
|
@@ -79,6 +80,22 @@ export function compose(...interceptors) {
|
|
|
79
80
|
return dispatch
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
const PRIORITY_TOS_MAP = {}
|
|
84
|
+
PRIORITY_TOS_MAP[Scheduler.HIGHEST] = 0xb8 // EF
|
|
85
|
+
PRIORITY_TOS_MAP['highest'] = 0xb8 // EF
|
|
86
|
+
PRIORITY_TOS_MAP[Scheduler.HIGHER] = 0x88 // AF41
|
|
87
|
+
PRIORITY_TOS_MAP['higher'] = 0x88 // AF41
|
|
88
|
+
PRIORITY_TOS_MAP[Scheduler.HIGH] = 0x68 // AF31
|
|
89
|
+
PRIORITY_TOS_MAP['high'] = 0x68 // AF31
|
|
90
|
+
PRIORITY_TOS_MAP[Scheduler.NORMAL] = 0x00 // BE
|
|
91
|
+
PRIORITY_TOS_MAP['normal'] = 0x00 // BE
|
|
92
|
+
PRIORITY_TOS_MAP[Scheduler.LOW] = 0x04 // LE
|
|
93
|
+
PRIORITY_TOS_MAP['low'] = 0x04 // LE
|
|
94
|
+
PRIORITY_TOS_MAP[Scheduler.LOWER] = 0x04 // LE
|
|
95
|
+
PRIORITY_TOS_MAP['lower'] = 0x04 // LE
|
|
96
|
+
PRIORITY_TOS_MAP[Scheduler.LOWEST] = 0x04 // LE
|
|
97
|
+
PRIORITY_TOS_MAP['lowest'] = 0x04 // LE
|
|
98
|
+
|
|
82
99
|
function wrapDispatch(dispatcher) {
|
|
83
100
|
let wrappedDispatcher = dispatcherCache.get(dispatcher)
|
|
84
101
|
if (wrappedDispatcher == null) {
|
|
@@ -135,6 +152,8 @@ function wrapDispatch(dispatcher) {
|
|
|
135
152
|
opts.timeout?.headers ?? opts.headersTimeout ?? opts.headerTimeout ?? opts.timeout,
|
|
136
153
|
bodyTimeout: opts.timeout?.body ?? opts.bodyTimeout ?? opts.timeout,
|
|
137
154
|
idempotent: opts.idempotent,
|
|
155
|
+
typeOfService:
|
|
156
|
+
opts.typeOfService ?? (opts.priority ? (PRIORITY_TOS_MAP[opts.priority] ?? 0) : 0),
|
|
138
157
|
retry: opts.retry ?? 8,
|
|
139
158
|
proxy: opts.proxy ?? false,
|
|
140
159
|
cache: opts.cache ?? false,
|
|
@@ -204,6 +223,7 @@ export function dispatch(dispatcher, opts, handler) {
|
|
|
204
223
|
* cache: object | boolean | null | undefined,
|
|
205
224
|
* upgrade: object | boolean | null | undefined,
|
|
206
225
|
* follow: object | boolean | null | undefined,
|
|
226
|
+
* typeOfService: number | null | undefined,
|
|
207
227
|
* error: object | boolean | null | undefined,
|
|
208
228
|
* verify: object | boolean | null | undefined,
|
|
209
229
|
* logger: LoggerLike | null | undefined,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/nxt-undici",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"lib/*"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@nxtedition/scheduler": "^3.0.
|
|
13
|
-
"@nxtedition/undici": "^11.1.
|
|
12
|
+
"@nxtedition/scheduler": "^3.0.1",
|
|
13
|
+
"@nxtedition/undici": "^11.1.3",
|
|
14
14
|
"cache-control-parser": "^2.0.6",
|
|
15
15
|
"fast-querystring": "^1.1.2",
|
|
16
16
|
"http-errors": "^2.0.1",
|
|
17
17
|
"xxhash-wasm": "^1.1.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@types/node": "^25.
|
|
20
|
+
"@types/node": "^25.2.0",
|
|
21
21
|
"eslint": "^9.39.2",
|
|
22
22
|
"eslint-plugin-n": "^17.23.2",
|
|
23
23
|
"husky": "^9.1.7",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"prettier": "^3.8.1",
|
|
27
27
|
"send": "^1.2.1",
|
|
28
28
|
"tap": "^21.5.0",
|
|
29
|
-
"undici-types": "^7.
|
|
29
|
+
"undici-types": "^7.20.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"prepare": "husky",
|