UNPKG

matterbridge-roborock-vacuum-plugin

Version:
93 lines 4.08 kB
import { AnsiLogger } from 'matterbridge/logger'; import { LocalStorage } from 'node-persist'; import { PlatformConfigManager } from '../platform/platformConfigManager.js'; import { RoborockAuthenticateApi } from '../roborockCommunication/api/authClient.js'; import { RoborockIoTApi } from '../roborockCommunication/api/iotClient.js'; import { UserData } from '../roborockCommunication/models/index.js'; import type { Factory } from '../types/index.js'; import { WssSendSnackbarMessage } from '../types/WssSendSnackbarMessage.js'; import { AreaManagementService } from './areaManagementService.js'; import { AuthenticationCoordinator } from './authentication/AuthenticationCoordinator.js'; import ClientManager from './clientManager.js'; import { ConnectionService } from './connectionService.js'; import { DeviceManagementService } from './deviceManagementService.js'; import { MessageRoutingService } from './messageRoutingService.js'; import { PollingService } from './pollingService.js'; /** Configuration for ServiceContainer. */ export interface ServiceContainerConfig { baseUrl: string; refreshInterval: number; authenticateApiFactory?: (logger: AnsiLogger, baseUrl: string) => RoborockAuthenticateApi; iotApiFactory?: Factory<UserData, RoborockIoTApi>; persist: LocalStorage; configManager: PlatformConfigManager; toastMessage: WssSendSnackbarMessage; } /** DI container managing service lifecycle. Services are lazily created and cached. */ export declare class ServiceContainer { private readonly logger; private readonly config; private authenticationCoordinator; private deviceManagementService; private areaManagementService; private messageRoutingService; private pollingService; private connectionService; private readonly authenticateApi; private readonly authenticateApiFactory; private readonly iotApiFactory; private readonly clientManager; private readonly authGateway; private userdata?; private iotApi?; constructor(logger: AnsiLogger, config: ServiceContainerConfig); /** Set user data after login to enable device services. */ setUserData(userdata: UserData): void; /** Get or create AuthenticationCoordinator singleton. */ getAuthenticationCoordinator(): AuthenticationCoordinator; /** Get or create PollingService singleton. */ getPollingService(): PollingService; /** Get or create DeviceManagementService singleton. Requires setUserData() after login. */ getDeviceManagementService(): DeviceManagementService; /** * Get or create the AreaManagementService singleton. * * Note: Requires user authentication. Call setUserData() after login. * * @returns AreaManagementService instance */ getAreaManagementService(): AreaManagementService; /** * Get or create the MessageRoutingService singleton. * * Note: Requires user authentication. Call setUserData() after login. * * @returns MessageRoutingService instance */ getMessageRoutingService(): MessageRoutingService; getConnectionService(): ConnectionService; synchronizeMessageClients(): void; /** * Get all services as a bundle. * Useful for passing to RoborockService facade. */ getAllServices(): { authenticationCoordinator: AuthenticationCoordinator; deviceManagement: DeviceManagementService; areaManagement: AreaManagementService; messageRouting: MessageRoutingService; polling: PollingService; connection: ConnectionService; }; /** Destroy all services and clear cached instances. */ destroy(): Promise<void>; /** Get logger instance. */ getLogger(): AnsiLogger; /** Get ClientManager instance. */ getClientManager(): ClientManager; /** Get current user data (undefined if not authenticated). */ getUserData(): UserData | undefined; /** Get IoT API (undefined if not authenticated). */ getIotApi(): RoborockIoTApi | undefined; } //# sourceMappingURL=serviceContainer.d.ts.map