Skip to content

Commit 904d006

Browse files
committed
2.4.0
1 parent 1b6fabf commit 904d006

24 files changed

+1838
-577
lines changed

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@
7676
"request": "launch",
7777
"name": "Run Dart samples",
7878
"program": "demos/dart/demo.dart"
79-
},
79+
}
8080
]
8181
}
Lines changed: 95 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,95 @@
1-
import {
2-
VisualizationData,
3-
DataExtractionResult,
4-
} from "../../DataExtractionResult";
5-
import { LoadDataExtractorsFn } from "./LoadDataExtractorsFn";
6-
7-
export interface DataExtractorApi {
8-
/**
9-
* Registers a single extractor.
10-
*/
11-
registerExtractor(extractor: DataExtractor): void;
12-
13-
/**
14-
* Registers multiple extractors.
15-
*/
16-
registerExtractors(extractors: DataExtractor[]): void;
17-
18-
/**
19-
* Extracts data from the result of `valueFn`.
20-
* @valueFn a function returning the value to extract the data from.
21-
* Is a function so that it's evaluation can depend on `evalFn`.
22-
*/
23-
getData(
24-
valueFn: () => unknown,
25-
evalFn: <T>(expression: string) => T,
26-
preferredDataExtractorId: string | undefined,
27-
variablesInScope: Record<string, unknown>
28-
): JSONString<DataResult>;
29-
30-
/**
31-
* Registers all default (built-in) extractors.
32-
* @preferExisting if `true`, existing extractors with the same id are not overwritten.
33-
*/
34-
registerDefaultExtractors(preferExisting?: boolean): void;
35-
36-
registerDataExtractorsSource(id: string, fn: LoadDataExtractorsFn): void;
37-
unregisterDataExtractorsSource(id: string): void;
38-
}
39-
40-
export type DataResult =
41-
| {
42-
kind: "Data";
43-
extractionResult: DataExtractionResult;
44-
}
45-
| { kind: "NoExtractors" }
46-
| { kind: "Error"; message: string };
47-
48-
export interface JSONString<T> extends String {
49-
__brand: { json: T };
50-
}
51-
52-
export interface DataExtractor {
53-
/**
54-
* Must be unique among all data extractors.
55-
*/
56-
id: string;
57-
getExtractions(
58-
data: unknown,
59-
extractionCollector: ExtractionCollector,
60-
context: DataExtractorContext
61-
): void;
62-
}
63-
64-
export interface ExtractionCollector {
65-
/**
66-
* Suggests a possible extraction.
67-
*/
68-
addExtraction(extraction: DataExtraction): void;
69-
}
70-
71-
export interface DataExtractorContext {
72-
/**
73-
* Evaluates an expression in the context of the active stack frame.
74-
*/
75-
evalFn: <TEval>(expression: string) => TEval;
76-
77-
variablesInScope: Record<string, () => unknown>;
78-
}
79-
80-
export interface DataExtraction {
81-
/**
82-
* Higher priorities are preferred.
83-
*/
84-
priority: number;
85-
86-
/**
87-
* A unique id identifying this extraction among all extractions.
88-
* Required to express extraction preferences.
89-
*/
90-
id: string;
91-
/**
92-
* A user friendly name of this extraction.
93-
*/
94-
name: string;
95-
extractData(): VisualizationData;
96-
}
1+
import {
2+
VisualizationData,
3+
DataExtractionResult,
4+
} from "../../DataExtractionResult";
5+
import { LoadDataExtractorsFn } from "./LoadDataExtractorsFn";
6+
7+
export interface DataExtractorApi {
8+
/**
9+
* Registers a single extractor.
10+
*/
11+
registerExtractor(extractor: DataExtractor): void;
12+
13+
/**
14+
* Registers multiple extractors.
15+
*/
16+
registerExtractors(extractors: DataExtractor[]): void;
17+
18+
/**
19+
* Extracts data from the result of `valueFn`.
20+
* @valueFn a function returning the value to extract the data from.
21+
* Is a function so that it's evaluation can depend on `evalFn`.
22+
*/
23+
getData(
24+
valueFn: () => unknown,
25+
evalFn: <T>(expression: string) => T,
26+
preferredDataExtractorId: string | undefined,
27+
variablesInScope: Record<string, unknown>
28+
): JSONString<DataResult>;
29+
30+
/**
31+
* Registers all default (built-in) extractors.
32+
* @preferExisting if `true`, existing extractors with the same id are not overwritten.
33+
*/
34+
registerDefaultExtractors(preferExisting?: boolean): void;
35+
36+
setDataExtractorFn(id: string, fn: LoadDataExtractorsFn | undefined): void;
37+
}
38+
39+
export type DataResult =
40+
| {
41+
kind: "Data";
42+
extractionResult: DataExtractionResult;
43+
}
44+
| { kind: "NoExtractors" }
45+
| { kind: "Error"; message: string };
46+
47+
export interface JSONString<T> extends String {
48+
__brand: { json: T };
49+
}
50+
51+
export interface DataExtractor {
52+
/**
53+
* Must be unique among all data extractors.
54+
*/
55+
id: string;
56+
getExtractions(
57+
data: unknown,
58+
extractionCollector: ExtractionCollector,
59+
context: DataExtractorContext
60+
): void;
61+
}
62+
63+
export interface ExtractionCollector {
64+
/**
65+
* Suggests a possible extraction.
66+
*/
67+
addExtraction(extraction: DataExtraction): void;
68+
}
69+
70+
export interface DataExtractorContext {
71+
/**
72+
* Evaluates an expression in the context of the active stack frame.
73+
*/
74+
evalFn: <TEval>(expression: string) => TEval;
75+
76+
variablesInScope: Record<string, () => unknown>;
77+
}
78+
79+
export interface DataExtraction {
80+
/**
81+
* Higher priorities are preferred.
82+
*/
83+
priority: number;
84+
85+
/**
86+
* A unique id identifying this extraction among all extractions.
87+
* Required to express extraction preferences.
88+
*/
89+
id: string;
90+
/**
91+
* A user friendly name of this extraction.
92+
*/
93+
name: string;
94+
extractData(): VisualizationData;
95+
}

0 commit comments

Comments
 (0)