import { Routes, RouteBuilder } from './WebAppMeta'; import { AuthMeta } from '@webpieces/core-util'; import 'reflect-metadata'; /** * Type representing a class constructor (abstract or concrete). */ export type ClassType = Function & { prototype: T; }; /** * ApiRoutingFactory - Automatically wire API interfaces to controllers. * Reads @ApiPath/@Endpoint decorators from an API prototype class and * registers POST routes for each endpoint. * * Replaces the old RESTApiRoutes class. * * Usage: * ```typescript * // In your ServerMeta: * getRoutes(): Routes[] { * return [ * new ApiRoutingFactory(SaveApi, SaveController), * ]; * } * ``` */ export declare class ApiRoutingFactory implements Routes { private apiMetaClass; private controllerClass; /** * @param apiMetaClass - The API prototype class with @ApiPath/@Endpoint decorators * @param controllerClass - The controller class that implements the API */ constructor(apiMetaClass: ClassType, controllerClass: ClassType); /** * Configure routes by reading @ApiPath + @Endpoint metadata. * Validates controller methods and auth decorators in single loop. */ configure(routeBuilder: RouteBuilder): void; /** * Get the filepath of the controller source file. * Uses a heuristic based on the controller class name. */ private getControllerFilepath; /** * Get auth metadata for a specific method, falling back to class-level. */ getAuthMetaForMethod(methodName: string): AuthMeta | undefined; /** * Get the API interface class. */ getApiClass(): ClassType; /** * Get the controller class. */ getControllerClass(): ClassType; }