UNPKG

@cisstech/nestjs-expand

Version:

A NestJS module to build Dynamic Resource Expansion for APIs

17 lines (16 loc) 782 B
import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common'; import { Observable } from 'rxjs'; import { ExpandService } from './expand.service'; export declare class ExpandInterceptor implements NestInterceptor { private readonly expandService; private readonly logger; constructor(expandService: ExpandService); /** * Intercepts incoming requests and applies expansion based on metadata. * @param context - The execution context. * @param next - The next call handler. * @returns An observable with the expanded response. * @throws Error if there's an issue during the expansion process and the error policy is set to 'throw'. */ intercept(context: ExecutionContext, next: CallHandler): Observable<unknown>; }