digitaltwin-core
Version:
Minimalist framework to collect and handle data in a Digital Twin project
62 lines • 2.86 kB
TypeScript
/**
* @fileoverview Component initialization utilities for the digital twin engine
*
* This module handles the setup and initialization of digital twin components,
* including database table creation and dependency injection.
*/
import type { Collector } from '../components/collector.js';
import type { Harvester } from '../components/harvester.js';
import type { AssetsManager } from '../components/assets_manager.js';
import type { DatabaseAdapter } from '../database/database_adapter.js';
import type { StorageService } from '../storage/storage_service.js';
/**
* Initializes data collection and processing components with required dependencies.
*
* This function sets up collectors and harvesters by:
* 1. Creating necessary database tables for each component
* 2. Running automatic schema migrations if enabled
* 3. Injecting database and storage service dependencies
*
* @param components - Array of collectors and harvesters to initialize
* @param database - Database adapter instance for data storage
* @param storage - Storage service instance for file operations
* @param autoMigration - Enable automatic schema migration (default: true)
*
* @throws {Error} When database table creation fails
*
* @example
* ```typescript
* const components = [weatherCollector, trafficHarvester];
* const database = new KnexDatabaseAdapter(config);
* const storage = new LocalStorageService();
*
* await initializeComponents(components, database, storage, true);
* // Components are now ready to process data
* ```
*/
export declare function initializeComponents(components: Array<Collector | Harvester>, database: DatabaseAdapter, storage: StorageService, autoMigration?: boolean): Promise<void>;
/**
* Initializes asset management components with required dependencies.
*
* Asset managers handle file-based resources (like 3D models, tilesets, maps)
* and require both database access for metadata and storage for file operations.
*
* @param assetsManagers - Array of asset managers to initialize
* @param database - Database adapter instance for metadata storage
* @param storage - Storage service instance for asset file operations
* @param autoMigration - Enable automatic schema migration (default: true)
*
* @throws {Error} When database table creation fails
*
* @example
* ```typescript
* const managers = [tilesetManager, pointCloudManager];
* const database = new KnexDatabaseAdapter(config);
* const storage = new OvhS3StorageService(credentials);
*
* await initializeAssetsManagers(managers, database, storage, true);
* // Asset managers are now ready to handle file operations
* ```
*/
export declare function initializeAssetsManagers(assetsManagers: AssetsManager[], database: DatabaseAdapter, storage: StorageService, autoMigration?: boolean): Promise<void>;
//# sourceMappingURL=initializer.d.ts.map