diff --git a/docs/docs/api/Agent.md b/docs/docs/api/Agent.md index e3e3e26a93b..43b8d30ff5c 100644 --- a/docs/docs/api/Agent.md +++ b/docs/docs/api/Agent.md @@ -16,7 +16,7 @@ Returns: `Agent` ### Parameter: `AgentOptions` -Extends: [`PoolOptions`](Pool.md#parameter-pooloptions) +Extends: [`PoolOptions`](/docs/docs/api/Pool.md#parameter-pooloptions) * **factory** `(origin: URL, opts: Object) => Dispatcher` - Default: `(origin, opts) => new Pool(origin, opts)` @@ -24,54 +24,54 @@ Extends: [`PoolOptions`](Pool.md#parameter-pooloptions) ### `Agent.closed` -Implements [Client.closed](Client.md#clientclosed) +Implements [Client.closed](/docs/docs/api/Client.md#clientclosed) ### `Agent.destroyed` -Implements [Client.destroyed](Client.md#clientdestroyed) +Implements [Client.destroyed](/docs/docs/api/Client.md#clientdestroyed) ## Instance Methods ### `Agent.close([callback])` -Implements [`Dispatcher.close([callback])`](Dispatcher.md#dispatcherclosecallback-promise). +Implements [`Dispatcher.close([callback])`](/docs/docs/api/Dispatcher.md#dispatcherclosecallback-promise). ### `Agent.destroy([error, callback])` -Implements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise). +Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise). ### `Agent.dispatch(options, handler: AgentDispatchOptions)` -Implements [`Dispatcher.dispatch(options, handler)`](Dispatcher.md#dispatcherdispatchoptions-handler). +Implements [`Dispatcher.dispatch(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler). #### Parameter: `AgentDispatchOptions` -Extends: [`DispatchOptions`](Dispatcher.md#parameter-dispatchoptions) +Extends: [`DispatchOptions`](/docs/docs/api/Dispatcher.md#parameter-dispatchoptions) * **origin** `string | URL` -Implements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise). +Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise). ### `Agent.connect(options[, callback])` -See [`Dispatcher.connect(options[, callback])`](Dispatcher.md#dispatcherconnectoptions-callback). +See [`Dispatcher.connect(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback). ### `Agent.dispatch(options, handler)` -Implements [`Dispatcher.dispatch(options, handler)`](Dispatcher.md#dispatcherdispatchoptions-handler). +Implements [`Dispatcher.dispatch(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler). ### `Agent.pipeline(options, handler)` -See [`Dispatcher.pipeline(options, handler)`](Dispatcher.md#dispatcherpipelineoptions-handler). +See [`Dispatcher.pipeline(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler). ### `Agent.request(options[, callback])` -See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback). +See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback). ### `Agent.stream(options, factory[, callback])` -See [`Dispatcher.stream(options, factory[, callback])`](Dispatcher.md#dispatcherstreamoptions-factory-callback). +See [`Dispatcher.stream(options, factory[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback). ### `Agent.upgrade(options[, callback])` -See [`Dispatcher.upgrade(options[, callback])`](Dispatcher.md#dispatcherupgradeoptions-callback). +See [`Dispatcher.upgrade(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback). diff --git a/docs/docs/api/BalancedPool.md b/docs/docs/api/BalancedPool.md index a7e5598c800..df267fe7270 100644 --- a/docs/docs/api/BalancedPool.md +++ b/docs/docs/api/BalancedPool.md @@ -15,7 +15,7 @@ Arguments: ### Parameter: `BalancedPoolOptions` -Extends: [`PoolOptions`](Pool.md#parameter-pooloptions) +Extends: [`PoolOptions`](/docs/docs/api/Pool.md#parameter-pooloptions) * **factory** `(origin: URL, opts: Object) => Dispatcher` - Default: `(origin, opts) => new Pool(origin, opts)` @@ -28,15 +28,15 @@ Returns an array of upstreams that were previously added. ### `BalancedPool.closed` -Implements [Client.closed](Client.md#clientclosed) +Implements [Client.closed](/docs/docs/api/Client.md#clientclosed) ### `BalancedPool.destroyed` -Implements [Client.destroyed](Client.md#clientdestroyed) +Implements [Client.destroyed](/docs/docs/api/Client.md#clientdestroyed) ### `Pool.stats` -Returns [`PoolStats`](PoolStats.md) instance for this pool. +Returns [`PoolStats`](/docs/docs/api/PoolStats.md) instance for this pool. ## Instance Methods @@ -54,46 +54,46 @@ Removes an upstream that was previously added. ### `BalancedPool.close([callback])` -Implements [`Dispatcher.close([callback])`](Dispatcher.md#dispatcherclosecallback-promise). +Implements [`Dispatcher.close([callback])`](/docs/docs/api/Dispatcher.md#dispatcherclosecallback-promise). ### `BalancedPool.destroy([error, callback])` -Implements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise). +Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise). ### `BalancedPool.connect(options[, callback])` -See [`Dispatcher.connect(options[, callback])`](Dispatcher.md#dispatcherconnectoptions-callback). +See [`Dispatcher.connect(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback). ### `BalancedPool.dispatch(options, handlers)` -Implements [`Dispatcher.dispatch(options, handlers)`](Dispatcher.md#dispatcherdispatchoptions-handler). +Implements [`Dispatcher.dispatch(options, handlers)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler). ### `BalancedPool.pipeline(options, handler)` -See [`Dispatcher.pipeline(options, handler)`](Dispatcher.md#dispatcherpipelineoptions-handler). +See [`Dispatcher.pipeline(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler). ### `BalancedPool.request(options[, callback])` -See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback). +See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback). ### `BalancedPool.stream(options, factory[, callback])` -See [`Dispatcher.stream(options, factory[, callback])`](Dispatcher.md#dispatcherstreamoptions-factory-callback). +See [`Dispatcher.stream(options, factory[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback). ### `BalancedPool.upgrade(options[, callback])` -See [`Dispatcher.upgrade(options[, callback])`](Dispatcher.md#dispatcherupgradeoptions-callback). +See [`Dispatcher.upgrade(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback). ## Instance Events ### Event: `'connect'` -See [Dispatcher Event: `'connect'`](Dispatcher.md#event-connect). +See [Dispatcher Event: `'connect'`](/docs/docs/api/Dispatcher.md#event-connect). ### Event: `'disconnect'` -See [Dispatcher Event: `'disconnect'`](Dispatcher.md#event-disconnect). +See [Dispatcher Event: `'disconnect'`](/docs/docs/api/Dispatcher.md#event-disconnect). ### Event: `'drain'` -See [Dispatcher Event: `'drain'`](Dispatcher.md#event-drain). +See [Dispatcher Event: `'drain'`](/docs/docs/api/Dispatcher.md#event-drain). diff --git a/docs/docs/api/CacheStore.md b/docs/docs/api/CacheStore.md index b7e3cd192f8..f8a6962d65a 100644 --- a/docs/docs/api/CacheStore.md +++ b/docs/docs/api/CacheStore.md @@ -98,3 +98,22 @@ This would be is either the same sa staleAt or the `max-stale` caching directive. The store must not return a response after the time defined in this property. + +## `CacheStoreReadable` + +This extends Node's [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable) +and defines extra properties relevant to the cache interceptor. + +### Getter: `value` + +The response's [`CacheStoreValue`](/docs/docs/api/CacheStore.md#cachestorevalue) + +## `CacheStoreWriteable` + +This extends Node's [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable) +and defines extra properties relevant to the cache interceptor. + +### Setter: `rawTrailers` + +If the response has trailers, the cache interceptor will pass them to the cache +interceptor through this method. diff --git a/docs/docs/api/Client.md b/docs/docs/api/Client.md index 0be99625d2e..61f597c7dfe 100644 --- a/docs/docs/api/Client.md +++ b/docs/docs/api/Client.md @@ -86,37 +86,37 @@ const client = new Client('https://localhost:3000', { ### `Client.close([callback])` -Implements [`Dispatcher.close([callback])`](Dispatcher.md#dispatcherclosecallback-promise). +Implements [`Dispatcher.close([callback])`](/docs/docs/api/Dispatcher.md#dispatcherclosecallback-promise). ### `Client.destroy([error, callback])` -Implements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise). +Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise). Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). ### `Client.connect(options[, callback])` -See [`Dispatcher.connect(options[, callback])`](Dispatcher.md#dispatcherconnectoptions-callback). +See [`Dispatcher.connect(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback). ### `Client.dispatch(options, handlers)` -Implements [`Dispatcher.dispatch(options, handlers)`](Dispatcher.md#dispatcherdispatchoptions-handler). +Implements [`Dispatcher.dispatch(options, handlers)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler). ### `Client.pipeline(options, handler)` -See [`Dispatcher.pipeline(options, handler)`](Dispatcher.md#dispatcherpipelineoptions-handler). +See [`Dispatcher.pipeline(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler). ### `Client.request(options[, callback])` -See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback). +See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback). ### `Client.stream(options, factory[, callback])` -See [`Dispatcher.stream(options, factory[, callback])`](Dispatcher.md#dispatcherstreamoptions-factory-callback). +See [`Dispatcher.stream(options, factory[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback). ### `Client.upgrade(options[, callback])` -See [`Dispatcher.upgrade(options[, callback])`](Dispatcher.md#dispatcherupgradeoptions-callback). +See [`Dispatcher.upgrade(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback). ## Instance Properties @@ -142,7 +142,7 @@ Property to get and set the pipelining factor. ### Event: `'connect'` -See [Dispatcher Event: `'connect'`](Dispatcher.md#event-connect). +See [Dispatcher Event: `'connect'`](/docs/docs/api/Dispatcher.md#event-connect). Parameters: @@ -188,7 +188,7 @@ try { ### Event: `'disconnect'` -See [Dispatcher Event: `'disconnect'`](Dispatcher.md#event-disconnect). +See [Dispatcher Event: `'disconnect'`](/docs/docs/api/Dispatcher.md#event-disconnect). Parameters: @@ -233,7 +233,7 @@ try { Emitted when pipeline is no longer busy. -See [Dispatcher Event: `'drain'`](Dispatcher.md#event-drain). +See [Dispatcher Event: `'drain'`](/docs/docs/api/Dispatcher.md#event-drain). #### Example - Client drain event diff --git a/docs/docs/api/Dispatcher.md b/docs/docs/api/Dispatcher.md index e77b7771114..ff219bdbe3c 100644 --- a/docs/docs/api/Dispatcher.md +++ b/docs/docs/api/Dispatcher.md @@ -377,7 +377,7 @@ Returns: `stream.Duplex` #### Parameter: PipelineOptions -Extends: [`RequestOptions`](#parameter-requestoptions) +Extends: [`RequestOptions`](/docs/docs/api/Dispatch.md#parameter-requestoptions) * **objectMode** `boolean` (optional) - Default: `false` - Set to `true` if the `handler` will return an object stream. @@ -467,7 +467,7 @@ Returns: `void | Promise` - Only returns a `Promise` if no `callba #### Parameter: `RequestOptions` -Extends: [`DispatchOptions`](#parameter-dispatchoptions) +Extends: [`DispatchOptions`](/docs/docs/api/Dispatch.md#parameter-dispatchoptions) * **opaque** `unknown` (optional) - Default: `null` - Used for passing through context to `ResponseData`. * **signal** `AbortSignal | events.EventEmitter | null` (optional) - Default: `null`. @@ -654,7 +654,7 @@ return null A faster version of `Dispatcher.request`. This method expects the second argument `factory` to return a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable) stream which the response will be written to. This improves performance by avoiding creating an intermediate [`stream.Readable`](https://nodejs.org/api/stream.html#stream_readable_streams) stream when the user expects to directly pipe the response body to a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable) stream. -As demonstrated in [Example 1 - Basic GET stream request](#example-1---basic-get-stream-request), it is recommended to use the `option.opaque` property to avoid creating a closure for the `factory` method. This pattern works well with Node.js Web Frameworks such as [Fastify](https://fastify.io). See [Example 2 - Stream to Fastify Response](#example-2---stream-to-fastify-response) for more details. +As demonstrated in [Example 1 - Basic GET stream request](/docs/docs/api/Dispatch.md#example-1---basic-get-stream-request), it is recommended to use the `option.opaque` property to avoid creating a closure for the `factory` method. This pattern works well with Node.js Web Frameworks such as [Fastify](https://fastify.io). See [Example 2 - Stream to Fastify Response](/docs/docs/api/Dispatch.md#example-2---stream-to-fastify-response) for more details. Arguments: @@ -936,7 +936,7 @@ await client.request({ path: '/', method: 'GET' }) The `redirect` interceptor allows you to customize the way your dispatcher handles redirects. -It accepts the same arguments as the [`RedirectHandler` constructor](./RedirectHandler.md). +It accepts the same arguments as the [`RedirectHandler` constructor](/docs/docs/api/RedirectHandler.md). **Example - Basic Redirect Interceptor** @@ -954,7 +954,7 @@ client.request({ path: "/" }) The `retry` interceptor allows you to customize the way your dispatcher handles retries. -It accepts the same arguments as the [`RetryHandler` constructor](./RetryHandler.md). +It accepts the same arguments as the [`RetryHandler` constructor](/docs/docs/api/RetryHandler.md). **Example - Basic Redirect Interceptor** @@ -1260,7 +1260,7 @@ The `cache` interceptor implements client-side response caching as described in **Options** -- `store` - The [`CacheStore`](./CacheStore.md) to store and retrieve responses from. Default is [`MemoryCacheStore`](./CacheStore.md#memorycachestore). +- `store` - The [`CacheStore`](/docs/docs/api/CacheStore.md) to store and retrieve responses from. Default is [`MemoryCacheStore`](/docs/docs/api/CacheStore.md#memorycachestore). - `methods` - The [**safe** HTTP methods](https://www.rfc-editor.org/rfc/rfc9110#section-9.2.1) to cache the response of. ## Instance Events @@ -1309,13 +1309,13 @@ Emitted when dispatcher is no longer busy. * `Record | string[] | Iterable<[string, string | string[] | undefined]> | null` -Header arguments such as `options.headers` in [`Client.dispatch`](Client.md#clientdispatchoptions-handlers) can be specified in three forms: +Header arguments such as `options.headers` in [`Client.dispatch`](/docs/docs/api/Client.md#clientdispatchoptions-handlers) can be specified in three forms: * As an object specified by the `Record` (`IncomingHttpHeaders`) type. * As an array of strings. An array representation of a header list must have an even length, or an `InvalidArgumentError` will be thrown. * As an iterable that can encompass `Headers`, `Map`, or a custom iterator returning key-value pairs. Keys are lowercase and values are not modified. -Response headers will derive a `host` from the `url` of the [Client](Client.md#class-client) instance if no `host` header was previously specified. +Response headers will derive a `host` from the `url` of the [Client](/docs/docs/api/Client.md#class-client) instance if no `host` header was previously specified. ### Example 1 - Object diff --git a/docs/docs/api/EnvHttpProxyAgent.md b/docs/docs/api/EnvHttpProxyAgent.md index 7d431030f67..0bcbf25895a 100644 --- a/docs/docs/api/EnvHttpProxyAgent.md +++ b/docs/docs/api/EnvHttpProxyAgent.md @@ -20,7 +20,7 @@ Returns: `EnvHttpProxyAgent` ### Parameter: `EnvHttpProxyAgentOptions` -Extends: [`AgentOptions`](Agent.md#parameter-agentoptions) +Extends: [`AgentOptions`](/docs/docs/api/Agent.md#parameter-agentoptions) * **httpProxy** `string` (optional) - When set, it will override the `HTTP_PROXY` environment variable. * **httpsProxy** `string` (optional) - When set, it will override the `HTTPS_PROXY` environment variable. @@ -118,44 +118,44 @@ const data = await json() // data { foo: "bar" } ### `EnvHttpProxyAgent.close([callback])` -Implements [`Dispatcher.close([callback])`](Dispatcher.md#dispatcherclosecallback-promise). +Implements [`Dispatcher.close([callback])`](/docs/docs/api/Dispatcher.md#dispatcherclosecallback-promise). ### `EnvHttpProxyAgent.destroy([error, callback])` -Implements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise). +Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise). ### `EnvHttpProxyAgent.dispatch(options, handler: AgentDispatchOptions)` -Implements [`Dispatcher.dispatch(options, handler)`](Dispatcher.md#dispatcherdispatchoptions-handler). +Implements [`Dispatcher.dispatch(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler). #### Parameter: `AgentDispatchOptions` -Extends: [`DispatchOptions`](Dispatcher.md#parameter-dispatchoptions) +Extends: [`DispatchOptions`](/docs/docs/api/Dispatcher.md#parameter-dispatchoptions) * **origin** `string | URL` -Implements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise). +Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise). ### `EnvHttpProxyAgent.connect(options[, callback])` -See [`Dispatcher.connect(options[, callback])`](Dispatcher.md#dispatcherconnectoptions-callback). +See [`Dispatcher.connect(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback). ### `EnvHttpProxyAgent.dispatch(options, handler)` -Implements [`Dispatcher.dispatch(options, handler)`](Dispatcher.md#dispatcherdispatchoptions-handler). +Implements [`Dispatcher.dispatch(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler). ### `EnvHttpProxyAgent.pipeline(options, handler)` -See [`Dispatcher.pipeline(options, handler)`](Dispatcher.md#dispatcherpipelineoptions-handler). +See [`Dispatcher.pipeline(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler). ### `EnvHttpProxyAgent.request(options[, callback])` -See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback). +See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback). ### `EnvHttpProxyAgent.stream(options, factory[, callback])` -See [`Dispatcher.stream(options, factory[, callback])`](Dispatcher.md#dispatcherstreamoptions-factory-callback). +See [`Dispatcher.stream(options, factory[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback). ### `EnvHttpProxyAgent.upgrade(options[, callback])` -See [`Dispatcher.upgrade(options[, callback])`](Dispatcher.md#dispatcherupgradeoptions-callback). +See [`Dispatcher.upgrade(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback). diff --git a/docs/docs/api/MockAgent.md b/docs/docs/api/MockAgent.md index e5713db2712..70d479ac618 100644 --- a/docs/docs/api/MockAgent.md +++ b/docs/docs/api/MockAgent.md @@ -14,7 +14,7 @@ Returns: `MockAgent` ### Parameter: `MockAgentOptions` -Extends: [`AgentOptions`](Agent.md#parameter-agentoptions) +Extends: [`AgentOptions`](/docs/docs/api/Agent.md#parameter-agentoptions) * **agent** `Agent` (optional) - Default: `new Agent([options])` - a custom agent encapsulated by the MockAgent. @@ -301,11 +301,11 @@ await mockAgent.close() ### `MockAgent.dispatch(options, handlers)` -Implements [`Agent.dispatch(options, handlers)`](Agent.md#parameter-agentdispatchoptions). +Implements [`Agent.dispatch(options, handlers)`](/docs/docs/api/Agent.md#parameter-agentdispatchoptions). ### `MockAgent.request(options[, callback])` -See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback). +See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback). #### Example - MockAgent request diff --git a/docs/docs/api/MockClient.md b/docs/docs/api/MockClient.md index 7336d8e15ed..52ee3e33bdf 100644 --- a/docs/docs/api/MockClient.md +++ b/docs/docs/api/MockClient.md @@ -36,19 +36,19 @@ const mockClient = mockAgent.get('http://localhost:3000') ### `MockClient.intercept(options)` -Implements: [`MockPool.intercept(options)`](MockPool.md#mockpoolinterceptoptions) +Implements: [`MockPool.intercept(options)`](/docs/docs/api/MockPool.md#mockpoolinterceptoptions) ### `MockClient.close()` -Implements: [`MockPool.close()`](MockPool.md#mockpoolclose) +Implements: [`MockPool.close()`](/docs/docs/api/MockPool.md#mockpoolclose) ### `MockClient.dispatch(options, handlers)` -Implements [`Dispatcher.dispatch(options, handlers)`](Dispatcher.md#dispatcherdispatchoptions-handler). +Implements [`Dispatcher.dispatch(options, handlers)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler). ### `MockClient.request(options[, callback])` -See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback). +See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback). #### Example - MockClient request diff --git a/docs/docs/api/MockPool.md b/docs/docs/api/MockPool.md index ac8185ffd76..ff01b9a35ab 100644 --- a/docs/docs/api/MockPool.md +++ b/docs/docs/api/MockPool.md @@ -512,11 +512,11 @@ await mockPool.close() ### `MockPool.dispatch(options, handlers)` -Implements [`Dispatcher.dispatch(options, handlers)`](Dispatcher.md#dispatcherdispatchoptions-handler). +Implements [`Dispatcher.dispatch(options, handlers)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler). ### `MockPool.request(options[, callback])` -See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback). +See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback). #### Example - MockPool request diff --git a/docs/docs/api/Pool.md b/docs/docs/api/Pool.md index 5745395f421..9c4328240af 100644 --- a/docs/docs/api/Pool.md +++ b/docs/docs/api/Pool.md @@ -15,7 +15,7 @@ Arguments: ### Parameter: `PoolOptions` -Extends: [`ClientOptions`](Client.md#parameter-clientoptions) +Extends: [`ClientOptions`](/docs/docs/api/Client.md#parameter-clientoptions) * **factory** `(origin: URL, opts: Object) => Dispatcher` - Default: `(origin, opts) => new Client(origin, opts)` * **connections** `number | null` (optional) - Default: `null` - The number of `Client` instances to create. When set to `null`, the `Pool` instance will create an unlimited amount of `Client` instances. @@ -24,11 +24,11 @@ Extends: [`ClientOptions`](Client.md#parameter-clientoptions) ### `Pool.closed` -Implements [Client.closed](Client.md#clientclosed) +Implements [Client.closed](/docs/docs/api/Client.md#clientclosed) ### `Pool.destroyed` -Implements [Client.destroyed](Client.md#clientdestroyed) +Implements [Client.destroyed](/docs/docs/api/Client.md#clientdestroyed) ### `Pool.stats` @@ -38,46 +38,46 @@ Returns [`PoolStats`](PoolStats.md) instance for this pool. ### `Pool.close([callback])` -Implements [`Dispatcher.close([callback])`](Dispatcher.md#dispatcherclosecallback-promise). +Implements [`Dispatcher.close([callback])`](/docs/docs/api/Dispatcher.md#dispatcherclosecallback-promise). ### `Pool.destroy([error, callback])` -Implements [`Dispatcher.destroy([error, callback])`](Dispatcher.md#dispatcherdestroyerror-callback-promise). +Implements [`Dispatcher.destroy([error, callback])`](/docs/docs/api/Dispatcher.md#dispatcherdestroyerror-callback-promise). ### `Pool.connect(options[, callback])` -See [`Dispatcher.connect(options[, callback])`](Dispatcher.md#dispatcherconnectoptions-callback). +See [`Dispatcher.connect(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherconnectoptions-callback). ### `Pool.dispatch(options, handler)` -Implements [`Dispatcher.dispatch(options, handler)`](Dispatcher.md#dispatcherdispatchoptions-handler). +Implements [`Dispatcher.dispatch(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler). ### `Pool.pipeline(options, handler)` -See [`Dispatcher.pipeline(options, handler)`](Dispatcher.md#dispatcherpipelineoptions-handler). +See [`Dispatcher.pipeline(options, handler)`](/docs/docs/api/Dispatcher.md#dispatcherpipelineoptions-handler). ### `Pool.request(options[, callback])` -See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback). +See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback). ### `Pool.stream(options, factory[, callback])` -See [`Dispatcher.stream(options, factory[, callback])`](Dispatcher.md#dispatcherstreamoptions-factory-callback). +See [`Dispatcher.stream(options, factory[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherstreamoptions-factory-callback). ### `Pool.upgrade(options[, callback])` -See [`Dispatcher.upgrade(options[, callback])`](Dispatcher.md#dispatcherupgradeoptions-callback). +See [`Dispatcher.upgrade(options[, callback])`](/docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-callback). ## Instance Events ### Event: `'connect'` -See [Dispatcher Event: `'connect'`](Dispatcher.md#event-connect). +See [Dispatcher Event: `'connect'`](/docs/docs/api/Dispatcher.md#event-connect). ### Event: `'disconnect'` -See [Dispatcher Event: `'disconnect'`](Dispatcher.md#event-disconnect). +See [Dispatcher Event: `'disconnect'`](/docs/docs/api/Dispatcher.md#event-disconnect). ### Event: `'drain'` -See [Dispatcher Event: `'drain'`](Dispatcher.md#event-drain). +See [Dispatcher Event: `'drain'`](/docs/docs/api/Dispatcher.md#event-drain). diff --git a/docs/docs/api/PoolStats.md b/docs/docs/api/PoolStats.md index 16b6dc25364..3cbe0d82e17 100644 --- a/docs/docs/api/PoolStats.md +++ b/docs/docs/api/PoolStats.md @@ -1,6 +1,6 @@ # Class: PoolStats -Aggregate stats for a [Pool](Pool.md) or [BalancedPool](BalancedPool.md). +Aggregate stats for a [Pool](/docs/docs/api/Pool.md) or [BalancedPool](/docs/docs/api/BalancedPool.md). ## `new PoolStats(pool)` diff --git a/docs/docs/api/ProxyAgent.md b/docs/docs/api/ProxyAgent.md index 17f3f4b6798..441eaecd242 100644 --- a/docs/docs/api/ProxyAgent.md +++ b/docs/docs/api/ProxyAgent.md @@ -14,7 +14,7 @@ Returns: `ProxyAgent` ### Parameter: `ProxyAgentOptions` -Extends: [`AgentOptions`](Agent.md#parameter-agentoptions) +Extends: [`AgentOptions`](/docs/docs/api/Agent.md#parameter-agentoptions) * **uri** `string | URL` (required) - The URI of the proxy server. This can be provided as a string, as an instance of the URL class, or as an object with a `uri` property of type string. If the `uri` is provided as a string or `uri` is an object with an `uri` property of type string, then it will be parsed into a `URL` object according to the [WHATWG URL Specification](https://url.spec.whatwg.org). @@ -123,8 +123,8 @@ await proxyAgent.close() ### `ProxyAgent.dispatch(options, handlers)` -Implements [`Agent.dispatch(options, handlers)`](Agent.md#parameter-agentdispatchoptions). +Implements [`Agent.dispatch(options, handlers)`](/docs/docs/api/Agent.md#parameter-agentdispatchoptions). ### `ProxyAgent.request(options[, callback])` -See [`Dispatcher.request(options [, callback])`](Dispatcher.md#dispatcherrequestoptions-callback). +See [`Dispatcher.request(options [, callback])`](/docs/docs/api/Dispatcher.md#dispatcherrequestoptions-callback). diff --git a/docs/docs/api/RetryHandler.md b/docs/docs/api/RetryHandler.md index 62baafb676a..c24da75645c 100644 --- a/docs/docs/api/RetryHandler.md +++ b/docs/docs/api/RetryHandler.md @@ -15,7 +15,7 @@ Returns: `retryHandler` ### Parameter: `Dispatch.DispatchOptions & RetryOptions` -Extends: [`Dispatch.DispatchOptions`](Dispatcher.md#parameter-dispatchoptions). +Extends: [`Dispatch.DispatchOptions`](/docs/docs/api/Dispatcher.md#parameter-dispatchoptions). #### `RetryOptions` @@ -44,7 +44,7 @@ It represents the retry state for a given request. ### Parameter `RetryHandlers` - **dispatch** `(options: Dispatch.DispatchOptions, handlers: Dispatch.DispatchHandlers) => Promise` (required) - Dispatch function to be called after every retry. -- **handler** Extends [`Dispatch.DispatchHandlers`](Dispatcher.md#dispatcherdispatchoptions-handler) (required) - Handler function to be called after the request is successful or the retries are exhausted. +- **handler** Extends [`Dispatch.DispatchHandlers`](/docs/docs/api/Dispatcher.md#dispatcherdispatchoptions-handler) (required) - Handler function to be called after the request is successful or the retries are exhausted. >__Note__: The `RetryHandler` does not retry over stateful bodies (e.g. streams, AsyncIterable) as those, once consumed, are left in a state that cannot be reutilized. For these situations the `RetryHandler` will identify >the body as stateful and will not retry the request rejecting with the error `UND_ERR_REQ_RETRY`. diff --git a/docs/docs/api/WebSocket.md b/docs/docs/api/WebSocket.md index 7b8c24c3ff2..6f6836fd6ee 100644 --- a/docs/docs/api/WebSocket.md +++ b/docs/docs/api/WebSocket.md @@ -9,7 +9,7 @@ The WebSocket object provides a way to manage a WebSocket connection to a server Arguments: * **url** `URL | string` -* **protocol** `string | string[] | WebSocketInit` (optional) - Subprotocol(s) to request the server use, or a [`Dispatcher`](./Dispatcher.md). +* **protocol** `string | string[] | WebSocketInit` (optional) - Subprotocol(s) to request the server use, or a [`Dispatcher`](/docs/docs/api/Dispatcher.md). ### Example: diff --git a/docs/docs/api/api-lifecycle.md b/docs/docs/api/api-lifecycle.md index c49445b49fb..ee08292cc7d 100644 --- a/docs/docs/api/api-lifecycle.md +++ b/docs/docs/api/api-lifecycle.md @@ -58,33 +58,33 @@ stateDiagram-v2 ### idle -The **idle** state is the initial state of a `Client` instance. While an `origin` is required for instantiating a `Client` instance, the underlying socket connection will not be established until a request is queued using [`Client.dispatch()`](Client.md#clientdispatchoptions-handlers). By calling `Client.dispatch()` directly or using one of the multiple implementations ([`Client.connect()`](Client.md#clientconnectoptions-callback), [`Client.pipeline()`](Client.md#clientpipelineoptions-handler), [`Client.request()`](Client.md#clientrequestoptions-callback), [`Client.stream()`](Client.md#clientstreamoptions-factory-callback), and [`Client.upgrade()`](Client.md#clientupgradeoptions-callback)), the `Client` instance will transition from **idle** to [**pending**](#pending) and then most likely directly to [**processing**](#processing). +The **idle** state is the initial state of a `Client` instance. While an `origin` is required for instantiating a `Client` instance, the underlying socket connection will not be established until a request is queued using [`Client.dispatch()`](/docs/docs/api/Client.md#clientdispatchoptions-handlers). By calling `Client.dispatch()` directly or using one of the multiple implementations ([`Client.connect()`](Client.md#clientconnectoptions-callback), [`Client.pipeline()`](Client.md#clientpipelineoptions-handler), [`Client.request()`](Client.md#clientrequestoptions-callback), [`Client.stream()`](Client.md#clientstreamoptions-factory-callback), and [`Client.upgrade()`](/docs/docs/api/Client.md#clientupgradeoptions-callback)), the `Client` instance will transition from **idle** to [**pending**](/docs/docs/api/Client.md#pending) and then most likely directly to [**processing**](/docs/docs/api/Client.md#processing). -Calling [`Client.close()`](Client.md#clientclosecallback) or [`Client.destroy()`](Client.md#clientdestroyerror-callback) transitions directly to the [**destroyed**](#destroyed) state since the `Client` instance will have no queued requests in this state. +Calling [`Client.close()`](/docs/docs/api/Client.md#clientclosecallback) or [`Client.destroy()`](Client.md#clientdestroyerror-callback) transitions directly to the [**destroyed**](/docs/docs/api/Client.md#destroyed) state since the `Client` instance will have no queued requests in this state. ### pending -The **pending** state signifies a non-processing `Client`. Upon entering this state, the `Client` establishes a socket connection and emits the [`'connect'`](Client.md#event-connect) event signalling a connection was successfully established with the `origin` provided during `Client` instantiation. The internal queue is initially empty, and requests can start queueing. +The **pending** state signifies a non-processing `Client`. Upon entering this state, the `Client` establishes a socket connection and emits the [`'connect'`](/docs/docs/api/Client.md#event-connect) event signalling a connection was successfully established with the `origin` provided during `Client` instantiation. The internal queue is initially empty, and requests can start queueing. -Calling [`Client.close()`](Client.md#clientclosecallback) with queued requests, transitions the `Client` to the [**processing**](#processing) state. Without queued requests, it transitions to the [**destroyed**](#destroyed) state. +Calling [`Client.close()`](/docs/docs/api/Client.md#clientclosecallback) with queued requests, transitions the `Client` to the [**processing**](/docs/docs/api/Client.md#processing) state. Without queued requests, it transitions to the [**destroyed**](/docs/docs/api/Client.md#destroyed) state. -Calling [`Client.destroy()`](Client.md#clientdestroyerror-callback) transitions directly to the [**destroyed**](#destroyed) state regardless of existing requests. +Calling [`Client.destroy()`](/docs/docs/api/Client.md#clientdestroyerror-callback) transitions directly to the [**destroyed**](/docs/docs/api/Client.md#destroyed) state regardless of existing requests. ### processing -The **processing** state is a state machine within itself. It initializes to the [**processing.running**](#running) state. The [`Client.dispatch()`](Client.md#clientdispatchoptions-handlers), [`Client.close()`](Client.md#clientclosecallback), and [`Client.destroy()`](Client.md#clientdestroyerror-callback) can be called at any time while the `Client` is in this state. `Client.dispatch()` will add more requests to the queue while existing requests continue to be processed. `Client.close()` will transition to the [**processing.closing**](#closing) state. And `Client.destroy()` will transition to [**destroyed**](#destroyed). +The **processing** state is a state machine within itself. It initializes to the [**processing.running**](/docs/docs/api/Client.md#running) state. The [`Client.dispatch()`](/docs/docs/api/Client.md#clientdispatchoptions-handlers), [`Client.close()`](Client.md#clientclosecallback), and [`Client.destroy()`](Client.md#clientdestroyerror-callback) can be called at any time while the `Client` is in this state. `Client.dispatch()` will add more requests to the queue while existing requests continue to be processed. `Client.close()` will transition to the [**processing.closing**](/docs/docs/api/Client.md#closing) state. And `Client.destroy()` will transition to [**destroyed**](/docs/docs/api/Client.md#destroyed). #### running -In the **processing.running** sub-state, queued requests are being processed in a FIFO order. If a request body requires draining, the *needDrain* event transitions to the [**processing.busy**](#busy) sub-state. The *close* event transitions the Client to the [**process.closing**](#closing) sub-state. If all queued requests are processed and neither [`Client.close()`](Client.md#clientclosecallback) nor [`Client.destroy()`](Client.md#clientdestroyerror-callback) are called, then the [**processing**](#processing) machine will trigger a *keepalive* event transitioning the `Client` back to the [**pending**](#pending) state. During this time, the `Client` is waiting for the socket connection to timeout, and once it does, it triggers the *timeout* event and transitions to the [**idle**](#idle) state. +In the **processing.running** sub-state, queued requests are being processed in a FIFO order. If a request body requires draining, the *needDrain* event transitions to the [**processing.busy**](/docs/docs/api/Client.md#busy) sub-state. The *close* event transitions the Client to the [**process.closing**](/docs/docs/api/Client.md#closing) sub-state. If all queued requests are processed and neither [`Client.close()`](/docs/docs/api/Client.md#clientclosecallback) nor [`Client.destroy()`](Client.md#clientdestroyerror-callback) are called, then the [**processing**](/docs/docs/api/Client.md#processing) machine will trigger a *keepalive* event transitioning the `Client` back to the [**pending**](/docs/docs/api/Client.md#pending) state. During this time, the `Client` is waiting for the socket connection to timeout, and once it does, it triggers the *timeout* event and transitions to the [**idle**](/docs/docs/api/Client.md#idle) state. #### busy -This sub-state is only entered when a request body is an instance of [Stream](https://nodejs.org/api/stream.html) and requires draining. The `Client` cannot process additional requests while in this state and must wait until the currently processing request body is completely drained before transitioning back to [**processing.running**](#running). +This sub-state is only entered when a request body is an instance of [Stream](https://nodejs.org/api/stream.html) and requires draining. The `Client` cannot process additional requests while in this state and must wait until the currently processing request body is completely drained before transitioning back to [**processing.running**](/docs/docs/api/Client.md#running). #### closing -This sub-state is only entered when a `Client` instance has queued requests and the [`Client.close()`](Client.md#clientclosecallback) method is called. In this state, the `Client` instance continues to process requests as usual, with the one exception that no additional requests can be queued. Once all of the queued requests are processed, the `Client` will trigger the *done* event gracefully entering the [**destroyed**](#destroyed) state without an error. +This sub-state is only entered when a `Client` instance has queued requests and the [`Client.close()`](/docs/docs/api/Client.md#clientclosecallback) method is called. In this state, the `Client` instance continues to process requests as usual, with the one exception that no additional requests can be queued. Once all of the queued requests are processed, the `Client` will trigger the *done* event gracefully entering the [**destroyed**](/docs/docs/api/Client.md#destroyed) state without an error. ### destroyed diff --git a/docs/docsify/sidebar.md b/docs/docsify/sidebar.md index 7d6e2b7d77c..4a4ae6742b3 100644 --- a/docs/docsify/sidebar.md +++ b/docs/docsify/sidebar.md @@ -27,6 +27,9 @@ * [Util](/docs/api/Util.md "Undici API - Util") * [RedirectHandler](/docs/api/RedirectHandler.md "Undici API - RedirectHandler") * [RetryHandler](/docs/api/RetryHandler.md "Undici API - RetryHandler") + * [DiagnosticsChannel](/docs/api/DiagnosticsChannel.md "Undici API - DiagnosticsChannel") + * [EnvHttpProxyAgent](/docs/api/EnvHttpProxyAgent.md "Undici API - EnvHttpProxyAgent") + * [PoolStats](/docs/api/PoolStats.md "Undici API - PoolStats") * Examples * [Undici Examples](/examples/ "Undici Examples") * Best Practices