import type { DmmfDocument, DmmfModel } from '../types/dmmf.js'; import type { DataBridgeConfig } from '../types/config.js'; import type { ParsedQuery } from '../types/custom-queries.js'; /** * Logger interface expected by RouteGenerator. * Matches the oclif Command.log() / Command.warn() signatures. */ export interface RouteGeneratorLogger { log: (msg: string) => void; } /** * TEACHING NOTE: RouteGenerator — extracted from generate.ts * * Responsible for generating Fastify CRUD route files (one per model) using * ts-morph for AST-safe TypeScript generation. Each file contains: * GET /model – list all * GET /model/:id – get one (with opt-in ?include=) * POST /model – create (with Zod validation) * PATCH /model/:id – update (with Zod validation) * DELETE /model/:id – delete * GET /model/:id/relation – relationship helper endpoints */ export declare class RouteGenerator { private logger; constructor(logger: RouteGeneratorLogger); /** * TEACHING NOTE: Generate Fastify API Routes * * For each model (like "Product"), we create a file with full CRUD. */ generateApiRoutes(dmmf: DmmfDocument, config: DataBridgeConfig, customQueries?: ParsedQuery[]): Promise; /** * TEACHING NOTE: This generates the actual route handling code. * It's returned as a string that becomes the function body. */ generateRouteStatements(modelName: string, routeName: string, model: DmmfModel, customQueries?: ParsedQuery[]): string; /** * Normalize path for comparison (replace :id, :userId, etc. with generic :param) */ private normalizePathForComparison; /** * Check if two paths conflict (same normalized path) */ private pathsConflict; /** * Generate relationship helper endpoints (e.g., GET /users/:id/orders) */ private generateRelationshipEndpoints; /** * T16: Generate ?include= query param logic for GET routes. * By default no relations are fetched (fast). Clients opt-in with: * ?include=rel1,rel2 — specific relations * ?include=* — all available relations * * TEACHING NOTE: opt-in is preferred over auto-include because it avoids * N+1 query patterns when callers don't need related data. */ private generateIncludeQueryLogic; /** * TEACHING NOTE: Generate Zod validation schema from Prisma model. * This creates runtime validation for API requests. */ generateZodSchema(model: DmmfModel): string; } //# sourceMappingURL=route-generator.d.ts.map