import { NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common'; import { Observable } from 'rxjs'; import { ApiResponse } from '../response/api-response'; /** * Options for ApiResponseInterceptor */ export interface ApiResponseInterceptorOptions { /** Default success message (default: 'Success') */ defaultMessage?: string; /** Whether to skip wrapping if response is already ApiResponse (default: true) */ skipIfWrapped?: boolean; } /** * Response interceptor that wraps all responses in ApiResponse format * * This interceptor automatically converts controller return values * to standardized ApiResponse format. * * @example * ```typescript * // In main.ts * import { ApiResponseInterceptor } from '@tchil/business-codes/nestjs'; * * async function bootstrap() { * const app = await NestFactory.create(AppModule); * app.useGlobalInterceptors(new ApiResponseInterceptor()); * await app.listen(3000); * } * * // In a controller * @Get(':id') * async getUser(@Param('id') id: string) { * return this.userService.findById(id); * // Response: { success: true, data: {...}, message: 'Success', statusCode: 200 } * } * ``` */ export declare class ApiResponseInterceptor implements NestInterceptor> { private readonly options; constructor(options?: ApiResponseInterceptorOptions); intercept(context: ExecutionContext, next: CallHandler): Observable>; } export declare const SKIP_API_RESPONSE_KEY = "skipApiResponse"; export declare const SkipApiResponse: () => import("@nestjs/common").CustomDecorator; /** * Advanced response interceptor with skip decorator support */ export declare class ApiResponseInterceptorAdvanced implements NestInterceptor | T> { private readonly options; constructor(options?: ApiResponseInterceptorOptions); intercept(context: ExecutionContext, next: CallHandler): Observable | T>; } //# sourceMappingURL=interceptor.d.ts.map