import type { OnApplicationShutdown, OnModuleDestroy } from '@nestjs/common'; import type { Response } from 'express'; import type { MastraModuleOptions } from '../mastra.module.js'; /** * Service that manages graceful shutdown. * Tracks in-flight requests and waits for them to complete before shutdown. */ export declare class ShutdownService implements OnModuleDestroy, OnApplicationShutdown { private readonly options; private readonly logger; private readonly activeRequests; private readonly sseClients; private isShuttingDown; private shutdownResolve; constructor(options: MastraModuleOptions); /** * Check if the service is shutting down. * Use this to reject new requests during shutdown. */ get shuttingDown(): boolean; /** * Get the number of active requests. */ get activeRequestCount(): number; /** * Register a new request. * Returns a unique request ID for tracking. */ registerRequest(path: string): string; /** * Mark a request as complete. */ completeRequest(requestId: string): void; /** * Register an SSE client for shutdown notifications. * Returns an unregister function. */ registerSseClient(response: Response): () => void; /** * Notify all connected SSE clients about shutdown. */ notifySseClients(): void; /** * Called when the module is being destroyed. * Marks the service as shutting down. */ onModuleDestroy(): void; /** * Called when the application is shutting down. * Waits for in-flight requests to complete. */ onApplicationShutdown(signal?: string): Promise; } //# sourceMappingURL=shutdown.service.d.ts.map