UNPKG

nestjs-aborter

Version:

Automatic request cancellation and timeout handling for NestJS applications

23 lines (22 loc) 910 B
import { ExecutionContext } from '@nestjs/common'; /** * Factory function to extract AbortSignal from request */ export declare const aborterSignalFactory: (_data: unknown, ctx: ExecutionContext) => globalThis.AbortSignal | undefined; /** * Factory function to extract abort reason from request */ export declare const aborterReasonFactory: (_data: unknown, ctx: ExecutionContext) => string | undefined; /** * Injects the AbortSignal from the current HTTP request. * * Use this to cancel operations when the client disconnects, * a timeout is reached, or an error occurs. */ export declare const AborterSignal: (...dataOrPipes: unknown[]) => ParameterDecorator; /** * Injects the abort reason from the current HTTP request. * * Returns why the request was aborted (e.g., timeout, client disconnect, error). */ export declare const AborterReason: (...dataOrPipes: unknown[]) => ParameterDecorator;