import type { Application as ExpressApp } from 'express'; /** * Minimal service container interface for plugin use. * Matches the ServiceContainer API from node-express-suite. */ export interface IServiceContainer { register(key: string, factory: () => T, overwrite?: boolean): void; get(key: string): T; has(key: string): boolean; } /** * Narrowed set of App resources passed to subsystem plugins during * initialization. Uses broad/interface types so the definition can * live in brightchain-lib without importing concrete api-lib classes. */ export interface ISubsystemContext { /** The ServiceContainer for registering and resolving services. */ services: IServiceContainer; /** * The ApiRouter instance, or null if not available. * Plugins that wire routes should guard on this being non-null. */ apiRouter: any | null; /** The Express application instance for mounting middleware/routes. */ expressApp: ExpressApp; /** Environment configuration. */ environment: any; /** Block store from BrightChainDatabasePlugin. */ blockStore: any; /** Member store from BrightChainDatabasePlugin. */ memberStore: any; /** Energy store from BrightChainDatabasePlugin. */ energyStore: any; /** BrightDb instance from BrightChainDatabasePlugin. */ brightDb: any; /** * Get a model/collection from the document store by name. * Equivalent to App.getModel(). */ getModel(name: string): any; /** The EventNotificationSystem instance, or null. */ eventSystem: any | null; } /** * Shared interface for App subsystem plugins. * Implemented by each subsystem to encapsulate its initialization and teardown. */ export interface IAppSubsystemPlugin { /** Unique name identifying this subsystem (e.g., "email", "brighthub"). */ readonly name: string; /** * Whether initialization failure should be non-fatal. * When true (default), errors are logged and the App continues starting. * When false, errors propagate and abort App.start(). */ readonly isOptional?: boolean; /** * Initialize the subsystem: create services, register in the service * container, wire routes to the ApiRouter, etc. * * @returns `true` (or `void`/`undefined`) when the plugin started * normally; `false` when it intentionally skipped * initialization (e.g. a feature gate was off). The caller * uses this to decide whether to log a "ready" message. */ initialize(context: ISubsystemContext): Promise; /** * Optional teardown hook. Called in reverse registration order during * App.stop(). Errors are logged but do not prevent other plugins from * stopping. */ stop?(): Promise; } //# sourceMappingURL=appSubsystemPlugin.d.ts.map