Data extraction API improvements.

This commit is contained in:
Henning Dieterichs
2023-03-24 14:06:22 +01:00
parent 904d0060ea
commit d45dfdaa71
5 changed files with 220 additions and 32 deletions

View File

@@ -53,6 +53,11 @@ export interface DataExtractor {
* Must be unique among all data extractors.
*/
id: string;
/**
* Filters the data to be extracted.
*/
dataCtor?: string;
getExtractions(
data: unknown,
extractionCollector: ExtractionCollector,
@@ -73,7 +78,11 @@ export interface DataExtractorContext {
*/
evalFn: <TEval>(expression: string) => TEval;
expression: string | undefined;
variablesInScope: Record<string, () => unknown>;
extract(value: unknown): VisualizationData | undefined;
}
export interface DataExtraction {
@@ -86,10 +95,12 @@ export interface DataExtraction {
* A unique id identifying this extraction among all extractions.
* Required to express extraction preferences.
*/
id: string;
id?: string;
/**
* A user friendly name of this extraction.
*/
name: string;
name?: string;
extractData(): VisualizationData;
}