import type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types'; import type { LLMsOptions } from '../types'; /** * OpenAPI document type that supports both v3.0 and v3.1 */ type OpenAPIDocument = OpenAPIV3.Document | OpenAPIV3_1.Document; /** * Validates that a URL is safe to fetch (prevents SSRF attacks). * * @param url - The URL to validate * @throws {Error} When the URL is invalid or points to a blocked host * * @example * ```typescript * validateUrl('https://api.example.com/openapi.json'); // OK * validateUrl('http://localhost:3000/spec'); // Throws error * ``` */ export declare const validateUrl: (url: string) => void; /** * Validates that a file path is safe to read (prevents path traversal attacks). * * @param filePath - The file path to validate * @param basePath - The base directory path (defaults to current working directory) * @returns The resolved, normalized absolute path * @throws {Error} When the path attempts directory traversal * * @example * ```typescript * validateFilePath('./openapi.json'); // OK, returns absolute path * validateFilePath('../../../etc/passwd'); // Throws error * ``` */ export declare const validateFilePath: (filePath: string, basePath?: string) => string; /** * Reads and parses JSON data from a local file. * * @param filePath - The path to the local JSON file * @param basePath - Optional base directory for path validation * @returns A Promise that resolves to the parsed OpenAPI document * @throws {Error} When the file cannot be read or parsed * * @example * ```typescript * const data = await parseFromFile('path/to/openapi.json'); * console.log(data); * ``` */ export declare const parseFromFile: (filePath: string, basePath?: string) => Promise; /** * Fetches and parses JSON data from a given URL. * * @param url - The URL to fetch data from * @param skipValidation - Set to true to skip URL validation (use with caution) * @returns A Promise that resolves to the parsed OpenAPI document * @throws {Error} When the HTTP request fails or when the URL cannot be fetched * * @example * ```typescript * const data = await parseFromUrl('https://api.example.com/openapi.json'); * console.log(data); * ``` */ export declare const parseFromUrl: (url: string, skipValidation?: boolean) => Promise; /** * Validates the provided options for Large Language Model (LLM) processing. * * @param options - The configuration options to validate * @throws {Error} When required fields are missing or invalid * * @example * ```typescript * validateOptions({ * source: { * type: 'file', * file: 'path/to/file.json' * } * }); * ``` */ export declare const validateOptions: (options: LLMsOptions) => void; export {}; //# sourceMappingURL=index.d.ts.map