aws-delivlib 15.0.16 → 15.0.18

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 (101) hide show
  1. package/lib/publishing/github/node_modules/.yarn-integrity +2 -2
  2. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/README.md +1 -1
  3. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/assert.d.ts +5 -5
  4. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/async_hooks.d.ts +26 -6
  5. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/buffer.d.ts +1 -2
  6. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/child_process.d.ts +2 -2
  7. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/cluster.d.ts +15 -15
  8. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/console.d.ts +17 -17
  9. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/crypto.d.ts +35 -28
  10. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/dgram.d.ts +1 -1
  11. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/diagnostics_channel.d.ts +1 -1
  12. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/dns.d.ts +16 -16
  13. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/domain.d.ts +1 -1
  14. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/events.d.ts +1 -2
  15. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/fs/promises.d.ts +16 -9
  16. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/fs.d.ts +28 -19
  17. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/globals.d.ts +7 -6
  18. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/globals.typedarray.d.ts +1 -0
  19. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/http.d.ts +2 -2
  20. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/http2.d.ts +6 -3
  21. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/https.d.ts +1 -1
  22. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/index.d.ts +7 -5
  23. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/inspector.d.ts +3 -7
  24. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/module.d.ts +63 -29
  25. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/net.d.ts +2 -5
  26. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/os.d.ts +8 -7
  27. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/package.json +13 -3
  28. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/path.d.ts +1 -1
  29. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/perf_hooks.d.ts +8 -8
  30. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/process.d.ts +21 -11
  31. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/punycode.d.ts +1 -1
  32. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/querystring.d.ts +1 -1
  33. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/readline/promises.d.ts +0 -1
  34. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/readline.d.ts +13 -13
  35. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/repl.d.ts +14 -16
  36. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/sea.d.ts +1 -1
  37. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/sqlite.d.ts +182 -2
  38. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/stream.d.ts +8 -19
  39. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/string_decoder.d.ts +1 -1
  40. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/test.d.ts +53 -15
  41. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/timers/promises.d.ts +1 -1
  42. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/timers.d.ts +1 -1
  43. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/tls.d.ts +2 -48
  44. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/trace_events.d.ts +6 -6
  45. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/{compatibility → ts5.1/compatibility}/disposable.d.ts +0 -4
  46. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts5.1/index.d.ts +98 -0
  47. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  48. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +1 -0
  49. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts5.6/index.d.ts +9 -5
  50. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  51. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/ts5.7/index.d.ts +96 -0
  52. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/tty.d.ts +1 -1
  53. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/url.d.ts +52 -19
  54. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/util.d.ts +16 -295
  55. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/v8.d.ts +29 -32
  56. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/vm.d.ts +17 -10
  57. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/wasi.d.ts +1 -1
  58. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/worker_threads.d.ts +34 -18
  59. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/zlib.d.ts +5 -7
  60. package/lib/publishing/github/node_modules/undici-types/agent.d.ts +7 -7
  61. package/lib/publishing/github/node_modules/undici-types/api.d.ts +24 -24
  62. package/lib/publishing/github/node_modules/undici-types/balanced-pool.d.ts +11 -11
  63. package/lib/publishing/github/node_modules/undici-types/cache-interceptor.d.ts +172 -0
  64. package/lib/publishing/github/node_modules/undici-types/client.d.ts +12 -13
  65. package/lib/publishing/github/node_modules/undici-types/cookies.d.ts +2 -0
  66. package/lib/publishing/github/node_modules/undici-types/diagnostics-channel.d.ts +10 -10
  67. package/lib/publishing/github/node_modules/undici-types/dispatcher.d.ts +117 -92
  68. package/lib/publishing/github/node_modules/undici-types/env-http-proxy-agent.d.ts +2 -2
  69. package/lib/publishing/github/node_modules/undici-types/errors.d.ts +69 -47
  70. package/lib/publishing/github/node_modules/undici-types/fetch.d.ts +17 -16
  71. package/lib/publishing/github/node_modules/undici-types/formdata.d.ts +7 -7
  72. package/lib/publishing/github/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  73. package/lib/publishing/github/node_modules/undici-types/global-origin.d.ts +5 -5
  74. package/lib/publishing/github/node_modules/undici-types/h2c-client.d.ts +75 -0
  75. package/lib/publishing/github/node_modules/undici-types/handlers.d.ts +7 -7
  76. package/lib/publishing/github/node_modules/undici-types/header.d.ts +157 -1
  77. package/lib/publishing/github/node_modules/undici-types/index.d.ts +51 -47
  78. package/lib/publishing/github/node_modules/undici-types/interceptors.d.ts +25 -8
  79. package/lib/publishing/github/node_modules/undici-types/mock-agent.d.ts +33 -18
  80. package/lib/publishing/github/node_modules/undici-types/mock-call-history.d.ts +111 -0
  81. package/lib/publishing/github/node_modules/undici-types/mock-client.d.ts +4 -4
  82. package/lib/publishing/github/node_modules/undici-types/mock-errors.d.ts +3 -3
  83. package/lib/publishing/github/node_modules/undici-types/mock-interceptor.d.ts +19 -19
  84. package/lib/publishing/github/node_modules/undici-types/mock-pool.d.ts +4 -4
  85. package/lib/publishing/github/node_modules/undici-types/package.json +1 -1
  86. package/lib/publishing/github/node_modules/undici-types/patch.d.ts +0 -4
  87. package/lib/publishing/github/node_modules/undici-types/pool-stats.d.ts +8 -8
  88. package/lib/publishing/github/node_modules/undici-types/pool.d.ts +12 -12
  89. package/lib/publishing/github/node_modules/undici-types/proxy-agent.d.ts +4 -4
  90. package/lib/publishing/github/node_modules/undici-types/readable.d.ts +18 -15
  91. package/lib/publishing/github/node_modules/undici-types/retry-agent.d.ts +1 -1
  92. package/lib/publishing/github/node_modules/undici-types/retry-handler.d.ts +10 -10
  93. package/lib/publishing/github/node_modules/undici-types/util.d.ts +3 -3
  94. package/lib/publishing/github/node_modules/undici-types/utility.d.ts +7 -0
  95. package/lib/publishing/github/node_modules/undici-types/webidl.d.ts +44 -6
  96. package/lib/publishing/github/node_modules/undici-types/websocket.d.ts +35 -1
  97. package/package.json +2 -2
  98. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/compatibility/index.d.ts +0 -9
  99. package/lib/publishing/github/node_modules/@types/jsonwebtoken/node_modules/@types/node/compatibility/indexable.d.ts +0 -23
  100. package/lib/publishing/github/node_modules/undici-types/file.d.ts +0 -39
  101. package/lib/publishing/github/node_modules/undici-types/filereader.d.ts +0 -54
