/** * NitroStack Lifecycle Interfaces * * NestJS-style lifecycle hook interfaces for modules, controllers, and providers. */ export interface OnModuleInit { onModuleInit(): Promise | void; } export interface OnApplicationBootstrap { onApplicationBootstrap(): Promise | void; } export interface OnModuleDestroy { onModuleDestroy(): Promise | void; } export interface BeforeApplicationShutdown { beforeApplicationShutdown(signal?: string): Promise | void; } export interface OnApplicationShutdown { onApplicationShutdown(signal?: string): Promise | void; } export type LifecycleHookName = 'onModuleInit' | 'onApplicationBootstrap' | 'onModuleDestroy' | 'beforeApplicationShutdown' | 'onApplicationShutdown'; export type LifecycleHookOptions = { safe?: boolean; logger?: { error(msg: string, meta?: unknown): void; }; }; /** * Triggers a lifecycle hook sequentially across all instances that implement it. * * Note: callers typically pass `DIContainer.getInstances()`, which includes every * resolved DI entry -- providers, controllers, modules, and values registered via * `registerValue()` (e.g. the logger or the server itself). Only instances that * actually expose a matching hook method are invoked; everything else (primitives, * plain values without the hook) is skipped. Keep this in mind if a registered * value coincidentally defines a method named like a lifecycle hook. * * @param instances Array of resolved instances to check * @param hookName Name of the hook method (e.g. 'onModuleInit') * @param options Optional safe-mode / logger settings * @param args Arguments to pass to the hook method */ export declare function triggerLifecycleHook(instances: unknown[], hookName: LifecycleHookName, options?: LifecycleHookOptions, ...args: unknown[]): Promise; //# sourceMappingURL=lifecycle.d.ts.map