import { ApplicationFeatureAdapter, ApplicationFeatureContext } from "@nodeboot/context"; import { HttpClientConfig, PluginConfigs } from "../client"; /** * The adapter responsible for integrating HTTP clients into the NodeBoot application lifecycle. * * This adapter: * - Checks if the HTTP client feature is enabled in the application. * - Creates and registers an Axios-based HTTP client instance. * - Enables HTTP logging if configured. * - Provides the HTTP client instance to the Dependency Injection (DI) container for injection into services. * * ## How It Works * 1. When an HTTP client class is decorated with `@HttpClient()`, this adapter is instantiated. * 2. It registers the HTTP client instance in the DI container so it can be injected into services. * 3. If `httpLogging` is enabled, it sets up logging for outgoing requests and incoming responses. * * ## Usage * Users should apply `@EnableHttpClients()` to their application and use `@HttpClient()` to register clients. * * @example * ```typescript * import { EnableHttpClients } from "@nodeboot/starter-http"; * import { EnableDI } from "@nodeboot/di"; * import { EnableComponentScan } from "@nodeboot/scan"; * import { NodeBootApplication, NodeBoot, NodeBootApp, NodeBootAppView } from "@nodeboot/core"; * import { ExpressServer } from "@nodeboot/express-server"; * import { Container } from "typedi"; * * @EnableDI(Container) * @EnableHttpClients() * @EnableComponentScan() * @NodeBootApplication() * export class SampleBackendApp implements NodeBootApp { * start(): Promise { * return NodeBoot.run(ExpressServer); * } * } * ``` * * @implements {ApplicationFeatureAdapter} */ export declare class HttpClientAdapter implements ApplicationFeatureAdapter { private readonly targetClass; private clientConfig; private pluginConfigs?; /** * Creates an instance of `HttpClientAdapter`. * * @param {new (...args: any[]) => any} targetClass - The class marked as an HTTP client. * @param {HttpClientConfig | string} clientConfig - Configuration settings for the HTTP client. * @param {PluginConfigs} [pluginConfigs] - Optional plugin configurations for the HTTP client. */ constructor(targetClass: new (...args: any[]) => any, clientConfig: HttpClientConfig | string, pluginConfigs?: PluginConfigs | undefined); /** * Binds the HTTP client to the NodeBoot application lifecycle. * * - Checks if HTTP clients are enabled (`@EnableHttpClients()` must be applied). * - Registers the HTTP client instance in the DI container. * - Configures HTTP request/response logging if enabled. * * @param {ApplicationFeatureContext} context - The application context providing a logger and DI container. */ bind({ logger, iocContainer, config }: ApplicationFeatureContext): void; private setupPlugins; /** * Sets up HTTP request and response logging if `httpLogging` is enabled. * * Logs outgoing requests and incoming responses, and captures errors. * * @param {HttpClientStub} instance - The Axios HTTP client instance. * @param {LoggerService} logger - The application's logging service. * @private */ private setupHttpLogging; private setupErrorHandling; private getHttpConfig; private resolveHttpConfig; } //# sourceMappingURL=HttpClientAdapter.d.ts.map