@@ -1,30 +1,29 @@
1
1
  import { URL } from 'url'
2
- import { TlsOptions } from 'tls'
3
2
  import Dispatcher from './dispatcher'
4
- import buildConnector from "./connector";
3
+ import buildConnector from './connector'
5
4
 
6
- type ClientConnectOptions = Omit<Dispatcher.ConnectOptions, "origin">;
5
+ type ClientConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>
7
6
 
8
7
  /**
9
8
  * A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
10
9
  */
11
10
  export class Client extends Dispatcher {
12
- constructor(url: string | URL, options?: Client.Options);
11
+ constructor (url: string | URL, options?: Client.Options)
13
12
  /** Property to get and set the pipelining factor. */
14
- pipelining: number;
13
+ pipelining: number
15
14
  /** `true` after `client.close()` has been called. */
16
- closed: boolean;
15
+ closed: boolean
17
16
  /** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */
18
- destroyed: boolean;
17
+ destroyed: boolean
19
18
 
20
19
  // Override dispatcher APIs.
21
- override connect(
20
+ override connect (
22
21
  options: ClientConnectOptions
23
- ): Promise<Dispatcher.ConnectData>;
24
- override connect(
22
+ ): Promise<Dispatcher.ConnectData>
23
+ override connect (
25
24
  options: ClientConnectOptions,
26
25
  callback: (err: Error | null, data: Dispatcher.ConnectData) => void
27
- ): void;
26
+ ): void
28
27
  }
29
28
 
