/** * ============================================================================ * NEXT.JS ROUTE FACTORY * ============================================================================ * * Factory for creating Next.js App Router API routes with minimal boilerplate. * Supports full TypeScript generics for body, params, query, and response types. * Provides access to injected Core services (db, storage, notifications, cache). * * @example Basic usage * ```typescript * export const { GET, POST } = createNextApiRoute({ * service: 'example', * handlers: { * GET: async (service, ctx) => service.getAll(), * POST: async (service, ctx) => service.create(ctx.body), * }, * }); * ``` * * @example With full type safety * ```typescript * interface CreateUserBody { name: string; email: string; } * interface UserParams { id: string; } * * export const { GET, POST } = createNextApiRoute< * UserService, * { GET: { params: UserParams }; POST: { body: CreateUserBody } } * >({ * service: 'users', * handlers: { * GET: async (service, { params }) => service.getById(params.id), // params.id is typed * POST: async (service, { body }) => service.create(body), // body is CreateUserBody * }, * }); * ``` * * @example With injected services * ```typescript * export const { POST } = createNextApiRoute({ * service: 'files', * handlers: { * POST: async (service, { body, services }) => { * // Access Core services * const dbRecord = await services.db?.query(...); * const cached = await services.cache?.get('key'); * await services.notifications?.send(...); * return service.upload(body); * }, * }, * }); * ``` */ import type { HandlersTypeMap, CoreNextJSRouteConfig, CoreNextJSRouteExports } from '@plyaz/types/core'; /** * Create Next.js App Router API route handlers with full type safety. * See file header for usage examples. * * @param config - Route configuration * @returns Object with GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD handlers */ export declare function createNextApiRoute(config: CoreNextJSRouteConfig): CoreNextJSRouteExports; //# sourceMappingURL=route-factory.d.ts.map