import { HttpApi, OpraSchema } from '@opra/common'; import { PlatformAdapter } from '@opra/core'; import type { EventMap } from 'node-events-async'; import { HttpContext } from './http-context.js'; import { HttpHandler } from './http-handler.js'; /** * HttpAdapter is the base class for all HTTP platform adapters. * It provides core functionality for handling HTTP requests and managing interceptors. * * @abstract */ export declare abstract class HttpAdapter extends PlatformAdapter> { readonly handler: HttpHandler; readonly transform: OpraSchema.Transport; readonly basePath: string; scope?: string; interceptors: (HttpAdapter.InterceptorFunction | HttpAdapter.IHttpInterceptor)[]; protected constructor(options?: HttpAdapter.Options); get api(): HttpApi; } export declare namespace HttpAdapter { type NextCallback = () => Promise; /** * The interceptor function signature. */ type InterceptorFunction = IHttpInterceptor['intercept']; /** * Interface for HTTP interceptors. */ type IHttpInterceptor = { intercept(context: HttpContext, next: NextCallback): Promise; }; interface Options extends PlatformAdapter.Options { basePath?: string; interceptors?: (InterceptorFunction | IHttpInterceptor)[]; scope?: string | '*'; } interface Events { createContext: [HttpContext]; error: [Error, HttpContext]; request: [HttpContext]; finish: [HttpContext]; } }