undici-types 6.2.1 → 6.4.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.
@@ -4,6 +4,8 @@ import { URL } from 'url'
4
4
 
5
5
  export default BalancedPool
6
6
 
7
+ type BalancedPoolConnectOptions = Omit<Dispatcher.ConnectOptions, "origin">;
8
+
7
9
  declare class BalancedPool extends Dispatcher {
8
10
  constructor(url: string | string[] | URL | URL[], options?: Pool.Options);
9
11
 
@@ -15,4 +17,13 @@ declare class BalancedPool extends Dispatcher {
15
17
  closed: boolean;
16
18
  /** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */
17
19
  destroyed: boolean;
20
+
21
+ // Override dispatcher APIs.
22
+ override connect(
23
+ options: BalancedPoolConnectOptions
24
+ ): Promise<Dispatcher.ConnectData>;
25
+ override connect(
26
+ options: BalancedPoolConnectOptions,
27
+ callback: (err: Error | null, data: Dispatcher.ConnectData) => void
28
+ ): void;
18
29
  }
package/client.d.ts CHANGED
@@ -3,6 +3,8 @@ import { TlsOptions } from 'tls'
3
3
  import Dispatcher from './dispatcher'
4
4
  import buildConnector from "./connector";
5
5
 
6
+ type ClientConnectOptions = Omit<Dispatcher.ConnectOptions, "origin">;
7
+
6
8
  /**
7
9
  * A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
8
10
  */
@@ -14,6 +16,15 @@ export class Client extends Dispatcher {
14
16
  closed: boolean;
15
17
  /** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */
16
18
  destroyed: boolean;
19
+
20
+ // Override dispatcher APIs.
21
+ override connect(
22
+ options: ClientConnectOptions
23
+ ): Promise<Dispatcher.ConnectData>;
24
+ override connect(
25
+ options: ClientConnectOptions,
26
+ callback: (err: Error | null, data: Dispatcher.ConnectData) => void
27
+ ): void;
17
28
  }
18
29
 
19
30
  export declare namespace Client {
package/dispatcher.d.ts CHANGED
@@ -121,6 +121,7 @@ declare namespace Dispatcher {
121
121
  expectContinue?: boolean;
122
122
  }
123
123
  export interface ConnectOptions {
124
+ origin: string | URL;
124
125
  path: string;
125
126
  /** Default: `null` */
126
127
  headers?: IncomingHttpHeaders | string[] | null;
@@ -130,6 +131,8 @@ declare namespace Dispatcher {
130
131
  opaque?: unknown;
131
132
  /** Default: 0 */
132
133
  maxRedirections?: number;
134
+ /** Default: false */
135
+ redirectionLimitReached?: boolean;
133
136
  /** Default: `null` */
134
137
  responseHeader?: 'raw' | null;
135
138
  }
@@ -140,6 +143,8 @@ declare namespace Dispatcher {
140
143
  signal?: AbortSignal | EventEmitter | null;
141
144
  /** Default: 0 */
142
145
  maxRedirections?: number;
146
+ /** Default: false */
147
+ redirectionLimitReached?: boolean;
143
148
  /** Default: `null` */
144
149
  onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
145
150
  /** Default: `null` */
@@ -163,6 +168,8 @@ declare namespace Dispatcher {
163
168
  signal?: AbortSignal | EventEmitter | null;
164
169
  /** Default: 0 */
165
170
  maxRedirections?: number;
171
+ /** Default: false */
172
+ redirectionLimitReached?: boolean;
166
173
  /** Default: `null` */
167
174
  responseHeader?: 'raw' | null;
168
175
  }
@@ -228,7 +235,7 @@ declare namespace Dispatcher {
228
235
  * @link https://fetch.spec.whatwg.org/#body-mixin
229
236
  */
230
237
  interface BodyMixin {
231
- readonly body?: never; // throws on node v16.6.0
238
+ readonly body?: never;
232
239
  readonly bodyUsed: boolean;
233
240
  arrayBuffer(): Promise<ArrayBuffer>;
234
241
  blob(): Promise<Blob>;
package/handlers.d.ts CHANGED
@@ -1,9 +1,15 @@
1
1
  import Dispatcher from "./dispatcher";
2
2
 
3
- export declare class RedirectHandler implements Dispatcher.DispatchHandlers{
4
- constructor (dispatch: Dispatcher, maxRedirections: number, opts: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandlers)
3
+ export declare class RedirectHandler implements Dispatcher.DispatchHandlers {
4
+ constructor(
5
+ dispatch: Dispatcher,
6
+ maxRedirections: number,
7
+ opts: Dispatcher.DispatchOptions,
8
+ handler: Dispatcher.DispatchHandlers,
9
+ redirectionLimitReached: boolean
10
+ );
5
11
  }
6
12
 
7
- export declare class DecoratorHandler implements Dispatcher.DispatchHandlers{
8
- constructor (handler: Dispatcher.DispatchHandlers)
13
+ export declare class DecoratorHandler implements Dispatcher.DispatchHandlers {
14
+ constructor(handler: Dispatcher.DispatchHandlers);
9
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici-types",
3
- "version": "6.2.1",
3
+ "version": "6.4.0",
4
4
  "description": "A stand-alone types package for Undici",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {
package/pool.d.ts CHANGED
@@ -5,6 +5,8 @@ import Dispatcher from "./dispatcher";
5
5
 
6
6
  export default Pool
7
7
 
8
+ type PoolConnectOptions = Omit<Dispatcher.ConnectOptions, "origin">;
9
+
8
10
  declare class Pool extends Dispatcher {
9
11
  constructor(url: string | URL, options?: Pool.Options)
10
12
  /** `true` after `pool.close()` has been called. */
@@ -13,6 +15,15 @@ declare class Pool extends Dispatcher {
13
15
  destroyed: boolean;
14
16
  /** Aggregate stats for a Pool. */
15
17
  readonly stats: TPoolStats;
18
+
19
+ // Override dispatcher APIs.
20
+ override connect(
21
+ options: PoolConnectOptions
22
+ ): Promise<Dispatcher.ConnectData>;
23
+ override connect(
24
+ options: PoolConnectOptions,
25
+ callback: (err: Error | null, data: Dispatcher.ConnectData) => void
26
+ ): void;
16
27
  }
17
28
 
18
29
  declare namespace Pool {
package/proxy-agent.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import Agent from './agent'
2
2
  import buildConnector from './connector';
3
- import Client from './client'
4
3
  import Dispatcher from './dispatcher'
5
4
  import { IncomingHttpHeaders } from './header'
6
- import Pool from './pool'
7
5
 
8
6
  export default ProxyAgent
9
7
 
package/readable.d.ts CHANGED
@@ -44,9 +44,8 @@ declare class BodyReadable extends Readable {
44
44
  */
45
45
  readonly bodyUsed: boolean
46
46
 
47
- /** Throws on node 16.6.0
48
- *
49
- * If body is null, it should return null as the body
47
+ /**
48
+ * If body is null, it should return null as the body
50
49
  *
51
50
  * If body is not null, should return the body as a ReadableStream
52
51
  *