@emulsify/cli 1.10.2 → 1.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.
Files changed (37) hide show
  1. package/README.md +6 -6
  2. package/dist/node_modules/.package-lock.json +7 -7
  3. package/dist/node_modules/@types/node/README.md +1 -1
  4. package/dist/node_modules/@types/node/buffer.d.ts +12 -0
  5. package/dist/node_modules/@types/node/inspector.d.ts +1061 -111
  6. package/dist/node_modules/@types/node/package.json +3 -3
  7. package/dist/node_modules/@types/node/perf_hooks.d.ts +30 -1
  8. package/dist/node_modules/@types/node/process.d.ts +142 -17
  9. package/dist/node_modules/@types/node/test.d.ts +232 -86
  10. package/dist/node_modules/@types/node/util.d.ts +6 -0
  11. package/dist/node_modules/@types/node/zlib.d.ts +9 -0
  12. package/dist/node_modules/undici-types/LICENSE +21 -0
  13. package/dist/node_modules/undici-types/balanced-pool.d.ts +11 -0
  14. package/dist/node_modules/undici-types/client.d.ts +12 -1
  15. package/dist/node_modules/undici-types/diagnostics-channel.d.ts +1 -2
  16. package/dist/node_modules/undici-types/dispatcher.d.ts +18 -4
  17. package/dist/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  18. package/dist/node_modules/undici-types/errors.d.ts +21 -0
  19. package/dist/node_modules/undici-types/eventsource.d.ts +63 -0
  20. package/dist/node_modules/undici-types/fetch.d.ts +25 -25
  21. package/dist/node_modules/undici-types/formdata.d.ts +1 -1
  22. package/dist/node_modules/undici-types/handlers.d.ts +10 -4
  23. package/dist/node_modules/undici-types/index.d.ts +10 -2
  24. package/dist/node_modules/undici-types/interceptors.d.ts +12 -2
  25. package/dist/node_modules/undici-types/mock-interceptor.d.ts +4 -4
  26. package/dist/node_modules/undici-types/package.json +1 -1
  27. package/dist/node_modules/undici-types/pool.d.ts +11 -0
  28. package/dist/node_modules/undici-types/proxy-agent.d.ts +0 -2
  29. package/dist/node_modules/undici-types/readable.d.ts +2 -3
  30. package/dist/node_modules/undici-types/retry-agent.d.ts +8 -0
  31. package/dist/node_modules/undici-types/retry-handler.d.ts +116 -0
  32. package/dist/node_modules/undici-types/util.d.ts +18 -0
  33. package/dist/node_modules/undici-types/webidl.d.ts +10 -8
  34. package/dist/node_modules/undici-types/websocket.d.ts +22 -1
  35. package/dist/package-lock.json +257 -200
  36. package/dist/util/system/getAvailableSystems.js +5 -0
  37. package/package.json +1 -1