30
29
  export declare namespace Client {
@@ -71,7 +70,7 @@ export declare namespace Client {
71
70
  /** TODO */
72
71
  maxRedirections?: number;
73
72
  /** TODO */
74
- connect?: buildConnector.BuildOptions | buildConnector.connector;
73
+ connect?: Partial<buildConnector.BuildOptions> | buildConnector.connector;
75
74
  /** TODO */
76
75
  maxRequestsPerClient?: number;
77
76
  /** TODO */
@@ -105,4 +104,4 @@ export declare namespace Client {
105
104
  }
106
105
  }
107
106
 
108
- export default Client;
107
+ export default Client
@@ -26,3 +26,5 @@ export function getCookies (headers: Headers): Record<string, string>
26
26
  export function getSetCookies (headers: Headers): Cookie[]
27
27
 
28
28
  export function setCookie (headers: Headers, cookie: Cookie): void
29
+
30
+ export function parseCookie (cookie: string): Cookie | null
@@ -1,7 +1,7 @@
1
- import { Socket } from "net";
2
- import { URL } from "url";
3
- import Connector from "./connector";
4
- import Dispatcher from "./dispatcher";
1
+ import { Socket } from 'net'
2
+ import { URL } from 'url'
3
+ import buildConnector from './connector'
4
+ import Dispatcher from './dispatcher'
5
5
 
6
6
  declare namespace DiagnosticsChannel {
7
7
  interface Request {
@@ -16,15 +16,15 @@ declare namespace DiagnosticsChannel {
16
16
  statusText: string;
17
17
  headers: Array<Buffer>;
18
18
  }
19
- type Error = unknown;
19
+ type Error = unknown
20
20
  interface ConnectParams {
21
- host: URL["host"];
22
- hostname: URL["hostname"];
23
- protocol: URL["protocol"];
24
- port: URL["port"];
21
+ host: URL['host'];
22
+ hostname: URL['hostname'];
23
+ protocol: URL['protocol'];
24
+ port: URL['port'];
25
25
  servername: string | null;
26
26
  }
27
- type Connector = Connector.connector;
27
+ type Connector = buildConnector.connector
28
28
  export interface RequestCreateMessage {
29
29
  request: Request;
30
30
  }
@@ -6,98 +6,98 @@ import { IncomingHttpHeaders } from './header'
6
6
  import BodyReadable from './readable'
7
7
  import { FormData } from './formdata'
8
8
  import Errors from './errors'
9
+ import { Autocomplete } from './utility'
9
10
 
10
- type AbortSignal = unknown;
11
+ type AbortSignal = unknown
11
12
 
12
13
  export default Dispatcher
13
14
 
15
+ export type UndiciHeaders = Record<string, string | string[]> | IncomingHttpHeaders | string[] | Iterable<[string, string | string[] | undefined]> | null
16
+
14
17
  /** Dispatcher is the core API used to dispatch requests. */
15
18
  declare class Dispatcher extends EventEmitter {
16
19
  /** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */
17
- dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
20
+ dispatch (options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
18
21
  /** Starts two-way communications with the requested resource. */
19
- connect(options: Dispatcher.ConnectOptions): Promise<Dispatcher.ConnectData>;
20
- connect(options: Dispatcher.ConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
22
+ connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>
23
+ connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ConnectData<TOpaque>) => void): void
21
24
  /** Compose a chain of dispatchers */
22
- compose(dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
23
- compose(...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher;
25
+ compose (dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
26
+ compose (...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
24
27
  /** Performs an HTTP request. */
25
- request(options: Dispatcher.RequestOptions): Promise<Dispatcher.ResponseData>;
26
- request(options: Dispatcher.RequestOptions, callback: (err: Error | null, data: Dispatcher.ResponseData) => void): void;
28
+ request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>
29
+ request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ResponseData<TOpaque>) => void): void
27
30
  /** For easy use with `stream.pipeline`. */
28
- pipeline(options: Dispatcher.PipelineOptions, handler: Dispatcher.PipelineHandler): Duplex;
31
+ pipeline<TOpaque = null>(options: Dispatcher.PipelineOptions<TOpaque>, handler: Dispatcher.PipelineHandler<TOpaque>): Duplex
29
32
  /** A faster version of `Dispatcher.request`. */
30
- stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory): Promise<Dispatcher.StreamData>;
31
- stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory, callback: (err: Error | null, data: Dispatcher.StreamData) => void): void;
33
+ stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>>
34
+ stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>, callback: (err: Error | null, data: Dispatcher.StreamData<TOpaque>) => void): void
32
35
  /** Upgrade to a different protocol. */
33
- upgrade(options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>;
34
- upgrade(options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void;
36
+ upgrade (options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>
37
+ upgrade (options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void
35
38
  /** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
36
- close(): Promise<void>;
37
- close(callback: () => void): void;
39
+ close (): Promise<void>
40
+ close (callback: () => void): void
38
41
  /** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */
39
- destroy(): Promise<void>;
40
- destroy(err: Error | null): Promise<void>;
41
- destroy(callback: () => void): void;
42
- destroy(err: Error | null, callback: () => void): void;
43
-
44
- on(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
45
- on(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
46
- on(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
47
- on(eventName: 'drain', callback: (origin: URL) => void): this;
48
-
49
-
50
- once(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
51
- once(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
52
- once(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
53
- once(eventName: 'drain', callback: (origin: URL) => void): this;
42
+ destroy (): Promise<void>
43
+ destroy (err: Error | null): Promise<void>
44
+ destroy (callback: () => void): void
45
+ destroy (err: Error | null, callback: () => void): void
54
46
 
47
+ on (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
48
+ on (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
49
+ on (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
50
+ on (eventName: 'drain', callback: (origin: URL) => void): this
55
51
 
56
- off(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
57
- off(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
58
- off(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
59
- off(eventName: 'drain', callback: (origin: URL) => void): this;
52
+ once (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
53
+ once (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
54
+ once (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
55
+ once (eventName: 'drain', callback: (origin: URL) => void): this
60
56
 
57
+ off (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
58
+ off (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
59
+ off (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
60
+ off (eventName: 'drain', callback: (origin: URL) => void): this
61
61
 
62
- addListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
63
- addListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
64
- addListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
65
- addListener(eventName: 'drain', callback: (origin: URL) => void): this;
62
+ addListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
63
+ addListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
64
+ addListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
65
+ addListener (eventName: 'drain', callback: (origin: URL) => void): this
66
66
 
67
- removeListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
68
- removeListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
69
- removeListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
70
- removeListener(eventName: 'drain', callback: (origin: URL) => void): this;
67
+ removeListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
68
+ removeListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
69
+ removeListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
70
+ removeListener (eventName: 'drain', callback: (origin: URL) => void): this
71
71
 
72
- prependListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
73
- prependListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
74
- prependListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
75
- prependListener(eventName: 'drain', callback: (origin: URL) => void): this;
72
+ prependListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
73
+ prependListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
74
+ prependListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
75
+ prependListener (eventName: 'drain', callback: (origin: URL) => void): this
76
76
 
77
- prependOnceListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this;
78
- prependOnceListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
79
- prependOnceListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
80
- prependOnceListener(eventName: 'drain', callback: (origin: URL) => void): this;
77
+ prependOnceListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
78
+ prependOnceListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
79
+ prependOnceListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
80
+ prependOnceListener (eventName: 'drain', callback: (origin: URL) => void): this
81
81
 
82
- listeners(eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
83
- listeners(eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
84
- listeners(eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
85
- listeners(eventName: 'drain'): ((origin: URL) => void)[];
82
+ listeners (eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
83
+ listeners (eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
84
+ listeners (eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
85
+ listeners (eventName: 'drain'): ((origin: URL) => void)[]
86
86
 
87
- rawListeners(eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
88
- rawListeners(eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
89
- rawListeners(eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
90
- rawListeners(eventName: 'drain'): ((origin: URL) => void)[];
87
+ rawListeners (eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
88
+ rawListeners (eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
89
+ rawListeners (eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
90
+ rawListeners (eventName: 'drain'): ((origin: URL) => void)[]
91
91
 
92
- emit(eventName: 'connect', origin: URL, targets: readonly Dispatcher[]): boolean;
93
- emit(eventName: 'disconnect', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
94
- emit(eventName: 'connectionError', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
95
- emit(eventName: 'drain', origin: URL): boolean;
92
+ emit (eventName: 'connect', origin: URL, targets: readonly Dispatcher[]): boolean
93
+ emit (eventName: 'disconnect', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean
94
+ emit (eventName: 'connectionError', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean
95
+ emit (eventName: 'drain', origin: URL): boolean
96
96
  }
97
97
 
98
98
  declare namespace Dispatcher {
99
99
  export interface ComposedDispatcher extends Dispatcher {}
100
- export type DispatcherComposeInterceptor = (dispatch: Dispatcher['dispatch']) => Dispatcher['dispatch'];
100
+ export type DispatcherComposeInterceptor = (dispatch: Dispatcher['dispatch']) => Dispatcher['dispatch']
101
101
  export interface DispatchOptions {
102
102
  origin?: string | URL;
103
103
  path: string;
@@ -105,12 +105,12 @@ declare namespace Dispatcher {
105
105
  /** Default: `null` */
106
106
  body?: string | Buffer | Uint8Array | Readable | null | FormData;
107
107
  /** Default: `null` */
108
- headers?: IncomingHttpHeaders | string[] | Iterable<[string, string | string[] | undefined]> | null;
108
+ headers?: UndiciHeaders;
109
109
  /** Query string params to be embedded in the request URL. Default: `null` */
110
110
  query?: Record<string, any>;
111
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`. */
112
112
  idempotent?: boolean;
113
- /** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. */
113
+ /** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. Defaults to `method !== 'HEAD'`. */
114
114
  blocking?: boolean;
115
115
  /** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
116
116
  upgrade?: boolean | string | null;
@@ -122,28 +122,28 @@ declare namespace Dispatcher {
122
122
  reset?: boolean;
123
123
  /** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
124
124
  throwOnError?: boolean;
125
- /** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server*/
125
+ /** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server */
126
126
  expectContinue?: boolean;
127
127
  }
128
- export interface ConnectOptions {
128
+ export interface ConnectOptions<TOpaque = null> {
129
129
  origin: string | URL;
130
130
  path: string;
131
131
  /** Default: `null` */
132
- headers?: IncomingHttpHeaders | string[] | null;
132
+ headers?: UndiciHeaders;
133
133
  /** Default: `null` */
134
134
  signal?: AbortSignal | EventEmitter | null;
135
135
  /** This argument parameter is passed through to `ConnectData` */
136
- opaque?: unknown;
136
+ opaque?: TOpaque;
137
137
  /** Default: 0 */
138
138
  maxRedirections?: number;
139
139
  /** Default: false */
140
140
  redirectionLimitReached?: boolean;
141
141
  /** Default: `null` */
142
- responseHeader?: 'raw' | null;
142
+ responseHeaders?: 'raw' | null;
143
143
  }
144
- export interface RequestOptions extends DispatchOptions {
144
+ export interface RequestOptions<TOpaque = null> extends DispatchOptions {
145
145
  /** Default: `null` */
146
- opaque?: unknown;
146
+ opaque?: TOpaque;
147
147
  /** Default: `null` */
148
148
  signal?: AbortSignal | EventEmitter | null;
149
149
  /** Default: 0 */
@@ -153,11 +153,11 @@ declare namespace Dispatcher {
153
153
  /** Default: `null` */
154
154
  onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
155
155
  /** Default: `null` */
156
- responseHeader?: 'raw' | null;
156
+ responseHeaders?: 'raw' | null;
157
157
  /** Default: `64 KiB` */
158
158
  highWaterMark?: number;
159
159
  }
160
- export interface PipelineOptions extends RequestOptions {
160
+ export interface PipelineOptions<TOpaque = null> extends RequestOptions<TOpaque> {
161
161
  /** `true` if the `handler` will return an object stream. Default: `false` */
162
162
  objectMode?: boolean;
163
163
  }
@@ -166,7 +166,7 @@ declare namespace Dispatcher {
166
166
  /** Default: `'GET'` */
167
167
  method?: string;
168
168
  /** Default: `null` */
169
- headers?: IncomingHttpHeaders | string[] | null;
169
+ headers?: UndiciHeaders;
170
170
  /** A string of comma separated protocols, in descending preference order. Default: `'Websocket'` */
171
171
  protocol?: string;
172
172
  /** Default: `null` */
@@ -176,65 +176,90 @@ declare namespace Dispatcher {
176
176
  /** Default: false */
177
177
  redirectionLimitReached?: boolean;
178
178
  /** Default: `null` */
179
- responseHeader?: 'raw' | null;
179
+ responseHeaders?: 'raw' | null;
180
180
  }
181
- export interface ConnectData {
181
+ export interface ConnectData<TOpaque = null> {
182
182
  statusCode: number;
183
183
  headers: IncomingHttpHeaders;
184
184
  socket: Duplex;
185
- opaque: unknown;
185
+ opaque: TOpaque;
186
186
  }
187
- export interface ResponseData {
187
+ export interface ResponseData<TOpaque = null> {
188
188
  statusCode: number;
189
189
  headers: IncomingHttpHeaders;
190
190
  body: BodyReadable & BodyMixin;
191
191
  trailers: Record<string, string>;
192
- opaque: unknown;
192
+ opaque: TOpaque;
193
193
  context: object;
194
194
  }
195
- export interface PipelineHandlerData {
195
+ export interface PipelineHandlerData<TOpaque = null> {
196
196
  statusCode: number;
197
197
  headers: IncomingHttpHeaders;
198
- opaque: unknown;
198
+ opaque: TOpaque;
199
199
  body: BodyReadable;
200
200
  context: object;
201
201
  }
202
- export interface StreamData {
203
- opaque: unknown;
202
+ export interface StreamData<TOpaque = null> {
203
+ opaque: TOpaque;
204
204
  trailers: Record<string, string>;
205
205
  }
206
- export interface UpgradeData {
206
+ export interface UpgradeData<TOpaque = null> {
207
207
  headers: IncomingHttpHeaders;
208
208
  socket: Duplex;
209
- opaque: unknown;
209
+ opaque: TOpaque;
210
210
  }
211
- export interface StreamFactoryData {
211
+ export interface StreamFactoryData<TOpaque = null> {
212
212
  statusCode: number;
213
213
  headers: IncomingHttpHeaders;
214
- opaque: unknown;
214
+ opaque: TOpaque;
215
215
  context: object;
216
216
  }
217
- export type StreamFactory = (data: StreamFactoryData) => Writable;
218
- export interface DispatchHandlers {
217
+ export type StreamFactory<TOpaque = null> = (data: StreamFactoryData<TOpaque>) => Writable
218
+
219
+ export interface DispatchController {
220
+ get aborted () : boolean
221
+ get paused () : boolean
222
+ get reason () : Error | null
223
+ abort (reason: Error): void
224
+ pause(): void
225
+ resume(): void
226
+ }
227
+
228
+ export interface DispatchHandler {
229
+ onRequestStart?(controller: DispatchController, context: any): void;
230
+ onRequestUpgrade?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, socket: Duplex): void;
231
+ onResponseStart?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, statusMessage?: string): void;
232
+ onResponseData?(controller: DispatchController, chunk: Buffer): void;
233
+ onResponseEnd?(controller: DispatchController, trailers: IncomingHttpHeaders): void;
234
+ onResponseError?(controller: DispatchController, error: Error): void;
235
+
219
236
  /** 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. */
237
+ /** @deprecated */
220
238
  onConnect?(abort: (err?: Error) => void): void;
221
239
  /** Invoked when an error has occurred. */
240
+ /** @deprecated */
222
241
  onError?(err: Error): void;
223
242
  /** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
243
+ /** @deprecated */
224
244
  onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
225
245
  /** Invoked when response is received, before headers have been read. **/
246
+ /** @deprecated */
226
247
  onResponseStarted?(): void;
227
248
  /** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
249
+ /** @deprecated */
228
250
  onHeaders?(statusCode: number, headers: Buffer[], resume: () => void, statusText: string): boolean;
229
251
  /** Invoked when response payload data is received. */
252
+ /** @deprecated */
230
253
  onData?(chunk: Buffer): boolean;
231
254
  /** Invoked when response payload and trailers have been received and the request has completed. */
255
+ /** @deprecated */
232
256
  onComplete?(trailers: string[] | null): void;
233
257
  /** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
258
+ /** @deprecated */
234
259
  onBodySent?(chunkSize: number, totalBytesSent: number): void;
235
260
  }
236
- export type PipelineHandler = (data: PipelineHandlerData) => Readable;
237
- export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';
261
+ export type PipelineHandler<TOpaque = null> = (data: PipelineHandlerData<TOpaque>) => Readable
262
+ export type HttpMethod = Autocomplete<'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'>
238
263
 
239
264
  /**
240
265
  * @link https://fetch.spec.whatwg.org/#body-mixin
@@ -4,9 +4,9 @@ import Dispatcher from './dispatcher'
4
4
  export default EnvHttpProxyAgent
5
5
 
6
6
  declare class EnvHttpProxyAgent extends Dispatcher {
7
- constructor(opts?: EnvHttpProxyAgent.Options)
7
+ constructor (opts?: EnvHttpProxyAgent.Options)
8
8
 
9
- dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
9
+ dispatch (options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
10
10
  }
11
11
 
12
12
  declare namespace EnvHttpProxyAgent {