import * as http from "http"; import * as https from "https"; import type { FetchRequest, IConfigCatConfigFetcher } from "../ConfigFetcher.js"; import { fetchInternalAsyncMethodName, FetchResponse } from "../ConfigFetcher.js"; export interface INodeHttpConfigFetcherOptions { /** * The {@link https://nodejs.org/api/http.html#class-httpagent | http.Agent} instance to use for non-secure HTTP communication. * For example, this option allows you to configure the SDK to route `http://...` requests through an HTTP, HTTPS or SOCKS proxy. * * If not set, an internally managed agent with the same options as {@link https://nodejs.org/api/http.html#httpglobalagent | http.globalAgent} * will be used. * * This option applies when the SDK connects to a custom `http://...` URL you specified via `baseUrl`. * * @remarks If this and `httpAgentFactory` options are both specified, this option is ignored. * * @deprecated This option is kept for backward compatibility but will be removed in a future major version. * Please use the `httpAgentFactory` option instead. */ httpAgent?: http.Agent | null; /** * An optional callback to override the creation of {@link https://nodejs.org/api/http.html#class-httpagent | http.Agent} * instances for non-secure HTTP communication. For example, this option allows you to configure the SDK to route * `http://...` requests through an HTTP, HTTPS or SOCKS proxy. * * If not set, an internally managed agent with the same options as {@link https://nodejs.org/api/http.html#httpglobalagent | http.globalAgent} * will be used. * * This option applies when the SDK connects to a custom `http://...` URL you specified via `baseUrl`. * * @remarks The callback must always return a new `http.Agent` instance and leave lifetime management of that instance to the SDK. * * @param recommendedOptions Default options for the agent to create. This object can be modified as needed. * @returns The `http.Agent` instance to use for making requests. */ httpAgentFactory?: ((recommendedOptions: http.AgentOptions) => http.Agent) | null; /** * The {@link https://nodejs.org/api/https.html#class-httpsagent | https.Agent} instance to use for secure HTTP communication. * For example, this option allows you to configure the SDK to route `https://...` requests through an HTTP, HTTPS or SOCKS proxy. * * If not set, an internally managed agent with the same options as {@link https://nodejs.org/api/https.html#httpsglobalagent | https.globalAgent} * will be used. * * This option applies when the SDK connects to the ConfigCat CDN or a custom `https://...` URL you specified via `baseUrl`. * * @remarks If this and `httpsAgentFactory` options are both specified, this option is ignored. * * @deprecated This option is kept for backward compatibility but will be removed in a future major version. * Please use the `httpsAgentFactory` option instead. */ httpsAgent?: https.Agent | null; /** * An optional callback to override the creation of {@link https://nodejs.org/api/https.html#class-httpsagent | https.Agent} * instances for secure HTTP communication. For example, this option allows you to configure the SDK to route * `https://...` requests through an HTTP, HTTPS or SOCKS proxy. * * If not set, an internally managed agent with the same options as {@link https://nodejs.org/api/https.html#httpsglobalagent | https.globalAgent} * will be used. * * This option applies when the SDK connects to the ConfigCat CDN or a custom `https://...` URL you specified via `baseUrl`. * * @remarks The callback must always return a new `https.Agent` instance and leave lifetime management of that instance to the SDK. * * @param recommendedOptions Default options for the agent to create. This object can be modified as needed. * @returns The `https.Agent` instance to use for making requests. */ httpsAgentFactory?: ((recommendedOptions: https.AgentOptions) => https.Agent) | null; } export declare class NodeHttpConfigFetcher implements IConfigCatConfigFetcher { private static getFactory; private httpAgentState; private httpsAgentState; private agentRenewalThresholdMs; private requestRetryDelayMs; private readonly disposeToken; constructor(options?: INodeHttpConfigFetcherOptions); dispose(): void; fetchAsync(request: FetchRequest): Promise; private [fetchInternalAsyncMethodName]; private fetchWithRetryAsync; private fetchCoreAsync; private handleResponse; protected setRequestHeaders(requestOptions: { headers?: Record; }, headers: ReadonlyArray): void; }