digitaltwin-core
Version:
Minimalist framework to collect and handle data in a Digital Twin project
63 lines • 2.12 kB
TypeScript
import type { Component, ScheduleRunnable, Servable } from './interfaces.js';
import type { DataResponse, HarvesterConfiguration } from './types.js';
import type { DataRecord } from '../types/data_record.js';
import type { DatabaseAdapter } from '../database/database_adapter.js';
import type { StorageService } from '../storage/storage_service.js';
import type { HttpMethod } from '../engine/endpoints.js';
/**
* Abstract Harvester class for processing collected data
*/
export declare abstract class Harvester implements Component<HarvesterConfiguration>, ScheduleRunnable, Servable {
protected db: DatabaseAdapter;
protected storage: StorageService;
setDependencies(db: DatabaseAdapter, storage: StorageService): void;
private _configCache?;
/**
* Users implement this to provide their basic configuration
*/
abstract getUserConfiguration(): HarvesterConfiguration;
/**
* Final configuration with defaults applied
* This is what the engine/scheduler use
*/
getConfiguration(): HarvesterConfiguration;
/**
* Override to make schedule optional based on trigger mode
*/
getSchedule(): string;
/**
* Allow subclasses to define custom schedule
*/
getCustomSchedule?(): string;
abstract harvest(sourceData: DataRecord | DataRecord[], dependenciesData: Record<string, DataRecord | DataRecord[] | null>): Promise<Buffer | Buffer[]>;
/**
* Main execution method - NOUVELLE VERSION SIMPLIFIÉE
*/
run(): Promise<boolean>;
/**
* Get source data within the specified range
*/
private getSourceData;
/**
* Get data from dependent components
*/
private getDependenciesData;
/**
* Store harvesting results
*/
private storeResults;
/**
* HTTP endpoints
*/
getEndpoints(): Array<{
method: HttpMethod;
path: string;
handler: (...args: any[]) => any;
responseType?: string;
}>;
/**
* Retrieve latest harvested data
*/
retrieve(): Promise<DataResponse>;
}
//# sourceMappingURL=harvester.d.ts.map