/** * Interceptor decorators (@Guard, @Transform, @Intercept) * * All three decorators have unified semantics: * - @Guard is sugar for @Intercept({ request: guardFn }) * - @Transform is sugar for @Intercept({ response: transformFn }) * - @Intercept provides full control over both request and response */ import type { IInterceptOptions, IGuardOptions, TGuardFunction, TResponseInterceptor } from '../core/smartserve.interfaces.js'; /** * @Guard decorator - validates requests before handler execution * * Guards return boolean: true to allow, false to reject with 403 Forbidden * * @example * ```typescript * // Single guard * @Guard(isAuthenticated) * * // Multiple guards (all must pass) * @Guard([isAuthenticated, hasRole('admin')]) * * // With custom rejection response * @Guard(isAuthenticated, { * onReject: () => new Response('Unauthorized', { status: 401 }) * }) * ``` */ export declare function Guard
(guardOrGuards: TGuardFunction | TGuardFunction[], options?: IGuardOptions): (target: any, context: ClassDecoratorContext | ClassMethodDecoratorContext) => any; /** * @Transform decorator - modifies response after handler execution * * @example * ```typescript * // Single transform * @Transform(data => ({ success: true, data })) * * // Multiple transforms (applied in order) * @Transform([addTimestamp, wrapResponse]) * ``` */ export declare function Transform