@nxtedition/nxt-undici 7.3.3 → 7.3.5
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.d.ts +3 -12
- package/lib/index.js +0 -64
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Readable } from 'node:stream'
|
|
2
|
+
import type { Priority } from '@nxtedition/scheduler'
|
|
2
3
|
|
|
3
4
|
export interface URLObject {
|
|
4
5
|
origin?: string | null
|
|
@@ -16,6 +17,7 @@ export interface BodyReadable extends Readable {
|
|
|
16
17
|
json(): Promise<unknown>
|
|
17
18
|
arrayBuffer(): Promise<ArrayBuffer>
|
|
18
19
|
blob(): Promise<Blob>
|
|
20
|
+
dump(): Promise<void>
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export type URLLike = string | URL | URLObject
|
|
@@ -85,18 +87,7 @@ export interface DispatchOptions {
|
|
|
85
87
|
logger?: LoggerLike | null
|
|
86
88
|
dns?: DnsOptions | boolean | null
|
|
87
89
|
connect?: Record<string, unknown> | null
|
|
88
|
-
priority?:
|
|
89
|
-
| 0
|
|
90
|
-
| 1
|
|
91
|
-
| 2
|
|
92
|
-
| 'low'
|
|
93
|
-
| 'normal'
|
|
94
|
-
| 'high'
|
|
95
|
-
| 'lower'
|
|
96
|
-
| 'lowest'
|
|
97
|
-
| 'higher'
|
|
98
|
-
| 'highest'
|
|
99
|
-
| null
|
|
90
|
+
priority?: Priority | null
|
|
100
91
|
lookup?: LookupFn | null
|
|
101
92
|
}
|
|
102
93
|
|
package/lib/index.js
CHANGED
|
@@ -179,70 +179,6 @@ export function dispatch(dispatcher, opts, handler) {
|
|
|
179
179
|
return wrapDispatch(dispatcher)(opts, handler)
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
/**
|
|
183
|
-
* @typedef {{
|
|
184
|
-
* origin: string?,
|
|
185
|
-
* path: string?,
|
|
186
|
-
* host: string?,
|
|
187
|
-
* hostname: string?,
|
|
188
|
-
* port: string|number?,
|
|
189
|
-
* protocol: string?,
|
|
190
|
-
* pathname: string?,
|
|
191
|
-
* search: string?,
|
|
192
|
-
* }} URLObject
|
|
193
|
-
* @typedef {string|URL|URLObject} URLLike
|
|
194
|
-
*/
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* @typedef {{
|
|
198
|
-
* }} LoggerLike
|
|
199
|
-
*/
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* @typedef {{
|
|
203
|
-
* id: string | null | undefined,
|
|
204
|
-
* dispatch: function,
|
|
205
|
-
* dispatcher: import('@nxtedition/undici').Dispatcher | null | undefined,
|
|
206
|
-
* url: URLLike | null | undefined,
|
|
207
|
-
* origin: string?,
|
|
208
|
-
* path: string?,
|
|
209
|
-
* method: string | null | undefined,
|
|
210
|
-
* body: import('stream').Readable | Uint8Array | string | null | undefined,
|
|
211
|
-
* query: object | null | undefined,
|
|
212
|
-
* headers: Record<string, string> | null | undefined,
|
|
213
|
-
* signal: AbortSignal | null | undefined,
|
|
214
|
-
* reset: boolean | null | undefined,
|
|
215
|
-
* blocking: boolean | null | undefined,
|
|
216
|
-
* timeout: number | { headers?: number | null | undefined, body?: number | null | undefined } | null | undefined,
|
|
217
|
-
* headersTimeout: number | null | undefined,
|
|
218
|
-
* bodyTimeout: number | null | undefined,
|
|
219
|
-
* idempotent: boolean | null | undefined,
|
|
220
|
-
* retry: object | number | boolean | null | undefined,
|
|
221
|
-
* proxy: object | boolean | null | undefined,
|
|
222
|
-
* cache: object | boolean | null | undefined,
|
|
223
|
-
* upgrade: object | boolean | null | undefined,
|
|
224
|
-
* follow: object | boolean | null | undefined,
|
|
225
|
-
* typeOfService: number | null | undefined,
|
|
226
|
-
* error: object | boolean | null | undefined,
|
|
227
|
-
* verify: object | boolean | null | undefined,
|
|
228
|
-
* logger: LoggerLike | null | undefined,
|
|
229
|
-
* dns: object | boolean | null | undefined,
|
|
230
|
-
* connect: object | null | undefined,
|
|
231
|
-
* priority: 0 | 1 | 2 | "low" | "normal" | "high" | null | undefined,
|
|
232
|
-
* lookup: ((origin: string | URLLike | Array<string | URLLike> , opts: object, callback: (err: Error | null, address: string | null) => void) => void) | null | undefined,
|
|
233
|
-
* }} RequestOptions
|
|
234
|
-
*/
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
*
|
|
238
|
-
* @param {URLLike|RequestOptions} urlOrOpts
|
|
239
|
-
* @param {RequestOptions|null} [opts]
|
|
240
|
-
* @returns {Promise<{
|
|
241
|
-
* body: import('stream').Readable,
|
|
242
|
-
* statusCode: number,
|
|
243
|
-
* headers: Record<string, string | string[] | undefined>
|
|
244
|
-
* }>}
|
|
245
|
-
*/
|
|
246
182
|
export function request(urlOrOpts, opts) {
|
|
247
183
|
return _request(
|
|
248
184
|
wrapDispatch(
|