undici-types 7.24.6 → 8.0.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/dispatcher.d.ts +5 -27
- package/dispatcher1-wrapper.d.ts +7 -0
- package/fetch.d.ts +24 -4
- package/formdata.d.ts +6 -0
- package/handlers.d.ts +1 -2
- package/index.d.ts +3 -1
- package/package.json +1 -1
package/dispatcher.d.ts
CHANGED
|
@@ -137,8 +137,6 @@ declare namespace Dispatcher {
|
|
|
137
137
|
signal?: AbortSignal | EventEmitter | null;
|
|
138
138
|
/** This argument parameter is passed through to `ConnectData` */
|
|
139
139
|
opaque?: TOpaque;
|
|
140
|
-
/** Default: false */
|
|
141
|
-
redirectionLimitReached?: boolean;
|
|
142
140
|
/** Default: `null` */
|
|
143
141
|
responseHeaders?: 'raw' | null;
|
|
144
142
|
}
|
|
@@ -147,8 +145,6 @@ declare namespace Dispatcher {
|
|
|
147
145
|
opaque?: TOpaque;
|
|
148
146
|
/** Default: `null` */
|
|
149
147
|
signal?: AbortSignal | EventEmitter | null;
|
|
150
|
-
/** Default: false */
|
|
151
|
-
redirectionLimitReached?: boolean;
|
|
152
148
|
/** Default: `null` */
|
|
153
149
|
onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
|
|
154
150
|
/** Default: `null` */
|
|
@@ -170,8 +166,6 @@ declare namespace Dispatcher {
|
|
|
170
166
|
protocol?: string;
|
|
171
167
|
/** Default: `null` */
|
|
172
168
|
signal?: AbortSignal | EventEmitter | null;
|
|
173
|
-
/** Default: false */
|
|
174
|
-
redirectionLimitReached?: boolean;
|
|
175
169
|
/** Default: `null` */
|
|
176
170
|
responseHeaders?: 'raw' | null;
|
|
177
171
|
}
|
|
@@ -218,6 +212,8 @@ declare namespace Dispatcher {
|
|
|
218
212
|
get aborted(): boolean
|
|
219
213
|
get paused(): boolean
|
|
220
214
|
get reason(): Error | null
|
|
215
|
+
rawHeaders?: Buffer[] | string[] | null
|
|
216
|
+
rawTrailers?: Buffer[] | string[] | null
|
|
221
217
|
abort(reason: Error): void
|
|
222
218
|
pause(): void
|
|
223
219
|
resume(): void
|
|
@@ -231,30 +227,12 @@ declare namespace Dispatcher {
|
|
|
231
227
|
onResponseEnd?(controller: DispatchController, trailers: IncomingHttpHeaders): void;
|
|
232
228
|
onResponseError?(controller: DispatchController, error: Error): void;
|
|
233
229
|
|
|
234
|
-
/** Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails. */
|
|
235
|
-
/** @deprecated */
|
|
236
|
-
onConnect?(abort: (err?: Error) => void): void;
|
|
237
|
-
/** Invoked when an error has occurred. */
|
|
238
|
-
/** @deprecated */
|
|
239
|
-
onError?(err: Error): void;
|
|
240
|
-
/** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
|
|
241
|
-
/** @deprecated */
|
|
242
|
-
onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
|
|
243
230
|
/** Invoked when response is received, before headers have been read. **/
|
|
244
|
-
/** @deprecated */
|
|
245
231
|
onResponseStarted?(): void;
|
|
246
|
-
/** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
|
|
247
|
-
/** @deprecated */
|
|
248
|
-
onHeaders?(statusCode: number, headers: Buffer[], resume: () => void, statusText: string): boolean;
|
|
249
|
-
/** Invoked when response payload data is received. */
|
|
250
|
-
/** @deprecated */
|
|
251
|
-
onData?(chunk: Buffer): boolean;
|
|
252
|
-
/** Invoked when response payload and trailers have been received and the request has completed. */
|
|
253
|
-
/** @deprecated */
|
|
254
|
-
onComplete?(trailers: string[] | null): void;
|
|
255
232
|
/** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
|
|
256
|
-
|
|
257
|
-
|
|
233
|
+
onBodySent?(chunk: Buffer): void;
|
|
234
|
+
/** Invoked after the request body is fully sent. */
|
|
235
|
+
onRequestSent?(): void;
|
|
258
236
|
}
|
|
259
237
|
export type PipelineHandler<TOpaque = null> = (data: PipelineHandlerData<TOpaque>) => Readable
|
|
260
238
|
export type HttpMethod = Autocomplete<'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'>
|
package/fetch.d.ts
CHANGED
|
@@ -60,12 +60,32 @@ export interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
|
60
60
|
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export interface
|
|
63
|
+
export interface SpecIteratorObject<T, TReturn = undefined, TNext = unknown> extends SpecIterator<T, TReturn, TNext> {
|
|
64
|
+
[Symbol.iterator](): SpecIteratorObject<T, TReturn, TNext>;
|
|
65
|
+
map<U>(callbackfn: (value: T, index: number) => U): SpecIteratorObject<U>;
|
|
66
|
+
filter<S extends T>(predicate: (value: T, index: number) => value is S): SpecIteratorObject<S>;
|
|
67
|
+
filter(predicate: (value: T, index: number) => unknown): SpecIteratorObject<T>;
|
|
68
|
+
take(limit: number): SpecIteratorObject<T>;
|
|
69
|
+
drop(count: number): SpecIteratorObject<T>;
|
|
70
|
+
flatMap<U>(callbackfn: (value: T, index: number) => Iterator<U> | Iterable<U>): SpecIteratorObject<U>;
|
|
71
|
+
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T): T;
|
|
72
|
+
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T, initialValue: T): T;
|
|
73
|
+
reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U, initialValue: U): U;
|
|
74
|
+
toArray(): T[];
|
|
75
|
+
forEach(callbackfn: (value: T, index: number) => void): void;
|
|
76
|
+
some(predicate: (value: T, index: number) => unknown): boolean;
|
|
77
|
+
every(predicate: (value: T, index: number) => unknown): boolean;
|
|
78
|
+
find<S extends T>(predicate: (value: T, index: number) => value is S): S | undefined;
|
|
79
|
+
find(predicate: (value: T, index: number) => unknown): T | undefined;
|
|
80
|
+
readonly [Symbol.toStringTag]: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface SpecIterableIterator<T> extends SpecIteratorObject<T> {
|
|
64
84
|
[Symbol.iterator](): SpecIterableIterator<T>;
|
|
65
85
|
}
|
|
66
86
|
|
|
67
87
|
export interface SpecIterable<T> {
|
|
68
|
-
[Symbol.iterator]():
|
|
88
|
+
[Symbol.iterator](): SpecIterableIterator<T>;
|
|
69
89
|
}
|
|
70
90
|
|
|
71
91
|
export type HeadersInit = [string, string][] | HeaderRecord | Headers
|
|
@@ -173,7 +193,7 @@ export declare class Request extends BodyMixin {
|
|
|
173
193
|
readonly signal: AbortSignal
|
|
174
194
|
readonly duplex: RequestDuplex
|
|
175
195
|
|
|
176
|
-
|
|
196
|
+
public clone (): Request
|
|
177
197
|
}
|
|
178
198
|
|
|
179
199
|
export interface ResponseInit {
|
|
@@ -203,7 +223,7 @@ export declare class Response extends BodyMixin {
|
|
|
203
223
|
readonly url: string
|
|
204
224
|
readonly redirected: boolean
|
|
205
225
|
|
|
206
|
-
|
|
226
|
+
public clone (): Response
|
|
207
227
|
|
|
208
228
|
static error (): Response
|
|
209
229
|
static json (data: any, init?: ResponseInit): Response
|
package/formdata.d.ts
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
import { File } from 'node:buffer'
|
|
5
5
|
import { SpecIterableIterator } from './fetch'
|
|
6
6
|
|
|
7
|
+
declare module 'node:buffer' {
|
|
8
|
+
interface File {
|
|
9
|
+
readonly [Symbol.toStringTag]: string
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
/**
|
|
8
14
|
* A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
|
|
9
15
|
*/
|
package/handlers.d.ts
CHANGED
|
@@ -5,8 +5,7 @@ export declare class RedirectHandler implements Dispatcher.DispatchHandler {
|
|
|
5
5
|
dispatch: Dispatcher.Dispatch,
|
|
6
6
|
maxRedirections: number,
|
|
7
7
|
opts: Dispatcher.DispatchOptions,
|
|
8
|
-
handler: Dispatcher.DispatchHandler
|
|
9
|
-
redirectionLimitReached: boolean
|
|
8
|
+
handler: Dispatcher.DispatchHandler
|
|
10
9
|
)
|
|
11
10
|
}
|
|
12
11
|
|
package/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import H2CClient from './h2c-client'
|
|
|
11
11
|
import buildConnector from './connector'
|
|
12
12
|
import errors from './errors'
|
|
13
13
|
import Agent from './agent'
|
|
14
|
+
import Dispatcher1Wrapper from './dispatcher1-wrapper'
|
|
14
15
|
import MockClient from './mock-client'
|
|
15
16
|
import MockPool from './mock-pool'
|
|
16
17
|
import MockAgent from './mock-agent'
|
|
@@ -44,7 +45,7 @@ export { Interceptable } from './mock-interceptor'
|
|
|
44
45
|
|
|
45
46
|
declare function globalThisInstall (): void
|
|
46
47
|
|
|
47
|
-
export { Dispatcher, BalancedPool, RoundRobinPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, cacheStores, MockClient, MockPool, MockAgent, SnapshotAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, Socks5ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient, globalThisInstall as install }
|
|
48
|
+
export { Dispatcher, BalancedPool, RoundRobinPool, Pool, Client, buildConnector, errors, Agent, Dispatcher1Wrapper, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, cacheStores, MockClient, MockPool, MockAgent, SnapshotAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, Socks5ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient, globalThisInstall as install }
|
|
48
49
|
export default Undici
|
|
49
50
|
|
|
50
51
|
declare namespace Undici {
|
|
@@ -60,6 +61,7 @@ declare namespace Undici {
|
|
|
60
61
|
const buildConnector: typeof import('./connector').default
|
|
61
62
|
const errors: typeof import('./errors').default
|
|
62
63
|
const Agent: typeof import('./agent').default
|
|
64
|
+
const Dispatcher1Wrapper: typeof import('./dispatcher1-wrapper').default
|
|
63
65
|
const setGlobalDispatcher: typeof import('./global-dispatcher').setGlobalDispatcher
|
|
64
66
|
const getGlobalDispatcher: typeof import('./global-dispatcher').getGlobalDispatcher
|
|
65
67
|
const request: typeof import('./api').request
|