/** * NestJS Interceptor for Enriched Context Headers * Automatically collects enriched headers and sets AsyncLocalStorage context for service functions */ import { NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common'; import { Observable } from 'rxjs'; import type { EnrichedHeadersInterceptorOptions } from '@plyaz/types/api'; /** * NestJS interceptor that collects enriched context headers * Automatically runs service functions with enriched headers in AsyncLocalStorage context * * @example * ```typescript * import { Controller, Get, UseInterceptors } from '@nestjs/common'; * import { EnrichedHeadersInterceptor } from '@plyaz/api/network/frameworks/nestjs'; * import { fetchUsers } from '@plyaz/api/services'; * * @Controller('users') * @UseInterceptors(new EnrichedHeadersInterceptor({ * preset: 'standard', * includePerformance: true * })) * export class UsersController { * @Get() * async getUsers() { * // Service function automatically has enriched headers * return await fetchUsers({ page: 1 }); * } * } * ``` */ export declare class EnrichedHeadersInterceptor implements NestInterceptor { private readonly options; constructor(options?: EnrichedHeadersInterceptorOptions); /** * Build enriched headers for the request */ private buildHeaders; /** * Add enriched headers to response */ private addHeadersToResponse; /** * Create observable with context */ private createContextObservable; /** * Handle context setup error */ private handleContextError; /** * Handle error during header building */ private handleBuildError; /** * Create fallback observable when headers fail */ private createFallbackObservable; /** * Handle fallback error */ private handleFallbackError; intercept(context: ExecutionContext, next: CallHandler): Promise>; } /** * Create enriched headers interceptor with specific options * * @param options - Interceptor configuration * @returns Configured interceptor instance * * @example * ```typescript * @UseInterceptors(createEnrichedHeadersInterceptor({ * preset: 'compliance-strict', * debug: true * })) * export class ComplianceController { * // All methods automatically have enriched headers * } * ``` */ export declare function createEnrichedHeadersInterceptor(options?: EnrichedHeadersInterceptorOptions): EnrichedHeadersInterceptor; //# sourceMappingURL=enrichedHeadersInterceptor.d.ts.map