import type { LibSQLDatabase } from "drizzle-orm/libsql"; import type { z } from "zod"; import type * as schema from "../../db/schema.js"; import type { schemaProbedRoutes } from "../../lib/app-routes/index.js"; type Routes = z.infer["routes"]; /** * Enriches API routes with their corresponding OpenAPI specifications by fetching OpenAPI definitions * and mapping the routes in the spec to Hono routes. * * If an `openApiSpec` is provided, it will be used instead of fetching the latest spec from the database. * * This function handles both single routes and arrays of routes. * * @param db - LibSQL database instance containing the OpenAPI specifications. Used to fetch the latest spec. * @param routes - Array of routes to be enriched. Each route should contain path, method, * and handlerType properties for proper matching with OpenAPI specs. * @param openApiSpec - Optional OpenAPI specification to use instead of fetching from the database. * * @returns Array of enriched routes. Each route will contain all original properties plus an * `openApiSpec` property that is either: * - A stringified OpenAPI operation object if a match is found and dereferencing succeeds * - null if no matching OpenAPI spec exists or if dereferencing fails * If any error occurs during enrichment, returns the original routes unchanged. * * @example * const routes = [ * { path: "/api/users", method: "get", handlerType: "route" } * ]; * const enrichedRoutes = await addOpenApiSpecToRoutes(db, routes); * // enrichedRoutes[0].openApiSpec will contain the stringified OpenAPI operation or null */ export declare function addOpenApiSpecToRoutes(db: LibSQLDatabase, routes: Routes, openApiSpec: unknown): Promise; export {};