import { Agent, ProxyAgent, MockAgent } from "undici"; import { LRUCache } from "lru-cache"; import { InlineCallbackAction, HttpMethod, WebDavMethod } from "./request"; /** * @see https://en.wikipedia.org/wiki/Page_replacement_algorithm */ export declare const URICache: LRUCache; export interface computedUrlAndAgent { url: URL; agent: Agent | ProxyAgent | MockAgent | null; limit?: InlineCallbackAction; } /** * These are agents specifically designed to work with MyUnisoft. */ export interface CustomHttpAgent { customPath: string; domains: Set; agent: Agent | ProxyAgent | MockAgent; prod: string; preprod: string; dev: string; limit?: InlineCallbackAction; } export declare const agents: Set; /** * @description Detect if a given string URI is matching a given Agent custom path. * * @example * const URI = computeAgentPath("/windev/ws_monitoring", windev); * assert.strictEqual(URI, "https://ws-dev.myunisoft.fr/ws_monitoring"); */ export declare function isAgentPathMatchingURI(uri: string, agent: CustomHttpAgent): URL | null; /** * @description Compute a given string URI to the local list of agents. */ export declare function computeURIOnAllAgents(uri: string): computedUrlAndAgent; /** * @description Seek correspondence with local agents through the URI hostname * @see https://nodejs.org/api/url.html#url_url_hostname * * @example * detectAgentFromURI("https://ws-dev.myunisoft.fr/ws_monitoring"); // windev agent * detectAgentFromURI("https://www.google.fr/"); // null */ export declare function detectAgentFromURI(uri: URL): CustomHttpAgent | null; /** * @description Compute a given URI (format string or WHATWG URL) and return a fully build URL and paired agent. * Under the hood it use a LRU cache */ export declare function computeURI(method: HttpMethod | WebDavMethod, uri: string | URL): computedUrlAndAgent;