/** * HTTP log parser for specialized HTTP request detection. * * Detects and parses HTTP request logs with syntax highlighting * for methods (GET, POST, etc.), routes, and parameters. * * @module components/devenv/terminal/parsing/HttpLogParser */ import type { IParsedLogEntry } from './LogParser.types'; /** * HTTP method enumeration. */ export type THttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE'; /** * Parsed HTTP request data. */ export interface IHttpParsedData { /** HTTP method */ method: THttpMethod; /** Request path/route */ path: string; /** Query parameters extracted from path */ params?: Record; /** Whether request opens a multiline block (has brace) */ opensMultiline: boolean; } /** * HTTP log parser class. * * Detects HTTP requests in log lines and extracts structured data. * Supports various log formats: * * - `GET /api/endpoint` * - `GET /api/endpoint/:param {` * - `POST /api/users HTTP/1.1` * * @example * ```ts * const parser = new HttpLogParser(); * const parsed = parser.parseLine('GET /api/logs/containers/:name/stream {'); * // parsed.method = 'GET' * // parsed.path = '/api/logs/containers/:name/stream' * // parsed.opensMultiline = true * ``` */ export declare class HttpLogParser { /** HTTP method pattern */ private readonly HTTP_PATTERN; /** URL path with parameters pattern */ private readonly PATH_PARAM_PATTERN; /** * Parse a log line for HTTP request data. * * @param line - Log line to parse * @returns Parsed HTTP data or null if not an HTTP line */ parseLine(line: string): IHttpParsedData | null; /** * Check if a line is an HTTP request line. * * @param line - Line to check * @returns true if line is an HTTP request */ isHttpLine(line: string): boolean; /** * Extract path parameters from a route path. * * @param path - Route path (e.g., `/api/users/:id`) * @returns Object with parameter names */ extractPathParams(path: string): Record | undefined; /** * Format HTTP method with syntax highlighting class. * * @param _method - HTTP method * @returns CSS class for highlighting */ getMethodClass(_method: THttpMethod): string; /** * Format path with syntax highlighting. * * @param path - Request path * @returns CSS class for path highlighting */ getPathClass(): string; /** * Highlight an HTTP request line. * * Returns an array of parts with their associated CSS classes. * * @param line - HTTP request line * @returns Array of {text, className} parts */ highlightLine(line: string): Array<{ text: string; className?: string; }>; /** * Highlight path segments (routes and parameters). * * @param path - Path string * @returns Highlighted parts * @private */ private highlightPath; /** * Parse a multiline HTTP request block. * * Combines the initial request line with continuation lines * that form JSON or structured data. * * @param lines - Array of log lines * @returns Parsed entry with HTTP data */ parseHttpBlock(lines: string[]): IParsedLogEntry | null; } //# sourceMappingURL=HttpLogParser.d.ts.map