@@ -1480,6 +1480,12 @@ declare module "util" {
1480
1480
  * Whether this command accepts positional arguments.
1481
1481
  */
1482
1482
  allowPositionals?: boolean | undefined;
1483
+ /**
1484
+ * If `true`, allows explicitly setting boolean options to `false` by prefixing the option name with `--no-`.
1485
+ * @default false
1486
+ * @since v20.16.0
1487
+ */
1488
+ allowNegative?: boolean | undefined;
1483
1489
  /**
1484
1490
  * Return the parsed tokens. This is useful for extending the built-in behavior,
1485
1491
  * from adding additional checks through to reprocessing the tokens in different ways.
@@ -172,6 +172,15 @@ declare module "zlib" {
172
172
  interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams {}
173
173
  interface InflateRaw extends stream.Transform, Zlib, ZlibReset {}
174
174
  interface Unzip extends stream.Transform, Zlib {}
175
+ /**
176
+ * Computes a 32-bit [Cyclic Redundancy Check](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) checksum of `data`.
177
+ * If `value` is specified, it is used as the starting value of the checksum, otherwise, 0 is used as the starting value.
178
+ * @param data When `data` is a string, it will be encoded as UTF-8 before being used for computation.
179
+ * @param value An optional starting value. It must be a 32-bit unsigned integer. @default 0
180
+ * @returns A 32-bit unsigned integer containing the checksum.
181
+ * @since v20.15.0
182
+ */
183
+ function crc32(data: string | Buffer | NodeJS.ArrayBufferView, value?: number): number;
175
184
  /**
176
185
  * Creates and returns a new `BrotliCompress` object.
177
186
  * @since v11.7.0, v10.16.0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Matteo Collina and Undici contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -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
  }
@@ -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 {
@@ -77,7 +88,7 @@ export declare namespace Client {
77
88
  */
78
89
  allowH2?: boolean;
79
90
  /**
80
- * @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overriden by a SETTINGS remote frame.
91
+ * @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
81
92
  * @default 100
82
93
  */
83
94
  maxConcurrentStreams?: number
@@ -9,8 +9,7 @@ declare namespace DiagnosticsChannel {
9
9
  completed: boolean;
10
10
  method?: Dispatcher.HttpMethod;
11
11
  path: string;
12
- headers: string;
13
- addHeader(key: string, value: string): Request;
12
+ headers: any;
14
13
  }
15
14
  interface Response {
16
15
  statusCode: number;
@@ -18,6 +18,9 @@ declare class Dispatcher extends EventEmitter {
18
18
  /** Starts two-way communications with the requested resource. */
19
19
  connect(options: Dispatcher.ConnectOptions): Promise<Dispatcher.ConnectData>;
20
20
  connect(options: Dispatcher.ConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
21
+ /** Compose a chain of dispatchers */
22
+ compose(dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
23
+ compose(...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
21
24
  /** Performs an HTTP request. */
22
25
  request(options: Dispatcher.RequestOptions): Promise<Dispatcher.ResponseData>;
23
26
  request(options: Dispatcher.RequestOptions, callback: (err: Error | null, data: Dispatcher.ResponseData) => void): void;
@@ -93,6 +96,8 @@ declare class Dispatcher extends EventEmitter {
93
96
  }
94
97
 
95
98
  declare namespace Dispatcher {
99
+ export interface ComposedDispatcher extends Dispatcher {}
100
+ export type DispatcherComposeInterceptor = (dispatch: Dispatcher['dispatch']) => Dispatcher['dispatch'];
96
101
  export interface DispatchOptions {
97
102
  origin?: string | URL;
98
103
  path: string;
@@ -100,7 +105,7 @@ declare namespace Dispatcher {
100
105
  /** Default: `null` */
101
106
  body?: string | Buffer | Uint8Array | Readable | null | FormData;
102
107
  /** Default: `null` */
103
- headers?: IncomingHttpHeaders | string[] | null;
108
+ headers?: IncomingHttpHeaders | string[] | Iterable<[string, string | string[] | undefined]> | null;
104
109
  /** Query string params to be embedded in the request URL. Default: `null` */
105
110
  query?: Record<string, any>;
106
111
  /** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */
@@ -121,6 +126,7 @@ declare namespace Dispatcher {
121
126
  expectContinue?: boolean;
122
127
  }
123
128
  export interface ConnectOptions {
129
+ origin: string | URL;
124
130
  path: string;
125
131
  /** Default: `null` */
126
132
  headers?: IncomingHttpHeaders | string[] | null;
@@ -130,6 +136,8 @@ declare namespace Dispatcher {
130
136
  opaque?: unknown;
131
137
  /** Default: 0 */
132
138
  maxRedirections?: number;
139
+ /** Default: false */
140
+ redirectionLimitReached?: boolean;
133
141
  /** Default: `null` */
134
142
  responseHeader?: 'raw' | null;
135
143
  }
@@ -140,6 +148,8 @@ declare namespace Dispatcher {
140
148
  signal?: AbortSignal | EventEmitter | null;
141
149
  /** Default: 0 */
142
150
  maxRedirections?: number;
151
+ /** Default: false */
152
+ redirectionLimitReached?: boolean;
143
153
  /** Default: `null` */
144
154
  onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
145
155
  /** Default: `null` */
@@ -163,6 +173,8 @@ declare namespace Dispatcher {
163
173
  signal?: AbortSignal | EventEmitter | null;
164
174
  /** Default: 0 */
165
175
  maxRedirections?: number;
176
+ /** Default: false */
177
+ redirectionLimitReached?: boolean;
166
178
  /** Default: `null` */
167
179
  responseHeader?: 'raw' | null;
168
180
  }
@@ -205,13 +217,15 @@ declare namespace Dispatcher {
205
217
  export type StreamFactory = (data: StreamFactoryData) => Writable;
206
218
  export interface DispatchHandlers {
207
219
  /** 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. */
208
- onConnect?(abort: () => void): void;
220
+ onConnect?(abort: (err?: Error) => void): void;
209
221
  /** Invoked when an error has occurred. */
210
222
  onError?(err: Error): void;
211
223
  /** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
212
224
  onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
225
+ /** Invoked when response is received, before headers have been read. **/
226
+ onResponseStarted?(): void;
213
227
  /** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
214
- onHeaders?(statusCode: number, headers: Buffer[] | string[] | null, resume: () => void): boolean;
228
+ onHeaders?(statusCode: number, headers: Buffer[], resume: () => void, statusText: string): boolean;
215
229
  /** Invoked when response payload data is received. */
216
230
  onData?(chunk: Buffer): boolean;
217
231
  /** Invoked when response payload and trailers have been received and the request has completed. */
@@ -226,7 +240,7 @@ declare namespace Dispatcher {
226
240
  * @link https://fetch.spec.whatwg.org/#body-mixin
227
241
  */
228
242
  interface BodyMixin {
229
- readonly body?: never; // throws on node v16.6.0
243
+ readonly body?: never;
230
244
  readonly bodyUsed: boolean;
231
245
  arrayBuffer(): Promise<ArrayBuffer>;
232
246
  blob(): Promise<Blob>;
@@ -0,0 +1,21 @@
1
+ import Agent from './agent'
2
+ import Dispatcher from './dispatcher'
3
+
4
+ export default EnvHttpProxyAgent
5
+
6
+ declare class EnvHttpProxyAgent extends Dispatcher {
7
+ constructor(opts?: EnvHttpProxyAgent.Options)
8
+
9
+ dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
10
+ }
11
+
12
+ declare namespace EnvHttpProxyAgent {
13
+ export interface Options extends Agent.Options {
14
+ /** Overrides the value of the HTTP_PROXY environment variable */
15
+ httpProxy?: string;
16
+ /** Overrides the value of the HTTPS_PROXY environment variable */
17
+ httpsProxy?: string;
18
+ /** Overrides the value of the NO_PROXY environment variable */
19
+ noProxy?: string;
20
+ }
21
+ }
@@ -125,4 +125,25 @@ declare namespace Errors {
125
125
  name: 'ResponseExceededMaxSizeError';
126
126
  code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
127
127
  }
128
+
129
+ export class RequestRetryError extends UndiciError {
130
+ constructor (
131
+ message: string,
132
+ statusCode: number,
133
+ headers?: IncomingHttpHeaders | string[] | null,
134
+ body?: null | Record<string, any> | string
135
+ );
136
+ name: 'RequestRetryError';
137
+ code: 'UND_ERR_REQ_RETRY';
138
+ statusCode: number;
139
+ data: {
140
+ count: number;
141
+ };
142
+ headers: Record<string, string | string[]>;
143
+ }
144
+
145
+ export class SecureProxyConnectionError extends UndiciError {
146
+ name: 'SecureProxyConnectionError';
147
+ code: 'UND_ERR_PRX_TLS';
148
+ }
128
149
  }
@@ -0,0 +1,63 @@
1
+ import { MessageEvent, ErrorEvent } from './websocket'
2
+ import Dispatcher from './dispatcher'
3
+
4
+ import {
5
+ EventTarget,
6
+ Event,
7
+ EventListenerOptions,
8
+ AddEventListenerOptions,
9
+ EventListenerOrEventListenerObject
10
+ } from './patch'
11
+
12
+ interface EventSourceEventMap {
13
+ error: ErrorEvent
14
+ message: MessageEvent
15
+ open: Event
16
+ }
17
+
18
+ interface EventSource extends EventTarget {
19
+ close(): void
20
+ readonly CLOSED: 2
21
+ readonly CONNECTING: 0
22
+ readonly OPEN: 1
23
+ onerror: (this: EventSource, ev: ErrorEvent) => any
24
+ onmessage: (this: EventSource, ev: MessageEvent) => any
25
+ onopen: (this: EventSource, ev: Event) => any
26
+ readonly readyState: 0 | 1 | 2
27
+ readonly url: string
28
+ readonly withCredentials: boolean
29
+
30
+ addEventListener<K extends keyof EventSourceEventMap>(
31
+ type: K,
32
+ listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
33
+ options?: boolean | AddEventListenerOptions
34
+ ): void
35
+ addEventListener(
36
+ type: string,
37
+ listener: EventListenerOrEventListenerObject,
38
+ options?: boolean | AddEventListenerOptions
39
+ ): void
40
+ removeEventListener<K extends keyof EventSourceEventMap>(
41
+ type: K,
42
+ listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
43
+ options?: boolean | EventListenerOptions
44
+ ): void
45
+ removeEventListener(
46
+ type: string,
47
+ listener: EventListenerOrEventListenerObject,
48
+ options?: boolean | EventListenerOptions
49
+ ): void
50
+ }
51
+
52
+ export declare const EventSource: {
53
+ prototype: EventSource
54
+ new (url: string | URL, init?: EventSourceInit): EventSource
55
+ readonly CLOSED: 2
56
+ readonly CONNECTING: 0
57
+ readonly OPEN: 1
58
+ }
59
+
60
+ interface EventSourceInit {
61
+ withCredentials?: boolean,
62
+ dispatcher?: Dispatcher
63
+ }
@@ -27,12 +27,29 @@ export type BodyInit =
27
27
  | null
28
28
  | string
29
29
 
30
- export interface BodyMixin {
30
+ export class BodyMixin {
31
31
  readonly body: ReadableStream | null
32
32
  readonly bodyUsed: boolean
33
33
 
34
34
  readonly arrayBuffer: () => Promise<ArrayBuffer>
35
35
  readonly blob: () => Promise<Blob>
36
+ /**
37
+ * @deprecated This method is not recommended for parsing multipart/form-data bodies in server environments.
38
+ * It is recommended to use a library such as [@fastify/busboy](https://www.npmjs.com/package/@fastify/busboy) as follows:
39
+ *
40
+ * @example
41
+ * ```js
42
+ * import { Busboy } from '@fastify/busboy'
43
+ * import { Readable } from 'node:stream'
44
+ *
45
+ * const response = await fetch('...')
46
+ * const busboy = new Busboy({ headers: { 'content-type': response.headers.get('content-type') } })
47
+ *
48
+ * // handle events emitted from `busboy`
49
+ *
50
+ * Readable.fromWeb(response.body).pipe(busboy)
51
+ * ```
52
+ */
36
53
  readonly formData: () => Promise<FormData>
37
54
  readonly json: () => Promise<unknown>
38
55
  readonly text: () => Promise<string>
@@ -68,7 +85,7 @@ export declare class Headers implements SpecIterable<[string, string]> {
68
85
  readonly keys: () => SpecIterableIterator<string>
69
86
  readonly values: () => SpecIterableIterator<string>
70
87
  readonly entries: () => SpecIterableIterator<[string, string]>
71
- readonly [Symbol.iterator]: () => SpecIterator<[string, string]>
88
+ readonly [Symbol.iterator]: () => SpecIterableIterator<[string, string]>
72
89
  }
73
90
 
74
91
  export type RequestCache =
@@ -105,10 +122,10 @@ export interface RequestInit {
105
122
  method?: string
106
123
  keepalive?: boolean
107
124
  headers?: HeadersInit
108
- body?: BodyInit
125
+ body?: BodyInit | null
109
126
  redirect?: RequestRedirect
110
127
  integrity?: string
111
- signal?: AbortSignal
128
+ signal?: AbortSignal | null
112
129
  credentials?: RequestCredentials
113
130
  mode?: RequestMode
114
131
  referrer?: string
@@ -135,7 +152,7 @@ export type RequestRedirect = 'error' | 'follow' | 'manual'
135
152
 
136
153
  export type RequestDuplex = 'half'
137
154
 
138
- export declare class Request implements BodyMixin {
155
+ export declare class Request extends BodyMixin {
139
156
  constructor (input: RequestInfo, init?: RequestInit)
140
157
 
141
158
  readonly cache: RequestCache
@@ -146,22 +163,14 @@ export declare class Request implements BodyMixin {
146
163
  readonly method: string
147
164
  readonly mode: RequestMode
148
165
  readonly redirect: RequestRedirect
149
- readonly referrerPolicy: string
166
+ readonly referrer: string
167
+ readonly referrerPolicy: ReferrerPolicy
150
168
  readonly url: string
151
169
 
152
170
  readonly keepalive: boolean
153
171
  readonly signal: AbortSignal
154
172
  readonly duplex: RequestDuplex
155
173
 
156
- readonly body: ReadableStream | null
157
- readonly bodyUsed: boolean
158
-
159
- readonly arrayBuffer: () => Promise<ArrayBuffer>
160
- readonly blob: () => Promise<Blob>
161
- readonly formData: () => Promise<FormData>
162
- readonly json: () => Promise<unknown>
163
- readonly text: () => Promise<string>
164
-
165
174
  readonly clone: () => Request
166
175
  }
167
176
 
@@ -181,7 +190,7 @@ export type ResponseType =
181
190
 
182
191
  export type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308
183
192
 
184
- export declare class Response implements BodyMixin {
193
+ export declare class Response extends BodyMixin {
185
194
  constructor (body?: BodyInit, init?: ResponseInit)
186
195
 
187
196
  readonly headers: Headers
@@ -192,15 +201,6 @@ export declare class Response implements BodyMixin {
192
201
  readonly url: string
193
202
  readonly redirected: boolean
194
203
 
195
- readonly body: ReadableStream | null
196
- readonly bodyUsed: boolean
197
-
198
- readonly arrayBuffer: () => Promise<ArrayBuffer>
199
- readonly blob: () => Promise<Blob>
200
- readonly formData: () => Promise<FormData>
201
- readonly json: () => Promise<unknown>
202
- readonly text: () => Promise<string>
203
-
204
204
  readonly clone: () => Response
205
205
 
206
206
  static error (): Response
@@ -2,7 +2,7 @@
2
2
  /// <reference types="node" />
3
3
 
4
4
  import { File } from './file'
5
- import { SpecIterator, SpecIterableIterator } from './fetch'
5
+ import { SpecIterableIterator } from './fetch'
6
6
 
7
7
  /**
8
8
  * A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
@@ -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
  }
@@ -14,9 +14,15 @@ import MockPool from'./mock-pool'
14
14
  import MockAgent from'./mock-agent'
15
15
  import mockErrors from'./mock-errors'
16
16
  import ProxyAgent from'./proxy-agent'
17
+ import EnvHttpProxyAgent from './env-http-proxy-agent'
18
+ import RetryHandler from'./retry-handler'
19
+ import RetryAgent from'./retry-agent'
17
20
  import { request, pipeline, stream, connect, upgrade } from './api'
21
+ import interceptors from './interceptors'
18
22
 
23
+ export * from './util'
19
24
  export * from './cookies'
25
+ export * from './eventsource'
20
26
  export * from './fetch'
21
27
  export * from './file'
22
28
  export * from './filereader'
@@ -27,7 +33,7 @@ export * from './content-type'
27
33
  export * from './cache'
28
34
  export { Interceptable } from './mock-interceptor'
29
35
 
30
- export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, MockClient, MockPool, MockAgent, mockErrors, ProxyAgent, RedirectHandler, DecoratorHandler }
36
+ export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, MockClient, MockPool, MockAgent, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent }
31
37
  export default Undici
32
38
 
33
39
  declare namespace Undici {
@@ -35,7 +41,8 @@ declare namespace Undici {
35
41
  var Pool: typeof import('./pool').default;
36
42
  var RedirectHandler: typeof import ('./handlers').RedirectHandler
37
43
  var DecoratorHandler: typeof import ('./handlers').DecoratorHandler
38
- var createRedirectInterceptor: typeof import ('./interceptors').createRedirectInterceptor
44
+ var RetryHandler: typeof import ('./retry-handler').default
45
+ var createRedirectInterceptor: typeof import ('./interceptors').default.createRedirectInterceptor
39
46
  var BalancedPool: typeof import('./balanced-pool').default;
40
47
  var Client: typeof import('./client').default;
41
48
  var buildConnector: typeof import('./connector').default;
@@ -60,4 +67,5 @@ declare namespace Undici {
60
67
  var File: typeof import('./file').File;
61
68
  var FileReader: typeof import('./filereader').FileReader;
62
69
  var caches: typeof import('./cache').caches;
70
+ var interceptors: typeof import('./interceptors').default;
63
71
  }
@@ -1,5 +1,15 @@
1
1
  import Dispatcher from "./dispatcher";
2
+ import RetryHandler from "./retry-handler";
2
3
 
3
- type RedirectInterceptorOpts = { maxRedirections?: number }
4
+ export default Interceptors;
4
5
 
5
- export declare function createRedirectInterceptor (opts: RedirectInterceptorOpts): Dispatcher.DispatchInterceptor
6
+ declare namespace Interceptors {
7
+ export type DumpInterceptorOpts = { maxSize?: number }
8
+ export type RetryInterceptorOpts = RetryHandler.RetryOptions
9
+ export type RedirectInterceptorOpts = { maxRedirections?: number }
10
+
11
+ export function createRedirectInterceptor(opts: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
12
+ export function dump(opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
13
+ export function retry(opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
14
+ export function redirect(opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
15
+ }
@@ -71,11 +71,11 @@ declare namespace MockInterceptor {
71
71
 
72
72
  export interface MockResponseCallbackOptions {
73
73
  path: string;
74
- origin: string;
75
74
  method: string;
76
- body?: BodyInit | Dispatcher.DispatchOptions['body'];
77
- headers: Headers | Record<string, string>;
78
- maxRedirections: number;
75
+ headers?: Headers | Record<string, string>;
76
+ origin?: string;
77
+ body?: BodyInit | Dispatcher.DispatchOptions['body'] | null;
78
+ maxRedirections?: number;
79
79
  }
80
80
 
81
81
  export type MockResponseDataHandler<TData extends object = object> = (
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici-types",
3
- "version": "5.26.5",
3
+ "version": "6.19.8",
4
4
  "description": "A stand-alone types package for Undici",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {
@@ -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 {
@@ -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
 
@@ -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
  *
@@ -0,0 +1,8 @@
1
+ import Dispatcher from './dispatcher'
2
+ import RetryHandler from './retry-handler'
3
+
4
+ export default RetryAgent
5
+
6
+ declare class RetryAgent extends Dispatcher {
7
+ constructor(dispatcher: Dispatcher, options?: RetryHandler.RetryOptions)
8
+ }