UNPKG

@dudousxd/nestjs-telescope

Version:

Laravel Telescope-style observability console for NestJS — core: watchers, recorder, correlation, SQLite store, headless API.

25 lines 1.51 kB
import { type NestMiddleware } from '@nestjs/common'; import { ProfilerService } from '../profiling/profiler.service.js'; import { type TelescopeModuleOptions } from './telescope.options.js'; import { TelescopeService } from './telescope.service.js'; export declare class TelescopeRequestMiddleware implements NestMiddleware { private readonly service; private readonly profiler; /** Resolved once at construction — the per-request hot path never rebuilds this. */ private readonly captureConfig; constructor(service: TelescopeService, profiler?: ProfilerService | undefined, moduleOptions?: TelescopeModuleOptions | undefined); use(req: unknown, res: unknown, next: (error?: unknown) => void): void; } /** * Builds a framework-agnostic `(req, res, next)` request-capture handler for * hosts that register it globally via `app.use(...)` in their bootstrap — * required when the app uses `setGlobalPrefix(...)`, which scopes NestJS module * middleware so the built-in capture would only see `/`. Pair with * `TelescopeModule.forRoot({ registerRequestMiddleware: false })`. * * @example * const app = await NestFactory.create(AppModule); * app.use(telescopeRequestCapture(app.get(TelescopeService))); */ export declare function telescopeRequestCapture(service: TelescopeService, options?: Pick<TelescopeModuleOptions, 'requestCapture'>): (req: unknown, res: unknown, next: (error?: unknown) => void) => void; //# sourceMappingURL=telescope-request.middleware.d.ts.map