undici-types 7.10.0 → 7.11.0
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/diagnostics-channel.d.ts +9 -0
- package/dispatcher.d.ts +3 -2
- package/env-http-proxy-agent.d.ts +2 -1
- package/eventsource.d.ts +3 -3
- package/fetch.d.ts +1 -0
- package/handlers.d.ts +1 -1
- package/mock-client.d.ts +2 -0
- package/mock-interceptor.d.ts +2 -0
- package/mock-pool.d.ts +2 -0
- package/package.json +1 -1
- package/retry-handler.d.ts +9 -0
- package/webidl.d.ts +19 -15
- package/websocket.d.ts +1 -1
package/diagnostics-channel.d.ts
CHANGED
|
@@ -31,6 +31,15 @@ declare namespace DiagnosticsChannel {
|
|
|
31
31
|
export interface RequestBodySentMessage {
|
|
32
32
|
request: Request;
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
export interface RequestBodyChunkSentMessage {
|
|
36
|
+
request: Request;
|
|
37
|
+
chunk: Uint8Array | string;
|
|
38
|
+
}
|
|
39
|
+
export interface RequestBodyChunkReceivedMessage {
|
|
40
|
+
request: Request;
|
|
41
|
+
chunk: Buffer;
|
|
42
|
+
}
|
|
34
43
|
export interface RequestHeadersMessage {
|
|
35
44
|
request: Request;
|
|
36
45
|
response: Response;
|
package/dispatcher.d.ts
CHANGED
|
@@ -97,7 +97,8 @@ declare class Dispatcher extends EventEmitter {
|
|
|
97
97
|
|
|
98
98
|
declare namespace Dispatcher {
|
|
99
99
|
export interface ComposedDispatcher extends Dispatcher {}
|
|
100
|
-
export type
|
|
100
|
+
export type Dispatch = Dispatcher['dispatch']
|
|
101
|
+
export type DispatcherComposeInterceptor = (dispatch: Dispatch) => Dispatch
|
|
101
102
|
export interface DispatchOptions {
|
|
102
103
|
origin?: string | URL;
|
|
103
104
|
path: string;
|
|
@@ -276,6 +277,6 @@ declare namespace Dispatcher {
|
|
|
276
277
|
}
|
|
277
278
|
|
|
278
279
|
export interface DispatchInterceptor {
|
|
279
|
-
(dispatch:
|
|
280
|
+
(dispatch: Dispatch): Dispatch
|
|
280
281
|
}
|
|
281
282
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Agent from './agent'
|
|
2
|
+
import ProxyAgent from './proxy-agent'
|
|
2
3
|
import Dispatcher from './dispatcher'
|
|
3
4
|
|
|
4
5
|
export default EnvHttpProxyAgent
|
|
@@ -10,7 +11,7 @@ declare class EnvHttpProxyAgent extends Dispatcher {
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
declare namespace EnvHttpProxyAgent {
|
|
13
|
-
export interface Options extends
|
|
14
|
+
export interface Options extends Omit<ProxyAgent.Options, 'uri'> {
|
|
14
15
|
/** Overrides the value of the HTTP_PROXY environment variable */
|
|
15
16
|
httpProxy?: string;
|
|
16
17
|
/** Overrides the value of the HTTPS_PROXY environment variable */
|
package/eventsource.d.ts
CHANGED
|
@@ -18,9 +18,9 @@ interface EventSource extends EventTarget {
|
|
|
18
18
|
readonly CLOSED: 2
|
|
19
19
|
readonly CONNECTING: 0
|
|
20
20
|
readonly OPEN: 1
|
|
21
|
-
onerror: (this: EventSource, ev: ErrorEvent) => any
|
|
22
|
-
onmessage: (this: EventSource, ev: MessageEvent) => any
|
|
23
|
-
onopen: (this: EventSource, ev: Event) => any
|
|
21
|
+
onerror: ((this: EventSource, ev: ErrorEvent) => any) | null
|
|
22
|
+
onmessage: ((this: EventSource, ev: MessageEvent) => any) | null
|
|
23
|
+
onopen: ((this: EventSource, ev: Event) => any) | null
|
|
24
24
|
readonly readyState: 0 | 1 | 2
|
|
25
25
|
readonly url: string
|
|
26
26
|
readonly withCredentials: boolean
|
package/fetch.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export class BodyMixin {
|
|
|
33
33
|
|
|
34
34
|
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
35
35
|
readonly blob: () => Promise<Blob>
|
|
36
|
+
readonly bytes: () => Promise<Uint8Array>
|
|
36
37
|
/**
|
|
37
38
|
* @deprecated This method is not recommended for parsing multipart/form-data bodies in server environments.
|
|
38
39
|
* It is recommended to use a library such as [@fastify/busboy](https://www.npmjs.com/package/@fastify/busboy) as follows:
|
package/handlers.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import Dispatcher from './dispatcher'
|
|
|
2
2
|
|
|
3
3
|
export declare class RedirectHandler implements Dispatcher.DispatchHandler {
|
|
4
4
|
constructor (
|
|
5
|
-
dispatch: Dispatcher,
|
|
5
|
+
dispatch: Dispatcher.Dispatch,
|
|
6
6
|
maxRedirections: number,
|
|
7
7
|
opts: Dispatcher.DispatchOptions,
|
|
8
8
|
handler: Dispatcher.DispatchHandler,
|
package/mock-client.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ declare class MockClient extends Client implements Interceptable {
|
|
|
14
14
|
dispatch (options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandler): boolean
|
|
15
15
|
/** Closes the mock client and gracefully waits for enqueued requests to complete. */
|
|
16
16
|
close (): Promise<void>
|
|
17
|
+
/** Clean up all the prepared mocks. */
|
|
18
|
+
cleanMocks (): void
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
declare namespace MockClient {
|
package/mock-interceptor.d.ts
CHANGED
|
@@ -84,6 +84,8 @@ declare namespace MockInterceptor {
|
|
|
84
84
|
interface Interceptable extends Dispatcher {
|
|
85
85
|
/** Intercepts any matching requests that use the same origin as this mock client. */
|
|
86
86
|
intercept(options: MockInterceptor.Options): MockInterceptor;
|
|
87
|
+
/** Clean up all the prepared mocks. */
|
|
88
|
+
cleanMocks (): void
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
export {
|
package/mock-pool.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ declare class MockPool extends Pool implements Interceptable {
|
|
|
14
14
|
dispatch (options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandler): boolean
|
|
15
15
|
/** Closes the mock pool and gracefully waits for enqueued requests to complete. */
|
|
16
16
|
close (): Promise<void>
|
|
17
|
+
/** Clean up all the prepared mocks. */
|
|
18
|
+
cleanMocks (): void
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
declare namespace MockPool {
|
package/package.json
CHANGED
package/retry-handler.d.ts
CHANGED
|
@@ -35,6 +35,15 @@ declare namespace RetryHandler {
|
|
|
35
35
|
) => void
|
|
36
36
|
|
|
37
37
|
export interface RetryOptions {
|
|
38
|
+
/**
|
|
39
|
+
* If true, the retry handler will throw an error if the request fails,
|
|
40
|
+
* this will prevent the folling handlers from being called, and will destroy the socket.
|
|
41
|
+
*
|
|
42
|
+
* @type {boolean}
|
|
43
|
+
* @memberof RetryOptions
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
46
|
+
throwOnError?: boolean;
|
|
38
47
|
/**
|
|
39
48
|
* Callback to be invoked on every retry iteration.
|
|
40
49
|
* It receives the error, current state of the retry object and the options object
|
package/webidl.d.ts
CHANGED
|
@@ -16,9 +16,12 @@ interface ConvertToIntOpts {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
interface WebidlErrors {
|
|
19
|
+
/**
|
|
20
|
+
* @description Instantiate an error
|
|
21
|
+
*/
|
|
19
22
|
exception (opts: { header: string, message: string }): TypeError
|
|
20
23
|
/**
|
|
21
|
-
* @description
|
|
24
|
+
* @description Instantiate an error when conversion from one type to another has failed
|
|
22
25
|
*/
|
|
23
26
|
conversionFailed (opts: {
|
|
24
27
|
prefix: string
|
|
@@ -75,7 +78,7 @@ interface WebidlUtil {
|
|
|
75
78
|
): number
|
|
76
79
|
|
|
77
80
|
/**
|
|
78
|
-
* @see https://webidl.spec.whatwg.org/#abstract-opdef-
|
|
81
|
+
* @see https://webidl.spec.whatwg.org/#abstract-opdef-integerpart
|
|
79
82
|
*/
|
|
80
83
|
IntegerPart (N: number): number
|
|
81
84
|
|
|
@@ -182,20 +185,21 @@ interface WebidlConverters {
|
|
|
182
185
|
[Key: string]: (...args: any[]) => unknown
|
|
183
186
|
}
|
|
184
187
|
|
|
185
|
-
type
|
|
188
|
+
type WebidlIsFunction<T> = (arg: any) => arg is T
|
|
186
189
|
|
|
187
190
|
interface WebidlIs {
|
|
188
|
-
Request:
|
|
189
|
-
Response:
|
|
190
|
-
ReadableStream:
|
|
191
|
-
Blob:
|
|
192
|
-
URLSearchParams:
|
|
193
|
-
File:
|
|
194
|
-
FormData:
|
|
195
|
-
URL:
|
|
196
|
-
WebSocketError:
|
|
197
|
-
AbortSignal:
|
|
198
|
-
MessagePort:
|
|
191
|
+
Request: WebidlIsFunction<undici.Request>
|
|
192
|
+
Response: WebidlIsFunction<undici.Response>
|
|
193
|
+
ReadableStream: WebidlIsFunction<ReadableStream>
|
|
194
|
+
Blob: WebidlIsFunction<Blob>
|
|
195
|
+
URLSearchParams: WebidlIsFunction<URLSearchParams>
|
|
196
|
+
File: WebidlIsFunction<File>
|
|
197
|
+
FormData: WebidlIsFunction<undici.FormData>
|
|
198
|
+
URL: WebidlIsFunction<URL>
|
|
199
|
+
WebSocketError: WebidlIsFunction<undici.WebSocketError>
|
|
200
|
+
AbortSignal: WebidlIsFunction<AbortSignal>
|
|
201
|
+
MessagePort: WebidlIsFunction<MessagePort>
|
|
202
|
+
USVString: WebidlIsFunction<string>
|
|
199
203
|
}
|
|
200
204
|
|
|
201
205
|
export interface Webidl {
|
|
@@ -233,7 +237,7 @@ export interface Webidl {
|
|
|
233
237
|
* Similar to {@link Webidl.brandCheck} but allows skipping the check if third party
|
|
234
238
|
* interfaces are allowed.
|
|
235
239
|
*/
|
|
236
|
-
interfaceConverter <Interface>(typeCheck:
|
|
240
|
+
interfaceConverter <Interface>(typeCheck: WebidlIsFunction<Interface>, name: string): (
|
|
237
241
|
V: unknown,
|
|
238
242
|
prefix: string,
|
|
239
243
|
argument: string
|