import type { LoggerBackend } from '../lib/logger.js'; export declare enum ServiceState { Uninitialized = "uninitialized", Initialized = "initialized", ShutDown = "shutdown" } /** * Abstract base class for all services. * * Provides: * - Constructor injection of config and logger * - Lifecycle hooks (initialize/shutdown) with state tracking * - ensureInitialized() guard for methods that require initialization * - Consistent naming (className from constructor.name) * * @example * class UserService extends BaseService { * constructor(config: ServiceConfig, logger: LoggerBackend) { * super(config, logger); * } * * async initialize(): Promise { * // connect to DB, warm up caches, etc. * } * } */ export declare abstract class BaseService { protected readonly config: TConfig; protected readonly logger: LoggerBackend; protected readonly name: string; private _state; constructor(config: TConfig, logger: LoggerBackend); /** * Current lifecycle state. */ getState(): ServiceState; /** * Guard: throws if service has not been initialized. * Call at the start of methods that depend on initialization. */ protected ensureInitialized(): void; /** * Called once when the application starts. * Override to connect to databases, warm up caches, or validate config. */ initialize(): Promise; /** * Called once when the application shuts down. * Override to close connections, flush buffers, or clean up resources. */ shutdown(): Promise; } //# sourceMappingURL=base.service.d.ts.map